From 1ef854a0c654475d7e8e949f83b0b43ff797a6b2 Mon Sep 17 00:00:00 2001 From: gazebo Date: Thu, 25 Apr 2019 12:13:01 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E5=B0=86URL=E4=BF=A1=E6=81=AF=E6=94=BE?= =?UTF-8?q?=E5=88=B0=E9=85=8D=E7=BD=AE=E6=96=87=E4=BB=B6=E4=B8=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- business/jxstore/financial/financial.go | 2 +- business/jxstore/initdata/initdata.go | 2 +- business/jxutils/weixinmsg/weixinmsg.go | 18 ++++++++---------- conf/app.conf | 16 ++++++++++++---- controllers/ebai_callback.go | 3 ++- globals/api/api.go | 6 +++--- globals/globals.go | 6 ++++++ 7 files changed, 33 insertions(+), 20 deletions(-) diff --git a/business/jxstore/financial/financial.go b/business/jxstore/financial/financial.go index 21165dc60..8a20b7aab 100644 --- a/business/jxstore/financial/financial.go +++ b/business/jxstore/financial/financial.go @@ -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) } diff --git a/business/jxstore/initdata/initdata.go b/business/jxstore/initdata/initdata.go index bc93b44be..d402d9ef0 100644 --- a/business/jxstore/initdata/initdata.go +++ b/business/jxstore/initdata/initdata.go @@ -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 == "进口水果" { diff --git a/business/jxutils/weixinmsg/weixinmsg.go b/business/jxutils/weixinmsg/weixinmsg.go index aba3d7454..4e2917afa 100644 --- a/business/jxutils/weixinmsg/weixinmsg.go +++ b/business/jxutils/weixinmsg/weixinmsg.go @@ -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, diff --git a/conf/app.conf b/conf/app.conf index 4f0335097..9aac1c467 100644 --- a/conf/app.conf +++ b/conf/app.conf @@ -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 diff --git a/controllers/ebai_callback.go b/controllers/ebai_callback.go index d9e3de22b..d16f7299d 100644 --- a/controllers/ebai_callback.go +++ b/controllers/ebai_callback.go @@ -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 diff --git a/globals/api/api.go b/globals/api/api.go index fd0dff206..1fb59f9fb 100644 --- a/globals/api/api.go +++ b/globals/api/api.go @@ -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 diff --git a/globals/globals.go b/globals/globals.go index 25ba12984..c6ab1223a 100644 --- a/globals/globals.go +++ b/globals/globals.go @@ -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 {