duxin 2 سال پیش
والد
کامیت
70fe409a44
1فایلهای تغییر یافته به همراه25 افزوده شده و 26 حذف شده
  1. 25 26
      jyBXSubscribe/rpc/model/push.go

+ 25 - 26
jyBXSubscribe/rpc/model/push.go

@@ -25,7 +25,6 @@ import (
 	"time"
 )
 
-//
 const (
 	pageSize            = 100
 	AllSubPushCacheSize = 250
@@ -76,7 +75,7 @@ type PushCa struct {
 	FileExists bool
 }
 
-//查询参数
+// 查询参数
 type SubPushQueryParam struct {
 	Mgo_bidding      mongodb.MongodbSim //
 	Bidding          string             //
@@ -100,6 +99,7 @@ type SubPushQueryParam struct {
 	BaseServiceMysql *mysql.Mysql
 	NewUserId        int64
 	IsEnt            bool
+	SelectInfoIds    []string
 }
 
 func (spqp *SubPushQueryParam) IsEmpty() bool {
@@ -118,7 +118,7 @@ func NewSubscribePush(module ...string) *subscribePush {
 	return &subscribePush{m}
 }
 
-//从pushcache_2_a中取
+// 从pushcache_2_a中取
 func (s *subscribePush) GetTodayCache(userId string) (*SubPush, error) {
 	pc_a, err := redis.GetNewBytes("pushcache_2_b", s.todayKey(userId))
 	if err != nil {
@@ -134,12 +134,12 @@ func (s *subscribePush) GetTodayCache(userId string) (*SubPush, error) {
 	return p, nil
 }
 
-//往pushcache_2_a中放
+// 往pushcache_2_a中放
 func (s *subscribePush) PutTodayCache(userId string, pc_a *SubPush) {
 	redis.Put("pushcache_2_b", s.todayKey(userId), pc_a, oneDay)
 }
 
-//获取redis key
+// 获取redis key
 func (s *subscribePush) todayKey(userId string) string {
 	return fmt.Sprintf("%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId)
 }
@@ -147,7 +147,7 @@ func (s *subscribePush) allKey(userId string) string {
 	return fmt.Sprintf("all_%s_%s", aboutDbMsg[s.ModuleFlag].RedisKeyFlag, userId)
 }
 
-//历史推送记录中单条信息格式化
+// 历史推送记录中单条信息格式化
 func (s *subscribePush) InfoFormat(p *PushCa, info *map[string]interface{}) *bxsubscribe.SubscribeInfo {
 	area := common.ObjToString((*info)["area"])
 	if area == "A" {
@@ -311,7 +311,6 @@ func (s *subscribePush) Datas(spqp *SubPushQueryParam) (hasNextPage bool, total
 	return
 }
 
-//
 func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, endtime int64, size int, isLimit bool) (result []*bxsubscribe.SubscribeInfo, count int64) {
 	querys := []string{}
 	if spqp.IsEnt {
@@ -481,7 +480,7 @@ func (s *subscribePush) getDatasFromMysql(spqp *SubPushQueryParam, starttime, en
 	return
 }
 
-//根据id取内容
+// 根据id取内容
 func (s *subscribePush) GetInfoByIds(Mgo_bidding mongodb.MongodbSim, bidding, bidding_back string, pushCas []*PushCa) []*bxsubscribe.SubscribeInfo {
 	array := make([]*bxsubscribe.SubscribeInfo, len(pushCas))
 	if len(pushCas) == 0 {
@@ -566,7 +565,7 @@ func (s *subscribePush) GetInfoByIds(Mgo_bidding mongodb.MongodbSim, bidding, bi
 	return array
 }
 
-//获取历史推送
+// 获取历史推送
 func (s *subscribePush) GetJyPushs(datas []map[string]interface{}) (pushCas []*PushCa) {
 	pushCas = []*PushCa{}
 	for _, v := range datas {
@@ -588,7 +587,7 @@ func (s *subscribePush) GetJyPushs(datas []map[string]interface{}) (pushCas []*P
 	return
 }
 
-//查看全部列表缓存
+// 查看全部列表缓存
 func (s *subscribePush) PutAllCache(userId string, datas *SubPush) {
 	log.Println(s.allKey(userId), datas, oneDay)
 	redis.Put("pushcache_2_a", s.allKey(userId), datas, oneDay)
@@ -613,7 +612,7 @@ func (s *subscribePush) GetCache(code, key string) (*SubPush, error) {
 	return p, nil
 }
 
-//是否收藏
+// 是否收藏
 func (s *subscribePush) MakeCollection(userId string, list []*bxsubscribe.SubscribeInfo) {
 	if list == nil || len(list) == 0 {
 		return
@@ -643,7 +642,7 @@ func (s *subscribePush) MakeCollection(userId string, list []*bxsubscribe.Subscr
 	}
 }
 
-//仅移动端首页使用,历史推送7天信息
+// 仅移动端首页使用,历史推送7天信息
 func (s *subscribePush) sevenDayKey(userId string) string {
 	return fmt.Sprintf("7day_subpush_%s", userId)
 }
@@ -652,7 +651,7 @@ func (s *subscribePush) PutSevenDayCache(userId string, datas []*bxsubscribe.Sub
 	redis.Put("pushcache_2_a", s.sevenDayKey(userId), SubPush{Datas: datas}, 7*24*60*60)
 }
 
-//从pushcache_2_a中取
+// 从pushcache_2_a中取
 func (s *subscribePush) GetSevenDayCache(userId string) ([]*bxsubscribe.SubscribeInfo, error) {
 	allPush, _ := s.GetCache("pushcache_2_a", s.sevenDayKey(userId))
 	if allPush != nil && allPush.Datas != nil && len(allPush.Datas) > 0 {
@@ -661,7 +660,7 @@ func (s *subscribePush) GetSevenDayCache(userId string) ([]*bxsubscribe.Subscrib
 	return nil, nil
 }
 
-//历史推送记录中单条信息格式化
+// 历史推送记录中单条信息格式化
 func InfoFormats(info map[string]interface{}, tmp map[string]interface{}) map[string]interface{} {
 	area := common.ObjToString(info["area"])
 	if area == "A" {
@@ -694,7 +693,7 @@ func InfoFormats(info map[string]interface{}, tmp map[string]interface{}) map[st
 	return info
 }
 
-//UpdateUserPushUnread 更新app未读标识为已读
+// UpdateUserPushUnread 更新app未读标识为已读
 func UpdateUserPushUnread(userid string, vt string) {
 	if vt == MemberFlag {
 		IC.Mgo.UpdateById("user", userid, map[string]interface{}{"$set": map[string]interface{}{"i_member_apppushunread": 0}})
@@ -707,7 +706,7 @@ func UpdateUserPushUnread(userid string, vt string) {
 
 //
 
-//获取用户信息
+// 获取用户信息
 func (s *subscribePush) UserInfo(userId string) (*map[string]interface{}, int64) {
 	user, ok := IC.Mgo.FindById("user", userId, `{"s_m_openid":1,"a_m_openid":1,"s_phone":1,"a_mergeorder":1,"o_jy":1,"l_firstpushtime":1,"i_vip_status":1,"l_vip_endtime":1,"o_vipjy":1,"i_member_status":1,"o_member_jy":1}`)
 	if !ok || user == nil {
@@ -716,7 +715,7 @@ func (s *subscribePush) UserInfo(userId string) (*map[string]interface{}, int64)
 	return user, common.Int64All((*user)["l_firstpushtime"])
 }
 
-//是否有订阅词
+// 是否有订阅词
 func GetKeySet(t string, u *map[string]interface{}, data []string) (bool, []string) {
 	var industry_ = []string{}
 	if u != nil {
@@ -764,8 +763,8 @@ const (
 	findfields = `"title"`
 )
 
-//首次访问推送页面 默认生成推送数据
-//默认匹配es 7天内数据
+// 首次访问推送页面 默认生成推送数据
+// 默认匹配es 7天内数据
 func (s *subscribePush) DefaultDatas(spqp *SubPushQueryParam) (hasNextPage bool, total int64, result []*bxsubscribe.SubscribeInfo) {
 	if spqp.UserId == "" {
 		return false, 0, nil
@@ -802,7 +801,7 @@ func (s *subscribePush) DefaultDatas(spqp *SubPushQueryParam) (hasNextPage bool,
 	return
 }
 
-//保存推送表
+// 保存推送表
 func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]interface{}, keyword []ViewKeyWord, ccount int) (resultList []*bxsubscribe.SubscribeInfo) {
 	t2 := time.Now()
 	now := time.Now().Unix()
@@ -866,7 +865,7 @@ func (s *subscribePush) listManager(spqp *SubPushQueryParam, list []map[string]i
 	return
 }
 
-//获取匹配得关键词
+// 获取匹配得关键词
 func getKeys(title string, keywords []ViewKeyWord) (str []string) {
 	if len(keywords) > 0 {
 	L:
@@ -888,7 +887,7 @@ func getKeys(title string, keywords []ViewKeyWord) (str []string) {
 	return
 }
 
-//获取查询语句
+// 获取查询语句
 func (s *subscribePush) getDefaultDatasSQL(bsp *ViewCondition) (str string) {
 	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
@@ -1024,7 +1023,7 @@ type ViewCondition struct {
 	Size       int           //数量
 }
 
-//获取用户信息
+// 获取用户信息
 func (s *subscribePush) getUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition) {
 	var isPayBool = false
 	var tmpInfo = struct {
@@ -1113,7 +1112,7 @@ func (s *subscribePush) getUserInfo(spqp *SubPushQueryParam) (vc *ViewCondition)
 	return
 }
 
-//关键词 附加词 排除词
+// 关键词 附加词 排除词
 func getKeyWordArrFromDbResult(a_items []interface{}, item string, index int) (arr []ViewKeyWord) {
 	if a_items == nil {
 		return
@@ -1188,7 +1187,7 @@ func getKeyWordArrFromDbResultByFree(a_items []interface{}, item string, index i
 	return
 }
 
-//地区格式化
+// 地区格式化
 func getStringArrFromDbResult(area map[string]interface{}, i int) (arr []string) {
 	if area == nil {
 		return
@@ -1210,7 +1209,7 @@ func getStringArrFromDbResult(area map[string]interface{}, i int) (arr []string)
 	return
 }
 
-//IsInTsGuide 是否进入向导
+// IsInTsGuide 是否进入向导
 func (s *subscribePush) IsInTsGuide(userid string) bool {
 	if userid == "" {
 		return false