소스 검색

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

wangshan 5 년 전
부모
커밋
65f54b67aa
30개의 변경된 파일1049개의 추가작업 그리고 750개의 파일을 삭제
  1. 3 3
      src/jfw/modules/pushsubscribe/src/match/config.json
  2. 1 12
      src/jfw/modules/pushsubscribe/src/match/job/job.go
  3. 267 245
      src/jfw/modules/pushsubscribe/src/match/job/matchjob.go
  4. 7 2
      src/jfw/modules/pushsubscribe/src/match/job/timetask.go
  5. BIN
      src/jfw/modules/pushsubscribe/src/match/match
  6. 1 1
      src/jfw/modules/pushsubscribe/src/match/task.json
  7. 14 13
      src/jfw/modules/pushsubscribe/src/public/util.go
  8. 0 0
      src/jfw/modules/pushsubscribe/src/push/config.json
  9. 2 17
      src/jfw/modules/pushsubscribe/src/push/job/jobs.go
  10. 24 22
      src/jfw/modules/pushsubscribe/src/push/job/movejob.go
  11. 15 15
      src/jfw/modules/pushsubscribe/src/push/job/projectjob.go
  12. 8 7
      src/jfw/modules/pushsubscribe/src/push/job/pushjob.go
  13. BIN
      src/jfw/modules/pushsubscribe/src/push/push
  14. 15 11
      src/jfw/modules/pushsubscribe/src/push/pusher/specialpush.go
  15. 2 2
      src/jfw/modules/pushsubscribe/src/push/util/entity.go
  16. 0 0
      src/jfw/modules/subscribepay/src/dataexport.json
  17. 34 7
      src/jfw/modules/subscribepay/src/entity/dataexport.go
  18. 47 47
      src/jfw/modules/subscribepay/src/entity/subscribeVip.go
  19. 1 1
      src/jfw/modules/subscribepay/src/service/commonAction.go
  20. 4 8
      src/jfw/modules/subscribepay/src/service/orderListDetails.go
  21. 107 61
      src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go
  22. 7 3
      src/web/templates/weixin/dataExport/dataExport_invoiceSuccess.html
  23. 4 4
      src/web/templates/weixin/vipsubscribe/choose_area_upgrade.html
  24. 2 2
      src/web/templates/weixin/vipsubscribe/choose_industry_upgrade.html
  25. 42 22
      src/web/templates/weixin/vipsubscribe/renew_notice.html
  26. 4 8
      src/web/templates/weixin/vipsubscribe/renew_pay.html
  27. 4 6
      src/web/templates/weixin/vipsubscribe/trial_info.html
  28. 27 9
      src/web/templates/weixin/vipsubscribe/vip_order_detail.html
  29. 4 4
      src/web/templates/weixin/vipsubscribe/vip_purchase.html
  30. 403 218
      src/web/templates/weixin/vipsubscribe/vip_upgrade.html

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

@@ -6,13 +6,13 @@
 	"vipMaxPushSize":2000,
 	"mgoAddr":"192.168.3.128:27080",
 	"mgoSize":10,
-	"testids":["5dce0129e1382317285a570a"],
+	"testids":["5d81c5a525ef8723ac0036f9"],
 	"filterWords":["项目","中标","公告"],
 	"matchPoolSize":60,
 	"savePoolSize":5,
 	"loadBiddingPoolSize":60,
 	"loadUserPoolSize":60,
-	"matchDuration":1, 
-	"userBatch":2,
+	"matchDuration":60, 
+	"userBatch":10,
 	"pcHelper":"127.0.0.1:8082"
 }

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

@@ -1,7 +1,6 @@
 package job
 
 import (
-	. "match/config"
 	"sync"
 )
 
