Эх сурвалжийг харах

Merge branch 'feature/v4.9.89' of https://jygit.jydev.jianyu360.cn/qmx/jy into feature/v4.9.89

fuwencai 6 сар өмнө
parent
commit
f7990a9eea

+ 1 - 39
src/jfw/front/returnMoneyPage.go

@@ -19,7 +19,6 @@ import (
 type (
 	ReturnMoneyPage struct {
 		*xweb.Action
-		toRedirect     xweb.Mapper `xweb:"/returnMoney/toRedirect"` //跳转重定向(弃用,扫码并没有refer)
 		wxReturnMoney  xweb.Mapper `xweb:"/weixin/pay/returnMoney"` //微信数据导出-支付页面
 		aliReturnMoney xweb.Mapper `xweb:"/returnMoney/aliPage"`    //剑鱼管理后台微信支付回款
 	}
@@ -34,33 +33,6 @@ func init() {
 	xweb.AddAction(&ReturnMoneyPage{})
 }
 
-func (this *ReturnMoneyPage) ToRedirect() error {
-	var (
-		token = this.GetString("token")
-		refer = strings.ToLower(this.Refer())
-	)
-	if token == "" {
-		return fmt.Errorf("未知回款订单,token异常")
-	}
-	if refer != "" {
-		if strings.Contains(refer, "alipay") {
-			return this.Redirect(fmt.Sprintf("/returnMoney/aliPage?token=%s", token))
-		} else if strings.Contains(refer, "micromessenger") || strings.Contains(refer, "weixin") {
-			return this.Redirect(fmt.Sprintf("/weixin/pay/returnMoney?token=%s", token))
-		}
-	}
-	rMap := public.Mysql.FindOne("return_money_online", map[string]interface{}{"token": token, "status": 0}, "pay_way", "")
-	if rMap == nil || len(*rMap) == 0 {
-		return fmt.Errorf("未知回款订单")
-	}
-	var payWay = gconv.String((*rMap)["pay_way"])
-	if strings.Contains(payWay, "wx") {
-		return this.Redirect(fmt.Sprintf("/weixin/pay/returnMoney?token=%s", token))
-	} else {
-		return this.Redirect(fmt.Sprintf("/returnMoney/aliPage?token=%s", token))
-	}
-}
-
 func (this *ReturnMoneyPage) WxReturnMoney() {
 	err := func() error {
 		var (
@@ -105,11 +77,6 @@ func (this *ReturnMoneyPage) WxReturnMoney() {
 			return err
 		}
 
-		var pay_param map[string]interface{}
-		if payWay, payParam := gconv.String(rData["pay_way"]), gconv.String(rData["pay_param"]); payWay == "wx_js" && payParam != "" {
-			pay_param = gconv.Map(payParam)
-		}
-		this.T["pay_param"] = pay_param
 		this.T["token"] = token
 		this.T["data"] = rData
 		this.T["signature"] = wx.SignJSSDK(this.Site() + this.Url())
@@ -128,11 +95,6 @@ func (this *ReturnMoneyPage) AliReturnMoney() {
 		if err != nil {
 			return err
 		}
-		var pay_param string
-		if gconv.String(rData["pay_way"]) == "ali_pc" {
-			pay_param = gconv.String(rData["pay_param"])
-		}
-		this.T["pay_param"] = pay_param
 		this.T["token"] = token
 		this.T["data"] = formatShow(rData)
 		return this.Render("/common/returnMoney/aliReturnMoney.html", &this.T)
@@ -147,7 +109,7 @@ func getReturnPayDetail(token string) (map[string]interface{}, error) {
 	if token == "" {
 		return nil, errors.New("<p>参数异常</p>")
 	}
-	rList := public.Mysql.SelectBySql("SELECT d.order_status,d.product_type,d.user_phone,d.company_name,r.return_money,r.pay_param,r.pay_way,r.expire_time,r.status FROM dataexport_order d inner join return_money_online r on (d.order_code=r.order_code) WHERE r.token=? ", token)
+	rList := public.Mysql.SelectBySql("SELECT d.order_status,d.product_type,d.user_phone,d.company_name,r.return_money,r.expire_time,r.status FROM dataexport_order d inner join return_money_online r on (d.order_code=r.order_code) WHERE r.token=? ", token)
 	if rList == nil || len(*rList) == 0 {
 		return nil, fmt.Errorf("<p>未知回款单</p>")
 	}

+ 15 - 2
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/ent_portrait.js

@@ -351,6 +351,18 @@ var vNode = {
     }
   },
   methods: {
+    doMiniPostMessageShare (title) {
+      try {
+        wx.miniProgram.postMessage({ data: {
+            post: 'share',
+            type: 'common',
+            desc: '企业画像',
+            title
+          }})
+      } catch (e) {
+        console.log(e)
+      }
+    },
     restoreTab: function() {
       var tab = utils.getParam('tab') || ''
       if (tab) {
@@ -768,6 +780,7 @@ var vNode = {
           if (res.error_code == 0) {
             if (res.data && Object.keys(res.data).length !== 0) {
               _this.entInfo.name = res.data.entName
+              _this.doMiniPostMessageShare(_this.entInfo.name)
               _this.entBaseInfo._empty = false
               for (var key in res.data) {
                 _this.entBaseInfo[key] = res.data[key]
@@ -1645,11 +1658,11 @@ var vNode = {
       var container = document.querySelector('.sesame-main');
       if(!container) return
       var items = container.getElementsByClassName('sesame-item');
-  
+
       // 获取所有子元素的top值,如果所有子元素的top值相同,则说明只有一行
       var firstItemTop = items[0].offsetTop;
       var isOneRow = true;
-  
+
       for (var i = 1; i < items.length; i++) {
         if (items[i].offsetTop !== firstItemTop) {
           isOneRow = false;

+ 13 - 0
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/unit_portrayal.js

@@ -325,6 +325,7 @@ var vNode = {
   created () {
     this.buyer.name = decodeURIComponent(utils.getParam('entName'))
     this.portraitName = decodeURIComponent(utils.getParam('entName'))
+    this.doMiniPostMessageShare(this.buyer.name)
     this.getUserSimpleInfo()
     this.restore = this.reStoreState()
     setTimeout(() => {
@@ -358,6 +359,18 @@ var vNode = {
     window.removeEventListener("resize", this.init, 20);
   },
   methods: {
+    doMiniPostMessageShare (title) {
+      try {
+        wx.miniProgram.postMessage({ data: {
+            post: 'share',
+            type: 'common',
+            desc: '采购单位画像',
+            title
+          }})
+      } catch (e) {
+        console.log(e)
+      }
+    },
     restoreTab: function() {
       var tab = utils.getParam('tab') || ''
       if (tab) {

+ 2 - 0
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -355,6 +355,7 @@ window.utilsEnv = {
   },
   getPlatformEnvs: function () {
     var inWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
+    var inWeiXinMiniApp = navigator.userAgent.toLowerCase().indexOf('miniprogram') !== -1
     var inApp = this.getIsInTheAppContainer()
     var platformOS = this.androidOrIOS()
     var getPlatform = function () {
@@ -374,6 +375,7 @@ window.utilsEnv = {
       platformOS: platformOS,
       platform: platform,
       inApp: inApp,
+      inWxMini: inWeiXinMiniApp, // 微信小程序
       inWX: inWX
     }
   }

+ 3 - 0
src/jfw/modules/app/src/web/templates/big-member/page_pro_follow_detail.html

@@ -1508,6 +1508,9 @@
                 if (!this.isPayedUser) {
                     return this.openVip()
                 }
+                if (utils.$envs.inWxMini) {
+                    return utils.toDownloadApp()
+                }
                 if (this.isRequestIng) {
                     return
                 }

+ 3 - 0
src/jfw/modules/ossProxy/README.md

@@ -0,0 +1,3 @@
+# P228发送文件与文件下载需求文档需求
+1.访问附件地址需要判断当前用户是否有权限
+2.没有权限跳转该附件对应的正文链接中

+ 1 - 0
src/jfw/modules/ossProxy/config.yaml

@@ -0,0 +1 @@
+serverPort: 8440

+ 7 - 0
src/jfw/modules/ossProxy/db.json

@@ -0,0 +1,7 @@
+{
+  "redis": {
+    "main": {
+      "address": "session=192.168.3.149:1713,newother=192.168.3.149:1712"
+    }
+  }
+}

+ 134 - 0
src/jfw/modules/ossProxy/main.go

@@ -0,0 +1,134 @@
+package main
+
+import (
+	"app.yhyue.com/moapp/jybase/go-xweb/httpsession"
+	"app.yhyue.com/moapp/jybase/go-xweb/xweb"
+	"app.yhyue.com/moapp/jybase/redis"
+	_ "app.yhyue.com/moapp/jypkg/public"
+	"context"
+	"encoding/json"
+	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/util/gconv"
+	"io"
+	"log"
+	"net/http"
+	"net/http/httputil"
+	"net/url"
+	"time"
+)
+
+type OssProxy struct {
+	*xweb.Action
+	attachmentProxy xweb.Mapper `xweb:"/attachment/(.*)"` //附件下载包代理
+}
+
+func (this *OssProxy) AttachmentProxy(fileName string) {
+	var (
+		w    = this.ResponseWriter
+		jump string
+	)
+	bytes, err := func() ([]byte, error) {
+		var (
+			cacheKey = fmt.Sprintf("attachment_%s", fileName)
+			cacheMap = map[string]interface{}{}
+		)
+		b, err := redis.GetBytes("newother", cacheKey)
+		if b == nil || len(*b) == 0 || err != nil {
+			return nil, fmt.Errorf("文件链接已过期")
+		}
+		if err := json.Unmarshal(*b, &cacheMap); err != nil {
+			log.Printf("%s 获取下载缓存异常 %v", fileName, err)
+			return nil, err
+		}
+
+		var (
+			ossSource  = gconv.String(cacheMap["source"])
+			timeout    = gconv.Int64(cacheMap["timeout"])
+			outputName = gconv.String(cacheMap["fileName"])
+
+			noPower = gconv.String(cacheMap["noPower"])
+			//checkUserId = gconv.String(cacheMap["userId"])
+			//userId, _ = this.GetSession("userId").(string)
+		)
+		//if checkUserId != "" && userId != checkUserId {
+		//	if noPower != "" {
+		//		jump = noPower
+		//	}
+		//	return nil, fmt.Errorf("用户身份校验异常")
+		//}
+		//
+		//if ossSource == "" {
+		//	return nil, fmt.Errorf("下载地址异常")
+		//}
+
+		if time.Now().Unix() > timeout {
+			if noPower != "" {
+				jump = noPower
+			}
+			return nil, fmt.Errorf("文件链接已过期")
+		}
+		res, err := http.Get(ossSource)
+		if err != nil {
+			log.Printf("%s 获取下载文件异常 %v", fileName, err)
+			return nil, fmt.Errorf("获取下载文件异常")
+		}
+		defer res.Body.Close()
+		fileBytes, err := io.ReadAll(res.Body)
+		if err != nil {
+			log.Printf("%s 读取文件内容异常 %v", fileName, err)
+			return nil, fmt.Errorf("读取文件内容异常")
+		}
+		for k, v := range res.Header {
+			w.Header().Set(k, v[0])
+		}
+		if outputName != "" {
+			w.Header().Set("Content-Disposition", fmt.Sprintf("attachment; filename=%s", outputName))
+		}
+		return fileBytes, nil
+	}()
+	if jump != "" {
+		_ = this.Redirect(jump, 302)
+		return
+	}
+	if err != nil {
+		log.Printf("OssProxy.attachment %s 读取文件内容异常 %v", fileName, err)
+		this.ServeJson(map[string]interface{}{
+			"errMsg": err.Error(),
+		})
+	}
+	_, _ = w.Write(bytes)
+}
+
+func (this *OssProxy) OssProxy2(fileName string) {
+	u, e := url.Parse("https://jy-datafile.oss-cn-beijing.aliyuncs.com/")
+	if e != nil {
+		http.Error(this.ResponseWriter, e.Error(), http.StatusNotFound)
+		return
+	}
+	this.Request.Header.Set("HOST", "jy-datafile.oss-cn-beijing.aliyuncs.com")
+	this.Request.Host = "jy-datafile.oss-cn-beijing.aliyuncs.com"
+	this.Request.URL = u
+	this.Request.RequestURI = "/1268256f187f0f72b1f55636c037459fecca03f6f61ef702208c9de703669392.pdf"
+	httputil.NewSingleHostReverseProxy(u).ServeHTTP(this.ResponseWriter, this.Request)
+}
+
+func init() {
+	//开启redissession
+	httpsession.IsRedisSessionStore = true
+	httpsession.RedisNotLoginKey = "userId"
+	xweb.Config.Profiler = true
+	xweb.RootApp().BasePath = "/jyoss"
+	xweb.RootApp().AppConfig.StaticFileVersion = false
+	xweb.RootApp().AppConfig.CheckXsrf = false
+	xweb.RootApp().AppConfig.EnableHttpCache = false
+	xweb.RootApp().AppConfig.Mode = xweb.Product
+	xweb.RootApp().AppConfig.ReloadTemplates = true
+	xweb.RootApp().AppConfig.SessionTimeout = 7 * 24 * time.Hour
+	xweb.AddAction(&OssProxy{})
+}
+
+func main() {
+	mux1 := http.NewServeMux()
+	xweb.RunBase(fmt.Sprintf(":%d", g.Cfg().MustGet(context.Background(), "serverPort").Int64()), mux1)
+}

+ 5 - 1
src/jfw/modules/subscribepay/src/config.yaml

@@ -39,6 +39,10 @@ pdfPackPrice:
   市场分析定制报告下载包:
     - num: 1
       price: 199900
+ossProxy:
+  open: false #默认关闭,开启后走附件下载权限校验
+  addr: https://oss.jianyu360.cn #若非新域名,则不用配置此地址,默认使用剑鱼web域名
+  lineTimeout: 18000 #链接过期时间
 miniprogram:
   jyzbw:
     name: "剑鱼招标网"
@@ -46,4 +50,4 @@ miniprogram:
 consultingVipMemberH5: /jyapp/view/672352bb6b45456266a57127
 consultingVipMemberApp: /jyapp/view/672352bb6b45456266a57127
 consultingVipMemberWX: https://h5-editor.jydev.jianyu360.cn/view/67247f741d749c1b910c61d3
-consultingVipMemberMini: https://h5-editor.jydev.jianyu360.cn/view/67247f741d749c1b910c61d3
+consultingVipMemberMini: https://h5-editor.jydev.jianyu360.cn/view/67247f741d749c1b910c61d3

+ 46 - 30
src/jfw/modules/subscribepay/src/entity/returnMoney.go

@@ -2,6 +2,7 @@ package entity
 
 import (
 	. "app.yhyue.com/moapp/jybase/date"
+	"database/sql"
 	"github.com/gogf/gf/v2/util/gconv"
 	"jy/src/jfw/modules/subscribepay/src/pay"
 	"jy/src/jfw/modules/subscribepay/src/util"
@@ -15,43 +16,52 @@ type returnMoneyStruct struct{}
 var JyReturnMoneyStruct returnMoneyStruct
 
 func (m *returnMoneyStruct) PayCallBack(param *CallBackParam) bool {
-	now := time.Now()
-	if util.Mysql.Update("return_money_online", map[string]interface{}{
-		"out_trade_no": param.OutTradeno,
-		"status":       0,
-	}, map[string]interface{}{
-		"status":         1,
-		"pay_money":      param.CashFee,
-		"pay_time":       FormatDate(&now, Date_Full_Layout),
-		"transaction_id": param.TransactionId,
-	}) {
-		var orderCode string
-		if param.OrderCode != "" {
-			orderCode = param.OrderCode
-		} else {
-			if m := util.Mysql.FindOne("return_money_online", map[string]interface{}{
-				"out_trade_no": param.OutTradeno,
-			}, "order_code", ""); m != nil && len(*m) > 0 {
-				orderCode = gconv.String((*m)["order_code"])
-			}
+	return util.Mysql.ExecTx("回款更新", func(tx *sql.Tx) bool {
+		now := time.Now()
+
+		//回款支付记录更新
+		if !util.Mysql.UpdateByTx(tx, "return_money_online_pay", map[string]interface{}{
+			"out_trade_no": param.OutTradeno,
+			"status":       0,
+		}, map[string]interface{}{
+			"status":         1,
+			"pay_money":      param.CashFee,
+			"pay_time":       FormatDate(&now, Date_Full_Layout),
+			"transaction_id": param.TransactionId,
+		}) {
+			return false
 		}
-		if orderCode != "" {
-			go m.CloseOrder(orderCode)
+
+		res := util.Mysql.FindOne("return_money_online_pay", map[string]interface{}{
+			"out_trade_no": param.OutTradeno,
+		}, "order_code,return_id", "")
+		if m == nil || len(*res) == 0 {
+			return false
+		}
+
+		var (
+			orderCode = gconv.String((*res)["order_code"])
+			returnId  = gconv.String((*res)["return_id"])
+		)
+		//回款状态完成
+		if !util.Mysql.UpdateByTx(tx, "return_money_online", map[string]interface{}{
+			"id":     returnId,
+			"status": 0,
+		}, map[string]interface{}{
+			"status": 1,
+		}) {
+			return false
 		}
+
+		//取消未支付回款单
+		go m.CloseOrder(orderCode)
 		return true
-	}
-	return false
+	})
 }
 
 // CloseOrder 关闭其他未支付的订单
 func (m *returnMoneyStruct) CloseOrder(orderOrder string) {
-	res := util.Mysql.Query("SELECT pay_way,out_trade_no FROM return_money_online WHERE status=0 and order_code=? and expire_time>?", orderOrder, time.Now().Format(time.DateTime))
-	util.Mysql.Update("return_money_online", map[string]interface{}{
-		"order_code": orderOrder,
-		"status":     0,
-	}, map[string]interface{}{
-		"status": -1,
-	})
+	res := util.Mysql.Query("SELECT p.pay_way,p.out_trade_no FROM return_money_online r inner join return_money_online_pay p on (r.id = p.return_id and p.status=0)  WHERE r.order_code=? and r.expire_time>?", orderOrder, time.Now().Format(time.DateTime))
 	if res != nil && len(*res) > 0 {
 		for _, m := range *res {
 			var (
@@ -65,4 +75,10 @@ func (m *returnMoneyStruct) CloseOrder(orderOrder string) {
 			log.Printf("CloseReturnOrder 关闭支付 %s %s %v\n", orderOrder, out_trade_no, ok)
 		}
 	}
+	util.Mysql.Update("return_money_online", map[string]interface{}{
+		"order_code": orderOrder,
+		"status":     0,
+	}, map[string]interface{}{
+		"status": -1,
+	})
 }

+ 29 - 1
src/jfw/modules/subscribepay/src/service/basePack.go

@@ -1,10 +1,15 @@
 package service
 
 import (
+	"app.yhyue.com/moapp/jybase/redis"
 	"fmt"
+	"github.com/gogf/gf/v2/frame/g"
+	"github.com/gogf/gf/v2/util/gconv"
+	"github.com/google/uuid"
 	"jy/src/jfw/modules/subscribepay/src/config"
 	"jy/src/jfw/modules/subscribepay/src/entity"
 	"log"
+	"path/filepath"
 	"strings"
 	"time"
 
@@ -78,7 +83,30 @@ func (this *ResourcePack) ConsumePack() {
 			return nil, fmt.Sprintf("%s 使用异常:%s", productName, Msg)
 		}
 		if Code < 0 {
-			Ret = map[string]interface{}{"code": Code}
+			return map[string]interface{}{"code": Code}, ""
+		}
+		//P228发送文件与文件下载需求文档
+		if g.Cfg().MustGet(this.Request.Context(), "ossProxy.open", false).Bool() {
+			var (
+				uid     = uuid.New().String()
+				ossAddr = gconv.String(Ret["downUrl"])
+
+				fileName = filepath.Base(ossAddr)
+				fileExt  = filepath.Ext(fileName)
+				cacheKey = fmt.Sprintf("attachment_%s%s", uid, fileExt)
+				timeout  = g.Cfg().MustGet(this.Request.Context(), "ossProxy.lineTimeout", 18000).Int64()
+			)
+			cacheMap := map[string]interface{}{
+				"userId":   userId,                                                                                   //可下载文件用户职位id
+				"source":   ossAddr,                                                                                  //oss文件地址
+				"noPower":  fmt.Sprintf("%s/nologin/content/%s.html", config.Config.WebDomain, this.GetString("id")), //未登录或无权限跳转地址
+				"timeout":  time.Now().Unix() + timeout,
+				"fileName": Ret["fileName"],
+			}
+			if !redis.Put("newother", cacheKey, cacheMap, gconv.Int(timeout)*10) {
+				return map[string]interface{}{"code": -2}, "缓存异常"
+			}
+			Ret["downUrl"] = fmt.Sprintf("%s/jyoss/attachment/%s%s", g.Cfg().MustGet(this.Request.Context(), "ossProxy.addr", config.Config.WebDomain), uid, fileExt)
 		}
 		return Ret, ""
 	}()

+ 25 - 36
src/jfw/modules/subscribepay/src/service/commonAction.go

@@ -777,28 +777,21 @@ func (this *CommonAction) GetWxReturnPayParam() {
 		if !(payWayReq == "wx_js" || payWayReq == "ali_pc") {
 			return nil, fmt.Errorf("未知支付方式")
 		}
-
-		rList := util.Mysql.SelectBySql("SELECT return_money,expire_time,pay_way,pay_param,pay_way,return_money,order_code FROM return_money_online r WHERE r.status=0 and r.token=? ", token)
+		rList := util.Mysql.SelectBySql("SELECT id,return_money,expire_time,return_money,order_code FROM return_money_online r WHERE r.status=0 and r.token=? ", token)
 		if rList == nil || len(*rList) == 0 {
 			return nil, fmt.Errorf("未知回款单")
 		}
 		var (
 			rMap        = (*rList)[0]
 			expireTime  = gconv.String(rMap["expire_time"])
-			pay_param   = gconv.String(rMap["pay_param"])
-			payWay      = gconv.String(rMap["pay_way"])
 			returnMoney = gconv.Int(rMap["return_money"])
 			OrderCode   = gconv.String(rMap["order_code"])
+			returnId    = gconv.Int(rMap["id"])
 		)
-		if pay_param != "" {
-			if payWay == payWayReq {
-				return pay_param, nil
-			}
-			return "", fmt.Errorf("支付方式更变")
-		}
 		var (
 			tradeno, payParam string
 			err               error
+			openId            string
 		)
 		expire, dateErr := time.ParseInLocation(time.DateTime, expireTime, time.Local)
 		if dateErr == nil {
@@ -813,36 +806,34 @@ func (this *CommonAction) GetWxReturnPayParam() {
 		case "wx_js":
 			var (
 				sessVal = this.Session().GetMultiple()
-				openId  = qutil.ObjToString(sessVal["s_m_openid"])
 			)
-			if openId == "" {
+			if openId = qutil.ObjToString(sessVal["s_m_openid"]); openId == "" {
 				openId = qutil.ObjToString(sessVal["openid_returnMoney"])
 			}
 			if openId == "" {
 				return nil, fmt.Errorf("创建微信支付参数异常")
 			}
-			tradeno, _, payParam, err = pay.CreateOrderPay(returnMoney, pay.WX_RETURN_NATIVE, "", openId, "", payWay, OrderCode, expire.Unix())
+			tradeno, _, payParam, err = pay.CreateOrderPay(returnMoney, pay.WX_RETURN_NATIVE, "", openId, "", payWayReq, OrderCode, expire.Unix())
 			if err != nil {
 				return nil, fmt.Errorf("创建微信支付异常")
 			}
 		case "ali_pc":
-			tradeno, _, payParam, err = pay.CreateOrderPay(returnMoney, pay.ALI_RETURN_NATIVE, "", "", "", payWay, OrderCode, expire.Unix())
+			tradeno, _, payParam, err = pay.CreateOrderPay(returnMoney, pay.ALI_RETURN_NATIVE, "", "", "", payWayReq, OrderCode, expire.Unix())
 			if err != nil {
 				return nil, fmt.Errorf("创建支付宝支付异常")
 			}
 		}
 		//更新支付串
 		now := time.Now()
-		if !util.Mysql.Update("return_money_online", map[string]interface{}{
-			"status": 0,
-			"token":  token,
-		}, map[string]interface{}{
-			"order_code":   OrderCode,
+		if util.Mysql.Insert("return_money_online_pay", map[string]interface{}{
+			"return_id":    returnId,
 			"pay_param":    payParam,
+			"s_openid":     openId,
 			"out_trade_no": tradeno,
-			"pay_way":      payWay,
+			"order_code":   OrderCode,
+			"pay_way":      payWayReq,
 			"creat_time":   FormatDate(&now, Date_Full_Layout),
-		}) {
+		}) <= 0 {
 			return nil, fmt.Errorf("数据保存异常")
 		}
 		return payParam, nil
@@ -859,28 +850,26 @@ func (this *CommonAction) GetReturnResult() {
 		if token == "" {
 			return nil, fmt.Errorf("缺少参数")
 		}
-		rData := util.Mysql.FindOne("return_money_online", map[string]interface{}{
-			"token": token,
-		}, "transaction_id,pay_time,status,order_code,pay_money,return_money", "")
-		if rData == nil || len(*rData) == 0 {
-			return nil, fmt.Errorf("未知回款单")
-		}
 		var (
-			r      = map[string]interface{}{}
-			status = gconv.Int((*rData)["status"])
+			payed bool
+			r     = map[string]interface{}{}
 		)
-		r["success"] = status > 0
-		if status > 0 {
-			r["order_code"] = (*rData)["order_code"]
-			r["transaction_id"] = (*rData)["transaction_id"]
-			r["pay_money"] = (*rData)["pay_money"]
-			r["return_money"] = (*rData)["return_money"]
-			if payTime := gconv.String((*rData)["pay_time"]); payTime != "" {
+		res := util.Mysql.SelectBySql("SELECT r.status,r.order_code,r.return_money,p.pay_time,p.transaction_id FROM return_money_online r inner join return_money_online_pay p on (r.id = p.return_id and p.status=1) WHERE r.token=?", token)
+		if res != nil && len(*res) > 0 {
+			var (
+				rData = (*res)[0]
+			)
+			payed = true
+			r["order_code"] = rData["order_code"]
+			r["transaction_id"] = rData["transaction_id"]
+			r["return_money"] = rData["return_money"]
+			if payTime := gconv.String(rData["pay_time"]); payTime != "" {
 				if t, e := time.ParseInLocation(time.DateTime, payTime, time.Local); e == nil {
 					r["pay_time"] = t.Unix()
 				}
 			}
 		}
+		r["success"] = payed
 		return r, nil
 	}()
 	if errMsg != nil {

+ 4 - 0
src/web/staticres/common-module/big-member/js/page_client_follow_detail.js

@@ -1155,6 +1155,10 @@ var vNode = {
             if (!this.isPayedUser) {
                 return this.openVip()
             }
+            if (utils.$envs.inWxMini) {
+                return utils.toDownloadApp()
+            }
+
             if (this.isRequestIng) {
                 return
             }

+ 3 - 0
src/web/staticres/common-module/file-pack/js/index.js

@@ -333,6 +333,9 @@ var vm = new Vue({
     },
     downFile (item) {
       //location.href = item.s_downUrl
+      if (utils.$envs.inWxMini) {
+        return utils.toDownloadApp()
+      }
 		   $.ajax({
 		       type: 'post',
 		       url: '/jypay/resourcePack/consumePack',

+ 3 - 0
src/web/staticres/common-module/mobile-portrayal-footer/js/mobile-portrayal-footer.js

@@ -130,6 +130,9 @@ var mobilePortrayalFooter = {
  },
   methods: {
     downLoad(){
+      if (utils.$envs.inWxMini) {
+        return utils.toDownloadApp()
+      }
       this.$parent.$refs.downloadpopup.show() //触发引用此组件父级组件的下载弹框
     },
     monitorClick: utils.debounce(function(){

+ 20 - 0
src/web/staticres/common-module/public/head.js

@@ -28,6 +28,26 @@
 })();
 
 ;(function () {
+  function setMiniAppInfo () {
+    try {
+      var title = document.title
+      var meta = document.querySelector('meta[name="mini-app-data"]');
+      if (meta) {
+        title = meta.getAttribute('content');
+      }
+      wx.miniProgram.postMessage({ data: {
+          post: 'share',
+          type: 'common',
+          desc: '默认标题',
+          title: title
+        }})
+    } catch (e) {
+      console.log(e)
+    }
+  }
+
+  setMiniAppInfo()
+
   function loadJS (url, success) {
     var scripts = document.getElementsByTagName('script')
     for (var i = 0; i < scripts.length; i++) {

+ 8 - 0
src/web/staticres/common-module/public/js/utils.js

@@ -141,6 +141,8 @@ if (!window.utilsEnv) {
     },
     getPlatformEnvs: function () {
       var inWX = navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1
+      var inWeiXinMiniApp = navigator.userAgent.toLowerCase().indexOf('miniprogram') !== -1
+
       var inApp = this.getIsInTheAppContainer()
       var platformOS = this.androidOrIOS()
       var getPlatform = function () {
@@ -160,6 +162,7 @@ if (!window.utilsEnv) {
         platformOS: platformOS,
         platform: platform,
         inApp: inApp,
+        inWxMini: inWeiXinMiniApp, // 微信小程序
         inWX: inWX
       }
     }
@@ -181,6 +184,7 @@ var utils = {
     inApp: window.utilsEnv.platformEnvs.inApp, // 是否在app中
     inAndroid: window.utilsEnv.platformEnvs.platformOS === 'android', // 是否在android中
     inIOS: window.utilsEnv.platformEnvs.platformOS === 'ios', // 是否在android中
+    inWxMini: window.utilsEnv.platformEnvs.inWxMini, // 是否在微信小程序中
   },
   isWeiXinBrowser: navigator.userAgent.toLowerCase().indexOf('micromessenger') !== -1,
   isH5: window.location.href.toLowerCase().indexOf('h5') !== -1,
@@ -805,6 +809,10 @@ var utils = {
   toWxGzhProfile: function () {
     window.location.href = 'https://mp.weixin.qq.com/mp/profile_ext?action=home&__biz=Mzk0MjIyMzY2Nw==&scene=110#wechat_redirect'
   },
+  // 去下载app页面
+  toDownloadApp: function() {
+    window.location.href = 'https://h5.jianyu360.cn/front/downloadapppage/normal'
+  },
   moneyUnit: function (num, type, lv) {
     if (num === '' || num == null || num == undefined || isNaN(num)) return ''
     var levelArr = ['元', '万元', '亿元', '万亿元']

+ 3 - 0
src/web/staticres/common-module/share/js/invite-friends.js

@@ -177,6 +177,9 @@ var shareContent = new Vue({
                 scale: 3,
                 imageTimeout: 30000,
             }).then(function(canvas) {
+                if (utils.$envs.inWxMini) {
+                  return utils.toDownloadApp()
+                }
                 var imgUrl = canvas.toDataURL('image/png');
                 if (goTemplateData.platform === 'app') {
                   _this.doAppSaveImg(imgUrl)