Merge remote-tracking branch 'origin/jdshop' into qidongsheng
This commit is contained in:
@@ -1283,7 +1283,16 @@ func TransferJdsOrder(ctx *jxcontext.Context, vendorOrderID string, storeID int)
|
||||
return "", fmt.Errorf("未查询到该门店对应的平台信息!门店:[%v]", order.StoreID)
|
||||
}
|
||||
if len(order.VendorOrderID) > 12 {
|
||||
suffix := utils.Str2Int(order.VendorOrderID[12:len(order.VendorOrderID)])
|
||||
var goodsOrders []*model.GoodsOrder
|
||||
sql := `
|
||||
SELECT * FROM goods_order WHERE vendor_order_id2 = ? ORDER BY vendor_order_id DESC
|
||||
`
|
||||
sqlParams := []interface{}{order.VendorOrderID2}
|
||||
err = dao.GetRows(db, &goodsOrders, sql, sqlParams)
|
||||
if goodsOrders[0].Status != model.OrderStatusCanceled {
|
||||
err = jdshop.ChangeOrderStatus(goodsOrders[0].VendorOrderID, model.OrderStatusCanceled, "订单转移被取消")
|
||||
}
|
||||
suffix := utils.Str2Int(goodsOrders[0].VendorOrderID[12:len(goodsOrders[0].VendorOrderID)])
|
||||
suffix++
|
||||
order.VendorOrderID = utils.Int64ToStr(utils.Str2Int64(order.VendorOrderID2)*100000) + utils.Int2Str(suffix)
|
||||
}
|
||||
|
||||
@@ -4669,10 +4669,22 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto
|
||||
return true, err
|
||||
}
|
||||
|
||||
func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSkuAudit, status int, isAsync, isContinueWhenError bool) (hint string, err error) {
|
||||
func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSkuAudit, status int, isAsync, isContinueWhenError bool) (storeSkuAudits2 []*model.StoreSkuAudit, hint string, err error) {
|
||||
db := dao.GetDB()
|
||||
if status == model.StoreAuditStatusOnline {
|
||||
return "", fmt.Errorf("审核标志不正确!")
|
||||
return nil, "", fmt.Errorf("审核标志不正确!")
|
||||
}
|
||||
//证明是预审核
|
||||
if status == 2 {
|
||||
for _, v := range storeSkuAudits {
|
||||
skuList, _ := dao.GetStoreSkusByNameIDs(db, []int{v.StoreID}, v.NameID)
|
||||
if len(skuList) > 0 {
|
||||
if int64(v.AuditPrice) > skuList[0].UnitPrice*2 {
|
||||
storeSkuAudits2 = append(storeSkuAudits2, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
return storeSkuAudits2, "", err
|
||||
}
|
||||
task := tasksch.NewParallelTask("StoreSkuPriceAudit", tasksch.NewParallelConfig().SetParallelCount(5).SetIsContinueWhenError(isContinueWhenError), ctx,
|
||||
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
|
||||
@@ -4751,5 +4763,5 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeSkuAudits []*model.StoreSku
|
||||
_, err = task.GetResult(0)
|
||||
hint = "1"
|
||||
}
|
||||
return hint, err
|
||||
return nil, hint, err
|
||||
}
|
||||
|
||||
@@ -876,7 +876,7 @@ func (c *StoreSkuController) GetStoreSkuAudit() {
|
||||
// @Description 审核商品
|
||||
// @Param token header string true "认证token"
|
||||
// @Param payload formData string true "json数据,storeskuaudit对象"
|
||||
// @Param status formData int false "审核标志,1通过,-1 不通过"
|
||||
// @Param status formData int false "审核标志,1通过,-1 不通过,2 预审核"
|
||||
// @Param isAsync formData bool false "是否异步,缺省是同步"
|
||||
// @Param isContinueWhenError formData bool false "单个同步失败是否继续,缺省false"
|
||||
// @Success 200 {object} controllers.CallResult
|
||||
@@ -888,7 +888,11 @@ func (c *StoreSkuController) StoreSkuPriceAudit() {
|
||||
if err = jxutils.Strings2Objs(params.Payload, &storeSkuAudits); err != nil {
|
||||
return retVal, "", err
|
||||
}
|
||||
retVal, err = cms.StoreSkuPriceAudit(params.Ctx, storeSkuAudits, params.Status, params.IsAsync, params.IsContinueWhenError)
|
||||
retVal, hint, err := cms.StoreSkuPriceAudit(params.Ctx, storeSkuAudits, params.Status, params.IsAsync, params.IsContinueWhenError)
|
||||
if hint != "" {
|
||||
return hint, "", err
|
||||
} else {
|
||||
return retVal, "", err
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user