@@ -15,16 +14,6 @@ type jobs struct {
 
 var Jobs = &jobs{
 	Match: &MatchJob{
-		matchPool:            make(chan bool, Config.MatchPoolSize),
-		matchWaitGroup:       &sync.WaitGroup{},
-		loadBiddingPool:      make(chan bool, Config.LoadBiddingPoolSize),
-		loadBiddingWaitGroup: &sync.WaitGroup{},
-		loadUserPool:         make(chan bool, Config.LoadBiddingPoolSize),
-		loadUserWaitGroup:    &sync.WaitGroup{},
-		loadUserLock:         &sync.Mutex{},
-		savePool:             make(chan bool, Config.SavePoolSize),
-		saveWaitGroup:        &sync.WaitGroup{},
-		userMapLock:          &sync.Mutex{},
-		allProject:           &sync.Map{},
+		allProject: &sync.Map{},
 	},
 }

+ 267 - 245
src/jfw/modules/pushsubscribe/src/match/job/matchjob.go

@@ -1,7 +1,6 @@
 package job
 
 import (
-	"container/list"
 	"encoding/json"
 	"fmt"
 	. "match/config"
@@ -38,17 +37,7 @@ type Project struct {
 }
 
 type MatchJob struct {
-	matchPool            chan bool
-	matchWaitGroup       *sync.WaitGroup
-	loadBiddingPool      chan bool
-	loadBiddingWaitGroup *sync.WaitGroup
-	loadUserPool         chan bool
-	loadUserWaitGroup    *sync.WaitGroup
-	loadUserLock         *sync.Mutex
-	savePool             chan bool
-	saveWaitGroup        *sync.WaitGroup
-	userMapLock          *sync.Mutex
-	allProject           *sync.Map
+	allProject *sync.Map
 }
 
 //定时任务,匹配数据,存库
@@ -106,202 +95,6 @@ func (m *MatchJob) Execute() {
 	//
 }
 
-func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher, datas *[]map[string]interface{}) {
-	logger.Info("开始匹配第", batchIndex, "批用户。。。")
-	userMap, projectUserMap := m.EachAllBidInfo(matcher, datas)
-	logger.Info("第", batchIndex, "批用户匹配结束。。。")
-	logger.Info("第", batchIndex, "批开始保存到", Pushspace_temp, "表。。。")
-	index := 0
-	var saveBatch []map[string]interface{}
-	lock := &sync.Mutex{}
-	for u, i := range *userMap {
-		m.savePool <- true
-		m.saveWaitGroup.Add(1)
-		go func(user *UserInfo, infos *list.List) {
-			defer func() {
-				<-m.savePool
-				m.saveWaitGroup.Done()
-			}()
-			var pushArray = make(SortList, 0)
-			for e := infos.Front(); e != nil; e = e.Next() {
-				matchInfo := *(e.Value.(*MatchInfo))
-				pushArray = append(pushArray, &matchInfo)
-			}
-			//取最新50条
-			sort.Sort(pushArray)
-			var array []*MatchInfo
-			titleMap := map[string]bool{}
-			infoIdMap := map[string]bool{}
-			size := 0
-			for _, v2 := range pushArray {
-				title := util.ObjToString((*v2.Info)["title"])
-				_id := util.ObjToString((*v2.Info)["_id"])
-				pushInfoKey := PushInfoKey(user.Id, _id)
-				if titleMap[title] {
-					continue
-				}
-				titleMap[title] = true
-				isExists, err := redis.Exists(Pushcache_2_a, pushInfoKey)
-				if err != nil {
-					logger.Error(pushInfoKey, "推送信息redis判重出错", err)
-				}
-				if isExists {
-					continue
-				}
-				redis.Put(Pushcache_2_a, pushInfoKey, 1, OneDaySecond)
-				info := map[string]interface{}{}
-				for _, field := range SaveFields {
-					if (*v2.Info)[field] == nil {
-						continue
-					}
-					info[field] = (*v2.Info)[field]
-				}
-				infoIdMap[_id] = true
-				array = append(array, &MatchInfo{
-					Info: &info,
-					Keys: v2.Keys,
-				})
-				size++
-				maxPushSize := Config.MaxPushSize
-				if IsVipUser(user.VipStatus) {
-					maxPushSize = Config.VipMaxPushSize
-				}
-				if size == maxPushSize {
-					break
-				}
-			}
-			if size == 0 {
-				return
-			}
-			lock.Lock()
-			defer lock.Unlock()
-			saveBatch = append(saveBatch, map[string]interface{}{
-				"s_m_openid":    user.S_m_openid,
-				"a_m_openid":    user.A_m_openid,
-				"phone":         user.Phone,
-				"jpushid":       user.Jpushid,
-				"opushid":       user.Opushid,
-				"appphonetype":  user.AppPhoneType,
-				"userid":        user.Id,
-				"ratemode":      user.RateMode,
-				"wxpush":        user.WxPush,
-				"apppush":       user.AppPush,
-				"mailpush":      user.MailPush,
-				"pchelperpush":  user.PcHelperPush,
-				"usertype":      user.UserType,
-				"email":         user.Email,
-				"list":          array,
-				"size":          size,
-				"subscribe":     user.Subscribe,
-				"applystatus":   user.ApplyStatus,
-				"words":         user.Keys,
-				"modifydate":    user.ModifyDate,
-				"mergeorder":    user.MergeOrder,
-				"timestamp":     time.Now().Unix(),
-				"nickname":      user.NickName,
-				"firstpushtime": user.FirstPushTime,
-				"vipstatus":     user.VipStatus,
-			})
-			if len(saveBatch) == BulkSize {
-				mongodb.SaveBulk(Pushspace_temp, saveBatch...)
-				saveBatch = []map[string]interface{}{}
-			}
-		}(u, i)
-		index++
-		if index%500 == 0 {
-			logger.Info(Pushspace_temp, index)
-		}
-	}
-	m.saveWaitGroup.Wait()
-	if len(saveBatch) > 0 {
-		mongodb.SaveBulk(Pushspace_temp, saveBatch...)
-		saveBatch = []map[string]interface{}{}
-	}
-	logger.Info("第", batchIndex, "批保存到", Pushspace_temp, "表结束。。", index)
-	m.ToRelationProject(projectUserMap)
-}
-
-//关联项目
-func (m *MatchJob) ToRelationProject(projectUser *sync.Map) {
-	logger.Info("开始关联项目。。。")
-	index := 0
-	var updateproject [][]map[string]interface{}
-	lock := &sync.Mutex{}
-	projectUser.Range(func(key interface{}, value interface{}) bool {
-		k, _ := key.(string)
-		v, _ := value.(*[]*UserInfo)
-		m.savePool <- true
-		m.saveWaitGroup.Add(1)
-		go func(_id string, users *[]*UserInfo) {
-			defer func() {
-				<-m.savePool
-				m.saveWaitGroup.Done()
-			}()
-			list_last_infoid := ""
-			projectId := ""
-			if value, ok := m.allProject.Load(_id); ok {
-				project, _ := value.(*Project)
-				projectId = project.Id
-				list_last_infoid = project.List_last_infoid
-			} else {
-				projects := elastic.Get(Projectset, Projectset, fmt.Sprintf(ProjectQuery, _id))
-				if projects == nil || len(*projects) == 0 {
-					return
-				}
-				list := (*projects)[0]["list"].([]interface{})
-				if len(list) == 0 {
-					return
-				}
-				list_last, _ := list[len(list)-1].(map[string]interface{})
-				list_last_infoid = util.ObjToString(list_last["infoid"])
-				projectId, _ := (*projects)[0]["_id"].(string)
-				m.allProject.Store(_id, &Project{
-					Id:               projectId,
-					List_last_infoid: list_last_infoid,
-				})
-			}
-			if projectId == "" || list_last_infoid == "" {
-				return
-			}
-			lock.Lock()
-			defer lock.Unlock()
-			for _, user := range *users {
-				updateproject = append(updateproject, []map[string]interface{}{
-					map[string]interface{}{
-						"projectid": projectId,
-						"userid":    user.Id,
-					},
-					map[string]interface{}{
-						"$set": map[string]interface{}{
-							"projectid":  projectId,
-							"infoid":     _id,
-							"userid":     user.Id,
-							"maxid":      list_last_infoid,
-							"subtypes":   user.O_vipjy.SubTypes,
-							"createtime": time.Now().Unix(),
-						},
-					},
-				})
-			}
-			if len(updateproject) == BigBulkSize {
-				mongodb.NewUpdateBulk(Pushspace_project, true, true, updateproject...)
-				updateproject = [][]map[string]interface{}{}
-			}
-		}(k, v)
-		index++
-		if index%500 == 0 {
-			logger.Info("关联项目", index)
-		}
-		return true
-	})
-	m.saveWaitGroup.Wait()
-	if len(updateproject) > 0 {
-		mongodb.NewUpdateBulk(Pushspace_project, true, true, updateproject...)
-		updateproject = [][]map[string]interface{}{}
-	}
-	logger.Info("关联项目结束。。。", index)
-}
-
 //加载数据到内存中
 func (m *MatchJob) LoadBidding(lastId, newId string, lastTime int64) *[]map[string]interface{} {
 	defer util.Catch()
@@ -342,13 +135,15 @@ func (m *MatchJob) LoadBidding(lastId, newId string, lastTime int64) *[]map[stri
 		"buyerclass":      1,
 	}).Sort("_id").Iter()
 	index := 0
+	loadBiddingPool := make(chan bool, Config.LoadBiddingPoolSize)
+	loadBiddingWaitGroup := &sync.WaitGroup{}
 	for data := make(map[string]interface{}); it.Next(&data); {
-		m.loadBiddingPool <- true
-		m.loadBiddingWaitGroup.Add(1)
+		loadBiddingPool <- true
+		loadBiddingWaitGroup.Add(1)
 		go func(temp map[string]interface{}) {
 			defer func() {
-				<-m.loadBiddingPool
-				m.loadBiddingWaitGroup.Done()
+				<-loadBiddingPool
+				loadBiddingWaitGroup.Done()
 			}()
 			_id := util.BsonIdToSId(temp["_id"])
 			temp["_id"] = _id
@@ -369,10 +164,10 @@ func (m *MatchJob) LoadBidding(lastId, newId string, lastTime int64) *[]map[stri
 		data = make(map[string]interface{})
 		index++
 		if index%500 == 0 {
-			logger.Info(Bidding, index)
+			logger.Info("加载", Bidding, "数据:", index)
 		}
 	}
-	m.loadBiddingWaitGroup.Wait()
+	loadBiddingWaitGroup.Wait()
 	logger.Info(Bidding, "数据已经加载结束。。。", index)
 	return &res
 }
@@ -410,13 +205,17 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *VipU
 	//免费用户
 	title_key_user := make(map[string]*[]*UserInfo)
 	title_notkey_user := make(map[string]*[]*UserInfo)
+	//
+	loadUserPool := make(chan bool, Config.LoadUserPoolSize)
+	loadUserWaitGroup := &sync.WaitGroup{}
+	lock := &sync.Mutex{}
 	for userTemp := make(map[string]interface{}); query.Next(&userTemp); {
-		m.loadUserPool <- true
-		m.loadUserWaitGroup.Add(1)
+		loadUserPool <- true
+		loadUserWaitGroup.Add(1)
 		go func(temp map[string]interface{}) {
 			defer func() {
-				<-m.loadUserPool
-				m.loadUserWaitGroup.Done()
+				<-loadUserPool
+				loadUserWaitGroup.Done()
 			}()
 			user, o_msgset := public.NewUserInfoByUserColl(temp)
 			if user == nil {
@@ -519,8 +318,8 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *VipU
 			user.Keys = originalKeys
 			user.Key_notkey = key_notkey
 			/***************start*****************/
-			m.loadUserLock.Lock()
-			defer m.loadUserLock.Unlock()
+			lock.Lock()
+			defer lock.Unlock()
 			if isVipUser {
 				user.O_vipjy = &O_vipjy{
 					ProjectMatch: util.IntAll(o_msgset["i_projectmatch"]),
@@ -599,7 +398,7 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *VipU
 			break
 		}
 	}
-	m.loadUserWaitGroup.Wait()
+	loadUserWaitGroup.Wait()
 	//
 	vip_title_pjob := &KeyDfa{
 		Key_user:    &vip_title_key_user,
@@ -653,26 +452,48 @@ func (m *MatchJob) MakeKeyUser(keys []string, user *UserInfo, key_user *map[stri
 }
 
 //遍历数据并执行推送操作
-func (m *MatchJob) EachAllBidInfo(matcher Matcher, datas *[]map[string]interface{}) (*map[*UserInfo]*list.List, *sync.Map) {
+func (m *MatchJob) EachAllBidInfo(matcher Matcher, datas *[]map[string]interface{}) (*map[*UserInfo]*SortList, *map[*UserInfo]*[]string) {
 	defer util.Catch()
 	logger.Info("开始匹配数据。。。")
-	userMap := map[*UserInfo]*list.List{}
-	relationProject := &sync.Map{}
+	userMap := map[*UserInfo]*SortList{}
+	projectUserMap := map[*UserInfo]*[]string{}
+	lock := &sync.Mutex{}
 	var index int
+	matchPool := make(chan bool, Config.MatchPoolSize)
+	matchWaitGroup := &sync.WaitGroup{}
 	for _, temp := range *datas {
-		m.matchPool <- true
-		m.matchWaitGroup.Add(1)
+		matchPool <- true
+		matchWaitGroup.Add(1)
 		go func(info map[string]interface{}) {
 			defer func() {
-				m.matchWaitGroup.Done()
-				<-m.matchPool
+				matchWaitGroup.Done()
+				<-matchPool
 			}()
 			users, projectUsers := matcher.Match(&info)
+			lock.Lock()
+			defer lock.Unlock()
 			if users != nil && len(*users) > 0 {
-				m.EachInfoToUser(users, &info, &userMap)
+				for k, v := range *users {
+					l := userMap[k]
+					if l == nil {
+						l = &SortList{}
+					}
+					*l = append(*l, &MatchInfo{
+						Info: &info,
+						Keys: v.Keys,
+					})
+					userMap[k] = l
+				}
 			}
 			if projectUsers != nil && len(*projectUsers) > 0 {
-				relationProject.Store(util.ObjToString(info["_id"]), projectUsers)
+				for _, v := range *projectUsers {
+					l := projectUserMap[v]
+					if l == nil {
+						l = &[]string{}
+					}
+					*l = append(*l, util.ObjToString(info["_id"]))
+					projectUserMap[v] = l
+				}
 			}
 		}(temp)
 		index++
@@ -680,24 +501,225 @@ func (m *MatchJob) EachAllBidInfo(matcher Matcher, datas *[]map[string]interface
 			logger.Info("匹配数据", index)
 		}
 	}
-	m.matchWaitGroup.Wait()
+	matchWaitGroup.Wait()
 	logger.Info("匹配数据结束。。。", index)
-	return &userMap, relationProject
+	return &userMap, &projectUserMap
+}
+func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher, datas *[]map[string]interface{}) {
+	logger.Info("开始匹配第", batchIndex, "批用户。。。")
+	userMap, projectUserMap := m.EachAllBidInfo(matcher, datas)
+	logger.Info("第", batchIndex, "批用户匹配结束。。。")
+	logger.Info("第", batchIndex, "批开始保存到", Pushspace_temp, "表。。。")
+	index := 0
+	var saveBatch []map[string]interface{}
+	myMatchId := map[string]map[string]bool{}
+	myFilterId := map[string]map[string]bool{}
+	//
+	savePool := make(chan bool, Config.SavePoolSize)
+	saveWaitGroup := &sync.WaitGroup{}
+	lock := &sync.Mutex{}
+	for k, v := range *userMap {
+		savePool <- true
+		saveWaitGroup.Add(1)
+		go func(user *UserInfo, infos *SortList) {
+			defer func() {
+				<-savePool
+				saveWaitGroup.Done()
+			}()
+			//取最新50条
+			sort.Sort(infos)
+			var array []*MatchInfo
+			matchTitle := map[string]bool{}
+			matchId := map[string]bool{}
+			filterId := map[string]bool{}
+			size := 0
+			for _, v2 := range *infos {
+				title := util.ObjToString((*v2.Info)["title"])
+				_id := util.ObjToString((*v2.Info)["_id"])
+				pushInfoKey := PushInfoKey(user.Id, _id)
+				if matchTitle[title] {
+					filterId[_id] = true
+					continue
+				}
+				matchTitle[title] = true
+				isExists, err := redis.Exists(Pushcache_2_a, pushInfoKey)
+				if err != nil {
+					logger.Error(pushInfoKey, "推送信息redis判重出错", err)
+				}
+				if isExists {
+					filterId[_id] = true
+					continue
+				}
+				redis.Put(Pushcache_2_a, pushInfoKey, 1, OneDaySecond)
+				info := map[string]interface{}{}
+				for _, field := range SaveFields {
+					if (*v2.Info)[field] == nil {
+						continue
+					}
+					info[field] = (*v2.Info)[field]
+				}
+				matchId[_id] = true
+				array = append(array, &MatchInfo{
+					Info: &info,
+					Keys: v2.Keys,
+				})
+				size++
+				maxPushSize := Config.MaxPushSize
+				if IsVipUser(user.VipStatus) {
+					maxPushSize = Config.VipMaxPushSize
+				}
+				if size == maxPushSize {
+					break
+				}
+			}
+			if size == 0 {
+				return
+			}
+			lock.Lock()
+			defer lock.Unlock()
+			myMatchId[user.Id] = matchId
+			myFilterId[user.Id] = filterId
+			saveBatch = append(saveBatch, map[string]interface{}{
+				"s_m_openid":    user.S_m_openid,
+				"a_m_openid":    user.A_m_openid,
+				"phone":         user.Phone,
+				"jpushid":       user.Jpushid,
+				"opushid":       user.Opushid,
+				"appphonetype":  user.AppPhoneType,
+				"userid":        user.Id,
+				"ratemode":      user.RateMode,
+				"wxpush":        user.WxPush,
+				"apppush":       user.AppPush,
+				"mailpush":      user.MailPush,
+				"pchelperpush":  user.PcHelperPush,
+				"usertype":      user.UserType,
+				"email":         user.Email,
+				"list":          array,
+				"size":          size,
+				"subscribe":     user.Subscribe,
+				"applystatus":   user.ApplyStatus,
+				"words":         user.Keys,
+				"modifydate":    user.ModifyDate,
+				"mergeorder":    user.MergeOrder,
+				"timestamp":     time.Now().Unix(),
+				"nickname":      user.NickName,
+				"firstpushtime": user.FirstPushTime,
+				"vipstatus":     user.VipStatus,
+			})
+			if len(saveBatch) == BulkSize {
+				mongodb.SaveBulk(Pushspace_temp, saveBatch...)
+				saveBatch = []map[string]interface{}{}
+			}
+		}(k, v)
+		index++
+		if index%500 == 0 {
+			logger.Info("保存到", Pushspace_temp, "表:", index)
+		}
+	}
+	saveWaitGroup.Wait()
+	if len(saveBatch) > 0 {
+		mongodb.SaveBulk(Pushspace_temp, saveBatch...)
+		saveBatch = []map[string]interface{}{}
+	}
+	logger.Info("第", batchIndex, "批保存到", Pushspace_temp, "表结束。。。", index)
+	m.ToRelationProject(projectUserMap, &myMatchId, &myFilterId)
 }
 
-//遍历用户加入到此条信息上
-func (m *MatchJob) EachInfoToUser(users *map[*UserInfo]*MatchUser, info *map[string]interface{}, userMap *map[*UserInfo]*list.List) {
-	defer m.userMapLock.Unlock()
-	m.userMapLock.Lock()
-	for k, v := range *users {
-		l := (*userMap)[k]
-		if l == nil {
-			l = list.New()
+//关联项目
+func (m *MatchJob) ToRelationProject(projectUser *map[*UserInfo]*[]string, myMatchId, myFilterId *map[string]map[string]bool) {
+	logger.Info("开始关联项目。。。")
+	index := 0
+	var updateproject [][]map[string]interface{}
+	//
+	savePool := make(chan bool, Config.SavePoolSize)
+	saveWaitGroup := &sync.WaitGroup{}
+	lock := &sync.Mutex{}
+	for k, v := range *projectUser {
+		savePool <- true
+		saveWaitGroup.Add(1)
+		go func(user *UserInfo, _ids *[]string) {
+			defer func() {
+				<-savePool
+				saveWaitGroup.Done()
+			}()
+			needLength := Config.MaxPushSize - len((*myMatchId)[user.Id])
+			for _, _id := range *_ids {
+				if (*myFilterId)[user.Id] != nil && (*myFilterId)[user.Id][_id] {
+					continue
+				}
+				//如果有信息类型,优先用订阅匹配上的信息,然后最多关联50条
+				if len(user.O_vipjy.SubTypes) > 0 {
+					if (*myMatchId)[user.Id] == nil || !(*myMatchId)[user.Id][_id] {
+						if needLength > 0 {
+							needLength--
+						} else {
+							continue
+						}
+					}
+				} else { //如果没有信息类型,只关联订阅匹配上的信息
+					if (*myMatchId)[user.Id] == nil || !(*myMatchId)[user.Id][_id] {
+						continue
+					}
+				}
+				list_last_infoid := ""
+				projectId := ""
+				if value, ok := m.allProject.Load(_id); ok {
+					project, _ := value.(*Project)
+					projectId = project.Id
+					list_last_infoid = project.List_last_infoid
+				} else {
+					projects := elastic.Get(Projectset, Projectset, fmt.Sprintf(ProjectQuery, _id))
+					if projects == nil || len(*projects) == 0 {
+						continue
+					}
+					list := (*projects)[0]["list"].([]interface{})
+					if len(list) == 0 {
+						continue
+					}
+					list_last, _ := list[len(list)-1].(map[string]interface{})
+					list_last_infoid = util.ObjToString(list_last["infoid"])
+					projectId, _ = (*projects)[0]["_id"].(string)
+					m.allProject.Store(_id, &Project{
+						Id:               projectId,
+						List_last_infoid: list_last_infoid,
+					})
+				}
+				if projectId == "" || list_last_infoid == "" {
+					continue
+				}
+				lock.Lock()
+				updateproject = append(updateproject, []map[string]interface{}{
+					map[string]interface{}{
+						"projectid": projectId,
+						"userid":    user.Id,
+					},
+					map[string]interface{}{
+						"$set": map[string]interface{}{
+							"projectid":  projectId,
+							"infoid":     _id,
+							"userid":     user.Id,
+							"maxid":      list_last_infoid,
+							"subtypes":   user.O_vipjy.SubTypes,
+							"createtime": time.Now().Unix(),
+						},
+					},
+				})
+				if len(updateproject) == BigBulkSize {
+					mongodb.NewUpdateBulk(Pushspace_project, true, true, updateproject...)
+					updateproject = [][]map[string]interface{}{}
+				}
+				lock.Unlock()
+			}
+		}(k, v)
+		index++
+		if index%500 == 0 {
+			logger.Info("关联项目:", index)
 		}
-		l.PushBack(&MatchInfo{
-			Info: info,
-			Keys: v.Keys,
-		})
-		(*userMap)[k] = l
 	}
+	saveWaitGroup.Wait()
+	if len(updateproject) > 0 {
+		mongodb.NewUpdateBulk(Pushspace_project, true, true, updateproject...)
+		updateproject = [][]map[string]interface{}{}
+	}
+	logger.Info("关联项目结束。。。", index)
 }

+ 7 - 2
src/jfw/modules/pushsubscribe/src/match/job/timetask.go

@@ -20,8 +20,13 @@ type MatchTimeTask struct {
 }
 
 func (m *MatchTimeTask) Execute() {
-	Jobs.Match.Execute()
-	util.WriteSysConfig("./task.json", &TaskConfig)
+	hour := time.Hour
+	//23点到1点之间,不执行定时任务
+	//订阅付费有每天0点的定时任务删除pushspace_temp表的数据,会有冲突
+	if hour < 23 && hour > 1 {
+		Jobs.Match.Execute()
+		util.WriteSysConfig("./task.json", &TaskConfig)
+	}
 	t := time.Duration(Config.MatchDuration) * time.Minute
 	logger.Info("start match job after", t)
 	time.AfterFunc(t, m.Execute)

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


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

@@ -1 +1 @@
-{"startTime":"","lastId":"5da69c3fa5cb26b9b77bec0d"}
+{"lastTime":"","lastId":"5da72482a5cb26b9b7a130fb"}

+ 14 - 13
src/jfw/modules/pushsubscribe/src/public/util.go

@@ -11,19 +11,20 @@ import (
 )
 
 const (
-	BulkSize          = 20
-	BigBulkSize       = 100
-	OneDaySecond      = 86400
-	User              = "user"
-	Bidding           = "bidding"
-	Projectset        = "projectset"
-	Pushspace_project = "pushspace_project"
-	Pushspace_temp    = "pushspace_temp"
-	Pushspace_vip     = "pushspace_vip"
-	Pushspace_fail    = "pushspace_fail"
-	Pushspace         = "pushspace"
-	Pushcache_1       = "pushcache_1"
-	Pushcache_2_a     = "pushcache_2_a"
+	BulkSize           = 20
+	BigBulkSize        = 100
+	OneDaySecond       = 86400
+	User               = "user"
+	Bidding            = "bidding"
+	Projectset         = "projectset"
+	Pushspace_project  = "pushspace_project"
+	Pushspace_temp     = "pushspace_temp"
+	Pushspace_vip      = "pushspace_vip"
+	Pushspace_vip_fail = "pushspace_vip_fail"
+	Pushspace_fail     = "pushspace_fail"
+	Pushspace          = "pushspace"
+	Pushcache_1        = "pushcache_1"
+	Pushcache_2_a      = "pushcache_2_a"
 )
 
 var (

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
src/jfw/modules/pushsubscribe/src/push/config.json


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

@@ -1,7 +1,6 @@
 package job
 
 import (
-	. "push/config"
 	"sync"
 )
 
@@ -10,23 +9,9 @@ var Jobs = struct {
 	Push        *PushJob
 	ProjectPush *ProjectPushJob
 }{
-	Move: &MoveJob{
-		moveLock:  &sync.Mutex{},
-		moveWait:  &sync.WaitGroup{},
-		movePool:  make(chan bool, Config.MovePoolSize),
-		mergeLock: &sync.Mutex{},
-		mergeWait: &sync.WaitGroup{},
-		mergePool: make(chan bool, Config.MergePoolSize),
-	},
+	Move: &MoveJob{},
 	Push: &PushJob{
-		pool: make(chan bool, Config.PushPoolSize),
-		wait: &sync.WaitGroup{},
 		lock: &sync.Mutex{},
 	},
-	ProjectPush: &ProjectPushJob{
-		pushPool: make(chan bool, Config.ProjectPushPoolSize),
-		pushWait: &sync.WaitGroup{},
-		loadPool: make(chan bool, Config.LoadProjectPoolSize),
-		loadWait: &sync.WaitGroup{},
-	},
+	ProjectPush: &ProjectPushJob{},
 }

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

@@ -22,12 +22,6 @@ type MoveUser struct {
 }
 
 type MoveJob struct {
-	moveLock  *sync.Mutex
-	moveWait  *sync.WaitGroup
-	movePool  chan bool
-	mergeLock *sync.Mutex
-	mergeWait *sync.WaitGroup
-	mergePool chan bool
 }
 
 func (m *MoveJob) Execute() {
@@ -45,15 +39,18 @@ func (m *MoveJob) Execute() {
 	}).Sort("userid").Iter()
 	moveUsers := map[string]*MoveUser{}
 	index, number, length := 0, 0, 0
+	//
+	moveWait := &sync.WaitGroup{}
+	movePool := make(chan bool, Config.MovePoolSize)
+	moveLock := &sync.Mutex{}
 	for data := make(map[string]interface{}); it.Next(&data); {
-		m.movePool <- true
-		m.moveWait.Add(1)
+		movePool <- true
+		moveWait.Add(1)
 		index++
 		go func(temp map[string]interface{}) {
 			defer func() {
-				<-m.movePool
-				m.moveWait.Done()
-				m.moveLock.Unlock()
+				<-movePool
+				moveWait.Done()
 			}()
 			userId := util.ObjToString(temp["userid"])
 			isVipUser := IsVipUser(util.IntAll(temp["vipstatus"]))
@@ -61,7 +58,8 @@ func (m *MoveJob) Execute() {
 			if isVipUser {
 				maxPushSize = Config.VipMaxPushSize
 			}
-			m.moveLock.Lock()
+			moveLock.Lock()
+			defer moveLock.Unlock()
 			moveUser := moveUsers[userId]
 			if moveUser != nil {
 				list, _ := moveUser.info["list"].(*SortList)
@@ -109,7 +107,7 @@ func (m *MoveJob) Execute() {
 			logger.Info("迁移数据:", index)
 		}
 	}
-	m.moveWait.Wait()
+	moveWait.Wait()
 	if length > 0 {
 		m.merge(&number, nowUnix, moveUsers)
 		length = 0
@@ -127,26 +125,30 @@ func (m *MoveJob) merge(number *int, nowUnix int64, moveUsers map[string]*MoveUs
 	updateArray_set := []map[string]interface{}{}
 	updateArray_delete := []interface{}{}
 	invalidArray_delete := []interface{}{}
+	//
+	mergeLock := &sync.Mutex{}
+	mergeWait := &sync.WaitGroup{}
+	mergePool := make(chan bool, Config.MergePoolSize)
 	for k, v := range moveUsers {
-		m.mergePool <- true
-		m.mergeWait.Add(1)
+		mergePool <- true
+		mergeWait.Add(1)
 		go func(userId string, moveUser *MoveUser) {
 			defer func() {
-				<-m.mergePool
-				m.mergeWait.Done()
+				<-mergePool
+				mergeWait.Done()
 			}()
 			sess := mongodb.GetMgoConn()
 			defer mongodb.DestoryMongoConn(sess)
 			var data map[string]interface{}
 			sess.DB(DbName).C(Pushspace).Find(map[string]interface{}{"userid": userId}).Select(map[string]interface{}{"list": 1}).One(&data)
 			if data == nil { //批量新增
-				m.mergeLock.Lock()
+				mergeLock.Lock()
 				saveArray = append(saveArray, moveUser.info)
 				saveArray_delete = append(saveArray_delete, moveUser.ids...)
 				if len(saveArray) == BulkSize {
 					m.saveBulk(sess, &saveArray, &saveArray_delete)
 				}
-				m.mergeLock.Unlock()
+				mergeLock.Unlock()
 			} else { //批量更新
 				setMap := map[string]interface{}{}
 				for _, field := range MoveFields {
@@ -198,14 +200,14 @@ func (m *MoveJob) merge(number *int, nowUnix int64, moveUsers map[string]*MoveUs
 					}
 				}
 				upSet["$set"] = setMap
-				m.mergeLock.Lock()
+				mergeLock.Lock()
 				updateArray_delete = append(updateArray_delete, moveUser.ids...)
 				updateArray_query = append(updateArray_query, map[string]interface{}{"_id": data["_id"]})
 				updateArray_set = append(updateArray_set, upSet)
 				if len(updateArray_query) == BulkSize {
 					m.updateBulk(sess, &updateArray_query, &updateArray_set, &updateArray_delete)
 				}
-				m.mergeLock.Unlock()
+				mergeLock.Unlock()
 			}
 		}(k, v)
 		index++
@@ -213,7 +215,7 @@ func (m *MoveJob) merge(number *int, nowUnix int64, moveUsers map[string]*MoveUs
 			logger.Info("第", *number, "次合并数据:", index)
 		}
 	}
-	m.mergeWait.Wait()
+	mergeWait.Wait()
 	if len(saveArray) > 0 {
 		m.saveBulk(nil, &saveArray, &saveArray_delete)
 	}

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

@@ -18,10 +18,6 @@ import (
 )
 
 type ProjectPushJob struct {
-	pushPool chan bool
-	pushWait *sync.WaitGroup
-	loadPool chan bool
-	loadWait *sync.WaitGroup
 }
 
 func (p *ProjectPushJob) Execute() {
@@ -32,18 +28,21 @@ func (p *ProjectPushJob) Execute() {
 	projects := p.loadProject()
 	startId := ""
 	batchIndex := 0
+	//
+	pushPool := make(chan bool, Config.ProjectPushPoolSize)
+	pushWait := &sync.WaitGroup{}
 	for {
 		batchIndex++
 		batchCount, datas := p.loadPushspace_project(batchIndex, &startId)
 		logger.Info("开始第", batchIndex, "次关联项目匹配。。。")
 		index := 0
 		for k, v := range *datas {
-			p.pushPool <- true
-			p.pushWait.Add(1)
+			pushPool <- true
+			pushWait.Add(1)
 			go func(userId string, list []map[string]interface{}) {
 				defer func() {
-					<-p.pushPool
-					p.pushWait.Done()
+					<-pushPool
+					pushWait.Done()
 				}()
 				sess := mongodb.GetMgoConn()
 				defer mongodb.DestoryMongoConn(sess)
@@ -176,7 +175,7 @@ func (p *ProjectPushJob) Execute() {
 				logger.Info("第", batchIndex, "次关联项目匹配:", index)
 			}
 		}
-		p.pushWait.Wait()
+		pushWait.Wait()
 		logger.Info("第", batchIndex, "次关联项目匹配结束", index)
 		if batchCount < Config.PushBatch {
 			break
@@ -240,7 +239,6 @@ func (p *ProjectPushJob) loadPushspace_project(batchIndex int, startId *string)
 		}
 		prevUserId = userId
 	}
-	p.loadWait.Wait()
 	logger.Info("第", batchIndex, "批关联项目加载结束", index, *startId)
 	return index, &datas
 }
@@ -264,13 +262,15 @@ func (p *ProjectPushJob) loadProject() *sync.Map {
 	}).Sort("_id").Iter()
 	projectMap := &sync.Map{}
 	index := 0
+	loadPool := make(chan bool, Config.LoadProjectPoolSize)
+	loadWait := &sync.WaitGroup{}
 	for m := make(map[string]interface{}); it.Next(&m); {
-		p.loadPool <- true
-		p.loadWait.Add(1)
+		loadPool <- true
+		loadWait.Add(1)
 		go func(data map[string]interface{}) {
 			defer func() {
-				<-p.loadPool
-				p.loadWait.Done()
+				<-loadPool
+				loadWait.Done()
 			}()
 			_id := util.BsonIdToSId(data["_id"])
 			projectMap.Store(_id, data)
@@ -281,7 +281,7 @@ func (p *ProjectPushJob) loadProject() *sync.Map {
 			logger.Info("加载项目:", index)
 		}
 	}
-	p.loadWait.Wait()
+	loadWait.Wait()
 	logger.Info("加载项目结束。。。", index)
 	return projectMap
 }

+ 8 - 7
src/jfw/modules/pushsubscribe/src/push/job/pushjob.go

@@ -35,8 +35,6 @@ func init() {
 }
 
 type PushJob struct {
-	pool                    chan bool
-	wait                    *sync.WaitGroup
 	lock                    *sync.Mutex
 	minutePushPool          chan bool
 	fastigiumMinutePushPool chan bool
@@ -74,6 +72,9 @@ func (p *PushJob) StartPush(pusher Pusher, taskType int) {
 	logger.Info("推送任务", taskType, "开始推送。。。")
 	batchIndex := 0
 	startId := ""
+	//
+	pushPool := make(chan bool, Config.PushPoolSize)
+	pushWait := &sync.WaitGroup{}
 	for {
 		batchIndex++
 		isBreak, users := pusher.OncePushBatch(taskType, batchIndex, &startId)
@@ -90,15 +91,15 @@ func (p *PushJob) StartPush(pusher Pusher, taskType int) {
 						}
 					}
 				}()
-			case p.pool <- true:
+			case pushPool <- true:
 			}
-			p.wait.Add(1)
+			pushWait.Add(1)
 			go func(v map[string]interface{}, take bool) {
 				defer func() {
 					if take {
-						<-p.pool
+						<-pushPool
 					}
-					p.wait.Done()
+					pushWait.Done()
 				}()
 				u, pushWay := pusher.GetUserInfo(v)
 				if u == nil {
@@ -116,7 +117,7 @@ func (p *PushJob) StartPush(pusher Pusher, taskType int) {
 			break
 		}
 	}
-	p.wait.Wait()
+	pushWait.Wait()
 	logger.Info("推送任务结束。。。", taskType)
 }
 

BIN
src/jfw/modules/pushsubscribe/src/push/push


+ 15 - 11
src/jfw/modules/pushsubscribe/src/push/pusher/specialpush.go

@@ -16,9 +16,7 @@ type SpecialPush struct{}
 
 //获取需要推送的用户
 func (s *SpecialPush) OncePushBatch(taskType, batchIndex int, startId *string) (bool, *[]map[string]interface{}) {
-	query := map[string]interface{}{
-		"status": 1,
-	}
+	query := map[string]interface{}{}
 	if taskType == 3 {
 		query["ratemode"] = 3
 	} else if taskType == 4 {
@@ -93,17 +91,23 @@ func (s *SpecialPush) GetPushParam(mailPush bool, u *UserInfo, sl *SortList) *pu
 
 //推送以后处理
 func (s *SpecialPush) AfterPush(pushResult *putil.PushResult, u *UserInfo, user map[string]interface{}) {
-	if pushResult == nil || (pushResult.WxStatus != -1 && pushResult.AppStatus != -1 && pushResult.MailStatus != -1) {
-		s.deletePushspaceVip(user)
-	} else {
+	s.deletePushspaceVip(user)
+	if pushResult != nil && (pushResult.WxStatus == -1 || pushResult.AppStatus == -1 || pushResult.MailStatus == -1) {
 		sess := mongodb.GetMgoConn()
 		defer mongodb.DestoryMongoConn(sess)
-		err := sess.DB(DbName).C(Pushspace_vip).UpdateId(user["_id"], map[string]interface{}{
-			"failtime": time.Now().Unix(),
-			"status":   -1,
-		})
+		if pushResult.WxStatus == -1 {
+			user["wxfail"] = 1
+		}
+		if pushResult.AppStatus == -1 {
+			user["appfail"] = 1
+		}
+		if pushResult.MailStatus == -1 {
+			user["mailfail"] = 1
+		}
+		user["failtime"] = time.Now().Unix()
+		err := sess.DB(DbName).C(Pushspace_vip_fail).Insert(user)
 		if err != nil {
-			logger.Error(u.Id, "更新出错", err)
+			logger.Error(u.Id, "新出错", err)
 		}
 	}
 }

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

@@ -84,6 +84,8 @@ func NewPushParam(isLimit bool, dayCount int, mailPush bool, u *UserInfo, sl *So
 	infosLength := 0
 	isVipUser := IsVipUser(u.VipStatus)
 	for _, ks := range *sl {
+		infosLength++
+		dayCount++
 		k2 := *ks.Info
 		title := strings.Replace(k2["title"].(string), "\n", "", -1)
 		title = Re.ReplaceAllString(title, "$1")
@@ -92,7 +94,6 @@ func NewPushParam(isLimit bool, dayCount int, mailPush bool, u *UserInfo, sl *So
 			area = "全国"
 		}
 		newTitle := fmt.Sprintf("[%s]%s", area, title)
-		infosLength++
 		infos = append(infos, ks)
 		titleArray = append(titleArray, newTitle)
 		if infosLength == 1 {
@@ -169,7 +170,6 @@ func NewPushParam(isLimit bool, dayCount int, mailPush bool, u *UserInfo, sl *So
 					break
 				}
 			}
-			dayCount++
 		}
 	}
 	return &PushParam{

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 0 - 0
src/jfw/modules/subscribepay/src/dataexport.json


+ 34 - 7
src/jfw/modules/subscribepay/src/entity/dataexport.go

@@ -340,15 +340,16 @@ func SendMailToBJFinance(order *map[string]interface{}, pay_time, transaction_id
 				}
 			}
 			//vip开发票内容
-			subscription_area, industry, subscription_cycle, effective_date := "", "", "", ""
+			subscription_area, industry, subscription_cycle, effective_date, payment_number := "", "", "", "", ""
 			city_count := 0
 			filter := qutil.ObjToString((*order)["filter"])
 			vip_starttime := qutil.ObjToString((*order)["vip_starttime"])
 			vip_endtime := qutil.ObjToString((*order)["vip_endtime"])
+			payment_number = getPayTransactionId(qutil.ObjToString((*order)["pay_way"]), qutil.ObjToString((*order)["out_trade_no"]))
+			vip_type := qutil.Int64All((*order)["vip_type"]) //判断 续费 升级订单
 			vf := new(VipFilter)
 			err := json.Unmarshal([]byte(filter), &vf)
 			if err == nil && vf != nil {
-				log.Println(vf.Area)
 				vip_area := vf.Area    //区域
 				vip_ind := vf.Industry //行业
 				nbs := JyVipSubStruct.NewBuySet(&vip_area, vip_ind)
@@ -409,19 +410,22 @@ func SendMailToBJFinance(order *map[string]interface{}, pay_time, transaction_id
 						} else if year > 0 && month == 0 {
 							subscription_cycle = fmt.Sprintf("%d年", year)
 						}
-						log.Println(subscription_cycle)
 						//有效日期
 						vip_starttime = strings.Replace(vip_starttime[0:10], "-", ".", -1)
 						vip_endtime = strings.Replace(vip_endtime[0:10], "-", ".", -1)
 						effective_date = fmt.Sprintf("%v-%v", vip_starttime, vip_endtime)
-						log.Println(effective_date)
 					}
 				}
 			}
-			//vip
-			product_type = "VIP订阅"
+			if vip_type == 1 {
+				product_type = "VIP订阅(续费)"
+			} else if vip_type == 2 {
+				product_type = "VIP订阅(升级)"
+			} else {
+				product_type = "VIP订阅"
+			}
 			mail_title = "电子发票申请-[剑鱼标讯]VIP订阅(" + order_code + ")"
-			mailcontent = fmt.Sprintf(ExConf.Mail_vip_invoice_finance_content, bill_title, company_flag, bill_company, taxnum_flag, bill_taxnum, user_email, order_code, create_time, pay_time, pay_way, product_type, pay_money, subscription_area, industry, subscription_cycle, effective_date)
+			mailcontent = fmt.Sprintf(ExConf.Mail_vip_invoice_finance_content, bill_title, company_flag, bill_company, taxnum_flag, bill_taxnum, user_email, order_code, create_time, payment_number, pay_time, pay_way, product_type, pay_money, subscription_area, industry, subscription_cycle, effective_date)
 		}
 	}
 	//发送邮件
@@ -762,3 +766,26 @@ func GetBrforeMsg(userId, openId string) (name, phone, company, email string) {
 	}
 	return
 }
+
+//获取支付单号
+func getPayTransactionId(payWay, tradeNo string) (transaction_id string) {
+	if payWay == "" || tradeNo == "" {
+		return
+	}
+	table := ""
+	if strings.HasPrefix(payWay, "wx") {
+		table = "weixin_pay"
+	} else if strings.HasPrefix(payWay, "ali") {
+		table = "ali_pay"
+	} else {
+		return
+	}
+	query := map[string]interface{}{
+		"out_trade_no": tradeNo,
+	}
+	r := util.Mysql.FindOne(table, query, "transaction_id", "")
+	if r != nil {
+		transaction_id = qutil.ObjToString((*r)["transaction_id"])
+	}
+	return
+}

+ 47 - 47
src/jfw/modules/subscribepay/src/entity/subscribeVip.go

@@ -133,12 +133,12 @@ func (this *vipSubscribeStruct) PayCallBack(param *CallBackParam) bool {
 		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, "no")
-	} else if vmsg.OrderType == 4 { //下月升级
-		flag = JyVipSubStruct.UpgradeSubVip(userid, vmsg, qutil.ObjToString((*orderdata)["vip_starttime"]), qutil.ObjToString((*orderdata)["vip_endtime"]), false, "no")
+		//	} else if vmsg.OrderType == 4 { //下月升级
+		//		flag = JyVipSubStruct.UpgradeSubVip(userid, vmsg, qutil.ObjToString((*orderdata)["vip_starttime"]), qutil.ObjToString((*orderdata)["vip_endtime"]), false, "no")
 	} else if vmsg.OrderType == 5 {
 		flag = JyVipSubStruct.UpgradeSubVip(userid, vmsg, qutil.ObjToString((*orderdata)["vip_starttime"]), qutil.ObjToString((*orderdata)["vip_endtime"]), false, "exprie")
-	} else if vmsg.OrderType == 6 { //下月升级未生效再次升级
-		flag = JyVipSubStruct.UpgradeSubVipTwo(userid, vmsg, qutil.ObjToString((*orderdata)["vip_endtime"]), false)
+		//	} else if vmsg.OrderType == 6 { //下月升级未生效再次升级
+		//		flag = JyVipSubStruct.UpgradeSubVipTwo(userid, vmsg, qutil.ObjToString((*orderdata)["vip_endtime"]), false)
 	}
 	//支付成功后 其他未支付vip订阅订单 变为已取消
 	if flag {
@@ -216,12 +216,12 @@ func (this *vipSubscribeStruct) UpgradeSubVip(userId string, vmsg VipSimpleMsg,
 			log.Printf("%s更新结束%d日期出错\n", userId, endTime.Unix())
 			return false
 		}
-		var effectTime time.Time
-		if isExprie != "no" {
-			effectTime = startTime
-		} else {
-			effectTime = time.Date(time.Now().Year(), time.Now().Month()+1, 1, 0, 0, 0, 0, time.Local)
-		}
+		//		var effectTime time.Time
+		//		if isExprie != "no" {
+		effectTime := startTime
+		//		} else {
+		//			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{
@@ -238,43 +238,43 @@ func (this *vipSubscribeStruct) UpgradeSubVip(userId string, vmsg VipSimpleMsg,
 }
 
 //升级未生效再次升级
-func (this *vipSubscribeStruct) UpgradeSubVipTwo(userId string, vmsg VipSimpleMsg, end string, isNow bool) bool {
-	endTime, err := time.ParseInLocation(qutil.Date_Full_Layout, end, time.Local)
-	if err != nil {
-		log.Println("%s格式化日期出错%s\n", userId, endTime)
-		return false
-	}
-	buyset := JyVipSubStruct.NewBuySet(vmsg.Area, vmsg.Industry)
-
-	if !util.MQFW.UpdateById("user", userId,
-		bson.M{"$set": bson.M{
-			"l_vip_endtime":    endTime.Unix(),
-			"i_vip_expire_tip": 0,
-		}}) {
-		log.Printf("%s更新结束%d日期出错\n", userId, endTime.Unix())
-		return false
-	}
-
-	if util.MQFW.Update("vip_upgrade", bson.M{"s_userid": userId, "i_isvalid": 0},
-		bson.M{"$set": bson.M{
-			"i_isvalid": 1,
-		}}, false, 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":  effectTime.Unix(), //生效时间
-				"l_createtime": time.Now().Unix(), //入库时间
-				"o_buyset":     buyset,            //购买内容数量
-				"i_isvalid":    0,                 //是否已经生效 0-未生效
-			}) != ""
-	} else {
-		return false
-	}
-}
+//func (this *vipSubscribeStruct) UpgradeSubVipTwo(userId string, vmsg VipSimpleMsg, end string, isNow bool) bool {
+//	endTime, err := time.ParseInLocation(qutil.Date_Full_Layout, end, time.Local)
+//	if err != nil {
+//		log.Println("%s格式化日期出错%s\n", userId, endTime)
+//		return false
+//	}
+//	buyset := JyVipSubStruct.NewBuySet(vmsg.Area, vmsg.Industry)
+
+//	if !util.MQFW.UpdateById("user", userId,
+//		bson.M{"$set": bson.M{
+//			"l_vip_endtime":    endTime.Unix(),
+//			"i_vip_expire_tip": 0,
+//		}}) {
+//		log.Printf("%s更新结束%d日期出错\n", userId, endTime.Unix())
+//		return false
+//	}
+
+//	if util.MQFW.Update("vip_upgrade", bson.M{"s_userid": userId, "i_isvalid": 0},
+//		bson.M{"$set": bson.M{
+//			"i_isvalid": 1,
+//		}}, false, 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":  effectTime.Unix(), //生效时间
+//				"l_createtime": time.Now().Unix(), //入库时间
+//				"o_buyset":     buyset,            //购买内容数量
+//				"i_isvalid":    0,                 //是否已经生效 0-未生效
+//			}) != ""
+//	} else {
+//		return false
+//	}
+//}
 
 //根据行业和地区 返回*SubvipBuySet
 func (this *vipSubscribeStruct) NewBuySet(area *map[string]interface{}, industry []string) *SubvipBuySet {

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

@@ -52,7 +52,7 @@ func (d *CommonAction) ApplyInvoice() error {
 		go func() {
 			orderdata := util.Mysql.FindOne("dataexport_order", map[string]interface{}{
 				"order_code": order_code,
-			}, "id,filter,user_mail,user_phone,product_type,data_spec,filter_id,order_code,data_count,order_status,order_money,out_trade_no,applybill_type,applybill_company,applybill_taxnum,user_openid,create_time,pay_time,pay_way,pay_money,vip_starttime,vip_endtime,user_id", "")
+			}, "id,filter,user_mail,user_phone,product_type,data_spec,filter_id,order_code,data_count,order_status,order_money,out_trade_no,applybill_type,applybill_company,applybill_taxnum,user_openid,create_time,pay_time,pay_way,pay_money,vip_starttime,vip_endtime,user_id,vip_type", "")
 			tt := time.Now()
 			pay_time := qutil.FormatDate(&tt, qutil.Date_Full_Layout)
 			entity.SendMailToBJFinance(orderdata, pay_time, "", 2, config.GmailAuth)

+ 4 - 8
src/jfw/modules/subscribepay/src/service/orderListDetails.go

@@ -58,7 +58,6 @@ func (this *OrderListDetails) GetOrderPayAllMsg() {
 			//"order_status": 1,
 		}
 		oData := util.Mysql.FindOne(tableName_order, query, "prepay_time,create_time,pay_time,pay_way,original_price,applybill_status,out_trade_no,filter,product_type,order_status,applybill_type,applybill_taxnum,applybill_company,vip_starttime,vip_endtime,vip_type", "")
-		log.Println("odata:", oData)
 		//查询订单信息
 		if oData == nil || len(*oData) == 0 {
 			return &entity.FuncResult{false, errors.New("未找到此订单"), nil}
@@ -68,12 +67,6 @@ func (this *OrderListDetails) GetOrderPayAllMsg() {
 		if uData == nil || len(*uData) == 0 {
 			return &entity.FuncResult{false, errors.New("数据库查询异常"), nil}
 		}
-		//		//判断用户状态
-		//		uStatus, ok := util.MQFW.FindById("user", userId, `{"i_vip_status":1}`)
-		//		if uStatus == nil || len(*uStatus) == 0 || !ok {
-		//			return &entity.FuncResult{false, errors.New("数据库查询异常"), nil}
-		//		}
-		//		log.Println("udata:", uData)
 		if qutil.IntAll((*oData)["order_status"]) != 1 {
 			return &entity.FuncResult{true, nil, map[string]interface{}{
 				"order": oData,
@@ -433,7 +426,10 @@ func (o *OrderListDetails) SetRes(res []map[string]interface{}, queryM map[strin
 		//创建时间戳
 		create_time, _ := time.ParseInLocation(qutil.Date_Full_Layout, create_time_str, time.Local)
 		//48小时后的时间戳
-		create_time_stamp := create_time.AddDate(0, 0, 2).Unix()
+		//create_time_stamp_48 := create_time.AddDate(0, 0, 2).Unix()
+		//测试暂时改成1h
+		onehour, _ := time.ParseDuration("1h")
+		create_time_stamp := create_time.Add(onehour).Unix()
 		//当前时间时间戳
 		now_time_stamp := time.Now().Unix()
 		if create_time_stamp < now_time_stamp && qutil.ObjToString(v["product_type"]) == "VIP订阅" {

+ 107 - 61
src/jfw/modules/subscribepay/src/service/vipRenewUpgrade.go

@@ -16,7 +16,7 @@ import (
 	"util"
 
 	"github.com/go-xweb/xweb"
-	"gopkg.in/mgo.v2/bson"
+	//	"gopkg.in/mgo.v2/bson"
 )
 
 //订阅升级修改相关接口
@@ -43,14 +43,14 @@ func (this *RenewUpgrade) GetBuyMsg() {
 		end := time.Unix(endtime, 0).Format("2006-01-02")
 		now := time.Unix(time.Now().Unix(), 0).Format("2006-01-02")
 		vipStatus := (*data)["i_vip_status"]
-		isvalidOk := true
+		//		isvalidOk := true
 
-		str, oks := util.MQFW.FindOne("vip_upgrade", bson.M{"s_userid": userId, "i_isvalid": 0})
-		if oks && len(*str) > 0 && *str != nil {
-			area = (*str)["o_area"]
-			buyerclass = (*str)["a_buyerclass"]
-			isvalidOk = false
-		}
+		//		str, oks := util.MQFW.FindOne("vip_upgrade", bson.M{"s_userid": userId, "i_isvalid": 0})
+		//		if oks && len(*str) > 0 && *str != nil {
+		//			area = (*str)["o_area"]
+		//			buyerclass = (*str)["a_buyerclass"]
+		//			isvalidOk = false
+		//		}
 
 		dataArr := map[string]interface{}{
 			"area":       area,
@@ -63,7 +63,7 @@ func (this *RenewUpgrade) GetBuyMsg() {
 			"end":        end,
 			"now":        now,
 			"vipStatus":  vipStatus,
-			"isvalidOk":  isvalidOk,
+			//			"isvalidOk":  isvalidOk,
 		}
 		this.ServeJson(dataArr)
 	}
@@ -72,26 +72,50 @@ func (this *RenewUpgrade) GetBuyMsg() {
 //升级续费
 //创建订单返回支付串
 func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
-	area := qutil.ObjToMap(this.GetString("area"))                 //已购买区域+新增区域
-	industry := strings.Split(this.GetString("industry"), ",")     //已购买行业+新增行业
-	areas := qutil.ObjToMap(this.GetString("areas"))               //已购买区域
-	industrys := strings.Split(this.GetString("industryarr"), ",") //已购买行业
-	date := this.GetString("time")                                 //不延长时为空,正常为 年或月
-	payWay := this.GetString("payWay")                             //支付方式
-	effect := this.GetString("effect")                             //升级 生效日期 立即生效-now  下月一号生效-下月一号的时间戳
-	pay_source := this.GetString("pay_source")                     //类型  续费-Renew or 升级-Upgrade
+	areaArr := this.GetString("area")
+	var area *map[string]interface{}
+	if areaArr != "no" {
+		area = qutil.ObjToMap(this.GetString("area")) //新增区域
+	} else {
+		area = &map[string]interface{}{
+			"no": "no",
+		}
+	}
+	industryArr := this.GetString("industry")
+	var industry []string
+	if industryArr != "no" {
+		industry = strings.Split(this.GetString("industry"), ",") //新增行业
+	} else {
+		industry = append(industry, "no")
+	}
+	areas := qutil.ObjToMap(this.GetString("areas"))                 //已购买区域
+	industrys := strings.Split(this.GetString("industryarr"), ",")   //已购买行业
+	allArea := qutil.ObjToMap(this.GetString("allArea"))             //已购+新增区域
+	allIndustry := strings.Split(this.GetString("allIndustry"), ",") //已购+新增行业
+	date := this.GetString("time")                                   //不延长时为空,正常为 年或月
+	payWay := this.GetString("payWay")                               //支付方式
+	log.Println("payWay", payWay)
+	//	effect := this.GetString("effect")         //升级 生效日期 立即生效-now  下月一号生效-下月一号的时间戳
+	pay_source := this.GetString("pay_source") //类型  续费-Renew or 升级-Upgrade
 	userId := qutil.ObjToString(this.GetSession("userId"))
 	openId := qutil.ObjToString(this.GetSession("s_m_openid"))
-	isvalidOk, _ := this.GetBool("isvalidOk")
+	log.Println("area", area)
+	log.Println("industry", industry)
+	//	isvalidOk, _ := this.GetBool("isvalidOk")
 	r := func() *entity.FuncResult {
 		now := time.Now()
 		//数据校验
-		if len(industry) == 1 && industry[0] == "" { //去掉[""]
-			industry = []string{}
+		if (industry[0]) != "no" {
+			if len(industry) == 1 && industry[0] == "" { //去掉[""]
+				industry = []string{}
+			}
 		}
 		if len(industrys) == 1 && industrys[0] == "" { //去掉[""]
 			industrys = []string{}
 		}
+		if len(allIndustry) == 1 && allIndustry[0] == "" { //去掉[""]
+			allIndustry = []string{}
+		}
 		if !(pay_source == "Renew" || pay_source == "Upgrade") {
 			return &entity.FuncResult{false, errors.New("未知操作"), nil}
 		}
@@ -122,19 +146,20 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 		isRenew := true
 		if pay_source == "Upgrade" { //计算升级时间
 			isRenew = false
-			if effect == "now" { //立即生效
-				orderType = 3
-				//				startTime = time.Now()
-			} else { //下月生效
-				orderType = 4
-				//				startTime = time.Date(time.Now().Year(), time.Now().Month()+1, 1, 0, 0, 0, 0, time.Local)
-			}
-			if !isvalidOk {
-				orderType = 6
-			}
+			//			if effect == "now" { //立即生效
+			orderType = 3
+			startTime = time.Now()
+			//			} else { //下月生效
+			//				orderType = 4
+			//				startTime = time.Date(time.Now().Year(), time.Now().Month()+1, 1, 0, 0, 0, 0, time.Local)
+			//			}
+			//			if !isvalidOk {
+			//				orderType = 6
+			//			}
 		} else { //续费时间
 			orderType = 2 //续费操作
 			startTime = endTime
+			log.Println("startTime", startTime)
 		}
 		//		if date_unit == 1 { ///延长时间
 		//			endTime = endTime.AddDate(date_count, 0, 0)
@@ -145,15 +170,15 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 			endTime = util.GetDATE(date_unit, date_count, end)
 		}
 		log.Println("endend", endTime)
-		if pay_source == "Renew" && now.Unix() > end { //到期后的续费从当前时间往后延长
-			startTime = now
-			//			if date_unit == 1 { ///延长时间
-			//				endTime = startTime.AddDate(date_count, 0, 0)
-			//			} else if date_unit == 2 { //月
-			//				endTime = startTime.AddDate(0, date_count, 0)
-			//			}
-			endTime = util.GetDATE(date_unit, date_count, startTime.Unix())
-		}
+		//		if pay_source == "Renew" && now.Unix() > end { //到期后的续费从当前时间往后延长
+		//			startTime = now
+		//			//			if date_unit == 1 { ///延长时间
+		//			//				endTime = startTime.AddDate(date_count, 0, 0)
+		//			//			} else if date_unit == 2 { //月
+		//			//				endTime = startTime.AddDate(0, date_count, 0)
+		//			//			}
+		//			endTime = util.GetDATE(date_unit, date_count, startTime.Unix())
+		//		}
 		filter := entity.VipSimpleMsg{
 			area,
 			industry,
@@ -170,22 +195,48 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 		if pay_source == "Renew" {
 			totalfee = entity.JyVipSubStruct.GetSubVipPrice(area, industry, date_count, date_unit)
 		} else if pay_source == "Upgrade" {
-			upgradeYear, upgradeMonth := MaxUpgradeMonth(end, effect)                     //获取最大升级月数
-			addY := entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeYear, 1)  //已购+新增,以年为单位的价格
-			addM := entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeMonth, 2) //已购+新增,以月为单位的价格
-			addPrice := addM + addY                                                       //已购+新增总价格
-			log.Println("1", addPrice)
-			nowY := entity.JyVipSubStruct.GetSubVipPrice(areas, industrys, upgradeYear, 1)  //已购,以年为单位的价格
-			nowM := entity.JyVipSubStruct.GetSubVipPrice(areas, industrys, upgradeMonth, 2) //已购,以月为单位的价格
-			nowPrice := nowM + nowY                                                         //已购总价格
-			log.Println("2", nowPrice)
-			totalfee = addPrice - nowPrice //已购+新增的总价格 - 已购总价格 = 升级差价
-			if date_unit == 1 {            //升级中的延长时间
-				lengPrice := entity.JyVipSubStruct.GetSubVipPrice(area, industry, date_count, 1) //单位为年的已购+新增延长时间价格
-				totalfee = totalfee + lengPrice                                                  //已购+新增延长时间价格 + 升级差价 = 最终价格
+			upgradeYear, upgradeMonth := MaxUpgradeMonth(end) //获取最大升级月数
+			log.Println(upgradeYear)
+			log.Println(upgradeMonth)
+			addAreaY := 0
+			addAreaM := 0
+			oldAreaY := 0
+			oldAreaM := 0
+			addIndustryY := 0
+			addIndustryM := 0
+			if (*area)["no"] != "no" && industry[0] != "no" {
+				log.Println("1")
+				addAreaY = entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeYear, 1)
+				addAreaM = entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeMonth, 2)
+			}
+			if (*area)["no"] != "no" {
+				log.Println("2")
+				oldAreaY = entity.JyVipSubStruct.GetSubVipPrice(area, industrys, upgradeYear, 1)
+				oldAreaM = entity.JyVipSubStruct.GetSubVipPrice(area, industrys, upgradeMonth, 2)
+			}
+			if industry[0] != "no" {
+				log.Println("3")
+				addIndustryY = entity.JyVipSubStruct.GetSubVipPrice(areas, industry, upgradeYear, 1)
+				addIndustryM = entity.JyVipSubStruct.GetSubVipPrice(areas, industry, upgradeMonth, 2)
+			}
+			log.Println("addIndustryY", addIndustryY)
+			log.Println("addIndustryM", addIndustryM)
+			//			addY := entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeYear, 1)  //已购+新增,以年为单位的价格
+			//			addM := entity.JyVipSubStruct.GetSubVipPrice(area, industry, upgradeMonth, 2) //已购+新增,以月为单位的价格
+			//			addPrice := addM + addY                                                       //已购+新增总价格
+			//			log.Println("1", addPrice)
+			//			nowY := entity.JyVipSubStruct.GetSubVipPrice(areas, industrys, upgradeYear, 1)  //已购,以年为单位的价格
+			//			nowM := entity.JyVipSubStruct.GetSubVipPrice(areas, industrys, upgradeMonth, 2) //已购,以月为单位的价格
+			//			nowPrice := nowM + nowY                                                         //已购总价格
+			//			log.Println("2", nowPrice)
+			//			totalfee = addPrice - nowPrice //已购+新增的总价格 - 已购总价格 = 升级差价
+			totalfee = addAreaY + addAreaM + oldAreaY + oldAreaM + addIndustryY + addIndustryM
+			if date_unit == 1 { //升级中的延长时间
+				lengPrice := entity.JyVipSubStruct.GetSubVipPrice(allArea, allIndustry, date_count, 1) //单位为年的已购+新增延长时间价格
+				totalfee = totalfee + lengPrice                                                        //已购+新增延长时间价格 + 升级差价 = 最终价格
 			} else if date_unit == 2 {
-				lengPrice := entity.JyVipSubStruct.GetSubVipPrice(area, industry, date_count, 2) //单位为月的已购+新增延长时间价格
-				totalfee = totalfee + lengPrice                                                  //已购+新增延长时间价格 + 升级差价 = 最终价格
+				lengPrice := entity.JyVipSubStruct.GetSubVipPrice(allArea, allIndustry, date_count, 2) //单位为月的已购+新增延长时间价格
+				totalfee = totalfee + lengPrice                                                        //已购+新增延长时间价格 + 升级差价 = 最终价格
 			}
 		}
 		log.Println("price", totalfee)
@@ -224,6 +275,7 @@ func (this *RenewUpgrade) RenewUpgradeCreateOrder() {
 			}
 			prepayid = qutil.ObjToString((*ret)["prepayid"])
 			payStr = pay.WxStruct.GetAppWxPayStr(prepayid)
+			log.Println("tradeno", tradeno)
 		} else { //支付宝支付
 			var err error
 			payStr, tradeno, err = pay.Alipay.GetOrderPayParam((qutil.Float64All(totalfee)), "", pay.ALI_SUBVIP_APP)
@@ -321,7 +373,7 @@ func checkReqDates(dateStr string) (cyclecount, cycleunit int, err error) {
 }
 
 //获取最大升级月数
-func MaxUpgradeMonth(endTime int64, effect string) (int, int) {
+func MaxUpgradeMonth(endTime int64) (int, int) {
 	endYear := time.Unix(endTime, 0).Year()
 	endMonth := int(time.Unix(endTime, 0).Month())
 	endDay := time.Unix(endTime, 0).Day()
@@ -361,12 +413,6 @@ func MaxUpgradeMonth(endTime int64, effect string) (int, int) {
 		}
 	}
 
-	if effect != "now" {
-		nowUpgrade = nowUpgrade - 1
-	}
-	if nowUpgrade == 0 {
-		nowUpgrade = 1
-	}
 	//
 	var nowUpgradeYear = 0
 	if nowUpgrade >= 12 {

+ 7 - 3
src/web/templates/weixin/dataExport/dataExport_invoiceSuccess.html

@@ -31,18 +31,22 @@
             <a href="javascript:history.go(-1)" class="go_back"></a>
         </div>
         <script>
-        	var i=5;
+        	var i=3;
 			$(function(){
 			 	setTimeout(function(){
 			 	//如果再次进入此页面 不显示 缓存
 				 	window.location.href="javascript:history.go(-1)";
-				},5000);//5秒后返回首页
+				},3000);//3秒后返回首页
 				after();
 			});
 			//自动刷新页面上的时间
 			function after(){
 			 gobackHtml=""
-			 gobackHtml+='<a href="javascript:history.go(-1)" class="go_back">返回('+i+')</a>';
+			 if (i==0){
+			  gobackHtml+='<a href="javascript:history.go(-1)" class="go_back">返回</a>';
+			 }else{
+			  gobackHtml+='<a href="javascript:history.go(-1)" class="go_back">返回('+i+')</a>';
+			 }
 			 $(".go_back").empty().append(gobackHtml);
 			 if(i>0){
 			 	i=i-1;

+ 4 - 4
src/web/templates/weixin/vipsubscribe/choose_area_upgrade.html

@@ -365,8 +365,8 @@
         <div class="tips_btn">
             <div class="tips_discount">
                 <!--<div class="tips_d_money" style="display: block">&yen;38</div>-->
-                <div class="tips_d_text citys">已选择4个市,建议购买“全省”更划算哦~</div>
-                <div class="tips_d_text all">已选择10个省,建议购买“全国”更划算哦~</div>
+                <div class="tips_d_text citys">已选择4个市,建议购买“全省”</div>
+                <div class="tips_d_text all">已选择10个省,建议购买“全国”</div>
             </div>
             <div class="btns">
                 <button class="reset-btn">重置</button>
@@ -591,7 +591,7 @@
                   // 判断每个省份下选中的城市长度,当大于等于4的时候 弹出"选择全省更划算的弹窗"
                   let childrenArr=[];
                   if (children.length >= 4 && !this.vipSubisTrial) {
-                      $('.tips_btn .tips_d_text.citys').text("已选择"+children.length+"个市,建议购买“全省”更划算哦~");
+                      $('.tips_btn .tips_d_text.citys').text("已选择"+children.length+"个市,建议购买“全省”");
                       $('.tips_btn .tips_d_text.citys').show();
                   } 
                   html += `${result[i].name}(`
@@ -627,7 +627,7 @@
 	            }
 	        }
           	if(provincesArr.length > 9){
-          		$('.tips_d_text.all').text("已选择"+provincesArr.length+"个省,建议购买“全国”更划算哦~");
+          		$('.tips_d_text.all').text("已选择"+provincesArr.length+"个省,建议购买“全国”");
           		$('.tips_d_text.all').show();
           		$('.tips_d_text.citys').hide();
           	}else{

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

@@ -243,7 +243,7 @@
             <div class="tips_btn">
                 <div class="tips_discount">
                     <!--<div class="tips_d_money" style="display: block">&yen;38</div>-->
-                    <div class="tips_d_text">已选择4个行业,建议购买“全部行业”更划算哦~</div>
+                    <div class="tips_d_text">已选择4个行业,建议购买“全部行业”~</div>
                 </div>
                 <div class="btns">
                     <button class="reset-btn">重置</button>
@@ -292,7 +292,7 @@
                 
                 // 显示隐藏优惠tips
                 if (selectedArr.length >= 4 && !vipSubisTrial) {
-                	$('.tips_btn .tips_d_text').text("已选择"+selectedArr.length+"个行业,建议购买“全部行业”更划算哦~");
+                	$('.tips_btn .tips_d_text').text("已选择"+selectedArr.length+"个行业,建议购买“全部行业”");
                     $('.tips_btn .tips_d_text').slideDown();
                 } else {
                     $('.tips_btn .tips_d_text').slideUp()

+ 42 - 22
src/web/templates/weixin/vipsubscribe/renew_notice.html

@@ -17,6 +17,13 @@
 		body,html {
 			height: 100%;
 		}
+		.aginBuy{
+			height: 0.94rem;
+		    font-size: .34rem;
+		    color: #fff;
+		    background-color: #2cb7ca;
+		    border-radius: .08rem;
+		}
 	</style>
 	<body>
 		<script type="text/javascript">
@@ -53,6 +60,7 @@
             </div>
 			<div class="renew_box">
                 <button style="display: none;" class="renew_service" onclick="window.location.href='/weixin/pay/renewPayPage'">续费</button>
+                <button style="display: none;" class="aginBuy" onclick="window.location.href='/weixin/pay/vipsubscribe_willExpire'">再次购买</button>
                 <button style="display: none;" class="free_service" onclick="window.location.href='/swordfish/historypush'">使用免费订阅</button>
             </div>
 		</div>
@@ -76,39 +84,44 @@
 						var buyerclass = r.buyerclass
 						var exprie = {{.T.exprie}};
 						var vipStatus = Number(r.vipStatus);
-						var areaArr = [];
-					    var areaHtml = "";
+						var areaHtml = "";
+					    var provinceArr = [];
+					    var cityArr = [];
 					    var buyerclassArr = [];
 					    var buyerclassHtml = "";
 					    var endstime = new Date(ends).getTime();
 						if (area !== "" && area !== undefined){
 					    	for(var province in area){
 					    		var citys = area[province]
-			//		    		console.log(citys);
+				//	    		console.log(citys);
 					    		if(citys.length===0){
-					    			areaArr.push(province);
+					    			provinceArr.push(province);
 					    		}else{
 					    			for(var i in citys){
-					    				areaArr.push(citys[i]);
+					    				var city = citys[i];
+					    				cityArr.push(city);
 					    			}
 					    		}
 					    	}
-					    	areaHtml = areaArr.toString().replace(/,/g, "、");
-					    	if(checkObj(area)){
+					    	var provinceLen = provinceArr.length;
+					 		var cityLen = cityArr.length;
+					    	areaHtml = provinceLen+"个省级区域、"+cityLen+"个市";
+					    	
+							if(checkObj(area)){
 								areaHtml = "全国";
 							}
-					    	$('.area-list').text(areaHtml);
+					    	$(".area-list").text(areaHtml);
 					    }
 					    if(buyerclass !== "" && buyerclass !== undefined){
 					    	for(var i in buyerclass){
 					    		var industry = buyerclass[i];
 					    		buyerclassArr.push(industry);
+					    		buyerclassHtml = buyerclassArr.length+"个行业";
 					    	}
-					    	buyerclassHtml = buyerclassArr.toString().replace(/,/g, "、");
 					    	if(checkObj(buyerclass)){
 					    		buyerclassHtml = "全行业";
 					    	}
-							$('.industry-list').text(buyerclassHtml);
+					    	$('.industry-list').text(buyerclassHtml);
 					    }
 					    if(starts !== "" && ends !== ""){
 					    	let start = starts.toString().replace(/-/g, ".");
@@ -129,8 +142,9 @@
 						    	$(".recommend_title").text("以下区域、行业的订阅推送即将停止,为了不影响您的使用,请立即续费!")
 					    	}
 					    }else{
-					    	$(".renew_service").show();
-					    	$(".free_service").show();
+//					    	$(".renew_service").show();
+					    	$(".aginBuy").show();
+					  	  	$(".free_service").show();
 					    }
 					}
 				});
@@ -144,8 +158,9 @@
 					    var exprie = {{.T.exprie}};
 					    var vipStatus = Number(data.vipStatus);
 					    //
-					    var areaArr = [];
 					    var areaHtml = "";
+					    var provinceArr = [];
+					    var cityArr = [];
 					    var buyerclassArr = [];
 					    var buyerclassHtml = "";
 				//	    var dateName = "";
@@ -153,31 +168,35 @@
 					    if (area !== "" && area !== undefined){
 					    	for(var province in area){
 					    		var citys = area[province]
-			//		    		console.log(citys);
+				//	    		console.log(citys);
 					    		if(citys.length===0){
-					    			areaArr.push(province);
+					    			provinceArr.push(province);
 					    		}else{
 					    			for(var i in citys){
-					    				areaArr.push(citys[i]);
+					    				var city = citys[i];
+					    				cityArr.push(city);
 					    			}
 					    		}
 					    	}
-					    	areaHtml = areaArr.toString().replace(/,/g, "、");
-					    	if(checkObj(area)){
+					    	var provinceLen = provinceArr.length;
+					 		var cityLen = cityArr.length;
+					    	areaHtml = provinceLen+"个省级区域、"+cityLen+"个市";
+					    	
+							if(checkObj(area)){
 								areaHtml = "全国";
 							}
-					    	$('.area-list').text(areaHtml);
+					    	$(".area-list").text(areaHtml);
 					    }
 					    if(buyerclass !== "" && buyerclass !== undefined){
 					    	for(var i in buyerclass){
 					    		var industry = buyerclass[i];
 					    		buyerclassArr.push(industry);
+					    		buyerclassHtml = buyerclassArr.length+"个行业";
 					    	}
-					    	buyerclassHtml = buyerclassArr.toString().replace(/,/g, "、");
 					    	if(checkObj(buyerclass)){
 					    		buyerclassHtml = "全行业";
 					    	}
-							$('.industry-list').text(buyerclassHtml);
+					    	$('.industry-list').text(buyerclassHtml);
 					    }
 				//	    if(cycleunit !== "" && cycleunit !== undefined){
 				//	    	if(cycleunit === 1){
@@ -198,7 +217,8 @@
 					    	$("#exprie").text("VIP订阅服务即将到期,请及时续费")
 					    	$(".recommend_title").text("以下区域、行业的订阅推送即将停止,为了不影响您的使用,请立即续费!")
 					    }else{
-					    	$(".renew_service").show();
+//					    	$(".renew_service").show();
+							$(".aginBuy").show();
 					    	$(".free_service").show();
 					    }
 					}

+ 4 - 8
src/web/templates/weixin/vipsubscribe/renew_pay.html

@@ -596,7 +596,6 @@
 			    monthPrice = getsubVipOrderPrice(area, buyerclass, [1, 2]);
 			    yearPrice = getsubVipOrderPrice(area, buyerclass, [1, 1]);
 			    //
-			    var areaArr = [];
 			    var areaHtml = "";
 			    var provinceArr = [];
 			    var cityArr = [];
@@ -609,17 +608,17 @@
 			    		var citys = area[province]
 		//	    		console.log(citys);
 			    		if(citys.length===0){
-			    			areaArr.push(province);
 			    			provinceArr.push(province);
 			    		}else{
 			    			for(var i in citys){
 			    				var city = citys[i];
-			    				areaArr.push(city);
 			    				cityArr.push(city);
 			    			}
 			    		}
 			    	}
-			    	areaHtml = areaArr.toString().replace(/,/g, "、");
+			    	var provinceLen = provinceArr.length;
+			 		var cityLen = cityArr.length;
+			    	areaHtml = provinceLen+"个省级区域、"+cityLen+"个市";
 			    	
 					if(checkObj(area)){
 						areaHtml = "全国";
@@ -630,7 +629,7 @@
 			    	for(var i in buyerclass){
 			    		var industry = buyerclass[i];
 			    		buyerclassArr.push(industry);
-			    		buyerclassHtml = buyerclassArr.toString().replace(/,/g, "、");
+			    		buyerclassHtml = buyerclassArr.length+"个行业";
 			    	}
 			    	if(checkObj(buyerclass)){
 			    		buyerclassHtml = "全行业";
@@ -698,9 +697,6 @@
 			 		$(".renew_update").hide();
 			 		$(".renew_upgrade").show();
 			 	}
-			 	//
-			 	var provinceLen = provinceArr.length;
-			 	var cityLen = cityArr.length;
 		    }
         }, false);
         //

+ 4 - 6
src/web/templates/weixin/vipsubscribe/trial_info.html

@@ -15,9 +15,9 @@
     <link rel="stylesheet" href="/vipsubscribe/css/trial_info.css?v={{Msg "seo" "version"}}">
 </head>
 
-<body style="height: 100vh">
+<body style="height: 100vh; background: #34355A;">
 <div class="trial_info">
-    <form class="form" id="formInfo">
+    <form class="form">
         <div class="trial_body">
             <div class="banner">
                 <div class="shadow"></div>
@@ -161,7 +161,7 @@
             }
         });
         //提交
-        $('#formInfo').submit(function (e) {
+        $(".btn").on("click",function (e) {
             var name = $('.name').val();
             var tel = $('.phone').val();
             var code = $('.phonecode').val();
@@ -180,7 +180,6 @@
                     window.location.replace("/weixin/pay/vipsubscribe_trial");
                 }
             });
-            return false;
         });
     });
 
@@ -232,9 +231,8 @@
         })
     }
     {{else}}
-    $('#formInfo').submit(function (e) {
+    $(".btn").on("click",function (e) {
         window.location.replace("/weixin/pay/vipsubscribe_trial");
-        return false;
     });
     {{end}}
 

+ 27 - 9
src/web/templates/weixin/vipsubscribe/vip_order_detail.html

@@ -132,19 +132,19 @@
                     </div>
                     <div class="card-content">
                         <div class="item-list">
-                            <label>订阅区域:</label>
+                            <label class="dyqy">订阅区域:</label>
                             <ul class="item-list-parents">
                                 <li class="areaNum"></li>
                             </ul>
                         </div>
                         <div class="item-list">
-                            <label>订阅行业:</label>
+                            <label class="dyhy">订阅行业:</label>
                             <ul class="item-list-parents">
                                 <li><span class="industryNum"></span></li>
                             </ul>
                         </div>
                         <div class="item-list">
-                            <label>订阅周期:</label>
+                            <label class="dyzq">订阅周期:</label>
                             <ul class="item-list-parents">
                                 <li><span class="cyclecount"></li>
                             </ul>
@@ -224,11 +224,7 @@ try{
         	$(".productType").text(r.data.order.product_type+"(试用)");
         }
         //1 续费 2升级
-        if(r.data.order.vip_type==1){
-        	$(".productType").text(r.data.order.product_type+"(续费)");
-        }else if(r.data.order.vip_type==2){
-        	$(".productType").text(r.data.order.product_type+"(升级)");
-        }
+
         //价格
         $(".price").text(r.data.order.original_price/100);
         
@@ -316,6 +312,27 @@ try{
 	           $(".cyclecount").text(filterObj.cyclecount+"天")
 	      }
        }
+       
+        if(r.data.order.vip_type==1){
+        	$(".productType").text(r.data.order.product_type+"(续费)");
+        	$(".dyqy").text("续费区域:");
+        	$(".dyhy").text("续费行业:");
+        	$(".dyzq").text("续费周期:");
+        }else if(r.data.order.vip_type==2){
+        	$(".productType").text(r.data.order.product_type+"(升级)");
+        	if(filterObj.cycleunit==1){
+		        $(".cyclecount").text(filterObj.cyclecount+"年")
+		    }else if(filterObj.cycleunit==2){
+		        $(".cyclecount").text(filterObj.cyclecount+"个月")
+		    }else if(filterObj.cycleunit==3){
+		        $(".cyclecount").text(filterObj.cyclecount+"天")
+		    }else if (filterObj.cycleunit==-1){
+		        $(".cyclecount").text("不延期");
+		    }
+        	$(".dyqy").text("升级区域:");
+        	$(".dyhy").text("升级行业:");
+        	$(".dyzq").text("延长周期:");
+        }
         
         if(r.data.order.order_status==0){       	
           //未支付
@@ -412,7 +429,8 @@ try{
 	    	//倒计时 未购买
 			var create_time=r.data.order.create_time;
 			create_time=create_time.replace(/-/g,'/')
-			var clock_end = +new Date(create_time) + 172800000;
+			//var clock_end = +new Date(create_time) + 172800000;
+			var clock_end = +new Date(create_time) + 3600000;
 			setTimeFunc(clock_end); 
 			setInterval(function(){
 				setTimeFunc(clock_end);

+ 4 - 4
src/web/templates/weixin/vipsubscribe/vip_purchase.html

@@ -383,13 +383,13 @@
                             } else {
                                 purchase.industrySelect = ["全部行业"]
                             }
-                            if (r.timeSelect!=undefined&&r.company!=undefined){
-                           		purchase.timeSelect=[r.timeSelect,r.company];
-                            }
+//                          if (r.timeSelect!=undefined&&r.company!=undefined){
+//                         		purchase.timeSelect=[r.timeSelect,r.company];
+//                          }
                             $(".weui-icon-checked").click();
                             sessionStorage.setItem("vipSubSelectArea", JSON.stringify(purchase.areaSelect));
                             sessionStorage.setItem("vipSubSelectIndustry", JSON.stringify(purchase.industrySelect));
-                            sessionStorage.setItem("vipSubSelectTime", JSON.stringify(purchase.timeSelect));
+                            //sessionStorage.setItem("vipSubSelectTime", JSON.stringify(purchase.timeSelect));
                           
                         }, false)
                     }

+ 403 - 218
src/web/templates/weixin/vipsubscribe/vip_upgrade.html

@@ -47,18 +47,18 @@
                 <li class="choose_item">
                     <a href="/front/vipsubscribe/toChooseAreaUpgrade">
                         <span class="label">区域</span>
-                        <input type="text" id="area" value="" disabled placeholder="选择全国、省份、地市" class="info">
+                        <input type="text" id="area" value="" disabled placeholder="选择升级区域" class="info">
                         <i class="iconfont icon-arrow"></i>
                     </a>
-                    <p class="add_tips area-list" style="display: none;">已新增 1 个省级区域、4 个地市</p>
+                    <!--<p class="add_tips area-list" style="display: none;">已新增 1 个省级区域、4 个地市</p>-->
                 </li>
                 <li class="choose_item">
                     <a href="/front/vipsubscribe/toChooseIndustryUpgrade">
                         <span class="label">行业</span>
-                        <input type="text" id="buyerclass" disabled value="" placeholder="选择采购单位行业" class="info">
+                        <input type="text" id="buyerclass" disabled value="" placeholder="选择升级行业" class="info">
                         <i class="iconfont icon-arrow"></i>
                     </a>
-                    <p class="add_tips industry-list" style="display: none;">已新增 2 个行业</p>
+                    <!--<p class="add_tips industry-list" style="display: none;">已新增 2 个行业</p>-->
                 </li>
                 <!-- <li class="choose_item select_cycle">
                     <a href="javascript:;">
@@ -67,13 +67,13 @@
                         <i class="iconfont icon-arrow choose_time"></i>
                     </a>
                 </li> -->
-                <li class="choose_item choose_effect_date">
+                <!--<li class="choose_item choose_effect_date">
                     <a href="javascript:;">
                         <span class="label">生效日期</span>
                         <span class="info" id="effect_date_name">立即生效,需支付当月费用差价</span>
                         <i class="iconfont icon-arrow choose_time"></i>
                     </a>
-                </li>
+                </li>-->
             </ul>
             <ul class="chooseList">
                 <li class="choose_item lengthen">
@@ -131,8 +131,7 @@
                         </table>
                         <dl class="tips">
                             <dt>购买须知:</dt>
-                            <dd>套餐周期内,不支持套餐降级,续费可降级;</dd>
-                            <dd>用户最多购买/续费3年套餐;</dd>
+                            <dd>套餐周期内,不支持套餐降级,即将到期时续费可降级;</dd>
                             <dd>支持套餐升级,补差价(按月进行补差价,不足一个月按一个月计算)。</dd>
                         </dl>
                     </div>
@@ -240,7 +239,7 @@
             </div>
         </div>
         <!-- 选择生效日期 -->
-        <div class="js_dialog effective_date" id="effective_date" style="display: none;">
+        <!--<div class="js_dialog effective_date" id="effective_date" style="display: none;">
             <div class="weui-mask"></div>
             <div class="box">
                 <div class="box_hd">
@@ -273,7 +272,7 @@
                     </div>
                 </div>
             </div>
-        </div>
+        </div>-->
         <!-- 选择支付方式 -->
         <div class="js_dialog pay_way" id="pay_way" style="display: none;">
             <div class="weui-mask"></div>
@@ -443,62 +442,62 @@
 //          $('.pay_mode .select_payment .choose_way.info').html(checkValue);
 //      });
          // 选择生效日期
-        $('.choose_effect_date > a').click(function () {
-            $('#effective_date').show(200);
-			var nowMonths = new Date().getMonth()+1;
-			var nowYears = new Date().getFullYear();
-			var as = nowMonths +1;
-			if(as > 12){
-				as = as-12;
-				nowYears = nowYears +1;
-			}
-			var bs = nowYears+"/"+as+"/1";
-			var effects = new Date(bs).getTime() /1000;
-			var a = nowYears+"."+as+".01";
-			$(".notnownow").text(a + " - " + endTime.replace(/-/g, "."))
-			if(ends < effects){
-				$(".effect_next").hide();
-//				$(".box").css("height", "2.7rem");
-			}
-			if(!isvalidOk){
-				console.log(isvalidOk)
-				$(".effect_one").hide();
-				$(".effective_name").each(function(){
-		    		if($(this).text() === effectiveNames){
-		    			$(this).parent().next().find("input").prop("checked", true);
-		    		}
-		    	})
-			}
-        })
+//      $('.choose_effect_date > a').click(function () {
+//          $('#effective_date').show(200);
+//			var nowMonths = new Date().getMonth()+1;
+//			var nowYears = new Date().getFullYear();
+//			var as = nowMonths +1;
+//			if(as > 12){
+//				as = as-12;
+//				nowYears = nowYears +1;
+//			}
+//			var bs = nowYears+"/"+as+"/1";
+//			var effects = new Date(bs).getTime() /1000;
+//			var a = nowYears+"."+as+".01";
+//			$(".notnownow").text(a + " - " + endTime.replace(/-/g, "."))
+//			if(ends < effects){
+//				$(".effect_next").hide();
+////				$(".box").css("height", "2.7rem");
+//			}
+//			if(!isvalidOk){
+//				console.log(isvalidOk)
+//				$(".effect_one").hide();
+//				$(".effective_name").each(function(){
+//		    		if($(this).text() === effectiveNames){
+//		    			$(this).parent().next().find("input").prop("checked", true);
+//		    		}
+//		    	})
+//			}
+//      })
         //
-		var effectiveName = new Date().getMonth()+2;
-		if(effectiveName > 12){
-	    	effectiveName = effectiveName - 12
-	   	}
-		var effectiveNames = effectiveName+"月1日生效"
-		$(".effective_name.notnow").text(effectiveNames);
-		$('#nextMonth').val(effectiveNames);
+//		var effectiveName = new Date().getMonth()+2;
+//		if(effectiveName > 12){
+//	    	effectiveName = effectiveName - 12
+//	   	}
+//		var effectiveNames = effectiveName+"月1日生效"
+//		$(".effective_name.notnow").text(effectiveNames);
+//		$('#nextMonth').val(effectiveNames);
 		
         // 对生效日期方式选择的input绑定点击事件
-        $('#effective_date input:radio[name="date"]').click(function () {
-            var checkValue = $('input:radio[name="date"]:checked').val();
-//          console.log(checkValue);
-            $('#effective_date').hide(200);
-            var effective = "";
-            var effectiveName = new Date().getMonth()+2;
-            if(effectiveName > 12){
-	    		effectiveName = effectiveName - 12
-	    	}
-            var effectiveNames = effectiveName+"月1日生效"
-            if(checkValue === "立即生效,需支付当月费用差价"){
-            	effective = "now";
-            }else if(checkValue === effectiveNames){
-            	effective = "notnow";
-            }
-            sessionStorage.effectiveDate = effective;
-            $('#effect_date_name').html(checkValue);
-            FinallyPrice();
-        });
+//      $('#effective_date input:radio[name="date"]').click(function () {
+//          var checkValue = $('input:radio[name="date"]:checked').val();
+////          console.log(checkValue);
+//          $('#effective_date').hide(200);
+//          var effective = "";
+//          var effectiveName = new Date().getMonth()+2;
+//          if(effectiveName > 12){
+//	    		effectiveName = effectiveName - 12
+//	    	}
+//          var effectiveNames = effectiveName+"月1日生效"
+//          if(checkValue === "立即生效,需支付当月费用差价"){
+//          	effective = "now";
+//          }else if(checkValue === effectiveNames){
+//          	effective = "notnow";
+//          }
+//          sessionStorage.effectiveDate = effective;
+//          $('#effect_date_name').html(checkValue);
+//          FinallyPrice();
+//      });
         
         
         // 选择周期
@@ -786,13 +785,17 @@
 			}
 			var provinceLen = provinceArr.length;
 			var cityLen = cityArr.length;
+			var areaHtml = "";
 			if(isAll === ""){
-				$(".area-list").text("已新增 "+ provinceLen +" 个省级区域、"+ cityLen +" 个地市");
+				areaHtml = "已新增 "+ provinceLen +" 个省级区域、"+ cityLen +" 个地市";
+				$("#area").attr("placeholder", areaHtml);
 			}else{
-				$(".area-list").text("已新增为 : 全国");
+				areaHtml = "已新增全国";
+				$("#area").attr("placeholder", areaHtml);
 			}
 			if(provinceLen === 0 && cityLen === 0){
-				$(".area-list").hide();
+				areaHtml = "选择升级区域";
+				$("#area").attr("placeholder", areaHtml);
 			}
 	    }
 	    //新增行业
@@ -800,7 +803,8 @@
 	    	var vipSubSelectIndustry = JSON.parse(sessionStorage.vipSubSelectIndustryUpgrade);
 	    	var industryArr = [];
 	    	var isAll = "";
-	    	$(".industry-list").show();
+	    	var industryHtml = "";
+//	    	$(".industry-list").show();
 	    	for(var i in vipSubSelectIndustry){
 	    		var industry = vipSubSelectIndustry[i];
 	    		industryArr.push(industry);
@@ -810,34 +814,37 @@
 	    	}
 	    	var industryLen = industryArr.length
 	    	if(isAll === ""){
-				$(".industry-list").text("已新增 "+ industryLen +" 个行业");
+	    		industryHtml = "已新增 "+ industryLen +" 个行业";
+				$("#buyerclass").attr("placeholder", industryHtml);
 			}else{
-				$(".industry-list").text("已新增为 : 全部行业");
+				industryHtml = "已新增全行业";
+				$("#buyerclass").attr("placeholder", industryHtml);
 			}
 			if(industryLen === 0){
-				$(".industry-list").hide();
+				industryHtml = "选择升级行业";
+				$("#buyerclass").attr("placeholder", industryHtml);
 			}
 	    }
 	    //生效时间
-	    if(sessionStorage.effectiveDate !== ""&&sessionStorage.effectiveDate!==undefined){
-	    	var effective = sessionStorage.effectiveDate;
-	    	var effectiveHtml = "";
-	    	if(effective === "now"){
-	    		effectiveHtml = "立即生效,需支付当月费用差价";
-	    	}else if(effective === "notnow"){
-	    		var effectiveName = new Date().getMonth()+2;
-	    		if(effectiveName > 12){
-	    			effectiveName = effectiveName - 12
-	    		}
-	    		effectiveHtml = effectiveName+"月1日生效";
-	    	}
-	    	$(".effective_name").each(function(){
-	    		if($(this).text() === effectiveHtml){
-	    			$(this).parent().next().find("input").prop("checked", true);
-	    		}
-	    	})
-	    	$('#effect_date_name').html(effectiveHtml);
-	    }
+//	    if(sessionStorage.effectiveDate !== ""&&sessionStorage.effectiveDate!==undefined){
+//	    	var effective = sessionStorage.effectiveDate;
+//	    	var effectiveHtml = "";
+//	    	if(effective === "now"){
+//	    		effectiveHtml = "立即生效,需支付当月费用差价";
+//	    	}else if(effective === "notnow"){
+//	    		var effectiveName = new Date().getMonth()+2;
+//	    		if(effectiveName > 12){
+//	    			effectiveName = effectiveName - 12
+//	    		}
+//	    		effectiveHtml = effectiveName+"月1日生效";
+//	    	}
+//	    	$(".effective_name").each(function(){
+//	    		if($(this).text() === effectiveHtml){
+//	    			$(this).parent().next().find("input").prop("checked", true);
+//	    		}
+//	    	})
+//	    	$('#effect_date_name').html(effectiveHtml);
+//	    }
 //	    //支付方式
 //	    if(sessionStorage.payType!==""&&sessionStorage.payType!==undefined){
 //	    	var payType = sessionStorage.payType;
@@ -893,7 +900,7 @@
 	    var starts = "";
 	    var endTime = "";
 	    var ends = "";
-	    var isvalidOk = "";
+//	    var isvalidOk = "";
 	 	$DoPost("/subscribepay/renewUpgrade/getBuyMsg", {}, function (data) {
             if (data) {
                 area = data.area;
@@ -904,58 +911,61 @@
 			    starts = data.starttime;
 			    endTime = data.end;
 			    ends = data.endtime;
-			    isvalidOk = data.isvalidOk;
+//			    isvalidOk = data.isvalidOk;
 			    //
-			    var areaArr = [];
-			    var areaHtml = "";
-			    var buyerclassArr = [];
-			    var buyerclassHtml = "";
+//			    var provinceArr = [];
+//			    var cityArr = [];
+//			    var areaHtml = "";
+//			    var buyerclassArr = [];
+//			    var buyerclassHtml = "";
 		//	    var dateName = "";
 		//	    var dateHtml = "";
-			    if (area !== "" && area !== undefined){
-			    	for(var province in area){
-			    		var citys = area[province]
-		//	    		console.log(citys);
-			    		if(citys.length===0){
-			    			areaArr.push(province);
-			    		}else{
-			    			for(var i in citys){
-			    				areaArr.push(citys[i]);
-			    			}
-			    		}
-			    	}
-			    	areaHtml = areaArr.toString().replace(/,/g, " ");
-		//	    	$(".item_area .label_for").text(areaHtml);
-					if(checkObj(area)){
-						areaHtml = "全国";
-					}
-			    	$('#area').attr("placeholder",areaHtml);
-			    }
-			    if(buyerclass !== "" && buyerclass !== undefined){
-			    	for(var i in buyerclass){
-			    		var industry = buyerclass[i];
-			    		buyerclassArr.push(industry);
-			    		buyerclassHtml = buyerclassArr.toString().replace(/,/g, " ");
-			    	}
-		//	    	$(".item_industry .label_for").text(buyerclassHtml);
-					if(checkObj(buyerclass)){
-						buyerclassHtml = "全行业";
-					}
-					$('#buyerclass').attr("placeholder",buyerclassHtml);
-			    }
-			    //
-			    var nowDate = data.now.replace(/-/g, ".");
-			    var a = nowDate+ " - " +endTime;
-			    $(".nownow").text(nowDate+ " - " +endTime.replace(/-/g, "."))
+//			    if (area !== "" && area !== undefined){
+//			    	for(var province in area){
+//			    		var citys = area[province]
+//		//	    		console.log(citys);
+//			    		if(citys.length===0){
+//			    			provinceArr.push(province);
+//			    		}else{
+//			    			for(var i in citys){
+//			    				cityArr.push(citys[i]);
+//			    			}
+//			    		}
+//			    	}
+//			    	var provinceLen = provinceArr.length;
+//			 		var cityLen = cityArr.length;
+//			    	areaHtml = "已购买"+provinceLen+"个省级区域/"+cityLen+"个市";
+//		//	    	$(".item_area .label_for").text(areaHtml);
+//					if(checkObj(area)){
+//						areaHtml = "已购买全国";
+//					}
+//			    	$('#area').attr("placeholder",areaHtml);
+//			    }
+//			    if(buyerclass !== "" && buyerclass !== undefined){
+//			    	for(var i in buyerclass){
+//			    		var industry = buyerclass[i];
+//			    		buyerclassArr.push(industry);
+//			    		buyerclassHtml = "已购买"+buyerclassArr.length+"个行业";
+//			    	}
+//		//	    	$(".item_industry .label_for").text(buyerclassHtml);
+//					if(checkObj(buyerclass)){
+//						buyerclassHtml = "已购买全行业";
+//					}
+//					$('#buyerclass').attr("placeholder",buyerclassHtml);
+//			    }
+//			    //
+//			    var nowDate = data.now.replace(/-/g, ".");
+//			    var a = nowDate+ " - " +endTime;
+//			    $(".nownow").text(nowDate+ " - " +endTime.replace(/-/g, "."))
 			    //
-			    if(!isvalidOk){
-			    	var effectiveName = new Date().getMonth()+2;
-		    		if(effectiveName > 12){
-		    			effectiveName = effectiveName - 12
-		    		}
-		    		effectiveHtml = effectiveName+"月1日生效";
-		    		$("#effect_date_name").text(effectiveHtml);
-			    }
+//			    if(!isvalidOk){
+//			    	var effectiveName = new Date().getMonth()+2;
+//		    		if(effectiveName > 12){
+//		    			effectiveName = effectiveName - 12
+//		    		}
+//		    		effectiveHtml = effectiveName+"月1日生效";
+//		    		$("#effect_date_name").text(effectiveHtml);
+//			    }
 			}
         },false);
         //
@@ -965,22 +975,25 @@
         var oldMonthPrice = 0;
         var areasArr = {};
 	    var industrysArr = [];
+	    var allArea = {};
+	    var allIndustry = [];
 	    var nowRenew = "";
         function FinallyPrice(){
         	$(".save_upgrade").attr('disabled','disabled');
 	    	var nowUpgrade = "";
 			//
-			var nowMonth = new Date(startTime).getMonth()+1;
-			var nowYear = new Date(startTime).getFullYear();
-			var nowDay = new Date(startTime).getDate();
+			var nowMonth = new Date().getMonth()+1;
+			var nowYear = new Date().getFullYear();
+			var nowDay = new Date().getDate();
 			//
 			var endMonth = new Date(endTime).getMonth()+1;
 			var endYear = new Date(endTime).getFullYear();
 			var endDay = new Date(endTime).getDate();
 			var oldPrice = "";
 			var price = "";
-			var effect = "";
+//			var effect = "";
 			var buyCheck = true;
+			var cPrice = 0;
 			if(sessionStorage.buyCheck!==undefined&&sessionStorage.buyCheck!==""){
 				let bcheck = sessionStorage.buyCheck;
 				if(bcheck === "true"){
@@ -991,26 +1004,42 @@
 			}
 			if(sessionStorage.vipSubSelectAreaUpgrade!==""&&sessionStorage.vipSubSelectAreaUpgrade!==undefined){
 				var vipArea = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
+				for(let province in vipArea){
+		    		let citys = vipArea[province];
+		    		if(citys.length===0){
+						areasArr[province] = [];
+		    		}else{
+		    			areasArr[province] = citys;
+		    		}
+		    	}
+				for(let province in vipArea){
+		    		if(province === "全国"){
+						areasArr = {"全国":[]};
+					}
+		    	}
+				if(buyCheck){
+					$(".save_upgrade").removeAttr("disabled");
+				}
 				if(area !== ""&&area !== undefined){
 					for(let province in area){
 			    		let citys = area[province];
 			    		if(citys.length===0){
-							areasArr[province] = [];
+							allArea[province] = [];
 			    		}else{
-			    			areasArr[province] = citys;
+			    			allArea[province] = citys;
 			    		}
 			    	}
 					for(let province in vipArea){
 						let citys = vipArea[province];
-						if(areasArr[province] === undefined){
-							areasArr[province] = citys
+						if(allArea[province] === undefined){
+							allArea[province] = citys
 						}else{
 							let cityArr = [];
 							for(let i in citys){
 								cityArr.push(citys[i]);
 							}
-							for(let i in areasArr[province]){
-								cityArr.push(areasArr[province][i]);
+							for(let i in allArea[province]){
+								cityArr.push(allArea[province][i]);
 							}
 							//
 							for (var x = 0; x < cityArr.length; x++) {
@@ -1022,42 +1051,105 @@
 					            }
 					       	}
 							//
-							areasArr[province] = cityArr;
+							allArea[province] = cityArr;
 						}
 						if(province === "全国"){
-							areasArr = {"全国":[]};
+							allArea = {"全国":[]};
 						}
 					}
 				}
-				console.log($(".save_upgrade").attr("disabled"))
-				if(buyCheck){
-					$(".save_upgrade").removeAttr("disabled");
-				}
 			}else{
+				areasArr = null;
 				if(area !== ""&&area !== undefined){
 					for(let province in area){
 			    		let citys = area[province];
 			    		if(citys.length===0){
-							areasArr[province] = [];
+							allArea[province] = [];
 			    		}else{
-			    			areasArr[province] = citys;
+			    			allArea[province] = citys;
 			    		}
 			    	}
 				}
 			}
+//			if(sessionStorage.vipSubSelectAreaUpgrade!==""&&sessionStorage.vipSubSelectAreaUpgrade!==undefined){
+//				var vipArea = JSON.parse(sessionStorage.vipSubSelectAreaUpgrade);
+//				if(area !== ""&&area !== undefined){
+//					for(let province in area){
+//			    		let citys = area[province];
+//			    		if(citys.length===0){
+//							areasArr[province] = [];
+//			    		}else{
+//			    			areasArr[province] = citys;
+//			    		}
+//			    	}
+//					for(let province in vipArea){
+//						let citys = vipArea[province];
+//						if(areasArr[province] === undefined){
+//							areasArr[province] = citys
+//						}else{
+//							let cityArr = [];
+//							for(let i in citys){
+//								cityArr.push(citys[i]);
+//							}
+//							for(let i in areasArr[province]){
+//								cityArr.push(areasArr[province][i]);
+//							}
+//							//
+//							for (var x = 0; x < cityArr.length; x++) {
+//					            for (var j =x+1; j <cityArr.length; ) {
+//					                if (cityArr[x] === cityArr[j]){
+//					                    cityArr.splice(j, 1);
+//					                }
+//					                else j++;
+//					            }
+//					       	}
+//							//
+//							areasArr[province] = cityArr;
+//						}
+//						if(province === "全国"){
+//							areasArr = {"全国":[]};
+//						}
+//					}
+//				}
+//				console.log($(".save_upgrade").attr("disabled"))
+//				if(buyCheck){
+//					$(".save_upgrade").removeAttr("disabled");
+//				}
+//			}else{
+//				if(area !== ""&&area !== undefined){
+//					for(let province in area){
+//			    		let citys = area[province];
+//			    		if(citys.length===0){
+//							areasArr[province] = [];
+//			    		}else{
+//			    			areasArr[province] = citys;
+//			    		}
+//			    	}
+//				}
+//			}
+
 			console.log("areasArr",areasArr)
 			if(sessionStorage.vipSubSelectIndustryUpgrade!==""&&sessionStorage.vipSubSelectIndustryUpgrade!==undefined){
 				var vipIndustry = JSON.parse(sessionStorage.vipSubSelectIndustryUpgrade);
+				for(let i in vipIndustry){
+		    		let industry = vipIndustry[i];
+		    		industrysArr.push(industry);
+		        }
+				for(let i in vipIndustry){
+					if(industry === "全部行业"){
+						industrysArr = ["全部行业"];
+					}
+				}
 				if(buyerclass!==""&&buyerclass!==undefined){
 					for(let i in buyerclass){
 			    		let industry = buyerclass[i];
-			    		industrysArr.push(industry);
+			    		allIndustry.push(industry);
 			        }
 					for(let i in vipIndustry){
 						let industry = vipIndustry[i];
-						industrysArr.push(industry);
+						allIndustry.push(industry);
 						if(industry === "全部行业"){
-							industrysArr = ["全部行业"];
+							allIndustry = ["全部行业"];
 						}
 					}
 				}
@@ -1065,34 +1157,71 @@
 					$(".save_upgrade").removeAttr("disabled");
 				}
 			}else{
+				industrysArr = null;
 				if(buyerclass!==""&&buyerclass!==undefined){
 					for(let i in buyerclass){
 			    		let industry = buyerclass[i];
-			    		industrysArr.push(industry);
+			    		allIndustry.push(industry);
 			    	}
 			    }
 			}
 			
-			for (var x = 0; x < industrysArr.length; x++) {
-	            for (var j =x+1; j <industrysArr.length; ) {
-	                if (industrysArr[x] === industrysArr[j]){
-	                    industrysArr.splice(j, 1);
+//			if(sessionStorage.vipSubSelectIndustryUpgrade!==""&&sessionStorage.vipSubSelectIndustryUpgrade!==undefined){
+//				var vipIndustry = JSON.parse(sessionStorage.vipSubSelectIndustryUpgrade);
+//				if(buyerclass!==""&&buyerclass!==undefined){
+//					for(let i in buyerclass){
+//			    		let industry = buyerclass[i];
+//			    		industrysArr.push(industry);
+//			        }
+//					for(let i in vipIndustry){
+//						let industry = vipIndustry[i];
+//						industrysArr.push(industry);
+//						if(industry === "全部行业"){
+//							industrysArr = ["全部行业"];
+//						}
+//					}
+//				}
+//				if(buyCheck){
+//					$(".save_upgrade").removeAttr("disabled");
+//				}
+//			}else{
+//				if(buyerclass!==""&&buyerclass!==undefined){
+//					for(let i in buyerclass){
+//			    		let industry = buyerclass[i];
+//			    		industrysArr.push(industry);
+//			    	}
+//			    }
+//			}
+			if(industrysArr !== null){
+				for (var x = 0; x < industrysArr.length; x++) {
+		            for (var j =x+1; j <industrysArr.length; ) {
+		                if (industrysArr[x] === industrysArr[j]){
+		                    industrysArr.splice(j, 1);
+		                }
+		                else j++;
+		            }
+		       	}
+			}
+			for (var x = 0; x < allIndustry.length; x++) {
+	            for (var j =x+1; j <allIndustry.length; ) {
+	                if (allIndustry[x] === allIndustry[j]){
+	                    allIndustry.splice(j, 1);
 	                }
 	                else j++;
 	            }
 	       	}
 			
 			console.log("industrysArr",industrysArr);
-			if(sessionStorage.effectiveDate !== ""&&sessionStorage.effectiveDate!==undefined){
-				let eff = sessionStorage.effectiveDate;
-				if(eff === "now"){
-					effect = "now";
-				}else{
-					effect = "notnow";
-				}
-			}else{
-				effect = "now";
-			}
+//			if(sessionStorage.effectiveDate !== ""&&sessionStorage.effectiveDate!==undefined){
+//				let eff = sessionStorage.effectiveDate;
+//				if(eff === "now"){
+//					effect = "now";
+//				}else{
+//					effect = "notnow";
+//				}
+//			}else{
+//				effect = "now";
+//			}
 			//
 			if(endYear === nowYear){
 				if(endMonth === nowMonth){
@@ -1128,12 +1257,12 @@
 			nowRenew = nowUpgrade;
 			console.log("monthold",nowUpgrade)
 			//
-			if(effect === "notnow"){
-				nowUpgrade = nowUpgrade -1;
-			}
-			if(nowUpgrade == 0){
-				nowUpgrade = 1;
-			}
+//			if(effect === "notnow"){
+//				nowUpgrade = nowUpgrade -1;
+//			}
+//			if(nowUpgrade == 0){
+//				nowUpgrade = 1;
+//			}
 			
 			//
 			var nowUpgradeYear = 0;
@@ -1172,9 +1301,30 @@
 			
 			//
 			if(nowUpgradeYear >= 1){
-				let yearprice = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgradeYear,1]);
-				let monthprice = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgrade,2]);
-				price = yearprice + monthprice;
+				let addAreaPriceY = 0;
+				let addAreaPriceM = 0;
+				let oldAreaPriceY = 0;
+				let oldAreaPriceM = 0;
+				let addIndustryPriceY = 0;
+				let addIndustryPriceM = 0;
+				if(areasArr !== null&&industrysArr !== null){
+					addAreaPriceY = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgradeYear,1]);
+					addAreaPriceM = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgrade,2]);
+				}
+				if(areasArr !== null){
+					oldAreaPriceY = getsubVipOrderPrice(areasArr,buyerclass,[nowUpgradeYear,1]);
+					oldAreaPriceM = getsubVipOrderPrice(areasArr,buyerclass,[nowUpgrade,2]);
+				}
+				if(industrysArr !== null){
+					addIndustryPriceY = getsubVipOrderPrice(area,industrysArr,[nowUpgradeYear,1]);
+					addIndustryPriceM = getsubVipOrderPrice(area,industrysArr,[nowUpgrade,2]);
+				}
+				let yearprice = getsubVipOrderPrice(allArea,allIndustry,[nowUpgradeYear,1]);
+				let monthprice = getsubVipOrderPrice(allArea,allIndustry,[nowUpgrade,2]);
+//				price = yearprice + monthprice;
+				price = addAreaPriceY + addAreaPriceM + oldAreaPriceY + oldAreaPriceM + addIndustryPriceY + addIndustryPriceM;
+//				let yearprice = addAreaPriceY + oldAreaPriceY + addIndustryPriceY;
+//				let monthprice = addAreaPriceM + oldAreaPriceM + addIndustryPriceM;
 				if(monthprice === 0){
 					completeMonth = ((yearprice / nowUpgradeYear) / 10).toFixed(1);
 					completeYear = (yearprice / nowUpgradeYear).toFixed(1);
@@ -1186,16 +1336,30 @@
 				console.log("monthprice",monthprice);
 				console.log(">=1",price);
 			}else{
-				price = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgrade,2]);
-				completeMonth = (price / nowUpgrade).toFixed(1);
-				completeYear = ((price / nowUpgrade)*10).toFixed(1);
+				let addAreaPriceM = 0;
+				let oldAreaPriceM = 0;
+				let addIndustryPriceM = 0;
+				if(areasArr !== null&&industrysArr !== null){
+					addAreaPriceM = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgrade,2]);
+				}
+				if(areasArr !== null){
+					oldAreaPriceM = getsubVipOrderPrice(areasArr,buyerclass,[nowUpgrade,2]);
+				}
+				if(industrysArr !== null){
+					addIndustryPriceM = getsubVipOrderPrice(area,industrysArr,[nowUpgrade,2]);
+				}
+				let monthprice = getsubVipOrderPrice(allArea,allIndustry,[nowUpgrade,2]);
+//				price = getsubVipOrderPrice(areasArr,industrysArr,[nowUpgrade,2]);
+				price = addAreaPriceM + oldAreaPriceM + addIndustryPriceM;
+				completeMonth = (monthprice / nowUpgrade).toFixed(1);
+				completeYear = ((monthprice / nowUpgrade)*10).toFixed(1);
 				console.log("<1",price)
 			}
 			
 			console.log("oldPrice", oldPrice);
 			if(sessionStorage.vipSubSelectAreaUpgrade===undefined&&sessionStorage.vipSubSelectIndustryUpgrade===undefined){
-				completeMonth = oldMonthPrice
-				completeYear = oldYearPrice
+				completeMonth = oldMonthPrice;
+				completeYear = oldYearPrice;
 			}
 			console.log("completeMonth",completeMonth)
 			console.log("completeYear",completeYear)
@@ -1210,10 +1374,10 @@
 					sessionStorage.proPrice = price;
 				}
 			}
-			var cPrice = 0;
-  			if(price>0){
-  				var cPrice = (price - oldPrice).toFixed(1);
-  			}
+			
+			if(price>0){
+				var cPrice = price;
+			}
 			console.log(cPrice);
 			if(sessionStorage.proPrice!==""&&sessionStorage.proPrice!==undefined){
 				let proPrice = sessionStorage.proPrice;
@@ -1246,32 +1410,51 @@
         //
         $(".save_upgrade").on("click", function(){
         	$(".save_upgrade").attr("disabled","disabled")
-        	let effective = $("#effect_date_name").text();
-        	var effect = "now";
-        	if(effective !== "立即生效,需支付当月费用差价"){
-				let nowMonth = new Date().getMonth()+1;
-				let nowYear = new Date().getFullYear();
-				let a = nowMonth +1;
-        		if(a > 12){
-        			a = a-12;
-        			nowYear = nowYear +1;
-        		}
-        		let b = nowYear+"/"+a+"/1";
-        		effect = new Date(b).getTime() /1000;
-        	}
+//      	let effective = $("#effect_date_name").text();
+//      	var effect = "now";
+//      	if(effective !== "立即生效,需支付当月费用差价"){
+//				let nowMonth = new Date().getMonth()+1;
+//				let nowYear = new Date().getFullYear();
+//				let a = nowMonth +1;
+//      		if(a > 12){
+//      			a = a-12;
+//      			nowYear = nowYear +1;
+//      		}
+//      		let b = nowYear+"/"+a+"/1";
+//      		effect = new Date(b).getTime() /1000;
+//      	}
         	//
         	let areas = areasArr;
         	let industrys = industrysArr;
-        	if(areas["全国"]){
-                areas={};
-            }
-            if(industrys.length==1&&industrys[0]=="全部行业"){
-                industrys=[];
-            }
+        	let industryArr = "";
+        	let areaArr = "";
+        	if(areas !== null){
+        		if(areas["全国"]){
+	                areas={};
+	            }
+        		areaArr = JSON.stringify(areas);
+        	}else{
+        		areaArr = "no";
+        	}
+        	if(industrys !== null){
+        		if(industrys.length==1&&industrys[0]=="全部行业"){
+	                industrys=[];
+	            }
+        		industryArr = industrys.join(",");
+        	}else{
+        		industryArr = "no";
+        	}
             //
             let areaarr = area;
         	let industryarr = buyerclass;
-        	
+        	let allAreaArr = allArea;
+        	let allIndustryArr = allIndustry;
+        	if(allAreaArr["全国"]){
+                allAreaArr={};
+            }
+        	if(allIndustryArr.length==1&&allIndustryArr[0]=="全部行业"){
+                allIndustryArr=[];
+            }
             //
             let renew_time = $('.choose_item.lengthen .info').text();
             let times = "";
@@ -1280,16 +1463,18 @@
             }
             //
 	    	var param = {
-	    		"area": JSON.stringify(areas),
-	    		"industry": industrys.join(","),
+	    		"area": areaArr,
+	    		"industry": industryArr,
 	    		"areas": JSON.stringify(areaarr),
 	    		"industryarr": industryarr.join(","),
+	    		"allArea": JSON.stringify(allAreaArr),
+	    		"allIndustry": allIndustryArr.join(","),
 	    		"payWay": "wx_js",
-	    		"effect": effect,
+//	    		"effect": effect,
 	    		"pay_source" : "Upgrade",
 	    		"time": times,
-	    		"nowUp": Number(nowRenew),
-	    		"isvalidOk" : isvalidOk,
+//	    		"nowUp": Number(nowRenew),
+//	    		"isvalidOk" : isvalidOk,
 	    	}
 	    	console.log(param)
 	    	$DoPost("/subscribepay/renewUpgrade/renewUpgradeCreateOrder",param,function(r){
@@ -1308,7 +1493,7 @@
 	    	sessionStorage.removeItem("proPrice");
 	    	sessionStorage.removeItem("vipSubSelectAreaUpgrade");
 	    	sessionStorage.removeItem("vipSubSelectIndustryUpgrade");
-	    	sessionStorage.removeItem("effectiveDate");
+//	    	sessionStorage.removeItem("effectiveDate");
 	    	sessionStorage.removeItem("buyCheck");
 	    }
 	    

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.