|
@@ -57,3 +57,90 @@ func GetActivityListSpecialAll(activityId int) (items []*CygxActivitySpecialSign
|
|
|
_, err = o.Raw(sql, activityId).QueryRows(&items)
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
+type CygxActivitySpecialSignupResp struct {
|
|
|
+ Id int `orm:"column(id);pk"`
|
|
|
+ ActivityId int `description:"活动ID"`
|
|
|
+ UserId int `description:"用户ID"`
|
|
|
+ CreateTime time.Time `description:"创建时间"`
|
|
|
+ Mobile string `description:"手机号"`
|
|
|
+ Email string `description:"邮箱"`
|
|
|
+ CompanyId int `description:"公司id"`
|
|
|
+ CompanyName string `description:"公司名称"`
|
|
|
+ RealName string `description:"用户实际名称"`
|
|
|
+ SellerName string `description:"所属销售"`
|
|
|
+ Count string `description:"所属销售"`
|
|
|
+}
|
|
|
+
|
|
|
+//列表
|
|
|
+func GetActivityListSpecialGroupByMobile() (items []*CygxActivitySpecialSignupResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT *, COUNT( 1 ) AS count FROM cygx_activity_special_signup GROUP BY mobile`
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+//列表
|
|
|
+func GetActivityListSpecialGroupByCompanyId() (items []*CygxActivitySpecialSignupResp, err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ sql := `SELECT *, COUNT( 1 ) AS count FROM cygx_activity_special_signup GROUP BY company_id`
|
|
|
+ _, err = o.Raw(sql).QueryRows(&items)
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateActivitySpecialSignupNumMulti 批量修改专项调研感兴趣的人数排名
|
|
|
+func UpdateActivitySpecialSignupNumMulti(items []*CygxActivitySpecialSignupResp) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ p, err := o.Raw("UPDATE cygx_activity_special_signup SET user_num = ? WHERE mobile = ?").Prepare()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ _ = p.Close() // 别忘记关闭 statement
|
|
|
+ }()
|
|
|
+ for _, v := range items {
|
|
|
+ _, err = p.Exec(v.Count, v.Mobile)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateActivitySpecialSignupCompanyIdMulti 批量修改专项调研感兴趣的用户的对应公司ID
|
|
|
+func UpdateActivitySpecialSignupCompanyIdMulti(items []*WxUser) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ p, err := o.Raw("UPDATE cygx_activity_special_signup SET company_id = ? WHERE mobile = ?").Prepare()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ _ = p.Close() // 别忘记关闭 statement
|
|
|
+ }()
|
|
|
+ for _, v := range items {
|
|
|
+ _, err = p.Exec(v.CompanyId, v.Mobile)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|
|
|
+
|
|
|
+// UpdateActivitySpecialSignupCompanyNumMulti 批量修改专项调研感兴趣的公司对应的数量
|
|
|
+func UpdateActivitySpecialSignupCompanyNumMulti(items []*CygxActivitySpecialSignupResp) (err error) {
|
|
|
+ o := orm.NewOrm()
|
|
|
+ p, err := o.Raw("UPDATE cygx_activity_special_signup SET company_num = ? WHERE company_id = ?").Prepare()
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ defer func() {
|
|
|
+ _ = p.Close() // 别忘记关闭 statement
|
|
|
+ }()
|
|
|
+ for _, v := range items {
|
|
|
+ _, err = p.Exec(v.Count, v.CompanyId)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return
|
|
|
+}
|