wx_user_move_log.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package company
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "hongze/hz_crm_api/utils"
  5. "time"
  6. )
  7. // WxUserOpLog 联系人操作日志表
  8. type WxUserMoveLog struct {
  9. Id int `orm:"column(id);pk"`
  10. UserId int `description:"联系人id"`
  11. RealName string `description:"联系人姓名"`
  12. Mobile string `description:"当前手机号"`
  13. Email string `description:"当前邮箱"`
  14. CompanyId int `description:"当前客户id"`
  15. CompanyName string `description:"当前客户名称"`
  16. SysUserId int `description:"操作人ID"`
  17. SysUserRealName string `description:"操作人姓名"`
  18. CompanyIdMove int `description:"移动后客户id"`
  19. CompanyNameMove string `description:"移动后客户名称"`
  20. CreateTime time.Time `description:"日志创建时间"`
  21. }
  22. // AddWxUserOpLog 联系人移动日志记录
  23. func AddWxUserMoveLog(item *WxUserMoveLog) (err error) {
  24. o := orm.NewOrm()
  25. _, err = o.Insert(item)
  26. return
  27. }
  28. // 列表
  29. func GetWxUserMoveLogListmByMobiles(mobiles []string) (items []*WxUserMoveLog, err error) {
  30. lenarr := len(mobiles)
  31. if lenarr == 0 {
  32. return
  33. }
  34. o := orm.NewOrm()
  35. sql := `SELECT mobile FROM wx_user_move_log WHERE mobile IN (` + utils.GetOrmInReplace(lenarr) + `) GROUP BY mobile `
  36. _, err = o.Raw(sql, mobiles).QueryRows(&items)
  37. return
  38. }
  39. // 列表
  40. func GetWxUserMoveLogListmByMobile(mobile string) (items []*WxUserMoveLog, err error) {
  41. o := orm.NewOrm()
  42. sql := `SELECT * FROM wx_user_move_log WHERE mobile = ? ORDER BY id ASC `
  43. _, err = o.Raw(sql, mobile).QueryRows(&items)
  44. return
  45. }
  46. type WxUserMoveLogResp struct {
  47. UserName string `description:"联系人姓名"`
  48. Mobile string `description:"手机号"`
  49. Email string `description:"邮箱地址"`
  50. CompanyId int `description:"当前客户id"`
  51. CompanyName string `description:"当前客户名称"`
  52. CompanyIdMove int `description:"移动后客户id"`
  53. CompanyNameMove string `description:"移动后客户名称"`
  54. CreateTime string `description:"日志创建时间"`
  55. }
  56. type WxUserMoveLogListResp struct {
  57. List []*WxUserMoveLogResp
  58. }