zhangxinlei1996 4 年之前
父节点
当前提交
1db5639652

+ 2 - 2
src/jfw/front/shorturl.go

@@ -254,14 +254,14 @@ func (s *Short) Article(stype, id string) error {
 			s.T["forceShareFlag"] = public.CheckUserNeedForceShare(userId, public.ShareType_detail)     //是否强制分享
 			if from_userid != "" && from_userid != userId && util.ObjToString(obj["subtype"]) != "拟建" { //分享开打的
 				article_id := util.CommonDecodeArticle(stype, id)[0]
-				if redis.Get("other", fmt.Sprintf("integral_article_%s_%s", from_userid, article_id)) == nil {
+				if redis.Get("other", fmt.Sprintf("integral_article_%s_%s_%s", article_id, from_userid, userId)) == nil {
 					fmt.Println("from_userid", se.DecodeStringByCheck(from_userid))
 					err := jy.Publish(public.Mgo_Log, config.Sysconfig["nsq"].(string), jy.Jyweb_article_open, se.DecodeStringByCheck(from_userid), jy.Jywx_node1)
 					if err != nil {
 						log.Println("nsq队列写入失败-->", jy.Jyweb_article_open, se.DecodeStringByCheck(from_userid))
 					} else {
 						//integral_article_ +userId+ 三级页id
-						redis.Put("other", fmt.Sprintf("integral_article_%s_%s", from_userid, article_id), "1", 60*60*24)
+						redis.Put("other", fmt.Sprintf("integral_article_%s_%s_%s", article_id, from_userid, userId), "1", 60*60*24)
 					}
 				}
 			}

+ 1 - 0
src/jfw/modules/app/src/app/front/commonPay.go

@@ -19,6 +19,7 @@ var (
 		"datareport":   []string{"数据报告"},
 		"onlineCourse": []string{"中标必听课"},
 		"member":       []string{"大会员"},
+		"integral":     []string{"剑鱼币充值"},
 	}
 )
 

+ 2 - 2
src/jfw/modules/app/src/app/front/shorturl.go

@@ -132,13 +132,13 @@ func (s *Short) Article(stype, id string) error {
 	if len(obj) > 0 {
 		if belongUserId != "" && belongUserId != userId && util.ObjToString(obj["subtype"]) != "拟建" { //分享开打的
 			article_id := util.CommonDecodeArticle(stype, id)[0]
-			if redis.Get("other", fmt.Sprintf("integral_article_%s_%s", belongUserId, article_id)) == nil {
+			if redis.Get("other", fmt.Sprintf("integral_article_%s_%s_%s", article_id, belongUserId, userId)) == nil {
 				err := jy.Publish(public.Mgo_Log, config.Sysconfig["nsq"].(string), jy.Jyweb_article_open, belongUserId, jy.Jyapp_node1)
 				if err != nil {
 					log.Println("nsq队列写入失败-->", jy.Jyweb_article_open, belongUserId)
 				} else {
 					//integral_article_ +userId+ 三级页id
-					redis.Put("other", fmt.Sprintf("integral_article_%s_%s", belongUserId, article_id), "1", 60*60*24)
+					redis.Put("other", fmt.Sprintf("integral_article_%s_%s_%s", article_id, belongUserId, userId), "1", 60*60*24)
 				}
 			}
 		}

+ 4 - 0
src/jfw/modules/app/src/web/templates/commonPay/checkout.html

@@ -311,6 +311,10 @@
                                         if (bigmemberBid==="1"){
                                            href = "/jyapp/aiForecastPack/paySuccess?orderCode=" + res.orderCode + "&email=" + res.email + "&payTime=" + res.payTime + "&pay_way=" + res.pay_way + "&price=" + res.price + "&t={{.T.t}}"
                                         }
+                                        var docsId=checkout.getUrlParam("docId");
+                                        if (docsId!=null){
+                                          href +="&docsId="+docsId
+                                        }
                                         location.replace(href);
                                     }
                                 })

+ 2 - 6
src/jfw/modules/app/src/web/templates/commonPay/integral/integralDetail.html

@@ -85,10 +85,6 @@
                 <div class="middle">
                     <div class="title">购买信息</div>
                     <div class="list">
-                        <p class="l-item" style="border-top: 1px solid #fff">
-                            <span class=" label">产品类型:</span>
-                            <span class="value item-list-parents level_value">剑鱼币</span>
-                        </p>
                         <p class="l-item">
                             <span>数量:</span>
                             <span class="item-list-parents count_value value"></span>
@@ -127,7 +123,7 @@
                             <span class="label">产品类型:</span>
                             <span class="value">剑鱼币</span>
                         </p>
-                        <p class="l-item paymoney" style="display: none">
+                        <p class="l-item paymoney">
                             <span class="label" id="price">实付金额:</span>
                             <span class="price value"></span>
                         </p>
@@ -161,7 +157,7 @@
                 //订单信息
                 $(".orderCode").text(orderCode);
                 var filterObj = JSON.parse(r.data.filter);
-                $(".count_value").text(filterObj.score + "次");
+                $(".count_value").text(formatMoney(filterObj.score) + "枚");
                 $(".o-name").text("剑鱼币")
                 $(".order-img > img").attr("src", "/jyapp/commonPay/image/jianyubi.png")
                 if (r.data.vip_endtime != null) {

+ 1 - 1
src/jfw/modules/app/src/web/templates/commonPay/myOrder.html

@@ -2410,7 +2410,7 @@
                     + '</div>'
                     + '<div class="media-info">'
                     + '<p class="item-ifo ellipsis">产品类型:剑鱼币 </p>'
-                    + '<p class="item-ifo ellipsis">数量:' + filterObj.score + '枚</p>'
+                    + '<p class="item-ifo ellipsis">数量:' + formatMoney(filterObj.score) + '枚</p>'
                     + '<p class="item-ifo ellipsis">有效日期:永久</p>'
                     + '</div>'
                     + '</a>'

+ 21 - 1
src/jfw/modules/app/src/web/templates/commonPay/paySuccess.html

@@ -87,6 +87,9 @@
                 <button style="margin: 0 .32rem; background-color: #2cb7ca; margin-bottom: 0.45rem;height: 0.92rem;border-radius: 0.16rem;" class="right_btn" onclick="window.location.href = '/jyapp/front/myorder/tointegralDetail?order_code={{.T.orderCode}}'">
                     查看订单
                 </button>
+                <button style="display:none;margin: 0 .32rem; background-color: #2cb7ca; margin-bottom: 0.45rem;height: 0.92rem;border-radius: 0.16rem;" class="right_btn" id ="read" >
+                    继续浏览
+                </button>
             </div>
         {{end}}
     </div>
@@ -126,7 +129,13 @@
         if (payway.indexOf("ali") > -1) {
             showPayway = "支付宝支付"
         }
-        $(".payway").text(showPayway)
+        $(".payway").text(showPayway);
+        var docsId = getParam("docsId");
+        if (docsId!=""){
+          $("#read").show().click(function(){
+            window.location.href = '/page_docs_app/details/'+docsId;
+          });
+        }
     })
 
     function formatMoney(s, n) {
@@ -168,6 +177,17 @@
         var money = t.split('').reverse().join('') + point + right;
         return money;
     }
