|
@@ -50,7 +50,7 @@ func (this *MarketAnalysis) ProjectInfo() {
|
|
|
if rid == "" {
|
|
|
return nil, fmt.Errorf("参数异常")
|
|
|
}
|
|
|
- log.Println("-----:", this.GetString("keysItems"))
|
|
|
+ log.Println("keysItems==", this.GetString("keysItems"))
|
|
|
//接受参数
|
|
|
bParam := marketAnalysis.AnalysisRequestParam{
|
|
|
KeysItemsStr: this.GetString("keysItems"), //分析内容【字符串】结构和o_member_jy.a_items保持一致
|
|
@@ -73,16 +73,20 @@ func (this *MarketAnalysis) ProjectInfo() {
|
|
|
//原查询条件
|
|
|
maePrimary := &marketAnalysis.MarketAnalysisEntity{MgoRecordId: rid, UId: userId, Pid: pid}
|
|
|
if err := maePrimary.GetAnalysisFromMgoDb(); err == nil {
|
|
|
- if bParam.KeysItemsStr == "" || bParam.KeysItemsStr == "{}" || len([]rune(bParam.KeysItemsStr)) < 2 { //分析内容【字符串】结构和o_member_jy.a_items保持一致
|
|
|
+ if bParam.KeysItemsStr == "" || bParam.KeysItemsStr == "{}" ||
|
|
|
+ bParam.KeysItemsStr == "[]" || len([]rune(bParam.KeysItemsStr)) < 2 { //分析内容【字符串】结构和o_member_jy.a_items保持一致
|
|
|
mae.BaseParam.KeysItemsStr = maePrimary.BaseParam.KeysItemsStr
|
|
|
}
|
|
|
- if bParam.Area == "" || bParam.Area == "{}" || len([]rune(bParam.Area)) < 2 { //省份【字符串】多个省份用逗号拼接
|
|
|
+ if bParam.Area == "" || bParam.Area == "{}" ||
|
|
|
+ bParam.Area == "[]" || len([]rune(bParam.Area)) < 2 { //省份【字符串】多个省份用逗号拼接
|
|
|
mae.BaseParam.Area = maePrimary.BaseParam.Area
|
|
|
}
|
|
|
- if bParam.Industry == "" || bParam.Industry == "{}" || len([]rune(bParam.Industry)) < 2 { //行业【字符串】多个行业用逗号拼接
|
|
|
+ if bParam.Industry == "" || bParam.Industry == "{}" ||
|
|
|
+ bParam.Industry == "[]" || len([]rune(bParam.Industry)) < 2 { //行业【字符串】多个行业用逗号拼接
|
|
|
mae.BaseParam.Industry = maePrimary.BaseParam.Industry
|
|
|
}
|
|
|
- if bParam.BuyerClass == "" || bParam.BuyerClass == "{}" || len([]rune(bParam.BuyerClass)) < 2 { //采购单位类型【字符串】多个采购单位类型用逗号拼接
|
|
|
+ if bParam.BuyerClass == "" || bParam.BuyerClass == "{}" ||
|
|
|
+ bParam.BuyerClass == "[]" || len([]rune(bParam.BuyerClass)) < 2 { //采购单位类型【字符串】多个采购单位类型用逗号拼接
|
|
|
mae.BaseParam.BuyerClass = maePrimary.BaseParam.BuyerClass
|
|
|
}
|
|
|
if bParam.MatchingMode == "" { //匹配模式
|
|
@@ -119,6 +123,17 @@ func checkPower(session *httpsession.Session) (string, error) {
|
|
|
return bigMeg.Pid, nil
|
|
|
}
|
|
|
|
|
|
+// checkPower 权限校验 增加判断权益 过滤字段
|
|
|
+func checkPowerEquity(session *httpsession.Session) (string, bool, error) {
|
|
|
+ userid := fmt.Sprint(qutil.Int64All(session.Get("base_user_id")))
|
|
|
+ if userid == "" || userid == "0" {
|
|
|
+ return "", false, fmt.Errorf("未登录")
|
|
|
+ }
|
|
|
+ //仅购买《定制化市场分析报告》的大会员有权限
|
|
|
+ bigMeg := jy.GetBigVipUserBaseMsg(session, *config.Middleground)
|
|
|
+ return bigMeg.Pid, bigMeg.PowerMap[26], nil
|
|
|
+}
|
|
|
+
|
|
|
const (
|
|
|
AnalysisStatusRealTime = 0 // 实时生成
|
|
|
AnalysisStatusOffline = 1 // 离线生成
|
|
@@ -282,7 +297,7 @@ func (this *MarketAnalysis) GetAnalysisResult() {
|
|
|
userId := qutil.ObjToString(sessVal["userId"])
|
|
|
positionId := qutil.IntAll(sessVal["positionId"])
|
|
|
rData, errMsg := func() (interface{}, error) {
|
|
|
- pid, powerErr := checkPower(this.Session())
|
|
|
+ pid, isEquity, powerErr := checkPowerEquity(this.Session())
|
|
|
if powerErr != nil {
|
|
|
return nil, powerErr
|
|
|
}
|
|
@@ -300,6 +315,16 @@ func (this *MarketAnalysis) GetAnalysisResult() {
|
|
|
if err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
+ if !isEquity && flag != 0 {
|
|
|
+ newData := make(map[string]interface{})
|
|
|
+ var keyArr = []string{"market_profile", "month_distribution", "year_distribution", "scaleBuyclassAmountTop", "customer_scale_other", "buyer_time_distribution", "winner_time_distribution", "scaleBuyclassCountTop", "customer_scale"}
|
|
|
+ for _, key := range keyArr {
|
|
|
+ if vs, ok := rData[key]; ok {
|
|
|
+ newData[key] = vs
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return newData, nil
|
|
|
+ }
|
|
|
return rData, nil
|
|
|
}()
|
|
|
if errMsg != nil {
|