Selaa lähdekoodia

Merge branch 'dev4.6.2.1' of http://192.168.3.207:8080/qmx/jy into dev4.6.2.1

zhangxinlei1996 3 vuotta sitten
vanhempi
commit
3905850a8f

+ 4 - 3
src/jfw/modules/app/src/web/staticres/jyapp/big-member/css/analysis_result.css

@@ -357,15 +357,16 @@
 #analysis-result .company-info{
 #analysis-result .company-info{
     display: flex;
     display: flex;
     align-items: center;
     align-items: center;
-    padding: 5px 8px 8px;
+    justify-content: space-between;
+    padding: 5px 6px 8px;
     color: #5F5E64;
     color: #5F5E64;
     font-size: .2rem;
     font-size: .2rem;
     line-height: .36rem;
     line-height: .36rem;
 }
 }
 #analysis-result .company-info span{
 #analysis-result .company-info span{
-    flex: 1;
+    /* flex: 1; */
     white-space: nowrap;
     white-space: nowrap;
-    margin-right: .24rem;
+    /* margin-right: .14rem; */
 }
 }
 #analysis-result .same-history,.other-history{
 #analysis-result .same-history,.other-history{
     margin-top: .16rem;
     margin-top: .16rem;

+ 2 - 1
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/set_area.js

