wcj 5 tahun lalu
induk
melakukan
f9535f35d0

+ 2 - 1
src/jfw/modules/app/src/app/front/laboratory.go

@@ -18,6 +18,7 @@ func init() {
 
 //剑鱼标讯实验室首页
 func (l *Lab) Index() error {
-	return l.Render("/weixin/treasure_box.html")
+	//return l.Render("/weixin/treasure_box.html")
 	//return l.Render("/weixin/jylab/lab-index.html")
+	return l.Redirect("/page_entniche/page/treasure_box.html")
 }

+ 42 - 1
src/jfw/modules/app/src/app/front/me.go

@@ -299,11 +299,52 @@ func (l *Me) MyInfo() {
 		r["entName"] = l.GetSession("entName")
 	} else {
 		userId, _ := l.GetSession("userId").(string)
-		user, ok := mongodb.FindById("user", userId, `{"s_phone":1,"i_vip_status":1}`)
+		user, ok := mongodb.FindById("user", userId, `{"s_phone":1,"o_jy":1,"i_vip_status":1,"l_vip_endtime":1,"o_vipjy":1}`)
 		if ok && user != nil {
+			isExpire := 0
+			isOnTail := 0
+			isPassCount := false
+			hasKeyFlag := false
+			tedayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
 			if qutil.IntAll((*user)["i_vip_status"]) > 0 {
 				r["userType"] = "vip"
+				isOnTail = qutil.IntAll((*user)["i_vip_status"])
+				//
+				var threeRemind = int64(3 * 24 * 60 * 60)
+				var twoRemind = int64(2 * 24 * 60 * 60)
+				var oneRemind = int64(1 * 24 * 60 * 60)
+				_endtime := (*user)["l_vip_endtime"]
+				//是否到期
+				if qutil.Int64All(_endtime)-time.Now().Unix() < threeRemind && qutil.Int64All(_endtime)-time.Now().Unix() >= twoRemind {
+					isExpire = 3 //即将到期
+				} else if qutil.Int64All(_endtime)-time.Now().Unix() < twoRemind && qutil.Int64All(_endtime)-time.Now().Unix() >= oneRemind {
+					isExpire = 2 //即将到期
+				} else if qutil.Int64All(_endtime)-time.Now().Unix() < oneRemind && qutil.Int64All(_endtime)-time.Now().Unix() >= 0 {
+					isExpire = 1 //即将到期
+				}
+				isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) > 2000
+				o_vipjy, _ := (*user)["o_vipjy"].(map[string]interface{})
+				if o_vipjy["a_items"] != nil {
+					a_itmes := qutil.ObjArrToMapArr(o_vipjy["a_items"].([]interface{}))
+					hasKeyFlag = len(a_itmes) > 0
+				}
+			} else {
+				if (*user)["i_vip_status"] == nil {
+					isExpire = 0
+				} else {
+					isOnTail = qutil.IntAll((*user)["i_vip_status"])
+				}
+				isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) > 50
+				o_jy, _ := (*user)["o_jy"].(map[string]interface{})
+				if o_jy != nil || len(o_jy) == 0 {
+					a_key, _ := o_jy["a_key"].([]interface{})
+					hasKeyFlag = len(a_key) > 0
+				}
 			}
+			r["isExpire"] = isExpire
+			r["isOnTail"] = isOnTail
+			r["isPassCount"] = isPassCount
+			r["haskey"] = hasKeyFlag
 			phone, _ := (*user)["s_phone"].(string)
 			if public.Mysql.CountBySql(`SELECT count(DISTINCT a.id) as count from entniche_info a 
 			INNER JOIN entniche_user b on (a.id=b.ent_id) 

+ 0 - 31
src/jfw/modules/app/src/app/front/swordfish.go

@@ -640,11 +640,6 @@ func (f *Front) HasPushHistory() {
 	user, _ := jy.SubscribePush.UserInfo(public.MQFW, userId)
 	hasKeyFlag := false
 	isVipFlag := false
-	isPassCount := false
-	isExpire := 0
-	tedayNum := time.Unix(time.Now().Unix(), 1).Format("20060102")
-	isOnTail := 0
-
 	var o_jy map[string]interface{}
 	var keys []string
 	if user != nil {
@@ -659,10 +654,6 @@ func (f *Front) HasPushHistory() {
 			}
 		}
 		if util.IntAll((*user)["i_vip_status"]) == 1 || util.IntAll((*user)["i_vip_status"]) == 2 {
-			//
-			var threeRemind = int64(3 * 24 * 60 * 60)
-			var twoRemind = int64(2 * 24 * 60 * 60)
-			var oneRemind = int64(1 * 24 * 60 * 60)
 			var o_vipjy map[string]interface{}
 			o_vipjy, _ = (*user)["o_vipjy"].(map[string]interface{})
 			if o_vipjy["a_items"] != nil {
@@ -670,28 +661,11 @@ func (f *Front) HasPushHistory() {
 				hasKeyFlag = len(a_itmes) > 0
 			}
 			isVipFlag = true
-			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) > 2000
-			isOnTail = util.IntAll((*user)["i_vip_status"])
-			_endtime := (*user)["l_vip_endtime"]
-			//是否到期
-			if util.Int64All(_endtime)-time.Now().Unix() < threeRemind && util.Int64All(_endtime)-time.Now().Unix() >= twoRemind {
-				isExpire = 3 //即将到期
-			} else if util.Int64All(_endtime)-time.Now().Unix() < twoRemind && util.Int64All(_endtime)-time.Now().Unix() >= oneRemind {
-				isExpire = 2 //即将到期
-			} else if util.Int64All(_endtime)-time.Now().Unix() < oneRemind && util.Int64All(_endtime)-time.Now().Unix() >= 0 {
-				isExpire = 1 //即将到期
-			}
 		} else {
-			if (*user)["i_vip_status"] == nil {
-				isExpire = 0
-			} else {
-				isOnTail = util.IntAll((*user)["i_vip_status"])
-			}
 			if o_jy != nil || len(o_jy) == 0 {
 				a_key, _ := o_jy["a_key"].([]interface{})
 				hasKeyFlag = len(a_key) > 0
 			}
-			isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) > 50
 		}
 	}
 	pageNum, _ := f.GetInteger("pageNum")
@@ -715,14 +689,9 @@ func (f *Front) HasPushHistory() {
 	}
 	//
 	f.ServeJson(map[string]interface{}{
-		"haskey":      hasKeyFlag,
 		"data":        list,
 		"hasNextPage": hasNextPage,
 		"isInTSguide": isInTSguide(userId),
-		"isVipSub":    isVipFlag,
-		"isPassCount": isPassCount,
-		"isExpire":    isExpire,
-		"isOnTail":    isOnTail,
 		"userId":      util.EncodeArticleId(userId),
 		"keys":        keys,
 	})

+ 117 - 120
src/jfw/modules/app/src/web/templates/weixin/historypush.html

@@ -81,12 +81,7 @@
 
         var words = ""
         var isInTSguide = false;//订阅向导
-        var isVipSub = false;//是不是VIP
         var firstTime = {{.T.selectTime}};
-        var isPassCount = false; //提示信息
-        var haskey = false;//是否有关键词
-        var isOnTail = false;//是否在试用
-        var isExpire = 0;//到期天数3 2 1
         var userId = "";
         var selectCity = "";
 
@@ -115,30 +110,133 @@
             $(".listcontent").scroll(function () {
                 scrollTop = $(this).scrollTop();
             });
+            this.InitPersonal=function(r){
+              $("#sub_manager").click(tokeyset);
+              $(".tab_left .area").hide();
+              $(".vip_banner").show();
+              if (r.isPassCount) {
+                  $(".open_remind").show();
+              }
+              if (r.isExpire < 0 && r.isOnTail == -1) {
+                  if (localStorage.getItem("nv_vip_" + userId) == null) {
+                      $(".nv_renew_toast").show();
+                  }
+              }
+              if (!firstPage.length > 0 && !r.haskey) {
+                  if (sessionStorage && (sessionStorage.keysetindexToHistory == "1" || sessionStorage.keysetindexToHistory == "2" || sessionStorage.keysetindexToHistory == "3")) {
+                    sessionStorage.removeItem("keysetindexToHistory");
+                    return
+                  }
+                  if (firstTime != "") {
+                    return
+                  }
+                  history.pushState({}, "", "");
+                  if (isInTSguide) {
+                      if (localStorage) {
+                        localStorage.removeItem("tsGuide_status");
+                      }
+                      window.location.href = '/jyapp/tenderSubscribe/guide';
+                  } else {
+                      window.location.href = '/jyapp/wxkeyset/keyset/index';
+                  }
+              }
+            }
+            this.InitVip=function(r){
+              $("#sub_manager").click(tosetpage);
+              $(".vip_report").show();
+              $(".tab_left .area").show();
+              if (!r.haskey) {
+                    $(".set_keyword").show();
+                    if (r.isPassCount && (localStorage.isPassCount == null || localStorage.isPassCount != date.split("-")[2])) {
+                        localStorage.isPassCount = date.split("-")[2]
+                        weuiDialog();
+                    }
+                }
+                if (r.isOnTail != 1) {
+                    if (r.isExpire > 1) {
+                        $(".renew_toast .isExpire").text(r.isExpire);
+                        $(".renew_toast").show();
+                    } else if (r.isExpire > 0) {
+                        $(".renew_toast").find(".other").hide();
+                        $(".renew_toast").find(".today").show();
+                        $(".renew_toast").show();
+                    }
+                } else {
+                    if (r.isExpire > 1) {
+                        $("._renew_toast .isExpire").text(r.isExpire);
+                        $("._renew_toast").show();
+                    } else if (r.isExpire > 0) {
+                        $("._renew_toast").find(".other").hide();
+                        $("._renew_toast").find(".today").show();
+                        $("._renew_toast").show();
+                    }
+                }
+                $.post("/subscribepay/report/tip?t=" + new Date().getTime(), null, function (r) {
+                    if (r.unread > 0) {
+                        $(".vip_report>a").show();
+                    }
+                    if (r.tip) {
+                        if (r.tip.type == 2) {
+                            $(".vip_report_tip .weekly>span").text("周");
+                        } else {
+                            $(".vip_report_tip .weekly>span").text("月");
+                        }
+                        $(".vip_report_tip .term").text(new Date(Number(r.tip.startdate + "000")).Format("yyyy年M月d日") + "-" + new Date(Number(r.tip.enddate + "000")).Format("yyyy年M月d日"));
+                        $('.vip_report_tip').fadeIn();
+                        $('.vip_report_todetail').on('click', function () {
+                            updateReportStatus(1, r.tip.startdate, r.tip.enddate, r.tip.pushcount);
+                        });
+                        $('.weui-dialog img.vip_report_tip_close').click(function () {
+                            $('.vip_report_tip').fadeOut();
+                            updateReportStatus(0);
+                        });
+                    }
+                });
+                $(".vip_report").click(function () {
+                    window.location.href = "/vipreport/page/subreport.html";
+                });
+            }
+            var thisClass = this;
             $.post("/jyapp/myinfo?t="+new Date().getTime(),null,function(r){
               if(r.hasEnt){
                 if(r.userType=="vip"){
                   $(".switch").addClass("switch-vip");
                   $(".switch>span").text("VIP订阅");
+                  thisClass.InitVip(r);
                 }else if (r.userType=="ent"){
                   $(".switch").addClass("switch-ent");
                   $(".switch>span").text(r.entName);
+                  $(".switch").click(function(){
+                    window.location.href='/page_entniche/page/sub_mode/switch_mode.html';
+                  });
+                  $("#sub_manager").click(function(){
+                    $.post("/entniche/ent/entinfo",null,function(r){
+                      if(r.data.admin_system){
+                        window.location.href='/page/sub_management/sub_management_system.html';
+                      }else if(r.data.admin_department){
+                        window.location.href='/page/sub_management/sub_management_department.html';
+                      }
+                    });
+                  });
                 }else{
                   $(".switch").addClass("switch-personal");
                   $(".switch>span").text("标讯订阅(个人版)");
+                  thisClass.InitPersonal(r);
                 }
                 $(".switch").click(function(){
-                  window.location.href='';
+                  window.location.href='/page_entniche/page/sub_mode/switch_mode.html';
                 });
               }else{
                 if(r.userType=="vip"){
                   $(".switch").addClass("only-vip");
                   $(".switch>span").text("VIP订阅");
-                  $(".switch").click(tosetpage);  
+                  $(".switch").click(tosetpage);
+                  thisClass.InitVip(r);
                 }else{
                   $(".switch").addClass("only-personal");
                   $(".switch>span").text("¥5.8 开通VIP");
                   $(".switch").click(tointroducepage);
+                  thisClass.InitPersonal(r);
                 }
               }
             });
@@ -151,14 +249,6 @@
                 hasNextPage = sessionStorage.historypushHasNextPage == "true" ? true : false;
                 scrollTop = sessionStorage.historypushScrollTop;
                 dataCache = JSON.parse(sessionStorage.historypushDataCache);
-                isVipSub = sessionStorage.isVipSub == "true" ? true : false;
-                ;
-                isPassCount = sessionStorage.isPassCount == "true" ? true : false;
-                ;
-                haskey = sessionStorage.haskey == "true" ? true : false;
-                ;
-                isOnTail = sessionStorage.isOnTail;
-                isExpire = sessionStorage.isExpire;
                 userId = sessionStorage.userId;
                 firstTime = sessionStorage.getItem(userId + "_searchTime");
                 selectCity = sessionStorage.getItem(userId + "_selectCity");
@@ -192,18 +282,8 @@
                         lasttime = data.thistime;
                         firstPage = data.data;
                         hasNextPage = data.hasNextPage;
-                        isVipSub = data.isVipSub;
-                        sessionStorage.isVipSub = isVipSub;
                         userId = data.userId;
                         sessionStorage.userId = userId;
-                        isPassCount = data.isPassCount;
-                        sessionStorage.isPassCount = isPassCount;
-                        haskey = data.haskey;
-                        sessionStorage.haskey = haskey;
-                        isOnTail = data.isOnTail;
-                        sessionStorage.isOnTail = isOnTail;
-                        isExpire = data.isExpire;
-                        sessionStorage.isExpire = isExpire;
                         sessionStorage.setItem(userId + "_searchTime", firstTime);
                         showPage();
                     },
@@ -265,96 +345,6 @@
             $(".tab_left .time").show();
             //地区渲染
             mapData();
-            //
-            if (!isVipSub) {
-                $("#sub_manager").click(function(){
-                  setSessionStorage();
-                  window.location.href = '/jyapp/wxkeyset/keyset/index';
-                });
-                $(".tab_left .area").hide();
-                $(".vip_banner").show();
-                //$(".listcontent").css("margin-top","2rem");
-                if (isPassCount) {
-                    $(".open_remind").show();
-                }
-                if (parseInt(isExpire) < 0 && parseInt(isOnTail) == -1) {
-                    if (localStorage.getItem("nv_vip_" + userId) == null) {
-                        $(".nv_renew_toast").show();
-                    }
-                }
-                if (!firstPage.length > 0 && !haskey) {
-                    if (sessionStorage && (sessionStorage.keysetindexToHistory == "1" || sessionStorage.keysetindexToHistory == "2" || sessionStorage.keysetindexToHistory == "3")) {
-                        sessionStorage.removeItem("keysetindexToHistory");
-                        return
-                    }
-                    if (firstTime != "") {
-                        return
-                    }
-                    history.pushState({}, "", "");
-                    if (isInTSguide) {
-                        if (localStorage) {
-                            localStorage.removeItem("tsGuide_status");
-                        }
-                        window.location.href = '/jyapp/tenderSubscribe/guide';
-                    } else {
-                        window.location.href = '/jyapp/wxkeyset/keyset/index';
-                    }
-                }
-            } else {
-                if (!haskey) {
-                    $(".set_keyword").show();
-                    if (isPassCount && (localStorage.isPassCount == null || localStorage.isPassCount != date.split("-")[2])) {
-                        localStorage.isPassCount = date.split("-")[2]
-                        weuiDialog();
-                    }
-                }
-                if (parseInt(isOnTail) != 1) {
-                    if (parseInt(isExpire) > 1) {
-                        $(".renew_toast .isExpire").text(parseInt(isExpire));
-                        $(".renew_toast").show();
-                    } else if (parseInt(isExpire) > 0) {
-                        $(".renew_toast").find(".other").hide();
-                        $(".renew_toast").find(".today").show();
-                        $(".renew_toast").show();
-                    }
-                } else {
-                    if (parseInt(isExpire) > 1) {
-                        $("._renew_toast .isExpire").text(parseInt(isExpire));
-                        $("._renew_toast").show();
-                    } else if (parseInt(isExpire) > 0) {
-                        $("._renew_toast").find(".other").hide();
-                        $("._renew_toast").find(".today").show();
-                        $("._renew_toast").show();
-                    }
-                }
-                $("#sub_manager").click(tosetpage);
-                $(".vip_report").show();
-                $(".tab_left .area").show();
-                $.post("/subscribepay/report/tip?t=" + new Date().getTime(), null, function (r) {
-                    if (r.unread > 0) {
-                        $(".vip_report>a").show();
-                    }
-                    if (r.tip) {
-                        if (r.tip.type == 2) {
-                            $(".vip_report_tip .weekly>span").text("周");
-                        } else {
-                            $(".vip_report_tip .weekly>span").text("月");
-                        }
-                        $(".vip_report_tip .term").text(new Date(Number(r.tip.startdate + "000")).Format("yyyy年M月d日") + "-" + new Date(Number(r.tip.enddate + "000")).Format("yyyy年M月d日"));
-                        $('.vip_report_tip').fadeIn();
-                        $('.vip_report_todetail').on('click', function () {
-                            updateReportStatus(1, r.tip.startdate, r.tip.enddate, r.tip.pushcount);
-                        });
-                        $('.weui-dialog img.vip_report_tip_close').click(function () {
-                            $('.vip_report_tip').fadeOut();
-                            updateReportStatus(0);
-                        });
-                    }
-                });
-                $(".vip_report").click(function () {
-                    window.location.href = "/vipreport/page/subreport.html";
-                });
-            }
         }
 
         //下拉刷新
@@ -767,6 +757,12 @@
             }
         }
 
+        //免费用户关键词设置
+        function tokeyset() {
+          setSessionStorage();
+          window.location.href = '/jyapp/wxkeyset/keyset/index';
+        }
+
         //介绍页
         function tointroducepage() {
             setSessionStorage();
@@ -1023,10 +1019,11 @@
         .app-layout-header>ul>li:last-child{
           font-size: 15px;
           align-self: center;
-        }
-        .app-layout-header>ul>li:last-child>img{
-          width:14px;
-          margin-right: 5px;
+          padding-left: 19px;
+          background-image: url("/jyapp/images/sub_manager.png");
+          background-size: 14px;
+          background-repeat: no-repeat;
+          background-position: left center;
         }
         .app-layout-header .switch{
           padding: 0px 10px;
@@ -1112,7 +1109,7 @@
   <ul>
     <li>订阅</li>
     <li><div class="switch"><span></div></span></li>
-    <li id="sub_manager"><img src="/jyapp/images/sub_manager.png">订阅管理</li>
+    <li id="sub_manager">订阅管理</li>
   </ul>
 </div>
 <div class="app-layout-content-b">

+ 7 - 6
src/jfw/modules/entniche/src/config.json

@@ -1,17 +1,18 @@
 {
 	"webPort": "811",
 	"mongodb":{
-		"address":"192.168.3.128:27080",
+		"address":"127.0.0.1:27080",
 		"size":5,
 		"dbName":"qfw"
 	},
-    "redisAddrs": "other=192.168.3.128:1712,session=192.168.3.128:1712",
+    "redisAddrs": "other=127.0.0.1:1712,session=127.0.0.1:1712",
     "mysql": {
         "dbName": "jianyu",
-        "address": "192.168.3.11:3366",
+        "address": "127.0.0.1:3366",
         "userName": "root",
         "passWord": "Topnet123",
-		"maxOpenConns":500,
-		"maxIdleConns":200
-    }
+		"maxOpenConns":2,
+		"maxIdleConns":2
+    },
+    "userInEntLimit":5
 }

+ 1 - 0
src/jfw/modules/entniche/src/config/config.go

@@ -28,6 +28,7 @@ type config struct {
 		MaxOpenConns int
 		MaxIdleConns int
 	}
+	UserInEntLimit int64
 }
 type timeTaskConfig struct {
 	CheckIsExpire string //定时更新用户状态

+ 2 - 1
src/jfw/modules/entniche/src/service/person/person.go

@@ -2,6 +2,7 @@
 package person
 
 import (
+	. "config"
 	"database/sql"
 	. "entity"
 	"fmt"
@@ -92,7 +93,7 @@ func (a *Action) Add() {
 	status, user_id := func() (int, int64) {
 		if VarUser.AddIsExists(entId, phone) {
 			return -1, 0
-		} else if VarEntInfo.IsQuota(entId) {
+		} else if Mysql.CountBySql(`SELECT count(1) from entniche_user where phone=?`, phone) >= Config.UserInEntLimit {
 			return -2, 0
 		}
 		var user_id int64

+ 0 - 2
src/jfw/modules/entniche/src/util/constant.go

@@ -12,9 +12,7 @@ const (
 	Entniche_department_parent = "entniche_department_parent"
 	Entniche_info              = "entniche_info"
 	Entniche_log               = "entniche_log"
-	Entniche_power             = "entniche_power"
 	Entniche_role              = "entniche_role"
-	Entniche_role_power        = "entniche_role_power"
 	Entniche_user              = "entniche_user"
 	Entniche_user_role         = "entniche_user_role"
 	Entniche_user_rule         = "entniche_user_rule"

+ 9 - 1
src/jfw/modules/pushsubscribe/src/match/config.json

@@ -15,5 +15,13 @@
 	"notMatchHour":[19,20,21,23,0,1,2,4,5],
 	"userBatch":10,
 	"pcHelperSleep":-1,
-	"pcHelper":"127.0.0.1:8082"
+	"pcHelper":"127.0.0.1:8082",
+	"mysql":{
+        "dbName":"jianyu",
+        "address":"127.0.0.1:3366",
+        "userName":"root",
+        "passWord":"Topnet123",
+		"maxOpenConns": 2,
+		"maxIdleConns": 2
+    }
 }

+ 8 - 0
src/jfw/modules/pushsubscribe/src/match/config/config.go

@@ -22,6 +22,14 @@ type config struct {
 	UserBatch        int      `json:"userBatch"`
 	PcHelper         string   `json:"pcHelper"`
 	PcHelperSleep    int      `json:"pcHelperSleep"`
+	Mysql            struct {
+		DbName       string
+		Address      string
+		UserName     string
+		PassWord     string
+		MaxOpenConns int
+		MaxIdleConns int
+	} `json:"mysql"`
 }
 
 type taskConfig struct {

+ 23 - 1
src/jfw/modules/pushsubscribe/src/match/job/matchjob.go

@@ -5,6 +5,7 @@ import (
 	"fmt"
 	. "match/config"
 	. "match/matcher"
+	. "match/util"
 	. "public"
 	"qfw/util"
 	"qfw/util/elastic"
@@ -20,7 +21,6 @@ import (
 )
 
 const (
-	DbName       = "qfw"
 	DB           = "bidding"
 	MaxId        = `{"query":{"filtered":{"filter":{"bool":{"must":{"range":{"id":{"gt":"%s"}}}}}}},"_source":["_id","comeintime"],"sort":{"id":"desc"},"from":0,"size":1}`
 	ProjectQuery = `{"query":{"filtered":{"filter":{"term":{"list.infoid":"%s"}}}},"_source":["_id","list.infoid"],"sort":{"id":"desc"},"from":0,"size":1}`
@@ -236,6 +236,10 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *VipU
 			originalKeys := []string{}                   //原始关键词
 			////////////////
 			for _, vs := range allKeySet {
+				if vs == nil {
+					logger.Error(user.Id, "关键词设置异常")
+					continue
+				}
 				var vs_keys []string
 				for _, vs_v := range [][]string{vs.Keys, vs.AppendKeys} {
 					for _, vs_vv := range vs_v {
@@ -701,3 +705,21 @@ func (m *MatchJob) ToRelationProject(projectUser *map[*UserInfo]*[]string, myMat
 	}
 	logger.Info("关联项目结束。。。", index)
 }
+
+func (m *MatchJob) LoadEntPersonal() map[string]map[int]bool {
+	user_ent_personal := map[string]map[int]bool{}
+	list := Mysql.SelectBySql("SELECT b.entid,b.phone from entniche_info a INNER JOIN entniche_user b on (a.model=2 and a.id=b.ent_id)")
+	if list == nil {
+		return
+	}
+	for _, v := range *list {
+		phone, _ := v["phone"].(string)
+		entId := util.IntAll(v["entid"])
+		if user_ent_personal[phone] == nil {
+
+			user_ent_personal[phone] = map[int]bool{}
+		}
+		user_ent_personal[phone][entId] = true
+	}
+	return user_ent_personal
+}

+ 12 - 8
src/jfw/modules/pushsubscribe/src/match/job/timetask.go

@@ -19,18 +19,20 @@ var Task = &timeTask{
 type MatchTimeTask struct {
 }
 
-func (m *MatchTimeTask) Execute() {
+func (m *MatchTimeTask) Execute(flag bool) {
 	hour := time.Now().Hour()
 	//23点到1点之间,不执行定时任务
 	//订阅付费有每天0点的定时任务删除pushspace_temp表的数据,会有冲突
 	isRun := true
-	if hour == 0 {
-		isRun = false
-	}
-	for _, v := range Config.NotMatchHour {
-		if v == hour {
+	if flag {
+		if hour == 0 {
 			isRun = false
-			break
+		}
+		for _, v := range Config.NotMatchHour {
+			if v == hour {
+				isRun = false
+				break
+			}
 		}
 	}
 	if isRun {
@@ -39,5 +41,7 @@ func (m *MatchTimeTask) Execute() {
 	}
 	t := time.Duration(Config.MatchDuration) * time.Minute
 	logger.Info("start match job after", t)
-	time.AfterFunc(t, m.Execute)
+	time.AfterFunc(t, func() {
+		m.Execute(true)
+	})
 }

+ 2 - 9
src/jfw/modules/pushsubscribe/src/match/main.go

@@ -4,28 +4,21 @@ package main
 import (
 	"flag"
 	"log"
-	. "match/config"
 	"match/job"
-	"qfw/util/elastic"
-	"qfw/util/mongodb"
-	"qfw/util/redis"
 
 	"github.com/donnie4w/go-logger/logger"
 )
 
 func main() {
-	modle := flag.Int("m", 0, "默认:0;1 匹配数据")
+	modle := flag.Int("m", 0, "默认:0;1 非定时任务匹配数据")
 	flag.Parse()
 	logger.SetConsole(false)
 	logger.SetRollingDaily("./logs", "match.log")
-	mongodb.InitMongodbPool(Config.MgoSize, Config.MgoAddr, job.DbName)
-	redis.InitRedis(Config.RedisServers)
-	elastic.InitElasticSize(Config.ElasticSearch, Config.ElasticPoolSize)
 	log.Println("订阅推送-匹配数据程序启动。。。")
 	if *modle == 1 {
 		job.Jobs.Match.Execute()
 	} else {
-		go job.Task.Match.Execute()
+		go job.Task.Match.Execute(false)
 		<-chan bool(nil)
 	}
 }

+ 34 - 0
src/jfw/modules/pushsubscribe/src/match/util/db.go

@@ -0,0 +1,34 @@
+package util
+
+import (
+	"log"
+	. "match/config"
+	"qfw/util/elastic"
+	"qfw/util/mongodb"
+	"qfw/util/mysql"
+	"qfw/util/redis"
+)
+
+var (
+	Mysql  *mysql.Mysql
+	DbName = "qfw"
+)
+
+func init() {
+	mongodb.InitMongodbPool(Config.MgoSize, Config.MgoAddr, DbName)
+	log.Println("mongodb初始化完成!")
+	redis.InitRedis(Config.RedisServers)
+	log.Println("redis初始化完成!")
+	elastic.InitElasticSize(Config.ElasticSearch, Config.ElasticPoolSize)
+	log.Println("elastic初始化完成!")
+	Mysql = &mysql.Mysql{
+		DBName:       Config.Mysql.DbName,
+		Address:      Config.Mysql.Address,
+		UserName:     Config.Mysql.UserName,
+		PassWord:     Config.Mysql.PassWord,
+		MaxOpenConns: Config.Mysql.MaxOpenConns,
+		MaxIdleConns: Config.Mysql.MaxIdleConns,
+	}
+	Mysql.Init()
+	log.Println("mysql初始化完成!")
+}

+ 1 - 0
src/jfw/modules/pushsubscribe/src/public/entity.go

@@ -33,6 +33,7 @@ type UserInfo struct {
 	CreateTime    int64
 	O_jy          *O_jy
 	O_vipjy       *O_vipjy
+	O_entniche    *O_vipjy
 }
 
 type O_jy struct {

+ 20 - 16
src/jfw/modules/pushsubscribe/src/public/util.go

@@ -12,22 +12,26 @@ import (
 )
 
 const (
-	BulkSize            = 20
-	BigBulkSize         = 100
-	OneDaySecond        = 86400
-	SevenDay            = 604800
-	User                = "user"
-	Bidding             = "bidding"
-	Projectset          = "projectset"
-	Pushspace_project   = "pushspace_project"
-	Pushspace_statistic = "pushspace_statistic"
-	Pushspace_temp      = "pushspace_temp"
-	Pushspace_vip       = "pushspace_vip"
-	Pushspace_vip_fail  = "pushspace_vip_fail"
-	Pushspace_fail      = "pushspace_fail"
-	Pushspace           = "pushspace"
-	Pushcache_1         = "pushcache_1"
-	Pushcache_2_a       = "pushcache_2_a"
+	BulkSize                         = 20
+	BigBulkSize                      = 100
+	OneDaySecond                     = 86400
+	SevenDay                         = 604800
+	User                             = "user"
+	Bidding                          = "bidding"
+	Projectset                       = "projectset"
+	Pushspace_project                = "pushspace_project"
+	Pushspace_statistic              = "pushspace_statistic"
+	Pushspace_temp                   = "pushspace_temp"
+	Pushspace_vip                    = "pushspace_vip"
+	Pushspace_vip_fail               = "pushspace_vip_fail"
+	Pushspace_fail                   = "pushspace_fail"
+	Pushcache_entniche_personal      = "pushcache_entniche_personal"
+	Pushcache_entniche_personal_temp = "pushcache_entniche_personal_temp"
+	Pushcache_entniche_unified       = "pushcache_entniche_unified"
+	Pushcache_entniche_unified_temp  = "pushcache_entniche_unified_temp"
+	Pushspace                        = "pushspace"
+	Pushcache_1                      = "pushcache_1"
+	Pushcache_2_a                    = "pushcache_2_a"
 )
 
 var (

+ 2 - 1
src/jfw/modules/pushsubscribe/src/push/config.json

@@ -51,7 +51,8 @@
 	"testids":["5d81c5a525ef8723ac0036f9"],
 	"weixinRpcServer":"127.0.0.1:8083",
 	"wxColor":"#2cb7ca",
-	"wxGroup":"招标信息",
+	"wxType":"标讯订阅",
+	"vipWxType":"VIP订阅",
 	"wxTitle":"根据你订阅的关键词“%s”,剑鱼标讯为你推送以下信息。如果不想继续收到此类信息,可进入招标订阅的设置页面取消订阅。",
 	"vipWxTitle":"根据你当前订阅,剑鱼标讯为你推送以下信息。如果不想继续收到此类信息,可进入招标订阅的设置页面取消订阅。",
 	"wxDetailColor":"#686868",

+ 2 - 3
src/jfw/modules/pushsubscribe/src/push/config/config.go

@@ -28,8 +28,9 @@ type config struct {
 	TestIds                 []string       `json:"testIds"`
 	WeixinRpcServer         string         `json:"weixinRpcServer"`
 	WxColor                 string         `json:"wxColor"`
-	WxGroup                 string         `json:"wxGroup"`
 	WxTitle                 string         `json:"wxTitle"`
+	WxType                  string         `json:"wxType"`
+	VipWxType               string         `json:"vipWxType"`
 	VipWxTitle              string         `json:"vipWxTitle"`
 	WxDetailColor           string         `json:"wxDetailColor"`
 	AppPushServiceRpc       string         `json:"appPushServiceRpc"`
@@ -91,7 +92,6 @@ var (
 	Gmails         []*mail.GmailAuth
 	Config         *config
 	ProjectTask    *projectTask
-	WxGroupLen     int
 	FastigiumStart int
 	FastigiumEnd   int
 )
@@ -104,7 +104,6 @@ func init() {
 		FastigiumStart = util.IntAll(fastigiumTimes[0])
 		FastigiumEnd = util.IntAll(fastigiumTimes[1])
 	}
-	WxGroupLen = len([]rune(Config.WxGroup))
 	Gmails = make([]*mail.GmailAuth, len(Config.Mails))
 	for k, v := range Config.Mails {
 		Gmails[k] = &mail.GmailAuth{

+ 5 - 1
src/jfw/modules/pushsubscribe/src/push/job/pushjob.go

@@ -186,7 +186,11 @@ func (p *PushJob) doPush(pusher Pusher, taskType int, pushWay *putil.PushWay, u
 				wxTitle = fmt.Sprintf(Config.WxTitle, wxTitleKeys)
 			}
 			TitleLen := len([]rune(wxTitle))
-			reLen := 200 - TitleLen - 10 - WxGroupLen - len([]rune(tip))
+			TypeLen := len([]rune(Config.WxType))
+			if IsVipUser(u.VipStatus) {
+				TypeLen = len([]rune(Config.VipWxType))
+			}
+			reLen := 200 - TitleLen - 10 - TypeLen - len([]rune(tip))
 			wxTplTitle := ""
 			bshow := false
 			for n := 1; n < len(pushParam.TitleArray)+1; n++ {

TEMPAT SAMPAH
src/jfw/modules/pushsubscribe/src/push/push


+ 5 - 1
src/jfw/modules/pushsubscribe/src/push/util/rpccall.go

@@ -31,11 +31,15 @@ func SendWeixin(k *UserInfo, remark, title string, pushDate int64) bool {
 	if Config.WxSleep > 0 {
 		time.Sleep(time.Duration(Config.WxSleep) * time.Millisecond)
 	}
+	wxTplType := Config.WxType
+	if IsVipUser(k.VipStatus) {
+		wxTplType = Config.VipWxType
+	}
 	p := &qrpc.NotifyMsg{
 		Openid:      k.S_m_openid,
 		Title:       title,
 		Remark:      remark,
-		Detail:      Config.WxGroup,
+		Detail:      wxTplType,
 		Date:        "",
 		Service:     util.NowFormat(util.Date_Short_Layout),
 		Color:       Config.WxColor,

+ 0 - 1
src/jfw/modules/subscribepay/src/entity/entniche.go

@@ -35,7 +35,6 @@ func (e *entnicheStruct) PayCallBack(param *CallBackParam) bool {
 			phone, _ := filter["phone"].(string)
 			industry, _ := filter["industry"].(string)
 			enddate := time.Date(now.Year()+cycle, now.Month(), now.Day(), 23, 59, 59, 0, time.Local)
-			var filter_id int64
 			ent := util.Mysql.FindOne("entniche_info", map[string]interface{}{
 				"name":  entname,
 				"phone": phone,

+ 12 - 1
src/jfw/modules/subscribepay/src/service/entniche.go

@@ -67,7 +67,10 @@ func (e *Entniche) Buy() {
 		if util.Mysql.Count("entniche_info", map[string]interface{}{"name": entname, "phone": phone, "status": 1}) > 0 {
 			return -2, ""
 		}
-		order_money := int(config.EntnicheConfig.Discount * price * float64(cycle) * 100)
+		order_money := int(config.EntnicheConfig.Discount * price * float64(cycle) * float64(personnum) * 100)
+		if order_money < 1 {
+			order_money = 1
+		}
 		code := pay.GetOrderCode(userId)
 		if util.Mysql.ExecTx("企业商机管理创建订单", func(tx *sql.Tx) bool {
 			filter, _ := json.Marshal(map[string]interface{}{
@@ -103,6 +106,14 @@ func (e *Entniche) Buy() {
 			isadmin = 1
 		}
 	}
+	log.Println(map[string]interface{}{
+		"error_code": 0,
+		"data": map[string]interface{}{
+			"status":    status,
+			"ordercode": ordercode,
+			"isadmin":   isadmin,
+		},
+	})
 	e.ServeJson(map[string]interface{}{
 		"error_code": 0,
 		"data": map[string]interface{}{