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

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

wangkaiyue 5 жил өмнө
parent
commit
ab2ce00444
46 өөрчлөгдсөн 718 нэмэгдсэн , 469 устгасан
  1. 10 9
      src/jfw/front/swordfish.go
  2. 1 1
      src/jfw/front/vipsubscribe.go
  3. 4 0
      src/jfw/modules/app/src/app/front/myorder.go
  4. 15 13
      src/jfw/modules/app/src/web/templates/me/index.html
  5. 1 1
      src/jfw/modules/pushsubscribe/src/match/config.json
  6. 4 1
      src/jfw/modules/pushsubscribe/src/match/job/matchjob.go
  7. BIN
      src/jfw/modules/pushsubscribe/src/match/match
  8. 1 1
      src/jfw/modules/pushsubscribe/src/match/matcher/vipmatch.go
  9. 1 1
      src/jfw/modules/pushsubscribe/src/public/entity.go
  10. 1 1
      src/jfw/modules/pushsubscribe/src/public/util.go
  11. 1 2
      src/jfw/modules/pushsubscribe/src/push/config.json
  12. 2 0
      src/jfw/modules/pushsubscribe/src/push/config/config.go
  13. 2 8
      src/jfw/modules/pushsubscribe/src/push/job/jobs.go
  14. 4 4
      src/jfw/modules/pushsubscribe/src/push/job/movejob.go
  15. 57 82
      src/jfw/modules/pushsubscribe/src/push/job/pushjob.go
  16. 0 61
      src/jfw/modules/pushsubscribe/src/push/job/repairjob.go
  17. 16 7
      src/jfw/modules/pushsubscribe/src/push/main.go
  18. 49 30
      src/jfw/modules/pushsubscribe/src/push/pusher/normalpush.go
  19. 3 3
      src/jfw/modules/pushsubscribe/src/push/pusher/pusher.go
  20. 36 21
      src/jfw/modules/pushsubscribe/src/push/pusher/repairpush.go
  21. 67 23
      src/jfw/modules/pushsubscribe/src/push/pusher/specialpush.go
  22. 6 5
      src/jfw/modules/pushsubscribe/src/push/rpc/rpc.go
  23. 65 26
      src/jfw/modules/pushsubscribe/src/push/util/entity.go
  24. 1 2
      src/jfw/modules/pushsubscribe/src/push/util/rpccall.go
  25. 32 5
      src/jfw/modules/pushsubscribe/src/push/util/util.go
  26. 1 1
      src/jfw/modules/subscribepay/src/a/init.go
  27. 14 11
      src/jfw/modules/subscribepay/src/entity/subscribeVip.go
  28. 52 2
      src/jfw/modules/subscribepay/src/service/orderListDetails.go
  29. 3 3
      src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go
  30. 7 4
      src/jfw/modules/subscribepay/src/timetask/timetask.go
  31. 23 13
      src/jfw/public/historypush.go
  32. 1 1
      src/main.go
  33. BIN
      src/web/staticres/images/mail.png
  34. BIN
      src/web/staticres/images/phone.png
  35. 1 1
      src/web/staticres/vipsubscribe/css/vip_update.css
  36. 4 4
      src/web/staticres/vipsubscribe/js/keyWord.js
  37. 2 1
      src/web/templates/weixin/dataExport/dataExport_toMyOrder.html
  38. 4 4
      src/web/templates/weixin/email/bind_email.html
  39. 57 11
      src/web/templates/weixin/email/bind_success.html
  40. 2 2
      src/web/templates/weixin/historypush.html
  41. 32 10
      src/web/templates/weixin/vipsubscribe/choose_area_upgrade.html
  42. 2 1
      src/web/templates/weixin/vipsubscribe/choose_industry_upgrade.html
  43. 67 44
      src/web/templates/weixin/vipsubscribe/keyWord.html
  44. 36 27
      src/web/templates/weixin/vipsubscribe/renew_pay.html
  45. 1 1
      src/web/templates/weixin/vipsubscribe/vip_pay_success.html
  46. 30 21
      src/web/templates/weixin/vipsubscribe/vip_upgrade.html

+ 10 - 9
src/jfw/front/swordfish.go

@@ -2379,8 +2379,10 @@ func (f *Front) HasPushHistory() {
 		var oneRemind = int64(1 * 24 * 60 * 60)
 		var o_vipjy map[string]interface{}
 		o_vipjy, _ = (*user)["o_vipjy"].(map[string]interface{})
-		a_itmes := util.ObjArrToMapArr(o_vipjy["a_items"].([]interface{}))
-		hasKeyFlag = len(a_itmes) > 0
+		if o_vipjy["a_items"] != nil {
+			a_itmes := util.ObjArrToMapArr(o_vipjy["a_items"].([]interface{}))
+			hasKeyFlag = len(a_itmes) > 0
+		}
 		isVipFlag = true
 		isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) > 2000
 		isOnTail = util.IntAll((*user)["i_vip_status"])
@@ -2405,19 +2407,18 @@ func (f *Front) HasPushHistory() {
 		}
 		isPassCount = redis.GetInt("pushcache_2_a", "oncecount_"+tedayNum+"_"+userId) > 50
 	}
-	//	hasNextPage, list, err := public.HistoryPush.Datas(userId, 1, firstPushTime, formatTime)
-	//	if err == nil && hasKeyFlag && len(list) == 0 && formatTime == "" && !isVipFlag {
-	//		flag, data := public.HistoryPush.MakeHistoryDatas(userId, bidSearch_field_1)
-	//		if flag && data != nil {
-	//			list = data
-	//		}
-	//	}
 	pageNum, _ := f.GetInteger("pageNum")
 	if pageNum == 0 {
 		pageNum = 1
 	}
 	area := f.GetString("area")
 	hasNextPage, list := public.HistoryPush.Datas_Mysql(userId, pageNum, formatTime, area)
