瀏覽代碼

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

zhangxinlei1996 5 年之前
父節點
當前提交
99a44d313e
共有 58 個文件被更改,包括 669 次插入466 次删除
  1. 1 1
      src/jfw/modules/pushsubscribe/src/match/config.json
  2. 4 1
      src/jfw/modules/pushsubscribe/src/match/job/matchjob.go
  3. 二進制
      src/jfw/modules/pushsubscribe/src/match/match
  4. 1 1
      src/jfw/modules/pushsubscribe/src/match/matcher/vipmatch.go
  5. 1 1
      src/jfw/modules/pushsubscribe/src/public/entity.go
  6. 1 1
      src/jfw/modules/pushsubscribe/src/public/util.go
  7. 1 2
      src/jfw/modules/pushsubscribe/src/push/config.json
  8. 2 0
      src/jfw/modules/pushsubscribe/src/push/config/config.go
  9. 2 8
      src/jfw/modules/pushsubscribe/src/push/job/jobs.go
  10. 4 4
      src/jfw/modules/pushsubscribe/src/push/job/movejob.go
  11. 57 82
      src/jfw/modules/pushsubscribe/src/push/job/pushjob.go
  12. 0 61
      src/jfw/modules/pushsubscribe/src/push/job/repairjob.go
  13. 16 7
      src/jfw/modules/pushsubscribe/src/push/main.go
  14. 49 30
      src/jfw/modules/pushsubscribe/src/push/pusher/normalpush.go
  15. 3 3
      src/jfw/modules/pushsubscribe/src/push/pusher/pusher.go
  16. 36 21
      src/jfw/modules/pushsubscribe/src/push/pusher/repairpush.go
  17. 67 23
      src/jfw/modules/pushsubscribe/src/push/pusher/specialpush.go
  18. 6 5
      src/jfw/modules/pushsubscribe/src/push/rpc/rpc.go
  19. 65 26
      src/jfw/modules/pushsubscribe/src/push/util/entity.go
  20. 1 2
      src/jfw/modules/pushsubscribe/src/push/util/rpccall.go
  21. 32 5
      src/jfw/modules/pushsubscribe/src/push/util/util.go
  22. 2 1
      src/jfw/modules/subscribepay/src/a/init.go
  23. 14 11
      src/jfw/modules/subscribepay/src/entity/subscribeVip.go
  24. 2 2
      src/jfw/modules/subscribepay/src/service/afterPay.go
  25. 3 3
      src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go
  26. 1 1
      src/jfw/modules/subscribepay/src/service/vipSubscribeTrial.go
  27. 8 5
      src/jfw/modules/subscribepay/src/timetask/timetask.go
  28. 1 0
      src/jfw/modules/subscribepay/src/util/vrew.go
  29. 1 0
      src/jfw/public/historypush.go
  30. 1 1
      src/main.go
  31. 二進制
      src/web/staticres/images/mail.png
  32. 二進制
      src/web/staticres/images/phone.png
  33. 7 0
      src/web/staticres/vipsubscribe/css/addition_exclusive_word.css
  34. 8 0
      src/web/staticres/vipsubscribe/css/keyWord.css
  35. 1 1
      src/web/staticres/vipsubscribe/css/subscribe_list.css
  36. 4 3
      src/web/staticres/vipsubscribe/css/vip_index.css
  37. 34 6
      src/web/staticres/vipsubscribe/js/additionWord.js
  38. 35 7
      src/web/staticres/vipsubscribe/js/exclusiveWord.js
  39. 22 16
      src/web/staticres/vipsubscribe/js/keyWord.js
  40. 16 13
      src/web/templates/weixin/historypush.html
  41. 1 0
      src/web/templates/weixin/resultpreview.html
  42. 6 1
      src/web/templates/weixin/vipsubscribe/additionWord.html
  43. 26 6
      src/web/templates/weixin/vipsubscribe/choose_area.html
  44. 1 1
      src/web/templates/weixin/vipsubscribe/choose_industry.html
  45. 2 1
      src/web/templates/weixin/vipsubscribe/choose_industry_upgrade.html
  46. 1 1
      src/web/templates/weixin/vipsubscribe/edit_subscribe.html
  47. 5 0
      src/web/templates/weixin/vipsubscribe/exclusiveWord.html
  48. 30 16
      src/web/templates/weixin/vipsubscribe/keyWord.html
  49. 7 7
      src/web/templates/weixin/vipsubscribe/messageType.html
  50. 1 0
      src/web/templates/weixin/vipsubscribe/renew_notice.html
  51. 17 15
      src/web/templates/weixin/vipsubscribe/renew_pay.html
  52. 1 0
      src/web/templates/weixin/vipsubscribe/trial_info.html
  53. 6 2
      src/web/templates/weixin/vipsubscribe/vip_index.html
  54. 20 27
      src/web/templates/weixin/vipsubscribe/vip_introduce.html
  55. 9 11
      src/web/templates/weixin/vipsubscribe/vip_purchase.html
  56. 1 1
      src/web/templates/weixin/vipsubscribe/vip_seniorset.html
  57. 17 16
      src/web/templates/weixin/vipsubscribe/vip_upgrade.html
  58. 9 7
      src/web/templates/weixin/wxkeyset/index.html

+ 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, "条")

二進制
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,

File diff suppressed because it is too large
+ 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
 }

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

@@ -18,8 +18,9 @@ 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.RootApp().AppConfig.StaticDir = "web/staticres"
 	//
 	xweb.AddRouter("/subscribepay", &service.AfterPay{})
 	xweb.AddRouter("/subscribepay", &service.TrialOrder{})       //试用&订单

+ 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-未生效

+ 2 - 2
src/jfw/modules/subscribepay/src/service/afterPay.go

@@ -202,7 +202,7 @@ func (a *AfterPay) GetUserInfo() error {
 				buyClass += v.(string) + "、"
 			}
 			if buyClass == "" {
-				(*data)["a_buyerclass"] = "全"
+				(*data)["a_buyerclass"] = "全行业"
 			} else {
 				(*data)["a_buyerclass"] = strings.TrimRight(buyClass, "、")
 			}
