xingzai il y a 8 mois
Parent
commit
3c10995af5
2 fichiers modifiés avec 7 ajouts et 1 suppressions
  1. 1 1
      models/wx_user.go
  2. 6 0
      services/rai_serve_count.go

+ 1 - 1
models/wx_user.go

@@ -649,7 +649,7 @@ func GetWxUserisMakerByCompanyIds(companyIds []int) (items []*WxUser, err error)
 	if lenArr == 0 {
 		return
 	}
-	sql := `SELECT user_id  FROM wx_user  WHERE company_id in (` + utils.GetOrmInReplace(lenArr) + `) AND is_maker = 1   `
+	sql := `SELECT user_id,mobile FROM wx_user  WHERE company_id in (` + utils.GetOrmInReplace(lenArr) + `) AND is_maker = 1   `
 	o := orm.NewOrmUsingDB("weekly_report")
 	_, err = o.Raw(sql, companyIds).QueryRows(&items)
 	return

+ 6 - 0
services/rai_serve_count.go

@@ -447,8 +447,10 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
 		return
 	}
 	mapUserMaker := make(map[int]bool)
+	mapUserMobileUserId := make(map[string]int)
 	for _, v := range listisMakeruser {
 		mapUserMaker[v.UserId] = true
+		mapUserMobileUserId[v.Mobile] = v.UserId
 	}
 
 	var condition string
@@ -664,6 +666,10 @@ func UpdateCygxRaiServeBillByCompanyIds() (err error) {
 				item.ServeTypeId = 2
 				item.ServeTypeName = "线下活动"
 			}
+			if v.UserId == 0 && v.Mobile != "" {
+				v.UserId = mapUserMobileUserId[v.Mobile] // 空降的部分联系人 userid 为0这里做一下修复
+			}
+
 			item.UserId = v.UserId
 			item.Mobile = v.Mobile
 			item.Email = v.Email