瀏覽代碼

Merge branch 'dev2.10.12' of http://192.168.3.207:10080/qmx/jy into dev2.10.12

zhangxinlei1996 5 年之前
父節點
當前提交
e53e397b66
共有 27 個文件被更改,包括 490 次插入268 次删除
  1. 4 4
      src/config.json
  2. 1 0
      src/jfw/modules/app/src/app/front/shorturl.go
  3. 25 4
      src/jfw/modules/app/src/web/staticres/jyapp/js/common.js
  4. 0 17
      src/jfw/modules/app/src/web/staticres/jyapp/js/searchindex.js
  5. 9 7
      src/jfw/modules/app/src/web/templates/me/download.html
  6. 1 0
      src/jfw/modules/app/src/web/templates/weixin/historypush.html
  7. 169 0
      src/jfw/modules/distribution/src/service/action/capital.go
  8. 0 2
      src/jfw/modules/distribution/src/service/action/logoff.go
  9. 0 2
      src/jfw/modules/distribution/src/service/action/share.go
  10. 8 1
      src/jfw/modules/distribution/src/service/public/random.go
  11. 20 13
      src/jfw/modules/distribution/src/timetask/timetask.go
  12. 4 6
      src/jfw/modules/pushsubscribe/src/push/config.json
  13. 7 3
      src/jfw/modules/pushsubscribe/src/push/config/config.go
  14. 209 184
      src/jfw/modules/pushsubscribe/src/push/job/projectjob.go
  15. 1 1
      src/jfw/modules/pushsubscribe/src/push/projecttask.json
  16. 1 0
      src/jfw/modules/pushsubscribe/src/push/pusher/normalpush.go
  17. 二進制
      src/jfw/modules/pushsubscribe/src/push/pushsubscribe_push
  18. 3 6
      src/jfw/modules/pushsubscribe/src/push/util/db.go
  19. 2 2
      src/jfw/modules/subscribepay/src/config.json
  20. 3 3
      src/jfw/modules/subscribepay/src/pay_config.json
  21. 5 5
      src/jfw/modules/weixin/src/config.json
  22. 3 3
      src/jfw/modules/weixin/src/distribution.json
  23. 2 2
      src/jfw/modules/wxtoken/src/config.json
  24. 9 0
      src/jfw/public/search.go
  25. 2 1
      src/web/staticres/css/pc.css
  26. 1 1
      src/web/templates/course/pc/order_detail.html
  27. 1 1
      src/web/templates/pc/aboutus.html

+ 4 - 4
src/config.json

@@ -8,7 +8,7 @@
     "weixinrpc": "127.0.0.1:8083",
     "cacheflag": false,
     "agreement": "http",
