user_trial_apply.go 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "github.com/rdlucklib/rdluck_tools/paging"
  5. "time"
  6. //"time"
  7. )
  8. type UserTrialApply struct {
  9. Id uint `orm:"column(id);pk;auto"`
  10. CompanyName string `orm:"size(255)";description:"企业名称"`
  11. RealName string `orm:"size(64)";description:"联系人姓名"`
  12. Phone string `orm:"size(20)";description:"手机号联系方式"`
  13. Email string `orm:"size(64)";description:"邮箱"`
  14. Industry string `orm:"size(20)";description:"所属行业:'公募基金','私募基金','券商资管','保险','海外','生产商','贸易商','下游用户','其他金融机构'";default:"公募基金"`
  15. ProductInfo string `orm:"size(255)";description:"申请使用的产品,多值,用,隔开"`
  16. Message string `orm:"size(255)";description:"留言信息"`
  17. SourceIp string `orm:"size(20)";description:"来源ip"`
  18. SourceType string `orm:"size(20)";description:"来源,枚举值:'中文官网','英文官网'";default:"中文官网"`
  19. Status string `description:"状态,枚举值:'待处理','已处理'";orm:"size(16)";default:"待处理"`
  20. OpUserId uint `description:"操作用户id"`
  21. OpUserName string `orm:"size(64)";description:"操作用户名称"`
  22. CreateTime time.Time `description:"申请时间"`
  23. ModifyTime time.Time `description:"修改时间"`
  24. }
  25. type UserTrialApplyItem struct {
  26. Id uint `orm:"column(id);pk;auto"`
  27. CompanyName string `orm:"size(255)";description:"企业名称"`
  28. RealName string `orm:"size(64)";description:"联系人姓名"`
  29. Phone string `orm:"size(20)";description:"手机号联系方式"`
  30. Email string `orm:"size(64)";description:"邮箱"`
  31. Industry string `orm:"size(20)";description:"所属行业:'公募基金','私募基金','券商资管','保险','海外','生产商','贸易商','下游用户','其他金融机构'";default:"公募基金"`
  32. ProductInfo string `orm:"size(255)";description:"申请使用的产品,多值,用,隔开"`
  33. Message string `orm:"size(255)";description:"留言信息"`
  34. SourceIp string `orm:"size(20)";description:"来源ip"`
  35. SourceType string `orm:"size(20)";description:"来源,枚举值:'中文官网','英文官网'";default:"中文官网"`
  36. Status string `description:"状态,枚举值:'待处理','已处理'";orm:"size(16)";default:"待处理"`
  37. OpUserId uint `description:"操作用户id"`
  38. OpUserName string `orm:"size(64)";description:"操作用户名称"`
  39. CreateTime time.Time `description:"申请时间"`
  40. CreateTimeStr string `description:"申请时间字符串"`
  41. ModifyTime time.Time `description:"修改时间"`
  42. ModifyTimeStr string `description:"申请时间字符串"`
  43. }
  44. //列表数据
  45. type UserTrialApplyListResp struct {
  46. List []*UserTrialApplyItem
  47. Paging *paging.PagingItem `description:"分页数据"`
  48. }
  49. //确认申请
  50. type UserTrialApplyConfirmReq struct {
  51. Id int `description:"Id"`
  52. }
  53. //获取获取官网申请列表页数据的数据数
  54. func GetOfficialApplyUserListListCount(condition string, pars []interface{}) (count int, err error) {
  55. o := orm.NewOrm()
  56. sql := `SELECT
  57. COUNT(id ) AS COUNT
  58. FROM user_trial_apply `
  59. if condition != "" {
  60. sql += " WHERE " + condition
  61. }
  62. err = o.Raw(sql, pars).QueryRow(&count)
  63. return
  64. }
  65. //获取官网申请列表页数据
  66. func GetOfficialApplyUserListList(condition string, pars []interface{}, startSize, pageSize int) (items []*UserTrialApplyItem, err error) {
  67. o := orm.NewOrm()
  68. sql := `SELECT * from user_trial_apply `
  69. if condition != "" {
  70. sql += " WHERE " + condition
  71. }
  72. sql += `ORDER BY id DESC LIMIT ?,? `
  73. _, err = o.Raw(sql, pars, startSize, pageSize).QueryRows(&items)
  74. return
  75. }
  76. // GetOfficialApplyUserListListExport 导出官网申请试用列表
  77. func GetOfficialApplyUserListListExport(condition string, pars []interface{}) (items []*UserTrialApplyItem, err error) {
  78. o := orm.NewOrm()
  79. sql := `SELECT * from user_trial_apply `
  80. if condition != "" {
  81. sql += " WHERE " + condition
  82. }
  83. sql += `ORDER BY id DESC`
  84. _, err = o.Raw(sql, pars).QueryRows(&items)
  85. return
  86. }
  87. //获取申请记录信息
  88. func GetOfficialApplyUserById(id int) (item *UserTrialApply, err error) {
  89. o := orm.NewOrm()
  90. err = o.Raw(`SELECT * from user_trial_apply where id = ?`, id).QueryRow(&item)
  91. return
  92. }
  93. //确认申请记录
  94. func ConfirmOfficialApplyUser(id int, opUserId int, opUserName string) (err error) {
  95. sql := ` UPDATE user_trial_apply
  96. SET
  97. status = ?,
  98. op_user_id = ?,
  99. op_user_name = ?,
  100. modify_time = ?
  101. WHERE id = ? `
  102. _, err = orm.NewOrm().Raw(sql, "已处理", opUserId, opUserName, time.Now(), id).Exec()
  103. return
  104. }