- handle special chars in store name.

This commit is contained in:
gazebo
2018-11-07 18:12:32 +08:00
parent e5510db6ea
commit a5d22c3655
4 changed files with 31 additions and 19 deletions

View File

@@ -487,7 +487,7 @@ func GetJdPromotions(ctx *jxcontext.Context, keyword string, params map[string]i
t1.begin_at,
t1.end_at,
t1.advertising,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"storeID":', t2.store_id, ', "name":"', t22.name, '"}')), "]") store_str,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"storeID":', t2.store_id, ', "name":"', REPLACE(REPLACE(t22.name, '\t', ''), '"', ''), '"}')), "]") store_str,
CONCAT("[", GROUP_CONCAT(DISTINCT CONCAT('{"skuID":', t3.sku_id, ', "priceType":', t3.price_type, ', "price":', t3.price, ', "limitSkuCount":', t3.limit_sku_count, ', "isLock":', t3.is_lock, '}')), "]") sku_price_str
FROM promotion t1
JOIN promotion_store t2 ON t1.id = t2.promotion_id
@@ -843,24 +843,26 @@ func OnStoreStockMsg(msg *jdapi.CallbackStoreStockMsg) (retVal *jdapi.CallbackRe
sku := &model.Sku{}
sku.JdID = msg.SkuId
if err = dao.GetEntity(db, sku, model.FieldJdID); err == nil {
if msg.Vendibility == 1 {
vendibility := &jdapi.StockVendibility{
OutSkuId: utils.Int2Str(sku.ID),
DoSale: true,
go func() {
if msg.Vendibility == 1 {
vendibility := &jdapi.StockVendibility{
OutSkuId: utils.Int2Str(sku.ID),
DoSale: true,
}
_, err = api.JdAPI.BatchUpdateVendibility("", msg.StationNo, []*jdapi.StockVendibility{
vendibility,
}, userName)
}
_, err = api.JdAPI.BatchUpdateVendibility("", msg.StationNo, []*jdapi.StockVendibility{
vendibility,
}, userName)
}
if !msg.Have {
stock := &jdapi.SkuStock{
OutSkuId: utils.Int2Str(sku.ID),
StockQty: model.MaxStoreSkuStockQty,
if !msg.Have {
stock := &jdapi.SkuStock{
OutSkuId: utils.Int2Str(sku.ID),
StockQty: model.MaxStoreSkuStockQty,
}
_, err = api.JdAPI.BatchUpdateCurrentQtys("", msg.StationNo, []*jdapi.SkuStock{
stock,
}, userName)
}
_, err = api.JdAPI.BatchUpdateCurrentQtys("", msg.StationNo, []*jdapi.SkuStock{
stock,
}, userName)
}
}()
}
}
return jdapi.Err2CallbackResponse(err, "")