刷新门店价格修改

This commit is contained in:
苏尹岚
2020-06-03 09:54:37 +08:00
parent d7679ef6ee
commit 1eb43ea9b9
3 changed files with 17 additions and 9 deletions

View File

@@ -4702,11 +4702,13 @@ func result2Orders(ctx *jxcontext.Context, result *jdshopapi.AllOrdersResult) (o
order.VendorStoreID = storeMaps[0].VendorStoreID
}
} else {
// storeList, err := GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false)
// if err != nil {
// globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error())
// continue
// }
storeList, err := GetStoreListByLocation(ctx, jxutils.IntCoordinate2Standard(order.ConsigneeLng), jxutils.IntCoordinate2Standard(order.ConsigneeLat), 5000, false)
if err != nil {
globals.SugarLogger.Debugf("jds GetStoreListByLocation error: %v", err.Error())
continue
}
order.StoreID = storeList[0].ID
order.StoreName = storeList[0].Name
}
//如果是暂停,表示是预订单
if jdsOrder.OrderStatus == jdshopapi.JdsOrderStatusPause {

View File

@@ -1618,7 +1618,7 @@ func UploadJdsImage(ctx *jxcontext.Context) (err error) {
return err
}
func RefreshJXPriceChange(ctx *jxcontext.Context) (hint string, err error) {
func RefreshJXPriceChange(ctx *jxcontext.Context, storeID int) (hint string, err error) {
db := dao.GetDB()
var (
stores []*model.Store
@@ -1630,9 +1630,12 @@ func RefreshJXPriceChange(ctx *jxcontext.Context) (hint string, err error) {
SELECT *
FROM store
WHERE deleted_at = ? AND status <> ?
AND id in (?,?,?)
`
sqlParams := []interface{}{utils.DefaultTimeValue, model.StoreStatusDisabled, 100118, 100205, 100274}
sqlParams := []interface{}{utils.DefaultTimeValue, model.StoreStatusDisabled}
if storeID != 0 {
sql += " AND id = ?"
sqlParams = append(sqlParams, storeID)
}
err = dao.GetRows(db, &stores, sql, sqlParams)
task := tasksch.NewParallelTask("刷新门店价格", tasksch.NewParallelConfig().SetIsContinueWhenError(isContinueWhenError), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
@@ -1672,6 +1675,8 @@ func RefreshJXPriceChange(ctx *jxcontext.Context) (hint string, err error) {
skuBindInfos = append(skuBindInfos, skuBindInfo)
}
cms.UpdateStoresSkusByBind(ctx, task, skuBindInfos, isAsync, isContinueWhenError, false)
store.PayPercentage = 100
dao.UpdateEntity(db, store, "PayPercentage")
return retVal, err
}, stores)
tasksch.HandleTask(task, nil, true).Run()

View File

@@ -385,12 +385,13 @@ func (c *TempOpController) UploadJdsImage() {
// @Title 京西刷新调价包和门店价格
// @Description 京西刷新调价包和门店价格
// @Param token header string true "认证token"
// @Param storeID formData int false "门店ID"
// @Success 200 {object} controllers.CallResult
// @Failure 200 {object} controllers.CallResult
// @router /RefreshJXPriceChange [post]
func (c *TempOpController) RefreshJXPriceChange() {
c.callRefreshJXPriceChange(func(params *tTempopRefreshJXPriceChangeParams) (retVal interface{}, errCode string, err error) {
retVal, err = tempop.RefreshJXPriceChange(params.Ctx)
retVal, err = tempop.RefreshJXPriceChange(params.Ctx, params.StoreID)
return retVal, "", err
})
}