user_trial_apply.go 5.3 KB

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