activity_special_trip_bill.go 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxActivitySpecialTripBill struct {
  7. Id int `orm:"column(id);pk"`
  8. UserId int `description:"用户id,多个用,隔开"`
  9. ActivityId int `description:"活动ID"`
  10. CreateTime time.Time `description:"创建时间"`
  11. Mobile string `description:"手机号"`
  12. Email string `description:"邮箱号"`
  13. CompanyId int `description:"公司ID"`
  14. CompanyName string `description:"公司名称"`
  15. RealName string `description:"用户实际名称"`
  16. AdminId int `description:"销售/管理员ID"`
  17. Source int `description:"来源,1小程序,2后台添加, 3开发人员手动添加"`
  18. BillDetailed int `description:"流水明细,判断是进账还是出账"`
  19. DoType int `description:"操作方式,1报名,2取消报名"`
  20. RegisterPlatform int `description:"来源 1小程序,2:网页"`
  21. ChartPermissionId int `description:"行业id"`
  22. ChartPermissionName string `description:"行业名称"`
  23. Way int `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"`
  24. Content string `description:"内容"`
  25. Total string `description:"总和"`
  26. }
  27. // 添加
  28. func AddCygxActivitySpecialTripBill(item *CygxActivitySpecialTripBill) (err error) {
  29. o := orm.NewOrm()
  30. _, err = o.Insert(item)
  31. if err != nil {
  32. return
  33. }
  34. return
  35. }
  36. func GetCygxActivitySpecialTripBill(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBill, err error) {
  37. o := orm.NewOrm()
  38. sql := `SELECT *
  39. FROM
  40. cygx_activity_special_trip_bill
  41. WHERE 1 = 1 ` + condition
  42. _, err = o.Raw(sql, pars).QueryRows(&item)
  43. return
  44. }
  45. type CygxActivitySpecialTripBillList struct {
  46. Id int `orm:"column(id);pk"`
  47. UserId int `description:"用户id,多个用,隔开"`
  48. ActivityId int `description:"活动ID"`
  49. CreateTime time.Time `description:"创建时间"`
  50. Mobile string `description:"手机号"`
  51. Email string `description:"邮箱号"`
  52. CompanyId int `description:"公司ID"`
  53. CompanyName string `description:"公司名称"`
  54. RealName string `description:"用户实际名称"`
  55. AdminId int `description:"销售/管理员ID"`
  56. Source int `description:"来源,1小程序,2后台添加, 3开发人员手动添加"`
  57. BillDetailed int `description:"流水明细,判断是进账还是出账"`
  58. DoType int `description:"操作方式,1报名,2取消报名"`
  59. RegisterPlatform int `description:"来源 1小程序,2:网页"`
  60. ChartPermissionId int `description:"行业id"`
  61. ChartPermissionName string `description:"行业名称"`
  62. Way int `description:"1报名,取消报名。2到会取消到会 3转正或清零 4取消活动"`
  63. Content string `description:"内容"`
  64. }
  65. func GetCygxActivitySpecialTripBillList(condition string, pars []interface{}) (item []*CygxActivitySpecialTripBillList, err error) {
  66. o := orm.NewOrm()
  67. sql := `SELECT
  68. b.*
  69. FROM
  70. cygx_activity_special_trip_bill AS b
  71. WHERE
  72. 1 = 1` + condition
  73. _, err = o.Raw(sql, pars).QueryRows(&item)
  74. return
  75. }
  76. // GetCygxActivitySpecialTripBillLastDetialByActivityId 根据活动ID获取最后一条扣点明细
  77. func GetCygxActivitySpecialTripBillLastDetialByActivityId(activityId, userId int) (item *CygxActivitySpecialTripBill, err error) {
  78. o := orm.NewOrm()
  79. sql := `SELECT *
  80. FROM
  81. cygx_activity_special_trip_bill
  82. WHERE 1 = 1 AND activity_id =? AND user_id = ? ORDER BY id DESC LIMIT 1 `
  83. err = o.Raw(sql, activityId, userId).QueryRow(&item)
  84. return
  85. }