-    "webdomain": "http://web-jydev-zxl.jianyu360.cn",
+    "webdomain": "http://web-jydev-wss.jianyu360.cn",
     "redirect": {
         "searchinfo": "/jylab/mainSearch",
         "rssset": "/swordfish/historypush",
@@ -43,7 +43,7 @@
 		"msgremind": "/front/vipsubscribe/msgremind?%s",
 		"treasurebox":"/jyTreasureBox/treasureBox",
 		"vipreport":"/subscribepay/report/wxtplmsg?start=%s&end=%s&pushcount=%s",
-		"viphomepage":"/weixin/pay/toSubVipSetPage",
+		"viphomepage":"/front/vipsubscribe/toSubVipSetPage",
 		"liveAcitve":"/active/livePage/index"
     },
     "jy_activeset": {
@@ -191,8 +191,8 @@
     "advertName": "广告",
     "advertUrl": "/swordfish/about",
     "wxJianyu": {
-        "appid": "wxfa161ce88ab7584e",
-        "appsecret": "4776638e01eda5f44780dc2abfebb236"
+        "appid": "wx5b1c6e7cc4dac0e4",
+        "appsecret": "b026103ffebd2291b3edb7a269612112"
     },
     "industry": "分类综合测试",
     "recommendEntLimit": "50",

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

@@ -2,6 +2,7 @@ package front
 
 import (
 	"jfw/config"
+	"time"
 
 	//"math/rand"
 	. "app/jyutil"

+ 25 - 4
src/jfw/modules/app/src/web/staticres/jyapp/js/common.js

@@ -1268,7 +1268,7 @@ function distribInfo(tt){
 		if (discored!=""){
 			$.ajax({
 				url: "/distribution/share/getWordInfo?t="+new Date().getTime(),
-				type: "GET",
+				type: "POST",
 				data: {copyTxt:tt},
 				async:false,
 				dataType: "json",
@@ -1277,6 +1277,8 @@ function distribInfo(tt){
 					if(r.flag){
 						//清除客户端粘贴板
 						try{
+							nowTime = new Date(formatDate(nowTime,true)+ " 00:00:00").getTime();
+							localStorage.setItem("Active_Vip_Invite",nowTime);
 							JyObj.clearRight();
 						}catch(e){}
 						tipFlag = false;
@@ -1295,11 +1297,12 @@ function distribInfo(tt){
 								}
 								history.replaceState(null,null,myHref+fh+"appUrl="+encodeURIComponent(appUrl))
 							}else{
-								window.location.href="/jyapp/free/login?url="+encodeURIComponent(appUrl);
+								appUrl = "/jyapp/free/login?url="+encodeURIComponent(appUrl);
 							}
-						}else{
-							DisWord_Tip_Invite(imgUrl,modular,nickName,appUrl);
 						}
+						setTimeout(function(){
+							DisWord_Tip_Invite(imgUrl,modular,nickName,appUrl);
+						},500)
 					}
 				},
 				error: function(){
@@ -1350,4 +1353,22 @@ function DTIClose(){
 		$(".modal-backdrop").remove();
 	});
 	$("#myModal-tap").removeClass("in");
+}
+//格式化时间
+function formatDate(date,hms) {
+	if(date ===null || date==="" || date === 0){
+		return "-"
+	}
+	var date = new Date(date);
+	var YY = date.getFullYear() + '-';
+	var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
+	var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
+	var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
+	var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
+	var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
+	if(!hms){
+		return YY + MM + DD + " " + hh + mm + ss
+	}else{
+		return YY + MM + DD
+	}
 }

+ 0 - 17
src/jfw/modules/app/src/web/staticres/jyapp/js/searchindex.js

@@ -3698,20 +3698,3 @@ var Active_Vip_Invite = function(nowTime){
 //
 var ActiveTip = null;
 
-function formatDate(date,hms) {
-	if(date ===null || date==="" || date === 0){
-		return "-"
-	}
-	var date = new Date(date);
-	var YY = date.getFullYear() + '-';
-	var MM = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
-	var DD = (date.getDate() < 10 ? '0' + (date.getDate()) : date.getDate());
-	var hh = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
-	var mm = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
-	var ss = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds());
-	if(!hms){
-		return YY + MM + DD + " " + hh + mm + ss
-	}else{
-		return YY + MM + DD
-	}
-}

+ 9 - 7
src/jfw/modules/app/src/web/templates/me/download.html

@@ -98,13 +98,15 @@
 	<script type="text/javascript">
 		var isIos = !!navigator.userAgent.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
 		//如果已安装,直接打开app
-		try{
-			if(isIos){
-				window.location.href = "jianyuiosapp://";
-			}else{
-				window.location.href = "jyscheme://host";
-			}
-		}catch(e){}
+    setTimeout(function(){
+  		try{
+  			if(isIos){
+  				window.location.href = "jianyuiosapp://";
+  			}else{
+  				window.location.href = "jyscheme://host";
+  			}
+  		}catch(e){}
+    },1000);
 		//
 		document.getElementById("rightcorner-bg").onclick = function(){
 			this.style.display = "none";

+ 1 - 0
src/jfw/modules/app/src/web/templates/weixin/historypush.html

@@ -679,6 +679,7 @@
       $(".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 () {
+        $('.vip_report_tip').fadeOut();
         updateReportStatus(1, r.tip.startdate, r.tip.enddate, r.tip.pushcount);
       });
       $('.weui-dialog img.vip_report_tip_close').click(function () {

+ 169 - 0
src/jfw/modules/distribution/src/service/action/capital.go

@@ -0,0 +1,169 @@
+//注销
+package action
+
+import (
+	. "api"
+	"fmt"
+	"qfw/util"
+	. "service/config"
+	"sort"
+	"strings"
+	"time"
+
+	"github.com/go-xweb/xweb"
+)
+
+type Capital struct {
+	*xweb.Action
+	list xweb.Mapper `xweb:"/capital/list"` //资金列表
+}
+
+type CapitalList struct {
+	Type     string //提现、上月结算、佣金、实名认证、代扣个税
+	Money    string //
+	Date     string //
+	Status   string //已申请、未结算
+	TaxCash  string //代扣个税
+	AuthCash string //实名认证
+}
+
+type SortList []*CapitalList
+
+func (s SortList) Len() int {
+	return len(s)
+}
+
+func (s SortList) Less(i, j int) bool {
+	a, _ := time.ParseInLocation(util.Date_Full_Layout, s[i].Date, time.Local)
+	b, _ := time.ParseInLocation(util.Date_Full_Layout, s[j].Date, time.Local)
+	return a.Unix() > b.Unix()
+}
+
+func (s SortList) Swap(i, j int) {
+	s[i], s[j] = s[j], s[i]
+}
+
+func init() {
+	xweb.AddAction(&Capital{})
+}
+
+//资金列表
+func (l *Capital) List() {
+	userId, _ := l.GetSession("userId").(string)
+	sl := SortList{}
+	dis_sale := Mysql.SelectBySql(`select commission,sale_status,createtime from dis_sale where uid=?`, userId)
+	if dis_sale != nil {
+		for _, v := range *dis_sale {
+			sl = append(sl, &CapitalList{
+				Type:   "佣金",
+				Money:  fmt.Sprintf("+%.2f", util.Float64All(v["commission"])/100),
+				Date:   util.ObjToString(v["createtime"]),
+				Status: "",
+			})
+		}
+	}
+	dis_count := Mysql.SelectBySql(`select commission,count_cash,auth_cash,tax_cash,count_status,createtime from dis_count where uid=?`, userId)
+	if dis_count != nil {
+		for _, v := range *dis_count {
+			cl := &CapitalList{
+				Type: "上月结算",
+				Date: util.ObjToString(v["createtime"]),
+			}
+			if util.IntAll(v["count_status"]) == 2 {
+				if commission := util.Float64All(v["commission"]); commission > 0 {
+					cl.Money = fmt.Sprintf("¥%.2f", commission/100)
+				}
+				cl.Status = "未结算"
+			} else {
+				if count_cash := util.Float64All(v["count_cash"]); count_cash > 0 {
+					cl.Money = fmt.Sprintf("¥%.2f", count_cash/100)
+				}
+			}
+			if tax_cash := util.Float64All(v["tax_cash"]); tax_cash > 0 {
+				cl.TaxCash = fmt.Sprintf("-%.2f", tax_cash/100)
+			}
+			if auth_cash := util.Float64All(v["auth_cash"]); auth_cash > 0 {
+				cl.AuthCash = fmt.Sprintf("-%.2f", auth_cash/100)
+			}
+			if cl.Money != "" || cl.TaxCash != "" || cl.AuthCash != "" {
+				sl = append(sl, cl)
+			}
+		}
+	}
+	dis_cashout := Mysql.SelectBySql(`select money,cashout_status,createtime from dis_cashout where uid=?`, userId)
+	if dis_cashout != nil {
+		for _, v := range *dis_cashout {
+			status := ""
+			cashout_status := util.IntAll(v["cashout_status"])
+			if cashout_status == 0 {
+				status = "已申请"
+			} else if cashout_status == -1 {
+				continue
+			}
+			if money := util.Float64All(v["money"]); money > 0 {
+				sl = append(sl, &CapitalList{
+					Type:   "提现",
+					Money:  fmt.Sprintf("-%.2f", money/100),
+					Date:   util.ObjToString(v["createtime"]),
+					Status: status,
+				})
+			}
+		}
+	}
+	sort.Sort(sl)
+	all := []M{}
+	array := []M{}
+	prevDate := ""
+	for k, v := range sl {
+		dates := strings.Split(strings.Split(v.Date, " ")[0], "-")
+		if len(dates) != 3 {
+			continue
+		}
+		yearMonth := fmt.Sprintf("%s年 %s月", dates[0], dates[1])
+		day := fmt.Sprintf("%s日", dates[2])
+		if prevDate == "" {
+			prevDate = yearMonth
+		}
+		if prevDate != yearMonth {
+			all = append(all, M{
+				"date": yearMonth,
+				"list": array,
+			})
+			array = []M{}
+			prevDate = yearMonth
+		}
+		if v.AuthCash != "" {
+			array = append(array, M{
+				"day":    day,
+				"type":   "实名认证",
+				"status": "",
+				"money":  v.AuthCash,
+			})
+		}
+		if v.TaxCash != "" {
+			array = append(array, M{
+				"day":    day,
+				"type":   "代扣个税",
+				"status": "",
+				"money":  v.TaxCash,
+			})
+		}
+		array = append(array, M{
+			"day":    day,
+			"type":   v.Type,
+			"status": v.Status,
+			"money":  v.Money,
+		})
+		if k == len(sl)-1 {
+			all = append(all, M{
+				"date": yearMonth,
+				"list": array,
+			})
+			array = []M{}
+			prevDate = yearMonth
+		}
+	}
+	l.ServeJson(Result{
+		Data: all,
+	})
+}

+ 0 - 2
src/jfw/modules/distribution/src/service/action/logoff.go

@@ -12,14 +12,12 @@ import (
 	"github.com/go-xweb/xweb"
 )
 
-//申请成为伙伴接口
 type Logoff struct {
 	*xweb.Action
 	accountinfo xweb.Mapper `xweb:"/logoff/accountinfo"` //账户详情
 	sure        xweb.Mapper `xweb:"/logoff/sure"`        //注销
 }
 
-//申请接口(个人和企业)
 func init() {
 	xweb.AddAction(&Logoff{})
 }

+ 0 - 2
src/jfw/modules/distribution/src/service/action/share.go

@@ -111,8 +111,6 @@ func (this *Share) GetWordInfo() {
 		"msg":     "请求方式有误",
 		"isLogin": false,
 	}
-	log.Println("---", this.Method())
-	METHOD = this.Method()
 	if this.Method() == METHOD {
 		isLogin := false
 		userId, _ := this.GetSession("userId").(string)

+ 8 - 1
src/jfw/modules/distribution/src/service/public/random.go

@@ -7,6 +7,7 @@ import (
 	"math/rand"
 	"qfw/util/redis"
 	"service/config"
+	"strings"
 	"sync"
 	"time"
 )
@@ -15,12 +16,14 @@ var VarLSCPool = &LSCPool{
 	JobQueue:  make(chan string, config.Sysconfig.JobNum),
 	WorkerNum: config.Sysconfig.WorkerNum,
 	Lock:      &sync.Mutex{},
+	Randoms:   "",
 }
 
 type LSCPool struct {
 	JobQueue  chan string //待取的口令
 	WorkerNum int         //当前工作的协程数
-	Lock      *sync.Mutex
+	Lock      *sync.Mutex //口令锁
+	Randoms   string      //口令集合
 }
 
 func (this *LSCPool) GetJob() string {
@@ -47,6 +50,10 @@ func (this *LSCPool) GetRandom() string {
 	//如果使用过了 重新获取
 	for {
 		LSC := this.SpecialChar(0) + this.LetterRandom(8)
+		if strings.Contains(this.Randoms, LSC) {
+			continue
+		}
+		this.Randoms += LSC + "|"
 		ok, _ := redis.Exists("other", "DIS_"+LSC)
 		if ok {
 			continue

+ 20 - 13
src/jfw/modules/distribution/src/timetask/timetask.go

@@ -47,6 +47,7 @@ func init() {
 	go func() {
 		for _, v := range []string{"超级订阅", "数据导出", "数据报告", "线上课程"} {
 			shareCount(v)
+			time.Sleep(50 * time.Millisecond)
 		}
 	}()
 }
@@ -107,8 +108,7 @@ func settlement() {
 				log.Println(uid, "佣金异常不进行结算", "佣金", commission)
 				continue
 			}
-			count_code := VarOrderCode.Get() //结算单号
-			var can_cash int64               //可提现金额
+			var can_cash int64 //可提现金额
 			account := Mysql.SelectBySql(`select money from account where uid=?`, uid)
 			if account != nil && len(*account) > 0 {
 				can_cash, _ = (*account)[0]["money"].(int64)
@@ -117,16 +117,20 @@ func settlement() {
 				continue
 			}
 			var sFx *settlementFx
-			var partner_auth_cash int64 //认证费用
+			var partner_auth_cash int64      //认证费用
+			count_code := VarOrderCode.Get() //结算单号
+			nowFormat := util.NowFormat(util.Date_Full_Layout)
 			partner := Mysql.SelectBySql(`select a.name,a.type,a.auth_cost,a.auth_status,b.legal_idcard from dis_partner a left join dis_auth b on (b.auth_status=1 and a.id=b.partner_id) where a.uid=?`, uid)
 			if partner != nil && len(*partner) > 0 {
-				auth_status, _ := (*partner)[0]["auth_status"].(int64)
-				if auth_status == 0 {
-					log.Println(uid, "没有认证,不进行结算")
-					continue
-				}
 				partner_type, _ := (*partner)[0]["type"].(int64)
 				if partner_type == 1 {
+					auth_status, _ := (*partner)[0]["auth_status"].(int64)
+					if auth_status == 0 {
+						Mysql.InsertBySql(`insert into dis_count (uid,code,commission,sale_cash,count_cash,can_cash,auth_cash,tax_cash,count_status,createtime,timestamp) values (?,?,?,?,?,?,?,?,?,?,?)`,
+							uid, count_code, commission, sale_money, 0, can_cash, 0, 0, 2, nowFormat, nowFormat)
+						log.Println(uid, "还没有认证,不进行实际结算,但记录资金流水")
+						continue
+					}
 					sFx = &settlementFx{}
 					sFx.name, _ = (*partner)[0]["name"].(string)           //姓名
 					sFx.idcard, _ = (*partner)[0]["legal_idcard"].(string) //身份证号
@@ -152,7 +156,6 @@ func settlement() {
 				log.Println(uid, "结算金额异常,不进行结算")
 				continue
 			}
-			nowFormat := util.NowFormat(util.Date_Full_Layout)
 			if Mysql.ExecTx("结算定时任务", func(tx *sql.Tx) bool {
 				ok_1 := Mysql.InsertBySqlByTx(tx, `insert into dis_count (uid,code,commission,sale_cash,count_cash,can_cash,auth_cash,tax_cash,count_status,createtime,timestamp) values (?,?,?,?,?,?,?,?,?,?,?)`,
 					uid, count_code, commission, sale_money, count_cash, can_cash, partner_auth_cash, tax_cash, 0, nowFormat, nowFormat)
@@ -318,11 +321,15 @@ func shareCount(product string) {
 		if inc < inc_min {
 			inc += inc_min
 		}
-		duration := r.Intn(duration_max)
-		if duration < duration_min {
-			duration += duration_min
+		duration_m := r.Intn(duration_max)
+		if duration_m < duration_min {
+			duration_m += duration_min
+		}
+		duration_s := r.Intn(duration_max)
+		if duration_s < duration_min {
+			duration_s += duration_min
 		}
-		d := time.Duration(duration) * time.Minute
+		d := time.Duration(duration_m)*time.Minute + time.Duration(duration_s)*time.Second
 		MQFW.Update("dis_product", map[string]interface{}{
 			"s_name": product,
 		}, map[string]interface{}{

File diff suppressed because it is too large
+ 4 - 6
src/jfw/modules/pushsubscribe/src/push/config.json


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

@@ -8,11 +8,16 @@ import (
 )
 
 type config struct {
-	JianyuDomain        string         `json:"jianyuDomain"`
-	RedisServers        string         `json:"redisServers"`
+	JianyuDomain  string `json:"jianyuDomain"`
+	RedisServers  string `json:"redisServers"`
+	ElasticSearch struct {
+		Size    int    `json:"size"`
+		Address string `json:"address"`
+	} `json:"elasticSearch"`
 	PushPoolSize        int            `json:"pushPoolSize"`
 	ProjectPushPoolSize int            `json:"projectPushPoolSize"`
 	LoadProjectPoolSize int            `json:"loadProjectPoolSize"`
+	ProjectPagingSize   int            `json:"projectPagingSize"`
 	Mail_content        string         `json:"mail_content"`
 	Mail_html           string         `json:"mail_html"`
 	Mail_title          string         `json:"mail_title"`
@@ -23,7 +28,6 @@ type config struct {
 	VipMaxPushSize      int            `json:"vipMaxPushSize"`
 	MaxRelationProject  int            `json:"maxRelationProject"`
 	Mongodb             *MongodbConfig `json:"mongodb"`
-	ProjectMongodb      *MongodbConfig `json:"projectMongodb"`
 	TestIds             []string       `json:"testIds"`
 	WeixinRpcServer     string         `json:"weixinRpcServer"`
 	AppPushServiceRpc   string         `json:"appPushServiceRpc"`

+ 209 - 184
src/jfw/modules/pushsubscribe/src/push/job/projectjob.go

@@ -2,189 +2,199 @@
 package job
 
 import (
+	"fmt"
 	. "public"
 	. "push/config"
 	putil "push/util"
 	. "qfw/mongodb"
 	"qfw/util"
+	"qfw/util/elastic"
 	"qfw/util/redis"
 	"sort"
 	"sync"
+	"sync/atomic"
 	"time"
 
 	"github.com/donnie4w/go-logger/logger"
 	"gopkg.in/mgo.v2/bson"
 )
 
+const (
+	projectQuery       = `{"query":{"filtered":{"filter":{"bool":{"must":[{"range":{"pici":{"gt":%d,"lte":%d}}}]}}}}%s}`
+	projectPagingQuery = `,"_source":["_id","list"],"from":%d,"size":%d`
+)
+
 type ProjectPushJob struct {
 }
 
 func (p *ProjectPushJob) Execute() {
 	logger.Info("开始关联项目推送任务。。。")
 	unix := time.Now().Unix()
-	projects := p.loadProject()
-	startId := ""
-	batchIndex := 0
-	//
-	pushPool := make(chan bool, Config.ProjectPushPoolSize)
-	pushWait := &sync.WaitGroup{}
-	for {
-		batchIndex++
-		batchCount, datas := p.loadPushspace_project(batchIndex, &startId)
-		logger.Info("开始第", batchIndex, "次关联项目匹配。。。")
-		index := 0
-		for k, v := range *datas {
-			pushPool <- true
-			pushWait.Add(1)
-			go func(userId string, list []map[string]interface{}) {
-				defer util.Catch()
-				defer func() {
-					<-pushPool
-					pushWait.Done()
-				}()
-				sess := putil.Mgo.GetMgoConn()
-				defer putil.Mgo.DestoryMongoConn(sess)
-				var u map[string]interface{}
-				sess.DB(Config.Mongodb.DbName).C(User).FindId(bson.ObjectIdHex(userId)).Select(map[string]interface{}{
-					"o_vipjy.i_projectmatch": 1,
-					"i_vip_status":           1,
-				}).One(&u)
-				if u == nil || len(u) == 0 {
-					logger.Error(userId, "没有找到该用户信息")
-					p.Delete(userId)
-					return
-				} else if util.IntAll(u["i_vip_status"]) <= 0 {
-					logger.Error(userId, "已经不再是vip")
-					p.Delete(userId)
-					return
-				}
-				o_vipjy, _ := u["o_vipjy"].(map[string]interface{})
-				if util.IntAll(o_vipjy["i_projectmatch"]) == 0 {
-					logger.Info(userId, "关联项目推送没有打开")
-					p.Delete(userId)
-					return
-				}
-				dayCountKey := DayCountKey(userId)
-				dayCount, err := redis.GetNewInt(Pushcache_2_a, dayCountKey)
-				if err != nil {
-					logger.Error(userId, "redis中获取当天推送总数出错", err)
-					return
-				} else if dayCount >= Config.VipMaxPushSize {
-					return
-				}
-				needCount := Config.VipMaxPushSize - dayCount
-				sortList := &SortList{}
-				length := 0
-				i := len(list)
-				for {
-					var updateProject [][]map[string]interface{}
-					for i > 0 {
-						i--
-						projectId, _ := list[i]["projectid"].(string)
-						pi, ok := projects.Load(projectId)
-						if !ok {
-							return
-						}
-						subtypes, _ := list[i]["subtypes"].([]interface{})
-						maxId, _ := list[i]["maxid"].(string)
-						userSubtype := map[string]bool{}
-						for _, t := range subtypes {
-							userSubtype[util.ObjToString(t)] = true
-						}
-						//
-						project, _ := pi.(map[string]interface{})
-						project_list, _ := project["list"].([]interface{})
-						infoId := ""
-						for _, pl := range project_list {
-							plm, _ := pl.(map[string]interface{})
-							infoId, _ = plm["infoid"].(string)
-							if bson.ObjectIdHex(infoId) <= bson.ObjectIdHex(maxId) {
-								continue
-							}
-							publishtime := util.Int64All(plm["publishtime"])
-							if unix-publishtime > Config.ProjectPublishTimeLimit { //发布时间7天之内
-								continue
-							}
-							subtype, _ := plm["subtype"].(string)
-							if len(userSubtype) > 0 && !userSubtype[subtype] {
-								continue
-							}
-							isExists, err := redis.Exists(Pushcache_2_a, PushInfoKey(userId, infoId))
-							if err != nil {
-								logger.Error("推送信息判重出错", err)
-								continue
+	projectLength, projects := p.loadProject(unix)
+	if projectLength > 0 {
+		startId := ""
+		batchIndex := 0
+		//
+		pushPool := make(chan bool, Config.ProjectPushPoolSize)
+		pushWait := &sync.WaitGroup{}
+		for {
+			batchIndex++
+			batchCount, datas := p.loadPushspace_project(batchIndex, &startId)
+			logger.Info("开始第", batchIndex, "次关联项目匹配。。。")
+			index := 0
+			for k, v := range *datas {
+				pushPool <- true
+				pushWait.Add(1)
+				go func(userId string, list []map[string]interface{}) {
+					defer util.Catch()
+					defer func() {
+						<-pushPool
+						pushWait.Done()
+					}()
+					sess := putil.Mgo.GetMgoConn()
+					defer putil.Mgo.DestoryMongoConn(sess)
+					var u map[string]interface{}
+					sess.DB(Config.Mongodb.DbName).C(User).FindId(bson.ObjectIdHex(userId)).Select(map[string]interface{}{
+						"o_vipjy.i_projectmatch": 1,
+						"i_vip_status":           1,
+					}).One(&u)
+					if u == nil || len(u) == 0 {
+						logger.Error(userId, "没有找到该用户信息")
+						p.Delete(userId)
+						return
+					} else if util.IntAll(u["i_vip_status"]) <= 0 {
+						logger.Error(userId, "已经不再是vip")
+						p.Delete(userId)
+						return
+					}
+					o_vipjy, _ := u["o_vipjy"].(map[string]interface{})
+					if util.IntAll(o_vipjy["i_projectmatch"]) == 0 {
+						logger.Info(userId, "关联项目推送没有打开")
+						p.Delete(userId)
+						return
+					}
+					dayCountKey := DayCountKey(userId)
+					dayCount, err := redis.GetNewInt(Pushcache_2_a, dayCountKey)
+					if err != nil {
+						logger.Error(userId, "redis中获取当天推送总数出错", err)
+						return
+					} else if dayCount >= Config.VipMaxPushSize {
+						return
+					}
+					needCount := Config.VipMaxPushSize - dayCount
+					sortList := &SortList{}
+					length := 0
+					i := len(list)
+					for {
+						var updateProject [][]map[string]interface{}
+						for i > 0 {
+							i--
+							projectId, _ := list[i]["projectid"].(string)
+							pi, ok := projects.Load(projectId)
+							if !ok {
+								return
 							}
-							if isExists {
-								continue
+							subtypes, _ := list[i]["subtypes"].([]interface{})
+							maxId, _ := list[i]["maxid"].(string)
+							userSubtype := map[string]bool{}
+							for _, t := range subtypes {
+								userSubtype[util.ObjToString(t)] = true
 							}
-							length++
-							//满足条件,可以推送
-							info := map[string]interface{}{}
-							for _, field := range InfoSaveFields {
-								if field == "_id" || plm[field] == nil {
+							//
+							project, _ := pi.(map[string]interface{})
+							project_list, _ := project["list"].([]interface{})
+							infoId := ""
+							for _, pl := range project_list {
+								plm, _ := pl.(map[string]interface{})
+								infoId, _ = plm["infoid"].(string)
+								if bson.ObjectIdHex(infoId) <= bson.ObjectIdHex(maxId) {
+									continue
+								}
+								publishtime := util.Int64All(plm["publishtime"])
+								if unix-publishtime > Config.ProjectPublishTimeLimit { //发布时间7天之内
+									continue
+								}
+								subtype, _ := plm["subtype"].(string)
+								if len(userSubtype) > 0 && !userSubtype[subtype] {
+									continue
+								}
+								isExists, err := redis.Exists(Pushcache_2_a, PushInfoKey(userId, infoId))
+								if err != nil {
+									logger.Error("推送信息判重出错", err)
+									continue
+								}
+								if isExists {
 									continue
 								}
-								info[field] = plm[field]
+								length++
+								//满足条件,可以推送
+								info := map[string]interface{}{}
+								for _, field := range InfoSaveFields {
+									if field == "_id" || plm[field] == nil {
+										continue
+									}
+									info[field] = plm[field]
+								}
+								info["_id"] = infoId
+								*sortList = append(*sortList, &MatchInfo{Info: &info})
 							}
-							info["_id"] = infoId
-							*sortList = append(*sortList, &MatchInfo{Info: &info})
-						}
-						if infoId != maxId {
-							updateProject = append(updateProject, []map[string]interface{}{
-								map[string]interface{}{
-									"_id": list[i]["_id"],
-								},
-								map[string]interface{}{
-									"$set": map[string]interface{}{
-										"maxid": infoId,
+							if infoId != maxId {
+								updateProject = append(updateProject, []map[string]interface{}{
+									map[string]interface{}{
+										"_id": list[i]["_id"],
+									},
+									map[string]interface{}{
+										"$set": map[string]interface{}{
+											"maxid": infoId,
+										},
 									},
-								},
-							})
-							if len(updateProject) == BigBulkSize {
-								break
+								})
+								if len(updateProject) == BigBulkSize {
+									break
+								}
 							}
 						}
+						if len(updateProject) > 0 {
+							putil.Mgo.NewUpdateBulk(Pushspace_project, true, true, updateProject...)
+						}
+						if len(updateProject) < BigBulkSize {
+							break
+						}
 					}
-					if len(updateProject) > 0 {
-						putil.Mgo.NewUpdateBulk(Pushspace_project, true, true, updateProject...)
+					if length == 0 {
+						return
 					}
-					if len(updateProject) < BigBulkSize {
-						break
+					sort.Sort(*sortList)
+					if length > needCount {
+						length = needCount
 					}
-				}
-				if length == 0 {
-					return
-				}
-				sort.Sort(*sortList)
-				if length > needCount {
-					length = needCount
-				}
-				saveArray := make([]*MatchInfo, length)
-				for sk, sl := range *sortList {
-					saveArray[length-1-sk] = sl
-					if sk == length-1 {
-						break
+					saveArray := make([]*MatchInfo, length)
+					for sk, sl := range *sortList {
+						saveArray[length-1-sk] = sl
+						if sk == length-1 {
+							break
+						}
 					}
-				}
-				if pushDate := putil.SaveToPushsubscribe(true, true, userId, &saveArray); pushDate > 0 {
-					logger.Info(userId, "关联项目推送保存成功", pushDate, length)
-					redis.Put(Pushcache_2_a, dayCountKey, dayCount+length, OneDaySecond)
-					for _, v := range saveArray {
-						redis.Put(Pushcache_2_a, PushInfoKey(userId, util.ObjToString((*v.Info)["_id"])), 1, OneDaySecond)
+					if pushDate := putil.SaveToPushsubscribe(true, true, userId, &saveArray); pushDate > 0 {
+						logger.Info(userId, "关联项目推送保存成功", pushDate, length)
+						redis.Put(Pushcache_2_a, dayCountKey, dayCount+length, OneDaySecond)
+						for _, v := range saveArray {
+							redis.Put(Pushcache_2_a, PushInfoKey(userId, util.ObjToString((*v.Info)["_id"])), 1, OneDaySecond)
+						}
+					} else {
+						logger.Info(userId, "关联项目推送保存出错", pushDate)
 					}
-				} else {
-					logger.Info(userId, "关联项目推送保存出错", pushDate)
+				}(k, v)
+				index++
+				if index%500 == 0 {
+					logger.Info("第", batchIndex, "次关联项目匹配:", index)
 				}
-			}(k, v)
-			index++
-			if index%500 == 0 {
-				logger.Info("第", batchIndex, "次关联项目匹配:", index)
 			}
-		}
-		pushWait.Wait()
-		logger.Info("第", batchIndex, "次关联项目匹配结束", index)
-		if batchCount < Config.PushBatch {
-			break
+			pushWait.Wait()
+			logger.Info("第", batchIndex, "次关联项目匹配结束", index)
+			if batchCount < Config.PushBatch {
+				break
+			}
 		}
 	}
 	ProjectTask.Pici = unix
@@ -244,47 +254,62 @@ func (p *ProjectPushJob) loadPushspace_project(batchIndex int, startId *string)
 }
 
 //加载项目数据
-func (p *ProjectPushJob) loadProject() *sync.Map {
-	query := map[string]interface{}{
-		"pici": map[string]interface{}{
-			"$gte": ProjectTask.Pici,
-		},
-	}
-	//query = map[string]interface{}{
-	//"_id": bson.ObjectIdHex("5da828a6e138234108b4c02e"),
-	//}
-	logger.Info("开始加载项目。。。", query)
-	sess := putil.Mgo_Project.GetMgoConn()
-	defer putil.Mgo_Project.DestoryMongoConn(sess)
-	it := sess.DB(Config.ProjectMongodb.DbName).C(Config.ProjectMongodb.CollName).Find(query).Select(map[string]interface{}{
-		"_id":  1,
-		"list": 1,
-	}).Iter()
+func (p *ProjectPushJob) loadProject(unix int64) (int64, *sync.Map) {
+	defer util.Catch()
 	projectMap := &sync.Map{}
-	index := 0
+	query := fmt.Sprintf(projectQuery, ProjectTask.Pici, unix, "")
+	logger.Info("开始加载项目。。。", query)
+	count := int(elastic.Count(Projectset, Projectset, query))
+	logger.Info("需要加载项目", count, "条")
+	if count == 0 {
+		return 0, projectMap
+	}
+	onceSize := Config.ProjectPagingSize //ES一次查询这么多条
+	if onceSize > count {
+		onceSize = count
+	}
+	totalPage := int((count + onceSize - 1) / onceSize)
+	logger.Info("加载项目一共", totalPage, "页")
 	loadPool := make(chan bool, Config.LoadProjectPoolSize)
 	loadWait := &sync.WaitGroup{}
-	for m := make(map[string]interface{}); it.Next(&m); {
-		loadPool <- true
-		loadWait.Add(1)
-		go func(data map[string]interface{}) {
-			defer util.Catch()
-			defer func() {
-				<-loadPool
-				loadWait.Done()
-			}()
-			_id := BsonIdToSId(data["_id"])
-			projectMap.Store(_id, data)
-		}(m)
-		m = make(map[string]interface{})
-		index++
-		if index%500 == 0 {
-			logger.Info("加载项目:", index)
+	var length int64
+	for t := 0; t < 3; t++ {
+		projectMap = &sync.Map{}
+		for i := 0; i < totalPage; i++ {
+			loadPool <- true
+			loadWait.Add(1)
+			go func(start int) {
+				defer util.Catch()
+				defer func() {
+					<-loadPool
+					loadWait.Done()
+				}()
+				size := onceSize
+				if start == totalPage-1 && count%onceSize != 0 {
+					size = count % onceSize
+				}
+				pagingQuery := fmt.Sprintf(projectQuery, ProjectTask.Pici, unix, fmt.Sprintf(projectPagingQuery, start*onceSize, size))
+				logger.Info("加载项目", "开始加载第", start+1, "页数据", pagingQuery)
+				r := elastic.Get(Projectset, Projectset, pagingQuery)
+				if r == nil {
+					return
+				}
+				for _, v := range *r {
+					length = atomic.AddInt64(&length, 1)
+					_id, _ := v["_id"].(string)
+					projectMap.Store(_id, v)
+				}
+				logger.Info("加载项目", "第", start+1, "页数据加载完成")
+			}(i)
+		}
+		loadWait.Wait()
+		if int(length) >= count-5 {
+			break
 		}
+		logger.Info("加载项目", "第", t, "次加载数据完成,数据总数", length, ",由于数据量不够,重新加载")
 	}
-	loadWait.Wait()
-	logger.Info("加载项目结束。。。", index)
-	return projectMap
+	logger.Info("加载项目结束。。。", length)
+	return length, projectMap
 }
 
 //清理三个月前的数据

+ 1 - 1
src/jfw/modules/pushsubscribe/src/push/projecttask.json

@@ -1 +1 @@
-{"pici":1576221579}
+{"pici":1596771847}

+ 1 - 0
src/jfw/modules/pushsubscribe/src/push/pusher/normalpush.go

@@ -114,6 +114,7 @@ func (n *NormalPush) GetPushParam(mailPush bool, u *UserInfo, sl *SortList) *put
 	dayCount := redis.GetInt(Pushcache_2_a, dayCountKey)
 	isVipUser := IsVipUser(u.VipStatus)
 	if isVipUser && dayCount >= Config.VipMaxPushSize {
+		logger.Info(u.Id, "超过一天最大限制数,不再推送")
 		return nil
 	}
 	pushParam := putil.NewPushParam(true, dayCount, mailPush, u, sl)

二進制
src/jfw/modules/pushsubscribe/src/push/pushsubscribe_push


+ 3 - 6
src/jfw/modules/pushsubscribe/src/push/util/db.go

@@ -4,6 +4,7 @@ import (
 	"log"
 	. "push/config"
 	"qfw/mongodb"
+	"qfw/util/elastic"
 	"qfw/util/jy"
 	"qfw/util/mysql"
 	"qfw/util/redis"
@@ -20,15 +21,11 @@ func init() {
 		DbName:      Config.Mongodb.DbName,
 	}
 	Mgo.InitPool()
-	Mgo_Project = mongodb.MongodbSim{
-		MongodbAddr: Config.ProjectMongodb.Address,
-		Size:        Config.ProjectMongodb.Size,
-		DbName:      Config.ProjectMongodb.DbName,
-	}
-	Mgo_Project.InitPool()
 	log.Println("mongodb初始化完成!")
 	redis.InitRedis(Config.RedisServers)
 	log.Println("redis初始化完成!")
+	elastic.InitElasticSize(Config.ElasticSearch.Address, Config.ElasticSearch.Size)
+	log.Println("elastic初始化完成!")
 	Mysql = &mysql.Mysql{
 		DBName:       Config.Mysql.DbName,
 		Address:      Config.Mysql.Address,

+ 2 - 2
src/jfw/modules/subscribepay/src/config.json

@@ -37,8 +37,8 @@
         }
     },
 	"appPushServiceRpc": "127.0.0.1:5566",
-    "webdomain": "http://web-jydev-xzh.jianyu360.cn",
-    "appdomain":"http://web-jydev-xzh.jianyu360.cn",
+    "webdomain": "http://web-jydev-ws.jianyu360.cn",
+    "appdomain":"http://web-jydev-ws.jianyu360.cn",
     "mail": [
         {
             "addr": "smtp.exmail.qq.com",

+ 3 - 3
src/jfw/modules/subscribepay/src/pay_config.json

@@ -10,7 +10,7 @@
             "detailmsg": "招标推送信息[%s] 打赏%s元钱",
             "sjdc_msg": "剑鱼标讯-历史数据",
             "sjbg_msg": "剑鱼标讯-数据报告",
-            "subvip_msg":"剑鱼标讯-vip订阅",
+            "subvip_msg":"剑鱼标讯-超级订阅",
             "course_msg":"剑鱼标讯-招投标课程",
             "courseOnline_msg":"剑鱼标讯-线上课程",
 			"entniche_msg":"剑鱼标讯-企业商机管理"
@@ -19,7 +19,7 @@
             "oIMvJvrVXG89597EFmYiSiznbyyY": "oHwE_wEQlEBvjZJOyZeNnQcgKQMo",
             "ouCYjw4BJMbpdMRYrTTLb9nFi2RE": "oHwE_wNA1V0DURDO0h7wAriz0qIY",
             "oIMvJvhl7CntkeLe3jEukHWhuKRc":"oHwE_wPk1VERbfcK2GRYtFWaStpk",
-            "oy1us5sU30a6ODBq0C1aI-Im_07o":"oHwE_wJZpWgPy7vc5bi5FanQoev8",
+            "oIMvJvjdp91QL-T7kVweryz58L9I":"oHwE_wJZpWgPy7vc5bi5FanQoev8",
 			"oIMvJvo8F6X8i9362I2tocHNOYTA":"oHwE_wIrgDynm9_Jy_wbfB0qtrvc",
             "oy1us5qlO6ChAyVHyg0liYrXFmno": "oHwE_wPWFBR_RSNBV4BH3BfngSg0",
             "oRvqm1JFuhAbiWOYr_WgQI4rR9as":"oHwE_wPk1VERbfcK2GRYtFWaStpk",
@@ -31,7 +31,7 @@
         "reqUrl":"https://openapi.alipay.com/gateway.do",
         "Subject_sjdc": "剑鱼数据导出",
         "Subject_sjbg": "剑鱼数据报告",
-        "Subject_subvip": "剑鱼VIP订阅",
+        "Subject_subvip": "剑鱼标讯超级订阅",
         "Subject_course":"剑鱼标讯-招投标课程",
 		"Subject_courseOnline":"剑鱼标讯-线上课程",
 		"Subject_entniche": "企业商机管理",

+ 5 - 5
src/jfw/modules/weixin/src/config.json

@@ -8,11 +8,11 @@
     "weixinrpcport": "8083",
     "webrpcport": "127.0.0.1:8084",
     "jyop_webrpcport": "127.0.0.1:8012",
-    "webdomain": "http://web-jydev-zxl.jianyu360.cn",
-    "appid": "wxdedd73f450993685",
-    "apptoken": "top2019top2019",
-    "appsecret": "d55898fde0b7887e5fe4660bd2494700",
-    "proxysess": "http://web-jydev-zxl.jianyu360.cn/front/sess/%s",
+    "webdomain": "http://web-jydev-ws.jianyu360.cn",
+    "appid": "wx5b1c6e7cc4dac0e4",
+    "apptoken": "top2015top2015",
+    "appsecret": "b026103ffebd2291b3edb7a269612112",
+    "proxysess": "http://web-jydev-ws.jianyu360.cn/front/sess/%s",
     "followCompany": 10,
     "welcomemsg": "用剑鱼标讯,所有功能完全免费,\n和传统的会员制说再见!\n\n<a href='%s'>点击这里</a>设置关键词,或直接回复“订阅 关键词”,如“订阅 教学设备”,您将随时随地接收招标信息!\n\n剑鱼标讯,让投标无限可能!",
     "tpl_subscribe_push_id": "IY_RWWzMlwDK6hcd6RAzTec6qre8n5r8PNOOUM_hgk0",

+ 3 - 3
src/jfw/modules/weixin/src/distribution.json

@@ -1,15 +1,15 @@
 {
 	"modular":{
     	"A":{
-			"name":"<a href='%s'>超级订阅</a>",
+			"name":"你身边的人都在用剑鱼标讯【超级订阅】找商机就差你了!<a href='%s'>立即点击</a>,快速获取全国招标项目!",
 			"url":"/F/%s"
 			},
     	"B":{
-			"name":"<a href='%s'>数据导出</a>",
+			"name":"用剑鱼标讯【数据导出】彻底透视你的行业、客户、竞争对手!<a href='%s'>立即点击</a>,直接使用!",
 			"url":"/F/%s"
 			},
     	"C":{
-			"name":"<a href='%s'>数据报告</a>",
+			"name":"独家【数据报告】,为你深度洞察各领域的业绩增长点!<a href='%s'>立即点击</a>, 即可获取!",
 			"url":"/F/%s"
 			},
     	"D":{

+ 2 - 2
src/jfw/modules/wxtoken/src/config.json

@@ -1,8 +1,8 @@
 {
 	"wxs":[
 		{
-			"appid":"wx76e1309b01a7b17e",
-			"appsecret":"dd00e71cb2370432d9de848b674eb8e7"
+			"appid":"wx5b1c6e7cc4dac0e4",
+			"appsecret":"b026103ffebd2291b3edb7a269612112"
 		}
 	],
 	"redis":"wxtoken=192.168.3.128:1712"

+ 9 - 0
src/jfw/public/search.go

@@ -503,6 +503,15 @@ func FormatExportData(data *[]map[string]interface{}, webdomain string, dataType
 			}
 			v["detail"] = str
 		}
+		if v["title"] != "" && v["title"] != nil {
+			str := ClearHtml.ReplaceAllString(v["title"].(string), "")
+			str = ClearOther.ReplaceAllString(str, "")
+			str = strings.Replace(str, " ", "", -1)
+			if len([]rune(str)) > 100 {
+				str = util.SubString(str, 0, 100) + "..."
+			}
+			v["title"] = str
+		}
 		if v["subtype"] == nil && v["toptype"] != nil {
 			v["subtype"] = v["toptype"]
 		}

+ 2 - 1
src/web/staticres/css/pc.css

@@ -2710,7 +2710,8 @@ form{
 	position: relative;
 }
 .aboutus-page>.j-com-4 ul:last-of-type font:first-child{
-	font-size: 40px;
+/*	font-size: 40px;*/
+	font-size: 32px;
 	padding-right: 20px;
 }
 .aboutus-page>.j-com-4 ul:last-of-type font:last-child{

+ 1 - 1
src/web/templates/course/pc/order_detail.html

@@ -216,7 +216,7 @@
                  window.open("/front/course/applyInvoice?orderCode="+orderId,'_self');
             })
             $(".lookinvoice").on("click",function(){
-                window.open("/front/course/viewInvoice?orderCode"+orderId,'_self');
+                window.open("/front/course/viewInvoice?orderCode="+orderId,'_self');
             })
         })
     </script>

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

@@ -34,7 +34,7 @@ $(function(){
 				<img src="https://www.jianyu360.com/front/downloadJyApp/qr?page=pc_bottom&source=pc_scan"/>
 			</div>
 		</div>
-		<p>开始免费使用<span>(安装包约4M,请放心下载)</span></p>
+		<p>开始免费使用<span>(安装包约7M,请放心下载)</span></p>
 		<!--动画-->
 		<img class="icon-1" src="{{Msg "seo" "cdn"}}/images/pc/about-icon-1.png"/>
 		<img class="icon-2" src="{{Msg "seo" "cdn"}}/images/pc/about-icon-2.png"/>

Some files were not shown because too many files changed in this diff