1
This commit is contained in:
59
business/jxstore/cms/store_responsible_person_config.go
Normal file
59
business/jxstore/cms/store_responsible_person_config.go
Normal file
@@ -0,0 +1,59 @@
|
||||
package cms
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"git.rosy.net.cn/jx-callback/business/model/dao"
|
||||
"git.rosy.net.cn/jx-callback/globals"
|
||||
)
|
||||
|
||||
// 更新门店负责人信息
|
||||
func UpdateStoreOperatorConfig() {
|
||||
db := dao.GetDB()
|
||||
store, err := dao.GetStoreList(db, nil, nil, nil, nil, nil, "")
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debug("定时任务,获取所有门店信息错误")
|
||||
return
|
||||
}
|
||||
|
||||
userData := make(map[string][]map[string]string, 0)
|
||||
for _, v := range store {
|
||||
storeDetail, err := dao.GetStoreDetail(dao.GetDB(), v.ID, 0, "")
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debug("定时任务,更新门店负责人,美团负责人.....错误", v.ID)
|
||||
return
|
||||
}
|
||||
if storeDetail.MarketManPhone != "" { // 平台负责人jx
|
||||
if _, ok := userData["jx"]; ok {
|
||||
userData["jx"] = append(userData["jx"], map[string]string{storeDetail.MarketManName: storeDetail.MarketManPhone})
|
||||
}
|
||||
}
|
||||
if storeDetail.OperatorPhone != "" { // 京东负责人电话
|
||||
if _, ok := userData["jd"]; ok {
|
||||
userData["jd"] = append(userData["jd"], map[string]string{storeDetail.OperatorName: storeDetail.OperatorPhone})
|
||||
}
|
||||
}
|
||||
if storeDetail.OperatorPhone2 != "" { // 美团负责人电话
|
||||
if _, ok := userData["jd"]; ok {
|
||||
userData["mt"] = append(userData["mt"], map[string]string{storeDetail.OperatorName2: storeDetail.OperatorPhone2})
|
||||
}
|
||||
}
|
||||
if storeDetail.OperatorPhone3 != "" { // 饿了么负责人电话
|
||||
if _, ok := userData["eb"]; ok {
|
||||
userData["eb"] = append(userData["eb"], map[string]string{storeDetail.OperatorName3: storeDetail.OperatorPhone3})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
userData["test_write"] = nil
|
||||
// 写入配置
|
||||
byteData, err := json.Marshal(userData)
|
||||
if err != nil {
|
||||
globals.SugarLogger.Debug("Marshal err :", err)
|
||||
return
|
||||
}
|
||||
if err := dao.UpdateOperatorConfig(string(byteData)); err != nil {
|
||||
globals.SugarLogger.Debug("update new_config err :", err)
|
||||
return
|
||||
}
|
||||
return
|
||||
}
|
||||
@@ -178,6 +178,13 @@ func Init() {
|
||||
delivery.GetOrderRiderInfoToPlatform("")
|
||||
}, 10*time.Second, 5*time.Minute)
|
||||
|
||||
// 定时任务更新负责人信息
|
||||
ScheduleTimerFunc("RefreshStoreOperator", func() {
|
||||
cms.UpdateStoreOperatorConfig()
|
||||
}, []string{
|
||||
"03:30:00",
|
||||
})
|
||||
|
||||
ScheduleTimerFuncByInterval(func() {
|
||||
defsch.FixedScheduler.ConfirmSelfTakeOrders(jxcontext.AdminCtx, []int{model.VendorIDJD}, time.Now().Add(-48*time.Hour), time.Now().Add(-30*time.Minute), true, true)
|
||||
}, 5*time.Second, 10*time.Minute)
|
||||
|
||||
@@ -2,7 +2,6 @@ package dao
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils/errlist"
|
||||
|
||||
"git.rosy.net.cn/baseapi/utils"
|
||||
@@ -60,3 +59,10 @@ func GetSysConfigAsInt64(db *DaoDB, key string) (value int64, err error) {
|
||||
}
|
||||
return value, err
|
||||
}
|
||||
|
||||
// 修改配置
|
||||
func UpdateOperatorConfig(param string) error {
|
||||
sql := `UPDATE new_config SET value = ? WHERE type = ? AND key = ?`
|
||||
_, err := ExecuteSQL(GetDB(), sql, []interface{}{"Sys", "FZR", param})
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -58,10 +58,12 @@ func pay4OrderByTL(ctx *jxcontext.Context, order *model.GoodsOrder, payType int,
|
||||
if vendorPayType == tonglianpayapi.PayTypeZfbJS || vendorPayType == tonglianpayapi.PayTypeZfbApp ||vendorPayType == tonglianpayapi.PayTypeZfbQrcode {
|
||||
if authInfo, err := ctx.GetV2AuthInfo(); err == nil {
|
||||
param.Acct = authInfo.GetAuthID()
|
||||
globals.SugarLogger.Debug("==============1",authInfo)
|
||||
}
|
||||
if param.Acct == "" {
|
||||
return nil, fmt.Errorf("未找到用户的认证ID!")
|
||||
}
|
||||
globals.SugarLogger.Debug("==============2",param)
|
||||
}
|
||||
if vendorPayType == tonglianpayapi.PayTypeH5 {
|
||||
param2 := &tonglianpayapi.CreateH5UnitorderOrderParam{
|
||||
|
||||
Reference in New Issue
Block a user