@@ -188,8 +188,9 @@ var vNode = {
         // 根据城市的选择情况判断省份的选择情况
         // 根据城市的选择情况判断省份的选择情况
         changeCityState(province, city) {
         changeCityState(province, city) {
             if (city === '#') {
             if (city === '#') {
+                this.setCitySelected()
                 this.onChange()
                 this.onChange()
-                return this.setCitySelected()
+                return
             }
             }
             // 全国置为空
             // 全国置为空
             this.provinceListMap['#'][0].selectedState = ''
             this.provinceListMap['#'][0].selectedState = ''

+ 4 - 4
src/jfw/modules/app/src/web/templates/big-member/page_analysis_result.html

@@ -133,17 +133,17 @@
                                                 <span v-else class="index">${i + 1}</span>
                                                 <span v-else class="index">${i + 1}</span>
                                                 <span class="title" @click="goEntImg(hs.entId)">${hs.key}</span>
                                                 <span class="title" @click="goEntImg(hs.entId)">${hs.key}</span>
                                             </div>
                                             </div>
-                                            <div class="win-capital">注册资本${formatterMoney(hs.capital)}</div>
+                                            <div class="win-capital">注册资本:${formatterMoney(hs.capital)}</div>
                                             <div class="win-info" @click="goDetail(hs.key)">
                                             <div class="win-info" @click="goDetail(hs.key)">
                                               <div class="w-title">
                                               <div class="w-title">
                                                 <span class="w-title-label">类似项目明细</span>
                                                 <span class="w-title-label">类似项目明细</span>
                                                 <van-icon class="win-arrow" name="arrow"></van-icon>
                                                 <van-icon class="win-arrow" name="arrow"></van-icon>
                                               </div>
                                               </div>
                                               <div class="company-info">
                                               <div class="company-info">
-                                                <span>项目数量${hs.doc_count}个</span>
-                                                <span>项目金额${formatterMoney(hs.total_project)}</span>
+                                                <span>项目数量:${hs.doc_count}个</span>
+                                                <span>项目金额:${formatterMoney(hs.total_project)}</span>
                                                 <!-- <span>注册资本:${formatterMoney(hs.capital)}</span> -->
                                                 <!-- <span>注册资本:${formatterMoney(hs.capital)}</span> -->
-                                                <span class="ellipsis">最近中标:${formatterTime(hs.max_jytime)}</span>
+                                                <span>最近中标:${formatterTime(hs.max_jytime)}</span>
                                               </div>
                                               </div>
                                             </div>
                                             </div>
                                             
                                             

+ 1 - 1
src/jfw/modules/common/src/qfw/util/jy/bigVipPower.go

@@ -53,7 +53,7 @@ const (
 	PowerCacheEntPortKey   = "free_power_entport_%s"
 	PowerCacheEntPortKey   = "free_power_entport_%s"
 	PowerCacheBuyerPortKey = "free_power_buyerport_%s"
 	PowerCacheBuyerPortKey = "free_power_buyerport_%s"
 	PowerCacheFileKey      = "free_power_File_%s"
 	PowerCacheFileKey      = "free_power_File_%s"
-	UserUpdateAreaKey      = "free_area_num_%s"
+	UserUpdateAreaKey      = "free_area_num_%s_%s"
 	BaseAreaNum            = 1
 	BaseAreaNum            = 1
 )
 )
 
 

+ 15 - 5
src/jfw/modules/publicapply/src/subscribe/entity/entity.go

@@ -9,6 +9,7 @@ import (
 	"qfw/util/elastic"
 	"qfw/util/elastic"
 	"qfw/util/jy"
 	"qfw/util/jy"
 	"qfw/util/redis"
 	"qfw/util/redis"
+	"time"
 
 
 	// "reflect"
 	// "reflect"
 	"strconv"
 	"strconv"
@@ -160,16 +161,25 @@ func (pi *ParamInfo) GetSubMsg() UserSubMsg {
 			res.Area, _ = o_jy["o_area"].(map[string]interface{})
 			res.Area, _ = o_jy["o_area"].(map[string]interface{})
 		}
 		}
 		res.Infotype, _ = o_jy["a_infotype"].([]interface{})
 		res.Infotype, _ = o_jy["a_infotype"].([]interface{})
-		//地区调整可用次数
-		pnum := redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, pi.UserId))
-		res.Areanum = qutil.If(pnum > 0, jy.BaseAreaNum-pnum, jy.BaseAreaNum).(int)
-		//购买省份订阅包
+
+		//免费用户未购买省份订阅包 按年算
+		year := fmt.Sprint(time.Now().Year())
+		//免费用户未购买省份订阅包 已调整地区次数(年)
+		fpnum := redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, pi.UserId, year))
+		//免费用户未购买省份订阅包 地区调整可用次数(默认值)
+		res.Areanum = qutil.If(fpnum > 0, jy.BaseAreaNum-fpnum, jy.BaseAreaNum).(int)
+		//免费用户已购买省份订阅包
 		if o_jy["i_ppstatus"] != nil && qutil.IntAll(o_jy["i_ppstatus"]) > 0 {
 		if o_jy["i_ppstatus"] != nil && qutil.IntAll(o_jy["i_ppstatus"]) > 0 {
 			o_buyset_p, _ := o_jy["o_buyset_p"].(map[string]interface{})
 			o_buyset_p, _ := o_jy["o_buyset_p"].(map[string]interface{})
 			res.Provincenum = qutil.IntAll(o_buyset_p["areacount"]) //-1 全国无限制
 			res.Provincenum = qutil.IntAll(o_buyset_p["areacount"]) //-1 全国无限制
 			res.Areanum = res.Provincenum
 			res.Areanum = res.Provincenum
 			if res.Provincenum > 0 {
 			if res.Provincenum > 0 {
-				res.Areanum = res.Provincenum + jy.BaseAreaNum - pnum
+				//按月算
+				ym := fmt.Sprint(time.Now().Year()) + "-" + fmt.Sprint(time.Now().Month())
+				//已调整地区次数(月)
+				ppnum := redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, pi.UserId, ym))
+				//可调整次数(月)
+				res.Areanum = res.Provincenum + jy.BaseAreaNum - fpnum - ppnum
 			}
 			}
 			res.Ppstarttime = qutil.Int64All(o_jy["l_areaStart_p"])
 			res.Ppstarttime = qutil.Int64All(o_jy["l_areaStart_p"])
 			res.Ppendtime = qutil.Int64All(o_jy["l_areaEnd_p"])
 			res.Ppendtime = qutil.Int64All(o_jy["l_areaEnd_p"])

+ 66 - 19
src/jfw/modules/publicapply/src/subscribePush/entity/setting.go

@@ -8,6 +8,8 @@ import (
 	qutil "qfw/util"
 	qutil "qfw/util"
 	"qfw/util/jy"
 	"qfw/util/jy"
 	"qfw/util/redis"
 	"qfw/util/redis"
+	"sort"
+	"strings"
 	"time"
 	"time"
 	"util"
 	"util"
 )
 )
@@ -39,25 +41,47 @@ func freeSet(area map[string]interface{}, industry []string, userId string) *Fun
 	if len(area) == 0 {
 	if len(area) == 0 {
 		return &FuncResult{false, errors.New("地区参数异常"), nil}
 		return &FuncResult{false, errors.New("地区参数异常"), nil}
 	}
 	}
