From 332404d95338eb23eb8903d1f99579bd98f73b86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8B=8F=E5=B0=B9=E5=B2=9A?= <770236076@qq.com> Date: Fri, 29 May 2020 15:12:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=95=86=E5=93=81=E4=BB=B7=E6=A0=BC=E5=AE=A1?= =?UTF-8?q?=E6=A0=B8=E6=9F=A5=E8=AF=A2=E5=A2=9E=E5=8A=A0types?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/cms/store_sku.go | 22 ++++-- business/jxutils/weixinmsg/weixinmsg.go | 94 ++++++++++++------------- 2 files changed, 65 insertions(+), 51 deletions(-) diff --git a/business/jxstore/cms/store_sku.go b/business/jxstore/cms/store_sku.go index c4be7ed26..483b2a7a4 100644 --- a/business/jxstore/cms/store_sku.go +++ b/business/jxstore/cms/store_sku.go @@ -4482,10 +4482,10 @@ func doStoreSkuAudit(ctx *jxcontext.Context, storeIDs []int, skuBindInfos []*Sto // globals.SugarLogger.Debugf("doStoreSkuAudit return2 storeID : %v nameID: %v", storeID, skuBindInfo.NameID) // return false, err // } - // if ctx.GetLoginType() != weixin.AuthTypeMP && ctx.GetLoginType() != weixin.AuthTypeMini { - // globals.SugarLogger.Debugf("doStoreSkuAudit return3 storeID : %v nameID: %v", storeID, skuBindInfo.NameID) - // return false, err - // } + if ctx.GetLoginType() != weixin.AuthTypeMP && ctx.GetLoginType() != weixin.AuthTypeMini { + globals.SugarLogger.Debugf("doStoreSkuAudit return3 storeID : %v nameID: %v", storeID, skuBindInfo.NameID) + return false, err + } storeSkuAudit := &model.StoreSkuAudit{ StoreID: storeID, NameID: skuBindInfo.NameID, @@ -4545,8 +4545,10 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeIDs, nameIDs []int, status, if len(storeAudits) > 1 { return retVal, fmt.Errorf("查询到该门店该商品的待审核信息大于1条!storeID: %v, nameID: %v", storeID, v) } + flag := false //审核通过 if status == model.StoreAuditStatusCreated { + flag = true storeAudits[0].UserID = ctx.GetUserID() storeAudits[0].Status = model.StoreAuditStatusCreated storeAudits[0].Remark = remark @@ -4589,6 +4591,18 @@ func StoreSkuPriceAudit(ctx *jxcontext.Context, storeIDs, nameIDs []int, status, } else { return retVal, fmt.Errorf("审核标志不正确!") } + if err == nil { + // skuAndNames, err := dao.GetSkus(db, nil, []int{v}, nil, nil, nil) + // if len(skuAndNames) > 0 && err == nil { + // price := 0 + // if auditPrice != 0 { + // price = auditPrice + // } else { + // price = storeAudits[0].UnitPrice + // } + // weixinmsg.NotifyStoreOpRequestStatus(flag, storeID, v, jxutils.ComposeSpuName(skuAndNames[0].Prefix, skuAndNames[0].Name, 0), storeAudits[0].OriginUnitPrice, price, remark) + // } + } } return retVal, err }, storeIDs) diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index 87795f53d..81a50cecd 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -56,9 +56,9 @@ const ( WX_SALE_BILL_TEMPLATE_ID = "eTUuFZMWH7IsVBfcxNMpmaHYaxRkUaD6zG8wSGJDcic" - WX_NORMAL_STORE_MSG_TEMPLATE_ID = "EUeIJEz2TLUAn4TU2EffOGYLd3dEaYndD_y6Sw9FcSU" - // WX_CHANGE_APPROVED_TEMPLATE_ID = "gIG2olBZtQbjXmp6doNB_dESu60By5xuXYOGxksLv3Y" - // WX_CHANGE_REJECTED_TEMPLATE_ID = "tn2QXWi4HtSIwaztmtN6Bb2uzNL-jBxWltCZTDNJuYE" + WX_NORMAL_STORE_MSG_TEMPLATE_ID = "EUeIJEz2TLUAn4TU2EffOGYLd3dEaYndD_y6Sw9FcSU" + WX_CHANGE_APPROVED_TEMPLATE_ID = "gIG2olBZtQbjXmp6doNB_dESu60By5xuXYOGxksLv3Y" + WX_CHANGE_REJECTED_TEMPLATE_ID = "tn2QXWi4HtSIwaztmtN6Bb2uzNL-jBxWltCZTDNJuYE" WX_ORDER_APPLY_CANCEL_TEMPLATE_ID = "e6urTtcm4PL0rgDMG_1qWNOwrE3Qxqcm_dx0kWWCmEI" WX_ORDER_ORDER_CANCELED_TEMPLATE_ID = "HXjuSAbIk77Xh18hjgwoxHzbciR9jX3Rn2CpLJz9dZw" @@ -460,50 +460,50 @@ func NotifySaleBill(storeID int, title, shopName, fileURL string) (err error) { } func NotifyStoreOpRequestStatus(isAccepted bool, storeID, nameID int, spuName string, originalUnitPrice, unitPrice int, rejectReason string) (err error) { - // globals.SugarLogger.Debugf("NotifyStoreOpRequestStatus isAccepted:%t, storeID:%d, nameID:%d, spuName:%s, originalUnitPrice:%d, unitPrice:%d, rejectReason:%s", isAccepted, storeID, nameID, spuName, originalUnitPrice, unitPrice, rejectReason) - // templateID := "" - // fileURL := globals.WxBackstageHost + fmt.Sprintf("%s%d", WX_TO_STORE_SKU_PAGE_URL, storeID) - // data := make(map[string]interface{}) - // if isAccepted { - // templateID = WX_CHANGE_APPROVED_TEMPLATE_ID - // data = map[string]interface{}{ - // "first": map[string]interface{}{ - // "value": fmt.Sprintf("%s%s元,修改为%s元,已经通过审核。^_^", spuName, jxutils.IntPrice2StandardString(int64(originalUnitPrice)), jxutils.IntPrice2StandardString(int64(unitPrice))), - // "color": "#333333", - // }, - // "keyword1": map[string]interface{}{ - // "value": "审核通过", - // "color": "#2E408E", - // }, - // "keyword2": map[string]interface{}{ - // "value": utils.Time2Str(time.Now()), - // "color": "#2E408E", - // }, - // "remark": map[string]interface{}{ - // "value": "点击查看详情", - // }, - // } - // } else { - // templateID = WX_CHANGE_REJECTED_TEMPLATE_ID - // data = map[string]interface{}{ - // "first": map[string]interface{}{ - // "value": fmt.Sprintf("您好!抱歉的通知您。%s%s元,修改为%s元,未通过审核。原因:%s", spuName, jxutils.IntPrice2StandardString(int64(originalUnitPrice)), jxutils.IntPrice2StandardString(int64(unitPrice)), rejectReason), - // "color": "#E80000", - // }, - // "keyword1": map[string]interface{}{ - // "value": "1", - // "color": "#2E408E", - // }, - // "keyword2": map[string]interface{}{ - // "value": utils.Time2Str(time.Now()), - // "color": "#2E408E", - // }, - // "remark": map[string]interface{}{ - // "value": "请您及时到商品管理修改价格,修改后请重新提交。", - // }, - // } - // } - // err = SendMsgToStore(storeID, templateID, fileURL, WX_MINI_TO_STORE_SKU_PAGE_URL, data) + globals.SugarLogger.Debugf("NotifyStoreOpRequestStatus isAccepted:%t, storeID:%d, nameID:%d, spuName:%s, originalUnitPrice:%d, unitPrice:%d, rejectReason:%s", isAccepted, storeID, nameID, spuName, originalUnitPrice, unitPrice, rejectReason) + templateID := "" + fileURL := globals.WxBackstageHost + fmt.Sprintf("%s%d", WX_TO_STORE_SKU_PAGE_URL, storeID) + data := make(map[string]interface{}) + if isAccepted { + templateID = WX_CHANGE_APPROVED_TEMPLATE_ID + data = map[string]interface{}{ + "first": map[string]interface{}{ + "value": fmt.Sprintf("%s%s元,修改为%s元,已经通过审核。^_^", spuName, jxutils.IntPrice2StandardString(int64(originalUnitPrice)), jxutils.IntPrice2StandardString(int64(unitPrice))), + "color": "#333333", + }, + "keyword1": map[string]interface{}{ + "value": "审核通过", + "color": "#2E408E", + }, + "keyword2": map[string]interface{}{ + "value": utils.Time2Str(time.Now()), + "color": "#2E408E", + }, + "remark": map[string]interface{}{ + "value": "点击查看详情", + }, + } + } else { + templateID = WX_CHANGE_REJECTED_TEMPLATE_ID + data = map[string]interface{}{ + "first": map[string]interface{}{ + "value": fmt.Sprintf("您好!抱歉的通知您。%s%s元,修改为%s元,未通过审核。原因:%s", spuName, jxutils.IntPrice2StandardString(int64(originalUnitPrice)), jxutils.IntPrice2StandardString(int64(unitPrice)), rejectReason), + "color": "#E80000", + }, + "keyword1": map[string]interface{}{ + "value": "1", + "color": "#2E408E", + }, + "keyword2": map[string]interface{}{ + "value": utils.Time2Str(time.Now()), + "color": "#2E408E", + }, + "remark": map[string]interface{}{ + "value": "请您及时到商品管理修改价格,修改后请重新提交。", + }, + } + } + err = SendMsgToStore(storeID, templateID, fileURL, WX_MINI_TO_STORE_SKU_PAGE_URL, data) return err }