Merge branch 'jdshop' of https://e.coding.net/rosydev/jx-callback into jdshop

This commit is contained in:
richboo111
2023-07-18 10:50:17 +08:00
8 changed files with 21 additions and 36 deletions

View File

@@ -80,6 +80,7 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
if err == nil || dao.IsNoRowsError(err) {
isNewComment := false
if dao.IsNoRowsError(err) {
globals.SugarLogger.Debugf("========dao.IsNoRowsError= :%s", utils.Format4Output(orderComment, false))
err = nil
isNewComment = true
if orderComment.IsReplied == 0 && time.Now().Sub(orderComment.CommentCreatedAt) < time.Duration(orderComment.ModifyDuration)*time.Hour {
@@ -157,6 +158,9 @@ func (c *OrderManager) OnOrderComments(orderCommentList []*model.OrderComment) (
}
}
}
globals.SugarLogger.Debugf("========comment2= :%s", utils.Format4Output(comment2, false))
globals.SugarLogger.Debugf("========isNewComment= :%s", utils.Format4Output(isNewComment, false))
if err == nil {
if isNewComment {
err = dao.CreateEntity(db, comment2)

View File

@@ -707,10 +707,13 @@ func GetActMtwmVendorPage(db *DaoDB, storeIDs, skuIDs []int, keyword string, beg
var (
acts []*model.ActMtwmVendor
)
pageInfo := &model.PagedInfo{}
sql := `
SELECT SQL_CALC_FOUND_ROWS b.name store_name ,a.*
FROM act_mtwm_vendor a
LEFT JOIN store b ON a.store_id = b.id
WHERE 1 = 1
`
sqlParams := []interface{}{}
if len(storeIDs) > 0 {
@@ -726,11 +729,11 @@ func GetActMtwmVendorPage(db *DaoDB, storeIDs, skuIDs []int, keyword string, beg
sqlParams = append(sqlParams, keyword, keyword, "%"+keyword+"%", "%"+keyword+"%")
}
if !utils.IsTimeZero(beginAt) {
sql += " AND a.begin_at <= ?"
sql += " AND a.begin_at >= ?"
sqlParams = append(sqlParams, beginAt)
}
if !utils.IsTimeZero(endAt) {
sql += " AND a.end_at >= ?"
sql += " AND a.end_at <= ?"
sqlParams = append(sqlParams, endAt)
}
if actType != 0 {
@@ -749,12 +752,13 @@ func GetActMtwmVendorPage(db *DaoDB, storeIDs, skuIDs []int, keyword string, beg
panic(r)
}
}()
if err = GetRowsTx(txDB, &acts, sql, sqlParams...); err == nil {
page.TotalCount = GetLastTotalRowCount2(db, txDB)
page.Data = acts
if err = GetRowsTx(txDB, &acts, sql, sqlParams...); err == nil && len(acts) != 0 {
pageInfo.TotalCount = GetLastTotalRowCount2(db, txDB)
pageInfo.Data = acts
}
Commit(db, txDB)
return page, err
return pageInfo, err
}
// GetDontHaveSku 获取不存在此商品活动的门店

View File

@@ -104,7 +104,6 @@ func (c *DeliveryHandler) onWaybillMsg(msg *mtpsapi.CallbackOrderMsg) (retVal *m
}
}
globals.SugarLogger.Debugf("===========msg := %s", utils.Format4Output(msg, false))
store, _ := dao.GetStoreDetail(dao.GetDB(), goodsOrder.JxStoreID, goodsOrder.VendorID, goodsOrder.VendorOrgCode)
switch msg.Status {
case mtpsapi.OrderStatusWaitingForSchedule:

View File

@@ -29,6 +29,7 @@ func (c *PurchaseHandler) StartRefreshComment() {
}
func (c *PurchaseHandler) refreshCommentOnce() {
globals.SugarLogger.Debugf("refreshCommentOnce = %s", utils.Format4Output(time.Now(), false))
c.RefreshComment(time.Now().Add(-RefreshCommentTime), time.Now())
utils.AfterFuncWithRecover(RefreshCommentTimeInterval, func() {
c.refreshCommentOnce()
@@ -54,10 +55,10 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error)
func(task *tasksch.ParallelTask, batchItemList []interface{}, params ...interface{}) (retVal interface{}, err error) {
storeID := batchItemList[0].(int)
storeDetail, _ := dao.GetStoreDetail(dao.GetDB(), storeID, model.VendorIDMTWM, "")
commentList, err2 := getAPI(storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID).CommentQuery(storeDetail.VendorStoreID, startDateStr, endDateStr, 0, 0, mtwmapi.CommentReplyStatusNotReplied)
commentList, _ := getAPI(storeDetail.VendorOrgCode, storeID, storeDetail.VendorStoreID).CommentQuery(storeDetail.VendorStoreID, startDateStr, endDateStr, 0, 0, mtwmapi.CommentReplyStatusNotReplied)
var orderCommentList []*model.OrderComment
if err = err2; err != nil {
return nil, err
if len(commentList) == model.NO || commentList == nil {
return nil, nil
}
for _, mtwmComment := range commentList {
createdTime, err := utils.TryStr2Time(mtwmComment.CommentTime)
@@ -90,6 +91,8 @@ func (c *PurchaseHandler) RefreshComment(fromTime, toTime time.Time) (err error)
}, storeIDs)
task.Run()
resultList, err2 := task.GetResult(0)
globals.SugarLogger.Debugf("resultList := %s", utils.Format4Output(resultList, false))
globals.SugarLogger.Debugf("err2 := %s", utils.Format4Output(err2, false))
if err = err2; err != nil {
return err
}

View File

@@ -674,7 +674,6 @@ func updateStoreSkusStockByCreate(ctx *jxcontext.Context, api *tao_vegetable.API
globals.SugarLogger.Debugf("Updat stock err := %s", err.Error())
//failedList = append(failedList, putils.GetErrMsg2FailedSingleList(v, err, storeID, model.VendorChineseNames[model.VendorIDTaoVegetable], "更新库存错误")...)
}
globals.SugarLogger.Debugf("UpdateStoreSkusStock=====err := %v", failedList)
return failedList
}

View File

@@ -449,7 +449,7 @@ func (c *ActController) GetVendorPopActDetail() {
// @Title 查询美团平台活动
// @Description 查询美团平台活动
// @Param token header string true "认证token"
// @Param token header string true "认证token"
// @Param storeIDs query string false "门店IDs"
// @Param skuIDs query string false "skuIDs"
// @Param keyword query string false "关键字"

View File

@@ -110,7 +110,6 @@ func (c *DjswController) OrderCommentPush() {
func (c *DjswController) Token() {
urlValues, err := utils.HTTPBody2Values(c.Ctx.Input.RequestBody, false)
globals.SugarLogger.Info(utils.Format4Output(utils.URLValues2Map(urlValues), false))
globals.SugarLogger.Info(utils.Format4Output(utils.Format4Output(err, false), false))
jd.OnTokenChange(urlValues)
c.Data["json"] = c.transferResponse("Token", nil)

View File

@@ -9,7 +9,6 @@ import (
"git.rosy.net.cn/jx-callback/business/jxstore/common"
"git.rosy.net.cn/jx-callback/business/model"
taoVegetable "git.rosy.net.cn/jx-callback/business/partner/purchase/tao_vegetable"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego/server/web"
"io/ioutil"
@@ -39,7 +38,6 @@ func (c *TaoBaoVegetableController) GetCode() {
}
tokenInfo, err := api.TaoVegetableApi.GetStoreToken(codeData, "")
if err != nil {
globals.SugarLogger.Debugf("获取门店token错误:%s", err.Error())
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
return
@@ -76,8 +74,6 @@ func (c *TaoBaoVegetableController) OrderStatus() {
// 获取url参数
values, err := url.ParseQuery(urlParam)
globals.SugarLogger.Debugf("ReaderOrderInfo := %s", utils.Format4Output(urlParam, false))
globals.SugarLogger.Debugf("ReaderOrderInfo err := %s", utils.Format4Output(err, false))
if err != nil {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -86,8 +82,6 @@ func (c *TaoBaoVegetableController) OrderStatus() {
// 获取body参数
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 {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -121,8 +115,6 @@ func (c *TaoBaoVegetableController) ApplyCancelOrder() {
// 获取url参数
values, err := url.ParseQuery(urlParam)
globals.SugarLogger.Debugf("ApplyCancelOrder := %s", utils.Format4Output(urlParam, false))
globals.SugarLogger.Debugf("ApplyCancelOrder err := %s", utils.Format4Output(err, false))
if err != nil {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -130,8 +122,6 @@ func (c *TaoBaoVegetableController) ApplyCancelOrder() {
}
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 {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -153,7 +143,6 @@ func (c *TaoBaoVegetableController) ApplyCancelOrder() {
}
default:
callbackResponse := taoVegetable.OnCallbackMsg(tao_vegetable.OrderStatusApplyAfs, afsOrder.OutOrderId, afsOrder)
globals.SugarLogger.Debugf("callbackResponse response : %s", utils.Format4Output(callbackResponse, false))
c.Data["json"] = callbackResponse
c.ServeJSON()
return
@@ -166,8 +155,6 @@ func (c *TaoBaoVegetableController) UserCancelRefund() {
// 获取url参数
values, err := url.ParseQuery(urlParam)
globals.SugarLogger.Debugf("UserCancelRefund := %s", utils.Format4Output(urlParam, false))
globals.SugarLogger.Debugf("UserCancelRefund err := %s", utils.Format4Output(err, false))
if err != nil {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -175,8 +162,6 @@ func (c *TaoBaoVegetableController) UserCancelRefund() {
}
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 {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -211,8 +196,6 @@ func (c *TaoBaoVegetableController) CancelOnSaleRefundOrder() {
// 获取url参数
values, err := url.ParseQuery(urlParam)
globals.SugarLogger.Debugf("CancelOnSaleRefundOrder := %s", utils.Format4Output(urlParam, false))
globals.SugarLogger.Debugf("CancelOnSaleRefundOrder err := %s", utils.Format4Output(err, false))
if err != nil {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -220,8 +203,6 @@ func (c *TaoBaoVegetableController) CancelOnSaleRefundOrder() {
}
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 {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -255,8 +236,6 @@ func (c *TaoBaoVegetableController) RefundOrderSuccess() {
// 获取url参数
values, err := url.ParseQuery(urlParam)
globals.SugarLogger.Debugf("RefundOrderSuccess := %s", utils.Format4Output(urlParam, false))
globals.SugarLogger.Debugf("RefundOrderSuccess err := %s", utils.Format4Output(err, false))
if err != nil {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()
@@ -264,8 +243,6 @@ func (c *TaoBaoVegetableController) RefundOrderSuccess() {
}
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 {
c.Data["json"] = tao_vegetable.CallBackResultInfo(err)
c.ServeJSON()