1
This commit is contained in:
@@ -46,23 +46,35 @@ func OnCallbackMsg(msg *mtwmapi.CallbackMsg, msgType string) (response *mtwmapi.
|
||||
return nil
|
||||
}
|
||||
if len(dataMap) != 0 {
|
||||
var storeMap = make(map[string]map[int][]string, 0)
|
||||
var skuStatus = make(map[int][]string, 0)
|
||||
for _, v := range dataMap {
|
||||
if v.AppFoodCode != "" && v.AppPoiCode != "" {
|
||||
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), v.AppPoiCode, model.VendorIDMTWM, utils.Int2Str(v.AppId))
|
||||
if storeDetail != nil {
|
||||
param := []interface{}{}
|
||||
switch v.DiffContents.IsSoldOut.Result {
|
||||
skuStatus[v.DiffContents.IsSoldOut.Result] = append(skuStatus[v.DiffContents.IsSoldOut.Result], v.AppFoodCode)
|
||||
storeMap[v.AppPoiCode] = skuStatus
|
||||
}
|
||||
}
|
||||
for k, v := range storeMap {
|
||||
storeDetail, _ := dao.GetStoreDetailByVendorStoreID(dao.GetDB(), k, model.VendorIDMTWM, "")
|
||||
if storeDetail != nil {
|
||||
for k2, v2 := range v {
|
||||
switch k2 {
|
||||
case 1: // 下架
|
||||
param = append(param, 0)
|
||||
param := []interface{}{}
|
||||
param = append(param, 0, mtwmapi.MsgTypeSkuUpdate, storeDetail.ID, v2)
|
||||
sql := `UPDATE store_sku_bind SET status = ?,last_operator = ? WHERE store_id = ? AND sku_id IN` + "(" + dao.GenQuestionMarks(len(v2)) + ")"
|
||||
dao.ExecuteSQL(dao.GetDB(), sql, param...)
|
||||
case 0: // 上架
|
||||
param = append(param, 1)
|
||||
param := []interface{}{}
|
||||
param = append(param, 1, mtwmapi.MsgTypeSkuUpdate, storeDetail.ID, v2)
|
||||
sql := `UPDATE store_sku_bind SET status = ?,last_operator = ? WHERE store_id = ? AND sku_id IN` + "(" + dao.GenQuestionMarks(len(v2)) + ")"
|
||||
dao.ExecuteSQL(dao.GetDB(), sql, param...)
|
||||
}
|
||||
param = append(param, mtwmapi.MsgTypeSkuUpdate, storeDetail.ID, v.AppFoodCode)
|
||||
sql := `UPDATE store_sku_bind SET status = ?,last_operator = ? WHERE store_id = ? AND sku_id = ? `
|
||||
dao.ExecuteSQL(dao.GetDB(), sql, param...)
|
||||
}
|
||||
}
|
||||
}
|
||||
globals.SugarLogger.Debugf("---------storeMap : %s", utils.Format4Output(storeMap, false))
|
||||
globals.SugarLogger.Debugf("---------skuStatus : %s", utils.Format4Output(skuStatus, false))
|
||||
}
|
||||
return mtwmapi.Err2CallbackResponse(nil, "")
|
||||
} else {
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"git.rosy.net.cn/baseapi/platformapi/dingdingapi"
|
||||
"git.rosy.net.cn/jx-callback/business/jxstore/cms"
|
||||
"git.rosy.net.cn/jx-callback/business/jxutils/ddmsg"
|
||||
beego "github.com/astaxie/beego/server/web"
|
||||
"math"
|
||||
@@ -477,6 +478,7 @@ func (c *PurchaseHandler) UpdateStoreOpTime(ctx *jxcontext.Context, vendorOrgCod
|
||||
err = getAPI(vendorOrgCode, storeID, vendorStoreID).PoiShipTimeUpdate(vendorStoreID, shippingTime)
|
||||
}
|
||||
}
|
||||
cms.AddEventDetail(dao.GetDB(), ctx, model.OperateUpdate, model.VendorIDMTWM, model.ThingTypeStore, storeID, "修改前:", shippingTime)
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user