@@ -214,7 +214,7 @@ func (a *AfterPay) GetUserInfo() error {
 			//订阅周期
 			var cycle = ""
 			if i_vip_status == 1 {
-				cycle = "7天"
+				cycle = "试用7天"
 			} else {
 				var _start = strings.Split(qutil.FormatDateWithObj(&_starttime, qutil.Date_Short_Layout), "-")
 				var _end = strings.Split(qutil.FormatDateWithObj(&_endtime, qutil.Date_Short_Layout), "-")

+ 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)

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

@@ -116,7 +116,7 @@ func (t *TrialOrder) SendPhoneCaptcha() {
 		}
 		imgcode_sess := qutil.ObjToString(t.GetSession("subvip_trial_imgCode"))
 		if !captcha.VerifyString(imgcode_sess, imgcode_req) || imgcode_req == "" {
-			return false, "验证码不正确"
+			return false, "图形验证码不正确"
 		}
 		//获取上次发送验证码时间
 		lastSend := qutil.Int64All(t.GetSession("subvip_trial_lastSend"))

+ 8 - 5
src/jfw/modules/subscribepay/src/timetask/timetask.go

@@ -84,7 +84,7 @@ func checkIsExpire() {
 				"$in": []int{1, 2},
 			},
 			"l_vip_endtime": map[string]interface{}{
-				"$lt": now_unix + threeday,
+				"$lte": now_unix + threeday,
 			},
 		}).Select(map[string]interface{}{"i_vip_status": 1, "l_vip_endtime": 1, "i_vip_expire_tip": 1}).Iter()
 		for m := make(map[string]interface{}); it.Next(&m); {
@@ -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,
 					},
 				})
 			}

+ 1 - 0
src/jfw/modules/subscribepay/src/util/vrew.go

@@ -258,6 +258,7 @@ func MergeKws(userId string) {
 			if o_kws != nil && len(o_kws) > 0 {
 				a := MQFW.UpdateById("user", userId, bson.M{
 					"$push": bson.M{"o_vipjy.a_items": o_kws},
+					"$set":  bson.M{"o_vipjy.i_matchway": 1, "o_vipjy.i_ratemode": 1, "o_vipjy.i_wxpush": 1, "o_vipjy.i_projectmatch": 0, "o_vipjy.l_modifydate": time.Now().Unix()},
 				})
 				log.Println(a)
 			}

+ 1 - 0
src/jfw/public/historypush.go

@@ -428,6 +428,7 @@ func (h *historyPush) MakeHistoryDatas(userId, field string) (bool, []map[string
 	allquery = fmt.Sprintf(allquery, fmt.Sprint(time.Now().AddDate(0, 0, -7).Unix()))
 	allquery = ``
 	keys, list := PushView(userId, allquery, field, 1, 50)
+	log.Println(list)
 	if list == nil || len(*list) == 0 {
 		return true, nil
 	}

+ 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)

二進制
src/web/staticres/images/mail.png


二進制
src/web/staticres/images/phone.png


+ 7 - 0
src/web/staticres/vipsubscribe/css/addition_exclusive_word.css

@@ -339,3 +339,10 @@
 .weui-dialog input {
   caret-color: #2cb7ca;
 }
+.addKeyWord  i.icon-tianjia{
+	    position: fixed;
+    bottom: 0px;
+    left: 50%;
+    margin-left: -25px;
+    width: 50px;
+}

+ 8 - 0
src/web/staticres/vipsubscribe/css/keyWord.css

@@ -444,3 +444,11 @@
 .classify-edit-pop .weui-dialog .weui-dialog__ft:after {
   border: none;
 }
+
+.addKeyWord  i.icon-tianjia{
+	    position: fixed;
+    bottom: .5rem;
+    left: 50%;
+    margin-left: -25px;
+    width: 50px;
+}

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

@@ -182,7 +182,7 @@
 }
 
 .filter_tab .tab_left .time {
-  margin-right: .15rem;
+  margin-right: .25rem;
 }
 
 .filter_tab .tab_left .time_box,

+ 4 - 3
src/web/staticres/vipsubscribe/css/vip_index.css

@@ -486,6 +486,7 @@
   left: .15rem;
   color: #34355A;
   background-color: #FFDAB1;
+    padding: .02rem .03rem 0.01rem .03rem;
 }
 
 .vip_index .content .vip_info .s_left .already {
@@ -552,7 +553,7 @@
 .vip_index .content .subscribe_info .s_info_top .s_i_item {
   display: flex;
   position: relative;
-  line-height: 1.4;
+  line-height: 1.8;
   z-index: 2;
 }
 
@@ -588,8 +589,8 @@
 }
 
 .vip_index .content .subscribe_info .s_info_bottom {
-  height: .53rem;
-  line-height: .53rem;
+  height: .68rem;
+  line-height: .68rem;
   font-size: .24rem;
   text-align: center;
   border-top: 1px solid #CFAD89;

+ 34 - 6
src/web/staticres/vipsubscribe/js/additionWord.js

@@ -50,6 +50,14 @@ $(function(){
         var timestamp = new Date().getTime();//动态生成不同的id,因为id唯一不能重复,所以 用时间戳 代替  防止重复
         var keyWord = $('.addkeyWord input.enterOne').val();
         _addindex = -1;
+		if(addkws_arr[keyWord]!=undefined){
+            weui.toast('您设置的附加词已存在,请调整后再添加。', {
+                duration: 2000,
+                className: 'custom-toast',
+                callback: function () { console.log('close') }
+            });
+			return
+		}
         //保存新附加词
         _addkws = keyWord;
         saveSession();
@@ -126,6 +134,14 @@ $(function(){
             });
         }else{
             _addindex = $(".showKeyWord li").length - $(this).parent().parent('li').index() - 1;
+			if(addkws_arr[keyWord]!=undefined&&addkws_arr[keyWord]!=_addindex){
+	            weui.toast('您设置的排除词已存在,请调整后再添加。', {
+	                duration: 2000,
+	                className: 'custom-toast',
+	                callback: function () { console.log('close') }
+	            });
+				return
+			}
             _addkws = keyWord;
             saveSession();
             $(this).parent().siblings().find('.key').text(keyWord)
@@ -133,11 +149,23 @@ $(function(){
         }
     })
 
+    
     //防止键盘把当前输入框给挡住
-    $('input[type="text"],textarea').focus(function () {
-        var target = this;
-        setTimeout(function(){
-            target.scrollIntoViewIfNeeded();
-        },400);
-    });
+    var u = navigator.userAgent;
+	var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
+	var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
+	if(isAndroid){
+		//防止键盘把当前输入框给挡住
+	    window.addEventListener('resize', function () {
+	      	if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
+	          		window.setTimeout(function () {
+	         	document.activeElement.scrollIntoViewIfNeeded();
+	            }, 0);
+	        }
+	    })
+	}
+	(/iphone|ipod|ipad/i.test(navigator.appVersion)) && document.addEventListener('blur', (e) => {
+	    // 这里加了个类型判断,因为a等元素也会触发blur事件
+	    ['input', 'textarea'].includes(e.target.localName) && document.body.scrollIntoView(false)
+	}, true)
 })

