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

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

wangshan 5 жил өмнө
parent
commit
e64b1895db

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

@@ -3,7 +3,6 @@ package job
 import (
 	"encoding/json"
 	"fmt"
-	"log"
 	. "match/config"
 	. "match/matcher"
 	. "match/util"
@@ -133,6 +132,8 @@ func (m *MatchJob) LoadBidding(lastId, newId string, lastTime int64) *[]map[stri
 		"city":            1,
 		"buyerclass":      1,
 		"jsondata":        1,
+		"budget":          1,
+		"bidamount":       1,
 	}).Sort("_id").Iter()
 	index := 0
 	for temp := make(map[string]interface{}); it.Next(&temp); {
@@ -314,15 +315,15 @@ func (m *MatchJob) OnceUserBatch(batchIndex int, lastUserId *string) (int, *VipU
 						vip_buyerclass = append(vip_buyerclass, "其它")
 					}
 					vip_bcm := Config.VipBuyerClassMap //vip采购单位行业调整映射
-					ss := map[string]int{}
+					counter := map[string]int{}
 					for _, v := range vip_buyerclass {
 						s_v, _ := v.(string)
 						if s_v == "" {
 							continue
 						}
 						//
-						if vip_bcm[s_v] != "" && ss[vip_bcm[s_v]] == 0 {
-							ss[vip_bcm[s_v]]++
+						if vip_bcm[s_v] != "" && counter[vip_bcm[s_v]] == 0 {
+							counter[vip_bcm[s_v]]++
 							vipUser.Add(vip_bcm[s_v], user, &vipUser.BuyerclassUsers)
 						}
 						//

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

@@ -57,7 +57,7 @@ var (
 		"s_nickname":      1,
 		"l_firstpushtime": 1,
 	}
-	InfoSaveFields = []string{"_id", "area", "city", "buyerclass", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type"}
+	InfoSaveFields = []string{"_id", "area", "city", "buyerclass", "publishtime", "s_subscopeclass", "subtype", "title", "toptype", "type", "bidamount", "budget"}
 	WeekNum        = map[string]int{
 		"Monday":    1,
 		"Tuesday":   2,

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


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

@@ -30,7 +30,7 @@ func (n *NothingJob) PushNothing(ratetype int) {
 		"i_vip_status": map[string]interface{}{
 			"$in": []int{1, 2},
 		},
-		// "s_m_openid":         "o043a5hr4gD9e1Yy8DSNjy9BX3U4",
+		// "s_m_openid": "ouCYjw5eUMXFErd1OMpOVthwWA0Q",
 	}
 	all := mongodb.Find("user", query, nil, `{"_id":1,"s_nickname":1,"o_vipjy":1,"a_jpushid":1,"s_jpushid":1,"s_opushid":1,"s_m_openid":1,"s_appponetype":1,"i_applystatus":1}`, false, 0, 0)
 	t, _ := time.ParseInLocation("2006-01-02", time.Now().Format("2006-01-02"), time.Local)
@@ -39,10 +39,11 @@ func (n *NothingJob) PushNothing(ratetype int) {
 		userid := util.BsonIdToSId(v["_id"])
 		day1, day2 := n.ComputTime(ratemode, t)
 		if n.isNoInfo(userid, day1, day2) {
-			if ratetype == 1 {
-				if ratemode != 1 {
-					continue
-				}
+			if ratetype == 1 && ratemode != 1 { //实时推送的过滤掉其他推送
+				continue
+			}
+			if ratetype == 0 && ratemode == 1 { //其他推送 过滤掉实时推送
+				continue
 			}
 			if ratemode == 3 && !(strings.ToLower(time.Now().Weekday().String()) == strings.ToLower(Config.VipPushWeek)) {
 				continue
@@ -74,12 +75,12 @@ func (n *NothingJob) StartPush(user []map[string]interface{}) {
 			userid := util.BsonIdToSId(v["_id"])
 			//APP推送
 			if util.IntAll(vipjy["i_apppush"]) == 1 {
-				logger.Info("推送任务 -未匹配到数据- 开始app推送", userid)
+				logger.Info("推送任务 未匹配到数据 开始app推送", userid)
 				isPushOk := putil.SendApp(map[string]interface{}{
 					"phoneType":      v["s_appponetype"],
 					"descript":       "亲爱的VIP订阅用户,",
 					"descriptAppend": "根据您当前的订阅,无法精准的为您推送新的增量信息,建议您对订阅设置进行修改,剑鱼标讯期待更好的为您服务。",
-					"type":           "message",
+					"type":           "nothing",
 					"userId":         userid,
 					"url":            "/jyapp/vipsubscribe/toSubVipSetPage",
 					"otherPushId":    v["s_opushid"],

+ 0 - 10
src/jfw/modules/pushsubscribe/src/push/main_test.go

@@ -1,10 +0,0 @@
-package main
-
-import (
-	"log"
-	"testing"
-)
-
-func Test_Update(t *testing.T) {
-
-}

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

@@ -42,7 +42,7 @@ func NewPushWay(u *UserInfo) *PushWay {
 		mailPush = true
 	}
 	//再对取消关注以及app没有登录的用户进行过滤,但是依然可以进行助手推送
-	if u.Subscribe == 0 {
+	if u.Subscribe == 0 || u.S_m_openid == "" {
 		wxPush = false
 	}
 	if u.Jpushid == "" && u.Opushid == "" {
@@ -113,6 +113,17 @@ func NewPushParam(isLimit bool, dayCount int, mailPush bool, u *UserInfo, sl *So
 			industryClassName = "subscopeclass"
 			industry = GetSubScopeClass(k2["s_subscopeclass"])
 		}
+		//增加金额的处理
+		acount := ""
+		acountClassName := "acount"
+		if k2["bidamount"] != nil {
+			acount = ConversionMoeny(k2["bidamount"])
+		} else if k2["budget"] != nil {
+			acount = ConversionMoeny(k2["budget"])
+		}
+		if acount == "" {
+			acountClassName = "none"
+		}
 		if mailPush && infosLength <= Config.MaxPushSize { //关于邮件的处理
 			mailSid := util.CommonEncodeArticle("mailprivate", util.ObjToString(k2["_id"]))
 			url := fmt.Sprintf("%s/article/mailprivate/%s.html", Config.JianyuDomain, mailSid)
@@ -160,7 +171,7 @@ func NewPushParam(isLimit bool, dayCount int, mailPush bool, u *UserInfo, sl *So
 			if infotype == "" {
 				typeClassName = ""
 			}
-			mailContent += fmt.Sprintf(Config.Mail_content, infosLength, url, otitle, areaClassName, area, typeClassName, infotype, industryClassName, industry, dates)
+			mailContent += fmt.Sprintf(Config.Mail_content, infosLength, url, otitle, areaClassName, area, typeClassName, infotype, industryClassName, industry, acountClassName, acount, dates)
 		}
 		if isLimit {
 			if isVipUser {

+ 35 - 0
src/jfw/modules/pushsubscribe/src/push/util/util.go

@@ -6,6 +6,8 @@ import (
 	"qfw/util"
 	"qfw/util/jy"
 	"qfw/util/mongodb"
+	"reflect"
+	"strconv"
 	"strings"
 	"time"
 
@@ -307,3 +309,36 @@ func IsSleep(start, end string) bool {
 	now := time.Now()
 	return !(now.After(starttime) && now.Before(endtime))
 }
+
+//金额转化   金额:0-万元以下单位为元  ,万元以上至亿元以下单位为万元 ,亿元以上单位为亿元。保留 小数点后 2 位,不进行四舍五入。
+func ConversionMoeny(i_money interface{}) string {
+	m := ""
+	if reflect.TypeOf(i_money).Name() == "float64" {
+		m = strconv.FormatFloat(util.Float64All(i_money), 'f', -1, 64)
+	} else {
+		m = util.ObjToString(i_money)
+	}
+	if m == "" {
+		return m
+	}
+	m_arr := strings.Split(m, ".")
+	m_1 := m_arr[0]
+	len_m1 := len([]rune(m_1))
+	if len_m1 >= 9 {
+		m = m_1[0:len_m1-8] + "." + m_1[len_m1-8:len_m1-6] + "亿元"
+	} else if len_m1 >= 5 {
+		m = m_1[0:len_m1-4] + "." + m_1[len_m1-4:len_m1-2] + "万元"
+	} else {
+		if len(m_arr) == 1 {
+			return m + ".00元"
+		}
+		m_2 := m_arr[1]
+		if len([]rune(m_2)) > 1 {
+			m_2 = m_2[0:2]
+		} else {
+			m_2 = m_2[0:1] + "0"
+		}
+		m = m_1 + "." + m_2 + "元"
+	}
+	return m
+}

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