Explorar o código

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

wangkaiyue %!s(int64=5) %!d(string=hai) anos
pai
achega
9645ed8eb7
Modificáronse 23 ficheiros con 791 adicións e 372 borrados
  1. 77 0
      src/jfw/modules/pushsubscribe/src/match/job/freeuser.go
  2. 0 2
      src/jfw/modules/pushsubscribe/src/match/job/job.go
  3. 7 0
      src/jfw/modules/pushsubscribe/src/match/job/matcher.go
  4. 215 221
      src/jfw/modules/pushsubscribe/src/match/job/matchjob.go
  5. 131 0
      src/jfw/modules/pushsubscribe/src/match/job/vipuser.go
  6. 47 27
      src/jfw/modules/pushsubscribe/src/public/entity.go
  7. 8 0
      src/jfw/modules/pushsubscribe/src/public/util.go
  8. 2 1
      src/jfw/modules/pushsubscribe/src/push/config.json
  9. 1 0
      src/jfw/modules/pushsubscribe/src/push/config/config.go
  10. 14 20
      src/jfw/modules/pushsubscribe/src/push/job/dopush.go
  11. 15 16
      src/jfw/modules/pushsubscribe/src/push/job/pushjob.go
  12. 13 13
      src/jfw/modules/pushsubscribe/src/push/job/repairjob.go
  13. 18 8
      src/jfw/modules/pushsubscribe/src/push/util/util.go
  14. 1 0
      src/jfw/modules/subscribepay/src/a/init.go
  15. 12 0
      src/jfw/modules/subscribepay/src/service/afterPay.go
  16. 56 18
      src/jfw/modules/subscribepay/src/service/orderListDetails.go
  17. 118 0
      src/jfw/modules/subscribepay/src/service/vrew.go
  18. 1 1
      src/jfw/public/search.go
  19. 1 1
      src/web/templates/weixin/dataExport/dataExport_applyInvoice.html
  20. 40 33
      src/web/templates/weixin/dataExport/dataExport_toMyOrder.html
  21. 2 5
      src/web/templates/weixin/vipsubscribe/keyWord.html
  22. 6 4
      src/web/templates/weixin/vipsubscribe/vip_index.html
  23. 6 2
      src/web/templates/weixin/vipsubscribe/vip_order_detail.html

+ 77 - 0
src/jfw/modules/pushsubscribe/src/match/job/freeuser.go

@@ -0,0 +1,77 @@
+package job
+
+import (
+	. "public"
+	"strings"
+)
+
+//免费用户
+type FreeUser struct {
+	Users      map[*UserInfo]bool
+	Title_Pjob *Pjob
+}
+
+func NewFreeUser() *FreeUser {
+	return &FreeUser{
+		Users: map[*UserInfo]bool{},
+	}
+}
+func (f *FreeUser) Match(info *map[string]interface{}) *map[*UserInfo]*MatchUser {
+	title, _ := (*info)["title"].(string)
+	title = strings.ToUpper(title)
+	//订阅词
+	keys := f.Title_Pjob.InterestDfa.Analy(title)
+	//排除词
+	notkeys := f.Title_Pjob.NotInterestDfa.Analy(title)
+	users := f.GetFinalUser(keys, notkeys, f.Title_Pjob.Key_user, info)
+	return users
+}
+
+//获取最终的用户,排除词、信息范围、信息类型之后的
+//返回匹配上的用户和没有匹配到的用户
+func (f *FreeUser) GetFinalUser(keys, notkeys []string, key_user *map[string]*[]*UserInfo, info *map[string]interface{}) *map[*UserInfo]*MatchUser {
+	area, _ := (*info)["area"].(string)
+	toptype, _ := (*info)["toptype"].(string)
+	keyMap := map[string]bool{}
+	for _, v := range keys {
+		keyMap[v] = true
+	}
+	users := map[*UserInfo]*MatchUser{} //匹配到用户
+	//遍历所有用户
+	for k, us := range *key_user {
+		if !keyMap[k] { //该关键词没有匹配到的用户
+			continue
+		}
+		for _, u := range *us {
+			//获取该词下面所有的用户
+			//遍历我的排除词,如果存在的话,排除自己
+			isContinue := false
+			for _, notkey := range notkeys {
+				if u.Key_notkey[k][notkey] {
+					isContinue = true
+					break
+				}
+			}
+			if isContinue {
+				continue
+			}
+			//遍历我的信息范围,看该信息是不是在我的信息范围中
+			if len(u.O_jy.Area[k]) > 0 && !u.O_jy.Area[k][area] {
+				continue
+			}
+			//遍历我的信息类型,看该信息是不是在我的信息类型中
+			if len(u.O_jy.Infotype[k]) > 0 && !u.O_jy.Infotype[k][toptype] {
+				continue
+			}
+			matchUser := users[u]
+			if matchUser == nil {
+				matchUser = &MatchUser{
+					Keys: []string{},
+				}
+			}
+			matchUser.Keys = append(matchUser.Keys, k)
+			users[u] = matchUser
+		}
+	}
+	return &users
+}

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

@@ -2,7 +2,6 @@ package job
 
 import (
 	"match/config"
-	. "public"
 	"sync"
 )
 