+ 35 - 7
src/web/staticres/vipsubscribe/js/exclusiveWord.js

@@ -64,6 +64,14 @@ $(function(){
         _notindex = -1;
         //保存新附加词
         _notkws = keyWord;
+		if(notkws_arr[keyWord]!=undefined){
+            weui.toast('您设置的附加词已存在,请调整后再添加。', {
+                duration: 2000,
+                className: 'custom-toast',
+                callback: function () { console.log('close') }
+            });
+			return
+		}
         saveSession();
         var html = `<li>
                         <div class="one">
@@ -138,6 +146,14 @@ $(function(){
                 callback: function () { console.log('close') }
             });
         }else{
+			if(notkws_arr[keyWord]!=undefined&&notkws_arr[keyWord]!=_notindex){
+	            weui.toast('您设置的排除词已存在,请调整后再添加。', {
+	                duration: 2000,
+	                className: 'custom-toast',
+	                callback: function () { console.log('close') }
+	            });
+				return
+			}
             $this.parent().siblings().find('.key').text(keyWord);
             $this.parent().hide().siblings().show();
             $('.addKeyWord').show();
@@ -147,11 +163,23 @@ $(function(){
         }
     })
 
-    // 防止键盘把当前输入框给挡住
-    $('input[type="text"],textarea').focus(function () {
-        var target = this;
-        setTimeout(function(){
-            target.scrollIntoViewIfNeeded();
-        },400);
-    });
+    
+    //防止键盘把当前输入框给挡住
+    var u = navigator.userAgent;
+	var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
+	var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
+	if(isAndroid){
+		//防止键盘把当前输入框给挡住
+	    window.addEventListener('resize', function () {
+	      	if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
+	          		window.setTimeout(function () {
+	         	document.activeElement.scrollIntoViewIfNeeded();
+	            }, 0);
+	        }
+	    })
+	}
+	(/iphone|ipod|ipad/i.test(navigator.appVersion)) && document.addEventListener('blur', (e) => {
+	    // 这里加了个类型判断,因为a等元素也会触发blur事件
+	    ['input', 'textarea'].includes(e.target.localName) && document.body.scrollIntoView(false)
+	}, true)
 })

+ 22 - 16
src/web/staticres/vipsubscribe/js/keyWord.js

@@ -66,6 +66,8 @@ var reloadFunc = function(){
                 callback: function () { console.log('close') }
             });
         }else if (saveData("SK")){
+            //
+            doSessionData();
             $(".add-keyword-container .addNewKeyword").show();
             //点击保存关键词,查看缓存中存的附加词 和排除词。
             $(".kws_count").text(kws_count);
@@ -87,11 +89,10 @@ var reloadFunc = function(){
                                 +'</span>'
                 }
                 html +=`</div>
-                        <button class="editKeyWord"><i class="iconfont icon-xiugai"></i> 修改</button>
+                        <button class="editKeyWord"  dataIndex=`+kws_index+`><i class="iconfont icon-xiugai"></i> 修改</button>
                         </div>
                         <div class="modify">
-                        <textarea  name=""  rows="1"  placeholder="" maxlength="20">${keyWord}</textarea>
-                                `
+                        <textarea  name=""  rows="1"  placeholder="" maxlength="20">${keyWord}</textarea>`
             if (addition_kws.length>0){
                 html +=`<button class="addAdjunctWord" onClick="toappendkey(this)">编辑 附加词<i>(`+addition_kws.length+`)</i></button>`
             }else{
@@ -102,10 +103,7 @@ var reloadFunc = function(){
             }else{
                 html +=`<button class="addAdjunctWord" onClick="tonotkey(this)">添加 排除词</button>`
             }
-                html +=`<button class="deleteKey">删除</button>
-                                <button class="ascertainKey" onclick="saveK(this,1)">确定</button>
-                            </div>
-                        </li>`
+                html +=`<button class="deleteKey">删除</button><button class="ascertainKey" dataIndex=`+kws_index+` onclick="saveK(this)">确定</button></div></li>`
             $('.showKeyWord > ul').prepend(html);
             // 添加完成隐藏输入框
             $(".enter.addkeyWord").hide();
@@ -138,8 +136,6 @@ var reloadFunc = function(){
                     })
                 }
             }
-            //
-            doSessionData();
         }
     })
     // 编辑
