This commit is contained in:
邹宗楠
2023-07-04 13:49:55 +08:00
parent 73b63e67fe
commit 811eaee723
2 changed files with 26 additions and 24 deletions

View File

@@ -698,7 +698,13 @@ func syncStoreSkuNew(ctx *jxcontext.Context, parentTask tasksch.ITask, causeFlag
// api.JdShop2API.SetCookieWithStr(configs[0].Value)
// }
}
globals.SugarLogger.Debugf("createList ==== := %s", utils.Format4Output(createList, false))
globals.SugarLogger.Debugf("updateList ==== := %s", utils.Format4Output(updateList, false))
globals.SugarLogger.Debugf("deleteList ==== := %s", utils.Format4Output(deleteList, false))
globals.SugarLogger.Debugf("stockList ==== := %s", utils.Format4Output(stockList, false))
globals.SugarLogger.Debugf("onlineList ==== := %s", utils.Format4Output(onlineList, false))
globals.SugarLogger.Debugf("offlineList ==== := %s", utils.Format4Output(offlineList, false))
globals.SugarLogger.Debugf("priceList ==== := %s", utils.Format4Output(priceList, false))
task := tasksch.NewParallelTask("syncStoreSkuNew", tasksch.NewParallelConfig().SetParallelCount(1).SetIsContinueWhenError(isContinueWhenError2), ctx,
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
step := batchItemList[0].(int)

View File

@@ -89,7 +89,7 @@ func (c *TaoBaoVegetableController) OrderStatus() {
}
// 获取body参数
order, err := api.TaoVegetableApi.ReaderOrderInfo(c.Ctx.Request)
order, body, err := api.TaoVegetableApi.ReaderOrderInfo(c.Ctx.Request)
globals.SugarLogger.Debugf("order_status ReaderOrderInfo:= %s", utils.Format4Output(order, false))
globals.SugarLogger.Debugf("order_status ReaderOrderInfo:= %s", utils.Format4Output(order, false))
if err != nil {
@@ -99,16 +99,16 @@ func (c *TaoBaoVegetableController) OrderStatus() {
}
// 验签
sign := Sign(values, utils.Format4Output(order, false), api.TaoVegetableApi.GetAppSecret())
sign := Sign(values, body, api.TaoVegetableApi.GetAppSecret())
if sign != values.Get("sign") {
c.Data["json"] = tao_vegetable.CallBackResultSign(fmt.Errorf("非法签名"))
c.ServeJSON()
return
} /*else {
} else {
c.Data["json"] = tao_vegetable.CallBackResultSign(nil)
c.ServeJSON()
return
}*/
}
callbackResponse := taoVegetable.OnCallbackMsg(tao_vegetable.OrderStatusChange, utils.Int64ToStr(order.BizOrderId), order)
c.Data["json"] = callbackResponse
@@ -130,7 +130,7 @@ func (c *TaoBaoVegetableController) ApplyCancelOrder() {
return
}
afsOrder, err := api.TaoVegetableApi.UserApplyRefund(c.Ctx.Request)
afsOrder, body, err := api.TaoVegetableApi.UserApplyRefund(c.Ctx.Request)
globals.SugarLogger.Debugf("ApplyCancelOrder := %s", utils.Format4Output(afsOrder, false))
globals.SugarLogger.Debugf("ApplyCancelOrder err := %s", utils.Format4Output(err, false))
if err != nil {
@@ -141,7 +141,7 @@ func (c *TaoBaoVegetableController) ApplyCancelOrder() {
}
// 验签 FFF779F16365992BD721C9C1A027F03C
sign := Sign(values, utils.Format4Output(afsOrder, false), api.TaoVegetableApi.GetAppSecret())
sign := Sign(values, body, api.TaoVegetableApi.GetAppSecret())
if sign != values.Get("sign") { // 76626F983F0F7E4A159AD64F9B13B332
c.Data["json"] = tao_vegetable.CallBackResultSign(fmt.Errorf("非法签名"))
c.ServeJSON()
@@ -172,7 +172,7 @@ func (c *TaoBaoVegetableController) UserCancelRefund() {
return
}
afsOrder, err := api.TaoVegetableApi.UserCancelRefundApply(c.Ctx.Request)
afsOrder, body, err := api.TaoVegetableApi.UserCancelRefundApply(c.Ctx.Request)
globals.SugarLogger.Debugf("UserCancelRefund := %s", utils.Format4Output(afsOrder, false))
globals.SugarLogger.Debugf("UserCancelRefund err := %s", utils.Format4Output(err, false))
if err != nil {
@@ -183,16 +183,16 @@ func (c *TaoBaoVegetableController) UserCancelRefund() {
}
// 验签
sign := Sign(values, utils.Format4Output(afsOrder, false), api.TaoVegetableApi.GetAppSecret())
sign := Sign(values, body, api.TaoVegetableApi.GetAppSecret())
if sign != values.Get("sign") {
c.Data["json"] = tao_vegetable.CallBackResultSign(fmt.Errorf("非法签名"))
c.ServeJSON()
return
} /*else {
} else {
c.Data["json"] = tao_vegetable.CallBackResultSign(nil)
c.ServeJSON()
return
}*/
}
callbackResponse := taoVegetable.OnCallbackMsg(tao_vegetable.OrderStatusCancelAfs, afsOrder.OutOrderId, afsOrder)
c.Data["json"] = callbackResponse
@@ -214,7 +214,7 @@ func (c *TaoBaoVegetableController) CancelOnSaleRefundOrder() {
return
}
afsOrder, err := api.TaoVegetableApi.OnSaleRefundOrder(c.Ctx.Request)
afsOrder, body, err := api.TaoVegetableApi.OnSaleRefundOrder(c.Ctx.Request)
globals.SugarLogger.Debugf("CancelOnSaleRefundOrder := %s", utils.Format4Output(afsOrder, false))
globals.SugarLogger.Debugf("CancelOnSaleRefundOrder err := %s", utils.Format4Output(err, false))
if err != nil {
@@ -225,16 +225,16 @@ func (c *TaoBaoVegetableController) CancelOnSaleRefundOrder() {
}
// 验签
sign := Sign(values, utils.Format4Output(afsOrder, false), api.TaoVegetableApi.GetAppSecret())
sign := Sign(values, body, api.TaoVegetableApi.GetAppSecret())
if sign != values.Get("sign") {
c.Data["json"] = tao_vegetable.CallBackResultSign(fmt.Errorf("非法签名"))
c.ServeJSON()
return
} /*else {
} else {
c.Data["json"] = tao_vegetable.CallBackResultSign(nil)
c.ServeJSON()
return
}*/
}
callbackResponse := taoVegetable.OnCallbackMsg(tao_vegetable.OrderStatusOnSaleCancel, utils.Int64ToStr(afsOrder.PartCancelRequest.BizOrderId), afsOrder)
c.Data["json"] = callbackResponse
@@ -256,7 +256,7 @@ func (c *TaoBaoVegetableController) RefundOrderSuccess() {
return
}
refundSuccess, err := api.TaoVegetableApi.RefundOrderFinish(c.Ctx.Request)
refundSuccess, body, err := api.TaoVegetableApi.RefundOrderFinish(c.Ctx.Request)
globals.SugarLogger.Debugf("RefundOrderSuccess := %s", utils.Format4Output(refundSuccess, false))
globals.SugarLogger.Debugf("RefundOrderSuccess err := %s", utils.Format4Output(err, false))
if err != nil {
@@ -266,16 +266,16 @@ func (c *TaoBaoVegetableController) RefundOrderSuccess() {
return
}
// 验签
sign := Sign(values, utils.Format4Output(refundSuccess, false), api.TaoVegetableApi.GetAppSecret())
sign := Sign(values, body, api.TaoVegetableApi.GetAppSecret())
if sign != values.Get("sign") {
c.Data["json"] = tao_vegetable.CallBackResultSign(fmt.Errorf("非法签名"))
c.ServeJSON()
return
} /*else {
} else {
c.Data["json"] = tao_vegetable.CallBackResultSign(nil)
c.ServeJSON()
return
}*/
}
callbackResponse := taoVegetable.OnCallbackMsg(tao_vegetable.OrderStatusRefundSuccess, refundSuccess.OutSubOrderId, refundSuccess)
c.Data["json"] = callbackResponse
@@ -293,10 +293,6 @@ func Sign(param url.Values, data, secret string) string {
}
sort.Strings(publicParam)
resultParam := strings.ReplaceAll(strings.ReplaceAll(strings.ReplaceAll(data, "\n", ""), "\t", ""), " ", "")
if strings.Contains(resultParam, `\u0026`) {
resultParam = strings.ReplaceAll(resultParam, `\u0026`, "&")
}
cc := secret + strings.Join(publicParam, "") + resultParam + secret
cc := secret + strings.Join(publicParam, "") + data + secret
return fmt.Sprintf("%X", md5.Sum([]byte(cc)))
}