互动
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.

56 lines
3.7 KiB

5 years ago
5 years ago
5 years ago
  1. package models
  2. import (
  3. "time"
  4. "github.com/ouxuanserver/osmanthuswine/src/core"
  5. )
  6. const ActivityModuleServiceTableName = TableNamePrefix + "activity_module_service"
  7. //活动模块服务
  8. type ActivityModuleService struct {
  9. Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
  10. ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id') INT(11)"`
  11. ServiceModuleHistoryId int64 `json:"service_module_history_id" xorm:"not null comment('service_module_history表id') INT(11)"`
  12. ServiceModuleName string `json:"service_module_name" xorm:"-" description:"模块服务名字"`
  13. ServiceModuleStatus string `json:"service_module_status" xorm:"not null default('关闭') comment('服务模块 免费开启。付费默认关闭。') VARCHAR(128)"`
  14. PhoneBgUrl string `json:"phone_bg_url" xorm:"not null default('') comment('服务模块的自定义手机屏的图片') VARCHAR(255)"`
  15. PhoneBgSwitch string `json:"phone_bg_switch" xorm:"not null default('关闭') comment('模块手机的开关 开启|关闭') VARCHAR(11)"`
  16. MaxBgUrl string `json:"max_bg_url" xorm:"not null default('') comment('服务模块的自定义大屏的图片') VARCHAR(255)"`
  17. MaxBgSwitch string `json:"max_bg_switch" xorm:"not null default('关闭') comment('模块大屏的开关 开启|关闭') VARCHAR(11)"`
  18. ModuleStyleId int64 `json:"module_style_id" xorm:"not null default(0) comment('每个模块对应的一个样式id 如果有的话') INT(11)"`
  19. BesideRepeat string `json:"beside_repeat" xorm:"not null default('不去除') comment('是否去除重复') VARCHAR(11)"`
  20. ServiceModuleStartTime time.Time `json:"service_module_start_time" xorm:"not null default('1970-01-01 08:00:00') comment('服务开始时间') DATETIME"`
  21. ServiceModuleEndTime time.Time `json:"service_module_end_time" xorm:"not null default('1970-01-01 08:00:00') comment('服务结束时间') DATETIME"`
  22. MoreAreaMode string `json:"more_area_mode" xorm:"not null default('关闭') comment('多地区模式录入人员用到') VARCHAR(11)"`
  23. OrderDrawStatus string `json:"order_draw_status" xorm:"not null default('关闭') comment('订单抽奖开关[开启|关闭]') VARCHAR(11)"`
  24. IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
  25. CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME" description:"创建时间"`
  26. UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME" description:"更新时间"`
  27. }
  28. /**
  29. * 获取手机和大屏的背景图
  30. * 通过主活动的id定位activity_module_service的所有service_module_history_id
  31. * 所有service_module_history_id in module_service_history并且 模块名=module_service_history.name
  32. * 通过定位出来的activity_module_service检查是否手机和大屏的背景图状态开启则从ui_base获取否则直接从activity_module_service
  33. */
  34. func (t *ActivityModuleService) TableName() string {
  35. return ActivityModuleServiceTableName
  36. }
  37. func (t *ActivityModuleService) Alias(name string) string {
  38. return AliasTableName(t, name)
  39. }
  40. //
  41. //func (t *ActivityModuleService) GetByActivityIdAndHistoryId(aid, hid int64) (bool, error) {
  42. // return core.GetXormAuto().Where("is_delete=0 and activity_id=? and service_module_history_id=?", aid, hid).Get(t)
  43. //}
  44. func (t *ActivityModuleService) GetByActivityIdAndHistoryIds(activityId, historyIds interface{}) (bool, error) {
  45. return core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).
  46. In("service_module_history_id", historyIds).Get(t)
  47. }