소스 검색

no message

xingzai 1 년 전
부모
커밋
7457688638
7개의 변경된 파일67개의 추가작업 그리고 29개의 파일을 삭제
  1. 12 12
      controllers/activity.go
  2. 1 0
      controllers/article.go
  3. 4 4
      controllers/home.go
  4. 9 6
      controllers/yanxuan_special.go
  5. 15 4
      services/activity.go
  6. 24 1
      services/es_comprehensive.go
  7. 2 2
      services/tag.go

+ 12 - 12
controllers/activity.go

@@ -1818,18 +1818,18 @@ func (this *ActivityCoAntroller) Check() {
 		return
 	}
 
-	if activityInfo.LimitPeopleNum > 0 {
-		signupCount, err := models.GetActivitySignupSuccessByUserCountNoHz(activityId)
-		if err != nil {
-			br.Msg = "获取信息"
-			br.ErrMsg = "GetActivitySignupSuccessByUserCountNoHz,Err:" + err.Error()
-			return
-		}
-		if activityInfo.LimitPeopleNum <= signupCount {
-			br.Msg = "提示报名已满,留意下期活动的弹窗"
-			return
-		}
-	}
+	//if activityInfo.LimitPeopleNum > 0 {
+	//	signupCount, err := models.GetActivitySignupSuccessByUserCountNoHz(activityId)
+	//	if err != nil {
+	//		br.Msg = "获取信息"
+	//		br.ErrMsg = "GetActivitySignupSuccessByUserCountNoHz,Err:" + err.Error()
+	//		return
+	//	}
+	//	if activityInfo.LimitPeopleNum <= signupCount {
+	//		br.Msg = "提示报名已满,留意下期活动的弹窗"
+	//		return
+	//	}
+	//}
 
 	//这里的文案顺序提示 权限>时间>研选扣点>邮箱绑定。
 	resp := new(models.ActivityCheck)

+ 1 - 0
controllers/article.go

@@ -1224,6 +1224,7 @@ func (this *ArticleController) ApplyAppointmentExpert() {
 		br.Ret = 408
 		return
 	}
+	fmt.Println(user)
 	var req models.CygxArticleIdReq
 	err := json.Unmarshal(this.Ctx.Input.RequestBody, &req)
 	if err != nil {

+ 4 - 4
controllers/home.go

@@ -74,10 +74,10 @@ func (this *HomeController) NewList() {
 		if labelKeyword == "" {
 			//查询近一个月的数据
 			condition += " AND search_order_time  >   '" + time.Now().AddDate(0, 0, -60).Format(utils.FormatDateTime) + "'"
-			yanxuanActivityIds = services.GetYanxuanActivityIds() // 获取所有的研选活动ID
-			yanxuanArticleIds = services.GetYanxuanArticleIds()   //获取所有研选文章ID
+			yanxuanActivityIds = services.GetYanxuanActivityIds(user) // 获取所有的研选活动ID
+			yanxuanArticleIds = services.GetYanxuanArticleIds()       //获取所有研选文章ID
 		} else {
-			yanxuanActivityIds, yanxuanArticleIds, err = services.GetConditionInitByTagIds(labelKeyword)
+			yanxuanActivityIds, yanxuanArticleIds, err = services.GetConditionInitByTagIds(user, labelKeyword)
 			if err != nil {
 				br.Msg = "获取失败"
 				br.ErrMsg = "获取活动权限数据失败,GetConditionInitByTagIds Err:" + err.Error()
@@ -112,7 +112,7 @@ func (this *HomeController) NewList() {
 		}
 	} else {
 
-		tmpResult, tmpTotalResult, err := services.SqlComprehensiveSearch(keyWord, startSize, pageSize)
+		tmpResult, tmpTotalResult, err := services.SqlComprehensiveSearch(user, keyWord, startSize, pageSize)
 		if err != nil {
 			br.Msg = "检索失败"
 			br.ErrMsg = "检索失败,Err:" + err.Error()

+ 9 - 6
controllers/yanxuan_special.go

@@ -783,14 +783,17 @@ func (this *YanxuanSpecialController) Follow() {
 		br.Msg = "参数错误"
 		return
 	}
+
 	var sellerName string
-	sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
-	if err != nil {
-		br.Msg = "查询栏目详情失败!"
-		br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
-		return
+	if user.CompanyId > 1 {
+		sellerItemQy, err := models.GetSellerByCompanyIdCheckFicc(user.CompanyId, 2)
+		if err != nil {
+			br.Msg = "查询栏目详情失败!"
+			br.ErrMsg = "获取销售信息失败,Err:" + err.Error()
+			return
+		}
+		sellerName = sellerItemQy.RealName
 	}
-	sellerName = sellerItemQy.RealName
 	if req.Status == 1 {
 		item := models.CygxYanxuanSpecialFollow{
 			UserId:           user.UserId,

+ 15 - 4
services/activity.go

@@ -1295,7 +1295,7 @@ func GetActivityTypeIdMap() (mapResp map[int]int) {
 }
 
 // GetYanxuanActivityIds 获取研选活动ID
-func GetYanxuanActivityIds() (activityIds []int) {
+func GetYanxuanActivityIds(user *models.WxUserItem) (activityIds []int) {
 	var err error
 	defer func() {
 		if err != nil {
@@ -1305,13 +1305,24 @@ func GetYanxuanActivityIds() (activityIds []int) {
 	}()
 	var condition string
 	var pars []interface{}
-	condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  `
-	pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
-	list, e := models.GetCygxActivityIdList(condition, pars)
+	condition = `  AND  chart_permission_id  = 31  AND yidong_activity_id = '' AND art.publish_status = 1  `
+	//pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)
+	if user.CompanyId > 1 {
+		conditionActivity, e := ActivityConditioninitSql(user, condition, 0)
+		if e != nil && e.Error() != utils.ErrNoRow() {
+			err = errors.New("ActivityConditioninitSql, Err: " + e.Error())
+			return
+		}
+		condition += conditionActivity
+	}
+
+	condition += ` ORDER BY art.activity_time DESC ,  art.active_state ASC   `
+	list, e := models.GetCygxActivityList(condition, pars, 0, 2000)
 	if e != nil {
 		err = errors.New("GetCygxActivityIdList, Err: " + e.Error())
 		return
 	}
+
 	for _, v := range list {
 		activityIds = append(activityIds, v.ActivityId)
 	}

+ 24 - 1
services/es_comprehensive.go

@@ -673,8 +673,31 @@ func GetResourceDataEsList(list []*SearchComprehensiveItem, user *models.WxUserI
 	return
 }
 
-func SqlComprehensiveSearch(keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int, err error) {
+func SqlComprehensiveSearch(user *models.WxUserItem, keyWord string, startSize, pageSize int) (result []*SearchComprehensiveItem, total int, err error) {
+	yanxuanActivityIds := GetYanxuanActivityIds(user) // 获取所有的研选活动ID
+	yanxuanArticleIds := GetYanxuanArticleIds()       //获取所有研选文章ID
+	yanxuanArticleIds = append(yanxuanArticleIds, 0)
+	yanxuanActivityIds = append(yanxuanActivityIds, 0)
+
+	var yanxuanArticleIdsStr []string
+	var yanxuanActivityIdsStr []string
+
+	for _, v := range yanxuanArticleIds {
+		yanxuanArticleIdsStr = append(yanxuanArticleIdsStr, strconv.Itoa(v))
+	}
+
+	for _, v := range yanxuanActivityIds {
+		yanxuanActivityIdsStr = append(yanxuanActivityIdsStr, strconv.Itoa(v))
+	}
+
+	//yanxuanspecialIds = append(yanxuanspecialIds, 0)
 	condition := " AND source IN ('article','activity','yanxuanspecial')   " // 只有研选的文章、研选的活动、研选的专栏这三种
+	condition += `  AND IF ( source = 'article' , source_id   IN (` + strings.Join(yanxuanArticleIdsStr, ",") + `) ,1=1 ) `
+	//pars = append(pars, yanxuanArticleIds)
+
+	condition += `  AND IF ( source = 'activity' , source_id   IN (` + strings.Join(yanxuanActivityIdsStr, ",") + `) ,1=1 ) `
+	//pars = append(pars, yanxuanActivityIds)
+
 	keyWord = "%" + keyWord + "%"
 	var conditionTitle string
 	var parsTitle []interface{}

+ 2 - 2
services/tag.go

@@ -59,14 +59,14 @@ func AddCygxTagHistory(user *models.WxUserItem, tagId int) (err error) {
 //	LABEL_L3_3 string = "主题c"     // 主题c
 //)
 
-func GetConditionInitByTagIds(labelKeyword string) (yanxuanActivityIdsResp, yanxuanArticleIdsResp []int, err error) {
+func GetConditionInitByTagIds(user *models.WxUserItem, labelKeyword string) (yanxuanActivityIdsResp, yanxuanArticleIdsResp []int, err error) {
 	var yanxuanActivityIds []int
 	var yanxuanArticleIds []int
 	var condition string
 	var pars []interface{}
 	switch labelKeyword {
 	case utils.LABEL_L1_1: // 全部活动
-		yanxuanActivityIds = GetYanxuanActivityIds() // 获取所有的研选活动ID
+		yanxuanActivityIds = GetYanxuanActivityIds(user) // 获取所有的研选活动ID
 	case "买方交流": // 买方交流 ->买方线下交流
 		condition = `   AND  chart_permission_id  = ? AND yidong_activity_id = ''  AND activity_type_id = 8  `
 		pars = append(pars, utils.CHART_PERMISSION_ID_YANXUAN)