product_interior_history.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. package models
  2. import (
  3. "github.com/beego/beego/v2/client/orm"
  4. "time"
  5. )
  6. type CygxProductInteriorHistory struct {
  7. Id int `orm:"column(id);pk"`
  8. ProductInteriorId int
  9. UserId int
  10. CreateTime time.Time
  11. Mobile string `description:"手机号"`
  12. Email string `description:"邮箱"`
  13. CompanyId int `description:"公司id"`
  14. CompanyName string `description:"公司名称"`
  15. ModifyTime time.Time `description:"修改时间"`
  16. RealName string `description:"用户实际名称"`
  17. SellerName string `description:"所属销售"`
  18. RegisterPlatform int `description:"来源 1小程序,2:网页"`
  19. }
  20. // 添加历史信息
  21. func AddCygxProductInteriorHistory(item *CygxProductInteriorHistory) (lastId int64, err error) {
  22. o := orm.NewOrm()
  23. item.ModifyTime = time.Now()
  24. lastId, err = o.Insert(item)
  25. return
  26. }
  27. //
  28. //// 列表
  29. //func GetCygxProductInteriorHistoryList(condition string, pars []interface{}) (items []*CygxProductInteriorHistory, err error) {
  30. // o := orm.NewOrm()
  31. // sql := `SELECT * FROM cygx_product_interior_history as art WHERE 1= 1 `
  32. // if condition != "" {
  33. // sql += condition
  34. // }
  35. // _, err = o.Raw(sql, pars).QueryRows(&items)
  36. // return
  37. //}
  38. //
  39. //
  40. type ListProductInteriorPvUvResp struct {
  41. ProductInteriorId int `description:"文章ID"`
  42. Pv int `description:"pv"`
  43. Uv int `description:"pv"`
  44. }
  45. // 列表
  46. func GetCygxProductInteriorHistoryList(condition string, pars []interface{}) (items []*ListProductInteriorPvUvResp, err error) {
  47. o := orm.NewOrm()
  48. sql := `SELECT
  49. COUNT( 1 ) AS pv,
  50. product_interior_id
  51. FROM
  52. cygx_product_interior_history WHERE 1 = 1 `
  53. if condition != "" {
  54. sql += condition
  55. }
  56. sql += ` GROUP BY product_interior_id `
  57. _, err = o.Raw(sql, pars).QueryRows(&items)
  58. return
  59. }