@@ -216,13 +212,23 @@ var reloadFunc = function(){
     // })
     
     //防止键盘把当前输入框给挡住
-    $('input[type="text"],textarea').focus(function () {
-        var target = this;
-        setTimeout(function(){
-            target.scrollIntoViewIfNeeded();
-        },400);
-    });
-
+    var u = navigator.userAgent;
+	var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1; //android终端
+	var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
+	if(isAndroid){
+		//防止键盘把当前输入框给挡住
+	    window.addEventListener('resize', function () {
+	      	if (document.activeElement.tagName == 'INPUT' || document.activeElement.tagName == 'TEXTAREA') {
+	          		window.setTimeout(function () {
+	         	document.activeElement.scrollIntoViewIfNeeded();
+	            }, 0);
+	        }
+	    })
+	}
+	(/iphone|ipod|ipad/i.test(navigator.appVersion)) && document.addEventListener('blur', (e) => {
+	    // 这里加了个类型判断,因为a等元素也会触发blur事件
+	    ['input', 'textarea'].includes(e.target.localName) && document.body.scrollIntoView(false)
+	}, true)
 
     // 显示关键词分类弹框
     $('.classify-r').on('click', function(){

+ 16 - 13
src/web/templates/weixin/historypush.html

@@ -80,6 +80,7 @@
 					isInTSguide=data.isInTSguide;
 					hasNextPage=data.hasNextPage;
 					firstPage = data.data;
+					isVipSub = data.isVipSub;
 					if(!firstPage.length>0 && !data.haskey){
 						if(sessionStorage&&(sessionStorage.keysetindexToHistory=="1"||sessionStorage.keysetindexToHistory=="2"||sessionStorage.keysetindexToHistory=="3")){
 							sessionStorage.removeItem("keysetindexToHistory");
@@ -93,16 +94,18 @@
 								},2000);
 							}
 						}else{
-							history.pushState({},"","");
-							if(data.isInTSguide){
-								if(localStorage){
-									localStorage.removeItem("tsGuide_status");
+							if(!isVipSub){
+								history.pushState({},"","");
+								if(data.isInTSguide){
+									if(localStorage){
+										localStorage.removeItem("tsGuide_status");
+									}
+									window.location.href='/front/tenderSubscribe/guide';
+								}else{
+									window.location.href='/wxkeyset/keyset/index';
 								}
-								window.location.href='/front/tenderSubscribe/guide';
-							}else{
-								window.location.href='/wxkeyset/keyset/index';
+								return
 							}
-							return
 						}
 					}
 					setTimeout(function(){
@@ -113,7 +116,6 @@
 						}
 						$(".tab_left .time").show();
 					},500)
-					isVipSub = data.isVipSub;
 					if(isVipSub){
 						if(!data.haskey){
 							$(".set_keyword").show();
@@ -125,7 +127,7 @@
 							$('.free7days_pic').append("<style>.free7days_pic:after{display:none}</style>");
 						}
 						if(parseInt(data.isExpire)!=0){
-							$(".isExpire").text(parseInt(isExpire));
+							$(".isExpire").text(parseInt(data.isExpire));
 							$(".renew_toast").show();
 						}
 						$(".vip_set").show();
@@ -424,7 +426,7 @@
 				} 
 				return   year+"-"+month+"-"+date; 
 			}else if(sl=="2"){
-				return   year+"/"+month+"/"+date; 
+				return   year+"."+month+"."+date; 
 			}else{
 				return   year+"<br>"+month+""+date; 
 			}