+      //获取url参数
+    function getParam(name) {
+        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+        var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
+        var context = "";
+        if (r != null)
+            context = r[2];
+        reg = null;
+        r = null;
+        return context == null || context == "" || context == "undefined" ? "" : context;
+    }
 </script>
 {{include "/common/baiducc.html"}}
 </html>

+ 33 - 23
src/jfw/modules/subscribepay/src/entity/integral.go

@@ -39,46 +39,56 @@ func (b *integral) PayCallBack(param *CallBackParam) bool {
 	if qutil.IntAll((*orderdata)["order_status"]) == 0 {
 		now := time.Now()
 		nowFormat := qutil.FormatDate(&now, qutil.Date_Full_Layout)
-		product_type := qutil.ObjToString((*orderdata)["product_type"])
 		var filter map[string]interface{}
 		if err := json.Unmarshal([]byte(qutil.ObjToString((*orderdata)["filter"])), &filter); err != nil {
 			log.Println("剑鱼币支付解析json.Unmarshal出错", err)
 		} else {
 			score := qutil.IntAll(filter["score"])
 			order_code := qutil.ObjToString((*orderdata)["order_code"])
+			//调用积分接口 给用户增加积分
+			href := config.IntegralConfig.IntegralHarvestHref
+			data := url.Values{
+				"userId":        []string{userId},
+				"appId":         []string{config.IntegralConfig.Appid}, //剑鱼标识
+				"pointType":     []string{strconv.Itoa(1001)},          //1001充值
+				"sourceId":      []string{order_code},                  //订单号
+				"sourceType":    []string{"充值"},                        //业务类型
+				"point":         []string{strconv.Itoa(score)},         //积分
+				"operationType": []string{"true"},                      //积分类型永久:true、时效:false
+				"endDate":       []string{""},                          //永久为空
+			}
+			//
+			res, err := http.PostForm(href, data)
+			if err != nil {
+				log.Println(err.Error())
+			}
+			defer res.Body.Close()
+			bs, _ := ioutil.ReadAll(res.Body)
+			log.Println("返回内容:" + string(bs))
+			SerialNumber := "" //流水号
+			resMap := map[string]interface{}{}
+			err = json.Unmarshal([]byte(bs), &resMap)
+			if err != nil {
+				log.Println("json.unmarshal err", resMap)
+			} else {
+				if qutil.IntAll(resMap["Code"]) == 1 {
+					SerialNumber = qutil.ObjToString(resMap["SerialNumber"])
+				}
+			}
 			update := util.Mysql.Update("dataexport_order", map[string]interface{}{
 				"id": (*orderdata)["id"],
 			}, map[string]interface{}{
 				"pay_money":    param.CashFee,
 				"pay_time":     nowFormat,
 				"order_status": 1,
+				"filter_id":    SerialNumber, //流水号
 			})
-			log.Println("############", update)
 			if update {
 				//取消其他订单
 				go PayCancel(userId, "剑鱼币", "")
-				//调用积分接口 给用户增加积分
-				log.Println(product_type, "-----score--:", score, "---", order_code)
-				href := config.IntegralConfig.IntegralHarvestHref
-				data := url.Values{
-					"userId":        []string{userId},
-					"appId":         []string{config.IntegralConfig.Appid}, //剑鱼标识
-					"pointType":     []string{strconv.Itoa(1001)},          //1001充值
-					"sourceId":      []string{order_code},                  //订单号
-					"sourceType":    []string{"充值"},                        //业务类型
-					"point":         []string{strconv.Itoa(score)},         //积分
-					"operationType": []string{"true"},                      //积分类型永久:true、时效:false
-					"endDate":       []string{""},                          //永久为空
-				}
-				//
-				res, err := http.PostForm(href, data)
-				if err != nil {
-					log.Println(err.Error())
-				}
-				defer res.Body.Close()
-				bs, _ := ioutil.ReadAll(res.Body)
-				log.Println("返回内容:" + string(bs))
+
 			}
+			log.Println("############", update)
 		}
 	}
 	return true

+ 1 - 1
src/jfw/modules/subscribepay/src/service/orderListDetails.go

@@ -893,7 +893,7 @@ func (o *OrderListDetails) JyPoint() {
 		data = *util.Mysql.FindOne(tableName_order, map[string]interface{}{
 			"order_code": order_code,
 			"user_id":    userId,
-		}, "filter", "")
+		}, "filter,filter_id", "")
 		if data != nil {
 			value := fmt.Sprintf("?userId=%s&appId=%s", userId, config.IntegralConfig.Appid)
 			res, err := http.Get(config.IntegralConfig.IntegralBalanceCheckHref + value)

+ 0 - 1
src/jfw/modules/subscribepay/src/service/userAccountInfo.go

@@ -649,7 +649,6 @@ func (this *UserAccount) WxUnBind() {
 
 func (u *UserAccount) ShareUserId() {
 	userId, _ := u.GetSession("userId").(string)
-	log.Println(userId)
 	rData, errMsg := func() (interface{}, error) {
 		if userId == "" {
 			return nil, DBQUERY_ERROR

+ 11 - 4
src/jfw/modules/weixin/src/wx/wx.go

@@ -418,18 +418,25 @@ func saveUser(u *UserInfo, source, pre, RSource string) (bool, string, string) {
 		if fromid != "" {
 			newUser["s_invitid"] = fromid //邀请人的id
 		}
+		fmt.Println(fromid, "--fromid")
 		_id := tools.MQFW.Save("user", newUser)
-		if fromid != "" {
+		if fromid != "" && fromid != _id {
 			//被邀请新用户
 			newUser["s_invitid"] = fromid //邀请人的id
 			err := jy.Publish(tools.MGLOG, config.Sysconfig["nsq"].(string), jy.Jywx_subscribe_invited, _id, jy.Jywx_node1)
-			log.Println("nsq队列写入失败-->", err, jy.Jywx_subscribe_invited, _id)
+			if err != nil {
+				log.Println("nsq队列写入失败-->", err, jy.Jywx_subscribe_invited, _id)
+			}
 			err = jy.Publish(tools.MGLOG, config.Sysconfig["nsq"].(string), jy.Jywx_subscribe_invite, fromid, jy.Jywx_node1)
-			log.Println("nsq队列写入失败-->", err, jy.Jywx_subscribe_invite, fromid)
+			if err != nil {
+				log.Println("nsq队列写入失败-->", err, jy.Jywx_subscribe_invite, fromid)
+			}
 		} else {
 			//新用户
 			err = jy.Publish(tools.MGLOG, config.Sysconfig["nsq"].(string), jy.Jywx_subscribe_new, _id, jy.Jywx_node1)
-			log.Println("nsq队列写入失败-->", err, jy.Jywx_subscribe_new, _id)
+			if err != nil {
+				log.Println("nsq队列写入失败-->", err, jy.Jywx_subscribe_new, _id)
+			}
 		}
 		if _id != "" && isJyopUser {
 			go func() {

+ 1 - 1
src/web/templates/order/pc/integral/integralDetail.html

@@ -150,7 +150,7 @@
 
                     $(".price").text("¥ " + formatMoney(r.data.order_money / 100) + "元");
 
-                    $(".count").text(filterObj.score + "枚");
+                    $(".count").text(formatMoney(filterObj.score) + "枚");
                     if (r.data.order_status === 1) {
                         $("#status_success").removeClass("hide");
                         $(".pay_time_p").css("display", "");

+ 4 - 0
src/web/templates/order/pc/orderPay.html

@@ -160,6 +160,7 @@
     haslogin({{.T.logid}});
     var orderCode ={{.T.orderCode}}
     var price = 0
+    var docsId =getParam("docId");
     $(function () {
         //nav样式
         $("#public-nav").css("background", "#fff");
@@ -252,6 +253,9 @@
                             if (bigmemberBid==="1"){//
                               href ="/front/aiForecastPack/paySuccess/{{.T.orderCode}}?payway=" + r.pay_way + "&payTime=" + r.payTime + "&email=" + r.email + "&price=" + price
                             }
+                            if (docsId!=null){
+                              href+="&docsId="+docsId;
+                            }
                             window.location.replace(href);
                         }
                     })

+ 17 - 1
src/web/templates/order/pc/paySuccess.html

@@ -23,7 +23,11 @@
 {{include "/common/pchead.html"}}
 <!-- main  START -->
 <div class="pay_success">
+   {{if eq .T.orderType "integral"}}
+    <div class="w ps_header">充值成功</div>
+    {{else}}
     <div class="w ps_header">支付成功</div>
+    {{end}}
     <div class="w ps_content">
         <div class="c_top">
             <div class="c_t_status">
@@ -55,8 +59,13 @@
                 <span>订单编号</span>
                 <span id="orderCode">{{.T.orderCode}}</span>
             </p>
+
             <p class="order_item">
-                <span>支付时间</span>
+             {{if eq .T.orderType "integral"}}
+               <span>充值时间</span>
+             {{else}}
+               <span>支付时间</span>
+             {{end}}
                 <span id="payTime">{{.T.payTime}}</span>
             </p>
             <p class="order_item">
@@ -84,6 +93,7 @@
                 <span>剑鱼币余额:</span>
                 <span id="pointFund" style="color:red"></span>
             </p>
+                <a class="check_order" id="read" style="display:none">继续浏览</a>
                 <a class="check_order" href="/front/integral/integralDetail?order_code={{.T.orderCode}}">查看订单</a>
             {{end}}
         </div>
@@ -108,6 +118,12 @@
               var filterObj = JSON.parse(r.data.filter);
               $(".point").html("+"+filterObj.score);
               $("#pointFund").html(r.data.point);
+              $("#SerialNumber").html(r.data.filter_id);
+              var docid=getParam("docsId");
+              console.log(docid)
+              if (docid!=null){
+                $("#read").show().attr("href","/swordfish/docs/index/content/"+docid);
+              }
             }else{
               $("#point").hide();
               $("#pointFund").hide();

+ 1 - 1
src/web/templates/pc/myOrder.html

@@ -863,7 +863,7 @@
                             var imgurl = "/order/image/jianyubi.png";
                             shop_img_html += '<img src=' + imgurl + ' alt="">'
                             shop_main_html += '<p style="line-height: 24px;">产品类型:' + obj.product_type + '</p>'
-                                + '<p style="line-height: 24px;">数量:' + filter_.score + '枚</p>'
+                                + '<p style="line-height: 24px;">数量:' + FormatNum(filter_.score) + '枚</p>'
                                 + '<p style="line-height: 24px;">有效日期:永久</p>'
                             if (orderStatus === 0) {//0:待付款;
                                 var payNameTmp = "去支付"

+ 4 - 0
src/web/templates/weixin/commonPay/checkout.html

@@ -308,6 +308,10 @@
                                         if(bigmemberBid==="1"){
                                           href="/weixin/aiForecastPack/paySuccess?orderCode=" + res.orderCode + "&email=" + res.email + "&payTime=" + res.payTime + "&price=" + res.price + "&t={{.T.t}}"
                                         }
+                                        var docsId=checkout.getUrlParam("docId")
+                                        if (docsId!=null){
+                                          href +="&docsId="+docsId
+                                        }
                                         location.replace(href);
                                     }
                                 })

+ 6 - 6
src/web/templates/weixin/commonPay/integral/integralDetail.html

@@ -89,10 +89,6 @@
                 <div class="middle">
                     <div class="title">购买信息</div>
                     <div class="list">
-                        <p class="l-item line_level">
-                            <span>产品类型:</span>
-                            <span class="item-list-parents level_value value">剑鱼币</span>
-                        </p>
                         <p class="l-item line_count">
                             <span>数量:</span>
                             <span class="item-list-parents count_value value"></span>
@@ -115,6 +111,10 @@
                             <span class="label">下单时间:</span>
                             <span class="prepayTime value"></span>
                         </p>
+                        <p class="l-item">
+                            <span class="label">产品类型:</span>
+                            <span class="value">剑鱼币</span>
+                        </p>
                         <!-- 订单状态为已完成时显示支付时间、支付方式和订单号,状态为待付款时不显示 -->
                         <p class="l-item line_paytime" style="display:none">
                             <span class="label" id="paytime">支付时间:</span>
@@ -128,7 +128,7 @@
                             <span class="label">支付单号:</span>
                             <span class="transaction_id value"></span>
                         </p>
-                        <p class="l-item paymoney" style="display: none">
+                        <p class="l-item paymoney">
                             <span class="label" id="price">实付金额:</span>
                             <span class="value price"></span>
                         </p>
@@ -171,7 +171,7 @@
                     priceText = "¥ " + formatMoney((r.data.pay_money / 100));
                 }
                 $(".price").text(priceText);
-                $(".count_value").text(filterObj.score + "次");
+                $(".count_value").text(formatMoney(filterObj.score) + "枚");
             }
             //
             if (r.data.order_status == 1) {

+ 2 - 1
src/web/templates/weixin/commonPay/myOrder.html

@@ -1938,6 +1938,7 @@
                     orderStatusHtml = "已取消";
                     orderStatusHtmls = "status-text";
                 }
+                var jianyubiCount =filterObj.score;
                 listhtml += '<div class="card">'
                     + '<div class="card-header">'
                     + '<span class="time" style="color:#888888">' + createTime + '</span>'
@@ -1953,7 +1954,7 @@
                     + '</div>'
                     + '<div class="media-info">'
                     + '<p class="item-ifo ellipsis">产品类型:剑鱼币</p>'
-                    + '<p class="item-ifo ellipsis">数量:' + filterObj.score + '枚</p>'
+                    + '<p class="item-ifo ellipsis">数量:' + formatMoney(jianyubiCount)+ '枚</p>'
                     + '<p class="item-ifo ellipsis">有效日期:永久</p>'
                     + '</div>'
                     + '</a>'

+ 21 - 0
src/web/templates/weixin/commonPay/paySuccess.html

@@ -71,6 +71,9 @@
         <button class="right_btn" onclick="window.location.href = '/front/wxMyOrder/integralDetail/{{.T.orderCode}}'">
             查看订单
         </button>
+        <button class="right_btn" id ="read" style="display:none">
+            继续浏览
+        </button>
     </div>
     {{end}}
 </div>
@@ -93,6 +96,12 @@
         } else {
             $(".success-price em").text(formatMoney(price))
         }
+        var docsId = getParam("docsId");
+        if (docsId!=""){
+          $("#read").show().click(function(){
+            window.location.href = '/page_docs_app/details/'+docsId;
+          });
+        }
     })
 
     function formatMoney(s, n) {
@@ -134,6 +143,18 @@
         var money = t.split('').reverse().join('') + point + right;
         return money;
     }
+    
+    //获取url参数
+    function getParam(name) {
+        var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
+        var r = window.location.search.substr(1).match(reg); //获取url中"?"符后的字符串并正则匹配
+        var context = "";
+        if (r != null)
+            context = r[2];
+        reg = null;
+        r = null;
+        return context == null || context == "" || context == "undefined" ? "" : context;
+    }
 </script>
 {{include "/common/baiducc.html"}}
 </html>