wx_user.go 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "hongze/hz_crm_api/utils"
  6. "time"
  7. )
  8. type WxUser struct {
  9. UserId int64 `orm:"column(user_id);pk"`
  10. Mobile string
  11. Email string
  12. CompanyId int
  13. RealName string `description:"姓名"`
  14. NickName string `description:"昵称"`
  15. CreatedTime time.Time
  16. MobileTwo string `description:"备用手机号"`
  17. BusinessCardUrl string `description:"名片"`
  18. IsMaker int `description:"是否决策人,1:是,0:否"`
  19. Position string `description:"职位"`
  20. Sex int `description:"普通用户性别,1为男性,2为女性"`
  21. DepartmentName string `description:"联系人部门"`
  22. RegisterTime time.Time
  23. RegisterPlatform int
  24. Remark string `description:"备注"`
  25. CountryCode string `description:"区号,86、852、886等"`
  26. OutboundMobile string `description:"外呼手机号"`
  27. OutboundCountryCode string `description:"外呼手机号区号,86、852、886等"`
  28. LastUpdatedTime time.Time `description:"最近一次更新时间"`
  29. IsDeal int `description:"是否标记处理 0-未处理 1-已处理"`
  30. OpenId string `orm:"column(open_id)" description:"微信openid"`
  31. Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
  32. UserLabel string `description:"查研观向用户标签"`
  33. MarkGroup string `description:"标记分组"`
  34. }
  35. func AddWxUser(item *WxUser) (lastId int64, err error) {
  36. o := orm.NewOrm()
  37. lastId, err = o.Insert(item)
  38. return
  39. }
  40. func GetWxUserByMobile(mobile string) (item *WxUser, err error) {
  41. o := orm.NewOrm()
  42. sql := `SELECT * FROM wx_user WHERE mobile = ? LIMIT 1`
  43. err = o.Raw(sql, mobile).QueryRow(&item)
  44. return
  45. }
  46. // GetWxUserByMobileCountryCode 根据手机号和区号获取用户信息
  47. func GetWxUserByMobileCountryCode(mobile, countryCode string) (item *WxUser, err error) {
  48. o := orm.NewOrm()
  49. sql := `SELECT * FROM wx_user WHERE mobile = ? `
  50. sql += ` and country_code in ("","` + countryCode + `") `
  51. sql += ` LIMIT 1 `
  52. err = o.Raw(sql, mobile).QueryRow(&item)
  53. return
  54. }
  55. func GetWxUserByUserId(userId int) (item *WxUser, err error) {
  56. o := orm.NewOrm()
  57. sql := `SELECT * FROM wx_user WHERE user_id=? `
  58. err = o.Raw(sql, userId).QueryRow(&item)
  59. return
  60. }
  61. // 更新wxUser信息
  62. func (wxUser *WxUser) Update(cols []string) (err error) {
  63. o := orm.NewOrm()
  64. _, err = o.Update(wxUser, cols...)
  65. return
  66. }
  67. type PotentialUserItem struct {
  68. UserId int `description:"用户id"`
  69. RealName string `description:"姓名"`
  70. CountryCode string `description:"区号,86、852、886等"`
  71. Mobile string `description:"手机号"`
  72. Email string `description:"邮箱"`
  73. CreatedTime string `description:"注册时间"`
  74. ApplyMethod int `description:"0:未申请,1:已付费客户申请试用,2:非客户申请试用"`
  75. CompanyName string `description:"客户名称"`
  76. ViewTotal int `description:"累计阅读次数"`
  77. LastViewTime time.Time `json:"-" description:"最后一次阅读时间"`
  78. LastViewTimeStr string `description:"最后一次阅读时间"`
  79. FromType string `description:"report:研报,teleconference:电话会"`
  80. BusinessCardUrl string `description:"名片"`
  81. Source int `description:"来源,1:微信端,2:pc网页端,3:查研观向小程序,4:每日咨询,5:电话会"`
  82. IsDeal int `description:"是否标记处理,0是未处理,1是已处理"`
  83. }
  84. type PotentialUserListResp struct {
  85. List []*PotentialUserItem
  86. Paging *paging.PagingItem `description:"分页数据"`
  87. }
  88. // 联系人导入预览数据返回
  89. type ImportListResp struct {
  90. ValidUser []*WxUser `description:"有效客户数据"`
  91. RepeatUser []*WxUser `description:"重复客户数据"`
  92. }
  93. func GetPotentialUserListCount(condition string, pars []interface{}) (count int, err error) {
  94. o := orm.NewOrm()
  95. sql := `SELECT COUNT(1) AS count
  96. FROM wx_user AS a
  97. LEFT JOIN company AS b ON a.company_id = b.company_id
  98. LEFT JOIN user_record AS c ON a.user_id=c.user_id
  99. WHERE b.enabled = 1 AND b.company_id = 1
  100. AND (a.mobile IS NOT NULL || a.email IS NOT NULL)
  101. AND (a.mobile<>'' OR a.email<>'')
  102. AND (c.create_platform<>4 or c.create_platform is null)`
  103. if condition != "" {
  104. sql += condition
  105. }
  106. err = o.Raw(sql, pars).QueryRow(&count)
  107. return
  108. }
  109. func GetPotentialUserList(condition string, pars []interface{}, startSize, pageSize int) (items []*PotentialUserItem, err error) {
  110. o := orm.NewOrm()
  111. sql := `SELECT a.*,a.note AS company_name,
  112. IF(b.type IN (1,2),1,0) AS is_fee_customer,
  113. (SELECT count(1) FROM user_view_history AS uvh WHERE uvh.user_id=a.user_id GROUP BY a.user_id) AS view_total,
  114. a.report_last_view_time AS last_view_time_str,
  115. c.create_platform
  116. FROM wx_user AS a
  117. LEFT JOIN company AS b ON a.company_id = b.company_id
  118. LEFT JOIN user_record AS c ON a.user_id=c.user_id
  119. WHERE b.enabled = 1 AND b.company_id = 1
  120. AND (a.mobile IS NOT NULL || a.email IS NOT NULL)
  121. AND (a.mobile<>'' OR a.email<>'')
  122. AND (c.create_platform<>4 or c.create_platform is null) `
  123. if condition != "" {
  124. sql += condition
  125. }
  126. sql += ` GROUP BY a.user_id `
  127. sql += `ORDER BY a.created_time DESC LIMIT ?,? `
  128. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  129. return
  130. }
  131. type PotentialUserDeleteReq struct {
  132. UserId int `description:"用户id"`
  133. }
  134. // 标记潜在用户请求
  135. type PotentialUserDealReq struct {
  136. UserId int `description:"用户id"`
  137. }
  138. func DeletePotentialUser(userId int) (err error) {
  139. sql := ` DELETE FROM wx_user WHERE user_id=? `
  140. _, err = orm.NewOrm().Raw(sql, userId).Exec()
  141. return
  142. }
  143. // DeleteWxUserByUserIds 根据用户id字符串批量删除用户信息
  144. func DeleteWxUserByUserIds(userIds string) (err error) {
  145. sql := ` DELETE FROM wx_user WHERE user_id in (` + userIds + `) `
  146. _, err = orm.NewOrm().Raw(sql).Exec()
  147. return
  148. }
  149. // 移动潜在客户名下的联系人 请求数据
  150. type PotentialUserMoveReq struct {
  151. UserId int `description:"用户id"`
  152. CompanyId int `description:"移动到的客户id"`
  153. SellerId int `description:"需要移动到的销售id"`
  154. RealName string `description:"姓名"`
  155. Mobile string `description:"手机号"`
  156. Email string `description:"邮箱"`
  157. Remark string `description:"备注信息"`
  158. //crm4.0新增校验字段
  159. Sex int `description:"用户性别,1为男性,2为女性"`
  160. RegionType string `description:"区域,枚举值:国内、海外"`
  161. Position string `description:"职位"`
  162. IsMaker int `description:"是否决策人,1:是,0:否"`
  163. BusinessCardUrl string `description:"名片地址"`
  164. DepartmentName string `description:"联系人部门"`
  165. CountryCode string `description:"区号,86、852、886等"`
  166. }
  167. // 移动联系人请求数据
  168. type UserMoveReq struct {
  169. UserId int `description:"用户id"`
  170. CompanyId int `description:"移动到的客户id"`
  171. SellerId int `description:"需要移动到的销售id"`
  172. }
  173. // FICC申请单-移动潜在客户名下的联系人 请求数据
  174. type ApplyRecordPotentialUserMoveReq struct {
  175. UserId int `description:"用户id"`
  176. CompanyId int `description:"移动到的客户id"`
  177. SellerId int `description:"需要移动到的销售id"`
  178. RealName string `description:"姓名"`
  179. Mobile string `description:"手机号"`
  180. Email string `description:"邮箱"`
  181. Remark string `description:"备注信息"`
  182. ApplyRecordId int `description:"申请单ID"`
  183. Sex int `description:"用户性别,1为男性,2为女性"`
  184. RegionType string `description:"区域,枚举值:国内、海外"`
  185. Position string `description:"职位"`
  186. IsMaker int `description:"是否决策人,1:是,0:否"`
  187. BusinessCardUrl string `description:"名片地址"`
  188. DepartmentName string `description:"联系人部门"`
  189. CountryCode string `description:"区号,86、852、886等"`
  190. }
  191. func CheckUserMobileIsRegister(userId int, mobile string) (count int, err error) {
  192. sql := `SELECT COUNT(1) AS count FROM wx_user AS a
  193. INNER JOIN company AS b ON a.company_id = b.company_id
  194. WHERE a.mobile = ? AND a.user_id<> ? `
  195. o := orm.NewOrm()
  196. err = o.Raw(sql, mobile, userId).QueryRow(&count)
  197. return
  198. }
  199. func CheckUserEmailIsRegister(userId int, email string) (count int, err error) {
  200. sql := `SELECT COUNT(1) AS count FROM wx_user AS a
  201. INNER JOIN company AS b ON a.company_id = b.company_id
  202. WHERE a.email = ? AND a.user_id<> ? `
  203. o := orm.NewOrm()
  204. err = o.Raw(sql, email, userId).QueryRow(&count)
  205. return
  206. }
  207. // 移动潜在客户名下的联系人
  208. func MovePotentialUser(userId, companyId int, realName, mobile, email, remark string) (err error) {
  209. if realName != "" {
  210. sql := ` UPDATE wx_user
  211. SET
  212. company_id = ?,
  213. real_name = ?,
  214. mobile = ?,
  215. email = ?,
  216. remark = ?,
  217. last_updated_time = NOW(),
  218. is_note = 1
  219. WHERE user_id = ? `
  220. _, err = orm.NewOrm().Raw(sql, companyId, realName, mobile, email, remark, userId).Exec()
  221. } else {
  222. sql := ` UPDATE wx_user
  223. SET
  224. company_id = ?,
  225. mobile = ?,
  226. email = ?,
  227. remark = ?,
  228. last_updated_time = NOW(),
  229. is_note = 1
  230. WHERE user_id = ? `
  231. _, err = orm.NewOrm().Raw(sql, companyId, mobile, email, remark, userId).Exec()
  232. }
  233. return
  234. }
  235. // 移动联系人
  236. func MoveUser(userId, companyId int) (err error) {
  237. sql := ` UPDATE wx_user
  238. SET
  239. company_id = ?,
  240. last_updated_time = NOW(),
  241. is_note = 1
  242. WHERE user_id = ? `
  243. _, err = orm.NewOrm().Raw(sql, companyId, userId).Exec()
  244. return
  245. }
  246. type ReportViewRecordTotal struct {
  247. ViewTotal int
  248. LastViewTime time.Time
  249. }
  250. func GetReportViewMaxTime(uid int) (item *ReportViewRecordTotal, err error) {
  251. o := orm.NewOrmUsingDB("rddp")
  252. rddpSql := "SELECT MAX(create_time) AS last_view_time,COUNT(1) AS view_total FROM report_view_record WHERE user_id=? "
  253. err = o.Raw(rddpSql, uid).QueryRow(&item)
  254. return
  255. }
  256. // 根据用户id字符串获取用户的浏览数
  257. func GetReportViewMaxTimeByUserIds(userIds string) (items []*ReportViewRecord, err error) {
  258. o := orm.NewOrmUsingDB("rddp")
  259. rddpSql := `SELECT user_id,MAX(create_time) AS last_view_time,COUNT(1) AS view_total FROM report_view_record WHERE user_id in (` + userIds + `) group by user_id`
  260. _, err = o.Raw(rddpSql).QueryRows(&items)
  261. return
  262. }
  263. // 根据用户手机号字符串获取用户的浏览数
  264. type ReportViewMobileRecord struct {
  265. Mobile string
  266. ViewTotal int
  267. LastViewTime time.Time
  268. }
  269. func GetReportViewMaxTimeByMobiles(mobiles string) (items []*ReportViewMobileRecord, err error) {
  270. o := orm.NewOrmUsingDB("rddp")
  271. rddpSql := `SELECT mobile,MAX(create_time) AS last_view_time,COUNT(1) AS view_total FROM report_view_record WHERE mobile in (` + mobiles + `) group by mobile`
  272. _, err = o.Raw(rddpSql).QueryRows(&items)
  273. return
  274. }
  275. // 根据用户邮箱字符串获取用户的浏览数
  276. type ReportViewEmailRecord struct {
  277. Email string
  278. ViewTotal int
  279. LastViewTime time.Time
  280. }
  281. func GetReportViewMaxTimeByEmails(emails string) (items []*ReportViewEmailRecord, err error) {
  282. o := orm.NewOrmUsingDB("rddp")
  283. rddpSql := `SELECT email,MAX(create_time) AS last_view_time,COUNT(1) AS view_total FROM report_view_record WHERE email in (` + emails + `) group by email`
  284. _, err = o.Raw(rddpSql).QueryRows(&items)
  285. return
  286. }
  287. func GetPotentialUserListExport(condition string, pars []interface{}) (items []*PotentialUserItem, err error) {
  288. o := orm.NewOrm()
  289. sql := `SELECT DISTINCT a.*,b.company_name,
  290. IF(b.type IN (1,2),1,0) AS is_fee_customer,
  291. (SELECT count(1) FROM user_view_history AS uvh WHERE uvh.user_id=a.user_id GROUP BY a.user_id) AS view_total,
  292. (SELECT max(uvh.created_time) FROM user_view_history AS uvh WHERE uvh.user_id=a.user_id GROUP BY a.user_id) AS last_view_time
  293. FROM wx_user AS a
  294. LEFT JOIN company AS b ON a.company_id = b.company_id
  295. INNER JOIN user_record AS c ON a.user_id=c.user_id
  296. WHERE b.enabled = 1 AND b.company_id = 1
  297. AND (a.mobile IS NOT NULL || a.email IS NOT NULL)
  298. AND (a.mobile<>'' OR a.email<>'')
  299. AND c.create_platform<>4 `
  300. if condition != "" {
  301. sql += condition
  302. }
  303. sql += `ORDER BY a.last_updated_time DESC `
  304. _, err = o.Raw(sql, pars).QueryRows(&items)
  305. return
  306. }
  307. type WxUserDetail struct {
  308. UserId int64 `orm:"column(user_id);pk"`
  309. CountryCode string `description:"区号,86、852、886等"`
  310. Mobile string
  311. Email string
  312. CompanyId int
  313. RealName string `description:"姓名"`
  314. CreatedTime time.Time
  315. MobileTwo string `description:"备用手机号"`
  316. BusinessCardUrl string `description:"名片"`
  317. IsMaker int `description:"是否决策人,1:是,0:否"`
  318. Position string `description:"职位"`
  319. Sex int `description:"普通用户性别,1为男性,2为女性"`
  320. CompanyName string `description:"公司名称"`
  321. DepartmentName string `description:"联系人部门"`
  322. SellerRealName string `description:"销售"`
  323. }
  324. // GetWxUserListByUserIds 根据用户ID集合获取用户
  325. func GetWxUserListByUserIds(userIds string) (list []*WxUser, err error) {
  326. o := orm.NewOrm()
  327. sql := ` SELECT * FROM wx_user WHERE user_id IN (` + userIds + `) `
  328. _, err = o.Raw(sql).QueryRows(&list)
  329. return
  330. }
  331. // GetWxUserByCompanyIdAndMobile 根据客户ID及手机号获取用户
  332. func GetWxUserByCompanyIdAndMobile(companyId int, mobile string) (item *WxUser, err error) {
  333. o := orm.NewOrm()
  334. sql := ` SELECT * FROM wx_user WHERE company_id = ? AND mobile = ? LIMIT 1 `
  335. err = o.Raw(sql, companyId, mobile).QueryRow(&item)
  336. return
  337. }
  338. // DeleteWxUserAndRecordByUserId 删除用户及第三方信息
  339. func DeleteWxUserAndRecordByUserId(userId int) (err error) {
  340. o := orm.NewOrm()
  341. to, err := o.Begin()
  342. if err != nil {
  343. return
  344. }
  345. defer func() {
  346. if err != nil {
  347. _ = to.Rollback()
  348. } else {
  349. _ = to.Commit()
  350. }
  351. }()
  352. // 删除wx_user
  353. userSql := ` DELETE FROM wx_user WHERE user_id = ? LIMIT 1 `
  354. _, err = to.Raw(userSql, userId).Exec()
  355. // 删除user_record
  356. if err == nil {
  357. recordSql := ` DELETE FROM user_record WHERE user_id = ? `
  358. _, err = to.Raw(recordSql, userId).Exec()
  359. }
  360. return
  361. }
  362. // 获取这个公司下面所有用户的手机号
  363. func GetCompanyUserMobilesByCompanyId(companyId int) (mobiles string, err error) {
  364. o := orm.NewOrm()
  365. sql := ` SELECT GROUP_CONCAT( DISTINCT a.mobile SEPARATOR ',' ) AS mobiles FROM
  366. wx_user AS a WHERE company_id = ? AND mobile != '' `
  367. err = o.Raw(sql, companyId).QueryRow(&mobiles)
  368. return
  369. }
  370. // 获取这个公司下面所有用户的邮箱号
  371. func GetCompanyUserEmailsByCompanyId(companyId int) (emails string, err error) {
  372. o := orm.NewOrm()
  373. sql := ` SELECT GROUP_CONCAT( DISTINCT a.email SEPARATOR ',' ) AS emails FROM
  374. wx_user AS a WHERE company_id = ? AND email != '' `
  375. err = o.Raw(sql, companyId).QueryRow(&emails)
  376. return
  377. }
  378. // 获取这个公司下面所有用户的手机号
  379. func SetUserSubscribe(openId string) (err error) {
  380. o := orm.NewOrm()
  381. sql := ` UPDATE user_record SET subscribe=1,subscribe_time=NOW() WHERE open_id=? `
  382. _, err = o.Raw(sql, openId).Exec()
  383. return
  384. }
  385. type WxUserItem struct {
  386. UserId int `description:"用户id"`
  387. OpenId string `description:"open_id"`
  388. UnionId string `description:"union_id"`
  389. CompanyId int `description:"客户id"`
  390. NickName string `description:"用户昵称"`
  391. RealName string `description:"用户实际名称"`
  392. Mobile string `description:"手机号码"`
  393. BindAccount string `description:"绑定时的账号"`
  394. Email string `description:"邮箱"`
  395. Headimgurl string `description:"用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空"`
  396. ApplyMethod int `description:"0:未申请,1:已付费客户申请试用,2:非客户申请试用"`
  397. FirstLogin int `description:"是否第一次登陆"`
  398. IsFreeLogin int `description:"是否免登陆,true:免登陆,false:非免登陆"`
  399. LoginTime time.Time `description:"登录时间"`
  400. CreatedTime time.Time `description:"创建时间"`
  401. LastUpdatedTime time.Time `description:"最近一次修改时间"`
  402. SessionKey string `description:"微信小程序会话密钥"`
  403. CompanyName string `description:"公司名称"`
  404. IsRegister int `description:"是否注册:1:已注册,0:未注册"`
  405. CountryCode string `description:"手机国家区号"`
  406. OutboundMobile string `description:"外呼手机号"`
  407. OutboundCountryCode string `description:"外呼手机号区号"`
  408. IsMsgOutboundMobile int `description:"是否弹窗过绑定外呼手机号区号"`
  409. IsMaker int `description:"是否是决策人"`
  410. Source int
  411. }
  412. // GetWxUserListByUserIds 根据用户ID集合获取用户有公司名称
  413. func GetWxUserListByUserIdsHaveCompany(userIds string) (list []*WxUserItem, err error) {
  414. o := orm.NewOrm()
  415. sql := ` SELECT u.*, c.company_name FROM wx_user AS u
  416. INNER JOIN company AS c ON c.company_id = u.company_id
  417. WHERE user_id IN (` + userIds + `) `
  418. _, err = o.Raw(sql).QueryRows(&list)
  419. return
  420. }
  421. // GetWxUserByAdminId 通过后台用户ID及微信平台获取对应的微信用户
  422. func GetWxUserByAdminId(platform, adminId int) (item *WxUser, err error) {
  423. o := orm.NewOrm()
  424. sql := `SELECT
  425. wu.user_id
  426. FROM
  427. wx_user AS wu
  428. JOIN user_record AS ur ON wu.user_id = ur.user_id AND ur.create_platform = ?
  429. JOIN admin AS ad ON wu.mobile = ad.mobile
  430. WHERE
  431. ad.admin_id = ?`
  432. err = o.Raw(sql, platform, adminId).QueryRow(&item)
  433. return
  434. }
  435. // GetWxUserByOutboundMobiles 根据用户手机号获取用户详情
  436. func GetWxUserByOutboundMobiles(mobiles []string) (items []*WxUser, err error) {
  437. lenmobiles := len(mobiles)
  438. if lenmobiles == 0 {
  439. return
  440. }
  441. sql := `SELECT* FROM wx_user WHERE outbound_mobile in (` + utils.GetOrmInReplace(lenmobiles) + `) `
  442. o := orm.NewOrm()
  443. _, err = o.Raw(sql, mobiles).QueryRows(&items)
  444. return
  445. }
  446. // GetWxUserByUserIds 根据用户ID获取用户详情
  447. func GetWxUserByUserIds(userIds []int) (items []*WxUser, err error) {
  448. lenuserIds := len(userIds)
  449. if lenuserIds == 0 {
  450. return
  451. }
  452. sql := `SELECT* FROM wx_user WHERE user_id in (` + utils.GetOrmInReplace(lenuserIds) + `) `
  453. o := orm.NewOrm()
  454. _, err = o.Raw(sql, userIds).QueryRows(&items)
  455. return
  456. }
  457. // GetWxUserListByUserMobileHaveCompany 根据用户手机号集合获取用户有公司名称
  458. func GetWxUserListByUserMobileHaveCompany(mobiles []string) (list []*WxUserItem, err error) {
  459. lenmobiles := len(mobiles)
  460. if lenmobiles == 0 {
  461. return
  462. }
  463. o := orm.NewOrm()
  464. sql := ` SELECT u.*, c.company_name FROM wx_user AS u
  465. INNER JOIN company AS c ON c.company_id = u.company_id
  466. WHERE mobile in (` + utils.GetOrmInReplace(lenmobiles) + `) `
  467. _, err = o.Raw(sql, mobiles).QueryRows(&list)
  468. return
  469. }
  470. // GetWxUserListCompanyId 根据公司ID获取所有用户信息
  471. func GetWxUserListCompanyId(companyId int) (list []*WxUserItem, err error) {
  472. o := orm.NewOrm()
  473. sql := ` SELECT* FROM wx_user WHERE company_id = ? `
  474. _, err = o.Raw(sql, companyId).QueryRows(&list)
  475. return
  476. }