@@ -986,7 +988,7 @@
             	weui.datePicker({
             		id: '1',
             		start: 2000,
-            		end: new Date().getFullYear(),
+            		end: new Date(),
             		defaultValue:date.split('-'),
             		className: 'jymobile-datePicker',
             		onChange: function (result) {},
@@ -994,7 +996,7 @@
             			let year = result[0].value;
             			let month = result[1].value < 10 ? '0' + result[1].value : result[1].value;
             			let day = result[2].value < 10 ? '0' + result[2].value:result[2].value;
-            			let time_result = year + '/' + month + '/' + day;
+            			let time_result = year + '.' + month + '.' + day;
             			FTAGData(year + '-' + month + '-' + day)
             			$('.time_result').html(time_result)
             		}
@@ -1033,6 +1035,7 @@
             });
             // 选择地区
             $('#showArea').on('click', function (){
+				$(this).find("span").toggleClass("current");
             	$('.area_container').slideToggle();
             	$('.screen').toggle();
             	$(".subscribe").toggleClass('overClass');

+ 1 - 0
src/web/templates/weixin/resultpreview.html

@@ -6,6 +6,7 @@
 <link href="{{Msg "seo" "cdn"}}/css/dropload.css?v={{Msg "seo" "version"}}" rel="stylesheet">
 <link href="{{Msg "seo" "cdn"}}/css/wxlist.css?v={{Msg "seo" "version"}}" rel="stylesheet">
 {{include "/common/weixin.html"}}
+<script type="text/javascript" src="{{Msg "seo" "cdn"}}/js/rem.js"></script>
 <script src="{{Msg "seo" "cdn"}}/js/jquery.js"></script>
 <script src="{{Msg "seo" "cdn"}}/wxswordfish/share.js?v={{Msg "seo" "version"}}"></script>
 <script src="{{Msg "seo" "cdn"}}/js/dropload.js?v={{Msg "seo" "version"}}"></script>

+ 6 - 1
src/web/templates/weixin/vipsubscribe/additionWord.html

@@ -75,6 +75,7 @@
         var addition_kws = []//附加词
         var _addkws = "";
         var _addindex = -1;
+		var addkws_arr = {}
         $(function() {
             if(sessionStorage&&sessionStorage.addition_kws!=undefined){
                 addition_kws = JSON.parse(sessionStorage.addition_kws);
@@ -89,6 +90,7 @@
             if (data.length>0){
                 var additionHtml = '';
                 for (var i = data.length - 1; i >= 0; i--) {
+					addkws_arr[data[i]]=i
                     additionHtml +='<li>'
                                     +'<div class="one">'
                                     +'<div>'
@@ -117,12 +119,15 @@
         function saveSession(t){
             if (_addkws!=""){
                 if(t!="D"){
-                    if(_addindex>0){
+                    if(_addindex>=0){
+						addkws_arr[_addkws] = _addindex;
                         addition_kws[_addindex] = _addkws
                     }else{
+						addkws_arr[_addkws] = addition_kws.length;
                         addition_kws.push(_addkws)
                     }
                 }else{
+					delete addkws_arr[_addkws];
                     addition_kws.splice(_addindex,1)
                 }
                 sessionStorage.addition_kws = JSON.stringify(addition_kws)

+ 26 - 6
src/web/templates/weixin/vipsubscribe/choose_area.html

@@ -466,7 +466,7 @@
         getResult:function(){   /* 选中结果 */
           //如果选中所有,则转为全国
           if($(".city").length==$(".city.active").length){
-            $(".checkbox.other").trigger("click");
+            $(".checkbox.other").trigger("click");           
             return
           }
           this.selectObj = {};
@@ -477,14 +477,14 @@
           if ($('.other').is(':checked')) {
             // data.push(val)
             data =[{name:val,children:[]}] //全国
+            $(".tips_d_text").slideUp();
           }
           $(".tab_content").find(".city.active:not('[disabled]')").each(function () {
               var length = $(this).parent('.tab_content').find('.city').length; //省份下城市的length
               var activeLeng = $(this).parent('.tab_content').find('.city.active').length; //省份下选中城市的length
               let arr =[];
               // 判断省份下的城市是否等于选中的城市长度,相等就是全部选中
-              if (length == activeLeng) {
-                  $('.tips_btn .tips_d_text').hide()
+              if (length == activeLeng) {                  
                   // 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({
@@ -524,14 +524,16 @@
               }
           })
           var html = '';
+          var selectProvince = 0;
+          var selectCityMax = 0;
           for (var i = 0; i < result.length; i++) {
               let children = result[i].children;
               if( children.length >0){
                   // 判断每个省份下选中的城市长度,当大于等于4的时候 弹出"选择全省更划算的弹窗"
                   let childrenArr=[];
-                  if (children.length >= 4 && !this.vipSubisTrial) {
-                      $('.tips_btn .tips_d_text').show()
-                  } 
+                  if(children.length>selectCityMax){
+                    selectCityMax = children.length;
+                  }
                   html += `${result[i].name}(`
                   for(var j = 0;j < children.length;j++){
                       childrenArr.push(children[j].name)
@@ -548,6 +550,8 @@
                   }
                   this.selectObj[result[i].name]=childrenArr;//
               }else{
+                  selectProvince++
+                 
                   if(i !=result.length -1){
                       html += `${result[i].name}、`
                   }else{
@@ -556,6 +560,22 @@
                   this.selectObj[result[i].name]=[];//
               }
           }
+          
+          //提示
+          if(!this.vipSubisTrial){
+            if(selectProvince>9){
+              $('.tips_btn .tips_d_text').text("已选择"+selectProvince+"个省,建议购买“全国”更划算哦~").slideDown()
+            }else{
+              if (selectCityMax > 3) {
+                $('.tips_btn .tips_d_text').text("已选择"+selectCityMax+"个市,建议购买“全省”更划算哦~").slideDown();
+              }else{
+                $(".tips_d_text").slideUp();
+              } 
+            }
+          }
+          
+          
+          
           console.log("this.selectObj:",this.selectObj)
           $('.result_name').append(html)
           AreaChoose.isOpen()

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

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

+ 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()
                 }

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

@@ -114,7 +114,7 @@
           },
           initClick:function(){
             $(".edit_item").on("click",function(){
-               window.location.replace($(this).attr("data_href"));
+               window.location.href=$(this).attr("data_href");
             });
             //提交
           },

+ 5 - 0
src/web/templates/weixin/vipsubscribe/exclusiveWord.html

@@ -74,6 +74,7 @@
         var not_kws = []//附加词
         var _notkws = "";
         var _notindex = -1;
+		var notkws_arr = {}
         $(function() {
             if(sessionStorage&&sessionStorage.not_kws!=undefined){
                 not_kws = JSON.parse(sessionStorage.not_kws);
@@ -88,6 +89,7 @@
             if (data.length>0){
                 var additionHtml = '';
                 for (var i = data.length - 1; i >= 0; i--) {
+					notkws_arr[data[i]]=i
                     additionHtml +='<li>'
                                     +'<div class="one">'
                                     +'<div>'
@@ -117,11 +119,14 @@
             if (_notkws!=""){
                 if(t!="D"){
                     if(_notindex>0){
+						notkws_arr[_notkws] = _notindex;
                         not_kws[_notindex] = _notkws
                     }else{
+						notkws_arr[_notkws] = not_kws.length;
                         not_kws.push(_notkws)
                     }
                 }else{
+					delete notkws_arr[_notkws];
                     not_kws.splice(_notindex,1)
                 }
                 sessionStorage.not_kws = JSON.stringify(not_kws)

+ 30 - 16
src/web/templates/weixin/vipsubscribe/keyWord.html

@@ -101,10 +101,6 @@
       .classify-show-pop .weui-dialog .weui-dialog__ft:after {
             border: none;
       }
-      .keyWord .addKeyWord{
-            position: fixed;
-            bottom: 0;
-      }
       .all-classify-column{
             position: relative;
             padding-bottom: 1rem;
@@ -215,7 +211,7 @@
                     <strong class="weui-dialog__title">提示信息</strong>
                 </div>
                 <div class="weui-dialog__bd">
-                    关键词分类有利于关键词做整合管理<br>工作更高效!
+                    关键词分类有利于关键词做整合管理<br>工作更高效!
                 </div>
                 <div class="weui-dialog__ft">
                     <a href="javascript:;" class="dialog__btn dialog__btn_confirm">去设置</a> 
@@ -478,7 +474,19 @@
                 if(kws_tips==undefined){
                     kws_tips = 0;
                 }
-                $(".classify").attr("tips",Number(kws_tips));
+				if (kws_tips==0&&classify_name.indexOf("未分类")>-1){
+	                //第一次进来分类提示
+	                showMeg();
+					var param = {};
+                    param.classify_index = classify_index;
+                    param.kws_tips = 1;
+                    $.post("/subscribepay/afterPay/updateUserTips",param,function(r){
+                        if(r.flag){
+                            kws_tips = param.kws_tips;
+                            $(".classify").attr("tips",kws_tips);
+                        }
+                    })
+				}
                 for (var i = _keyArr.length - 1; i >= 0; i--) {
                     var ak_showClass = 'hide';//是否显示附加词个数
                     var nk_showClass = 'hide';//是否显示排除词个数
@@ -530,11 +538,13 @@
                     }else{
                         kwsHtml +='<div class="modify" style="display: none;">'
                     }
+					var p = kws_arr[_keyArr[i]["key"].join(" ")].split("-")[0]
+					console.log("p:"+p)
                     kwsHtml +='<textarea name="" rows="1" placeholder="" maxlength="20">'+_keyArr[i]["key"].join(" ")+'</textarea>'
                                 +'<button class="addAdjunctWord" onclick="toappendkey(this)">'+ak_remark+' 附加词 <i class="appendkey '+ak_showClass+'">('+appendkeylth+')</i></button>'
                                 +'<button class="addExclusion" onclick="tonotkey(this)">'+nk_remark+' 排除词 <i class="notkey '+nk_showClass+'">('+notkeylth+')</i></button>'
                                 +'<button class="deleteKey">删除</button>'
-                                +'<button class="ascertainKey" onclick="saveK(this,'+i+')">确定</button>'
+                                +'<button class="ascertainKey" dataIndex="'+p+'" onclick="saveK(this)">确定</button>'
                                 +'</div>'
                                 +'</li>'
                 }
@@ -548,7 +558,7 @@
         }
         //跳转附加词
         function toappendkey(th){
-			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=211")
+			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=231")
             if(!$('.enter.addkeyWord').is(':hidden')){
                 if($('.addkeyWord input.enterOne').val()==""){
                     return
@@ -566,7 +576,7 @@
         }
         //
         function tonotkey(th){
-			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=211")
+			history.replaceState("","","/front/vipsubscribe/toSetKeyWordPage?page=231")
             if(!$('.enter.addkeyWord').is(':hidden')){
                 if($('.addkeyWord input.enterOne').val()==""){
                     return
@@ -613,10 +623,12 @@
             sessionStorage.removeItem("kws_arr");
         }
         //保存关键词
-        function saveK(th,i){
+        function saveK(th){
             var $this = $(th);
+			var yuan_index = $this.attr("dataIndex")
             kws_name = $(th).siblings('textarea').val();
-			if(kws_arr[kws_name]!=undefined&&kws_arr[kws_name]!=(kws_index+"-"+classify_index)){
+			console.log(kws_arr[kws_name])
+			if(kws_arr[kws_name]!=undefined&&kws_arr[kws_name]!=(yuan_index+"-"+classify_index)){
                 weui.toast('您设置的关键词已存在,请调整后再添加。', {
                     duration: 2000,
                     className: 'custom-toast',
@@ -632,6 +644,7 @@
                 });
             }else{
                 if(saveData('SK')){
+					$this.attr("dataindex",kws_index);
                     $this.parent().siblings().find('.key').text(kws_name)
                     $this.parent().hide().siblings().show()
                     $('.addKeyWord').show();
@@ -680,7 +693,9 @@
         function doSessionData(t){
             //删除关键词
             if(t!="DK"){
-                if(kws_index == ($(".showKeyWord li").length-1)){
+				kws_arr[kws_name] = kws_index+"-"+classify_index
+				console.log(kws_index,"----",$(".showKeyWord li").length)
+                if(kws_index == $(".showKeyWord li").length){
                     //新加
                     var karr = {"key":kws_name.split(" "),"appendkey":addition_kws,"notkey":not_kws}
                     var keyM = [];
@@ -697,6 +712,7 @@
                     a_items[classify_index]["a_key"][kws_index]["notkey"]= not_kws
                 }
             }else{
+				delete kws_arr[kws_name];
                 if (a_items[classify_index]["a_key"].length==1){
                     a_items.splice(classify_index,1);
                 }else{
@@ -710,7 +726,7 @@
             not_kws = [];
         }
     </script>
-    <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/keyWord.js?v={{Msg "seo" "version"}}124"></script>
+    <script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/keyWord.js?v={{Msg "seo" "version"}}"></script>
     <script>
         // 设置一条空记录,用户第一次进入添加关键词点击确定时候调用
         function setEmptyHistory() {
@@ -751,8 +767,6 @@
                 $(".enter.addkeyWord").find("input").val("");
                 $(".enter.addkeyWord").show();
                 $(".add-keyword-container .addNewKeyword").hide();
-                //第一次进来分类提示
-                showMeg();
             })
             // 通过判断是那个隐藏来判断是添加关键词还是添加新分类
             $(".addNewKeyword i").on('click', function () {
@@ -773,7 +787,7 @@
                 
                 // 显示添加关键词的输入框
                 $(".enter.addkeyWord").find(".btnChoose button").eq(0).html('添加 附加词');
-                $(".enter.addkeyWord").find(".btnChoose button").eq(1).html('添加 附加词');
+                $(".enter.addkeyWord").find(".btnChoose button").eq(1).html('添加 排除词');
                 $(".enter.addkeyWord").find("input").val("");
                 $(".enter.addkeyWord").show();
                 $('.enterOne').focus();

+ 7 - 7
src/web/templates/weixin/vipsubscribe/messageType.html

@@ -52,7 +52,7 @@
                 </li>
                 <li>
                     <dl>
-                        <dt  dataValue="招标">招标公告</dt>
+                        <dt>招标公告</dt>
                         <dd>招标</dd>
                         <dd>邀标</dd>
                         <dd>询价</dd>
@@ -60,24 +60,24 @@
                         <dd>单一</dd>
                         <dd>竞价</dd>
                         <dd>变更</dd>
+                        <dd>其它</dd>
                     </dl>
                 </li>
                 <li>
                     <dl>
-                        <dt dataValue="结果">招标结果</dt>
+                        <dt>招标结果</dt>
                         <dd>中标</dd>
                         <dd>成交</dd>
                         <dd>废标</dd>
                         <dd>流标</dd>
                     </dl>
                 </li>
-                <li>
+                <li style="border-bottom: 0px;">
                     <dl>
-                        <dt style="width:2rem;" dataValue="其它">招标信用信息</dt>
+                        <dt style="width:2rem;">招标信用信息</dt>
                         <dd>合同</dd>
                         <dd>验收</dd>
                         <dd>违规</dd>
-                        <dd>其它</dd>
                     </dl>
                 </li>
             </ul>
@@ -249,14 +249,14 @@
             $('.list ul li dd').each(function(index,dom){
                 // 如果有所有dd被选中,就设置标记为true
                 // 也就是说,有一个dd没被选中,就设置标记为false
-                if (!$(dom).hasClass('active')) {
+                if ($(dom).hasClass('active')) {
                     _f = false
                 } 
             })
             $('.list ul li dt').each(function(index,dom){
                 // 如果有所有dd被选中,就设置标记为true
                 // 也就是说,有一个dd没被选中,就设置标记为false
-                if (!$(dom).hasClass('active')) {
+                if ($(dom).hasClass('active')) {
                     _f = false
                 } 
             })

+ 1 - 0
src/web/templates/weixin/vipsubscribe/renew_notice.html

@@ -119,6 +119,7 @@
 			    if(exprie === "will"){
 			    	$(".free_service").hide();
 			    	$("#exprie").text("VIP订阅服务即将到期,请及时续费")
+			    	$(".recommend_title").text("以下区域、行业的订阅推送即将停止,为了不影响您的使用,请立即续费!")
 			    }else{
 			    	$(".free_service").show();
 			    }

+ 17 - 15
src/web/templates/weixin/vipsubscribe/renew_pay.html

@@ -243,20 +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);
-//		                    window.location.reload();
-		                }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){
@@ -539,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 - 0
src/web/templates/weixin/vipsubscribe/trial_info.html

@@ -136,6 +136,7 @@
                         className: 'custom-toast',
                       });
                     }
+                    $(".checkCode").attr("src","/subscribepay/trial/captcha?rnd="+Math.random()); //刷新验证码  
                   })
                 }
             })

+ 6 - 2
src/web/templates/weixin/vipsubscribe/vip_index.html

@@ -15,7 +15,7 @@
     <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/vipsubscribe/css/base.css?v={{Msg "seo" "version"}}" />
     <link rel="stylesheet" type="text/css" href="{{Msg "seo" "cdn"}}/vipsubscribe/iconfont/iconfont.css?v={{Msg "seo" "version"}}" />
     <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/vipsubscribe/css/public.css?v={{Msg "seo" "version"}}">
-    <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/vipsubscribe/css/vip_index.css?v={{Msg "seo" "version"}}">
+    <link rel="stylesheet" href="{{Msg "seo" "cdn"}}/vipsubscribe/css/vip_index.css?v={{Msg "seo" "version"}}1">
 </head>
 
 <body style="visibility:hidden;">
@@ -29,7 +29,7 @@
             <div class="vip_info">
                 <div class="service">
                     <div class="s_left">
-                        <span class="free7days_pic">已开通VIP订阅服务</span>
+                        <span class="free7days_pic"></span>
                         <!-- <div class="already">
                             <img src="/vipsubscribe/image/v.png?v={{Msg "seo" "version"}}" alt="">
                             <h4>已开通VIP订阅服务</h4>
@@ -220,8 +220,12 @@
                    		var _vipstatus = _userData["i_vip_status"];
                    		// console.log(_userData)
 	                   if(_vipstatus&&_vipstatus=="1"){
+							$(".tabbar").html('<a style="width: 100%;color: #fff;background: #2CB7CA;" href="/weixin/pay/vipsubscribe_new" class="update_btn">去购买</a>')
+							$('.free7days_pic').text("VIP订阅服务");
 	                        $('.free7days_pic').append("<style>.free7days_pic::after{display:inline-block}</style>");
 	                   }else{
+							$(".tabbar").html('<a href="/weixin/pay/toUpgradePage" class="update_btn">升级</a><a href="/weixin/pay/renewPayPage" class="renew_btn">续费</a>')
+							$('.free7days_pic').text("已开通VIP订阅服务");
 	                        $('.free7days_pic').append("<style>.free7days_pic::after{display:none}</style>");
 	                   }
 	                   if(_vipData){

+ 20 - 27
src/web/templates/weixin/vipsubscribe/vip_introduce.html

@@ -66,20 +66,11 @@
                             <tbody>
                                 <tr>
                                     <td>
-                                        <p class="miantitle">最多<em style="color: #2CB7CA">10</em>组关键词</p>
-                                    </td>
-                                    <td>
-                                        <p class="miantitle">最多<em style="color: #2CB7CA">300</em>组关键词</p>
-                                        <p class="subtitle">更多关键词,招标信息更全面</p>
-                                    </td>  
-                                </tr>
-                                <tr>
-                                    <td>
-                                        <p class="miantitle">每天最多接收<em style="color: #2CB7CA">150</em>条</p>
+                                        <p class="miantitle">匹配单次公告信息</p>
                                     </td>
                                     <td>
-                                        <p class="miantitle">每天最多接收<em style="color: #2CB7CA">2000</em>条</p>
-                                        <p class="subtitle">更多招标信息,重要项目不遗漏</p>
+                                        <p class="miantitle">匹配项目信息</p>
+                                        <p class="subtitle">根据你的订阅,为你推送所匹配项目后续的全部动态</p>
                                     </td>  
                                 </tr>
                                 <tr>
@@ -87,46 +78,48 @@
                                         <p class="miantitle">-</p>
                                     </td>
                                     <td>
-                                        <p class="miantitle">数据周报、月报</p>
-                                        <p class="subtitle">每周、每月推送你的订阅数据统计报告,帮助你全面掌握行业市场动态</p>
+                                        <p class="miantitle">按行业订阅</p>
+                                        <p class="subtitle">不知道如何设置关键词的时候,也可以按行业订阅</p>
                                     </td>  
                                 </tr>
                                 <tr>
                                     <td>
-                                        <p class="miantitle">订阅区域精确到省</p>
+                                        <p class="miantitle">最多<em style="color: #2CB7CA">10</em>组关键词</p>
                                     </td>
                                     <td>
-                                        <p class="miantitle">订阅区域精确到市</p>
-                                        <p class="subtitle">只看你最关注的招标信息</p>
+                                        <p class="miantitle">最多<em style="color: #2CB7CA">300</em>组关键词</p>
+                                        <p class="subtitle">更多关键词,招标信息更全面</p>
                                     </td>  
                                 </tr>
-                                <tr>
+                                 <tr>
                                     <td>
-                                        <p class="miantitle">-</p>
+                                        <p class="miantitle">仅支持标题匹配</p>
                                     </td>
                                     <td>
-                                        <p class="miantitle">按行业订阅</p>
-                                        <p class="subtitle">不知道如何设置关键词的时候,也可以按行业订阅</p>
+                                        <p class="miantitle">支持标题匹配+全文匹配</p>
+                                        <p class="subtitle">关键词匹配标题或全文 任你选</p>
                                     </td>  
                                 </tr>
                                 <tr>
                                     <td>
-                                        <p class="miantitle">仅支持标题匹配</p>
+                                        <p class="miantitle">订阅区域精确到省</p>
                                     </td>
                                     <td>
-                                        <p class="miantitle">支持标题匹配+全文匹配</p>
-                                        <p class="subtitle">关键词匹配标题或全文 任你选</p>
+                                        <p class="miantitle">订阅区域精确到市</p>
+                                        <p class="subtitle">只看你最关注的招标信息</p>
                                     </td>  
                                 </tr>
+                                <!--
                                 <tr>
                                     <td>
-                                        <p class="miantitle">匹配单次公告信息</p>
+                                        <p class="miantitle">-</p>
                                     </td>
                                     <td>
-                                        <p class="miantitle">匹配项目信息</p>
-                                        <p class="subtitle">根据你的订阅,为你推送所匹配项目后续的全部动态</p>
+                                        <p class="miantitle">数据周报、月报</p>
+                                        <p class="subtitle">每周、每月推送你的订阅数据统计报告,帮助你全面掌握行业市场动态</p>
                                     </td>  
                                 </tr>
+                                -->
                             </tbody>
                         </table>
                     </div>

+ 9 - 11
src/web/templates/weixin/vipsubscribe/vip_purchase.html

@@ -304,14 +304,9 @@
   							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{
+  						}else if(r.err_msg == "get_brand_wcpay_request:cancel"){
+                console.log("支付已取消")
+						  }else{
                 weui.toast("系统异常,请稍微再试",{
                   duration: 2000,
                   className: 'custom-toast',
@@ -422,7 +417,10 @@
             tmp +="个月"
             $("#monthly").prop('checked', true);
             $(".number_box:eq(0)").addClass("active");
-            $("#number_box_month .month_number").text(this.timeSelect[0])
+            $("#number_box_month .month_number").text(this.timeSelect[0]);
+            if (this.timeSelect[0] >= 10) {
+                $('.profit_tips').text("已选择"+this.timeSelect[0]+"个月,建议“按年订阅”更换算哦~").show();
+            }
           }
           $(".info.choose_time").val(tmp);
         },
@@ -537,7 +535,7 @@
               var firstButton = $('#number_box_month button:first')
               var lastButton = $('#number_box_month button:last')
               if (currentNum >= 10) {
-                  $('.profit_tips').show()
+                  $('.profit_tips').text("已选择"+currentNum+"个月,建议“按年订阅”更换算哦~").show()
               } else {
                   $('.profit_tips').hide()
               }
@@ -596,7 +594,7 @@
               // console.log($(this).is(':checked'))
               let isChecked = $(this).is(':checked')
               // 按年订阅默认选择1年 
-              //let val = 1;
+              let val = 1;
               //$('.computed_price').html('¥' + Number(val) * 58)
               if (isChecked) {
                   $('#number_box_year span:eq(0)').addClass('active').siblings().removeClass('active')

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

@@ -1,6 +1,6 @@
 <html>
 <head>
-	<title>招标订阅</title>
+	<title>推送设置</title>
 	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
 	<link href="{{Msg "seo" "cdn"}}/mobiscroll/mobiscroll.min.css" rel="stylesheet">
 	<link href="{{Msg "seo" "cdn"}}/css/common.css?v={{Msg "seo" "version"}}" rel="stylesheet">

+ 17 - 16
src/web/templates/weixin/vipsubscribe/vip_upgrade.html

@@ -341,20 +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);
-//		                	window.location.reload();
-		                }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){
@@ -412,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");
@@ -853,7 +854,7 @@
 			    //
 			    var nowDate = data.now.replace(/-/g, ".");
 			    var a = nowDate+ " - " +endTime;
-			    $(".nownow").text(nowDate+ " - " +endTime)
+			    $(".nownow").text(nowDate+ " - " +endTime.replace(/-/g, "."))
 			    
 			}
         },false);

+ 9 - 7
src/web/templates/weixin/wxkeyset/index.html

@@ -11,7 +11,7 @@
 <script src="{{Msg "seo" "cdn"}}/js/common.js?v={{Msg "seo" "version"}}"></script>
 <!-- 2.8.5 -->
 <link rel="stylesheet" href="/vipsubscribe/iconfont/iconfont.css" />
-<script src="/vipsubscribe/js/rem.js"></script>
+<script src="{{Msg "seo" "cdn"}}/vipsubscribe/js/rem.js?v={{Msg "seo" "version"}}"></script>
 <style>
 ._header {
     position: fixed;
@@ -194,6 +194,7 @@ $(function(){
 	}).on('compositionend', function(){
 	    $(this).prop('comStart', false);
 	}).blur(function(){
+		$("#ten").css("margin-bottom","1rem");
 		$(".vip_banner").show();
 		isfocusing = false;
 		var thisClass = $(this);
@@ -222,6 +223,7 @@ $(function(){
 			}
 		},300);
 	}).focus(function(){
+		$("#ten").css("margin-bottom","");
 		$(".vip_banner").hide();
 		$(".header,.keyWordContent").addClass("absolute");
 		if(focusinputindex != $(this).parents(".keyWordGroup").index()){
@@ -690,12 +692,6 @@ function tointroducepage(){
 </script>
 </head>
 <body class="keysetpage">
-	<div class="header">
-		<!--<span class="header-title">订阅关键词<img class="help" src="/images/help-b.png"></span>-->
-		<span class="header-title">订阅关键词</span>
-		<span class="complate hide">完成</span>
-		<span class="seniorset" style="float: right;font-size: 15px;color: #686868;"><img src="{{Msg "seo" "cdn"}}/images/wxkeyset/set.png" style="width: 17px;margin-right: 4px;margin-top: -3px;">推送设置</span>
-	</div>
 	<div class="vip_banner" style="">
 		<div class="box">
 			<div class="left">
@@ -705,6 +701,12 @@ function tointroducepage(){
 			<a onclick="tointroducepage()" class="right">了解详情 &gt; </a>
 		</div>
 	</div>
+	<div class="header">
+		<!--<span class="header-title">订阅关键词<img class="help" src="/images/help-b.png"></span>-->
+		<span class="header-title">订阅关键词</span>
+		<span class="complate hide">完成</span>
+		<span class="seniorset" style="float: right;font-size: 15px;color: #686868;"><img src="{{Msg "seo" "cdn"}}/images/wxkeyset/set.png" style="width: 17px;margin-right: 4px;margin-top: -3px;">推送设置</span>
+	</div>
 	<div class="keyWordContent _margin_b">
 		<div class="keyWordGroup">
 			<lable>1</lable>

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