-
-	//地区调整已用次数
-	pnum := redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId))
-	log.Println(len(area), "pnum:", pnum)
-	//是否购买省级订阅包   省份订阅包购买的省份数量-1:全国 无限制调整;isfirst:是否第一次设置地区
-	isfirst, ppb, areacount := IsCanSet(userId)
-	//第一次设置地区不扣次数
-	if !isfirst {
-		//
-		if len(area) > areacount+jy.BaseAreaNum {
+	//isfirst:是否第一次设置地区;ppb:是否购买省级订阅包; areacount:省份订阅包购买的省份数量-1:全国 无限制调整
+	isfirst, ppb, areacount := IsCanSet(userId, area)
+	//购买省份订阅包 已调整地区次数
+	ppnum := 0
+	//免费用户购买省份订阅包 按月算
+	ym := fmt.Sprint(time.Now().Year()) + "-" + fmt.Sprint(time.Now().Month())
+	if ppb {
+		ppnum = redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym))
+	}
+	//免费用户未购买省份订阅包 按年算
+	year := fmt.Sprint(time.Now().Year())
+	//免费用户 已调整地区次数
+	fpnum := redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year))
+	// log.Println(len(area), "pnum:", pnum)
+	//第一次设置地区 || 购买全国  不扣次数
+	var issetredis = areacount > -1 && !isfirst
+	if issetredis {
+		//地区范围判断
+		if areacount+jy.BaseAreaNum < len(area) {
 			return &FuncResult{false, errors.New("超出地区可设置范围"), nil}
 			return &FuncResult{false, errors.New("超出地区可设置范围"), nil}
 		}
 		}
