方法移动到check文件

This commit is contained in:
qidongsheng
2020-06-19 14:18:56 +08:00
39 changed files with 1446 additions and 408 deletions

View File

@@ -3,6 +3,8 @@ package jxutils
import (
"bytes"
"context"
"crypto/aes"
"encoding/base64"
"fmt"
"io/ioutil"
"math"
@@ -882,3 +884,35 @@ func TranslateSoundSize(vendorID, soundPercentage int) (soundSize string) {
}
return soundSize
}
//ECB,AES模式解密
//目前就京东商城订单手机号解密用
func DecryptDESECB(d, key []byte) string {
data, err := base64.StdEncoding.DecodeString(string(d))
if err != nil {
return ""
}
block, err := aes.NewCipher(key)
if err != nil {
return ""
}
bs := block.BlockSize()
if len(data)%bs != 0 {
return ""
}
out := make([]byte, len(data))
dst := out
for len(data) > 0 {
block.Decrypt(dst, data[:bs])
data = data[bs:]
dst = dst[bs:]
}
out = PKCS5UnPadding(out)
return string(out)
}
func PKCS5UnPadding(origData []byte) []byte {
length := len(origData)
unpadding := int(origData[length-1])
return origData[:(length - unpadding)]
}

View File

@@ -86,7 +86,7 @@ func isPushSMS(order *model.GoodsOrder) bool {
} else {
storeID = order.StoreID
}
stores, _ := dao.GetStoresMapList(dao.GetDB(), []int{order.VendorID}, []int{storeID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "")
stores, _ := dao.GetStoresMapList(dao.GetDB(), []int{order.VendorID}, []int{storeID}, nil, model.StoreStatusAll, model.StoreIsSyncAll, "", "")
if len(stores) > 0 {
if stores[0].IsOrder == model.NO {
if storeID == model.MatterStoreID {

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 = "OBF4-d5inK95epHcUltpdb1zq9boVp2HESpASVRh1Oo"
WX_ORDER_APPLY_CANCEL_TEMPLATE_ID = "e6urTtcm4PL0rgDMG_1qWNOwrE3Qxqcm_dx0kWWCmEI"
WX_ORDER_ORDER_CANCELED_TEMPLATE_ID = "HXjuSAbIk77Xh18hjgwoxHzbciR9jX3Rn2CpLJz9dZw"
@@ -460,50 +460,58 @@ 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": "审核不通过",
"color": "#2E408E",
},
"keyword3": map[string]interface{}{
"value": utils.Time2Str(time.Now()),
"color": "#2E408E",
},
"keyword4": map[string]interface{}{
"value": "审核不通过",
"color": "#2E408E",
},
"remark": map[string]interface{}{
"value": "请您及时到商品管理修改价格,修改后请重新提交。",
},
}
}
err = SendMsgToStore(storeID, templateID, fileURL, WX_MINI_TO_STORE_SKU_PAGE_URL, data)
return err
}