+	if hasKeyFlag && len(list) == 0 && formatTime == "" && !isVipFlag {
+		flag, data := public.HistoryPush.MakeHistoryDatas(userId, bidSearch_field_1)
+		if flag && data != nil {
+			list = data
+		}
+	}
 	//
 	f.ServeJson(map[string]interface{}{
 		"haskey":      hasKeyFlag,

+ 1 - 1
src/jfw/front/vipsubscribe.go

@@ -16,7 +16,7 @@ type Subscribepay struct {
 	toChooseArea      xweb.Mapper `xweb:"/front/vipsubscribe/toChooseArea"`      //订阅收费地区筛选
 	toChooseIndustry  xweb.Mapper `xweb:"/front/vipsubscribe/toChooseIndustry"`  //订阅收费行业筛选
 	toPaySuccessPage  xweb.Mapper `xweb:"/front/vipsubscribe/toPaySuccessPage"`  //订阅支付完成页面
-	toOrderDetailPage xweb.Mapper `xweb:"/front/vipsubscribe/toOrderDetailPage"` //订阅收费支付订单详情页面
+	toOrderDetailPage xweb.Mapper `xweb:"/weixin/pay/toOrderDetailPage"`         //订阅收费支付订单详情页面
 	toSetKeyWordPage  xweb.Mapper `xweb:"/front/vipsubscribe/toSetKeyWordPage"`  //订阅收费设置关键词
 	toSetPage         xweb.Mapper `xweb:"/front/vipsubscribe/toSetPage"`         //订阅收费设置
 	toSetInfoTypePage xweb.Mapper `xweb:"/front/vipsubscribe/toSetInfoTypePage"` //订阅收费设置信息类型

+ 4 - 0
src/jfw/modules/app/src/app/front/myorder.go

@@ -161,6 +161,8 @@ func (m *MyOrder) QueryMyOrder() error {
 	} else {
 		queryM["order_status"] = map[string]interface{}{"ne": orderStatus_deleted}
 	}
+	//2.8.5 app暂时不显示 vip订单
+	queryM["product_type"] = map[string]interface{}{"ne": "VIP订阅"}
 	//总数
 	haveNextPage, res, _ := m.Datas(queryM, 1)
 	count := len(res)
@@ -222,6 +224,8 @@ func (m *MyOrder) MyOrderPaging() error {
 	} else {
 		queryM["order_status"] = map[string]interface{}{"ne": orderStatus_deleted}
 	}
+	//2.8.5 app暂时不显示 vip订单
+	queryM["product_type"] = map[string]interface{}{"ne": "VIP订阅"}
 	haveNextPage, res, _ := m.Datas(queryM, pageNum)
 	if res != nil {
 		for _, v := range res {

+ 15 - 13
src/jfw/modules/app/src/web/templates/me/index.html

@@ -200,18 +200,18 @@
 		</div>
 		<!--通知end-->
 		
-		<!--vip订阅开始-->
-		<div class="vip">
-			<ul>
-				<li class="vip_">
-				<img src="/jyapp/me/images/vip.svg" class="vipimg"/>
-					<a class="vipa">VIP订阅</a>
-					<i class="redspot"></i>
-					<i class="jyapp-icon jyapp-icon-youjiantou"> </i>
-				</li>			
-			</ul>
-		</div>
-		
+		<!--vip订阅开始
+			<div class="vip">
+				<ul>
+					<li class="vip_">
+					<img src="/jyapp/me/images/vip.svg" class="vipimg"/>
+						<a class="vipa">VIP订阅</a>
+						<i class="redspot"></i>
+						<i class="jyapp-icon jyapp-icon-youjiantou"> </i>
+					</li>			
+				</ul>
+			</div>
+		-->
 		<!--vip订阅结束-->
 		
 		<!--我的订单-->
@@ -234,12 +234,14 @@
 					<i class="redspot"></i>
 					<i class="jyapp-icon jyapp-icon-youjiantou"> </i>
 				</li>	
+			<!--				
 				<li class="myEmail">
 					<img src="/jyapp/me/images/email.svg" class="emailimg"/>
 					<a class="emaila">邮箱地址 {{if .T.isNoEmail}}<span class="no_set_email">未绑定</span>{{end}}</a>
 					<i class="redspot"></i>
 					<i class="jyapp-icon jyapp-icon-youjiantou"> </i>
-				</li>			
+				</li>	
+			-->		
 			</ul>
 		</div>
 		<!--我的关注start-->

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

@@ -4,7 +4,7 @@
 	"redisServers": "pushcache_1=192.168.3.128:5000,pushcache_2_a=192.168.3.128:5001",
 	"maxPushSize": 50,
 	"vipMaxPushSize": 2000,
-	"maxSearch": 50000,
+	"maxSearch": 20000,
 	"mgoAddr": "192.168.3.128:27080",
 	"mgoSize": 10,
 	"testids": ["5d81c5a525ef8723ac0036f9"],

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

@@ -152,7 +152,7 @@ func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher) {
 			"wxpush":        user.WxPush,
 			"apppush":       user.AppPush,
 			"mailpush":      user.MailPush,
-			"pchelperpush":  user.PchelperPush,
+			"pchelperpush":  user.PcHelperPush,
 			"usertype":      user.UserType,
 			"email":         user.Email,
 			"list":          array,
@@ -202,6 +202,9 @@ func (m *MatchJob) LoadBidding(lastId, newId string, lastTime int64) bool {
 	if len(idQuery) > 0 {
 		c_query["_id"] = idQuery
 	}
+	//c_query = map[string]interface{}{
+	//"_id": bson.ObjectIdHex("5da706f7a5cb26b9b778d08a"),
+	//}
 	logger.Info("mongodb query:", c_query)
 	count := mongodb.Count("bidding", c_query)
 	logger.Info("本次数据共", count, "条")

BIN
src/jfw/modules/pushsubscribe/src/match/match


+ 1 - 1
src/jfw/modules/pushsubscribe/src/match/matcher/vipmatch.go

@@ -72,7 +72,7 @@ func (v *VipUser) Match(info *map[string]interface{}) *map[*UserInfo]*MatchUser
 	users := map[*UserInfo]*MatchUser{}
 	for k, _ := range v.Users {
 		if (!v.BuyerclassUsers[""][k] && !v.BuyerclassUsers[buyerclass][k]) ||
-			(!v.AreaUsers[""][k] && !v.AreaUsers[area][k] && !v.AreaUsers[city][k]) ||
+			(!v.AreaUsers[""][k] && !v.AreaUsers[area][k] && !v.CityUsers[city][k]) ||
 			(!v.InfoTypeUsers[""][k] && !v.InfoTypeUsers[toptype][k]) {
 			continue
 		}

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

@@ -16,7 +16,7 @@ type UserInfo struct {
 	WxPush        int                        //是否开启微信推送
 	AppPush       int                        //是否开启app推送
 	MailPush      int                        //是否开启邮箱推送
-	PchelperPush  int                        //是否pc助手推送
+	PcHelperPush  int                        //是否pc助手推送
 	RateMode      int                        //推送时间
 	Email         string                     //邮箱
 	ModifyDate    string                     //修改时间

+ 1 - 1
src/jfw/modules/pushsubscribe/src/public/util.go

@@ -195,7 +195,7 @@ func NewUserInfoByUserColl(temp map[string]interface{}) (user *UserInfo, o_msgse
 		WxPush:       wxpush,
 		AppPush:      apppush,
 		MailPush:     mailpush,
-		PchelperPush: pchelperPush,
+		PcHelperPush: pchelperPush,
 		Email:        email,
 		S_m_openid:   s_m_openid,
 		A_m_openid:   a_m_openid,

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 1 - 2
src/jfw/modules/pushsubscribe/src/push/config.json


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

@@ -16,6 +16,8 @@ type config struct {
 	Mail_content            string      `json:"mail_content"`
 	Mail_html               string      `json:"mail_html"`
 	Mail_title              string      `json:"mail_title"`
+	Mail_according          string      `json:"mail_according"`
+	Vip_mail_according      string      `json:"vip_mail_according"`
 	Mails                   []*pushMail `json:"mails"`
 	MaxPushSize             int         `json:"maxPushSize"`
 	VipMaxPushSize          int         `json:"vipMaxPushSize"`

+ 2 - 8
src/jfw/modules/pushsubscribe/src/push/job/jobs.go

@@ -6,9 +6,8 @@ import (
 )
 
 var Jobs = struct {
-	Move   *MoveJob
-	Push   *PushJob
-	Repair *RepairJob
+	Move *MoveJob
+	Push *PushJob
 }{
 	Move: &MoveJob{
 		moveLock:  &sync.Mutex{},
@@ -23,9 +22,4 @@ var Jobs = struct {
 		wait: &sync.WaitGroup{},
 		lock: &sync.Mutex{},
 	},
-	Repair: &RepairJob{
-		pool: make(chan bool, Config.PushPoolSize),
-		wait: &sync.WaitGroup{},
-		lock: &sync.Mutex{},
-	},
 }

+ 4 - 4
src/jfw/modules/pushsubscribe/src/push/job/movejob.go

@@ -70,7 +70,7 @@ func (m *MoveJob) Execute() {
 					idMap[util.ObjToString((*v.Info)["_id"])] = true
 				}
 				newList := putil.ToSortList(temp["list"])
-				for _, v := range newList {
+				for _, v := range *newList {
 					if idMap[util.ObjToString((*v.Info)["_id"])] {
 						continue
 					}
@@ -157,7 +157,7 @@ func (m *MoveJob) merge(number *int, nowUnix int64, moveUsers map[string]*MoveUs
 				}
 				oldList := putil.ToSortList(data["list"])
 				idMap := map[string]bool{}
-				for _, vv := range oldList {
+				for _, vv := range *oldList {
 					idMap[util.ObjToString((*vv.Info)["_id"])] = true
 				}
 				newList := make(SortList, 0)
@@ -172,14 +172,14 @@ func (m *MoveJob) merge(number *int, nowUnix int64, moveUsers map[string]*MoveUs
 				if pLength == 0 {
 					return
 				}
-				rLength := len(oldList)
+				rLength := len(*oldList)
 				maxPushSize := Config.MaxPushSize
 				if moveUser.isVipUser {
 					maxPushSize = Config.VipMaxPushSize
 				}
 				upSet := map[string]interface{}{}
 				if rLength+pLength > maxPushSize {
-					newList = append(newList, oldList...)
+					newList = append(newList, *oldList...)
 					sort.Sort(newList)
 					setMap["list"] = newList[:maxPushSize]
 					setMap["size"] = maxPushSize

+ 57 - 82
src/jfw/modules/pushsubscribe/src/push/job/pushjob.go

@@ -2,7 +2,6 @@ package job
 
 import (
 	"fmt"
-	"log"
 	"net/http"
 	"os"
 	. "public"
@@ -35,7 +34,6 @@ func init() {
 }
 
 type PushJob struct {
-	taskType                int
 	pool                    chan bool
 	wait                    *sync.WaitGroup
 	lock                    *sync.Mutex
@@ -45,29 +43,39 @@ type PushJob struct {
 
 //taskType 1--一天三次推送 2--九点推送
 func (p *PushJob) Execute(taskType int) {
-	p.startPush(taskType)
-	if taskType == 2 {
-		p.startPush(3)
+	p.lock.Lock()
+	defer p.lock.Unlock()
+	p.beforePush(taskType)
+	//每天九点以后,推送每周每月的用户
+	if taskType == 2 && putil.IsVipTempPushTime() {
+		now := time.Now()
+		if now.Weekday().String() == Config.VipPushWeek { //每周
+			p.beforePush(3)
+		} else if now.Day() == Config.VipPushDay { //每月
+			p.beforePush(4)
+		}
 	}
 }
 
 //开始推送
-func (p *PushJob) startPush(taskType int) {
-	defer util.Catch()
+func (p *PushJob) beforePush(taskType int) {
 	var pusher Pusher
 	if taskType == 1 || taskType == 2 {
 		pusher = &NormalPush{
 			SavePool: make(chan bool, Config.SavePoolSize),
 		}
-	} else if taskType == 3 {
+	} else if taskType == 3 || taskType == 4 || taskType == 5 {
 		pusher = &SpecialPush{}
 	} else {
 		return
 	}
-	p.lock.Lock()
-	defer p.lock.Unlock()
-	p.taskType = taskType
-	logger.Info("推送任务", p.taskType, "开始推送。。。")
+	p.StartPush(pusher, taskType)
+}
+
+//开始推送
+func (p *PushJob) StartPush(pusher Pusher, taskType int) {
+	defer util.Catch()
+	logger.Info("推送任务", taskType, "开始推送。。。")
 	batchIndex := 0
 	startId := ""
 	for {
@@ -78,7 +86,7 @@ func (p *PushJob) startPush(taskType int) {
 			select {
 			case <-time.After(5 * time.Minute):
 				isTake = false
-				logger.Error("推送任务", p.taskType, "推送放入通道超时,", temp["userid"], len(p.minutePushPool), len(p.fastigiumMinutePushPool))
+				logger.Error("推送任务", taskType, "推送放入通道超时,", temp["userid"], len(p.minutePushPool), len(p.fastigiumMinutePushPool))
 				go func() {
 					if Config.TimeoutWarn != "" {
 						if _, err := http.Get(Config.TimeoutWarn); err != nil {
@@ -96,44 +104,15 @@ func (p *PushJob) startPush(taskType int) {
 					}
 					p.wait.Done()
 				}()
-				u := pusher.GetUserInfo(v)
+				u, pushWay := pusher.GetUserInfo(v)
 				if u == nil {
 					return
 				}
-				logger.Info("推送任务", p.taskType, "开始推送用户", "userType", u.UserType, "userId", u.Id, "s_m_openid", u.S_m_openid, "a_m_openid", u.A_m_openid, "phone", u.Phone, "subscribe", u.Subscribe, "applystatus", u.ApplyStatus, "jpushid", u.Jpushid, "opushid", u.Opushid, "phoneType", u.AppPhoneType, "rateMode", u.RateMode, "email", u.Email)
-				wxPush, appPush, mailPush := 0, 0, 0
-				if u.WxPush == 1 {
-					wxPush = 1
-				}
-				if u.AppPush == 1 {
-					appPush = 1
-				}
-				if u.MailPush == 1 {
-					mailPush = 1
-				}
-				logger.Info("推送任务", p.taskType, "用户接收方式", "userId", u.Id, "wxPush", wxPush, "appPush", appPush, "mailPush", mailPush, "pchelperPush", u.PchelperPush)
-				if wxPush != 1 && appPush != 1 && mailPush != 1 {
-					return
-				}
-				list := putil.ToSortList(v["list"])
-				//再对取消关注以及app没有登录的用户进行过滤,但是依然可以进行助手推送
-				if u.Subscribe == 0 {
-					wxPush = 0
+				logger.Info("推送任务", taskType, "开始推送用户", "userType", u.UserType, "userId", u.Id, "s_m_openid", u.S_m_openid, "a_m_openid", u.A_m_openid, "phone", u.Phone, "subscribe", u.Subscribe, "applystatus", u.ApplyStatus, "jpushid", u.Jpushid, "opushid", u.Opushid, "phoneType", u.AppPhoneType, "rateMode", u.RateMode, "email", u.Email, "vipStatus", u.VipStatus)
+				var pushResult *putil.PushResult
+				if pushWay.WxPush || pushWay.AppPush || pushWay.MailPush || pushWay.PcHelperPush {
+					pushResult = p.doPush(pusher, taskType, pushWay, u, putil.ToSortList(v["list"]))
 				}
-				if u.Jpushid == "" && u.Opushid == "" {
-					appPush = 0
-				}
-				if mailPush != 0 {
-					if u.UserType == 0 && u.Subscribe == 0 {
-						mailPush = 0
-					} else if (u.UserType == 1 || u.UserType == 2) && u.Jpushid == "" && u.Opushid == "" {
-						mailPush = 0
-					} else if u.UserType == 5 && u.Subscribe == 0 && u.Jpushid == "" && u.Opushid == "" {
-						mailPush = 0
-					}
-				}
-				pushResult := p.selectPush(pusher, p.taskType, wxPush, appPush, mailPush, u, list)
-				log.Println(pushResult)
 				pusher.AfterPush(pushResult, u, v)
 			}(temp, isTake)
 		}
@@ -142,21 +121,12 @@ func (p *PushJob) startPush(taskType int) {
 		}
 	}
 	p.wait.Wait()
-	logger.Info("推送任务结束。。。", p.taskType)
-}
-
-//满足条件进行推送
-func (p *PushJob) selectPush(pusher Pusher, taskType int, wxPush, appPush, mailPush int, u *UserInfo, list SortList) (pushResult *putil.PushResult) {
-	if wxPush == 1 || appPush == 1 || mailPush == 1 || u.PchelperPush == 1 {
-		pushResult = p.doPush(pusher, taskType, wxPush, appPush, mailPush, u, &list)
-	}
-	return
+	logger.Info("推送任务结束。。。", taskType)
 }
 
 //进入具体推送
-func (p *PushJob) doPush(pusher Pusher, taskType int, wxPush, appPush, mailPush int, u *UserInfo, sl *SortList) (pushResult *putil.PushResult) {
+func (p *PushJob) doPush(pusher Pusher, taskType int, pushWay *putil.PushWay, u *UserInfo, sl *SortList) (pushResult *putil.PushResult) {
 	defer util.Catch()
-	pushResult = &putil.PushResult{}
 	now := time.Now()
 	//限制一分钟最大的推送数量
 	if p.fastigiumMinutePushPool != nil {
@@ -166,32 +136,31 @@ func (p *PushJob) doPush(pusher Pusher, taskType int, wxPush, appPush, mailPush
 	} else if p.minutePushPool != nil {
 		<-p.minutePushPool //正常期
 	}
-	pushParam := pusher.GetPushParam(mailPush, u, sl)
-	if pushParam == nil {
+	pushParam := pusher.GetPushParam(pushWay.MailPush, u, sl)
+	if pushParam.InfosLength == 0 {
 		logger.Info("推送任务", taskType, "没有要推送的数据!", u.Id)
-		return nil
+		return
+	}
+	pushResult = &putil.PushResult{
+		Infos:    pushParam.Infos,
+		PushDate: pushParam.PushDate,
 	}
-	pushResult.Infos = pushParam.Infos
-	pushResult.PushDate = pushParam.PushDate
-	pushResult.IsVipTempSave = pushParam.IsVipTempSave
 	if !pushParam.IsPush {
-		return pushResult
+		return
 	}
 	logger.Info("推送任务", taskType, "开始进行终端推送", u.Id)
-	if pushResult.PushDate > 0 {
-		//pc端助手推送
-		if u.S_m_openid != "" {
-			logger.Info("推送任务", taskType, "开始助手推送", u.Id, "s_m_openid", u.S_m_openid)
-			isPushOk := putil.SendPcHelper(map[string]interface{}{"clientCode": u.S_m_openid})
-			logger.Info("推送任务", taskType, "助手推送结束", isPushOk, u.Id, "s_m_openid", u.S_m_openid)
-		}
-		if u.Phone != "" {
-			logger.Info("推送任务", taskType, "开始助手推送", u.Id, "phone", u.Phone)
-			isPushOk := putil.SendPcHelper(map[string]interface{}{"clientCode": u.Phone})
-			logger.Info("推送任务", taskType, "助手推送结束", isPushOk, u.Id, "phone", u.Phone)
-		}
+	//pc端助手推送
+	if u.S_m_openid != "" {
+		logger.Info("推送任务", taskType, "开始助手推送", u.Id, "s_m_openid", u.S_m_openid)
+		isPushOk := putil.SendPcHelper(map[string]interface{}{"clientCode": u.S_m_openid})
+		logger.Info("推送任务", taskType, "助手推送结束", isPushOk, u.Id, "s_m_openid", u.S_m_openid)
 	}
-	if wxPush == 1 {
+	if u.Phone != "" {
+		logger.Info("推送任务", taskType, "开始助手推送", u.Id, "phone", u.Phone)
+		isPushOk := putil.SendPcHelper(map[string]interface{}{"clientCode": u.Phone})
+		logger.Info("推送任务", taskType, "助手推送结束", isPushOk, u.Id, "phone", u.Phone)
+	}
+	if pushWay.WxPush {
 		logger.Info("推送任务", taskType, "开始微信推送", u.ApplyStatus, u.Id)
 		isPushOk := true
 		if u.ApplyStatus == 1 {
@@ -215,7 +184,7 @@ func (p *PushJob) doPush(pusher Pusher, taskType int, wxPush, appPush, mailPush
 			}
 			LastTipLen := len([]rune(lastTip))
 			wxTitle := Config.VipWxTitle
-			if !pushParam.IsVipUser {
+			if !IsVipUser(u.VipStatus) {
 				wxTitleKeys := strings.Join(u.Keys, ";")
 				if len([]rune(wxTitleKeys)) > 8 {
 					wxTitleKeys = string([]rune(wxTitleKeys)[:8]) + "..."
@@ -269,7 +238,7 @@ func (p *PushJob) doPush(pusher Pusher, taskType int, wxPush, appPush, mailPush
 		}
 		logger.Info("推送任务", taskType, "微信推送结束", u.ApplyStatus, isPushOk, u.Id)
 	}
-	if appPush == 1 {
+	if pushWay.AppPush {
 		logger.Info("推送任务", taskType, "开始app推送", u.Id)
 		descriptAppend := ""
 		if pushParam.InfosLength > 1 {
@@ -301,9 +270,15 @@ func (p *PushJob) doPush(pusher Pusher, taskType int, wxPush, appPush, mailPush
 		logger.Info("推送任务", taskType, "app推送结束", isPushOk, u.Id)
 	}
 	//发送邮件
-	if mailPush == 1 {
+	if pushWay.MailPush {
 		logger.Info("推送任务", taskType, "开始邮箱推送", u.Id)
-		html := fmt.Sprintf(Config.Mail_html, strings.Replace(strings.Join(u.Keys, ";"), "+", " ", -1), pushParam.MailContent)
+		according := ""
+		if IsVipUser(u.VipStatus) {
+			according = Config.Vip_mail_according
+		} else {
+			according = fmt.Sprintf(Config.Mail_according, strings.Replace(strings.Join(u.Keys, ";"), "+", " ", -1))
+		}
+		html := fmt.Sprintf(Config.Mail_html, according, pushParam.MailContent)
 		isPushOk := p.sendMail(u.Email, Config.Mail_title, html, nil)
 		if isPushOk {
 			pushResult.MailStatus = 1

+ 0 - 61
src/jfw/modules/pushsubscribe/src/push/job/repairjob.go

@@ -1,61 +0,0 @@
-package job
-
-import (
-	. "push/pusher"
-	putil "push/util"
-	"qfw/util"
-	"sync"
-
-	"github.com/donnie4w/go-logger/logger"
-)
-
-//补推接口
-type RepairJob struct {
-	pool chan bool
-	wait *sync.WaitGroup
-	lock *sync.Mutex
-}
-
-func (r *RepairJob) Execute(param string) bool {
-	logger.Info("开始补推任务。。。")
-	var pusher Pusher = &RepairPush{}
-	taskType := 0
-	batchIndex := 0
-	startId := ""
-	for {
-		batchIndex++
-		isBreak, users := pusher.OncePushBatch(taskType, batchIndex, &startId)
-		for _, temp := range *users {
-			r.pool <- true
-			r.wait.Add(1)
-			go func(v map[string]interface{}) {
-				defer func() {
-					<-r.pool
-					r.wait.Done()
-				}()
-				u := pusher.GetUserInfo(v)
-				logger.Info("补推任务", "开始推送用户,userid", u.Id, "s_m_openid", u.S_m_openid, "a_m_openid", u.A_m_openid, "phone", u.Phone, "subscribe", u.Subscribe, "applystatus", u.ApplyStatus, "jpushid", u.Jpushid, "opushid", u.Opushid)
-				wxPush, appPush, mailPush := 0, 0, 0
-				wxFail, appFail, mailFail := util.IntAll(v["wxfail"]), util.IntAll(v["appfail"]), util.IntAll(v["mailfail"])
-				if wxFail > 0 {
-					wxPush = 1
-				}
-				if appFail > 0 {
-					appPush = 1
-				}
-				if mailFail > 0 {
-					mailPush = 1
-				}
-				list := putil.ToSortList(v["list"])
-				pushResult := Jobs.Push.selectPush(pusher, taskType, wxPush, appPush, mailPush, u, list)
-				pusher.AfterPush(pushResult, u, v)
-			}(temp)
-		}
-		if isBreak || param != "all" {
-			break
-		}
-	}
-	r.wait.Wait()
-	logger.Info("补推任务结束。。。")
-	return true
-}

+ 16 - 7
src/jfw/modules/pushsubscribe/src/push/main.go

@@ -8,7 +8,8 @@ import (
 	"net/http"
 	"net/rpc"
 	. "push/config"
-	"push/job"
+	. "push/job"
+	. "push/pusher"
 	prpc "push/rpc"
 	"qfw/util/mongodb"
 	"qfw/util/redis"
@@ -17,9 +18,10 @@ import (
 )
 
 func main() {
-	modle := flag.Int("m", 0, "0 定时任务模式推送;1 非定时任务模式推送;2 定时任务模式推送之前先执行-t的任务;")
+	modle := flag.Int("m", 0, "0 定时任务模式推送;1 非定时任务模式推送;2 定时任务模式推送之前先执行-t的任务;3 补推")
 	move := flag.Int("v", 0, "1 优先迁移数据")
-	taskType := flag.Int("t", 1, "1 一天三次推送;2 九点推送")
+	repair := flag.String("r", "", "all 全部;多个用户的话_id逗号分开")
+	taskType := flag.Int("t", 1, "1 一天三次推送;2 九点推送;3 每周;4 每月;5 每周+每月")
 	flag.Parse()
 	logger.SetConsole(false)
 	logger.SetRollingDaily("./logs", "push.log")
@@ -42,14 +44,21 @@ func main() {
 	//
 	log.Println("订阅推送-推送程序启动。。。")
 	if *move == 1 {
-		job.Jobs.Move.Execute()
+		Jobs.Move.Execute()
 	}
 	if *modle == 1 {
-		job.Jobs.Push.Execute(*taskType)
+		Jobs.Push.Execute(*taskType)
 		return
 	} else if *modle == 2 {
-		job.Jobs.Push.Execute(*taskType)
+		Jobs.Push.Execute(*taskType)
+	} else if *modle == 3 {
+		if *repair == "" {
+			log.Println("缺少-r参数")
+		} else {
+			Jobs.Push.StartPush(&RepairPush{Param: *repair}, 0)
+		}
+		return
 	}
-	(&job.TimeTask{}).Run()
+	(&TimeTask{}).Run()
 	<-chan bool(nil)
 }

+ 49 - 30
src/jfw/modules/pushsubscribe/src/push/pusher/normalpush.go

@@ -20,7 +20,7 @@ type NormalPush struct {
 }
 
 //获取需要推送的用户
-func (n *NormalPush) OncePushBatch(taskType, batchIndex int, startId *string, args ...interface{}) (bool, *[]map[string]interface{}) {
+func (n *NormalPush) OncePushBatch(taskType, batchIndex int, startId *string) (bool, *[]map[string]interface{}) {
 	var query map[string]interface{}
 	//根据任务类型,查找ratemode
 	if taskType == 1 {
@@ -51,13 +51,15 @@ func (n *NormalPush) OncePushBatch(taskType, batchIndex int, startId *string, ar
 }
 
 //获取用户缓存信息
-func (n *NormalPush) GetUserInfo(user map[string]interface{}) *UserInfo {
-	return putil.NewUserInfoByPushSpaceColl(user)
+func (n *NormalPush) GetUserInfo(user map[string]interface{}) (*UserInfo, *putil.PushWay) {
+	userInfo := putil.NewUserInfoByPushSpaceColl(user)
+	pushWay := putil.NewPushWay(userInfo)
+	return userInfo, pushWay
 }
 
 //推送以后处理
 func (n *NormalPush) AfterPush(pushResult *putil.PushResult, u *UserInfo, user map[string]interface{}) {
-	if pushResult.PushDate == 0 {
+	if pushResult == nil || pushResult.PushDate == 0 {
 		return
 	}
 	if u.FirstPushTime == 0 {
@@ -69,9 +71,6 @@ func (n *NormalPush) AfterPush(pushResult *putil.PushResult, u *UserInfo, user m
 			},
 		}, false, false)
 	}
-	if pushResult.IsVipTempSave {
-		n.vipTempSave(u.Id, pushResult.PushDate, pushResult.Infos)
-	}
 	//判断是否要删除数据
 	sess := mongodb.GetMgoConn()
 	defer mongodb.DestoryMongoConn(sess)
@@ -81,6 +80,7 @@ func (n *NormalPush) AfterPush(pushResult *putil.PushResult, u *UserInfo, user m
 	}
 	if pushResult.WxStatus == -1 || pushResult.AppStatus == -1 || pushResult.MailStatus == -1 {
 		user["failtime"] = time.Now().Unix()
+		user["createtime"] = pushResult.PushDate
 		user["list"] = pushResult.Infos
 		if pushResult.WxStatus == -1 {
 			user["wxfail"] = 1
@@ -97,14 +97,14 @@ func (n *NormalPush) AfterPush(pushResult *putil.PushResult, u *UserInfo, user m
 		}
 	}
 }
-func (n *NormalPush) GetPushParam(mailPush int, u *UserInfo, sl *SortList) *putil.PushParam {
+func (n *NormalPush) GetPushParam(mailPush bool, u *UserInfo, sl *SortList) *putil.PushParam {
 	dateymd := util.NowFormat(util.Date_yyyyMMdd)
 	dayCountKey := DayCountKey(dateymd, u.Id)
 	onceCountKey := OnceCountKey(dateymd, u.Id)
 	dayCount := redis.GetInt("pushcache_2_a", dayCountKey)
 	pushParam := putil.NewPushParam(true, dayCount, mailPush, u, sl)
-	if pushParam == nil || pushParam.InfosLength == 0 {
-		return nil
+	if pushParam.InfosLength == 0 {
+		return pushParam
 	}
 	redis.Put("pushcache_2_a", dayCountKey, dayCount+pushParam.InfosLength, 86400)
 	redis.Put("pushcache_2_a", onceCountKey, pushParam.InfosLength, 86400)
@@ -115,16 +115,17 @@ func (n *NormalPush) GetPushParam(mailPush int, u *UserInfo, sl *SortList) *puti
 		return pushParam
 	}
 	logger.Info(u.Id, "保存成功", pushParam.PushDate, pushParam.InfosLength)
-	now := time.Now()
-	if pushParam.IsVipUser && (u.RateMode == 3 || u.RateMode == 4) && now.Day() != Config.VipPushDay && now.Weekday().String() != Config.VipPushWeek {
-		pushParam.IsVipTempSave = true
+	if IsVipUser(u.VipStatus) && (u.RateMode == 3 || u.RateMode == 4) && !putil.IsVipTempPushTime() {
 		pushParam.IsPush = false
+		n.vipTempSave(u, pushParam)
+	} else {
+		pushParam.IsPush = true
 	}
 	return pushParam
 }
 
 //保存发送信息
-func (n *NormalPush) save(k *UserInfo, matchInfos []*MatchInfo) int64 {
+func (n *NormalPush) save(u *UserInfo, matchInfos []*MatchInfo) int64 {
 	n.SavePool <- true
 	defer func() {
 		<-n.SavePool
@@ -133,14 +134,26 @@ func (n *NormalPush) save(k *UserInfo, matchInfos []*MatchInfo) int64 {
 		time.Sleep(time.Duration(Config.SaveSleep) * time.Millisecond)
 	}
 	unix := time.Now().Unix()
+	isVipUser := IsVipUser(u.VipStatus)
 	values := []interface{}{}
 	for i := len(matchInfos) - 1; i >= 0; i-- {
 		matchInfo := matchInfos[i]
-		values = append(values, k.Id, util.ObjToString((*matchInfo.Info)["_id"]), unix, strings.Join(matchInfo.Keys, " "), util.ObjToString((*matchInfo.Info)["area"]), util.ObjToString((*matchInfo.Info)["city"]), util.ObjToString((*matchInfo.Info)["buyerclass"]))
+		values = append(values, u.Id, util.ObjToString((*matchInfo.Info)["_id"]), unix, strings.Join(matchInfo.Keys, " "), util.ObjToString((*matchInfo.Info)["area"]), util.ObjToString((*matchInfo.Info)["city"]))
+		if isVipUser {
+			values = append(values, util.ObjToString((*matchInfo.Info)["buyerclass"]))
+		} else {
+			values = append(values, putil.GetSubScopeClass((*matchInfo.Info)["s_subscopeclass"]))
+		}
+	}
+	fields := []string{"userid", "infoid", "date", "matchkeys", "area", "city"}
+	if isVipUser {
+		fields = append(fields, "buyerclass")
+	} else {
+		fields = append(fields, "subscopeclass")
 	}
-	savecount := putil.Mysql.InsertBatch("pushsubscribe", []string{"userid", "infoid", "date", "matchkeys", "area", "city", "buyerclass"}, values)
+	savecount := putil.Mysql.InsertBatch("pushsubscribe", fields, values)
 	if int(savecount) != len(matchInfos) {
-		logger.Error(k.Id, "批量保存有问题", len(matchInfos), savecount)
+		logger.Error(u.Id, "批量保存有问题", len(matchInfos), savecount)
 	}
 	if savecount == 0 {
 		return 0
@@ -149,9 +162,9 @@ func (n *NormalPush) save(k *UserInfo, matchInfos []*MatchInfo) int64 {
 }
 
 //vip 每周 每月推送 暂时保存
-func (n *NormalPush) vipTempSave(userId string, pushdate int64, newList []*MatchInfo) {
-	pLength := len(newList)
-	logger.Info(userId, "开始保存到pushspace_vip表", pLength)
+func (n *NormalPush) vipTempSave(u *UserInfo, pushParam *putil.PushParam) {
+	pLength := len(pushParam.Infos)
+	logger.Info(u.Id, "开始保存到pushspace_vip表", pLength)
 	if pLength == 0 {
 		return
 	}
@@ -159,21 +172,27 @@ func (n *NormalPush) vipTempSave(userId string, pushdate int64, newList []*Match
 	defer mongodb.DestoryMongoConn(sess)
 	var data map[string]interface{}
 	coll := sess.DB(putil.DbName).C("pushspace_vip")
-	coll.Find(map[string]interface{}{"userid": userId}).Select(map[string]interface{}{"size": 1, "list": 1, "date": 1, "userid": 1}).One(&data)
+	coll.Find(map[string]interface{}{
+		"userid":   u.Id,
+		"status":   1,
+		"ratemode": u.RateMode,
+	}).Select(map[string]interface{}{"size": 1, "list": 1, "date": 1, "userid": 1}).One(&data)
 	nowymd := util.NowFormat(util.Date_yyyyMMdd)
 	if data == nil { //批量新增
 		if pLength > Config.MaxPushSize {
-			newList = newList[:Config.MaxPushSize]
+			pushParam.Infos = pushParam.Infos[:Config.MaxPushSize]
 		}
 		err := coll.Insert(map[string]interface{}{
-			"userid":     userId,
+			"userid":     u.Id,
 			"size":       pLength,
-			"list":       newList,
+			"list":       pushParam.Infos,
 			"date":       nowymd,
-			"createtime": pushdate,
+			"createtime": pushParam.PushDate,
+			"status":     1,
+			"ratemode":   u.RateMode,
 		})
 		if err != nil {
-			logger.Error(userId, "保存到pushspace_vip出错", err)
+			logger.Error(u.Id, "保存到pushspace_vip出错", err)
 			return
 		}
 	} else { //批量更新
@@ -190,21 +209,21 @@ func (n *NormalPush) vipTempSave(userId string, pushdate int64, newList []*Match
 			count := Config.MaxPushSize - size
 			if pLength > count {
 				for i := 0; i < count; i++ {
-					oldList = append(oldList, newList[i])
+					oldList = append(oldList, pushParam.Infos[i])
 				}
 				set["list"] = oldList
 			} else { //追加
 				upSet["$pushAll"] = map[string]interface{}{
-					"list": newList,
+					"list": pushParam.Infos,
 				}
 			}
 		}
 		upSet["$set"] = set
 		err := coll.UpdateId(data["_id"], upSet)
 		if err != nil {
-			logger.Error(userId, "更新pushspace_vip出错", err)
+			logger.Error(u.Id, "更新pushspace_vip出错", err)
 			return
 		}
 	}
-	logger.Info(userId, "保存到pushspace_vip表结束", pLength)
+	logger.Info(u.Id, "保存到pushspace_vip表结束", pLength)
 }

+ 3 - 3
src/jfw/modules/pushsubscribe/src/push/pusher/pusher.go

@@ -6,8 +6,8 @@ import (
 )
 
 type Pusher interface {
-	OncePushBatch(taskType, batchIndex int, startId *string, args ...interface{}) (bool, *[]map[string]interface{})
-	GetUserInfo(user map[string]interface{}) *UserInfo
-	GetPushParam(mailPush int, k *UserInfo, sl *SortList) *putil.PushParam
+	OncePushBatch(taskType, batchIndex int, startId *string) (bool, *[]map[string]interface{})
+	GetUserInfo(user map[string]interface{}) (*UserInfo, *putil.PushWay)
+	GetPushParam(mailPush bool, k *UserInfo, sl *SortList) *putil.PushParam
 	AfterPush(pushResult *putil.PushResult, u *UserInfo, user map[string]interface{})
 }

+ 36 - 21
src/jfw/modules/pushsubscribe/src/push/pusher/repairpush.go

@@ -11,13 +11,14 @@ import (
 )
 
 //推送失败,补推
-type RepairPush struct{}
+type RepairPush struct {
+	Param string
+}
 
 //获取需要推送的用户
-func (r *RepairPush) OncePushBatch(taskType, batchIndex int, startId *string, args ...interface{}) (bool, *[]map[string]interface{}) {
-	param := args[0].(string)
+func (r *RepairPush) OncePushBatch(taskType, batchIndex int, startId *string) (bool, *[]map[string]interface{}) {
 	query := map[string]interface{}{}
-	if param == "all" {
+	if r.Param == "all" {
 		if *startId != "" {
 			query["_id"] = map[string]interface{}{
 				"$gt": bson.ObjectIdHex(*startId),
@@ -25,28 +26,41 @@ func (r *RepairPush) OncePushBatch(taskType, batchIndex int, startId *string, ar
 		}
 	} else {
 		ids := []bson.ObjectId{}
-		for _, v := range strings.Split(param, ",") {
+		for _, v := range strings.Split(r.Param, ",") {
 			ids = append(ids, bson.ObjectIdHex(v))
 		}
 		query["_id"] = map[string]interface{}{
 			"$in": ids,
 		}
+		batchIndex = -1
 	}
-	batchIndex = -1
 	return putil.GetPushDatas(taskType, batchIndex, "pushspace_fail", startId, query)
 }
 
 //获取用户缓存信息
-func (r *RepairPush) GetUserInfo(user map[string]interface{}) *UserInfo {
-	return putil.NewUserInfoByPushSpaceColl(user)
+func (r *RepairPush) GetUserInfo(user map[string]interface{}) (*UserInfo, *putil.PushWay) {
+	userInfo := putil.NewUserInfoByPushSpaceColl(user)
+	pushWay := &putil.PushWay{}
+	wxFail, _ := user["wxfail"].(int)
+	appFail, _ := user["appfail"].(int)
+	mailFail, _ := user["mailfail"].(int)
+	if wxFail > 0 {
+		pushWay.WxPush = true
+	}
+	if appFail > 0 {
+		pushWay.AppPush = true
+	}
+	if mailFail > 0 {
+		pushWay.MailPush = true
+	}
+	return userInfo, pushWay
 }
 
 //获取推送参数
-func (r *RepairPush) GetPushParam(mailPush int, u *UserInfo, sl *SortList) *putil.PushParam {
-	pushParam := putil.NewPushParam(true, 0, mailPush, u, sl)
-	if pushParam != nil {
-		pushParam.IsPush = true
-	}
+func (r *RepairPush) GetPushParam(mailPush bool, u *UserInfo, sl *SortList) *putil.PushParam {
+	pushParam := putil.NewPushParam(false, -1, mailPush, u, sl)
+	pushParam.IsPush = true
+	pushParam.PushDate = u.CreateTime
 	return pushParam
 
 }
@@ -55,7 +69,13 @@ func (r *RepairPush) GetPushParam(mailPush int, u *UserInfo, sl *SortList) *puti
 func (r *RepairPush) AfterPush(pushResult *putil.PushResult, u *UserInfo, user map[string]interface{}) {
 	sess := mongodb.GetMgoConn()
 	defer mongodb.DestoryMongoConn(sess)
-	if pushResult.WxStatus == -1 || pushResult.AppStatus == -1 || pushResult.MailStatus == -1 {
+	coll := sess.DB(putil.DbName).C("pushspace_fail")
+	if pushResult == nil || (pushResult.WxStatus != -1 && pushResult.AppStatus != -1 && pushResult.MailStatus != -1) {
+		err := coll.RemoveId(user["_id"])
+		if err != nil {
+			logger.Error(u.Id, "删除pushspace_fail表出错", err)
+		}
+	} else {
 		set := map[string]interface{}{}
 		inc := map[string]interface{}{}
 		if pushResult.WxStatus == -1 {
@@ -79,14 +99,9 @@ func (r *RepairPush) AfterPush(pushResult *putil.PushResult, u *UserInfo, user m
 		if len(set) > 0 {
 			update["$set"] = set
 		}
-		err := sess.DB("qfw").C("pushspace_fail").UpdateId(user["_id"], update)
-		if err != nil {
-			logger.Error("补推任务,update error", err)
-		}
-	} else {
-		err := sess.DB(putil.DbName).C("pushspace_fail").RemoveId(user["_id"])
+		err := coll.UpdateId(user["_id"], update)
 		if err != nil {
-			logger.Error("补推任务,update error", err)
+			logger.Error(u.Id, "更新pushspace_fail表出错", err)
 		}
 	}
 }

+ 67 - 23
src/jfw/modules/pushsubscribe/src/push/pusher/specialpush.go

@@ -5,6 +5,7 @@ import (
 	. "push/config"
 	putil "push/util"
 	"qfw/util/mongodb"
+	"time"
 
 	"github.com/donnie4w/go-logger/logger"
 	"gopkg.in/mgo.v2/bson"
@@ -14,8 +15,22 @@ import (
 type SpecialPush struct{}
 
 //获取需要推送的用户
-func (s *SpecialPush) OncePushBatch(taskType, batchIndex int, startId *string, args ...interface{}) (bool, *[]map[string]interface{}) {
-	query := map[string]interface{}{}
+func (s *SpecialPush) OncePushBatch(taskType, batchIndex int, startId *string) (bool, *[]map[string]interface{}) {
+	query := map[string]interface{}{
+		"status": 1,
+	}
+	if taskType == 3 {
+		query["ratemode"] = 3
+	} else if taskType == 4 {
+		query["ratemode"] = 4
+	} else if taskType == 5 {
+		query["ratemode"] = map[string]interface{}{
+			"$in": []int{4, 5},
+		}
+	} else {
+		logger.Error("taskType error", taskType)
+		return true, nil
+	}
 	if len(Config.TestIds) > 0 {
 		query["userid"] = map[string]interface{}{
 			"$in": Config.TestIds,
@@ -30,43 +45,72 @@ func (s *SpecialPush) OncePushBatch(taskType, batchIndex int, startId *string, a
 }
 
 //获取用户最新信息
-func (s *SpecialPush) GetUserInfo(user map[string]interface{}) *UserInfo {
+func (s *SpecialPush) GetUserInfo(user map[string]interface{}) (*UserInfo, *putil.PushWay) {
 	userId, _ := user["userid"].(string)
-	u := mongodb.FindById("user", userId, UserCollFields)
-	if u == nil || len(*u) == 0 {
-		logger.Error("user表中没有找到该用户信息", userId)
-		return nil
+	rateMode, _ := user["ratemode"].(int)
+	sess := mongodb.GetMgoConn()
+	defer mongodb.DestoryMongoConn(sess)
+	var u map[string]interface{}
+	sess.DB(putil.DbName).C("user").FindId(bson.ObjectIdHex(userId)).One(&u)
+	if u == nil || len(u) == 0 {
+		logger.Error(userId, "user表中没有找到该用户信息")
+		s.deletePushspaceVip(user)
+		return nil, nil
+	}
+	userInfo, _ := NewUserInfoByUserColl(u)
+	if !IsVipUser(userInfo.VipStatus) {
+		logger.Info(userId, "已经不是vip用户了", userInfo.VipStatus)
+		s.deletePushspaceVip(user)
+		return nil, nil
+	}
+	if rateMode != userInfo.RateMode {
+		logger.Info(userId, "用户的推送时间变了", rateMode, userInfo.RateMode)
+		s.deletePushspaceVip(user)
+		return nil, nil
 	}
-	userInfo, _ := NewUserInfoByUserColl(*u)
 	if userInfo != nil {
 		userInfo.Size, _ = user["size"].(int)
 		userInfo.CreateTime, _ = user["createtime"].(int64)
 	}
-	return userInfo
+	pushWay := putil.NewPushWay(userInfo)
+	if !pushWay.WxPush && !pushWay.AppPush && !pushWay.MailPush && !pushWay.PcHelperPush {
+		s.deletePushspaceVip(user)
+		return nil, nil
+	}
+	return userInfo, pushWay
 }
 
-func (s *SpecialPush) GetPushParam(mailPush int, u *UserInfo, sl *SortList) *putil.PushParam {
-	pushParam := putil.NewPushParam(false, 0, mailPush, u, sl)
-	if pushParam != nil {
-		pushParam.IsPush = true
-		pushParam.InfosLength = u.Size
-		pushParam.PushDate = u.CreateTime
-	}
+func (s *SpecialPush) GetPushParam(mailPush bool, u *UserInfo, sl *SortList) *putil.PushParam {
+	pushParam := putil.NewPushParam(false, -1, mailPush, u, sl)
+	pushParam.IsPush = true
+	pushParam.InfosLength = u.Size
+	pushParam.PushDate = u.CreateTime
 	return pushParam
 }
 
 //推送以后处理
 func (s *SpecialPush) AfterPush(pushResult *putil.PushResult, u *UserInfo, user map[string]interface{}) {
-	if pushResult.PushDate == 0 {
-		return
-	}
-	if pushResult.WxStatus == 0 && pushResult.AppStatus == 0 && pushResult.MailStatus == 0 {
-		return
+	if pushResult == nil || (pushResult.WxStatus != -1 && pushResult.AppStatus != -1 && pushResult.MailStatus != -1) {
+		s.deletePushspaceVip(user)
+	} else {
+		sess := mongodb.GetMgoConn()
+		defer mongodb.DestoryMongoConn(sess)
+		err := sess.DB(putil.DbName).C("pushspace_vip").UpdateId(user["_id"], map[string]interface{}{
+			"failtime": time.Now().Unix(),
+			"status":   -1,
+		})
+		if err != nil {
+			logger.Error(u.Id, "更新pushspace_vip数据出错", err)
+		}
 	}
+}
+
+//删除临时表数据
+func (s *SpecialPush) deletePushspaceVip(u map[string]interface{}) {
 	sess := mongodb.GetMgoConn()
 	defer mongodb.DestoryMongoConn(sess)
-	err := sess.DB(putil.DbName).C("pushspace_vip").RemoveId(user["_id"])
+	err := sess.DB(putil.DbName).C("pushspace_vip").RemoveId(u["_id"])
 	if err != nil {
-		logger.Error(u.Id, "删除pushspace_vip数据出错", err)
+		logger.Error(u["userid"], "删除pushspace_vip数据出错", err)
 	}
 }

+ 6 - 5
src/jfw/modules/pushsubscribe/src/push/rpc/rpc.go

@@ -1,7 +1,8 @@
 package rpc
 
 import (
-	"push/job"
+	. "push/job"
+	. "push/pusher"
 
 	"github.com/donnie4w/go-logger/logger"
 )
@@ -12,10 +13,10 @@ type Rpc struct {
 //企明星后台补推rpc接口
 func (p *Rpc) RepairPush(req string, res *string) error {
 	logger.Info("rpc接收到需要补推的请求", req)
-	if job.Jobs.Repair.Execute(req) {
-		*res = "y"
-	} else {
-		*res = "n"
+	var pusher Pusher = &RepairPush{
+		Param: req,
 	}
+	Jobs.Push.StartPush(pusher, 0)
+	*res = "y"
 	return nil
 }

+ 65 - 26
src/jfw/modules/pushsubscribe/src/push/util/entity.go

@@ -6,6 +6,8 @@ import (
 	. "push/config"
 	"qfw/util"
 	"strings"
+
+	"github.com/donnie4w/go-logger/logger"
 )
 
 //推送返回结果
@@ -17,20 +19,63 @@ type PushResult struct {
 	PushDate      int64
 	Infos         []*MatchInfo
 }
+type PushWay struct {
+	WxPush       bool
+	AppPush      bool
+	MailPush     bool
+	PcHelperPush bool
+}
+
+//获取推送方式
+func NewPushWay(u *UserInfo) *PushWay {
+	wxPush, appPush, mailPush := false, false, false
+	if u.WxPush == 1 {
+		wxPush = true
+	}
+	if u.AppPush == 1 {
+		appPush = true
+	}
+	if u.MailPush == 1 {
+		mailPush = true
+	}
+	//再对取消关注以及app没有登录的用户进行过滤,但是依然可以进行助手推送
+	if u.Subscribe == 0 {
+		wxPush = false
+	}
+	if u.Jpushid == "" && u.Opushid == "" {
+		appPush = false
+	}
+	if mailPush {
+		if u.UserType == 0 && u.Subscribe == 0 {
+			mailPush = false
+		} else if (u.UserType == 1 || u.UserType == 2) && u.Jpushid == "" && u.Opushid == "" {
+			mailPush = false
+		} else if u.UserType == 5 && u.Subscribe == 0 && u.Jpushid == "" && u.Opushid == "" {
+			mailPush = false
+		}
+	}
+	pushWay := &PushWay{
+		WxPush:       wxPush,
+		AppPush:      appPush,
+		MailPush:     mailPush,
+		PcHelperPush: u.PcHelperPush == 1,
+	}
+	logger.Info("用户接收方式", "userId", u.Id, "wxPush", pushWay.WxPush, "appPush", pushWay.AppPush, "mailPush", pushWay.MailPush, "pcHelperPush", pushWay.PcHelperPush)
+	return pushWay
+}
+
 type PushParam struct {
-	JpushTitle    string
-	LastInfoDate  int64
-	TitleArray    []string
-	Infos         []*MatchInfo
-	InfosLength   int
-	IsVipUser     bool
-	MailContent   string
-	PushDate      int64
-	IsPush        bool
-	IsVipTempSave bool
+	JpushTitle   string
+	LastInfoDate int64
+	TitleArray   []string
+	Infos        []*MatchInfo
+	InfosLength  int
+	MailContent  string
+	PushDate     int64
+	IsPush       bool
 }
 
-func NewPushParam(isLimit bool, dayCount, mailPush int, u *UserInfo, sl *SortList) *PushParam {
+func NewPushParam(isLimit bool, dayCount int, mailPush bool, u *UserInfo, sl *SortList) *PushParam {
 	mailContent := ""
 	jpushTitle := ""
 	lastInfoDate := int64(0)
@@ -61,20 +106,15 @@ func NewPushParam(isLimit bool, dayCount, mailPush int, u *UserInfo, sl *SortLis
 		}
 		//增加行业的处理
 		industry := ""
-		industryclass := "industry"
-		if k2["s_subscopeclass"] != nil {
-			k2sub := strings.Split(util.ObjToString(k2["s_subscopeclass"]), ",")
-			if len(k2sub) > 0 {
-				industry = k2sub[0]
-				if industry != "" {
-					ss := strings.Split(industry, "_")
-					if len(ss) > 1 {
-						industry = ss[0]
-					}
-				}
-			}
+		industryclass := ""
+		if isVipUser {
+			industryclass = "buyerclass"
+			industry, _ = k2["buyerclass"].(string)
+		} else {
+			industryclass = "subscopeclass"
+			industry = GetSubScopeClass(k2["s_subscopeclass"])
 		}
-		if mailPush == 1 { //关于邮件的处理
+		if mailPush && infosLength <= Config.MaxPushSize { //关于邮件的处理
 			mailSid := util.CommonEncodeArticle("mailprivate", util.ObjToString(k2["_id"]))
 			url := fmt.Sprintf("%s/article/mailprivate/%s.html", Config.JianyuDomain, mailSid)
 			classArea := "area"
@@ -94,7 +134,7 @@ func NewPushParam(isLimit bool, dayCount, mailPush int, u *UserInfo, sl *SortLis
 			dates := util.LongToDate(k2["publishtime"], false)
 			//标题替换
 			otitle := title
-			for _, kw := range u.Keys {
+			for _, kw := range ks.Keys {
 				kws := strings.Split(kw, "+")
 				n := 0
 				otitle2 := otitle
@@ -137,7 +177,6 @@ func NewPushParam(isLimit bool, dayCount, mailPush int, u *UserInfo, sl *SortLis
 		TitleArray:   titleArray,
 		Infos:        infos,
 		InfosLength:  infosLength,
-		IsVipUser:    isVipUser,
 		MailContent:  mailContent,
 	}
 }

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

@@ -31,14 +31,13 @@ func SendWeixin(k *UserInfo, remark, title string, pushDate int64) bool {
 	if Config.WxSleep > 0 {
 		time.Sleep(time.Duration(Config.WxSleep) * time.Millisecond)
 	}
-	now := time.Now()
 	p := &qrpc.NotifyMsg{
 		Openid:      k.S_m_openid,
 		Title:       title,
 		Remark:      remark,
 		Detail:      Config.WxGroup,
 		Date:        "",
-		Service:     util.FormatDate(&now, util.Date_Short_Layout),
+		Service:     util.NowFormat(util.Date_Short_Layout),
 		Color:       Config.WxColor,
 		DetailColor: Config.WxDetailColor,
 		Url:         Config.JianyuDomain + "/front/sess/" + Se.EncodeString(k.S_m_openid+",uid,"+strconv.Itoa(int(time.Now().Unix()))+",historypush") + "__" + fmt.Sprint(pushDate),

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

@@ -7,6 +7,7 @@ import (
 	"qfw/util"
 	"qfw/util/mongodb"
 	"sort"
+	"strings"
 	"time"
 
 	"github.com/donnie4w/go-logger/logger"
@@ -20,7 +21,7 @@ func ToObjectIds(ids []string) []bson.ObjectId {
 	}
 	return _ids
 }
-func ToSortList(list interface{}) SortList {
+func ToSortList(list interface{}) *SortList {
 	if list == nil {
 		return nil
 	}
@@ -34,7 +35,7 @@ func ToSortList(list interface{}) SortList {
 		return nil
 	}
 	sort.Sort(sl)
-	return sl
+	return &sl
 }
 
 //控制一分钟最大推送数,均匀调度
@@ -64,7 +65,7 @@ func NewUserInfoByPushSpaceColl(user map[string]interface{}) *UserInfo {
 		WxPush:        util.IntAll(user["wxpush"]),
 		AppPush:       util.IntAll(user["apppush"]),
 		MailPush:      util.IntAll(user["mailpush"]),
-		PchelperPush:  util.IntAll(user["pchelperpush"]),
+		PcHelperPush:  util.IntAll(user["pchelperpush"]),
 		Email:         util.ObjToString(user["email"]),
 		S_m_openid:    util.ObjToString(user["s_m_openid"]),
 		A_m_openid:    util.ObjToString(user["a_m_openid"]),
@@ -83,7 +84,9 @@ func NewUserInfoByPushSpaceColl(user map[string]interface{}) *UserInfo {
 	}
 }
 
-//获取一批次推送的数据
+/*获取一批次推送的数据
+ *batchIndex < 0 不走分批次加载
+ */
 func GetPushDatas(taskType, batchIndex int, collection string, startId *string, query map[string]interface{}) (bool, *[]map[string]interface{}) {
 	logger.Info(taskType, "开始加载第", batchIndex, "批用户", query)
 	sess := mongodb.GetMgoConn()
@@ -101,5 +104,29 @@ func GetPushDatas(taskType, batchIndex int, collection string, startId *string,
 		}
 	}
 	logger.Info(taskType, "第", batchIndex, "批用户加载结束", *startId)
-	return i < Config.PushBatch, &users
+	return batchIndex < 0 || i < Config.PushBatch, &users
+}
+
+//是否是一个月或者一周推送一次的时间
+func IsVipTempPushTime() bool {
+	now := time.Now()
+	return now.Day() == Config.VipPushDay || now.Weekday().String() == Config.VipPushWeek
+}
+
+//获取信息行业
+func GetSubScopeClass(subscopeclass interface{}) string {
+	industry := ""
+	if subscopeclass != nil {
+		k2sub := strings.Split(util.ObjToString(subscopeclass), ",")
+		if len(k2sub) > 0 {
+			industry = k2sub[0]
+			if industry != "" {
+				ss := strings.Split(industry, "_")
+				if len(ss) > 1 {
+					industry = ss[0]
+				}
+			}
+		}
+	}
+	return industry
 }

+ 1 - 1
src/jfw/modules/subscribepay/src/a/init.go

@@ -18,7 +18,7 @@ func init() {
 	xweb.RootApp().AppConfig.EnableHttpCache = false
 	xweb.RootApp().AppConfig.Mode = xweb.Product
 	xweb.RootApp().AppConfig.ReloadTemplates = true
-	xweb.RootApp().AppConfig.SessionTimeout = 30 * time.Minute
+	xweb.RootApp().AppConfig.SessionTimeout = 7 * 24 * time.Hour
 	xweb.RootApp().Logger.SetOutputLevel(1) //输出日志,改为4则不输出任何日志
 	//
 	xweb.AddRouter("/subscribepay", &service.AfterPay{})

+ 14 - 11
src/jfw/modules/subscribepay/src/entity/subscribeVip.go

@@ -100,9 +100,9 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 	} else if vmsg.OrderType == 2 { //续费
 		flag = JyVipSubStruct.RenewSubVip(userid, qutil.ObjToString((*orderdata)["vip_endtime"]))
 	} else if vmsg.OrderType == 3 { //立即升级
-		flag = JyVipSubStruct.UpgradeSubVip(userid, vmsg, qutil.ObjToString((*orderdata)["vip_starttime"]), qutil.ObjToString((*orderdata)["vip_endtime"]), true)
+		flag = JyVipSubStruct.UpgradeSubVip(userid, vmsg, qutil.ObjToString((*orderdata)["vip_endtime"]), true)
 	} else if vmsg.OrderType == 4 || vmsg.OrderType == 5 { //下月升级
-		flag = JyVipSubStruct.UpgradeSubVip(userid, vmsg, qutil.ObjToString((*orderdata)["vip_starttime"]), qutil.ObjToString((*orderdata)["vip_endtime"]), false)
+		flag = JyVipSubStruct.UpgradeSubVip(userid, vmsg, qutil.ObjToString((*orderdata)["vip_endtime"]), false)
 	}
 	//支付成功后 其他未支付vip订阅订单 变为已取消
 	if flag {
@@ -144,16 +144,16 @@ func (this *vipSubscribeStruct) RenewSubVip(userId, endtime string) bool {
 		log.Println("%s格式化日期出错%s\n", userId, endtime)
 		return false
 	}
-	return util.MQFW.UpdateById("user", userId, bson.M{"$set": bson.M{"l_vip_endtime": prepayTime.Unix()}})
+	return util.MQFW.UpdateById("user", userId, bson.M{"$set": bson.M{"l_vip_endtime": prepayTime.Unix(), "i_vip_expire_tip": 0}})
 }
 
 //升级
-func (this *vipSubscribeStruct) UpgradeSubVip(userId string, vmsg VipSimpleMsg, start, end string, isNow bool) bool {
-	startTime, err := time.ParseInLocation(qutil.Date_Full_Layout, start, time.Local)
-	if err != nil {
-		log.Println("%s格式化日期出错%s\n", userId, start)
-		return false
-	}
+func (this *vipSubscribeStruct) UpgradeSubVip(userId string, vmsg VipSimpleMsg, end string, isNow bool) bool {
+	//	startTime, err := time.ParseInLocation(qutil.Date_Full_Layout, start, time.Local)
+	//	if err != nil {
+	//		log.Println("%s格式化日期出错%s\n", userId, start)
+	//		return false
+	//	}
 	endTime, err := time.ParseInLocation(qutil.Date_Full_Layout, end, time.Local)
 	if err != nil {
 		log.Println("%s格式化日期出错%s\n", userId, endTime)
@@ -168,21 +168,24 @@ func (this *vipSubscribeStruct) UpgradeSubVip(userId string, vmsg VipSimpleMsg,
 				"o_vipjy.o_buyset":     buyset,
 				"l_vip_endtime":        endTime.Unix(),
 				"i_vip_status":         2,
+				"i_vip_expire_tip":     0,
 			}})
 	} else {
 		if !util.MQFW.UpdateById("user", userId,
 			bson.M{"$set": bson.M{
-				"l_vip_endtime": endTime.Unix(),
+				"l_vip_endtime":    endTime.Unix(),
+				"i_vip_expire_tip": 0,
 			}}) {
 			log.Printf("%s更新结束%d日期出错\n", userId, endTime.Unix())
 			return false
 		}
+		effectTime := time.Date(time.Now().Year(), time.Now().Month()+1, 1, 0, 0, 0, 0, time.Local)
 		return util.MQFW.Save("vip_upgrade",
 			bson.M{
 				"s_userid":     userId,            //试用设置地区
 				"a_buyerclass": vmsg.Industry,     //试用设置行业
 				"o_area":       vmsg.Area,         //购买内容 城市、省份、行业数量
-				"l_validtime":  startTime.Unix(),  //生效时间
+				"l_validtime":  effectTime.Unix(), //生效时间
 				"l_createtime": time.Now().Unix(), //入库时间
 				"o_buyset":     buyset,            //购买内容数量
 				"i_isvalid":    0,                 //是否已经生效 0-未生效

+ 52 - 2
src/jfw/modules/subscribepay/src/service/orderListDetails.go

@@ -245,8 +245,8 @@ func (o *OrderListDetails) SetEmail() {
 		var email_used = true
 		if email != o.GetSession("EmailBindingVerifyEmail") {
 			//user表里校验邮箱是否被使用  字段待定
-			res, _ := util.MQFW.FindOne("user", bson.M{"email": email})
-			if res != nil && qutil.ObjToString((*res)["email"]) != "" {
+			res, _ := util.MQFW.FindOne("user", bson.M{"s_myemail": email})
+			if res != nil && qutil.ObjToString((*res)["s_myemail"]) != "" {
 				email_used = false
 				o.T["success"] = false
 				o.T["errCode"] = 4
@@ -354,6 +354,26 @@ func (o *OrderListDetails) SetRes(res []map[string]interface{}, queryM map[strin
 	}
 	delete(queryM, "product_type")
 	for _, v := range res {
+		//获取单号 如果是vip 48小时取消
+		order_code := qutil.ObjToString(v["order_code"])
+		create_time_str := qutil.ObjToString(v["create_time"])
+		//创建时间戳
+		create_time, _ := time.ParseInLocation(qutil.Date_Full_Layout, create_time_str, time.Local)
+		//48小时后的时间戳
+		create_time_stamp := create_time.AddDate(0, 0, 2).Unix()
+		//当前时间时间戳
+		now_time_stamp := time.Now().Unix()
+		if create_time_stamp < now_time_stamp && qutil.ObjToString(v["product_type"]) == "VIP订阅" {
+			if v["order_status"] != nil {
+				order_status := qutil.Int64All(v["order_status"])
+				if order_status == 0 {
+					//数据库更改
+					go FortyEightHoursCancel(order_code, create_time_stamp, now_time_stamp)
+					//前端传参更改
+					v["order_status"] = orderStatus_cancel
+				}
+			}
+		}
 		if v["filter_publishtime"] != nil {
 			filter_publishtime := v["filter_publishtime"]
 			if filter_publishtime != nil {
@@ -436,3 +456,33 @@ func getPayTransactionId(payWay, tradeNo string) (transaction_id string) {
 	}
 	return
 }
+
+//检查vip订单是否到期,如果到期 订单取消48h
+func FortyEightHoursCancel(order string, create_time_stamp, now_time_stamp int64) {
+	//查询vip订单条件
+	queryM := map[string]interface{}{
+		"order_code":   order,
+		"product_type": "VIP订阅",
+	}
+	flag := false
+	//order := util.Mysql.FindOne(tableName_order, queryMap, "pay_way,out_trade_no,prepay_time,order_status", "")
+	res := util.Mysql.FindOne(tableName_order, queryM, "id,order_code,create_time,pay_way,out_trade_no,prepay_time,order_status,user_id", "")
+	if res != nil {
+		id := qutil.Int64All((*res)["id"])
+		queryMap := map[string]interface{}{
+			"id":      id,
+			"user_id": qutil.ObjToString((*res)["user_id"]),
+		}
+		//如果超过48小时 取消订单  创建48小时后的时间戳<当前时间戳
+		if create_time_stamp < now_time_stamp {
+			if qutil.IntAll((*res)["order_status"]) == 0 { //未支付状态下 删除订单需要先关闭订单
+				flag = pay.CloseDataExportOrder(qutil.ObjToString((*res)["pay_way"]), qutil.ObjToString((*res)["out_trade_no"]), qutil.ObjToString((*res)["prepay_time"]))
+			} else {
+				flag = true
+			}
+			if flag {
+				flag = util.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"order_status": -2})
+			}
+		}
+	}
+}

+ 3 - 3
src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go

@@ -117,15 +117,15 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 		if pay_source == "Upgrade" { //计算升级时间
 			if effect == "now" { //立即生效
 				orderType = 3
-				startTime = time.Now()
+				//				startTime = time.Now()
 			} else { //下月生效
 				orderType = 4
-				startTime = time.Date(time.Now().Year(), time.Now().Month()+1, 1, 0, 0, 0, 0, time.Local)
+				//				startTime = time.Date(time.Now().Year(), time.Now().Month()+1, 1, 0, 0, 0, 0, time.Local)
 			}
 
 		} else { //续费时间
 			orderType = 2 //续费操作
-			startTime = endTime
+			//			startTime = endTime
 		}
 		//		if date_unit == 1 { ///延长时间
 		//			endTime = endTime.AddDate(date_count, 0, 0)

+ 7 - 4
src/jfw/modules/subscribepay/src/timetask/timetask.go

@@ -92,15 +92,18 @@ func checkIsExpire() {
 			l_vip_endtime := qutil.Int64All(m["l_vip_endtime"])
 			i_vip_status := qutil.IntAll(m["i_vip_status"])
 			i_vip_expire_tip := qutil.IntAll(m["i_vip_expire_tip"])
-			if l_vip_endtime < now_unix {
+			if l_vip_endtime <= now_unix {
 				util.MQFW.UpdateById("user", _id, map[string]interface{}{
 					"$set": map[string]interface{}{
 						"i_vip_status":     -i_vip_status,
 						"i_vip_expire_tip": 2,
 					},
 				})
-				log.Println("用户", _id, i_vip_status, l_vip_endtime, "修改到期状态")
-			} else if l_vip_endtime-now_unix <= threeday && i_vip_expire_tip == 0 {
+				for _, pushColl := range []string{"pushspace", "pushspace_temp", "pushspace_vip", "pushspace_fail"} {
+					util.MQFW.Del(pushColl, map[string]interface{}{"userid": _id})
+				}
+				log.Println("用户", _id, i_vip_status, l_vip_endtime, "修改已到期状态")
+			} else if l_vip_endtime-now_unix <= threeday && i_vip_expire_tip != 1 && i_vip_expire_tip != -1 {
 				updateOk := util.MQFW.UpdateById("user", _id, map[string]interface{}{
 					"$set": map[string]interface{}{
 						"i_vip_expire_tip": 1,
@@ -187,7 +190,7 @@ func expireRemind() {
 			if wxPushOk || appPushOk {
 				util.MQFW.UpdateById("user", _id, map[string]interface{}{
 					"$set": map[string]interface{}{
-						"i_vip_expire_tip": 0,
+						"i_vip_expire_tip": -i_vip_expire_tip,
 					},
 				})
 			}

+ 23 - 13
src/jfw/public/historypush.go

@@ -426,15 +426,25 @@ func (h *historyPush) getInfoByIds(pushCas []*jy.PushCa) []map[string]interface{
 func (h *historyPush) MakeHistoryDatas(userId, field string) (bool, []map[string]interface{}) {
 	allquery := `{"range":{"publishtime":{"gt":%s}}}`
 	allquery = fmt.Sprintf(allquery, fmt.Sprint(time.Now().AddDate(0, 0, -7).Unix()))
-	//allquery := ``
-	_, list := PushView(userId, allquery, field, 1, 50)
+	allquery = ``
+	keys, list := PushView(userId, allquery, field, 1, 50)
 	if list == nil || len(*list) == 0 {
 		return true, nil
 	}
+	matchkeys := []string{}
+	if len(keys) > 0 {
+		for _, v := range keys {
+			for _, k := range util.ObjArrToStringArr(v.([]interface{})) {
+				matchkeys = append(matchkeys, k)
+			}
+		}
+	}
 	result := []map[string]interface{}{}
-	pushinfo := []string{}
+	fields := []string{"userid", "infoid", "date", "matchkeys", "area", "city", "type", "subscopeclass"}
+	values := []interface{}{}
 	publishTitle := map[string]bool{}
 	now := time.Now()
+	keystr := strings.Join(matchkeys, " ")
 	for k, v := range *list {
 		title := strings.Replace(v["title"].(string), "\n", "", -1)
 		area_check := util.ObjToString(v["area"])
@@ -443,8 +453,7 @@ func (h *historyPush) MakeHistoryDatas(userId, field string) (bool, []map[string
 		} else {
 			publishTitle[area_check+title] = true
 		}
-		pushinfo = append(pushinfo, util.ObjToString(v["_id"]))
-
+		values = append(values, userId, util.ObjToString(v["_id"]), now.Unix(), keystr, area_check, "", 0, v["s_subscopeclass"])
 		info := map[string]interface{}{
 			"area":             area_check,
 			"_id":              util.EncodeArticleId2ByCheck(util.ObjToString(v["_id"])),
@@ -462,6 +471,8 @@ func (h *historyPush) MakeHistoryDatas(userId, field string) (bool, []map[string
 			"title":            title,
 			"ca_isvisit_index": k + 1,
 			"ca_date":          now.Unix(),
+			"ca_isvisit":       0,
+			"matchkeys":        matchkeys,
 		}
 		area := util.ObjToString(info["area"])
 		if area == "A" {
@@ -505,14 +516,13 @@ func (h *historyPush) MakeHistoryDatas(userId, field string) (bool, []map[string
 
 		result = append(result, info)
 	}
-	wxpush := map[string]interface{}{
-		"dateymd":  now.Format(util.Date_yyyyMMdd),
-		"date":     now.Unix(),
-		"uid":      userId,
-		"pushinfo": strings.Join(pushinfo, ","),
-	}
-	flag := Ca_Push.SaveCacheByTimeOut("jy_pushhistory", wxpush, 10)
-	return flag, result
+	go func(fields []string, values []interface{}) {
+		count := Mysql.InsertBatch("pushsubscribe", fields, values)
+		if int(count) == len(values) {
+			log.Println("mysql insert  true")
+		}
+	}(fields, values)
+	return true, result
 }
 
 //获取用户信息

+ 1 - 1
src/main.go

@@ -100,7 +100,7 @@ func initXweb() {
 	xweb.RootApp().AppConfig.Mode = xweb.Product
 	xweb.RootApp().SetConfig("schecm", Sysconfig["agreement"])
 	xweb.RootApp().AppConfig.ReloadTemplates = true
-	xweb.RootApp().AppConfig.SessionTimeout = 30 * time.Minute
+	xweb.RootApp().AppConfig.SessionTimeout = 7 * 24 * time.Hour
 	xweb.RootApp().AppConfig.CacheTemplates = Sysconfig["cacheflag"].(bool)
 	xweb.RootApp().AddTmplVar("Msg", tag.Msg)
 	xweb.RootApp().AddTmplVar("Ad", tag.Ad)

BIN
src/web/staticres/images/mail.png


BIN
src/web/staticres/images/phone.png


+ 1 - 1
src/web/staticres/vipsubscribe/css/vip_update.css

@@ -877,7 +877,7 @@
 }
 
 .vip_renew .detail_item .item_info .label {
-  width: 1.56rem;
+  width: 1.6rem;
 }
 
 .vip_renew .detail_item .item_info .label_for {

+ 4 - 4
src/web/staticres/vipsubscribe/js/keyWord.js

@@ -1,4 +1,5 @@
-$(function () {
+
+var reloadFunc = function(){
     
     //去空格方法
     // String.prototype.trim = function () {
@@ -41,7 +42,7 @@ $(function () {
     // 添加 确认按钮的点击事件
     $('.content .addkeyWord .btn button').on('click', function () {
         var keyWord = $('.addkeyWord input.enterOne').val();
-		if($.inArray(keyWord, kws_arr)>-1){
+		if(kws_arr[keyWord]!=undefined){
             weui.toast('您设置的关键词已存在,请调整后再添加。', {
                 duration: 2000,
                 className: 'custom-toast',
@@ -285,5 +286,4 @@ $(function () {
         $('.classify-edit-pop').hide()
         $('input.classify-keyword').val('')
     })
-
-})
+}

+ 2 - 1
src/web/templates/weixin/dataExport/dataExport_toMyOrder.html

@@ -440,7 +440,7 @@
 			function beforeJump(eid,isVipOrder){
 				setSessionStorage();
 				if (isVipOrder=="true"){
-					window.location.href="/front/vipsubscribe/toOrderDetailPage?orderCode="+eid;
+					window.location.href="/weixin/pay/toOrderDetailPage?orderCode="+eid;
 				}else{
 					window.location.href="/weixin/pay/wxToOrderDetail?orderCode="+eid;
 				}
@@ -633,6 +633,7 @@
 					var result = true;
 					$.post("/subscribepay/orderListDetails/myOrder",{"type":typ},function(data){
 							$(".loading_").hide();
+							console.log(data.res)
 							var list=data.res;
 							dataCache =data.res;
 							pageIndex=2;

+ 4 - 4
src/web/templates/weixin/email/bind_email.html

@@ -114,13 +114,13 @@
 								if(data.success){
 									if ($("#bindBtn").text()=="确定"){	//更改绑定
 										sessionStorage.removeItem("send_myemail_"+{{.T.userId}});
-										window.location.replace("/front/wxMyOrder/setSuccess?name=changeEmail"); 
+										window.location.replace("/jyapp/front/myorder/setSuccess?name=changeEmail"); 
 									}else{
 										sessionStorage.removeItem("send_myemail_"+{{.T.userId}});
-										if((param="invoice")&&(orderCode!="")){
-											window.location.replace("/front/wxMyOrder/setSuccess?name=invoice&orderCode="+orderCode); 
+										if((param="invoice")&&(orderCode!=null)){
+											window.location.replace("/jyapp/front/myorder/setSuccess?name=invoice&orderCode="+orderCode); 
 										}else{
-											window.location.replace("/front/wxMyOrder/setSuccess?name=bindEmail"); 
+											window.location.replace("/jyapp/front/myorder/setSuccess?name=bindEmail"); 
 										}
 									}
 								}

+ 57 - 11
src/web/templates/weixin/email/bind_success.html

@@ -1,33 +1,79 @@
 <!DOCTYPE html>
 <html>
 	<head>
-		<meta charset="utf-8">
		<title>绑定成功</title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
+		<meta charset="utf-8">
+		<title>绑定成功</title>
+		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
 		<link rel="stylesheet" href="{{Msg "seo" "cdn"}}/wxmyemail/css/reset.css?v={{Msg "seo" "version"}}">
 		<link rel="stylesheet" href="{{Msg "seo" "cdn"}}/wxmyemail/css/common.css?v={{Msg "seo" "version"}}">
 		<link rel="stylesheet" href="{{Msg "seo" "cdn"}}/wxmyemail/css/mine.css?v={{Msg "seo" "version"}}"/>   
 		{{include "/common/weixin.html"}}
-		<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>    
+		<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>    
 	</head>
 	<body>
-		<div class="bind_success">
			<div class="success">
				<img src="{{Msg "seo" "cdn"}}/wxmyemail/img/successed.png" >
				<p></p>
			</div>
			<button class="common_btn back">返回 <time class="time">()</time> </button>
		</div>
		<script src="{{Msg "seo" "cdn"}}/wxmyemail/js/zepto.js"></script>
		<script src="{{Msg "seo" "cdn"}}/wxmyemail/js/public.js"></script>
		<script>
			$(function(){
+		<div class="bind_success">
+			<div class="success">
+				<img src="{{Msg "seo" "cdn"}}/wxmyemail/img/successed.png" >
+				<p></p>
+			</div>
+			<button class="common_btn back">返回 <time class="time">()</time> </button>
+		</div>
+		<script src="{{Msg "seo" "cdn"}}/wxmyemail/js/zepto.js"></script>
+		<script src="{{Msg "seo" "cdn"}}/wxmyemail/js/public.js"></script>
+		<script>
+			$(function(){
 				//分享
-				initShare({{.T.signature}},{{.T.openid}},2,"jy_wxmyorder",{{.T.nickname}},{{.T.avatar}});
				
+				initShare({{.T.signature}},{{.T.openid}},2,"jy_wxmyorder",{{.T.nickname}},{{.T.avatar}});
+				
 				let param = getParam('name');//获取url传来的参数 判断显示成功的字幕
-				var orderCode=getParam("orderCode"); //开发票的订单
				console.log(param)
				var time = 6;
				function countDown(){
					if(time == 0){
						$('.time').html('');
+				var orderCode=getParam("orderCode"); //开发票的订单
+				console.log(param)
+				var time = 6;
+				function countDown(){
+					if(time == 0){
+						$('.time').html('');
 						if((param="invoice")&&(orderCode!="")){
-							window.location.replace('/front/vipsubscribe/toOrderDetailPage?orderCode='+orderCode);
+							window.location.replace('/weixin/pay/toOrderDetailPage?orderCode='+orderCode);
 						}else{
 							window.location.replace('/front/wxMyOrder/myEmail');
-						}
					}else{
						$('.time').html('(' + time + ')');
						time--;
						setTimeout(()=>{
							countDown()
						},1000)
					}
				}
				if(param == 'bindEmail'){
					$('.success>p').html('邮箱绑定成功');
					countDown();
				}else if(param == 'bindPhoe'){
					$('.success>p').html('手机号绑定成功');
					countDown();
				}else if(param == 'changeEmail'){
					$('.success>p').html('邮箱更换成功');
					countDown();
				}else if(param == 'choosePhone'){
					$('.success>p').html('手机号更换成功');
					countDown();
				}else if(param =="unbind"){
+						}
+					}else{
+						$('.time').html('(' + time + ')');
+						time--;
+						setTimeout(()=>{
+							countDown()
+						},1000)
+					}
+				}
+				if(param == 'bindEmail'){
+					$('.success>p').html('邮箱绑定成功');
+					countDown();
+				}else if(param == 'bindPhoe'){
+					$('.success>p').html('手机号绑定成功');
+					countDown();
+				}else if(param == 'changeEmail'){
+					$('.success>p').html('邮箱更换成功');
+					countDown();
+				}else if(param == 'choosePhone'){
+					$('.success>p').html('手机号更换成功');
+					countDown();
+				}else if(param =="unbind"){
 					$('.success>p').html('邮箱解绑成功');
 					countDown();
 				}else if(param=="invoice"){
 					$('.success>p').html('邮箱绑定成功');
 					countDown();
-				}
				/* 返回 */
				$('.back').on('click',() =>{
					if((param="invoice")&&(orderCode!="")){
-							window.location.replace('/front/vipsubscribe/toOrderDetailPage?orderCode='+orderCode);
+				}
+				/* 返回 */
+				$('.back').on('click',() =>{
+					if((param="invoice")&&(orderCode!="")){
+							window.location.replace('/weixin/pay/toOrderDetailPage?orderCode='+orderCode);
 						}else{
 							window.location.replace('/front/wxMyOrder/myEmail');
-						}
				})
			})
		</script>
-	{{include "/common/baiducc.html"}}
	</body>
+						}
+				})
+			})
+		</script>
+	{{include "/common/baiducc.html"}}
+	</body>
 </html>

+ 2 - 2
src/web/templates/weixin/historypush.html

@@ -149,8 +149,8 @@
 				setSessionStorage();
 				window.location.href='/wxkeyset/keyset/index';
 			});
-			console.log(firstPage.length)
-			if(firstPage.length==0){
+			//console.log(firstPage.length)
+			if(firstPage==null||firstPage.length==0){
 				//最开始没有数据 
 				hasNoData();
 				$(".findnull_").show();

+ 32 - 10
src/web/templates/weixin/vipsubscribe/choose_area_upgrade.html

@@ -363,7 +363,8 @@
         <div class="tips_btn">
             <div class="tips_discount">
                 <div class="tips_d_money" style="display: block">&yen;38</div>
-                <div class="tips_d_text">已选择4个市,建议购买“全省”更划算哦~</div>
+                <div class="tips_d_text citys">已选择4个市,建议购买“全省”更划算哦~</div>
+                <div class="tips_d_text all">已选择10个省,建议购买“全国”更划算哦~</div>
             </div>
             <div class="btns">
                 <button class="reset-btn">重置</button>
@@ -390,7 +391,7 @@
         </div>
     </div>
     <script src="/vipsubscribe/js/jquery-2.1.4.js?v={{Msg "seo" "version"}}"></script>
-    <script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>
+    <!--<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>-->
     <script src="/vipsubscribe/js/mapJSON.js?v={{Msg "seo" "version"}}"></script>
     <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}"></script>
     <script>
@@ -401,7 +402,7 @@
             	buystr = data.area;
         	}
         }, false);
-        console.log(buystr)
+//      console.log(buystr)
       var AreaChoose={
         selectObj:{},//已选择,未购买城市;
         buyObj:{},//已购买
@@ -426,7 +427,7 @@
             if(checkObj(buystr)){
             	this.buyObj = {"全国":[]}
             }
-            console.log(this.buyObj)
+//          console.log(this.buyObj)
             //是否试用界面
             if(sessionStorage.getItem("vipSubisTrial")) this.vipSubisTrial=true;
           }catch(e){
@@ -522,6 +523,7 @@
           $('.result_name').empty()
           var data = []; //定义一个总数组
           var cityArr =[]; //定义一个选中城市数组
+          var provincesArr = [];
           var val = $('.other').parents('.province').text().trim();
           if ($('.other').is(':checked')) {
             // data.push(val)
@@ -533,13 +535,14 @@
               let arr =[];
               // 判断省份下的城市是否等于选中的城市长度,相等就是全部选中
               if (length == activeLeng) {
-                  $('.tips_btn .tips_d_text').hide()
+                  $('.tips_btn .tips_d_text.citys').hide()
                   // data.push($(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim())
                   let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
                   data.push({
                       name:province,
                       children:[]
-                  })
+                  });
+                  provincesArr.push(province);
               } else { 
                   let province = $(this).parent('.tab_content').siblings('.tab:not(.whole)').children('.province').text().trim();
                   let city = $(this).html()
@@ -561,7 +564,8 @@
           data = data.reduce((cur,next) =>{
               obj[next.name] ? "" : obj[next.name] = true && cur.push(next);
               return cur
-          },[]) 
+          },[]);
+          
           // 数组筛选
           let result = data.map(v =>{
               let filterArr = v.children.filter(s =>{
@@ -579,7 +583,8 @@
                   // 判断每个省份下选中的城市长度,当大于等于4的时候 弹出"选择全省更划算的弹窗"
                   let childrenArr=[];
                   if (children.length >= 4 && !this.vipSubisTrial) {
-                      $('.tips_btn .tips_d_text').show()
+                      $('.tips_btn .tips_d_text.citys').text("已选择"+children.length+"个市,建议购买“全省”更划算哦~");
+                      $('.tips_btn .tips_d_text.citys').show();
                   } 
                   html += `${result[i].name}(`
                   for(var j = 0;j < children.length;j++){
@@ -605,6 +610,21 @@
                   this.selectObj[result[i].name]=[];//
               }
           }
+          	for (var x = 0; x < provincesArr.length; x++) {
+	            for (var j =x+1; j <provincesArr.length; ) {
+	                if (provincesArr[x] === provincesArr[j]){
+	                    provincesArr.splice(j, 1);
+	                }
+	                else j++;
+	            }
+	        }
+          	if(provincesArr.length > 9){
+          		$('.tips_d_text.all').text("已选择"+provincesArr.length+"个省,建议购买“全国”更划算哦~");
+          		$('.tips_d_text.all').show();
+          		$('.tips_d_text.citys').hide();
+          	}else{
+          		$('.tips_d_text.all').hide();
+          	}
 //        console.log("this.selectObj:",this.selectObj)
           $('.result_name').append(html)
           AreaChoose.isOpen()
@@ -642,7 +662,7 @@
           let minHeight = $('.result_text').css('min-height')
           let rows = Math.round(Math.round(pHeight)/ parseFloat(minHeight));
           $(".select-area-box .area-list").css("margin-top",$('.result_text').height()+20);
-          console.log("高度:"+ pHeight,"最小高度"+ minHeight,"行数:" + rows)
+//        console.log("高度:"+ pHeight,"最小高度"+ minHeight,"行数:" + rows)
           if(rows == 1){
               if(length >= 50){
                   $('.detail').show()
@@ -652,7 +672,7 @@
                   $('.packup').hide()
               }
           }else if(rows == 2){
-              console.log($('.result_name').html().trim().length)
+//            console.log($('.result_name').html().trim().length)
               let length = $('.result_name').html().trim().length;
               if(length >= 50){
                   $('.detail').show()
@@ -819,6 +839,8 @@
 		    }
 		    return false;
 		}
+	    //
+
     </script>
 </body>
 

+ 2 - 1
src/web/templates/weixin/vipsubscribe/choose_industry_upgrade.html

@@ -291,7 +291,8 @@
                 
                 // 显示隐藏优惠tips
                 if (selectedArr.length >= 4 && !vipSubisTrial) {
-                    $('.tips_btn .tips_d_text').slideDown()
+                	$('.tips_btn .tips_d_text').text("已选择"+selectedArr.length+"个行业,建议购买“全部行业”更划算哦~");
+                    $('.tips_btn .tips_d_text').slideDown();
                 } else {
                     $('.tips_btn .tips_d_text').slideUp()
                 }

+ 67 - 44
src/web/templates/weixin/vipsubscribe/keyWord.html

@@ -232,15 +232,7 @@
 	<script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>
     <script>
 		initShare({{.T.signature}},{{.T.openid}},2,"jy_extend",{{.T.nickname}},{{.T.avatar}});
-        weui.loading();
-        setTimeout(function(){
-            weui.loading().hide();
-            if(window.location.search.indexOf("page=1")>-1){
-				history.replaceState("{id:1}","","/front/vipsubscribe/toSetKeyWordPage")
-            }else if(history.state){
-                window.history.go(-1)
-			}
-        },500)
+        
         var a_items = [];//全部数据
         var classify_name = "";//分类名称
         var classify_index = 0;//分类索引
@@ -251,15 +243,69 @@
         var addition_kws = []; //附加词
         var not_kws = []; //排除词
         var classify_arr = [];//分类对象
-        var kws_arr = [];//所有关键词对象
+        var kws_arr = {};//所有关键词对象
         var kws_tips = 0;
         // 页面状态
         var pageState = {
             //是否第一次设置关键词
             isFirstSetKeyword: true
         }
+		//
+		function initSess(){
+			weui.loading();
+	        setTimeout(function(){
+	            weui.loading().hide();
+	            if(window.location.search.indexOf("page=2")>-1){
+					history.replaceState("{id:1}","","/front/vipsubscribe/toSetKeyWordPage")
+	            }else if(history.state){
+	                window.history.go(-1)
+				}
+	        },500)
+		}
+		//
         $(function(){
-            init();
+			var isinitpage = false;
+			$(window).bind("pageshow", function(event){
+				if(event.originalEvent.persisted){
+					initpage();
+					isinitpage = true;
+					initSess();
+					reloadFunc();
+				}
+			});
+			if(!isinitpage) {
+				initpage();
+				initSess();
+				reloadFunc();
+			}
+			window.addEventListener('popstate', function(event){
+				if(!isinitpage){
+					if(a_items.length==0){
+		                window.history.go(-1)
+		            }
+		            var loading = weui.loading('loading...', {
+		                className: 'custom-classname'
+		            })
+		            $('.classify-show-pop').hide();
+		            $('.classify-edit-pop').hide();
+		            //重新加载数据
+		            initpage();
+		            // 用定时器模拟请求耗时
+		            setTimeout(function () {
+		                loading.hide(function() {
+		                    console.log('`loading` has been hidden');
+		                })
+		                // 判断是否是第一次(没有关键词进入)
+		                // 隐藏关键词列表section,显示分类列表section
+		                var isClassifyColumnShow = $('.add-keyword-container').is(':hidden')
+		                if (!isClassifyColumnShow) {
+		                    $('.add-keyword-container').hide()
+		                    $('.all-classify-column').show()
+		                }
+		            }, 500)
+				}
+				isinitpage = false
+			})
             // 关键词分类 - 去设置按钮点击事件
             $('.classify-show-pop .dialog__btn_confirm').on('click', function() {
                 $('.classify-show-pop').hide();
@@ -275,7 +321,6 @@
                     $('.classify-edit-pop').show();
                 },200)
             })
-
             // 关键词分类 - 取消按钮点击事件
             $('.classify-show-pop .dialog__btn_cancel').on('click', function() {
 				$('.enterOne').focus();
@@ -283,7 +328,7 @@
             })
         })
         //获取数据
-        function init(){
+        function initpage(){
             if(sessionStorage&&sessionStorage.kwspage){
                 if(sessionStorage.addition_kws!=undefined){
                     addition_kws = JSON.parse(sessionStorage.addition_kws);
@@ -293,6 +338,7 @@
                 }
                 showKorshowC(sessionStorage.kwspage);
                 a_items = JSON.parse(sessionStorage.a_items)
+                kws_arr = JSON.parse(sessionStorage.kws_arr)
                 classify_name = sessionStorage.classify_name;
                 classify_index = sessionStorage.classify_index;
                 kws_name = sessionStorage.kws_name;
@@ -352,6 +398,7 @@
             kws_count = 0;
             var classifyHtml = '';
             classify_arr = [];//每次初始化分类对象
+			kws_arr = {};//每次初始化关键词对象
             for (var i = 0;  i < kwsdata.length; i++) {
                 var s_item = kwsdata[i]["s_item"]
                 if(s_item==""){
@@ -366,7 +413,7 @@
                         keystr += "、"
                     }
                     keystr += a_key[j]["key"].join('、');
-					kws_arr = kws_arr.concat(a_key[j]["key"])
+					kws_arr[a_key[j]["key"].join(' ')]=j+"-"+i
                 } 
                 classifyHtml +='<li class="classify-item">'
                             +'<div><span class="classify-item-l">'+s_item+'</span>'
@@ -501,7 +548,7 @@
         }
         //跳转附加词
         function toappendkey(th){
-			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=1")
+			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=211")
             if(!$('.enter.addkeyWord').is(':hidden')){
                 if($('.addkeyWord input.enterOne').val()==""){
                     return
@@ -519,7 +566,7 @@
         }
         //
         function tonotkey(th){
-			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=1")
+			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=211")
             if(!$('.enter.addkeyWord').is(':hidden')){
                 if($('.addkeyWord input.enterOne').val()==""){
                     return
@@ -545,6 +592,7 @@
             sessionStorage.a_items = JSON.stringify(a_items);//当前数据
             sessionStorage.addition_kws =  JSON.stringify(addition_kws);//当前编辑关键词附加词
             sessionStorage.not_kws =  JSON.stringify(not_kws);//当前编辑关键词排除词
+            sessionStorage.kws_arr =  JSON.stringify(kws_arr);//当前所有关键词排
 
             sessionStorage.kws_count=kws_count;//关键词个数
         }
@@ -562,12 +610,13 @@
             sessionStorage.removeItem("addition_kws");
             sessionStorage.removeItem("not_kws");
             sessionStorage.removeItem("kws_count");
+            sessionStorage.removeItem("kws_arr");
         }
         //保存关键词
         function saveK(th,i){
             var $this = $(th);
             kws_name = $(th).siblings('textarea').val();
-			if($.inArray(kws_name, kws_arr)>-1){
+			if(kws_arr[kws_name]!=undefined&&kws_arr[kws_name]!=(kws_index+"-"+classify_index)){
                 weui.toast('您设置的关键词已存在,请调整后再添加。', {
                     duration: 2000,
                     className: 'custom-toast',
@@ -661,7 +710,7 @@
             not_kws = [];
         }
     </script>
-    <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/keyWord.js?v={{Msg "seo" "version"}}1"></script>
+    <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/keyWord.js?v={{Msg "seo" "version"}}124"></script>
     <script>
         // 设置一条空记录,用户第一次进入添加关键词点击确定时候调用
         function setEmptyHistory() {
@@ -672,7 +721,6 @@
         }
         //
         $(function(){
-
             $(".addNewKeyword div").on('click', function () {
                 history.pushState({id:1}, "","");
                 classify_index = $(".classify-list li").length;
@@ -741,31 +789,6 @@
                 toSetKws();
             })
         })
-        window.addEventListener('popstate', function(event){
-            if(a_items.length==0){
-                window.history.go(-1)
-            }
-            var loading = weui.loading('loading...', {
-                className: 'custom-classname'
-            })
-            $('.classify-show-pop').hide();
-            $('.classify-edit-pop').hide();
-            //重新加载数据
-            init();
-            // 用定时器模拟请求耗时
-            setTimeout(function () {
-                loading.hide(function() {
-                    console.log('`loading` has been hidden');
-                })
-                // 判断是否是第一次(没有关键词进入)
-                // 隐藏关键词列表section,显示分类列表section
-                var isClassifyColumnShow = $('.add-keyword-container').is(':hidden')
-                if (!isClassifyColumnShow) {
-                    $('.add-keyword-container').hide()
-                    $('.all-classify-column').show()
-                }
-            }, 500)
-        })
     </script>
 	{{include "/common/baiducc.html"}}
 </body>

+ 36 - 27
src/web/templates/weixin/vipsubscribe/renew_pay.html

@@ -13,7 +13,7 @@
     <link rel="stylesheet" type="text/css" href="/vipsubscribe/css/weui.min.css?v={{Msg "seo" "version"}}" />
     <link rel="stylesheet" type="text/css" href="/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}" />
     <link rel="stylesheet" type="text/css" href="/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}" />
-    <link rel="stylesheet" href="/vipsubscribe/css/vip_update.css?v={{Msg "seo" "version"}}3">
+    <link rel="stylesheet" href="/vipsubscribe/css/vip_update.css?v={{Msg "seo" "version"}}5">
 	{{include "/common/weixin.html"}}
 </head>
 <style type="text/css">
@@ -30,7 +30,7 @@
              <!-- 正常点击vip首页续费进入显示下列提示 -->
             <p class="update_tip renew_upgrade">提示:订阅续费可在已购买的服务基础上,延长订阅服务周期</p>
              <!-- 即将到期点击vip首页续费显示下列提示 -->
-            <p class="expire_tip renew_update">提示:您的VIP订阅服务即将到期,为不影响您的使用请立即续费</p>
+            <p class="expire_tip renew_update">提示:您的VIP订阅服务即将到期,为不影响您的使用请立即续费</p>
             <ul class="chooseList">
                 <li class="detail_item">
                         <div class="item_info item_area">
@@ -46,10 +46,8 @@
                             <span class="label_for">10个月</span>
                         </div>
                         <div class="item_info item_validity">
-                            <p>
-                                <span class="label">有效日期:</span>
-                                <span class="label_for">2020.01.31 - 2020.10.31</span>
-                            </p>
+                            <span class="label">有效日期:</span>
+                            <span class="label_for">2020.01.31 - 2020.10.31</span>
                             <p>
                                 <!-- 正常点击vip首页续费进入显示去升级,即将到期点击vip首页续费显示订阅修改 -->
                                 <a href="/weixin/pay/toUpgradePage" class="go_update renew_upgrade">去升级</a>
@@ -200,7 +198,7 @@
         </div>
     </div>
     <script src="/vipsubscribe/js/jquery-2.1.4.js"></script>
-    <script src="/vipsubscribe/js/common.js"></script>
+    <script src="/vipsubscribe/js/common.js?v={{Msg "seo" "version"}}3"></script>
     <!--<script src="/vipsubscribe/js/fastclick.js?v={{Msg "seo" "version"}}"></script>-->
     <script src="https://res.wx.qq.com/open/libs/weuijs/1.1.4/weui.min.js?v={{Msg "seo" "version"}}"></script>
     <script type="text/javascript">
@@ -245,19 +243,21 @@
 						setTimeout(function(){
 							window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
 						},500)
-					}else if(r.err_msg == "get_brand_wcpay_request:cancel"){               
-	                	alert("开发环境【支付跳转完成】")
-		                try{
-		  					window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
-		                }catch(e){
-		                  alert(e)
-		                }
-	  				}else{
-	                	weui.toast("系统异常,请稍微再试",{
-	                  		duration: 2000,
-	                  		className: 'custom-toast',
-	                	});
-	  				}
+					}	
+//					}else if(r.err_msg == "get_brand_wcpay_request:cancel"){               
+////	                	alert("开发环境【支付跳转完成】")
+//		                try{
+////		  					window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
+////		                    window.location.reload();
+//		                }catch(e){
+//		                  alert(e)
+//		                }
+//	  				}else{
+//	                	weui.toast("系统异常,请稍微再试",{
+//	                  		duration: 2000,
+//	                  		className: 'custom-toast',
+//	                	});
+//	  				}
   				});
   			}   
 		}catch(e){
@@ -353,6 +353,12 @@
                 currentNum = currentNum <= data.numboxMin ? data.numboxMin : currentNum - data
                     .numboxStep;
             }
+            if (currentNum >= 10) {
+            	$('.profit_tips').text("已选择"+currentNum+"个月,建议“按年订阅”更划算哦~");
+                $('.profit_tips').show();
+            } else {
+                $('.profit_tips').hide()
+            }
             $number.text(currentNum)
             if(currentNum >= 10){
             	currentNum = 10;
@@ -361,11 +367,12 @@
             $('.computed_price').html('¥' + price)
             var firstButton = $('#number_box_month button:first')
             var lastButton = $('#number_box_month button:last')
-            if (currentNum >= 10) {
-                $('.profit_tips').show()
-            } else {
-                $('.profit_tips').hide()
-            }
+//          if (currentNum >= 10) {
+//          	$('.profit_tips').text("已选择"+currentNum+"个月,建议“按年订阅”更划算哦~");
+//              $('.profit_tips').show();
+//          } else {
+//              $('.profit_tips').hide()
+//          }
             // 如果为操作后的结果为1,则锁定减号按钮
             if (currentNum === data.numboxMin) {
                 firstButton.attr('disabled', true)
@@ -399,7 +406,8 @@
             let isChecked = $(this).is(':checked')
             let val = $('.month_number').text();
             if (val >= 10) {
-                $('.profit_tips').show()
+            	$('.profit_tips').text("已选择"+val+"个月,建议“按年订阅”更划算哦~");
+                $('.profit_tips').show();
                 val = 10;
             }
 //          console.log(val)
@@ -532,7 +540,8 @@
 //			    	}
 //			    	$(".item_cycle .label_for").text(dateName);
 //			    }
-			    if(startTime !== "" && endTime !== ""){
+			    if(startTime !== "" && endTime !== "" && startTime !== undefined && endTime !== undefined){
+			    	console.log(startTime)
 			    	var start = startTime.replace(/-/g, ".");
 			    	var end = endTime.replace(/-/g, ".");
 			    	dateHtml = start + " - " + end;

+ 1 - 1
src/web/templates/weixin/vipsubscribe/vip_pay_success.html

@@ -46,7 +46,7 @@
     $(function(){
       //查看订单
       $(".left_btn").on("click",function(){
-        window.location.href ='/front/vipsubscribe/toOrderDetailPage?orderCode='+orderCode
+        window.location.href ='/weixin/pay/toOrderDetailPage?orderCode='+orderCode
       })
       //设置关键词
       $(".right_btn").on("click",function(){

+ 30 - 21
src/web/templates/weixin/vipsubscribe/vip_upgrade.html

@@ -341,19 +341,21 @@
 						setTimeout(function(){
 							window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
 						},500)
-					}else if(r.err_msg == "get_brand_wcpay_request:cancel"){               
-	                	alert("开发环境【支付跳转完成】")
-		                try{
-		  					window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
-		                }catch(e){
-		                  alert(e)
-		                }
-	  				}else{
-	                	weui.toast("系统异常,请稍微再试",{
-	                  		duration: 2000,
-	                  		className: 'custom-toast',
-	                	});
-	  				}
+					}
+//					}else if(r.err_msg == "get_brand_wcpay_request:cancel"){               
+////	                	alert("开发环境【支付跳转完成】")
+//		                try{
+////		  					window.location.replace("/front/vipsubscribe/toPaySuccessPage?orderCode="+ordercode);
+////		                	window.location.reload();
+//		                }catch(e){
+//		                  alert(e)
+//		                }
+//	  				}else{
+//	                	weui.toast("系统异常,请稍微再试",{
+//	                  		duration: 2000,
+//	                  		className: 'custom-toast',
+//	                	});
+//	  				}
   				});
   			}   
 		}catch(e){
@@ -411,7 +413,7 @@
 			var bs = nowYears+"/"+as+"/1";
 			var effects = new Date(bs).getTime() /1000;
 			var a = nowYears+"."+as+".01";
-			$(".notnownow").text(a + " - " + endTime)
+			$(".notnownow").text(a + " - " + endTime.replace(/-/g, "."))
 			if(ends < effects){
 				$(".effect_next").hide();
 //				$(".box").css("height", "2.7rem");
@@ -526,6 +528,12 @@
 		        return
             }
             $(".computed_price").show();
+            if (currentNum >= 10) {
+            	$('.profit_tips').text("已选择"+currentNum+"个月,建议“按年订阅”更划算哦~");
+                $('.profit_tips').show();
+            } else {
+                $('.profit_tips').hide()
+            }
             $number.text(currentNum)
             if(currentNum >= 10){
             	currentNum = 10;
@@ -534,11 +542,11 @@
             $('.computed_price').html('¥' + price)
             var firstButton = $('#number_box_month button:first')
             var lastButton = $('#number_box_month button:last')
-            if (currentNum >= 10) {
-                $('.profit_tips').show()
-            } else {
-                $('.profit_tips').hide()
-            }
+//          if (currentNum >= 10) {
+//              $('.profit_tips').show()
+//          } else {
+//              $('.profit_tips').hide()
+//          }
             // 如果为操作后的结果为1,则锁定减号按钮
             if (currentNum === data.numboxMin) {
                 firstButton.attr('disabled', true)
@@ -584,7 +592,8 @@
             let isChecked = $(this).is(':checked')
             let val = $('.month_number').text();
             if (val >= 10) {
-                $('.profit_tips').show()
+                $('.profit_tips').text("已选择"+val+"个月,建议“按年订阅”更划算哦~");
+                $('.profit_tips').show();
             }
             console.log(val)
             if (!isChecked) {
@@ -845,7 +854,7 @@
 			    //
 			    var nowDate = data.now.replace(/-/g, ".");
 			    var a = nowDate+ " - " +endTime;
-			    $(".nownow").text(nowDate+ " - " +endTime)
+			    $(".nownow").text(nowDate+ " - " +endTime.replace(/-/g, "."))
 			    
 			}
         },false);

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно