Browse Source

Merge branch 'bugfix_8/25'

ziwen 1 year ago
parent
commit
bd51173fa5
4 changed files with 11 additions and 6 deletions
  1. 6 3
      controllers/yb/apply_record.go
  2. 2 1
      models/wx_user.go
  3. 1 1
      models/yb/apply_record.go
  4. 2 1
      services/yb/apply_record.go

+ 6 - 3
controllers/yb/apply_record.go

@@ -318,7 +318,7 @@ func (this *ApplyRecordController) UserApplyList() {
 		pars = append(pars, reqKeyword, reqKeyword, reqKeyword, reqKeyword, reqKeyword)
 	}
 	if markGroup != "" {
-		condition += `AND y.mark_group = `+"'"+markGroup+"'"
+		condition += `AND (y.mark_group = `+"'"+markGroup+"'"+ ` OR a.mark_group = `+"'"+markGroup+"')"
 	}
 	if startDate != "" {
 		startDate += " 00:00:00"
@@ -533,7 +533,7 @@ func (this *ApplyRecordController) ApplyExport() {
 	}()
 	reqKeyword := this.GetString("KeyWord")
 	reqState := this.GetString("States")
-
+	markGroup := this.GetString("MarkGroup")
 	sysUser := this.SysUser
 	if sysUser == nil {
 		br.Msg = "请登录"
@@ -580,6 +580,9 @@ func (this *ApplyRecordController) ApplyExport() {
 			condition += " AND y.apply_record_id is null"
 		}
 	}
+	if markGroup != "" {
+		condition += `AND (y.mark_group = `+"'"+markGroup+"'"+ ` OR a.mark_group = `+"'"+markGroup+"')"
+	}
 	startTime := "2022-01-01"
 	list, err := yb.GetApplyRecordListV2Export(condition, pars, startTime)
 	if err != nil {
@@ -954,7 +957,7 @@ func (this *ApplyRecordController) MarkGroup() {
 		br.ErrMsg = "参数解析失败,Err:" + err.Error()
 		return
 	}
-	if req.ApplyRecordId <= 0 && req.GroupName != "" && req.UserId != 0 {
+	if req.GroupName == "" || req.UserId == 0 {
 		br.Msg = "申请记录ID或者分组名异常"
 		br.ErrMsg = "申请记录ID或者分组名异常"
 		return

+ 2 - 1
models/wx_user.go

@@ -32,6 +32,7 @@ type WxUser struct {
 	OpenId              string    `orm:"column(open_id)" description:"微信openid"`
 	Headimgurl          string    `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
 	UserLabel           string    `description:"查研观向用户标签"`
+	MarkGroup           string    `description:"标记分组"`
 }
 
 func AddWxUser(item *WxUser) (lastId int64, err error) {
@@ -521,4 +522,4 @@ func GetWxUserListCompanyId(companyId int) (list []*WxUserItem, err error) {
 	sql := ` SELECT* FROM wx_user  WHERE company_id = ?   `
 	_, err = o.Raw(sql, companyId).QueryRows(&list)
 	return
-}
+}

+ 1 - 1
models/yb/apply_record.go

@@ -158,7 +158,7 @@ SELECT
 	y.is_move,
 	y.source,
 	y.from_page,
-	y.mark_group,
+	IF(y.mark_group = '' OR y.mark_group IS NULL, a.mark_group, y.mark_group) AS mark_group,
     y.company_name as user_company_name
     #bp.seller_id,
 	#bp.seller_name

+ 2 - 1
services/yb/apply_record.go

@@ -319,9 +319,10 @@ func MarkGroupApplyRecord(applyRecordId, adminId, userId int, groupName string)
 	// 未处理过则进行标记
 	if wxUser.IsDeal == 0 {
 		wxUser.IsDeal = 1
+		wxUser.MarkGroup = groupName
 		wxUser.LastUpdatedTime = time.Now()
 		userUpdateCols := make([]string, 0)
-		userUpdateCols = append(userUpdateCols, "IsDeal", "LastUpdatedTime")
+		userUpdateCols = append(userUpdateCols, "IsDeal", "MarkGroup", "LastUpdatedTime")
 		err = wxUser.Update(userUpdateCols)
 		if err != nil {
 			err = errors.New(fmt.Sprint("对应用户信息标记失败", err))