소스 검색

wip:提交

wkyuer 2 주 전
부모
커밋
7db6160d4b

+ 33 - 0
src/jfw/modules/publicapply/src/subscribePush/entity/guide.go

@@ -0,0 +1,33 @@
+package entity
+
+import (
+	"github.com/gogf/gf/v2/util/gconv"
+	"jy/src/jfw/modules/publicapply/src/config"
+)
+
+// FreeIsInTsGuide 2有向导 1跳过向导
+func FreeIsInTsGuide(userid string) int {
+	data := config.Compatible.Select(userid, `{"o_jy":1,"i_ts_guide":1,"l_registedate":1}`)
+	if data == nil || len(*data) == 0 {
+		return 0
+	}
+	var (
+		o_jy       = gconv.Map((*data)["o_jy"])
+		i_ts_guide = gconv.Int64((*data)["i_ts_guide"])
+		a_key      = gconv.Interfaces(o_jy["a_key"])
+		o_area     = gconv.Map(o_jy["o_area"])
+	)
+	if i_ts_guide != 0 {
+		return 0
+	}
+	if len(o_jy) == 0 {
+		return 2
+	}
+	if a_key == nil || len(a_key) == 0 {
+		return 2
+	}
+	if o_area == nil || len(o_area) == 0 {
+		return 2
+	}
+	return 1
+}

+ 1 - 1
src/jfw/modules/publicapply/src/subscribePush/entity/keyWords.go

@@ -255,7 +255,7 @@ func AddKeyWordsFree(types, userId, classIndex, className, keywordsIndex, keywor
 			saveData[types+".a_key."+keywordsIndex+".matchway"] = matchWay
 			saveData[types+".a_key."+keywordsIndex+".updatetime"] = time.Now().Unix()
 			if gconv.Bool(sessionMap["isHelpSub"]) {
-				saveData["i_ts_guide"] = 1
+				saveData["i_ts_guide"] = FreeIsInTsGuide(userId)
 			}
 		}
 	}

+ 4 - 6
src/jfw/modules/publicapply/src/subscribePush/entity/setting.go

@@ -84,12 +84,10 @@ func freeSet(area, district map[string]interface{}, industry []string, userId st
 	})
 	config.Middleground.PowerCheckCenter.DelCheckRedis("10000", qutil.Int64All(positionId))
 
-	if !FreeSubChange(userId, &area, &district, industry, ppb, isfirst, gconv.Bool(sessionMap["isHelpSub"])) {
+	if !FreeSubChange(userId, &area, &district, industry, ppb, isfirst, sessionMap) {
 		return &FuncResult{false, errors.New("保存修改出错"), nil}
 	} else if issetredis { //更新调整次数 非全国(第一次 不消耗次数)
 		//优先使用省份订阅包次数
-		// log.Println(areacount, "---", ppnum)
-		// log.Println(jy.BaseAreaNum, "---", fpnum)
 		if !isHelpSub {
 			if ppb {
 				if areacount+jy.BaseAreaNum > ppnum {
@@ -111,7 +109,7 @@ func freeSet(area, district map[string]interface{}, industry []string, userId st
 }
 
 // 免费用户地区调整
-func FreeSubChange(userId string, area, district *map[string]interface{}, industry []string, ppb, isfirst, isHelpSub bool) bool {
+func FreeSubChange(userId string, area, district *map[string]interface{}, industry []string, ppb bool, sessionMap map[string]interface{}) bool {
 	setMap := map[string]interface{}{
 		"o_jy.o_area":     area,     //设置地区
 		"o_jy.o_district": district, //设置地区
@@ -123,8 +121,8 @@ func FreeSubChange(userId string, area, district *map[string]interface{}, indust
 			"o_jy.i_newfree": 1,    //老免费用户=>新订阅设置页面 20211122
 		}
 	}
-	if isHelpSub {
-		setMap["i_ts_guide"] = 1
+	if gconv.Bool(sessionMap["isHelpSub"]) {
+		setMap["i_ts_guide"] = FreeIsInTsGuide(userId)
 	}
 	updateOk := config.Compatible.Update(userId, map[string]interface{}{
 		"$set": setMap,