商品价格审核查询增加types

This commit is contained in:
苏尹岚
2020-05-29 15:12:56 +08:00
parent fc179d5cbb
commit 332404d953
2 changed files with 65 additions and 51 deletions

View File

@@ -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)

View File

@@ -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
}