@@ -30,7 +29,6 @@ type jobs struct {
 var Jobs = &jobs{
 	Match: &MatchJob{
 		datas:             &[]map[string]interface{}{},
-		users:             &map[string]*UserInfo{},
 		matchPool:         make(chan bool, config.SysConfig.MatchPoolSize),
 		eachInfoWaitGroup: &sync.WaitGroup{},
 		saveWaitGroup:     &sync.WaitGroup{},

+ 7 - 0
src/jfw/modules/pushsubscribe/src/match/job/matcher.go

@@ -0,0 +1,7 @@
+package job
+
+import . "public"
+
+type Matcher interface {
+	Match(info *map[string]interface{}) *map[*UserInfo]*MatchUser
+}

+ 215 - 221
src/jfw/modules/pushsubscribe/src/match/job/matchjob.go

@@ -23,7 +23,7 @@ import (
 )
 
 var (
-	SaveFields = []string{"_id", "area", "bidamount", "bidopentime", "budget", "buyer", "otitle", "projectname", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "winner"}
+	SaveFields = []string{"_id", "area", "city", "bidamount", "bidopentime", "budget", "buyer", "buyerclass", "projectname", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "winner"}
 	MailReg    = regexp.MustCompile(SysConfig.MailReg)
 )
 
@@ -53,12 +53,10 @@ func (p *Pjob) CreateDaf() {
 }
 
 type MatchUser struct {
-	User *UserInfo
 	Keys []string
 }
 type MatchJob struct {
 	datas             *[]map[string]interface{} //本次加载的数据
-	users             *map[string]*UserInfo     //所有用户
 	matchPool         chan bool
 	eachInfoWaitGroup *sync.WaitGroup
 	saveWaitGroup     *sync.WaitGroup
@@ -99,24 +97,12 @@ func (m *MatchJob) Execute() {
 	user_batch_index := 0
 	for {
 		user_batch_index++
-		user_batch_size := m.OnceUserBatch(user_batch_index)
+		user_batch_size, vipUser, freeUser := m.OnceUserBatch(user_batch_index)
 		if user_batch_size == 0 {
 			break
 		}
-		a_key_user := make(map[string]*[]*UserInfo)
-		a_notkey_user := make(map[string]*[]*UserInfo)
-		//开启智能订阅的用户
-		//s_key_user := make(map[string]*[]*UserInfo)
-		//s_notkey_user := make(map[string]*[]*UserInfo)
-		for _, v := range *m.users {
-			m.MakeKeyUser(v.Keys, v, &a_key_user)
-			m.MakeKeyUser(v.NotKeys, v, &a_notkey_user)
-			// if v.SmartSet == 1 {
-			// 	m.MakeKeyUser(v.Keys, v, &s_key_user)
-			// 	m.MakeKeyUser(v.NotKeys, v, &s_notkey_user)
-			// }
-		}
-		m.ToMatch(user_batch_index, a_key_user, a_notkey_user, nil, nil)
+		m.ToMatch(user_batch_index, vipUser)
+		m.ToMatch(user_batch_index, freeUser)
 		if user_batch_size < SysConfig.UserBatch {
 			break
 		}
@@ -127,35 +113,14 @@ func (m *MatchJob) Execute() {
 	TaskConfig.LastId = newId
 	TaskConfig.StartTime = util.FormatDateWithObj(&comeintime, util.Date_Full_Layout)
 	m.datas = &[]map[string]interface{}{}
-	m.users = &map[string]*UserInfo{}
 }
-func (m *MatchJob) ToMatch(batchIndex int, a_key_user, a_notkey_user, s_key_user, s_notkey_user map[string]*[]*UserInfo) {
+func (m *MatchJob) ToMatch(batchIndex int, matcher Matcher) {
 	logger.Info("开始匹配第", batchIndex, "批用户")
-	a_p := &Pjob{
-		Key_user:    &a_key_user,
-		Notkey_user: &a_notkey_user,
-	}
-	a_p.CreateDaf()
-	//
-	s_p := &Pjob{
-		Key_user:    &s_key_user,
-		Notkey_user: &s_notkey_user,
-	}
-	s_p.CreateDaf()
-	m.Save(a_p, s_p)
-	a_key_user = make(map[string]*[]*UserInfo)
-	a_notkey_user = make(map[string]*[]*UserInfo)
-	//开启智能订阅的用户
-	s_key_user = make(map[string]*[]*UserInfo)
-	s_notkey_user = make(map[string]*[]*UserInfo)
+	userMap := m.EachAllBidInfo(matcher)
 	logger.Info("第", batchIndex, "批用户匹配结束")
-}
-func (m *MatchJob) Save(a_p, s_p *Pjob) {
 	logger.Info("开始保存到pushmail_temp表")
-	userMap := m.EachAllBidInfo(a_p, s_p)
-	//加锁,保存数据和转移数据不能同时进行
 	index := 0
-	for openid, listInfos := range *userMap {
+	for user, listInfos := range *userMap {
 		var pushArray = make(SortList, 0)
 		for e := listInfos.Front(); e != nil; e = e.Next() {
 			matchInfo := *(e.Value.(*MatchInfo))
@@ -182,34 +147,32 @@ func (m *MatchJob) Save(a_p, s_p *Pjob) {
 				break
 			}
 		}
-		user := (*m.users)[openid]
 		m.saveBatch = append(m.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,
-			//"smartset":      user.SmartSet,
-			"usertype": user.UserType,
-			"email":    user.Email,
-			//"dataexport":    user.DataExport,
+			"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.OriginalKeys,
+			"words":         user.Keys,
 			"modifydate":    user.ModifyDate,
 			"mergeorder":    user.MergeOrder,
 			"timestamp":     time.Now().Unix(),
 			"nickname":      user.NickName,
 			"firstpushtime": user.FirstPushTime,
+			"vipstatus":     user.VipStatus,
 		})
 		if len(m.saveBatch) == BulkSize {
 			mongodb.SaveBulk("pushspace_temp", m.saveBatch...)
@@ -289,9 +252,8 @@ func (m *MatchJob) LoadBidding(lastId, newId string, lastTime int64) bool {
 }
 
 //初始化用户缓存
-func (m *MatchJob) OnceUserBatch(user_batch_index int) int {
+func (m *MatchJob) OnceUserBatch(user_batch_index int) (int, *VipUser, *FreeUser) {
 	defer util.Catch()
-	m.users = &map[string]*UserInfo{}
 	//遍历用户
 	q := map[string]interface{}{
 		"i_appid": 2,
@@ -312,6 +274,8 @@ func (m *MatchJob) OnceUserBatch(user_batch_index int) int {
 	query := session.DB(DbName).C("user").Find(&q).Select(&map[string]interface{}{
 		"_id":             1,
 		"o_jy":            1,
+		"o_vipjy":         1,
+		"i_vipstatus":     1,
 		"s_m_openid":      1,
 		"a_m_openid":      1,
 		"s_phone":         1,
@@ -325,10 +289,19 @@ func (m *MatchJob) OnceUserBatch(user_batch_index int) int {
 		"a_mergeorder":    1,
 		"s_nickname":      1,
 		"l_firstpushtime": 1,
-		//"i_dataexport": 1,
-		//"i_smartset":1,
 	}).Iter()
 	n := 0
+	freeUser := NewFreeUser() //免费所有用户
+	vipUser := NewVipUser()   //vip所有用户
+	//vip标题匹配
+	vip_title_key_user := make(map[string]*[]*UserInfo)
+	vip_title_notkey_user := make(map[string]*[]*UserInfo)
+	//vip正文匹配
+	vip_detail_key_user := make(map[string]*[]*UserInfo)
+	vip_detail_notkey_user := make(map[string]*[]*UserInfo)
+	//免费用户
+	title_key_user := make(map[string]*[]*UserInfo)
+	title_notkey_user := make(map[string]*[]*UserInfo)
 	for temp := make(map[string]interface{}); query.Next(temp); {
 		s_m_openid := util.ObjToString(temp["s_m_openid"])
 		a_m_openid := util.ObjToString(temp["a_m_openid"])
@@ -352,7 +325,13 @@ func (m *MatchJob) OnceUserBatch(user_batch_index int) int {
 			}
 		}
 		applystatus := util.IntAll(temp["i_applystatus"])
-		o_msgset, _ := temp["o_jy"].(map[string]interface{})
+		vipStatus := util.IntAll(temp["i_vipstatus"])
+		var o_msgset map[string]interface{}
+		if !IsVipUser(vipStatus) {
+			o_msgset, _ = temp["o_jy"].(map[string]interface{})
+		} else {
+			o_msgset, _ = temp["o_vipjy"].(map[string]interface{})
+		}
 		wxpush, apppush, mailpush := mutil.ModeTransform(userType, o_msgset)
 		email := strings.TrimSpace(util.ObjToString(o_msgset["s_email"]))
 		if !MailReg.MatchString(email) {
@@ -361,78 +340,95 @@ func (m *MatchJob) OnceUserBatch(user_batch_index int) int {
 		if wxpush != 1 && apppush != 1 && mailpush != 1 {
 			continue
 		}
-		var allkeysTemp []elastic.KeyConfig
-		_bs, err := json.Marshal(o_msgset["a_key"])
-		if err == nil {
-			json.Unmarshal(_bs, &allkeysTemp)
-		}
-		allkeys := []elastic.KeyConfig{}
-		if len(allkeysTemp) > 0 {
-			//一个字或者配置文件中的词,不推送
-			for _, vs := range allkeysTemp {
-				isFilter := false
-				vskey := strings.Replace(strings.Join(vs.Keys, ""), " ", "", -1)
-				if len([]rune(vskey)) == 1 {
-					continue
-				}
-				for _, fv := range SysConfig.FilterWords {
-					if fv == vskey {
-						isFilter = true
-						break
-					}
-				}
-				if !isFilter {
-					allkeys = append(allkeys, vs)
+		userId := fmt.Sprintf("%x", string(temp["_id"].(bson.ObjectId)))
+		var allKeySet []*KeySet
+		var err error
+		if !IsVipUser(vipStatus) {
+			allKeySet, err = m.GetKeySet(o_msgset["a_key"])
+		} else {
+			vip_items, _ := o_msgset["a_items"].([]interface{})
+			for _, v := range vip_items {
+				vip_item, _ := v.(map[string]interface{})
+				var vip_keySet []*KeySet
+				vip_keySet, err = m.GetKeySet(vip_item["a_key"])
+				if err != nil {
+					break
 				}
+				allKeySet = append(allKeySet, vip_keySet...)
 			}
 		}
-		////////////////
-		if len(allkeys) == 0 {
+		if err != nil {
+			logger.Error("获取用户关键词错误!", userId, err)
 			continue
 		}
-		userId := fmt.Sprintf("%x", string(temp["_id"].(bson.ObjectId)))
-		//smartset := util.IntAll(temp["i_smartset"])
-		//dataExport := util.IntAll(temp["i_dataexport"])
 		rateMode := util.IntAllDef(o_msgset["i_ratemode"], 2)
-		logger.Info("第", user_batch_index, "批用户,userid", userId, "s_m_openid", s_m_openid, "a_m_openid", a_m_openid, "s_phone", s_phone, "jpushid", jpushid, "opushid", opushid, "applystatus", applystatus, "email", email, "rateMode", rateMode, "wxpush", wxpush, "apppush", apppush, "mailpush", mailpush)
+		logger.Info("第", user_batch_index, "批用户,userid", userId, "s_m_openid", s_m_openid, "a_m_openid", a_m_openid, "s_phone", s_phone, "jpushid", jpushid, "opushid", opushid, "applystatus", applystatus, "email", email, "rateMode", rateMode, "wxpush", wxpush, "apppush", apppush, "mailpush", mailpush, "vipstatus", vipStatus)
 		keys := []string{}                           //过滤后的关键词
 		notkeys := []string{}                        //排除词
 		key_notkey := map[string]map[string]bool{}   //关键词所对应的排除词
 		key_area := map[string]map[string]bool{}     //关键词所对应的信息范围
 		key_infotype := map[string]map[string]bool{} //关键词所对应的信息类型
-		for _, vs := range allkeys {
-			key := strings.Join(vs.Keys, "+")
+		originalKeys := []string{}                   //原始关键词
+		////////////////
+		for _, vs := range allKeySet {
+			var vs_keys []string
+			for _, vs_v := range [][]string{vs.Keys, vs.AppendKeys} {
+				for _, vs_vv := range vs_v {
+					vs_vv = strings.TrimSpace(vs_vv)
+					if vs_vv == "" {
+						continue
+					}
+					vs_keys = append(vs_keys, vs_vv)
+				}
+			}
+			if len(vs_keys) == 0 {
+				continue
+			}
+			key := strings.Join(vs_keys, "+")
+			originalKeys = append(originalKeys, key)
+			//一个字或者配置文件中的词,不推送
+			//if len([]rune(key)) == 1 {
+			//continue
+			//}
+			isFilter := false
+			for _, fv := range SysConfig.FilterWords {
+				if fv == key {
+					isFilter = true
+					break
+				}
+			}
+			if isFilter {
+				continue
+			}
 			keys = append(keys, key)
 			notkeys = append(notkeys, vs.NotKeys...)
 			//转大写
-			keyTemp := strings.ToUpper(key)
+			upperKey := strings.ToUpper(key)
 			//建立与排除词的对应关系
 			for _, notkey := range vs.NotKeys {
-				notkeyTemp := strings.ToUpper(notkey)
-				if key_notkey[keyTemp] == nil {
-					key_notkey[keyTemp] = map[string]bool{}
+				upperNotkey := strings.ToUpper(notkey)
+				if key_notkey[upperKey] == nil {
+					key_notkey[upperKey] = map[string]bool{}
 				}
-				key_notkey[keyTemp][notkeyTemp] = true
+				key_notkey[upperKey][upperNotkey] = true
 			}
 			//建立与信息范围的对应关系
 			for _, area := range vs.Areas {
-				if key_area[keyTemp] == nil {
-					key_area[keyTemp] = map[string]bool{}
+				if key_area[upperKey] == nil {
+					key_area[upperKey] = map[string]bool{}
 				}
-				key_area[keyTemp][area] = true
+				key_area[upperKey][area] = true
 			}
 			//建立与信息类型的对应关系
 			for _, infotype := range vs.InfoTypes {
-				if key_infotype[keyTemp] == nil {
-					key_infotype[keyTemp] = map[string]bool{}
+				if key_infotype[upperKey] == nil {
+					key_infotype[upperKey] = map[string]bool{}
 				}
-				key_infotype[keyTemp][infotype] = true
+				key_infotype[upperKey][infotype] = true
 			}
 		}
-		//
-		keysTemp := []string{} //原始关键词
-		for _, vs := range allkeysTemp {
-			keysTemp = append(keysTemp, strings.Join(vs.Keys, "+"))
+		if !IsVipUser(vipStatus) && len(originalKeys) == 0 {
+			continue
 		}
 		modifydate := ""
 		md, _ := o_msgset["l_modifydate"].(int64)
@@ -445,12 +441,8 @@ func (m *MatchJob) OnceUserBatch(user_batch_index int) int {
 		}
 		user := &UserInfo{
 			Id:           userId,
-			OriginalKeys: keysTemp,
-			Keys:         keys, //原始关键词
-			NotKeys:      notkeys,
+			Keys:         originalKeys,
 			Key_notkey:   key_notkey,
-			Key_area:     key_area,
-			Key_infotype: key_infotype,
 			WxPush:       wxpush,
 			AppPush:      apppush,
 			MailPush:     mailpush,
@@ -463,17 +455,81 @@ func (m *MatchJob) OnceUserBatch(user_batch_index int) int {
 			Opushid:      opushid,
 			UserType:     userType,
 			RateMode:     rateMode,
-			AllKeys:      allkeysTemp, //原始关键词
 			ModifyDate:   modifydate,
 			AppPhoneType: appPhoneType,
 			ApplyStatus:  applystatus,
 			Subscribe:    isPush,
+			MatchType:    util.IntAllDef(o_msgset["i_matchway"], 1),
 			MergeOrder:   temp["a_mergeorder"],
 			NickName:     util.ObjToString(temp["s_nickname"]),
-			//SmartSet:     smartset,
-			//DataExport:   dataExport,
+			VipStatus:    vipStatus,
+		}
+		/***************start*****************/
+		if !IsVipUser(vipStatus) {
+			user.O_jy = &O_jy{
+				Area:     key_area,
+				Infotype: key_infotype,
+			}
+			m.MakeKeyUser(keys, user, &title_key_user)
+			m.MakeKeyUser(notkeys, user, &title_notkey_user)
+		} else {
+			//vip付费-采购单位行业
+			vip_buyerclass, _ := o_msgset["a_buyerclass"].([]interface{})
+			if len(vip_buyerclass) == 0 {
+				vipUser.Add("", user, &vipUser.BuyerclassUsers)
+			} else {
+				for _, v := range vip_buyerclass {
+					s_v, _ := v.(string)
+					if s_v == "" {
+						continue
+					}
+					vipUser.Add(s_v, user, &vipUser.BuyerclassUsers)
+				}
+			}
+			//vip付费-区域
+			vip_area, _ := o_msgset["o_area"].(map[string]interface{})
+			if len(vip_area) == 0 {
+				vipUser.Add("", user, &vipUser.AreaUsers)
+			} else {
+				for k, v := range vip_area {
+					if k == "" {
+						continue
+					}
+					vs, _ := v.([]interface{})
+					if len(vs) == 0 {
+						vipUser.Add(k, user, &vipUser.AreaUsers)
+					} else {
+						for _, vv := range vs {
+							s_vv, _ := vv.(string)
+							if s_vv == "" {
+								continue
+							}
+							vipUser.Add(s_vv, user, &vipUser.CityUsers)
+						}
+					}
+				}
+			}
+			//vip付费-信息类型
+			vip_infotype, _ := o_msgset["a_infotype"].([]interface{})
+			if len(vip_infotype) == 0 {
+				vipUser.Add("", user, &vipUser.InfoTypeUsers)
+			} else {
+				for _, v := range vip_infotype {
+					s_v, _ := v.(string)
+					if s_v == "" {
+						continue
+					}
+					vipUser.Add(s_v, user, &vipUser.InfoTypeUsers)
+				}
+			}
+			m.MakeKeyUser(keys, user, &vip_title_key_user)
+			m.MakeKeyUser(notkeys, user, &vip_title_notkey_user)
+			if user.MatchType == 2 {
+				m.MakeKeyUser(keys, user, &vip_detail_key_user)
+				m.MakeKeyUser(notkeys, user, &vip_detail_notkey_user)
+			}
 		}
-		(*m.users)[user.Id] = user
+		/***************end*****************/
 		m.lastUserId = user.Id
 		temp = make(map[string]interface{})
 		n++
@@ -481,8 +537,38 @@ func (m *MatchJob) OnceUserBatch(user_batch_index int) int {
 			break
 		}
 	}
+	//
+	vip_title_pjob := &Pjob{
+		Key_user:    &vip_title_key_user,
+		Notkey_user: &vip_title_notkey_user,
+	}
+	vip_title_pjob.CreateDaf()
+	vip_detail_pjob := &Pjob{
+		Key_user:    &vip_detail_key_user,
+		Notkey_user: &vip_detail_notkey_user,
+	}
+	vip_detail_pjob.CreateDaf()
+	vipUser.Title_Pjob = vip_title_pjob
+	vipUser.Detail_Pjob = vip_detail_pjob
+	//
+	title_pjob := &Pjob{
+		Key_user:    &title_key_user,
+		Notkey_user: &title_notkey_user,
+	}
+	title_pjob.CreateDaf()
+	freeUser.Title_Pjob = title_pjob
 	logger.Info("第", user_batch_index, "批用户加载结束", n)
-	return n
+	return n, vipUser, freeUser
+}
+
+//得到用户的关键词
+func (m *MatchJob) GetKeySet(a_key interface{}) ([]*KeySet, error) {
+	var keySet []*KeySet
+	_bs, err := json.Marshal(a_key)
+	if err == nil {
+		err = json.Unmarshal(_bs, &keySet)
+	}
+	return keySet, err
 }
 
 //把用户挂在词下面
@@ -494,23 +580,20 @@ func (m *MatchJob) MakeKeyUser(keys []string, user *UserInfo, key_user *map[stri
 			continue
 		}
 		mp[v] = true
-		var arr *[]*UserInfo
-		if nil == (*key_user)[v] {
+		arr := (*key_user)[v]
+		if arr == nil {
 			arr = &[]*UserInfo{}
-			(*key_user)[v] = arr
-		} else {
-			arr = (*key_user)[v]
-			(*key_user)[v] = arr
 		}
 		*arr = append(*arr, user)
+		(*key_user)[v] = arr
 	}
 }
 
 //遍历数据并执行推送操作
-func (m *MatchJob) EachAllBidInfo(a_p *Pjob, s_p *Pjob) *map[string]*list.List {
+func (m *MatchJob) EachAllBidInfo(matcher Matcher) *map[*UserInfo]*list.List {
 	defer util.Catch()
 	logger.Info("开始遍历数据。。。")
-	userMap := &map[string]*list.List{}
+	userMap := map[*UserInfo]*list.List{}
 	var count int
 	for _, temp := range *m.datas {
 		m.matchPool <- true
@@ -521,39 +604,9 @@ func (m *MatchJob) EachAllBidInfo(a_p *Pjob, s_p *Pjob) *map[string]*list.List {
 				m.eachInfoWaitGroup.Done()
 				<-m.matchPool
 			}()
-			title := util.ObjToString(info["title"])
-			if title == "" {
-				return
-			}
-			titleTemp := strings.ToUpper(title)
-			area := util.ObjToString(info["area"])
-			toptype := util.ObjToString(info["toptype"])
-			//订阅词
-			keys := a_p.InterestDfa.Analy(titleTemp)
-			//排除词
-			notkeys := a_p.NotInterestDfa.Analy(titleTemp)
-			users := m.GetFinalUser(keys, notkeys, a_p.Key_user, area, toptype, true)
-			//开启智能匹配的用户,匹配projectscope
-			if s_p != nil {
-				projectscope := util.ObjToString(info["projectscope"])
-				if projectscope == "" {
-					projectscope = util.ObjToString(info["detail"])
-				}
-				if projectscope != "" {
-					projectscopeTemp := strings.ToUpper(projectscope)
-					keys = s_p.InterestDfa.Analy(projectscopeTemp)
-					notkeys = s_p.NotInterestDfa.Analy(projectscopeTemp)
-					s_users := m.GetFinalUser(keys, notkeys, s_p.Key_user, area, toptype, false)
-					for _, s_u := range *s_users {
-						if (*users)[s_u.User.Id] != nil {
-							continue
-						}
-						(*users)[s_u.User.Id] = s_u
-					}
-				}
-			}
+			users := matcher.Match(&info)
 			if len(*users) > 0 {
-				m.EachInfoToUser(users, &info, userMap)
+				m.EachInfoToUser(users, &info, &userMap)
 			}
 		}(temp)
 		if count%500 == 0 {
@@ -562,70 +615,11 @@ func (m *MatchJob) EachAllBidInfo(a_p *Pjob, s_p *Pjob) *map[string]*list.List {
 	}
 	m.eachInfoWaitGroup.Wait()
 	logger.Info("数据遍历完成!")
-	return userMap
-}
-
-//获取最终的用户,排除词、信息范围、信息类型之后的
-//返回匹配上的用户和没有匹配到的用户
-func (m *MatchJob) GetFinalUser(keys, notkeys []string, key_user *map[string]*[]*UserInfo, area, toptype string, flag bool) *map[string]*MatchUser {
-	keyMap := map[string]bool{}
-	for _, v := range keys {
-		keyMap[v] = true
-	}
-	y_users := map[string]*MatchUser{} //匹配到用户
-	//遍历所有用户
-	for k, us := range *key_user {
-		if !keyMap[k] { //改关键词没有匹配到的用户
-			continue
-		}
-		for _, u := range *us {
-			//获取该词下面所有的用户
-			//遍历我的排除词,如果存在的话,排除自己
-			isContinue := false
-			for _, notkey := range notkeys {
-				if u.Key_notkey[k][notkey] {
-					isContinue = true
-					break
-				}
-			}
-			if isContinue {
-				continue
-			}
-			//遍历我的信息范围,看该信息是不是在我的信息范围中
-			if len(u.Key_area[k]) > 0 && !u.Key_area[k][area] {
-				continue
-			}
-			//遍历我的信息类型,看该信息是不是在我的信息类型中
-			if len(u.Key_infotype[k]) > 0 && !u.Key_infotype[k][toptype] {
-				continue
-			}
-			matchUser := y_users[u.Id]
-			if matchUser == nil {
-				matchUser = &MatchUser{
-					User: u,
-					Keys: []string{},
-				}
-			}
-			matchUser.Keys = append(matchUser.Keys, k)
-			y_users[u.Id] = matchUser
-		}
-	}
-	//获取最终没有匹配到的用户,进行正文或者范围匹配
-	users := map[string]*MatchUser{}
-	for k, v := range *m.users {
-		if y_users[k] == nil {
-			continue
-		}
-		users[v.Id] = &MatchUser{
-			User: v,
-			Keys: y_users[k].Keys,
-		}
-	}
-	return &users
+	return &userMap
 }
 
 //遍历用户加入到此条信息上
-func (m *MatchJob) EachInfoToUser(users *map[string]*MatchUser, info *map[string]interface{}, userMap *map[string]*list.List) {
+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 {

+ 131 - 0
src/jfw/modules/pushsubscribe/src/match/job/vipuser.go

@@ -0,0 +1,131 @@
+package job
+
+import (
+	. "public"
+	"strings"
+)
+
+//付费用户
+type VipUser struct {
+	Users           map[*UserInfo]bool
+	Title_Pjob      *Pjob
+	Detail_Pjob     *Pjob
+	BuyerclassUsers map[string]map[*UserInfo]bool
+	AreaUsers       map[string]map[*UserInfo]bool
+	CityUsers       map[string]map[*UserInfo]bool
+	InfoTypeUsers   map[string]map[*UserInfo]bool
+	MatchJob        *MatchJob
+}
+
+func (v *VipUser) Add(k string, u *UserInfo, m *map[string]map[*UserInfo]bool) {
+	mk := (*m)[k]
+	if mk == nil {
+		mk = map[*UserInfo]bool{}
+	}
+	mk[u] = true
+	(*m)[k] = mk
+}
+func NewVipUser() *VipUser {
+	return &VipUser{
+		Users:           map[*UserInfo]bool{},
+		BuyerclassUsers: map[string]map[*UserInfo]bool{},
+		AreaUsers:       map[string]map[*UserInfo]bool{},
+		CityUsers:       map[string]map[*UserInfo]bool{},
+		InfoTypeUsers:   map[string]map[*UserInfo]bool{},
+	}
+}
+
+func (v *VipUser) Match(info *map[string]interface{}) *map[*UserInfo]*MatchUser {
+	buyerclass, _ := (*info)["buyerclass"].(string)
+	area, _ := (*info)["area"].(string)
+	city, _ := (*info)["city"].(string)
+	toptype, _ := (*info)["toptype"].(string)
+	title, _ := (*info)["title"].(string)
+	title = strings.ToUpper(title)
+	//订阅词
+	keys := v.Title_Pjob.InterestDfa.Analy(title)
+	//排除词
+	notkeys := v.Title_Pjob.NotInterestDfa.Analy(title)
+	title_users := v.GetFinalUser(keys, notkeys, v.Title_Pjob.Key_user)
+	//开启智能匹配的用户,匹配projectscope
+	detail_users := &map[*UserInfo]*MatchUser{}
+	if v.Detail_Pjob != nil {
+		detail, _ := (*info)["projectscope"].(string)
+		if detail == "" {
+			detail, _ = (*info)["detail"].(string)
+		}
+		if detail != "" {
+			detail = strings.ToUpper(detail)
+			keys = v.Detail_Pjob.InterestDfa.Analy(detail)
+			notkeys = v.Detail_Pjob.NotInterestDfa.Analy(detail)
+			detail_users = v.GetFinalUser(keys, notkeys, v.Detail_Pjob.Key_user)
+			for d_k, d_u := range *detail_users {
+				if (*title_users)[d_k] != nil {
+					continue
+				}
+				(*title_users)[d_k] = d_u
+			}
+		}
+	}
+	users := map[*UserInfo]*MatchUser{}
+	for k, _ := range v.Users {
+		if (!v.BuyerclassUsers[""][k] && !v.BuyerclassUsers[buyerclass][k]) ||
+			(!v.AreaUsers[""][k] || !v.AreaUsers[area][k] || !v.AreaUsers[city][k]) ||
+			(!v.InfoTypeUsers[""][k] || !v.InfoTypeUsers[toptype][k]) {
+			continue
+		}
+		var matchUser *MatchUser
+		if len(k.OriginalKeys) > 0 {
+			matchUser = (*title_users)[k]
+			if matchUser == nil {
+				matchUser = (*detail_users)[k]
+			}
+			if matchUser == nil {
+				continue
+			}
+		} else {
+			matchUser = &MatchUser{}
+		}
+		users[k] = matchUser
+	}
+	return &users
+}
+
+//获取最终的用户,排除词、信息范围、信息类型之后的
+//返回匹配上的用户和没有匹配到的用户
+func (v *VipUser) GetFinalUser(keys, notkeys []string, key_user *map[string]*[]*UserInfo) *map[*UserInfo]*MatchUser {
+	keyMap := map[string]bool{}
+	for _, v := range keys {
+		keyMap[v] = true
+	}
+	users := map[*UserInfo]*MatchUser{} //匹配到用户
+	//遍历所有用户
+	for k, us := range *key_user {
+		if !keyMap[k] { //该关键词没有匹配到的用户
+			continue
+		}
+		for _, u := range *us {
+			//获取该词下面所有的用户
+			//遍历我的排除词,如果存在的话,排除自己
+			isContinue := false
+			for _, notkey := range notkeys {
+				if u.Key_notkey[k][notkey] {
+					isContinue = true
+					break
+				}
+			}
+			if isContinue {
+				continue
+			}
+			matchUser := users[u]
+			if matchUser == nil {
+				matchUser = &MatchUser{
+					Keys: []string{},
+				}
+			}
+			matchUser.Keys = append(matchUser.Keys, k)
+			users[u] = matchUser
+		}
+	}
+	return &users
+}

+ 47 - 27
src/jfw/modules/pushsubscribe/src/public/entity.go

@@ -2,52 +2,72 @@ package public
 
 import (
 	"qfw/util"
-	"qfw/util/elastic"
 )
 
 type UserInfo struct {
 	Id            string                     //mongoid
-	Province      string                     //省份
 	Key_notkey    map[string]map[string]bool //关键词-排除词
-	Key_area      map[string]map[string]bool //关键词-信息范围
-	Key_infotype  map[string]map[string]bool //关键词-信息类型
-	OriginalKeys  []string                   //用户兴趣
-	Keys          []string                   //用户兴趣
-	NotKeys       []string                   //用户不感兴趣
+	Keys          []string                   //用户原始关键词
 	S_m_openid    string                     //公众号openid
 	A_m_openid    string                     //app微信登录openid
 	Phone         string                     //app手机号登录
-	Jpushid       string
-	Opushid       string
-	InterestDate  int64
-	WxPush        int
-	AppPush       int
-	MailPush      int
-	PchelperPush  int
-	RateMode      int
-	Email         string
-	AllKeys       []elastic.KeyConfig
-	ModifyDate    string
-	AppPhoneType  string
-	ApplyStatus   int
-	Subscribe     int
-	UserType      int
-	MergeOrder    interface{}
-	NickName      string
-	FirstPushTime int64
-	//SmartSet      int //智能订阅 1开启 0关闭
-	//DataExport    int //是否导出数据 1开启 0关闭
+	Jpushid       string                     //极光推送id
+	Opushid       string                     //厂商推送id
+	WxPush        int                        //是否开启微信推送
+	AppPush       int                        //是否开启app推送
+	MailPush      int                        //是否开启邮箱推送
+	PchelperPush  int                        //是否pc助手推送
+	RateMode      int                        //推送时间
+	Email         string                     //邮箱
+	ModifyDate    string                     //修改时间
+	AppPhoneType  string                     //手机型号
+	ApplyStatus   int                        //是否申请打开订阅推送
+	Subscribe     int                        //是否关注
+	UserType      int                        //用户类型
+	MergeOrder    interface{}                //用户合并顺序
+	NickName      string                     //昵称
+	FirstPushTime int64                      //第一次推送时间
+	VipStatus     int                        // 1--试用 2--正式
+	MatchType     int                        //匹配方式 1-标题 2-正文
+	O_jy          *O_jy
 	//
 	//Active int
 	//Fail   *Fail //失败重试
 }
 
+type O_jy struct {
+	Area     map[string]map[string]bool //关键词-信息范围
+	Infotype map[string]map[string]bool //关键词-信息类型
+}
+
+//关键词
+type KeySet struct {
+	Keys       []string `json:"key"`       //关键词
+	NotKeys    []string `json:"notkey"`    //排除词
+	InfoTypes  []string `json:"infotype"`  //信息类型
+	Areas      []string `json:"area"`      //地区
+	AppendKeys []string `json:"appendkey"` //附加词
+}
+
 type Fail struct {
 	Wx    int
 	App   int
 	Email int
 }
 
+type Bidding struct {
+	Id              string
+	Area            string
+	City            string
+	Buyerclass      string
+	Publishtime     int64
+	S_subscopeclass []string
+	Subtype         string
+	Title           string
+	Toptype         string
+	Type            string
+}
+
 type SortList []*MatchInfo
 
 func (s SortList) Len() int {

+ 8 - 0
src/jfw/modules/pushsubscribe/src/public/util.go

@@ -0,0 +1,8 @@
+package public
+
+func IsVipUser(vipStatus int) bool {
+	if vipStatus == 1 || vipStatus == 2 {
+		return true
+	}
+	return false
+}

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

@@ -8,7 +8,7 @@
 		"size": 5,
 		"timeout": 20
 	},
-	"redisServers": "pushcache_2_a=192.168.3.128:5000,pushcache_2_b=192.168.3.128:5000",
+	"redisServers": "pushcache_2_a=192.168.3.128:5000,pushcache_2_b=192.168.3.128:5000,other=192.168.3.128:5000",
 	"mail_content": "<tr><td><num>%d</num></td><td><div class='tit'><a style='color: #000;text-decoration: none;' href='%s?mail' >%s</a></div></td><td style='float: right;' class='infos' ><span class='%s'>%s</span><span class='%s'>%s</span><span class='%s'>%s</span><span class='time'>%s</span></td></tr>",
 	"mail_html": "<body><style> *,body,html{margin:0;padding:0;font-family: tahoma, arial, 'Hiragino Sans GB', 'Microsoft YaHei', 宋体, sans-serif;font-size:16px; }#all{margin:0 auto;width:1024px;overflow:hidden;}.head{margin:5x;margin-top:20px;}.des{padding-bottom:15px;border-bottom:1px solid #e8ecee;color: #686868;}td a:hover {color: #fe7379;text-decoration: underline;} .tit{width:560px;overflow: hidden;    white-space: nowrap;text-overflow: ellipsis;}.area {background-color: #2cb7ca;border-radius: 3px;color: #fff;padding: 1px 2px;}.type {background-color: #ffba00;border-radius: 3px;color: #fff;padding: 1px 2px;margin-left:5px;}.industry {background-color: #25c78c;border-radius: 3px;color: #fff;padding: 1px 2px;margin-left:5px;}.infos span{display:inline-block;margin-left:5px;}td{padding-top:8px;padding-bottom:8px;height:20px;line-height:20px;}num{padding:0 5px 0 0; font-size:16px;color:#2cb7ca;font-weight:bolder;}.keys{color:blue;} </style><div id='all'><div class='head'><IMG width='100px' src=http://www.zhaobiao.info/images/swordfish/sf_01.png /></div><div class='head des'>根据您设置的关键词 :<span class='keys'>%s</span>,剑鱼标讯为您推送30天之内的信息。点击标题可查看详情信息</div><table cellpadding='0' cellspacing='0'>%s</table></div> </body>",
 	"mail_title": "您有新的%s信息-剑鱼标讯",
@@ -31,6 +31,7 @@
 		}
 	],
 	"maxPushSize": 50,
+	"vipOneDayMaxPushSize": 2000,
 	"mgoAddr": "192.168.3.128:27080",
 	"mgoSize": 10,
 	"testids": ["5d6e142a25ef871f08a72662"],

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

@@ -33,6 +33,7 @@ type sysConfig struct {
 	OncePushTime            string      `json:"oncePushTime"`
 	OtherPushTimes          []string    `json:"otherPushTimes"`
 	WxPollSize              int         `json:"wxPollSize"`
+	VipOneDayMaxPushSize    int64       `json:"vipOneDayMaxPushSize"`
 	AppPollSize             int         `json:"appPollSize"`
 	MailSleep               int         `json:"mailSleep"`
 	CassandraSleep          int         `json:"cassandraSleep"`

+ 14 - 20
src/jfw/modules/pushsubscribe/src/push/job/dopush.go

@@ -9,6 +9,7 @@ import (
 	"qfw/util"
 	"qfw/util/mail"
 	"qfw/util/mongodb"
+	"qfw/util/redis"
 	"strconv"
 	"strings"
 	"time"
@@ -57,8 +58,8 @@ func (d *doPush) Do(taskType int, isSave bool, wxPush, appPush, mailPush int, k
 	infos := []map[string]interface{}{}
 	publishTitle := map[string]bool{}
 	pushIds := []string{}
+	nowymd := util.NowFormat(util.Date_yyyyMMdd)
 	//邮件附件
-	//var fmdatas = []map[string]interface{}{}
 	for _, ks := range *sl {
 		k2 := *ks.Info
 		title := strings.Replace(k2["title"].(string), "\n", "", -1)
@@ -115,7 +116,7 @@ func (d *doPush) Do(taskType int, isSave bool, wxPush, appPush, mailPush int, k
 			dates := util.LongToDate(k2["publishtime"], false)
 			//标题替换
 			otitle := title
-			for _, kw := range k.OriginalKeys {
+			for _, kw := range k.Keys {
 				kws := strings.Split(kw, "+")
 				n := 0
 				otitle2 := otitle
@@ -137,23 +138,16 @@ func (d *doPush) Do(taskType int, isSave bool, wxPush, appPush, mailPush int, k
 				industryclass = ""
 			}
 			mailContent += fmt.Sprintf(SysConfig.Mail_content, i, url, otitle, classArea, area, classType, infotype, industryclass, industry, dates)
-			// if k.DataExport == 1 {
-			// 	//附件数据
-			// 	fmdatas = append(fmdatas, map[string]interface{}{
-			// 		"publishtime": k2["publishtime"],
-			// 		"subtype":     k2["subtype"],
-			// 		"buyer":       k2["buyer"],
-			// 		"projectname": k2["projectname"],
-			// 		"budget":      k2["budget"],
-			// 		"bidopentime": k2["bidopentime"],
-			// 		"winner":      k2["winner"],
-			// 		"bidamount":   k2["bidamount"],
-			// 	})
-			// }
 		}
-		if i >= SysConfig.MaxPushSize {
+		if IsVipUser(k.VipStatus) {
+			if redis.Incr("other", fmt.Sprintf("daycount_%s_%s", nowymd, k.Id)) >= SysConfig.VipOneDayMaxPushSize {
+				break
+			}
+		} else {
 			//限制最大信息条数
-			break
+			if i >= SysConfig.MaxPushSize {
+				break
+			}
 		}
 	}
 	if i == 0 {
@@ -170,7 +164,7 @@ func (d *doPush) Do(taskType int, isSave bool, wxPush, appPush, mailPush int, k
 	}
 	if taskType != 0 && isSave {
 		//推送记录id
-		pushId := putil.SaveSendInfo(k, pushIds, infos)
+		pushId := putil.SaveSendInfo(k, infos)
 		if pushId == "" {
 			logger.Info("推送任务", taskType, "保存到cassandra出错", k.Id)
 			return
@@ -215,7 +209,7 @@ func (d *doPush) Do(taskType int, isSave bool, wxPush, appPush, mailPush int, k
 				LastTip = fmt.Sprintf("...(共%d条)", i)
 			}
 			LastTipLen := len([]rune(LastTip))
-			wxTitleKeys := strings.Join(k.OriginalKeys, ";")
+			wxTitleKeys := strings.Join(k.Keys, ";")
 			if len([]rune(wxTitleKeys)) > 8 {
 				wxTitleKeys = string([]rune(wxTitleKeys)[:8]) + "..."
 			}
@@ -303,7 +297,7 @@ func (d *doPush) Do(taskType int, isSave bool, wxPush, appPush, mailPush int, k
 	//发送邮件
 	if mailPush == 1 {
 		logger.Info("推送任务", taskType, "开始邮箱推送", k.Id)
-		html := fmt.Sprintf(SysConfig.Mail_html, strings.Replace(strings.Join(k.OriginalKeys, ";"), "+", " ", -1), mailContent)
+		html := fmt.Sprintf(SysConfig.Mail_html, strings.Replace(strings.Join(k.Keys, ";"), "+", " ", -1), mailContent)
 		subject := fmt.Sprintf(SysConfig.Mail_title, "招标")
 		isPushOk := d.SendMail(k.Email, subject, html, nil)
 		if isPushOk {

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

@@ -320,28 +320,27 @@ func (p *pushJob) Push() {
 				}()
 				words, _ := v["words"].([]interface{})
 				u := &UserInfo{
-					Id:           util.ObjToString(v["userid"]),
-					OriginalKeys: util.ObjArrToStringArr(words),
-					WxPush:       util.IntAll(v["wxpush"]),
-					AppPush:      util.IntAll(v["apppush"]),
-					MailPush:     util.IntAll(v["mailpush"]),
-					PchelperPush: util.IntAll(v["pchelperpush"]),
-					Email:        util.ObjToString(v["email"]),
-					S_m_openid:   util.ObjToString(v["s_m_openid"]),
-					A_m_openid:   util.ObjToString(v["a_m_openid"]),
-					Phone:        util.ObjToString(v["phone"]),
-					Jpushid:      util.ObjToString(v["jpushid"]),
-					Opushid:      util.ObjToString(v["opushid"]),
-					UserType:     util.IntAll(v["usertype"]),
-					RateMode:     util.IntAllDef(v["ratemode"], 1),
-					//SmartSet:      util.IntAllDef(v["smartset"], 1),
-					//DataExport:    util.IntAll(v["dataexport"]),
+					Id:            util.ObjToString(v["userid"]),
+					Keys:          util.ObjArrToStringArr(words),
+					WxPush:        util.IntAll(v["wxpush"]),
+					AppPush:       util.IntAll(v["apppush"]),
+					MailPush:      util.IntAll(v["mailpush"]),
+					PchelperPush:  util.IntAll(v["pchelperpush"]),
+					Email:         util.ObjToString(v["email"]),
+					S_m_openid:    util.ObjToString(v["s_m_openid"]),
+					A_m_openid:    util.ObjToString(v["a_m_openid"]),
+					Phone:         util.ObjToString(v["phone"]),
+					Jpushid:       util.ObjToString(v["jpushid"]),
+					Opushid:       util.ObjToString(v["opushid"]),
+					UserType:      util.IntAll(v["usertype"]),
+					RateMode:      util.IntAllDef(v["ratemode"], 1),
 					AppPhoneType:  util.ObjToString(v["appphonetype"]),
 					ApplyStatus:   util.IntAll(v["applystatus"]),
 					Subscribe:     util.IntAllDef(v["subscribe"], 1),
 					ModifyDate:    util.ObjToString(v["modifydate"]),
 					MergeOrder:    v["mergeorder"],
 					FirstPushTime: util.Int64All(v["firstpushtime"]),
+					VipStatus:     util.IntAll(v["vipstatus"]),
 				}
 				logger.Info("推送任务", p.taskType, "开始推送用户", "userType", u.UserType, "userId", u.Id, "s_m_openid", u.S_m_openid, "a_m_openid", u.A_m_openid, "phone", u.Phone, "subscribe", u.Subscribe, "applystatus", u.ApplyStatus, "jpushid", u.Jpushid, "opushid", u.Opushid, "phoneType", u.AppPhoneType, "rateMode", u.RateMode, "email", u.Email)
 				wxPush, appPush, mailPush := 0, 0, 0

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

@@ -38,19 +38,19 @@ func (r *repairJob) Execute(param string) bool {
 				}()
 				words, _ := v["words"].([]interface{})
 				u := &public.UserInfo{
-					Id:           util.ObjToString(v["userid"]),
-					OriginalKeys: util.ObjArrToStringArr(words),
-					WxPush:       util.IntAll(v["wxpush"]),
-					AppPush:      util.IntAll(v["apppush"]),
-					MailPush:     util.IntAll(v["mailpush"]),
-					Email:        util.ObjToString(v["email"]),
-					S_m_openid:   util.ObjToString(v["s_m_openid"]),
-					A_m_openid:   util.ObjToString(v["a_m_openid"]),
-					Phone:        util.ObjToString(v["phone"]),
-					Jpushid:      util.ObjToString(v["jpushid"]),
-					Opushid:      util.ObjToString(v["opushid"]),
-					UserType:     util.IntAll(v["usertype"]),
-					RateMode:     util.IntAllDef(v["ratemode"], 1),
+					Id:         util.ObjToString(v["userid"]),
+					Keys:       util.ObjArrToStringArr(words),
+					WxPush:     util.IntAll(v["wxpush"]),
+					AppPush:    util.IntAll(v["apppush"]),
+					MailPush:   util.IntAll(v["mailpush"]),
+					Email:      util.ObjToString(v["email"]),
+					S_m_openid: util.ObjToString(v["s_m_openid"]),
+					A_m_openid: util.ObjToString(v["a_m_openid"]),
+					Phone:      util.ObjToString(v["phone"]),
+					Jpushid:    util.ObjToString(v["jpushid"]),
+					Opushid:    util.ObjToString(v["opushid"]),
+					UserType:   util.IntAll(v["usertype"]),
+					RateMode:   util.IntAllDef(v["ratemode"], 1),
 					//SmartSet:     util.IntAllDef(v["smartset"], 1),
 					//DataExport:   util.IntAll(v["dataexport"]),
 					AppPhoneType: util.ObjToString(v["appphonetype"]),

+ 18 - 8
src/jfw/modules/pushsubscribe/src/push/util/util.go

@@ -8,7 +8,6 @@ import (
 	"qfw/util"
 	"qfw/util/jy"
 	"sort"
-	"strings"
 	"time"
 	ca "ucbsutil/cassandra"
 
@@ -107,7 +106,7 @@ func ModeTransform(userType int, o_msgset map[string]interface{}) (int, int, int
 }
 
 //保存发送信息
-func SaveSendInfo(k *UserInfo, pushIds []string, infos []map[string]interface{}) string {
+func SaveSendInfo(k *UserInfo, infos []map[string]interface{}) string {
 	cassandraPoll <- true
 	defer func() {
 		<-cassandraPoll
@@ -123,13 +122,24 @@ func SaveSendInfo(k *UserInfo, pushIds []string, infos []map[string]interface{})
 		now = now.Add(time.Hour * time.Duration(h)).Add(time.Minute * time.Duration(m))
 	}
 	date := now.Unix()
-	wxpush := map[string]interface{}{
-		"dateymd":  now.Format(util.Date_yyyyMMdd),
-		"uid":      k.Id,
-		"date":     date,
-		"pushinfo": strings.Join(pushIds, ","),
+	dateymd := now.Format(util.Date_yyyyMMdd)
+	var saves []map[string]interface{}
+	for _, info := range infos {
+		wxpush := map[string]interface{}{
+			"dateymd":    dateymd,
+			"uid":        k.Id,
+			"date":       date,
+			"pushinfo":   fmt.Sprint(info["_id"]),
+			"keys":       k.Keys,
+			"area":       util.ObjToString(info["area"]),
+			"city":       util.ObjToString(info["city"]),
+			"buyerclass": util.ObjToString(info["buyerclass"]),
+		}
+		if ca.Save("jy_pushsubscribe", wxpush) {
+			saves = append(saves, info)
+		}
 	}
-	if ca.Save("jy_pushsubscribe", wxpush) {
+	if len(saves) > 0 {
 		updateRedis(date, k, infos)
 		return fmt.Sprint(date)
 	}

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

@@ -26,5 +26,6 @@ func init() {
 	xweb.AddAction(&service.Trial{})
 	xweb.AddAction(&service.Order{})
 	xweb.AddAction(&service.EditSub{})
+	xweb.AddAction(&service.OrderListDetails{})
 
 }

+ 12 - 0
src/jfw/modules/subscribepay/src/service/afterPay.go

@@ -18,6 +18,18 @@ type AfterPay struct {
 	*xweb.Action
 	getUserInfo xweb.Mapper `xweb:"/afterPay/getUserInfo"` //获取用户当前支付后的信息
 	setUserInfo xweb.Mapper `xweb:"/afterPay/setUserInfo"` //保存用户当前支付后的信息
+	pushView    xweb.Mapper `xweb:"/afterPay/pushView"`    //VIP推送预览
+}
+
+//
+func (a *AfterPay) PushView() error {
+	defer qutil.Catch()
+	userId, _ := a.GetSession("userId").(string)
+	if userId != "" {
+		sql := GetSqlObjFromId(userId)
+		log.Println("sql:", sql)
+	}
+	return nil
 }
 
 //

+ 56 - 18
src/jfw/modules/subscribepay/src/service/orderListDetails.go

@@ -3,16 +3,18 @@ package service
 import (
 	"errors"
 	"jfw/config"
-	"jfw/public"
 	"log"
 	"strconv"
 	"strings"
 	"time"
 	"util"
 
-	"github.com/go-xweb/xweb"
+	"jfw/public"
 
 	qutil "qfw/util"
+
+	"github.com/go-xweb/xweb"
+	"gopkg.in/mgo.v2/bson"
 )
 
 type OrderListDetails struct {
@@ -22,6 +24,7 @@ type OrderListDetails struct {
 	myOrderPaging     xweb.Mapper `xweb:"/orderListDetails/myOrderPaging"`     //查询订单分页
 	deleteOrder       xweb.Mapper `xweb:"/orderListDetails/deleteOrder"`       //删除订单
 	applyInvoice      xweb.Mapper `xweb:"/orderListDetails/applyInvoice"`      //开发票
+	payCancel         xweb.Mapper `xweb:"/orderListDetails/payCancel"`         //支付成功后,其余订单改为已取消
 }
 
 var (
@@ -194,10 +197,10 @@ func (o *OrderListDetails) DeleteOrder() error {
 		var boo = false
 		if cancel == "cancel" {
 			//取消订单
-			boo = public.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"order_status": -2})
+			boo = util.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"order_status": -2})
 		} else {
 			//删除订单
-			boo = public.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"order_status": -1})
+			boo = util.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"order_status": -1})
 		}
 		o.ServeJson(map[string]interface{}{
 			"success":     boo,
@@ -222,13 +225,13 @@ func (o *OrderListDetails) ApplyInvoice() error {
 	}
 	if applyBill_type == "个人" {
 		applyBill_status = 1
-		updateBl = public.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"applyBill_status": applyBill_status})
+		updateBl = util.Mysql.Update(tableName_order, queryMap, map[string]interface{}{"applyBill_status": applyBill_status})
 
 	} else if applyBill_type == "单位" {
 		applyBill_status = 1                                 //状态
 		applyBill_company = o.GetString("applyBill_company") //公司名
 		applyBill_taxnum = o.GetString("applyBill_taxnum")   //纳税人识别号
-		updateBl = public.Mysql.Update(tableName_order, queryMap, map[string]interface{}{
+		updateBl = util.Mysql.Update(tableName_order, queryMap, map[string]interface{}{
 			"applyBill_company": applyBill_company,
 			"applyBill_taxnum":  applyBill_taxnum,
 			"applyBill_status":  applyBill_status,
@@ -238,7 +241,7 @@ func (o *OrderListDetails) ApplyInvoice() error {
 	//判断条件
 	if updateBl {
 		go func() {
-			orderdata := public.Mysql.FindOne(tableName_order, map[string]interface{}{
+			orderdata := util.Mysql.FindOne(tableName_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", "")
 			tt := time.Now()
@@ -252,33 +255,68 @@ func (o *OrderListDetails) ApplyInvoice() error {
 	return nil
 }
 
+//支付成功后,将该订单以外的所有订单状态改为已取消状态 已取消:-2
+func (o *OrderListDetails) PayCancel() bool {
+	order_code := o.GetString("order_code")
+	userId := qutil.ObjToString(o.GetSession("userId"))
+	//	参数:查询语句,不等语句,修改条件
+	bl := util.Mysql.UpdateByNotEqual(tableName_order, bson.M{
+		"user_id":      userId,
+		"product_type": "vip订阅",
+	}, bson.M{
+		"order_code":   order_code,
+		"order_status": orderStatus_deleted,
+	}, bson.M{
+		"order_status": orderStatus_cancel,
+	})
+	return bl
+}
+
 func (o *OrderListDetails) SetRes(res []map[string]interface{}, queryM map[string]interface{}) {
 	for _, v := range res {
-		filter_publishtime := v["filter_publishtime"]
-		if filter_publishtime != nil || filter_publishtime != "" {
-			timeArr := strings.Split(filter_publishtime.(string), "_")
-			if len(timeArr) == 2 {
-				start, err := strconv.ParseInt(timeArr[0], 10, 64)
-				end, erro := strconv.ParseInt(timeArr[1], 10, 64)
-				if err == nil && erro == nil {
-					v["filter_publishtime"] = qutil.FormatDateByInt64(&start, layout_date) + "-" + qutil.FormatDateByInt64(&end, layout_date)
+		if v["filter_publishtime"] != nil {
+			filter_publishtime := v["filter_publishtime"]
+			if filter_publishtime != nil {
+				timeArr := strings.Split(filter_publishtime.(string), "_")
+				if len(timeArr) == 2 {
+					start, err := strconv.ParseInt(timeArr[0], 10, 64)
+					end, erro := strconv.ParseInt(timeArr[1], 10, 64)
+					if err == nil && erro == nil {
+						v["filter_publishtime"] = qutil.FormatDateByInt64(&start, layout_date) + "-" + qutil.FormatDateByInt64(&end, layout_date)
+					}
 				}
 			}
 		}
-		v["filter_id"] = qutil.SE.Encode2Hex(v["filter_id"].(string))
+		if v["filter_id"] != nil {
+			v["filter_id"] = qutil.SE.Encode2Hex(v["filter_id"].(string))
+		}
 		orderMoney := v["order_money"]
 		if orderMoney != nil {
 			v["order_money"] = float64(orderMoney.(int64)) / 100
 		}
-		if v["id"] != nil && orderMoney != nil && v["order_code"] != nil {
+		if v["id"] != nil && v["order_money"] != nil && v["order_code"] != nil {
 			v["token"] = public.GetWaitPayToken(v["id"].(int64), int(orderMoney.(int64)), v["order_code"].(string), v["pay_way"].(string), queryM["user_id"].(string))
 		}
+		if v["pay_time"] != nil && v["product_type"] == "vip订阅" {
+			//TODO 还没录入数据
+			data, err := util.MQFW.FindOne("user", bson.M{"_id": queryM["user_id"]})
+			if len(*data) > 0 && err {
+				v["i_vip_status"] = qutil.ObjToString((*data)["i_vip_status"])
+				v["l_vip_starttime"] = qutil.ObjToString((*data)["l_vip_starttime"])
+				v["l_vip_endtime"] = qutil.ObjToString((*data)["l_vip_endtime"])
+			} else {
+				v["i_vip_status"] = "1"
+				v["l_vip_starttime"] = "1571991460"
+				v["l_vip_endtime"] = "1572596260"
+			}
+		}
 	}
+	log.Println(res)
 }
 
 //查询数据
 func (o *OrderListDetails) Datas(queryM map[string]interface{}, pageNum int) (haveNextPage bool, result []map[string]interface{}, err error) {
-	res := *public.Mysql.Find(tableName_order, queryM, "id,order_code,filter_publishtime,create_time,data_spec,filter_id,filter_keys,order_money,data_count,order_status,pay_way", "create_time desc", -1, 0)
+	res := *util.Mysql.Find(tableName_order, queryM, "id,order_code,filter_publishtime,create_time,data_spec,filter_id,filter_keys,order_money,data_count,order_status,pay_way,product_type,filter,pay_time", "create_time desc", -1, 0)
 	if len(res) > 0 {
 		start := (pageNum - 1) * pagesize_max
 		end := pageNum * pagesize_max

+ 118 - 0
src/jfw/modules/subscribepay/src/service/vrew.go

@@ -0,0 +1,118 @@
+package service
+
+import (
+	"encoding/json"
+	"log"
+	qutil "qfw/util"
+	"strconv"
+	"util"
+
+	"gopkg.in/mgo.v2/bson"
+)
+
+/*已选条件--关键词*/
+type KeyWord struct {
+	Keyword  []string `json:"key"`       //关键词
+	Appended []string `json:"appendkey"` //附加词
+	Exclude  []string `json:"notkey"`    //排除词
+}
+
+/*已选条件*/
+type SieveCondition struct {
+	Area       []string  //地区-省份
+	City       []string  //地区-城市
+	Buyerclass []string  //采购行业
+	Keyword    []KeyWord //关键词
+	SelectType string    //筛选(正文 or 标题)
+	Subtype    []string  //信息类型
+}
+
+func GetSqlObjFromId(_id string) *SieveCondition {
+	var (
+		query *map[string]interface{}
+		ok    bool
+	)
+	if query, ok = util.MQFW.FindById("user", _id, `{"o_vipjy":1}`); !ok {
+		return nil
+	}
+	o_vipjy, _ := (*query)["o_vipjy"].(map[string]interface{})
+	a_items := o_vipjy["a_items"].([]interface{})
+	a_buyerclass := o_vipjy["a_buyerclass"].([]interface{})
+	a_infotype := o_vipjy["a_infotype"].([]interface{})
+	o_area := o_vipjy["o_area"].(map[string]interface{})
+	return &SieveCondition{
+		Keyword:    getKeyWordArrFromDbResult(a_items),
+		Buyerclass: qutil.ObjArrToStringArr(a_buyerclass),
+		Subtype:    qutil.ObjArrToStringArr(a_infotype),
+		Area:       getStringArrFromDbResult(o_area, 1),
+		City:       getStringArrFromDbResult(o_area, 2),
+		SelectType: strconv.Itoa(o_vipjy["i_matchway"].(int)),
+	}
+}
+
+//
+func getStringArrFromDbResult(area map[string]interface{}, i int) (arr []string) {
+	if area == nil {
+		return
+	}
+	for k, v := range area {
+		log.Println(k, v)
+	}
+	return
+}
+
+//关键词 附加词 排除词
+func getKeyWordArrFromDbResult(a_items []interface{}) (arr []KeyWord) {
+	if a_items == nil {
+		return
+	}
+	for _, v := range a_items {
+		kwsArr := v.(map[string]interface{})["a_key"]
+		for _, k := range kwsArr.([]interface{}) {
+			kw := KeyWord{}
+			b, e := json.Marshal(k)
+			if e != nil {
+				log.Println(e.Error())
+			}
+			json.Unmarshal(b, &kw)
+			arr = append(arr, kw)
+		}
+	}
+	return
+}
+
+//初始化vip订阅关键词
+func MergeKws(userId string) {
+	defer qutil.Catch()
+	if userId == "" {
+		return
+	}
+	data, ok := util.MQFW.FindById("user", userId, `{"o_jy":1,"o_vipjy":1}`)
+	var o_jy map[string]interface{}
+	var o_vipjy map[string]interface{}
+	if ok && data != nil && len(*data) > 0 {
+		o_vipjy, _ = (*data)["o_vipjy"].(map[string]interface{})
+		a_items, _ := o_vipjy["a_items"].([]interface{})
+		if a_items == nil { //首次
+			var o_kws = make(map[string]interface{})
+			o_jy, _ = (*data)["o_jy"].(map[string]interface{})
+			a_key, _ := o_jy["a_key"].([]interface{})
+			var _key = make([]map[string]interface{}, len(a_key))
+			if len(a_key) > 0 {
+				o_kws["s_item"] = "未分类"
+				for k, v := range a_key {
+					keyarr := v.(map[string]interface{})
+					_key[k] = map[string]interface{}{"key": keyarr["key"].([]interface{})}
+				}
+			}
+			o_kws["a_key"] = _key
+			if o_kws != nil && len(o_kws) > 0 {
+				a := util.MQFW.UpdateById("user", userId, bson.M{
+					"$push": bson.M{"o_vipjy.a_items": o_kws},
+				})
+				log.Println(a)
+			}
+		}
+	}
+
+}

+ 1 - 1
src/jfw/public/search.go

@@ -239,7 +239,7 @@ func getDataExportSql(scd *SieveCondition) string {
 	}
 
 	qstr := fmt.Sprintf(query, strings.Join(musts, ","), strings.Join(bools, ","), boolsNum)
-	//	log.Println("------qstr", qstr)
+	log.Println("------qstr", qstr)
 	return qstr
 }
 

+ 1 - 1
src/web/templates/weixin/dataExport/dataExport_applyInvoice.html

@@ -327,7 +327,7 @@
 					}
 				}
 				if (submitBl){
-					$.post('/front/wxMyOrder/wxApplyInvoice',formParam+"&demo-radio="+$(".type").html(),function(data){ 
+					$.post('/subscribepay/orderListDetails/applyInvoice',formParam+"&demo-radio="+$(".type").html(),function(data){ 
 										if(data.flag){
 											//window.location.href="/front/wxMyorder/wxPaySuccess/" + {{.T.order_code}}
 											sessionStorage.applysuccess="1";

+ 40 - 33
src/web/templates/weixin/dataExport/dataExport_toMyOrder.html

@@ -443,7 +443,7 @@
 			                    text: '确定',
 			                    btnClass: 'btn-primary-0',
 			                    action: function() {
-			                        $.post("/subscribepay/order/deleteOrder", {"id":id,"pageNum":pageIndex,"type":typ},function(data){
+			                        $.post("/subscribepay/orderListDetails/deleteOrder", {"id":id,"pageNum":pageIndex,"type":typ},function(data){
 			                                if(data && data["success"]){
 			                                    var self = $(obj).parent().parent();
 			                                    var parent = self.parent();
@@ -615,7 +615,7 @@
 			                    text: '确定',
 			                    btnClass: 'btn-primary-0',
 			                    action: function() {
-			                        $.post("/subscribepay/order/deleteOrder", {"id":id,"pageNum":pageIndex,"type":typ,"cancel":"cancel"},function(data){
+			                        $.post("/subscribepay/orderListDetails/deleteOrder", {"id":id,"pageNum":pageIndex,"type":typ,"cancel":"cancel"},function(data){
 			                                if(data && data["success"]){
 			                                    $.alert({
 			                                        title:"提示信息",
@@ -714,7 +714,7 @@
 //					sessionStorage.removeItem("payMsg")
 //					sessionStorage.removeItem("deleteIndex")
 					var result = true;
-					$.post("/subscribepay/order/myOrder",{"type":typ},function(data){
+					$.post("/subscribepay/orderListDetails/myOrder",{"type":typ},function(data){
 							$(".loading_").hide();
 							var list=data.res;
 							dataCache =data.res;
@@ -741,7 +741,7 @@
 							wxflag = $(' .main').dropload({
 						        scrollArea : $(".main"),
 						        loadDownFn : function(me){
-									$.post('/subscribepay/order/myOrderPaging', {"pageNum": pageIndex,"type":typ},function(data){
+									$.post('/subscribepay/orderListDetails/myOrderPaging', {"pageNum": pageIndex,"type":typ},function(data){
 											//没有数据
 											if(data.res==null||data.res.length==0){
 												noMoreData(me);
@@ -915,12 +915,19 @@
 	                        //地区
 							var region_vipArr = filter_vip.area;
 	                        var region_vip=""
+	                        var region_city_vip=" "
 	                        for( i in region_vipArr){
 	                        	region_vip+=i;
-	                        	region_vip+=region_vipArr[i];
+	                        	if(Array.isArray(region_vipArr[i])){
+	                        		for( j in region_vipArr[i]){
+	                        			region_city_vip+=region_vipArr[i][j]+" ";
+	                        		}
+	                        	}
+	                        	region_vip+=region_city_vip;
 	                        	region_vip+=" ";
 	                        }
 	                        region_vip=region_vip.replace(/(\s*$)/g, "");
+	                        console.log(region_vip)
 	                        //行业
 	                        var industry_vip = filter_vip.industry+"";	//数组
 	                        industry_vip=industry_vip.replace(/,/g,"、")
@@ -991,7 +998,7 @@
 	                        }
 	                        //vip状态 0不是vip 1试用 2正式
 	                        var status_vip = obj.i_vip_status;
-	                        if (status_vip==0){
+	                        if (orderStatus_vip!="已完成"){
 	                        //未支付 或 已取消
 	                        	listhtml+='<div class="card">'
 											+'<div class="card-header">'
@@ -1016,36 +1023,36 @@
 											+iconHtml
 									+'</div>'
 	                        }else{
-	                       //有效时间
-	                       var starttime_vip= obj.l_vip_starttime;
-	                       var endtime_vip= obj.l_vip_endtime;
-	                       starttime_vip = timestampToTime(starttime_vip)
-	                       endtime_vip = timestampToTime(endtime_vip)
-	                       var effectivetime_vip =starttime_vip+"-"+endtime_vip;
-	                        //已完成
-	                        	listhtml+='<div class="card">'
-											+'<div class="card-header">'
-												+'<span class="time" style="color:#888888">'+createTime_vip+'</span>'
-												+orderHtml
-											+'</div>'
-											+'<div class="card-content">'
-												+'<a  eid='+orderCode_vip+' class="media" isvipOrder="true">'
-													+'<div class="media-img">'
-														+'<img src="/vipsubscribe/image/vip_order.png">'
+			                       //有效时间
+			                       var starttime_vip= obj.l_vip_starttime;
+			                       var endtime_vip= obj.l_vip_endtime;
+			                       starttime_vip = timestampToTime(starttime_vip)
+			                       endtime_vip = timestampToTime(endtime_vip)
+			                       var effectivetime_vip =starttime_vip+"-"+endtime_vip;
+			                        //已完成
+			                        	listhtml+='<div class="card">'
+													+'<div class="card-header">'
+														+'<span class="time" style="color:#888888">'+createTime_vip+'</span>'
+														+orderHtml
 													+'</div>'
-													+'<div class="media-info">'
-														+'<p class="item-ifo ellipsis">区域:'+ region_vip+'</p>'
-														+'<p class="item-ifo ellipsis">行业:'+ industry_vip +'条</p>'
-														+'<p class="item-ifo ellipsis">订阅周期:'+effectiveduration_vip+'</p>'
-														+'<p class="item-ifo ellipsis">有效日期:'+effectivetime_vip+'</p>'
+													+'<div class="card-content">'
+														+'<a  eid='+orderCode_vip+' class="media" isvipOrder="true">'
+															+'<div class="media-img">'
+																+'<img src="/vipsubscribe/image/vip_order.png">'
+															+'</div>'
+															+'<div class="media-info">'
+																+'<p class="item-ifo ellipsis">区域:'+ region_vip+'</p>'
+																+'<p class="item-ifo ellipsis">行业:'+ industry_vip +'条</p>'
+																+'<p class="item-ifo ellipsis">订阅周期:'+effectiveduration_vip+'</p>'
+																+'<p class="item-ifo ellipsis">有效日期:'+effectivetime_vip+'</p>'
+															+'</div>'
+														+'</a>'
+														+'<div class="price">'
+															+'<strong class="current">¥'+orderMoney_vip+'</strong>'
+														+'</div>'
 													+'</div>'
-												+'</a>'
-												+'<div class="price">'
-													+'<strong class="current">¥'+orderMoney_vip+'</strong>'
-												+'</div>'
+													+iconHtml
 											+'</div>'
-											+iconHtml
-									+'</div>'
 	                        }
 	                        
 						}

+ 2 - 5
src/web/templates/weixin/vipsubscribe/keyWord.html

@@ -163,8 +163,8 @@
                         var _userData = r.userData;
                         var _vipData = _userData["o_vipjy"];
                         modifyFlag = false;
-                        a_items = _vipData["a_items"]
-                        if (a_items!=undefined&&a_items.length>0){
+                        if (_vipData["a_items"]!=undefined&&_vipData["a_items"].length>0){
+                            a_items = _vipData["a_items"]
                             pageState.isFirstSetKeyword = false;
                             appendHtml(a_items);
                         }else{
@@ -475,7 +475,6 @@
         // 设置一条空记录,用户第一次进入添加关键词点击确定时候调用
         function setEmptyHistory() {
             if (pageState.isFirstSetKeyword) {
-                    console.log("33333333333")
                 history.pushState({}, "","")
                 pageState.isFirstSetKeyword = false
             }
@@ -488,7 +487,6 @@
                 // isClassifyColumnShow = true说明是添加新分类
                 var isClassifyColumnShow = $('.add-keyword-container').is(':hidden');
                 if (isClassifyColumnShow) {
-                    console.log("11111111111111111")
                     history.pushState({}, "","");
                     classify_index = $(".classify-list li").length;
                     // 还原有数据
@@ -510,7 +508,6 @@
             // 点击分类目录的每一项,进入对应列表
             $('.classify-list').on('click', '.classify-item-r', function() {
                 // 添加一条空历史记录
-                    console.log("2222222222")
                 history.pushState({}, "","");
                 classify_name = $(this).parent().find('.classify-item-l').text();
                 classify_index = $(this).parent("li").index()

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

@@ -185,11 +185,13 @@
                         $("#pushSet").text(pushText);
                         var a_items = _vipData["a_items"]
                         var s_items = ""
-                        for (var i = a_items.length - 1; i >= 0; i--) {
-                            if(s_items!=""){
-                                s_items += " "
+                        if (a_items!=undefined &&a_items.length>0){
+                            for (var i = 0; a_items.length - 1 >= i ; i++) {
+                                if(s_items!=""){
+                                    s_items += "、"
+                                }
+                                s_items  += a_items[i]["s_item"]
                             }
-                            s_items  += a_items[i]["s_item"]
                         }
                         $("#keywords").text(s_items);
                    }

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

@@ -16,7 +16,11 @@
     <link rel="stylesheet" href="/vipsubscribe/css/weui.min.css?v={{Msg "seo" "version"}}">
     <link rel="stylesheet" href="/vipsubscribe/css/vip_order_detail.css?v={{Msg "seo" "version"}}">
 </head>
-
+<style>
+	.person > p >span , .unit > p >span{
+		margin-bottom: .12rem;
+	}
+</style>
 <body>
     <div class="vip_order_detail">
         <main class="main">
@@ -138,7 +142,7 @@ if(signature && signature.length == 4){
 	    });
     }
     $(".orderCode").text(orderCode);
-    $DoPost("/subscribepay/order/getOrderPayAllMsg",{"orderCode":orderCode},function(r){
+    $DoPost("/subscribepay/orderListDetails/getOrderPayAllMsg",{"orderCode":orderCode},function(r){
       if(r.success){
         //下单时间
         if(r.data.order.prepay_time) $(".prepayTime").text(r.data.order.prepay_time.replace("-",".").replace("-","."));