Browse Source

Merge branch 'dev3.4.8' of http://192.168.3.207:10080/qmx/jy into dev3.4.8

wangshan 4 years ago
parent
commit
25cf9cfa4f

+ 0 - 3
src/jfw/front/dataExport.go

@@ -466,7 +466,6 @@ func (d *DataExport) ToCreateOrderPage(_id string) error {
 	//邮箱验证
 	email := d.GetSession("DataExportVerifyEmail_val")
 	resPhone := d.GetSession("DataExportVerifyPhone_val")
-	log.Println(util.Int64All(d.GetSession("CreatEVerifyTime")), "----", time.Now().Unix())
 	if email != nil {
 		lastSendDEVerify := util.Int64All(d.GetSession("CreatEVerifyTime"))
 		timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
@@ -635,9 +634,7 @@ func (d *DataExport) SendMailVerify() {
 		}
 		if email_used {
 			lastSendDEVerify := util.Int64All(d.GetSession("CreatEVerifyTime"))
-			log.Println(util.Int64All(d.GetSession("CreatEVerifyTime")), "----", time.Now().Unix())
 			timeSpaceing := lastSendDEVerify - time.Now().Unix() + 60*5
-			log.Println("--------:", timeSpaceing)
 			incurKey := fmt.Sprintf("SendEmail_%s_%d", d.GetSession("userId"), time.Now().Day())
 			//log.Println(incurKey)
 			if lastSendDEVerify == 0 || timeSpaceing < 0 {

+ 0 - 1
src/jfw/front/swordfish.go

@@ -2315,7 +2315,6 @@ func (f *Front) SearchResult(at, name string) error {
 		var datas *[]map[string]interface{}
 		if list == nil {
 			count := elastic.Count(INDEX, TYPE, query1)
-			//log.Println("count:", count, "----", query)
 			r := rand.New(rand.NewSource(time.Now().UnixNano()))
 			currentPage = no
 			startPage = r.Intn(currentPage * limitcount)

+ 66 - 28
src/jfw/modules/app/src/web/staticres/jyapp/big-member/js/big_subscribe.js

@@ -162,24 +162,43 @@ var vNode = {
                 success:function(res) {
                     console.log(res)
                     if (res.error_code == 0){
-                        if(res.data && res.data.list && $.isArray(res.data.list) && res.data.list.length != 0){  
+                        if(res.data && res.data.list && $.isArray(res.data.list)){
                             _this.foShow = false
-                            for (let i = 0; i < res.data.list.length; i++) {
-                                res.data.list[i].budget = _this.moneyUnit(res.data.list[i].budget)
-                                var highlight = ''
-                                if(res.data.list[i].matchkeys && $.isArray(res.data.list[i].matchkeys) && res.data.list[i].matchkeys.length != 0){
-                                    highlight = utils.replaceKeyword(res.data.list[i].title,res.data.list[i].matchkeys, _this.highlightTag)
-                                    res.data.list[i].title = highlight
+                            // 当数组为空时,且不为第一页,底部显示没有更多数据
+                            if(res.data.list.length == 0 && _this.setParam.pagenum != 1){
+                                _this.list = _this.list.concat(res.data.list)
+                                _this.loading = false
+                                if(!res.data.hasnextpage){
+                                    _this.loading = true
+                                    _this.finished = true;
+                                }else{
+                                    _this.loading = false
+                                    _this.setParam.pagenum++
                                 }
-                            }
-                            _this.list = _this.list.concat(res.data.list)
-                            _this.loading = false
-                            if(!res.data.hasnextpage){
+                            }else if(res.data.list.length == 0 && _this.setParam.pagenum == 1){
+                                // 当数组为空时,且为第一页,页面为暂无数据页面
                                 _this.loading = true
                                 _this.finished = true;
-                            }else{
+                                _this.foShow = true
+                            } else {
+                                // 数据正常加载更多
+                                for (let i = 0; i < res.data.list.length; i++) {
+                                    res.data.list[i].budget = _this.moneyUnit(res.data.list[i].budget)
+                                    var highlight = ''
+                                    if(res.data.list[i].matchkeys && $.isArray(res.data.list[i].matchkeys) && res.data.list[i].matchkeys.length != 0){
+                                        highlight = utils.replaceKeyword(res.data.list[i].title,res.data.list[i].matchkeys, _this.highlightTag)
+                                        res.data.list[i].title = highlight
+                                    }
+                                }
+                                _this.list = _this.list.concat(res.data.list)
                                 _this.loading = false
-                                _this.setParam.pagenum++
+                                if(!res.data.hasnextpage){
+                                    _this.loading = true
+                                    _this.finished = true;
+                                }else{
+                                    _this.loading = false
+                                    _this.setParam.pagenum++
+                                }
                             }
                         }else{
                             _this.loading = true
@@ -390,25 +409,44 @@ var vNode = {
                 success:function(res) {
                     console.log(res)
                     if (res.error_code == 0){
-                    // res.data.list=[]
-                        if(res.data && res.data.list && $.isArray(res.data.list) && res.data.list.length!=0){
+                        if(res.data && res.data.list && $.isArray(res.data.list)){
                             _this.foShow = false
-                            for (let i = 0; i < res.data.list.length; i++) {
-                                res.data.list[i].budget = _this.moneyUnit(res.data.list[i].budget)
-                                var highlight = ''
-                                if(res.data.list[i].matchkeys && $.isArray(res.data.list[i].matchkeys) && res.data.list[i].matchkeys.length != 0){
-                                    highlight = utils.replaceKeyword(res.data.list[i].title,res.data.list[i].matchkeys, _this.highlightTag)
-                                    res.data.list[i].title = highlight
+                            // 当数组为空时,且不为第一页,底部显示没有更多数据
+                            if(res.data.list.length == 0 && _this.setParam.pagenum != 1){
+                                areaList = areaList.concat(res.data.list)
+                                _this.loading = false
+                                if(!res.data.hasnextpage){
+                                    _this.loading = true
+                                    _this.finished = true;
+                                }else{
+                                    _this.loading = false
+                                    _this.setParam.pagenum++
                                 }
-                            }
-                            areaList = areaList.concat(res.data.list)
-                            _this.list= areaList
-                            if(!res.data.hasnextpage){
+                            }else if(res.data.list.length == 0 && _this.setParam.pagenum == 1){
+                                // 当数组为空时,且为第一页,页面为暂无数据页面
                                 _this.loading = true
                                 _this.finished = true;
-                            }else{
-                                _this.loading = false
-                                _this.setParam.pagenum++
+                                _this.foShow = true
+                            } else {
+                                 // 数据正常加载更多
+                                for (let i = 0; i < res.data.list.length; i++) {
+                                    res.data.list[i].budget = _this.moneyUnit(res.data.list[i].budget)
+                                    var highlight = ''
+                                    if(res.data.list[i].matchkeys && $.isArray(res.data.list[i].matchkeys) && res.data.list[i].matchkeys.length != 0){
+                                        highlight = utils.replaceKeyword(res.data.list[i].title,res.data.list[i].matchkeys, _this.highlightTag)
+                                        res.data.list[i].title = highlight
+                                    }
+                                }
+                                areaList = areaList.concat(res.data.list)
+                                _this.list= areaList
+                                if(!res.data.hasnextpage){
+                                    _this.loading = true
+                                    _this.finished = true;
+                                }else{
+                                    _this.loading = false
+                                    _this.finished = false
+                                    _this.setParam.pagenum++
+                                }
                             }
                         }else{
                             _this.loading = true

+ 2 - 2
src/jfw/modules/subscribepay/src/entity/dataExportSearch.go

@@ -78,7 +78,7 @@ func getDataExportSql(scd *SieveCondition) string {
 	multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
 	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
-	query_bools_must := `{"bool":{"must":[{"range":{"bidamount":{%s}}}],"must_not":[{"term":{"bidamount":0}},{"term":{"budget":0}}]}},{"bool":{"must":[{"term":{"bidamount":0}},{"range":{"budget":{%s}}}]}},{"bool":{"must":[{"term":{"budget":0}},{"range":{"bidamount":{%s}}}]}}`
+	query_price := `{"bool":{"must":[{"range":{"bidamount":{%s}}}]}},{"bool":{"must":[{"range":{"budget":{%s}}}],"must_not":[{"range":{"bidamount":{"gte":-1}}}]}}`
 	query_bool_must := `{"terms":{"%s":[%s]}}`
 	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
 	gte := `"gte": %s`
@@ -202,7 +202,7 @@ func getDataExportSql(scd *SieveCondition) string {
 		if _maxPrice != "" {
 			sq += fmt.Sprintf(lte, _maxPrice)
 		}
-		query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_bools_must, sq, sq, sq))
+		query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_price, sq, sq))
 		musts = append(musts, query_price)
 	}
 	boolsNum := 0

+ 2 - 7
src/jfw/public/search.go

@@ -61,7 +61,7 @@ func getDataExportSql(scd *SieveCondition) string {
 	multi_match := `{"multi_match": {"query": %s,"type": "phrase", "fields": [%s]}}`
 	query := `{"query":{"bool":{"must":[%s],"should":[%s],"minimum_should_match": %d}}}`
 	query_bool_should := `{"bool":{"should":[%s],"minimum_should_match": 1}}`
-	query_bools_must := `{"bool":{"must":[{"range":{"bidamount":{%s}}}],"must_not":[{"term":{"bidamount":0}},{"term":{"budget":0}}]}},{"bool":{"must":[{"term":{"bidamount":0}},{"range":{"budget":{%s}}}]}},{"bool":{"must":[{"term":{"budget":0}},{"range":{"bidamount":{%s}}}]}}`
+	query_price := `{"bool":{"must":[{"range":{"bidamount":{%s}}}]}},{"bool":{"must":[{"range":{"budget":{%s}}}],"must_not":[{"range":{"bidamount":{"gte":-1}}}]}}`
 	query_bool_must := `{"terms":{"%s":[%s]}}`
 	query_bool_must_and := `{"bool":{"must":[%s]%s}}`
 	gte := `"gte": %s`
@@ -185,7 +185,7 @@ func getDataExportSql(scd *SieveCondition) string {
 		if _maxPrice != "" {
 			sq += fmt.Sprintf(lte, _maxPrice)
 		}
-		query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_bools_must, sq, sq, sq))
+		query_price := fmt.Sprintf(query_bool_should, fmt.Sprintf(query_price, sq, sq))
 		musts = append(musts, query_price)
 	}
 	boolsNum := 0
@@ -273,9 +273,6 @@ func getSqlObjFromId(_id string) *SieveCondition {
 
 //数据导出-查询结果数量
 func GetDataExportSearchCountUseId(_id string) (count int) {
-	defer func(t time.Time) {
-		fmt.Println("do Cost: ", time.Since(t).Seconds())
-	}(time.Now())
 	scd := getSqlObjFromId(_id)
 	qstr := getDataExportSql(scd)
 	log.Printf("GetDataExportSearchCountUseId-%s-count:%d-sql:%s\n", _id, count, qstr)
@@ -669,7 +666,6 @@ func doSearch(sql string, start, count int, dataType string) *[]map[string]inter
 		//分页排序
 		sql = sql[:len(sql)-1] + `,"sort": {"publishtime":"desc"},"from":` + strconv.Itoa(start) + `,"size":` + strconv.Itoa(count) + "}"
 	}
-	// log.Println("sql----", sql)
 	return elastic.Get(INDEX, TYPE, sql)
 }
 
@@ -709,7 +705,6 @@ func ScreenData(arr *[]map[string]interface{}, dataType string, resultNum int, k
 		if emptyNum == -1 {
 			continue
 		}
-		//		log.Println(util.ObjToString(v["title"]), "----", kws[0].Keyword)
 		if len(kws) > 0 && kws[0].Keyword != "" {
 			var kwsFlag = true
 			for _, vk := range kws {