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

是否收藏 标签显示

wangshan 4 жил өмнө
parent
commit
6884e64312

+ 26 - 0
src/jfw/modules/publicapply/src/bidcollection/entity/entity.go

@@ -31,6 +31,32 @@ var (
 	insertCollKey2 = []string{"userid", "bid", "labelid", "buyerclass", "buyerinfo", "winnerinfo", "createdate"}
 )
 
+//招标信息是否被收藏 并返回标签
+func IsCollByBidsBackInfo(bids, userid string) map[string]interface{} {
+	res := map[string]interface{}{
+		"iscoll": false,
+	}
+	bid := util.DecodeId(strings.Split(bids, ",")[0])
+	if bdinfos := *db.Mysql.SelectBySql(fmt.Sprintf("SELECT labelid FROM %s WHERE userid = ? AND bid = ?", db.DbConf.Bdcollection), userid, bid); len(bdinfos) > 0 {
+		bdinfo := bdinfos[0]
+		label_ids := qu.ObjToString(bdinfo["labelid"])
+		var labArr = []string{}
+		res["iscoll"] = true
+		if label_ids != "" {
+			if labinfos := *db.Mysql.SelectBySql(fmt.Sprintf("SELECT * FROM %s WHERE id IN (?)", db.DbConf.Bdlabel), strings.Split(label_ids, ",")[0]); len(labinfos) > 0 {
+				for _, v := range labinfos {
+					labArr = append(labArr, qu.ObjToString(v["labelname"]))
+				}
+			}
+		}
+		res = map[string]interface{}{
+			"iscoll": true,
+			"labels": labArr,
+		}
+	}
+	return res
+}
+
 //招标信息是否被收藏
 func IsCollByBids(bids, userid string) []string {
 	res := []string{}

+ 3 - 0
src/jfw/modules/publicapply/src/bidcollection/service/service.go

@@ -20,6 +20,9 @@ func (this *ServiceStruct) IsCollAction() {
 		if this.GetString("bids") == "" {
 			return Result{Data: nil, Error_msg: Error_msg_1003}
 		}
+		if this.GetString("label") != "" {
+			return Result{Data: entity.IsCollByBidsBackInfo(this.GetString("bids"), userId)}
+		}
 		return Result{Data: entity.IsCollByBids(this.GetString("bids"), userId)}
 	}()
 	this.ServeJson(r)

+ 11 - 2
src/jfw/modules/publicapply/src/dataexport/service/action.go

@@ -94,9 +94,18 @@ func isPay(userid string) bool {
 			phone = s_m_phone
 		}
 		if phone != "" {
-			if db.Mysql.CountBySql(`select count(1) from entniche_user where phone = ? and power =1`, phone) > 0 {
-				isEnt = true
+			//已购买企业未过期
+			if entInfo := *db.Mysql.SelectBySql(`SELECT status FROM entniche_info WHERE id  IN (SELECT ent_id FROM entniche_user where phone = ? and power =1)`, phone); len(entInfo) > 0 {
+				for _, v := range entInfo {
+					if util.IntAll(v["status"]) == 1 {
+						isEnt = true
+						break
+					}
+				}
 			}
+			// if db.Mysql.CountBySql(`select count(1) from entniche_user where phone = ? and power =1`, phone) > 0 {
+			// 	isEnt = true
+			// }
 		}
 	}
 	return isVip || isEnt || isMember

+ 18 - 18
src/jfw/modules/publicapply/src/util/util.go

@@ -52,6 +52,24 @@ type CollList struct {
 func CollListSql(c *CollList, isPay bool, userid string) string {
 	sql := fmt.Sprintf(`select bid from %s where userid ='%s'`, db.DbConf.Bdcollection, userid)
 	limit := config.BidCollConfig.FreeUserCollLimit
+	//个人标签
+	if c.Label != "" {
+		i := 0
+		sql += ` and `
+		if labelArr := strings.Split(c.Label, ","); len(labelArr) > 0 {
+			sql += `(`
+			for _, v := range labelArr {
+				i++
+				labid := qutil.SE.DecodeString(v)
+				if i == len(labelArr) {
+					sql += fmt.Sprintf(`FIND_IN_SET(%s,labelid)`, labid)
+				} else {
+					sql += fmt.Sprintf(`FIND_IN_SET(%s,labelid) or `, labid)
+				}
+			}
+			sql += `)`
+		}
+	}
 	if isPay {
 		now := time.Now()
 		start, end := "", ""
@@ -97,24 +115,6 @@ func CollListSql(c *CollList, isPay bool, userid string) string {
 				}
 			}
 		}
-		//个人标签
-		if c.Label != "" {
-			i := 0
-			sql += ` and `
-			if labelArr := strings.Split(c.Label, ","); len(labelArr) > 0 {
-				sql += `(`
-				for _, v := range labelArr {
-					i++
-					labid := qutil.SE.DecodeString(v)
-					if i == len(labelArr) {
-						sql += fmt.Sprintf(`FIND_IN_SET(%s,labelid)`, labid)
-					} else {
-						sql += fmt.Sprintf(`FIND_IN_SET(%s,labelid) or `, labid)
-					}
-				}
-				sql += `)`
-			}
-		}
 		//是否存在采购单位电话
 		if c.BuyerPhone == 1 {
 			sql += ` and buyerinfo = 1`