浏览代码

Merge branch 'master' into yb/3.0

hsun 2 年之前
父节点
当前提交
ea1da1646a
共有 2 个文件被更改,包括 13 次插入6 次删除
  1. 7 1
      services/share_poster.go
  2. 6 5
      services/wx_app/wx_app.go

+ 7 - 1
services/share_poster.go

@@ -35,7 +35,13 @@ func CreatePosterFromSource(codePage, codeScene, source, version, pars string) (
 	defer func() {
 		if err != nil {
 			global.LOG.Critical(fmt.Sprintf("CreatePosterFromSource: source=%s, pars:%s, errMsg:%s", source, pars, errMsg))
-			go alarm_msg.SendAlarmMsg("CreatePosterFromSource生成分享海报失败, Msg:"+errMsg+";Err:"+err.Error(), 2)
+			reqSlice := make([]string, 0)
+			reqSlice = append(reqSlice, fmt.Sprint("CodePage:", codePage, "\n"))
+			reqSlice = append(reqSlice, fmt.Sprint("CodeScene:", codeScene, "\n"))
+			reqSlice = append(reqSlice, fmt.Sprint("Source:", source, "\n"))
+			reqSlice = append(reqSlice, fmt.Sprint("Version:", version, "\n"))
+			reqSlice = append(reqSlice, fmt.Sprint("Pars:", pars, "\n"))
+			go alarm_msg.SendAlarmMsg("CreatePosterFromSource生成分享海报失败, Msg:"+errMsg+";Err:"+err.Error()+"\n;Req:\n"+strings.Join(reqSlice, ";"), 3)
 		}
 	}()
 	if codePage == "" || source == "" || pars == "" {

+ 6 - 5
services/wx_app/wx_app.go

@@ -26,10 +26,6 @@ func init() {
 	WxId = `gh_75abb562a946`
 	WxAppSecret = `1737c73e9f69a21de1a345b8f0800258`
 	WxPlatform = 6 //弘则研报来源
-	EnvVersion = "trial"
-	if global.CONFIG.Serve.RunMode == "release" {
-		EnvVersion = "release"
-	}
 }
 
 func GetWxApp() (miniprogram *miniprogram.MiniProgram) {
@@ -73,10 +69,15 @@ func GetDecryptInfo(sessionKey, encryptedData, iv string) (decryptData *encrypto
 
 // GetSunCode 获取太阳码
 func GetSunCode(page, scene string) (resp []byte, err error) {
+	// 此处因初始化顺序问题不放在init中
+	env := "trial"
+	if global.CONFIG.Serve.RunMode == "release" {
+		env = "release"
+	}
 	codePars := qrcode.QRCoder{
 		Page:       page,
 		Scene:      scene,
-		EnvVersion: EnvVersion,
+		EnvVersion: env,
 	}
 	wechatClient := GetWxApp()
 	qr := wechatClient.GetQRCode()