互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
2.0 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package models
  2. import (
  3. "fmt"
  4. "time"
  5. "github.com/ouxuanserver/osmanthuswine/src/core"
  6. )
  7. const CustomerOrderOptionTableName = TableNamePrefix + "customer_order_option"
  8. type CustomerOrderOption struct {
  9. Id int `json:"id" xorm:"not null pk INT(11)"`
  10. IsDelete int `json:"-" xorm:"not null default 0 comment('删除') TINYINT(1)"`
  11. CreatedAt time.Time `json:"-" xorm:"created"`
  12. UpdatedAt time.Time `json:"-" xorm:"updated"`
  13. ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
  14. SettingBox string `json:"setting_box" xorm:"not null comment('json格式 选中的表单项') TEXT"`
  15. SelfBox string `json:"self_box" xorm:"not null comment('json格式 邀请函选中的表单项') TEXT"`
  16. Status int `json:"status" xorm:"not null default 0 comment('订单活动的开启1|关闭0') TINYINT(1)"`
  17. PostFeeType int `json:"post_fee_type" xorm:"not null default 0 comment('直播订单运费设置0包邮1货到付款2收费') TINYINT(1)"`
  18. PostFee float64 `json:"post_fee" xorm:"not null default 0.00 comment('直播订单运费') DECIMAL(18)"`
  19. MainServicePhone string `json:"main_service_phone" xorm:"not null default '' comment('客服电话') VARCHAR(128)"`
  20. }
  21. func (t *CustomerOrderOption) TableName() string {
  22. return CustomerOrderOptionTableName
  23. }
  24. func (t *CustomerOrderOption) AliasName(n string) string {
  25. return fmt.Sprintf("%s as %s", t.TableName(), n)
  26. }
  27. func (t *CustomerOrderOption) GetByActivityId(aid int) (bool, error) {
  28. return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t)
  29. }
  30. func (t *CustomerOrderOption) GetOpen(aid int) (bool, error) {
  31. return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, 1).
  32. Desc("created_at").Get(t)
  33. }
  34. func (t *CustomerOrderOption) Switch(aid int, status int) (int64, error) {
  35. t.Status = status
  36. return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Cols("status").Update(t)
  37. }