- 将URL信息放到配置文件中

This commit is contained in:
gazebo
2019-04-25 12:13:01 +08:00
parent d9276e5833
commit 1ef854a0c6
7 changed files with 33 additions and 20 deletions

View File

@@ -80,7 +80,7 @@ func SendFilesToStores(ctx *jxcontext.Context, files []*multipart.FileHeader, ti
BillTitle: title,
}
if err = dao.CreateEntity(db, billRec); err == nil {
err = weixinmsg.NotifySaleBill(storeID, title, shopName, "http://www.jxc4.com/billshow/?path="+billRec.Url)
err = weixinmsg.NotifySaleBill(storeID, title, shopName, fmt.Sprintf("%s/billshow/?path=%s", globals.BackstageHost, billRec.Url))
if err != nil {
globals.SugarLogger.Infof("SendFilesToStores NotifySaleBill file:%s error:%v", fileHeader.Filename, err)
}

View File

@@ -423,7 +423,7 @@ func BuildSkuFromEbaiStore(ctx *jxcontext.Context, baiduShopID int64, isAsync, i
err = nil
continue
}
qiniuImgURL := "http://image.jxc4.com/" + key + "?imageMogr2/thumbnail/x800/gravity/Center/crop/800x800"
qiniuImgURL := jxutils.ComposeQiniuResURL(key) + "?imageMogr2/thumbnail/x800/gravity/Center/crop/800x800"
for _, sku := range skuNameExt.Skus {
jdCatID := 22410 // 其他国产水果
if cat.Name == "进口水果" {

View File

@@ -15,12 +15,10 @@ import (
)
const (
// WX_TO_ORDER_PAGE_URL = "http://www.jxc4.com/jx/h5/#/?jxStoreId="
// WX_TO_SHOW_COMMENTS_DETAIL_URL = "http://www.jxc4.com/jx/h5/#/assess-list?jxStoreId=" //展示差评详情的页面
WX_TO_ORDER_PAGE_URL = "http://wx.jxc4.com/#/?jxStoreId="
WX_TO_STORE_SKU_PAGE_URL = "http://wx.jxc4.com/#/shop?jxStoreId="
WX_TO_SHOW_COMMENTS_DETAIL_URL = "http://wx.jxc4.com/#/assess-list?jxStoreId=" //展示差评详情的页面
WX_TO_SHOW_MSG = "http://wx.jxc4.com/#/message-detail?msgID=%d&msgStatusID=%d"
WX_TO_ORDER_PAGE_URL = "/#/?jxStoreId="
WX_TO_STORE_SKU_PAGE_URL = "/#/shop?jxStoreId="
WX_TO_SHOW_COMMENTS_DETAIL_URL = "/#/assess-list?jxStoreId=" //展示差评详情的页面
WX_TO_SHOW_MSG = "/#/message-detail?msgID=%d&msgStatusID=%d"
WX_MINI_TO_ORDER_PAGE_URL = "pages/order-manager/main"
WX_MINI_TO_STORE_SKU_PAGE_URL = "pages/goods-manager/main"
@@ -205,7 +203,7 @@ func NotifyNewOrder(order *model.GoodsOrder) (err error) {
},
}
storeID := jxutils.GetSaleStoreIDFromOrder(order)
return SendMsgToStore(storeID, WX_NEWORDER_TEMPLATE_ID, fmt.Sprintf("%s%d", WX_TO_ORDER_PAGE_URL, storeID), WX_MINI_TO_ORDER_PAGE_URL, data)
return SendMsgToStore(storeID, WX_NEWORDER_TEMPLATE_ID, globals.WxBackstageHost+fmt.Sprintf("%s%d", WX_TO_ORDER_PAGE_URL, storeID), WX_MINI_TO_ORDER_PAGE_URL, data)
}
func NotifyWaybillStatus(bill *model.Waybill, order *model.GoodsOrder, isBillAlreadyCandidate bool) error {
@@ -340,7 +338,7 @@ func PushJDBadCommentToWeiXin(comment *legacymodel.JxBadComments) (err error) {
},
}
storeID := int(utils.Str2Int64(comment.Jxstoreid))
return SendMsgToStore(storeID, WX_BAD_COMMENT_PUSH_TEMPLATE_ID, fmt.Sprintf("%s%d", WX_TO_SHOW_COMMENTS_DETAIL_URL, storeID), WX_MINI_TO_SHOW_COMMENTS_DETAIL_URL, data)
return SendMsgToStore(storeID, WX_BAD_COMMENT_PUSH_TEMPLATE_ID, globals.WxBackstageHost+fmt.Sprintf("%s%d", WX_TO_SHOW_COMMENTS_DETAIL_URL, storeID), WX_MINI_TO_SHOW_COMMENTS_DETAIL_URL, data)
}
func NotifySaleBill(storeID int, title, shopName, fileURL string) (err error) {
@@ -379,7 +377,7 @@ 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 := fmt.Sprintf("%s%d", WX_TO_STORE_SKU_PAGE_URL, storeID)
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
@@ -426,7 +424,7 @@ func NotifyStoreOpRequestStatus(isAccepted bool, storeID, nameID int, spuName st
func NotifyStoreMessage(storeID, msgID, msgStatusID int, title, content string) (err error) {
globals.SugarLogger.Debugf("NotifyStoreMessage storeID:%d, msgID:%d, title:%s, content:%s", storeID, msgID, title, content)
templateID := WX_NORMAL_STORE_MSG_TEMPLATE_ID
fileURL := fmt.Sprintf(WX_TO_SHOW_MSG, msgID, msgStatusID)
fileURL := globals.WxBackstageHost + fmt.Sprintf(WX_TO_SHOW_MSG, msgID, msgStatusID)
data := map[string]interface{}{
"first": map[string]interface{}{
"value": content,

View File

@@ -39,9 +39,15 @@ showAppSecret = "384f911735334bf7a150f3bd3bdf0c1e"
weixinMsgToken = "weixin"
weixinMsgKey = "duyaeVYUsz8LuKBqJeQO1NX6KmoC43yfMsbJybcRJ3e"
weixinPageAppID = "wx018dbe7daa3d5627"
weixinPageSecret = "c7a84ed3ef3ae04ac78e02fb593ffbe5"
weixinMiniAppID = "wx4b5930c13f8b1170"
weixinMiniSecret = "2a57228a716ce991a52739f0ff41111d"
backstageHost = "http://www.jxc4.com"
wxBackstageHost = "http://wx.jxc4.com"
jdStorePageCookie = "YYJV3NHVBPHLD36FWP6F3EM5PTXJ2XZQS7U4HWRIDPP4IWGUKUIB4XG5N26CZRDLDF7PKOXBPD6BNTUAJLETLZOIWMCVFI3K6MYZIY4QBIXIMXYDJNUKFGJVQTN5356SAD6WPCIHWNQAG7DDMF7L7S3SHBUOPCIUXDX4MQEAYEPUFFOAD4WJECT4R3K22T24MKC7OMIRDLX7S55243TDVXLO25PP4UYSPTTPMNRUFXDNP4WPE566Q6V4AH32F7HT"
ebaiStorePageCookieWMUSS = "AADIBAABbDlEpGl47c1EyBFcJSidBTBJHFHZEXyMSdBllJTZ9AUNOKV0tZFB9FlRVM73gEAIHRjBVagwAAHh98X2oPJ34Gal0ofFJBYXZ2Xnc6LCEXWQVnVxs7LDlaKBlFNz9DPCogYyZxJQhoHGVfVRIBa2oFUkEfDm1YZxZwLEwvZMjpB18rjw%7E3CaMQAo"
ebaiStorePageCookieWMSTOKEN = "HwXAAB9SGxnTT8pbEwWRDQsNGB3Y09_PF5rO157QUcoLRQAAAoKlgUEiVTOhIf5LjkCoFpAwwCaAAAUr-GEu-yDBeNAQAAHNneF25-uRjhYtgX4rsAAGHurh8C5GAQAA"
@@ -51,9 +57,6 @@ weimobAppSecret = "7267AA7F58261F6965599218F5A1D592"
weimobStateSecret = "87ae9570-92dc-4c01-bcd9-1a15d441df6b"
weimobCallbackURL = "http://callback.test.jxc4.com/weimob"
weixinPageAppID = "wx018dbe7daa3d5627"
weixinPageSecret = "c7a84ed3ef3ae04ac78e02fb593ffbe5"
dingdingAgentID = 241047291
dingdingAppKey = "dingpx4hcf55zb4ubewg"
dingdingSecret = "1zooB4bmEXPesdwb1ElWASVQ1vinOSZM-1XCUFrrSjHsNAId1UuVCT5tmHSmg5_V"
@@ -154,7 +157,9 @@ jdToken = "84541069-fbe2-424b-b625-9b2ba1d4c9e6"
jdAppKey = "5d5577a2506f41b8b4ec520ba83490f5"
jdSecret = "0b01b9eeb15b41dab1c3d05d95c17a26"
disableEbai = true
ebaiSource = "34665"
ebaiSecret = "c3db75b754ea2d89"
disableElm = true
disableMtwm = true
disableWeimob = true
@@ -177,6 +182,9 @@ dingdingQRCodeSecret = "N9dyC9qB84sauQPs4_JYrILMsG5Krqm9-PSSVJ8t9hb87rrHiFUirISx
dingdingCallbackURL = "http://callback.jxgy.jxc4.com/dingding/msg"
backstageHost = "http://www-jxgy.jxc4.com"
wxBackstageHost = "http://wx-jxgy.jxc4.com"
[prod2]
httpport = 8082

View File

@@ -4,6 +4,7 @@ import (
"net/http"
"git.rosy.net.cn/jx-callback/business/partner/purchase/ebai"
"git.rosy.net.cn/jx-callback/globals"
"git.rosy.net.cn/jx-callback/globals/api"
"github.com/astaxie/beego"
)
@@ -18,7 +19,7 @@ func (c *EbaiController) Msg() {
if callbackResponse == nil {
callbackResponse = ebai.OnCallbackMsg(obj)
}
if callbackResponse == nil {
if callbackResponse == nil || globals.IsCallbackAlwaysReturnSuccess() {
callbackResponse = api.EbaiAPI.Err2CallbackResponse(obj.Cmd, nil, nil)
}
c.Data["json"] = callbackResponse

View File

@@ -33,9 +33,9 @@ var (
MtpsAPI *mtpsapi.API
DadaAPI *dadaapi.API
MtwmAPI *mtwmapi.API
WeixinAPI *weixinapi.API
WeixinMiniAPI *weixinapi.API
WeixinPageAPI *weixinapi.API
WeixinAPI *weixinapi.API // 微信公众号
WeixinMiniAPI *weixinapi.API // 小程序
WeixinPageAPI *weixinapi.API // 用户微信扫码登录
AutonaviAPI *autonavi.API
QiniuAPI *qbox.Mac

View File

@@ -34,6 +34,9 @@ var (
QiniuBucket string
WeimobCallbackURL string
WeimobStateSecret string
BackstageHost string
WxBackstageHost string
)
func init() {
@@ -66,6 +69,9 @@ func Init() {
WeimobCallbackURL = beego.AppConfig.DefaultString("weimobCallbackURL", "")
WeimobStateSecret = beego.AppConfig.DefaultString("weimobStateSecret", "")
BackstageHost = beego.AppConfig.DefaultString("backstageHost", "")
WxBackstageHost = beego.AppConfig.DefaultString("wxBackstageHost", "")
}
func IsCallbackAlwaysReturnSuccess() bool {