-		//
-		if areacount > -1 && areacount+jy.BaseAreaNum <= pnum {
+		//地区调整次数判断
+		if areacount+jy.BaseAreaNum <= ppnum+fpnum {
 			return &FuncResult{false, errors.New(fmt.Sprintf("订阅地区调整次数(%d)已用完", areacount+jy.BaseAreaNum)), nil}
 			return &FuncResult{false, errors.New(fmt.Sprintf("订阅地区调整次数(%d)已用完", areacount+jy.BaseAreaNum)), nil}
 		}
 		}
 	}
 	}
 	if !FreeSubChange(userId, &area, industry, ppb, isfirst) {
 	if !FreeSubChange(userId, &area, industry, ppb, isfirst) {
 		return &FuncResult{false, errors.New("保存修改出错"), nil}
 		return &FuncResult{false, errors.New("保存修改出错"), nil}
+	} else if issetredis { //更新调整次数 非全国(第一次 不消耗次数)
+		//清楚缓存
+		jy.ClearBigVipUserPower(userId)
+		//优先使用省份订阅包次数
+		// log.Println(areacount, "---", ppnum)
+		// log.Println(jy.BaseAreaNum, "---", fpnum)
+		if ppb && areacount > ppnum {
+			redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, ym), ppnum+1, 31*24*60*60)
+		} else if jy.BaseAreaNum > fpnum {
+			redis.Put(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId, year), fpnum+1, 365*24*60*60)
+		} else {
+			log.Println(fmt.Sprintf("免费用户设置地区 扣除次数异常  userId:%s", userId))
+		}
 	}
 	}
 	SetLog(userId, "o_jy")
 	SetLog(userId, "o_jy")
 	return &FuncResult{true, nil, map[string]interface{}{
 	return &FuncResult{true, nil, map[string]interface{}{
@@ -80,29 +104,52 @@ func FreeSubChange(userId string, area *map[string]interface{}, industry []strin
 	updateOk := db.Mgo.UpdateById("user", userId, setMap)
 	updateOk := db.Mgo.UpdateById("user", userId, setMap)
 	if !updateOk {
 	if !updateOk {
 		return false
 		return false
-	} else if !isfirst && redis.GetInt(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId)) > -1 { //更新调整次数 非全国(第一次 不消耗次数)
-		//清楚缓存
-		jy.ClearBigVipUserPower(userId)
-		redis.Incr(jy.PowerCacheDb, fmt.Sprintf(jy.UserUpdateAreaKey, userId))
 	}
 	}
 	return true
 	return true
 }
 }
 
 
 //是否可进行地区调整
 //是否可进行地区调整
-func IsCanSet(userId string) (bool, bool, int) {
+func IsCanSet(userId string, areamap map[string]interface{}) (bool, bool, int) {
 	areacount := 0
 	areacount := 0
+	myarea := []string{}
+	setarea := []string{}
+	myareamap := map[string]interface{}{}
 	mData, ok := db.Mgo.FindById("user", userId, `{"o_jy":1}`)
 	mData, ok := db.Mgo.FindById("user", userId, `{"o_jy":1}`)
 	if !ok || len(*mData) == 0 || mData == nil {
 	if !ok || len(*mData) == 0 || mData == nil {
 		return false, false, areacount
 		return false, false, areacount
 	}
 	}
 	o_jy, _ := (*mData)["o_jy"].(map[string]interface{})
 	o_jy, _ := (*mData)["o_jy"].(map[string]interface{})
+	//地区是否完全一致
+	if o_jy["o_area"] != nil {
+		myareamap = *qutil.ObjToMap(o_jy["o_area"])
+
+	}
 	//是否购买省份订阅包
 	//是否购买省份订阅包
 	if o_jy["i_ppstatus"] != nil && qutil.IntAll(o_jy["i_ppstatus"]) > 0 {
 	if o_jy["i_ppstatus"] != nil && qutil.IntAll(o_jy["i_ppstatus"]) > 0 {
 		o_buyset_p, _ := o_jy["o_buyset_p"].(map[string]interface{})
 		o_buyset_p, _ := o_jy["o_buyset_p"].(map[string]interface{})
 		areacount = qutil.IntAll(o_buyset_p["areacount"]) //-1 全国无限制
 		areacount = qutil.IntAll(o_buyset_p["areacount"]) //-1 全国无限制
+		myareamap = *qutil.ObjToMap(o_jy["o_area_p"])
+	}
+	for oak, _ := range myareamap {
+		myarea = append(myarea, oak)
+	}
+	for sak, _ := range areamap {
+		setarea = append(setarea, sak)
 	}
 	}
-	log.Println(jy.BaseAreaNum, "---areacount:", areacount)
-	return o_jy["o_area"] == nil, o_jy["i_ppstatus"] != nil && qutil.IntAll(o_jy["i_ppstatus"]) > 0, areacount
+	if areaSort(setarea) == areaSort(myarea) {
+		log.Println(setarea, "-地区选择前后一致-", myarea)
+		return true, qutil.IntAll(o_jy["i_ppstatus"]) > 0, areacount
+	}
+	// log.Println(areaSort(setarea) == areaSort(myarea), "---areacount:", areacount)
+	return o_jy["o_area"] == nil, qutil.IntAll(o_jy["i_ppstatus"]) > 0, areacount
+}
+
+//
+func areaSort(area []string) string {
+	sort.Slice(area, func(i, j int) bool {
+		return area[i] < area[j]
+	})
+	return strings.Join(area, ",")
 }
 }
 
 
 //
 //

+ 1 - 0
src/jfw/modules/subscribepay/src/entity/areaPack.go

@@ -195,6 +195,7 @@ func (this *AreaPackFilter) Power(userid string, startime, endtime time.Time) bo
 		"o_jy.o_buyset_p":  map[string]interface{}{"areacount": this.Num},
 		"o_jy.o_buyset_p":  map[string]interface{}{"areacount": this.Num},
 		"o_jy.l_areaEnd_p": endtime.Unix(),
 		"o_jy.l_areaEnd_p": endtime.Unix(),
 		"o_jy.i_ppstatus":  1,
 		"o_jy.i_ppstatus":  1,
+		"o_jy.i_newfree":   1, //新免费用户=>新订阅设置页面 20211122
 	}
 	}
 	if this.OrderType == 1 || this.OrderType == 2 {
 	if this.OrderType == 1 || this.OrderType == 2 {
 		setMap["o_jy.l_areaStart_p"] = startime.Unix()
 		setMap["o_jy.l_areaStart_p"] = startime.Unix()

+ 2 - 1
src/web/staticres/big-member/js/set_area.js

@@ -188,8 +188,9 @@ var vNode = {
         // 根据城市的选择情况判断省份的选择情况
         // 根据城市的选择情况判断省份的选择情况
         changeCityState(province, city) {
         changeCityState(province, city) {
             if (city === '#') {
             if (city === '#') {
+                this.setCitySelected()
                 this.onChange()
                 this.onChange()
-                return this.setCitySelected()
+                return
             }
             }
             // 全国置为空
             // 全国置为空
             this.provinceListMap['#'][0].selectedState = ''
             this.provinceListMap['#'][0].selectedState = ''