Browse Source

fix:bug

token_replace
黄梓健 5 years ago
parent
commit
fa021089ce
  1. 7
      controllers/author.go
  2. 4
      controllers/base.go
  3. 4
      controllers/client/activity.go
  4. 8
      controllers/client/auction.go
  5. 4
      controllers/client/barrage.go
  6. 10
      controllers/client/bully_screen.go
  7. 4
      controllers/client/calorie.go
  8. 29
      controllers/client/good.go
  9. 6
      controllers/client/invite_envelope.go
  10. 25
      controllers/client/live.go
  11. 13
      controllers/client/login.go
  12. 18
      controllers/client/lottery.go
  13. 38
      controllers/client/order_entry.go
  14. 6
      controllers/client/reward.go
  15. 8
      controllers/client/shake_red_envelope.go
  16. 22
      controllers/client/sign.go
  17. 10
      controllers/client/tug_war.go
  18. 4
      controllers/client/upper_wall.go
  19. 13
      controllers/client/vote.go
  20. 2
      controllers/common/im.go
  21. 3
      controllers/common/wechat_oauth.go
  22. 6
      controllers/pc/activity.go
  23. 2
      controllers/pc/area_store.go
  24. 26
      controllers/pc/auction.go
  25. 6
      controllers/pc/barrage.go
  26. 14
      controllers/pc/bully_screen.go
  27. 16
      controllers/pc/calorie.go
  28. 4
      controllers/pc/login.go
  29. 38
      controllers/pc/lottery_draw.go
  30. 53
      controllers/pc/order_draw.go
  31. 12
      controllers/pc/reward.go
  32. 27
      controllers/pc/shake_red_envelope.go
  33. 12
      controllers/pc/sign.go
  34. 22
      controllers/pc/tug_war.go
  35. 12
      controllers/pc/upper_wall.go
  36. 21
      controllers/pc/vote.go
  37. 4
      controllers/pc/ws.go
  38. 5
      hdws/ws/client.go
  39. 12
      hdws/ws/jwt_go.go
  40. 2
      hdws/ws/message.go
  41. 6
      hdws/ws/timer.go
  42. 12
      libs/jwt/jwt_go.go
  43. 5
      libs/qq/qq.go
  44. 7
      libs/wx/wx.go
  45. 15
      models/CalorieUser.go
  46. 6
      models/activity.go
  47. 10
      models/activity_module_service.go
  48. 3
      models/arch.go
  49. 12
      models/area_store.go
  50. 4
      models/auction_activity.go
  51. 4
      models/auction_deal.go
  52. 22
      models/auction_history.go
  53. 13
      models/auction_player.go
  54. 19
      models/auction_result_record.go
  55. 10
      models/auction_rule.go
  56. 6
      models/bahe_activity.go
  57. 6
      models/bahe_history.go
  58. 8
      models/bahe_rule.go
  59. 13
      models/bahe_team.go
  60. 12
      models/bahe_team_member.go
  61. 6
      models/barrage_history.go
  62. 5
      models/base.go
  63. 23
      models/bully_screen_history.go
  64. 9
      models/bully_screen_server.go
  65. 9
      models/bully_screen_wallet.go
  66. 8
      models/bully_screen_wallet_hisotry.go
  67. 15
      models/calorie.go
  68. 17
      models/customer.go
  69. 11
      models/customer_goods.go
  70. 18
      models/customer_operation.go
  71. 24
      models/customer_order.go
  72. 13
      models/customer_order_option.go
  73. 9
      models/customer_order_sub.go
  74. 9
      models/dan_mu_server.go
  75. 6
      models/invitation.go
  76. 10
      models/invitation_letter.go
  77. 9
      models/live_config.go
  78. 9
      models/live_config_area.go
  79. 10
      models/live_red_envelope_rule.go
  80. 13
      models/live_viewer.go
  81. 13
      models/lottery_draw_activity.go
  82. 4
      models/lottery_draw_envelope_wallet.go
  83. 27
      models/lottery_draw_record.go
  84. 17
      models/lottery_draw_rule.go
  85. 9
      models/lottery_draw_rule_ladder.go
  86. 4
      models/lottery_draw_wallet_history.go
  87. 8
      models/lottery_draw_winner.go
  88. 2
      models/module_service.go
  89. 10
      models/module_service_history.go
  90. 4
      models/module_style.go
  91. 6
      models/msg_wall_server.go
  92. 22
      models/new_auction_activity.go
  93. 19
      models/new_vote_activity.go
  94. 19
      models/new_vote_activity_history.go
  95. 13
      models/new_vote_activity_ladder.go
  96. 13
      models/order_draw_activity.go
  97. 18
      models/order_draw_record.go
  98. 13
      models/order_draw_rule.go
  99. 9
      models/order_draw_rule_ladder.go
  100. 2
      models/order_draw_style.go

7
controllers/author.go

@ -1,10 +1,11 @@
package controllers package controllers
import ( import (
jwt2 "github.com/dgrijalva/jwt-go"
"hudongzhuanjia/libs/jwt" "hudongzhuanjia/libs/jwt"
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
jwt2 "github.com/dgrijalva/jwt-go"
) )
//执行路由方法前校验登陆态,并且解析page、pageSize //执行路由方法前校验登陆态,并且解析page、pageSize
@ -15,7 +16,7 @@ type AuthorCtl struct {
func (t *AuthorCtl) Prepare() { func (t *AuthorCtl) Prepare() {
t.BaseCtl.Prepare() t.BaseCtl.Prepare()
skip, _ := t.GetInt64("skip")
skip, _ := t.GetInt("skip")
if skip != 0 { if skip != 0 {
t.claims = &jwt.Claims{ t.claims = &jwt.Claims{
AccountType: "customer", AccountType: "customer",
@ -52,7 +53,7 @@ func (t *AuthorCtl) Prepare() {
} }
} }
func (t *AuthorCtl) GetAccountId() int64 {
func (t *AuthorCtl) GetAccountId() int {
return t.claims.AccountId return t.claims.AccountId
} }

4
controllers/base.go

@ -2,13 +2,14 @@ package controllers
import ( import (
"fmt" "fmt"
"go.uber.org/zap"
"hudongzhuanjia/logger" "hudongzhuanjia/logger"
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"net/http" "net/http"
"strconv" "strconv"
"go.uber.org/zap"
"github.com/ouxuanserver/osmanthuswine/src/core" "github.com/ouxuanserver/osmanthuswine/src/core"
) )
@ -72,7 +73,6 @@ func (t *BaseCtl) GetInt64(key string) (int64, bool) {
} }
value, err := strconv.ParseInt(v, 10, 64) value, err := strconv.ParseInt(v, 10, 64)
if err != nil { if err != nil {
logger.Error("get int64 from request error", err)
t.ERROR(fmt.Sprintf("%v的数据类型不为int", key), code.MSG_ERR_Param) t.ERROR(fmt.Sprintf("%v的数据类型不为int", key), code.MSG_ERR_Param)
return value, false return value, false
} }

4
controllers/client/activity.go

@ -19,7 +19,7 @@ type ActivityCtl struct {
} }
func (t *ActivityCtl) ModuleStatus() { func (t *ActivityCtl) ModuleStatus() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
moduleName := t.MustGet("module_name") moduleName := t.MustGet("module_name")
exist, err := activity_service.ExistModuleByActivityId(activityId, moduleName) exist, err := activity_service.ExistModuleByActivityId(activityId, moduleName)
t.CheckErr(err) t.CheckErr(err)
@ -30,7 +30,7 @@ func (t *ActivityCtl) ModuleStatus() {
// 某个模块的活动状态 // 某个模块的活动状态
func (t *ActivityCtl) ModuleCurrent() { func (t *ActivityCtl) ModuleCurrent() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
moduleName := t.MustGet("module_name") moduleName := t.MustGet("module_name")
uid := t.GetAccountId() uid := t.GetAccountId()

8
controllers/client/auction.go

@ -18,10 +18,10 @@ type AuctionCtl struct {
// 竞拍动作 // 竞拍动作
// todo: 进行替换 // todo: 进行替换
func (t *AuctionCtl) Auction() { func (t *AuctionCtl) Auction() {
auctionId := t.MustGetInt64("auction_activity_id")
auctionId := t.MustGetInt("auction_activity_id")
totalMoney := t.MustGetDouble("total_money") totalMoney := t.MustGetDouble("total_money")
uid := t.GetAccountId() uid := t.GetAccountId()
areaId := t.MustGetInt64("area_id")
areaId := t.MustGetInt("area_id")
if totalMoney < 0 { if totalMoney < 0 {
t.ERROR("金额不能为0", code.MSG_ERR) t.ERROR("金额不能为0", code.MSG_ERR)
@ -148,7 +148,7 @@ func (t *AuctionCtl) Auction() {
} }
func (t *AuctionCtl) ExistRecord() { func (t *AuctionCtl) ExistRecord() {
auctionId := t.MustGetInt64("auction_activity_id")
auctionId := t.MustGetInt("auction_activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
auction := new(models.NewAuctionActivity) auction := new(models.NewAuctionActivity)
@ -172,7 +172,7 @@ func (t *AuctionCtl) ExistRecord() {
// 已经竞拍到了 // 已经竞拍到了
func (t *AuctionCtl) UserAuctions() { func (t *AuctionCtl) UserAuctions() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)

4
controllers/client/barrage.go

@ -19,8 +19,8 @@ type BarrageCtl struct {
//发送弹幕 //发送弹幕
func (t *BarrageCtl) Send() { func (t *BarrageCtl) Send() {
uid := t.GetAccountId() uid := t.GetAccountId()
customerId := t.MustGetInt64("customer_id")
activityId := t.MustGetInt64("activity_id")
customerId := t.MustGetInt("customer_id")
activityId := t.MustGetInt("activity_id")
content := t.MustGet("content") content := t.MustGet("content")
//检查内容是否包含敏感 //检查内容是否包含敏感

10
controllers/client/bully_screen.go

@ -5,7 +5,7 @@ import (
"hudongzhuanjia/libs/filter" "hudongzhuanjia/libs/filter"
"hudongzhuanjia/models" "hudongzhuanjia/models"
bully_screen_service "hudongzhuanjia/services/bully_reward" bully_screen_service "hudongzhuanjia/services/bully_reward"
"hudongzhuanjia/services/pay"
pay_service "hudongzhuanjia/services/pay"
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"time" "time"
) )
@ -17,12 +17,12 @@ type BullyScreenCtl struct {
//用户霸屏 //用户霸屏
func (t *BullyScreenCtl) PaScreen() { func (t *BullyScreenCtl) PaScreen() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
content := t.MustGet("content") content := t.MustGet("content")
second := t.MustGetDouble("second") second := t.MustGetDouble("second")
style := t.MustGetInt("style") style := t.MustGetInt("style")
customerId := t.MustGetInt64("customer_id")
customerId := t.MustGetInt("customer_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -51,7 +51,7 @@ func (t *BullyScreenCtl) PaScreen() {
var res = make(map[string]interface{}, 0) var res = make(map[string]interface{}, 0)
res["out_trade_no"] = "" res["out_trade_no"] = ""
if activity.RehearsalId == 0 { if activity.RehearsalId == 0 {
res, err = pay_service.UnifiedOrder("欧轩互动-霸屏支付", user.Openid, int64(amount*100), 1, user.Id,
res, err = pay_service.UnifiedOrder("欧轩互动-霸屏支付", user.Openid, int(amount*100), 1, user.Id,
activityId, time.Now().Add(1*time.Hour).Unix()) activityId, time.Now().Add(1*time.Hour).Unix())
t.CheckErr(err) t.CheckErr(err)
} }
@ -83,7 +83,7 @@ func (t *BullyScreenCtl) PaScreen() {
// 审核列表 [未审核,未通过,已通过] // 审核列表 [未审核,未通过,已通过]
func (t *BullyScreenCtl) List() { func (t *BullyScreenCtl) List() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
bss := new(models.BullyScreenServer) bss := new(models.BullyScreenServer)
exist, err := bss.GetByActivityId(activityId) exist, err := bss.GetByActivityId(activityId)

4
controllers/client/calorie.go

@ -13,7 +13,7 @@ type CalorieCtl struct {
// h5 1/s // h5 1/s
func (t *CalorieCtl) Shake() { func (t *CalorieCtl) Shake() {
calorieId := t.MustGetInt64("calorie_id")
calorieId := t.MustGetInt("calorie_id")
score := t.DefaultInt("score", 0) score := t.DefaultInt("score", 0)
uid := t.GetAccountId() uid := t.GetAccountId()
@ -37,7 +37,7 @@ func (t *CalorieCtl) Shake() {
if calorie.Status == define.StatusRunning && score > 0 { if calorie.Status == define.StatusRunning && score > 0 {
_, err = calorieUser.IncrScore(activity.ArchId, calorieUser.Id, score) _, err = calorieUser.IncrScore(activity.ArchId, calorieUser.Id, score)
t.CheckErr(err) t.CheckErr(err)
calorieUser.Score += int64(score) // 增加
calorieUser.Score += int(score) // 增加
} }
count, err := calorieUser.CountByCalorieId(calorie.Id, activity.ArchId, activity.RehearsalId) count, err := calorieUser.CountByCalorieId(calorie.Id, activity.ArchId, activity.RehearsalId)

29
controllers/client/good.go

@ -3,7 +3,6 @@ package client
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/models" "hudongzhuanjia/models"
pay_service "hudongzhuanjia/services/pay" pay_service "hudongzhuanjia/services/pay"
@ -11,6 +10,8 @@ import (
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"strings" "strings"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
type GoodCtl struct { type GoodCtl struct {
@ -18,7 +19,7 @@ type GoodCtl struct {
} }
func (t *GoodCtl) GoodDetail() { func (t *GoodCtl) GoodDetail() {
goodsId := t.MustGetInt64("customer_goods_id")
goodsId := t.MustGetInt("customer_goods_id")
good := new(models.CustomerGoods) good := new(models.CustomerGoods)
exist, err := models.Get(good, goodsId) exist, err := models.Get(good, goodsId)
t.CheckErr(err) t.CheckErr(err)
@ -27,7 +28,7 @@ func (t *GoodCtl) GoodDetail() {
} }
func (t *GoodCtl) GoodOption() { func (t *GoodCtl) GoodOption() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
option := new(models.CustomerOrderOption) option := new(models.CustomerOrderOption)
exist, err := option.GetByActivityId(activityId) exist, err := option.GetByActivityId(activityId)
@ -42,8 +43,8 @@ func (t *GoodCtl) GoodOption() {
// 商品列表 // 商品列表
func (t *GoodCtl) ListGood() { func (t *GoodCtl) ListGood() {
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt64("area_id")
activityId := t.MustGetInt("activity_id")
areaId := t.MustGetInt("area_id")
option := new(models.CustomerOrderOption) option := new(models.CustomerOrderOption)
exist, err := option.GetByActivityId(activityId) exist, err := option.GetByActivityId(activityId)
@ -65,9 +66,9 @@ func (t *GoodCtl) ListGood() {
} }
func (t *GoodCtl) ListOrder() { func (t *GoodCtl) ListOrder() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
status := t.MustGet("status") status := t.MustGet("status")
areaId := t.MustGetInt64("area_id")
areaId := t.MustGetInt("area_id")
uid := t.GetAccountId() uid := t.GetAccountId()
statusList := strings.Split(status, ",") statusList := strings.Split(status, ",")
@ -88,7 +89,7 @@ func (t *GoodCtl) ListOrder() {
orders, err := models.GetCustomerOrdersByActivityId(uid, activity.Id, activity.RehearsalId, orders, err := models.GetCustomerOrdersByActivityId(uid, activity.Id, activity.RehearsalId,
areaId, statusList, t.Page, t.PageSize, activity.ArchId) areaId, statusList, t.Page, t.PageSize, activity.ArchId)
t.CheckErr(err) t.CheckErr(err)
orderIds := make([]int64, 0)
orderIds := make([]int, 0)
for _, order := range orders { for _, order := range orders {
orderIds = append(orderIds, order.Id) orderIds = append(orderIds, order.Id)
} }
@ -107,8 +108,8 @@ func (t *GoodCtl) ListOrder() {
} }
type OrderParam struct { type OrderParam struct {
ActivityId int64 `json:"activity_id"`
AreaId int64 `json:"area_id"`
ActivityId int `json:"activity_id"`
AreaId int `json:"area_id"`
Name string `json:"name"` Name string `json:"name"`
Phone string `json:"phone"` Phone string `json:"phone"`
Address string `json:"address"` Address string `json:"address"`
@ -122,8 +123,8 @@ func (t *GoodCtl) Order() {
if t.Request.OriginRequest.Method == "POST" { if t.Request.OriginRequest.Method == "POST" {
t.CheckErr(t.Bind(&param)) t.CheckErr(t.Bind(&param))
} else if t.Request.OriginRequest.Method == "GET" { } else if t.Request.OriginRequest.Method == "GET" {
param.ActivityId = t.MustGetInt64("activity_id")
param.AreaId = t.MustGetInt64("area_id")
param.ActivityId = t.MustGetInt("activity_id")
param.AreaId = t.MustGetInt("area_id")
param.Name = t.MustGet("name") param.Name = t.MustGet("name")
param.Phone = t.MustGet("phone") param.Phone = t.MustGet("phone")
param.Address = t.MustGet("address") param.Address = t.MustGet("address")
@ -173,7 +174,7 @@ func (t *GoodCtl) Order() {
// 检测库存 // 检测库存
for _, good := range goods { for _, good := range goods {
for _, g := range param.Goods { for _, g := range param.Goods {
if good.Id == int64(g["id"]) {
if good.Id == int(g["id"]) {
if good.Stock-g["num"] < 0 { if good.Stock-g["num"] < 0 {
session.Rollback() session.Rollback()
t.ERROR("商品库存不足", code.MSG_DATA_NOT_EXIST) t.ERROR("商品库存不足", code.MSG_DATA_NOT_EXIST)
@ -200,7 +201,7 @@ func (t *GoodCtl) Order() {
} }
var expireAt = time.Now().Add(30 * time.Second).Unix() var expireAt = time.Now().Add(30 * time.Second).Unix()
res, err := pay_service.UnifiedOrder("欧轩互动-直播商品", user.Openid, int64(price+int(option.PostFee*100)),
res, err := pay_service.UnifiedOrder("欧轩互动-直播商品", user.Openid, int(price+int(option.PostFee*100)),
4, userId, activity.Id, expireAt) 4, userId, activity.Id, expireAt)
if err != nil { if err != nil {
session.Rollback() session.Rollback()

6
controllers/client/invite_envelope.go

@ -13,8 +13,8 @@ type InvitationLetterCtl struct {
func (t *InvitationLetterCtl) Invite() { func (t *InvitationLetterCtl) Invite() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
invitationId := t.MustGetInt64("invitation_id")
activityId := t.MustGetInt("activity_id")
invitationId := t.MustGetInt("invitation_id")
answer := t.MustGet("answer") answer := t.MustGet("answer")
activity := new(models.Activity) activity := new(models.Activity)
@ -42,7 +42,7 @@ func (t *InvitationLetterCtl) Invite() {
} }
func (t *InvitationLetterCtl) Setting() { func (t *InvitationLetterCtl) Setting() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
activity := new(models.Activity) activity := new(models.Activity)

25
controllers/client/live.go

@ -2,7 +2,6 @@ package client
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/libs/filter" "hudongzhuanjia/libs/filter"
"hudongzhuanjia/libs/im" "hudongzhuanjia/libs/im"
@ -14,6 +13,8 @@ import (
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"sync" "sync"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
// 轮询接口 // 轮询接口
@ -26,7 +27,7 @@ func QueryOnline() error {
if err != nil { if err != nil {
return err return err
} }
liveIds := make([]int64, 0)
liveIds := make([]int, 0)
for _, live := range lives { // 查询在线人数 for _, live := range lives { // 查询在线人数
liveIds = append(liveIds, live.Id) liveIds = append(liveIds, live.Id)
} }
@ -35,7 +36,7 @@ func QueryOnline() error {
return err return err
} }
var idm = make(map[int64][]string, 0)
var idm = make(map[int][]string, 0)
for _, live := range lives { for _, live := range lives {
for _, viewer := range viewers { for _, viewer := range viewers {
if live.Id == viewer.LiveConfigId { if live.Id == viewer.LiveConfigId {
@ -50,7 +51,7 @@ func QueryOnline() error {
wg.Add(len(idm)) wg.Add(len(idm))
var errs []error var errs []error
for lid, ids := range idm { for lid, ids := range idm {
go func(int64, []string) {
go func(int, []string) {
defer func() { recover() }() defer func() { recover() }()
defer wg.Done() defer wg.Done()
res, err := im.QueryState(ids) res, err := im.QueryState(ids)
@ -79,8 +80,8 @@ type LiveCtl struct {
// 详情 // 详情
func (t *LiveCtl) Detail() { func (t *LiveCtl) Detail() {
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt64("area_id")
activityId := t.MustGetInt("activity_id")
areaId := t.MustGetInt("area_id")
live := new(models.LiveConfig) live := new(models.LiveConfig)
exist, err := live.GetByActivityId(activityId) exist, err := live.GetByActivityId(activityId)
@ -123,7 +124,7 @@ func (t *LiveCtl) Detail() {
} }
func (t *LiveCtl) Like() { func (t *LiveCtl) Like() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
_, err := new(models.LiveConfig).Like(activityId) _, err := new(models.LiveConfig).Like(activityId)
t.CheckErr(err) t.CheckErr(err)
@ -139,7 +140,7 @@ func (t *LiveCtl) Like() {
} }
func (t *LiveCtl) LoopQuery() { func (t *LiveCtl) LoopQuery() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
live := new(models.LiveConfig) live := new(models.LiveConfig)
exist, err := live.GetByActivityId(activityId) exist, err := live.GetByActivityId(activityId)
t.CheckErr(err) t.CheckErr(err)
@ -154,11 +155,11 @@ func (t *LiveCtl) LoopQuery() {
// 维护一个队列进行循环, 遍历是否付款成功 // 维护一个队列进行循环, 遍历是否付款成功
func (t *LiveCtl) SendLiveRedPack() { func (t *LiveCtl) SendLiveRedPack() {
userId := t.GetAccountId() // 用户 uid userId := t.GetAccountId() // 用户 uid
activityId := t.MustGetInt64("activity_id") // activity_id
activityId := t.MustGetInt("activity_id") // activity_id
num := t.MustGetInt("num") // 红包数量 num := t.MustGetInt("num") // 红包数量
prompt := t.MustGet("prompt") // 提示 prompt := t.MustGet("prompt") // 提示
amount := utils.Float64CusDecimal(t.MustGetDouble("amount"), 2) // 金额 amount := utils.Float64CusDecimal(t.MustGetDouble("amount"), 2) // 金额
areaId := t.MustGetInt64("area_id")
areaId := t.MustGetInt("area_id")
if amount/float64(num) < 1 && amount/float64(num) > 200 { // 平均每个红包不得小于0.3 if amount/float64(num) < 1 && amount/float64(num) > 200 { // 平均每个红包不得小于0.3
t.ERROR("每个红包的平均金额必须在1.00元到200.00元之间", code.MSG_ERR) t.ERROR("每个红包的平均金额必须在1.00元到200.00元之间", code.MSG_ERR)
@ -175,7 +176,7 @@ func (t *LiveCtl) SendLiveRedPack() {
t.CheckErr(err) t.CheckErr(err)
t.Assert(exist, code.MSG_USER_NOT_EXIST, "用户不存在") t.Assert(exist, code.MSG_USER_NOT_EXIST, "用户不存在")
res, err := pay_service.UnifiedOrder("欧轩互动-直播红包", user.Openid, int64(amount*100),
res, err := pay_service.UnifiedOrder("欧轩互动-直播红包", user.Openid, int(amount*100),
3, userId, activityId, time.Now().Add(1*time.Hour).Unix()) 3, userId, activityId, time.Now().Add(1*time.Hour).Unix())
t.CheckErr(err) t.CheckErr(err)
@ -218,7 +219,7 @@ func (t *LiveCtl) SendLiveRedPack() {
// 领取红包 // 领取红包
func (t *LiveCtl) GetLiveRedPack() { func (t *LiveCtl) GetLiveRedPack() {
ruleId := t.MustGetInt64("live_red_envelope_rule_id")
ruleId := t.MustGetInt("live_red_envelope_rule_id")
userId := t.GetAccountId() userId := t.GetAccountId()
rule := new(models.LiveRedEnvelopeRule) rule := new(models.LiveRedEnvelopeRule)

13
controllers/client/login.go

@ -2,7 +2,6 @@ package client
import ( import (
"fmt" "fmt"
mpoauth2 "github.com/chanxuehong/wechat/mp/oauth2"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/libs/im" "hudongzhuanjia/libs/im"
"hudongzhuanjia/libs/jwt" "hudongzhuanjia/libs/jwt"
@ -13,6 +12,8 @@ import (
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"time" "time"
mpoauth2 "github.com/chanxuehong/wechat/mp/oauth2"
) )
//用户 //用户
@ -24,7 +25,7 @@ type UserCtl struct {
func (t *UserCtl) EntryLogin() { func (t *UserCtl) EntryLogin() {
account := t.MustGet("account") account := t.MustGet("account")
password := t.MustGet("password") password := t.MustGet("password")
activityId := t.MustGetInt64("activity_id") // 需要获取
activityId := t.MustGetInt("activity_id") // 需要获取
entryPeople := new(models.OrderEntryPerson) entryPeople := new(models.OrderEntryPerson)
exist, err := entryPeople.Auth(account, password, activityId) exist, err := entryPeople.Auth(account, password, activityId)
@ -59,7 +60,7 @@ func (t *UserCtl) EntryLogin() {
} }
func (t *UserCtl) WxLogin() { func (t *UserCtl) WxLogin() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
wxcode := t.MustGet("code") wxcode := t.MustGet("code")
logger.Error("微信code:", wxcode) logger.Error("微信code:", wxcode)
@ -191,9 +192,9 @@ func (t *UserCtl) Login() {
// 模拟wx login // 模拟wx login
func (t *UserCtl) DebugLogin() { func (t *UserCtl) DebugLogin() {
uid := t.DefaultInt64("user_id", 1)
customerId := t.DefaultInt64("customer_id", 1)
activityId := t.DefaultInt64("activity_id", 5)
uid := t.DefaultInt("user_id", 1)
customerId := t.DefaultInt("customer_id", 1)
activityId := t.DefaultInt("activity_id", 5)
user := new(models.User) user := new(models.User)
exist, err := models.Get(user, uid) exist, err := models.Get(user, uid)

18
controllers/client/lottery.go

@ -15,7 +15,7 @@ type LotteryCtl struct {
func (t *LotteryCtl) UserLotteries() { func (t *LotteryCtl) UserLotteries() {
userId := t.GetAccountId() userId := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -33,7 +33,7 @@ func (t *LotteryCtl) UserLotteries() {
func (t *LotteryCtl) CashLottery() { func (t *LotteryCtl) CashLottery() {
uid := t.GetAccountId() uid := t.GetAccountId()
prizeId := t.MustGetInt64("prize_id")
prizeId := t.MustGetInt("prize_id")
name := t.MustGet("name") name := t.MustGet("name")
phone := t.MustGet("phone") phone := t.MustGet("phone")
wxNo := t.MustGet("wx_no") wxNo := t.MustGet("wx_no")
@ -61,7 +61,7 @@ func (t *LotteryCtl) CashLottery() {
func (t *LotteryCtl) CheckLottery() { func (t *LotteryCtl) CheckLottery() {
uid := t.GetAccountId() uid := t.GetAccountId()
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
ladderId := t.MustGetInt("lottery_draw_ladder_id")
ladder := &models.LotteryDrawRuleLadder{} ladder := &models.LotteryDrawRuleLadder{}
exist, err := models.Get(ladder, ladderId) exist, err := models.Get(ladder, ladderId)
@ -95,8 +95,8 @@ func (t *LotteryCtl) CheckLottery() {
//获取中奖名单 //获取中奖名单
func (t *LotteryCtl) Winners() { func (t *LotteryCtl) Winners() {
activityId := t.MustGetInt64("activity_id")
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
activityId := t.MustGetInt("activity_id")
ladderId := t.MustGetInt("lottery_draw_ladder_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -119,9 +119,9 @@ func (t *LotteryCtl) Winners() {
// 抽奖用户 // 抽奖用户
func (t *LotteryCtl) Users() { func (t *LotteryCtl) Users() {
activityId := t.MustGetInt64("activity_id")
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
areaId := t.MustGetInt64("area_id")
activityId := t.MustGetInt("activity_id")
ladderId := t.MustGetInt("lottery_draw_ladder_id")
areaId := t.MustGetInt("area_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -137,7 +137,7 @@ func (t *LotteryCtl) Users() {
t.CheckErr(err) t.CheckErr(err)
t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "活动模块不存在") t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "活动模块不存在")
recordIds := make([]int64, 0)
recordIds := make([]int, 0)
if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT { if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT {
// 去重标志 // 去重标志
recordIds, err = models.GetUserIdsByLotteryDrawRuleId(ladder.LotteryDrawRuleId, activity.RehearsalId, areaId, activity.ArchId) recordIds, err = models.GetUserIdsByLotteryDrawRuleId(ladder.LotteryDrawRuleId, activity.RehearsalId, areaId, activity.ArchId)

38
controllers/client/order_entry.go

@ -2,13 +2,14 @@ package client
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/models" "hudongzhuanjia/models"
invitation_service "hudongzhuanjia/services/invitation" invitation_service "hudongzhuanjia/services/invitation"
"hudongzhuanjia/utils" "hudongzhuanjia/utils"
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
type OrderEntryCtl struct { type OrderEntryCtl struct {
@ -18,13 +19,22 @@ type OrderEntryCtl struct {
// 用户查看所有商品 // 用户查看所有商品
func (t *OrderEntryCtl) List() { func (t *OrderEntryCtl) List() {
_type := t.GetAccountType() _type := t.GetAccountType()
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt64("area_id")
uid := t.GetAccountId()
activityId := t.MustGetInt("activity_id")
areaId := 0
if _type == define.TYPE_ENTRYPEOPLE {
entryPerson := models.OrderEntryPerson{}
exist, err := models.Get(&entryPerson, uid)
t.CheckErr(err)
t.Assert(exist, code.MSG_ENTRYPEOPLE_NOT_EXIST, "录入人员信息异常")
areaId = entryPerson.AreaId
} else {
areaId = t.MustGetInt("area_id")
}
goods, err := models.GetGoodsByActivityId(activityId, areaId) goods, err := models.GetGoodsByActivityId(activityId, areaId)
t.CheckErr(err) t.CheckErr(err)
if _type == define.TYPE_H5USER { if _type == define.TYPE_H5USER {
uid := t.GetAccountId()
for index := range goods { for index := range goods {
url := fmt.Sprintf("%s/PcClient/Client/OrderEntryCtl/order?"+ url := fmt.Sprintf("%s/PcClient/Client/OrderEntryCtl/order?"+
"user_id=%d&activity_id=%d&good_id=%d", define.HOST, uid, activityId, goods[index].Id) "user_id=%d&activity_id=%d&good_id=%d", define.HOST, uid, activityId, goods[index].Id)
@ -42,8 +52,8 @@ func (t *OrderEntryCtl) List() {
// 扫二维码下单 // 扫二维码下单
func (t *OrderEntryCtl) Order() { func (t *OrderEntryCtl) Order() {
userId := t.MustGetInt64("user_id")
goodId := t.MustGetInt64("good_id")
userId := t.MustGetInt("user_id")
goodId := t.MustGetInt("good_id")
entryId := t.GetAccountId() entryId := t.GetAccountId()
entryPerson := models.OrderEntryPerson{} entryPerson := models.OrderEntryPerson{}
@ -384,7 +394,7 @@ func (t *OrderEntryCtl) ManualOrder() {
} }
func (t *OrderEntryCtl) DeleteOrder() { func (t *OrderEntryCtl) DeleteOrder() {
orderId := t.MustGetInt64("order_id")
orderId := t.MustGetInt("order_id")
order := new(models.CustomerOrder) order := new(models.CustomerOrder)
exist, err := models.Get(order, orderId) exist, err := models.Get(order, orderId)
t.CheckErr(err) t.CheckErr(err)
@ -399,8 +409,8 @@ func (t *OrderEntryCtl) DeleteOrder() {
} }
type OrderListResult struct { type OrderListResult struct {
OrderId int64 `json:"order_id"`
UserId int64 `json:"user_id"`
OrderId int `json:"order_id"`
UserId int `json:"user_id"`
EntryName string `json:"entry_name"` EntryName string `json:"entry_name"`
GoodName string `json:"good_name"` GoodName string `json:"good_name"`
OrderTime string `json:"order_time"` OrderTime string `json:"order_time"`
@ -411,7 +421,7 @@ type OrderListResult struct {
func (t *OrderEntryCtl) EntryOrders() { func (t *OrderEntryCtl) EntryOrders() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
entry := new(models.OrderEntryPerson) entry := new(models.OrderEntryPerson)
exist, err := models.Get(entry, uid) exist, err := models.Get(entry, uid)
@ -460,7 +470,7 @@ type UserOrdersResult struct {
// 用户查看订单列表 // 用户查看订单列表
func (t *OrderEntryCtl) UserOrders() { func (t *OrderEntryCtl) UserOrders() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -487,9 +497,9 @@ func (t *OrderEntryCtl) UserOrders() {
// 二维码 // 二维码
func (t *OrderEntryCtl) Qrcode() { func (t *OrderEntryCtl) Qrcode() {
userId := t.MustGetInt64("user_id")
activityId := t.MustGetInt64("activity_id")
goodId := t.MustGetInt64("good_id")
userId := t.MustGetInt("user_id")
activityId := t.MustGetInt("activity_id")
goodId := t.MustGetInt("good_id")
Url := fmt.Sprintf("%s/PcClient/Client/OrderEntryCtl/order?user_id=%d&activity_id=%d&good_id=%d", Url := fmt.Sprintf("%s/PcClient/Client/OrderEntryCtl/order?user_id=%d&activity_id=%d&good_id=%d",
define.HOST, userId, activityId, goodId) define.HOST, userId, activityId, goodId)
qr, err := utils.Qrcode2Base64(Url) qr, err := utils.Qrcode2Base64(Url)

6
controllers/client/reward.go

@ -17,7 +17,7 @@ type RewardCtl struct {
} }
func (t *RewardCtl) Reward() { func (t *RewardCtl) Reward() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
content := t.MustGet("content") content := t.MustGet("content")
amount := t.MustGetDouble("amount") amount := t.MustGetDouble("amount")
uid := t.GetAccountId() uid := t.GetAccountId()
@ -57,7 +57,7 @@ func (t *RewardCtl) Reward() {
var expireAt = time.Now().Add(24 * time.Hour).Unix() var expireAt = time.Now().Add(24 * time.Hour).Unix()
res["out_trade_no"] = "" res["out_trade_no"] = ""
if activity.RehearsalId == 0 || _type == 1 { // 直播不用彩排 if activity.RehearsalId == 0 || _type == 1 { // 直播不用彩排
res, err = pay_service.UnifiedOrder("欧轩互动-打赏支付", user.Openid, int64(amount*100), 2,
res, err = pay_service.UnifiedOrder("欧轩互动-打赏支付", user.Openid, int(amount*100), 2,
user.Id, activityId, expireAt) user.Id, activityId, expireAt)
t.CheckErr(err) t.CheckErr(err)
} }
@ -91,7 +91,7 @@ func (t *RewardCtl) Reward() {
func (t *RewardCtl) List() { func (t *RewardCtl) List() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)

8
controllers/client/shake_red_envelope.go

@ -18,7 +18,7 @@ type ShakeRedEnvelopeCtl struct {
} }
func (t *ShakeRedEnvelopeCtl) Status() { func (t *ShakeRedEnvelopeCtl) Status() {
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
ruleId := t.MustGetInt("shake_red_envelope_rule_id")
rule := new(models.ShakeRedEnvelopeRule) rule := new(models.ShakeRedEnvelopeRule)
exist, err := models.Get(rule, ruleId) exist, err := models.Get(rule, ruleId)
t.CheckErr(err) t.CheckErr(err)
@ -29,9 +29,9 @@ func (t *ShakeRedEnvelopeCtl) Status() {
} }
func (t *ShakeRedEnvelopeCtl) Shake() { func (t *ShakeRedEnvelopeCtl) Shake() {
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
ruleId := t.MustGetInt("shake_red_envelope_rule_id")
userId := t.GetAccountId() userId := t.GetAccountId()
areaId := t.MustGetInt64("area_id")
areaId := t.MustGetInt("area_id")
// 查询摇红包规则 // 查询摇红包规则
rule := new(models.ShakeRedEnvelopeRule) rule := new(models.ShakeRedEnvelopeRule)
@ -144,7 +144,7 @@ func (t *ShakeRedEnvelopeCtl) Shake() {
// 用户红包 // 用户红包
func (t *ShakeRedEnvelopeCtl) UserRedEnvelopes() { func (t *ShakeRedEnvelopeCtl) UserRedEnvelopes() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)

22
controllers/client/sign.go

@ -16,8 +16,8 @@ type SignCtl struct {
} }
func (t *SignCtl) CheckSign() { func (t *SignCtl) CheckSign() {
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt64("area_id")
activityId := t.MustGetInt("activity_id")
areaId := t.MustGetInt("area_id")
uid := t.GetAccountId() uid := t.GetAccountId()
_type := t.MustGetInt("type") _type := t.MustGetInt("type")
@ -86,7 +86,7 @@ func (t *SignCtl) CheckSign() {
} }
func (t *SignCtl) Setting() { func (t *SignCtl) Setting() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
service := new(models.ModuleService) service := new(models.ModuleService)
exist, err := service.GetByName(define.MODULE_SIGNIN) exist, err := service.GetByName(define.MODULE_SIGNIN)
@ -115,9 +115,9 @@ func (t *SignCtl) Setting() {
//签到动作 //签到动作
func (t *SignCtl) Sign() { func (t *SignCtl) Sign() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
_type := t.DefaultInt("type", 0) // 默认 0 _type := t.DefaultInt("type", 0) // 默认 0
areaId := t.MustGetInt64("area_id")
areaId := t.MustGetInt("area_id")
//根据activity_id查找主活动的信息 //根据activity_id查找主活动的信息
activity := new(models.Activity) activity := new(models.Activity)
@ -199,9 +199,9 @@ func (t *SignCtl) Sign() {
// 实名签到 // 实名签到
func (t *SignCtl) RealSign() { func (t *SignCtl) RealSign() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
userId := t.GetAccountId() userId := t.GetAccountId()
areaId := t.MustGetInt64("area_id")
areaId := t.MustGetInt("area_id")
user := new(models.User) user := new(models.User)
exist, err := models.Get(user, userId) exist, err := models.Get(user, userId)
@ -293,8 +293,8 @@ func (t *SignCtl) RealSign() {
func (t *SignCtl) ApplySign() { func (t *SignCtl) ApplySign() {
userId := t.GetAccountId() userId := t.GetAccountId()
areaId := t.MustGetInt64("area_id")
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt("area_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -318,8 +318,8 @@ func (t *SignCtl) ApplySign() {
func (t *SignCtl) CheckRealSign() { func (t *SignCtl) CheckRealSign() {
userId := t.GetAccountId() userId := t.GetAccountId()
areaId := t.MustGetInt64("area_id")
activityId := t.MustGetInt64("activity_id")
areaId := t.MustGetInt("area_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)

10
controllers/client/tug_war.go

@ -15,7 +15,7 @@ type TugOfWarCtl struct {
func (t *TugOfWarCtl) Status() { func (t *TugOfWarCtl) Status() {
// 获取此次活动的状态 // 获取此次活动的状态
baheId := t.MustGetInt64("bahe_activity_id")
baheId := t.MustGetInt("bahe_activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
// 找到活动 // 找到活动
bahe := new(models.TugOfWar) bahe := new(models.TugOfWar)
@ -63,8 +63,8 @@ func (t *TugOfWarCtl) Status() {
func (t *TugOfWarCtl) Shake() { func (t *TugOfWarCtl) Shake() {
uid := t.GetAccountId() uid := t.GetAccountId()
baheId := t.MustGetInt64("bahe_activity_id")
score := t.MustGetInt64("score") // 增加的分数
baheId := t.MustGetInt("bahe_activity_id")
score := t.MustGetInt("score") // 增加的分数
bahe := &models.TugOfWar{} bahe := &models.TugOfWar{}
exist, err := models.Get(bahe, baheId) exist, err := models.Get(bahe, baheId)
@ -107,8 +107,8 @@ func (t *TugOfWarCtl) Shake() {
} }
func (t *TugOfWarCtl) JoinTeam() { func (t *TugOfWarCtl) JoinTeam() {
teamId := t.MustGetInt64("bahe_team_id")
baheActivityId := t.MustGetInt64("bahe_activity_id")
teamId := t.MustGetInt("bahe_team_id")
baheActivityId := t.MustGetInt("bahe_activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
bahe := new(models.TugOfWar) bahe := new(models.TugOfWar)

4
controllers/client/upper_wall.go

@ -16,7 +16,7 @@ type UpperWallCtl struct {
//发送上墙消息 //发送上墙消息
func (t *UpperWallCtl) Send() { func (t *UpperWallCtl) Send() {
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
category := t.MustGetInt("category") category := t.MustGetInt("category")
content, _ := t.Get("content") content, _ := t.Get("content")
img, _ := t.Get("img") img, _ := t.Get("img")
@ -58,7 +58,7 @@ func (t *UpperWallCtl) Send() {
} }
func (t *UpperWallCtl) List() { func (t *UpperWallCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
userId := t.GetAccountId() userId := t.GetAccountId()
activity := new(models.Activity) activity := new(models.Activity)

13
controllers/client/vote.go

@ -2,10 +2,11 @@ package client
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/models" "hudongzhuanjia/models"
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
type VoteCtl struct { type VoteCtl struct {
@ -15,7 +16,7 @@ type VoteCtl struct {
//投票 //投票
func (t *VoteCtl) Vote() { func (t *VoteCtl) Vote() {
uid := t.GetAccountId() uid := t.GetAccountId()
ladderId := t.MustGetInt64("vote_activity_ladder_id")
ladderId := t.MustGetInt("vote_activity_ladder_id")
//检查是否可以投票 //检查是否可以投票
ladder := new(models.NewVoteActivityLadder) ladder := new(models.NewVoteActivityLadder)
@ -48,7 +49,7 @@ func (t *VoteCtl) Vote() {
} else { } else {
num, err := history.CountUser(uid, activity.RehearsalId, vote.Id, activity.ArchId) num, err := history.CountUser(uid, activity.RehearsalId, vote.Id, activity.ArchId)
t.CheckErr(err) t.CheckErr(err)
if num >= vote.ModelNum {
if int(num) >= vote.ModelNum {
t.ERROR(fmt.Sprintf("您投票人数已超过%d人", vote.ModelNum), code.MSG_ERR) t.ERROR(fmt.Sprintf("您投票人数已超过%d人", vote.ModelNum), code.MSG_ERR)
} }
} }
@ -68,7 +69,7 @@ func (t *VoteCtl) Vote() {
// 投票活动列表 // 投票活动列表
func (t *VoteCtl) List() { func (t *VoteCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
// 该活动是否进行中 // 该活动是否进行中
activity := new(models.Activity) activity := new(models.Activity)
@ -87,9 +88,9 @@ func (t *VoteCtl) List() {
} }
func (t *VoteCtl) Detail() { func (t *VoteCtl) Detail() {
voteActivityId := t.MustGetInt64("vote_activity_id")
voteActivityId := t.MustGetInt("vote_activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)

2
controllers/common/im.go

@ -25,7 +25,7 @@ func (t *ImTestCtl) Refund() {
} }
func (t *ImTestCtl) Send() { func (t *ImTestCtl) Send() {
err := im_service.SendGroupCustomMessage("admin", t.MustGetInt64("activity_id"),
err := im_service.SendGroupCustomMessage("admin", t.MustGetInt("activity_id"),
im_service.NoticeStatus(t.MustGetInt("type")), map[string]interface{}{ im_service.NoticeStatus(t.MustGetInt("type")), map[string]interface{}{
"content": "测试", "content": "测试",
}) })

3
controllers/common/wechat_oauth.go

@ -4,7 +4,6 @@ import (
"crypto/sha1" "crypto/sha1"
"encoding/xml" "encoding/xml"
"fmt" "fmt"
"go.uber.org/atomic"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/libs/filter" "hudongzhuanjia/libs/filter"
"hudongzhuanjia/logger" "hudongzhuanjia/logger"
@ -12,6 +11,8 @@ import (
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"os" "os"
"time" "time"
"go.uber.org/atomic"
) )
var Now = time.Now() var Now = time.Now()

6
controllers/pc/activity.go

@ -16,10 +16,10 @@ type ActivityCtl struct {
} }
func (t *ActivityCtl) StartActivity() { func (t *ActivityCtl) StartActivity() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
mode := t.MustGetInt("mode") // 标识彩排 mode=0正式 mode=1彩排 mode := t.MustGetInt("mode") // 标识彩排 mode=0正式 mode=1彩排
uid := t.GetAccountId() uid := t.GetAccountId()
limit := t.DefaultInt64("limit", 10)
limit := t.DefaultInt("limit", 10)
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -69,7 +69,7 @@ func (t *ActivityCtl) StartActivity() {
} }
func (t *ActivityCtl) StopActivity() { func (t *ActivityCtl) StopActivity() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)

2
controllers/pc/area_store.go

@ -11,7 +11,7 @@ type AreaStoreCtl struct {
} }
func (t *AreaStoreCtl) List() { func (t *AreaStoreCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
list, err := models.GetAreaStoresByActivityId(activityId) list, err := models.GetAreaStoresByActivityId(activityId)
t.CheckErr(err) t.CheckErr(err)

26
controllers/pc/auction.go

@ -19,7 +19,7 @@ type AuctionCtl struct {
// 竞拍准备状态 // 竞拍准备状态
func (t *AuctionCtl) ReadyAuction() { func (t *AuctionCtl) ReadyAuction() {
auctionId := t.MustGetInt64("auction_activity_id")
auctionId := t.MustGetInt("auction_activity_id")
auction := new(models.NewAuctionActivity) auction := new(models.NewAuctionActivity)
exist, err := models.Get(auction, auctionId) exist, err := models.Get(auction, auctionId)
t.CheckErr(err) t.CheckErr(err)
@ -36,7 +36,7 @@ func (t *AuctionCtl) ReadyAuction() {
} }
func (t *AuctionCtl) StartAuction() { func (t *AuctionCtl) StartAuction() {
auctionId := t.MustGetInt64("auction_activity_id")
auctionId := t.MustGetInt("auction_activity_id")
auction := new(models.NewAuctionActivity) auction := new(models.NewAuctionActivity)
exist, err := models.Get(auction, auctionId) exist, err := models.Get(auction, auctionId)
@ -57,7 +57,7 @@ func (t *AuctionCtl) StartAuction() {
} }
func (t *AuctionCtl) StopAuction() { func (t *AuctionCtl) StopAuction() {
auctionId := t.MustGetInt64("auction_activity_id")
auctionId := t.MustGetInt("auction_activity_id")
auction := new(models.NewAuctionActivity) auction := new(models.NewAuctionActivity)
exist, err := models.Get(auction, auctionId) exist, err := models.Get(auction, auctionId)
t.CheckErr(err) t.CheckErr(err)
@ -142,8 +142,8 @@ func (t *AuctionCtl) StopAuction() {
} }
func (t *AuctionCtl) History() { func (t *AuctionCtl) History() {
auctionId := t.MustGetInt64("auction_activity_id")
rehearsalId := t.MustGetInt64("rehearsal_id")
auctionId := t.MustGetInt("auction_activity_id")
rehearsalId := t.MustGetInt("rehearsal_id")
auction := &models.NewAuctionActivity{} auction := &models.NewAuctionActivity{}
exist, err := models.Get(auction, auctionId) exist, err := models.Get(auction, auctionId)
@ -163,7 +163,7 @@ func (t *AuctionCtl) History() {
histories, err := models.GetAuctionHistoriesByAuctionId(auctionId, rehearsalId, orderBy, activity.ArchId) histories, err := models.GetAuctionHistoriesByAuctionId(auctionId, rehearsalId, orderBy, activity.ArchId)
t.CheckErr(err) t.CheckErr(err)
userIdMap := make(map[int64]struct{}, 0) // 去重操作
userIdMap := make(map[int]struct{}, 0) // 去重操作
for u := range histories { for u := range histories {
if _, ok := userIdMap[histories[u].UserId]; ok { if _, ok := userIdMap[histories[u].UserId]; ok {
//去掉重复的 //去掉重复的
@ -180,8 +180,8 @@ func (t *AuctionCtl) History() {
} }
func (t *AuctionCtl) List() { func (t *AuctionCtl) List() {
activityId := t.MustGetInt64("activity_id")
rehearsalId := t.MustGetInt64("rehearsal_id")
activityId := t.MustGetInt("activity_id")
rehearsalId := t.MustGetInt("rehearsal_id")
activity := &models.Activity{} activity := &models.Activity{}
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -191,7 +191,7 @@ func (t *AuctionCtl) List() {
auctions, err := models.GetAuctionsByActivityId(activityId) auctions, err := models.GetAuctionsByActivityId(activityId)
t.CheckErr(err) t.CheckErr(err)
// 更具某个数据进行 // 更具某个数据进行
upIds := make([]int64, 0)
upIds := make([]int, 0)
for _, item := range auctions { for _, item := range auctions {
if item.AuctionModel == "加价竞拍" { if item.AuctionModel == "加价竞拍" {
upIds = append(upIds, item.Id) upIds = append(upIds, item.Id)
@ -202,7 +202,7 @@ func (t *AuctionCtl) List() {
for i := range auctions { for i := range auctions {
if auctions[i].AuctionModel == define.INCR_AUCTION { if auctions[i].AuctionModel == define.INCR_AUCTION {
userIdMap := make(map[int64]struct{}, 0) // 去重操作
userIdMap := make(map[int]struct{}, 0) // 去重操作
for u := range upH { for u := range upH {
if _, ok := userIdMap[upH[u].UserId]; ok { if _, ok := userIdMap[upH[u].UserId]; ok {
//去掉重复的 //去掉重复的
@ -225,7 +225,7 @@ func (t *AuctionCtl) List() {
// 成交记录 // 成交记录
func (t *AuctionCtl) Records() { func (t *AuctionCtl) Records() {
auctionId := t.MustGetInt64("auction_activity_id")
auctionId := t.MustGetInt("auction_activity_id")
auction := &models.NewAuctionActivity{} auction := &models.NewAuctionActivity{}
exist, err := models.Get(auction, auctionId) exist, err := models.Get(auction, auctionId)
t.CheckErr(err) t.CheckErr(err)
@ -248,8 +248,8 @@ func (t *AuctionCtl) Records() {
func (t *AuctionCtl) Qrcode() { func (t *AuctionCtl) Qrcode() {
//将服务器得地址和activity_id,动态生成二维码 //将服务器得地址和activity_id,动态生成二维码
uid := t.GetAccountId() uid := t.GetAccountId()
activityId := t.MustGetInt64("activity_id")
auctionId := t.MustGetInt64("auction_activity_id")
activityId := t.MustGetInt("activity_id")
auctionId := t.MustGetInt("auction_activity_id")
activity := &models.Activity{} activity := &models.Activity{}
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)

6
controllers/pc/barrage.go

@ -13,7 +13,7 @@ type BarrageCtl struct {
//获取活动的详情 //获取活动的详情
func (t *BarrageCtl) Details() { func (t *BarrageCtl) Details() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
server := new(models.DanMuServer) server := new(models.DanMuServer)
exist, err := server.GetByActivityId(activityId) exist, err := server.GetByActivityId(activityId)
t.CheckErr(err) t.CheckErr(err)
@ -25,14 +25,14 @@ func (t *BarrageCtl) Details() {
} }
func (t *BarrageCtl) SaveSetting() { func (t *BarrageCtl) SaveSetting() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
t.CheckErr(err) t.CheckErr(err)
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
danmuId := t.MustGetInt64("danmu_server_id")
danmuId := t.MustGetInt("danmu_server_id")
server := new(models.DanMuServer) server := new(models.DanMuServer)
server.DanmuFontSize = t.MustGet("font_size") server.DanmuFontSize = t.MustGet("font_size")
server.DanmuOpacity = t.MustGetInt("opacity") server.DanmuOpacity = t.MustGetInt("opacity")

14
controllers/pc/bully_screen.go

@ -4,7 +4,7 @@ import (
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/models" "hudongzhuanjia/models"
bully_reward_service "hudongzhuanjia/services/bully_reward" bully_reward_service "hudongzhuanjia/services/bully_reward"
"hudongzhuanjia/services/pay"
pay_service "hudongzhuanjia/services/pay"
"hudongzhuanjia/utils" "hudongzhuanjia/utils"
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"strings" "strings"
@ -17,7 +17,7 @@ type BullyScreenCtl struct {
//获取待审核列表 //获取待审核列表
func (t *BullyScreenCtl) WaitReview() { func (t *BullyScreenCtl) WaitReview() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -46,7 +46,7 @@ func (t *BullyScreenCtl) Review() {
customerId := t.GetAccountId() customerId := t.GetAccountId()
status := t.MustGetBool("status") status := t.MustGetBool("status")
ids := strings.Split(t.MustGet("ids"), "|") ids := strings.Split(t.MustGet("ids"), "|")
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -103,7 +103,7 @@ func (t *BullyScreenCtl) Review() {
//获取黑名单列表 //获取黑名单列表
func (t *BullyScreenCtl) Blacklist() { func (t *BullyScreenCtl) Blacklist() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -128,7 +128,7 @@ func (t *BullyScreenCtl) Blacklist() {
//获取目前霸屏得总金额 //获取目前霸屏得总金额
func (t *BullyScreenCtl) Amount() { func (t *BullyScreenCtl) Amount() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -151,7 +151,7 @@ func (t *BullyScreenCtl) Amount() {
//获取最新得霸屏记录 //获取最新得霸屏记录
func (t *BullyScreenCtl) Latest() { func (t *BullyScreenCtl) Latest() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -180,7 +180,7 @@ func (t *BullyScreenCtl) Latest() {
// 霸屏服务器开关 // 霸屏服务器开关
func (t *BullyScreenCtl) Details() { func (t *BullyScreenCtl) Details() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
server := new(models.BullyScreenServer) server := new(models.BullyScreenServer)
exist, err := server.GetByActivityId(activityId) exist, err := server.GetByActivityId(activityId)
t.CheckErr(err) t.CheckErr(err)

16
controllers/pc/calorie.go

@ -16,7 +16,7 @@ type CalorieCtl struct {
} }
func (t *CalorieCtl) Ready() { func (t *CalorieCtl) Ready() {
calorieId := t.MustGetInt64("calorie_id")
calorieId := t.MustGetInt("calorie_id")
calorie := new(models.Calorie) calorie := new(models.Calorie)
exist, err := models.Get(calorie, calorieId) exist, err := models.Get(calorie, calorieId)
@ -42,7 +42,7 @@ func (t *CalorieCtl) Ready() {
// 开始, 加一个开始时间 // 开始, 加一个开始时间
func (t *CalorieCtl) Start() { func (t *CalorieCtl) Start() {
calorieId := t.MustGetInt64("calorie_id")
calorieId := t.MustGetInt("calorie_id")
calorie := new(models.Calorie) calorie := new(models.Calorie)
exist, err := models.Get(calorie, calorieId) exist, err := models.Get(calorie, calorieId)
@ -64,7 +64,7 @@ func (t *CalorieCtl) Start() {
// 彩排活动需要恢复 // 彩排活动需要恢复
func (t *CalorieCtl) Stop() { func (t *CalorieCtl) Stop() {
calorieId := t.MustGetInt64("calorie_id")
calorieId := t.MustGetInt("calorie_id")
calorie := new(models.Calorie) calorie := new(models.Calorie)
exist, err := models.Get(calorie, calorieId) exist, err := models.Get(calorie, calorieId)
@ -86,7 +86,7 @@ func (t *CalorieCtl) Stop() {
// 列出轮次, 包括倒计时 // 列出轮次, 包括倒计时
func (t *CalorieCtl) List() { func (t *CalorieCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
calories, err := models.GetCaloriesByActivityId(activityId) calories, err := models.GetCaloriesByActivityId(activityId)
t.CheckErr(err) t.CheckErr(err)
t.JSON(map[string]interface{}{ t.JSON(map[string]interface{}{
@ -97,9 +97,9 @@ func (t *CalorieCtl) List() {
// 二维码 // 二维码
func (t *CalorieCtl) Qrcode() { func (t *CalorieCtl) Qrcode() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
calorieId := t.MustGetInt64("calorie_id")
calorieId := t.MustGetInt("calorie_id")
area := new(models.AreaStore) area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid, activityId) exist, err := area.GetByCustomerId(uid, activityId)
@ -120,8 +120,8 @@ func (t *CalorieCtl) Qrcode() {
// 统计一些数据, 包括参与人数, 包括当前排名 // 统计一些数据, 包括参与人数, 包括当前排名
func (t *CalorieCtl) Count() { func (t *CalorieCtl) Count() {
activityId := t.MustGetInt64("activity_id")
calorieId := t.MustGetInt64("calorie_id")
activityId := t.MustGetInt("activity_id")
calorieId := t.MustGetInt("calorie_id")
limit := t.DefaultInt("limit", 10) limit := t.DefaultInt("limit", 10)
activity := new(models.Activity) activity := new(models.Activity)

4
controllers/pc/login.go

@ -14,7 +14,7 @@ import (
"hudongzhuanjia/libs/qq" "hudongzhuanjia/libs/qq"
"hudongzhuanjia/libs/wx" "hudongzhuanjia/libs/wx"
"hudongzhuanjia/models" "hudongzhuanjia/models"
"hudongzhuanjia/services/activity"
activity_service "hudongzhuanjia/services/activity"
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
) )
@ -62,7 +62,7 @@ func (t *UserCtl) Checkin() {
// debug // debug
func (t *UserCtl) DebugLogin() { func (t *UserCtl) DebugLogin() {
customerId := t.DefaultInt64("customer_id", 1)
customerId := t.DefaultInt("customer_id", 1)
customer := new(models.Customer) customer := new(models.Customer)
exist, err := models.Get(customer, customerId) exist, err := models.Get(customer, customerId)
t.CheckErr(err) t.CheckErr(err)

38
controllers/pc/lottery_draw.go

@ -19,8 +19,8 @@ type LotteryDrawCtl struct {
//开始抽奖 //开始抽奖
func (t *LotteryDrawCtl) Start() { func (t *LotteryDrawCtl) Start() {
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
activityId := t.MustGetInt64("activity_id")
ladderId := t.MustGetInt("lottery_draw_ladder_id")
activityId := t.MustGetInt("activity_id")
ladder := new(models.LotteryDrawRuleLadder) ladder := new(models.LotteryDrawRuleLadder)
exist, err := models.Get(ladder, ladderId) exist, err := models.Get(ladder, ladderId)
@ -61,9 +61,9 @@ func (t *LotteryDrawCtl) Start() {
// 滚动 // 滚动
func (t *LotteryDrawCtl) StartRoll() { func (t *LotteryDrawCtl) StartRoll() {
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
activityId := t.MustGetInt64("activity_id")
num := t.MustGetInt64("num")
ladderId := t.MustGetInt("lottery_draw_ladder_id")
activityId := t.MustGetInt("activity_id")
num := t.MustGetInt("num")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -102,9 +102,9 @@ func (t *LotteryDrawCtl) StartRoll() {
} }
func (t *LotteryDrawCtl) StopRoll() { func (t *LotteryDrawCtl) StopRoll() {
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
activityId := t.MustGetInt64("activity_id")
num := t.MustGetInt64("num")
ladderId := t.MustGetInt("lottery_draw_ladder_id")
activityId := t.MustGetInt("activity_id")
num := t.MustGetInt("num")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -138,8 +138,8 @@ func (t *LotteryDrawCtl) StopRoll() {
//停止抽奖 //停止抽奖
func (t *LotteryDrawCtl) Stop() { func (t *LotteryDrawCtl) Stop() {
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
activityId := t.MustGetInt64("activity_id")
ladderId := t.MustGetInt("lottery_draw_ladder_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -177,7 +177,7 @@ func (t *LotteryDrawCtl) Stop() {
//获取所有抽奖活动列表 //获取所有抽奖活动列表
func (t *LotteryDrawCtl) List() { func (t *LotteryDrawCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
customerId := t.GetAccountId() customerId := t.GetAccountId()
customer := new(models.Customer) customer := new(models.Customer)
@ -200,7 +200,7 @@ func (t *LotteryDrawCtl) List() {
//抽奖奖品 //抽奖奖品
func (t *LotteryDrawCtl) Prize() { func (t *LotteryDrawCtl) Prize() {
ruleId := t.MustGetInt64("lottery_draw_rule_id")
ruleId := t.MustGetInt("lottery_draw_rule_id")
list, err := models.GetLotteryDrawLadderByRuleId(ruleId) list, err := models.GetLotteryDrawLadderByRuleId(ruleId)
t.CheckErr(err) t.CheckErr(err)
@ -216,8 +216,8 @@ func (t *LotteryDrawCtl) Prize() {
// 抽奖用户 // 抽奖用户
func (t *LotteryDrawCtl) Users() { func (t *LotteryDrawCtl) Users() {
activityId := t.MustGetInt64("activity_id")
ruleId := t.MustGetInt64("lottery_draw_rule_id")
activityId := t.MustGetInt("activity_id")
ruleId := t.MustGetInt("lottery_draw_rule_id")
customerId := t.GetAccountId() customerId := t.GetAccountId()
//customer := new(models.Customer) //customer := new(models.Customer)
@ -238,7 +238,7 @@ func (t *LotteryDrawCtl) Users() {
moduleService, exist, err := activity_service.GetModuleService(define.MODULE_LOTTERY, activityId) moduleService, exist, err := activity_service.GetModuleService(define.MODULE_LOTTERY, activityId)
t.CheckErr(err) t.CheckErr(err)
t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "活动模块不存在") t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "活动模块不存在")
recordIds := make([]int64, 0)
recordIds := make([]int, 0)
if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT { if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT {
// 去重标志 // 去重标志
recordIds, err = models.GetUserIdsByLotteryDrawRuleId(ruleId, activity.RehearsalId, area.Id, activity.ArchId) recordIds, err = models.GetUserIdsByLotteryDrawRuleId(ruleId, activity.RehearsalId, area.Id, activity.ArchId)
@ -255,9 +255,9 @@ func (t *LotteryDrawCtl) Users() {
//抽奖动作 //抽奖动作
func (t *LotteryDrawCtl) Lottery() { func (t *LotteryDrawCtl) Lottery() {
activityId := t.MustGetInt64("activity_id")
ruleId := t.MustGetInt64("lottery_draw_rule_id")
ladderId := t.MustGetInt64("lottery_draw_ladder_id")
activityId := t.MustGetInt("activity_id")
ruleId := t.MustGetInt("lottery_draw_rule_id")
ladderId := t.MustGetInt("lottery_draw_ladder_id")
number := t.MustGetInt("number") // 奖品数量 number := t.MustGetInt("number") // 奖品数量
customerId := t.GetAccountId() customerId := t.GetAccountId()
@ -379,7 +379,7 @@ func (t *LotteryDrawCtl) Lottery() {
//获取中奖名单 //获取中奖名单
func (t *LotteryDrawCtl) ListOfWinners() { func (t *LotteryDrawCtl) ListOfWinners() {
ruleId := t.MustGetInt64("lottery_draw_rule_id")
ruleId := t.MustGetInt("lottery_draw_rule_id")
rule := &models.LotteryDrawRule{} rule := &models.LotteryDrawRule{}
exist, err := models.Get(rule, ruleId) exist, err := models.Get(rule, ruleId)

53
controllers/pc/order_draw.go

@ -2,7 +2,6 @@ package pc
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/models" "hudongzhuanjia/models"
activity_service "hudongzhuanjia/services/activity" activity_service "hudongzhuanjia/services/activity"
@ -11,6 +10,8 @@ import (
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
// 订单 // 订单
@ -20,7 +21,7 @@ type OrderDrawCtl struct {
// 开启订单活动 // 开启订单活动
func (t *OrderDrawCtl) Switch() { func (t *OrderDrawCtl) Switch() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
status := t.MustGetInt("status") status := t.MustGetInt("status")
activity := models.Activity{} activity := models.Activity{}
@ -48,7 +49,7 @@ func (t *OrderDrawCtl) Switch() {
// 开始抽奖 // 开始抽奖
func (t *OrderDrawCtl) Start() { func (t *OrderDrawCtl) Start() {
ladderId := t.MustGetInt64("order_draw_ladder_id")
ladderId := t.MustGetInt("order_draw_ladder_id")
ladder := new(models.OrderDrawRuleLadder) ladder := new(models.OrderDrawRuleLadder)
exist, err := models.Get(ladder, ladderId) exist, err := models.Get(ladder, ladderId)
@ -70,7 +71,7 @@ func (t *OrderDrawCtl) Start() {
// 开始抽奖 // 开始抽奖
func (t *OrderDrawCtl) Stop() { func (t *OrderDrawCtl) Stop() {
ladderId := t.MustGetInt64("order_draw_ladder_id")
ladderId := t.MustGetInt("order_draw_ladder_id")
ladder := new(models.OrderDrawRuleLadder) ladder := new(models.OrderDrawRuleLadder)
exist, err := models.Get(ladder, ladderId) exist, err := models.Get(ladder, ladderId)
@ -92,24 +93,24 @@ func (t *OrderDrawCtl) Stop() {
} }
type OrderListResult struct { type OrderListResult struct {
OrderDrawActivityId int64 `json:"order_draw_activity_id"`
OrderDrawRuleId int64 `json:"order_draw_rule_id"`
OrderDrawActivityId int `json:"order_draw_activity_id"`
OrderDrawRuleId int `json:"order_draw_rule_id"`
OrderDrawActivityName string `json:"order_draw_activity_name"` OrderDrawActivityName string `json:"order_draw_activity_name"`
OrderDrawLadders []*OrderLadderResult `json:"order_draw_ladders"` OrderDrawLadders []*OrderLadderResult `json:"order_draw_ladders"`
PrizeNumber int64 `json:"prize_number"`
PrizeNumber int `json:"prize_number"`
} }
type OrderLadderResult struct { type OrderLadderResult struct {
OrderDrawRuleId int64 `json:"order_draw_rule_id"`
OrderDrawLadderId int64 `json:"order_draw_ladder_id"`
OrderDrawRuleId int `json:"order_draw_rule_id"`
OrderDrawLadderId int `json:"order_draw_ladder_id"`
PrizeName string `json:"prize_name"` PrizeName string `json:"prize_name"`
Status string `json:"status"` Status string `json:"status"`
PrizeImg string `json:"prize_img"` PrizeImg string `json:"prize_img"`
PrizeNumber int64 `json:"prize_number"`
PrizeNumber int `json:"prize_number"`
} }
//获取所有订单奖品 //获取所有订单奖品
func (t *OrderDrawCtl) List() { func (t *OrderDrawCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
customerId := t.GetAccountId() customerId := t.GetAccountId()
// //
area := &models.AreaStore{} area := &models.AreaStore{}
@ -135,7 +136,7 @@ func (t *OrderDrawCtl) List() {
"a.id=r.order_draw_activity_id and r.is_delete=0"). "a.id=r.order_draw_activity_id and r.is_delete=0").
Where("a.is_delete=0 and a.activity_id=?", activityId).Find(&result) Where("a.is_delete=0 and a.activity_id=?", activityId).Find(&result)
ruleIds := make([]int64, 0)
ruleIds := make([]int, 0)
for _, v := range result { for _, v := range result {
ruleIds = append(ruleIds, v.OrderDrawRuleId) ruleIds = append(ruleIds, v.OrderDrawRuleId)
} }
@ -146,12 +147,12 @@ func (t *OrderDrawCtl) List() {
Where("is_delete=0").In("order_draw_rule_id", ruleIds).Find(&ladders) Where("is_delete=0").In("order_draw_rule_id", ruleIds).Find(&ladders)
t.CheckErr(err) t.CheckErr(err)
ladderIds := make([]int64, 0)
ladderIds := make([]int, 0)
for _, ladder := range ladders { for _, ladder := range ladders {
ladderIds = append(ladderIds, ladder.OrderDrawLadderId) ladderIds = append(ladderIds, ladder.OrderDrawLadderId)
} }
records := make([]map[string]int64, 0)
records := make([]map[string]int, 0)
err = core.GetXormAuto().Table(new(models.OrderDrawRecord)).Alias("r"). err = core.GetXormAuto().Table(new(models.OrderDrawRecord)).Alias("r").
Select("r.order_draw_rule_ladder_id as ladder_id, count(id) as num"). Select("r.order_draw_rule_ladder_id as ladder_id, count(id) as num").
Where("is_delete=0 and rehearsal_id=? and arch_id=? and area_id=?", Where("is_delete=0 and rehearsal_id=? and arch_id=? and area_id=?",
@ -185,7 +186,7 @@ func (t *OrderDrawCtl) List() {
//抽奖奖品 //抽奖奖品
func (t *OrderDrawCtl) Prize() { func (t *OrderDrawCtl) Prize() {
ruleId := t.MustGetInt64("order_draw_rule_id")
ruleId := t.MustGetInt("order_draw_rule_id")
list := make([]*models.OrderDrawRuleLadder, 0) list := make([]*models.OrderDrawRuleLadder, 0)
err := core.GetXormAuto().Where("is_delete=0 and order_draw_rule_id=?", ruleId).Find(&list) err := core.GetXormAuto().Where("is_delete=0 and order_draw_rule_id=?", ruleId).Find(&list)
@ -201,15 +202,15 @@ func (t *OrderDrawCtl) Prize() {
} }
type OrderUsersResult struct { type OrderUsersResult struct {
UserId int64 `json:"user_id"`
UserId int `json:"user_id"`
Username string `json:"username"` Username string `json:"username"`
Avatar string `json:"avatar"` Avatar string `json:"avatar"`
} }
//统计人数和订单数量 //统计人数和订单数量
func (t *OrderDrawCtl) Users() { func (t *OrderDrawCtl) Users() {
activityId := t.MustGetInt64("activity_id")
ruleId := t.MustGetInt64("order_draw_rule_id")
activityId := t.MustGetInt("activity_id")
ruleId := t.MustGetInt("order_draw_rule_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -227,7 +228,7 @@ func (t *OrderDrawCtl) Users() {
t.CheckErr(err) t.CheckErr(err)
t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "模块服务不存在") t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "模块服务不存在")
if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT { if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT {
recordIds := make([]int64, 0)
recordIds := make([]int, 0)
err = core.GetXormAuto().Table(new(models.OrderDrawRecord)).Select("user_id"). err = core.GetXormAuto().Table(new(models.OrderDrawRecord)).Select("user_id").
Where("order_draw_rule_id=? and rehearsal_id=? and arch_id=? and is_delete=0", Where("order_draw_rule_id=? and rehearsal_id=? and arch_id=? and is_delete=0",
ruleId, activity.RehearsalId, activity.ArchId).Find(&recordIds) ruleId, activity.RehearsalId, activity.ArchId).Find(&recordIds)
@ -245,9 +246,9 @@ func (t *OrderDrawCtl) Users() {
// 订单抽奖动作 // 订单抽奖动作
func (t *OrderDrawCtl) Draw() { func (t *OrderDrawCtl) Draw() {
activityId := t.MustGetInt64("activity_id")
ruleId := t.MustGetInt64("order_draw_rule_id")
ladderId := t.MustGetInt64("order_draw_rule_ladder_id")
activityId := t.MustGetInt("activity_id")
ruleId := t.MustGetInt("order_draw_rule_id")
ladderId := t.MustGetInt("order_draw_rule_ladder_id")
number := t.MustGetInt("number") number := t.MustGetInt("number")
customerId := t.GetAccountId() customerId := t.GetAccountId()
@ -342,7 +343,7 @@ func (t *OrderDrawCtl) Draw() {
} }
type WinnerResult struct { type WinnerResult struct {
UserId int64 `json:"user_id"`
UserId int `json:"user_id"`
Username string `json:"user_name"` Username string `json:"user_name"`
UserPhone string `json:"user_phone"` UserPhone string `json:"user_phone"`
Avatar string `json:"avatar"` Avatar string `json:"avatar"`
@ -350,7 +351,7 @@ type WinnerResult struct {
} }
func (t *OrderDrawCtl) ListOfWinners() { func (t *OrderDrawCtl) ListOfWinners() {
ruleId := t.MustGetInt64("order_draw_rule_id")
ruleId := t.MustGetInt("order_draw_rule_id")
rule := &models.OrderDrawRule{} rule := &models.OrderDrawRule{}
exist, err := models.Get(rule, ruleId) exist, err := models.Get(rule, ruleId)
@ -378,7 +379,7 @@ func (t *OrderDrawCtl) ListOfWinners() {
// 获取所有订单 // 获取所有订单
type OrdersResult struct { type OrdersResult struct {
UserId int64 `json:"user_id"`
UserId int `json:"user_id"`
AreaName string `json:"area_name"` AreaName string `json:"area_name"`
GoodsName string `json:"goods_name"` GoodsName string `json:"goods_name"`
Nickname string `json:"nickname"` Nickname string `json:"nickname"`
@ -387,7 +388,7 @@ type OrdersResult struct {
} }
func (t *OrderDrawCtl) Orders() { func (t *OrderDrawCtl) Orders() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := &models.Activity{} activity := &models.Activity{}
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)

12
controllers/pc/reward.go

@ -6,7 +6,7 @@ import (
"hudongzhuanjia/models" "hudongzhuanjia/models"
bully_reward_service "hudongzhuanjia/services/bully_reward" bully_reward_service "hudongzhuanjia/services/bully_reward"
im_service "hudongzhuanjia/services/im" im_service "hudongzhuanjia/services/im"
"hudongzhuanjia/services/pay"
pay_service "hudongzhuanjia/services/pay"
"hudongzhuanjia/utils" "hudongzhuanjia/utils"
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"strings" "strings"
@ -19,7 +19,7 @@ type RewardCtl struct {
//获取最新的打赏记录 //获取最新的打赏记录
func (t *RewardCtl) Latest() { func (t *RewardCtl) Latest() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := &models.Activity{} activity := &models.Activity{}
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -52,7 +52,7 @@ func (t *RewardCtl) Latest() {
//获取待审核列表 //获取待审核列表
func (t *RewardCtl) WaitReview() { func (t *RewardCtl) WaitReview() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := &models.Activity{} activity := &models.Activity{}
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -140,7 +140,7 @@ func (t *RewardCtl) Review() {
//获取打赏得总金额 //获取打赏得总金额
func (t *RewardCtl) Amount() { func (t *RewardCtl) Amount() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -163,7 +163,7 @@ func (t *RewardCtl) Amount() {
// 黑名单 // 黑名单
func (t *RewardCtl) Blacklist() { func (t *RewardCtl) Blacklist() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -189,7 +189,7 @@ func (t *RewardCtl) Blacklist() {
// 开启打赏 // 开启打赏
func (t *RewardCtl) Details() { func (t *RewardCtl) Details() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
server := new(models.RewardServer) server := new(models.RewardServer)
exist, err := server.GetByActivityId(activityId) exist, err := server.GetByActivityId(activityId)
t.CheckErr(err) t.CheckErr(err)

27
controllers/pc/shake_red_envelope.go

@ -2,7 +2,6 @@ package pc
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/models" "hudongzhuanjia/models"
im_service "hudongzhuanjia/services/im" im_service "hudongzhuanjia/services/im"
@ -11,6 +10,8 @@ import (
"hudongzhuanjia/utils/code" "hudongzhuanjia/utils/code"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
type ShakeRedEnvelopeCtl struct { type ShakeRedEnvelopeCtl struct {
@ -18,7 +19,7 @@ type ShakeRedEnvelopeCtl struct {
} }
func (t *ShakeRedEnvelopeCtl) Ready() { func (t *ShakeRedEnvelopeCtl) Ready() {
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
ruleId := t.MustGetInt("shake_red_envelope_rule_id")
rule := new(models.ShakeRedEnvelopeRule) rule := new(models.ShakeRedEnvelopeRule)
exist, err := models.Get(rule, ruleId) exist, err := models.Get(rule, ruleId)
@ -38,7 +39,7 @@ func (t *ShakeRedEnvelopeCtl) Ready() {
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在")
t.CheckRunning(activity.Status) t.CheckRunning(activity.Status)
sids := make([]int64, 0)
sids := make([]int, 0)
err = core.GetXormAuto().Table(new(models.ShakeRedEnvelopeActivity)).Select("id"). err = core.GetXormAuto().Table(new(models.ShakeRedEnvelopeActivity)).Select("id").
Where("is_delete=0 and activity_id=?", activity.Id).Find(&sids) Where("is_delete=0 and activity_id=?", activity.Id).Find(&sids)
t.CheckErr(err) t.CheckErr(err)
@ -53,7 +54,7 @@ func (t *ShakeRedEnvelopeCtl) Ready() {
//开始摇红包 //开始摇红包
func (t *ShakeRedEnvelopeCtl) Start() { func (t *ShakeRedEnvelopeCtl) Start() {
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
ruleId := t.MustGetInt("shake_red_envelope_rule_id")
uid := t.GetAccountId() uid := t.GetAccountId()
//根据摇红包规则id查找该条记录并且更给状态 //根据摇红包规则id查找该条记录并且更给状态
@ -104,7 +105,7 @@ func (t *ShakeRedEnvelopeCtl) Start() {
//停止摇红包 //停止摇红包
func (t *ShakeRedEnvelopeCtl) Stop() { func (t *ShakeRedEnvelopeCtl) Stop() {
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
ruleId := t.MustGetInt("shake_red_envelope_rule_id")
uid := t.GetAccountId() uid := t.GetAccountId()
rule := new(models.ShakeRedEnvelopeRule) rule := new(models.ShakeRedEnvelopeRule)
@ -145,7 +146,7 @@ func (t *ShakeRedEnvelopeCtl) Stop() {
} }
func (t *ShakeRedEnvelopeCtl) List() { func (t *ShakeRedEnvelopeCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
customerId := t.GetAccountId() customerId := t.GetAccountId()
area := new(models.AreaStore) area := new(models.AreaStore)
@ -162,7 +163,7 @@ func (t *ShakeRedEnvelopeCtl) List() {
list := make([]*models.ShakeRedEnvelopeActivity, 0) list := make([]*models.ShakeRedEnvelopeActivity, 0)
total, err := core.GetXormAuto().Where("is_delete=0 and is_pay=1 and activity_id=?", activityId).FindAndCount(&list) total, err := core.GetXormAuto().Where("is_delete=0 and is_pay=1 and activity_id=?", activityId).FindAndCount(&list)
t.CheckErr(err) t.CheckErr(err)
aIds := make([]int64, 0)
aIds := make([]int, 0)
for _, v := range list { for _, v := range list {
aIds = append(aIds, v.Id) aIds = append(aIds, v.Id)
} }
@ -170,7 +171,7 @@ func (t *ShakeRedEnvelopeCtl) List() {
rules := make([]*models.ShakeRedEnvelopeRule, 0) rules := make([]*models.ShakeRedEnvelopeRule, 0)
err = core.GetXormAuto().Where("is_delete=0 and area_id=?", area.Id).In("shake_red_envelope_activity_id", aIds).Find(&rules) err = core.GetXormAuto().Where("is_delete=0 and area_id=?", area.Id).In("shake_red_envelope_activity_id", aIds).Find(&rules)
t.CheckErr(err) t.CheckErr(err)
rIds := make([]int64, 0)
rIds := make([]int, 0)
for _, v := range rules { for _, v := range rules {
rIds = append(rIds, v.Id) rIds = append(rIds, v.Id)
} }
@ -204,10 +205,10 @@ func (t *ShakeRedEnvelopeCtl) List() {
//二维码 //二维码
func (t *ShakeRedEnvelopeCtl) Qrcode() { func (t *ShakeRedEnvelopeCtl) Qrcode() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
customerId := t.GetAccountId() customerId := t.GetAccountId()
rehearsalId := t.MustGetInt64("rehearsal_id")
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
rehearsalId := t.MustGetInt("rehearsal_id")
ruleId := t.MustGetInt("shake_red_envelope_rule_id")
area := new(models.AreaStore) area := new(models.AreaStore)
exist, err := area.GetByCustomerId(customerId, activityId) exist, err := area.GetByCustomerId(customerId, activityId)
@ -235,7 +236,7 @@ type ShakeRedEnvelopeRecordAndUser struct {
// 参数优化 // 参数优化
func (t *ShakeRedEnvelopeCtl) Winners() { func (t *ShakeRedEnvelopeCtl) Winners() {
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
ruleId := t.MustGetInt("shake_red_envelope_rule_id")
rule := &models.ShakeRedEnvelopeRule{} rule := &models.ShakeRedEnvelopeRule{}
exist, err := models.Get(rule, ruleId) exist, err := models.Get(rule, ruleId)
@ -266,7 +267,7 @@ func (t *ShakeRedEnvelopeCtl) Winners() {
// 统计摇红包参与人数和剩余红包数量 // 统计摇红包参与人数和剩余红包数量
func (t *ShakeRedEnvelopeCtl) Count() { func (t *ShakeRedEnvelopeCtl) Count() {
ruleId := t.MustGetInt64("shake_red_envelope_rule_id")
ruleId := t.MustGetInt("shake_red_envelope_rule_id")
rule := new(models.ShakeRedEnvelopeRule) rule := new(models.ShakeRedEnvelopeRule)
exist, err := models.Get(rule, ruleId) exist, err := models.Get(rule, ruleId)

12
controllers/pc/sign.go

@ -18,9 +18,9 @@ type SignCtl struct {
//获取二维码 //获取二维码
func (t *SignCtl) Qrcode() { func (t *SignCtl) Qrcode() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
signUpId := t.MustGetInt64("sign_rule_id")
signUpId := t.MustGetInt("sign_rule_id")
area := new(models.AreaStore) area := new(models.AreaStore)
exist, err := area.GetByCustomerId(uid, activityId) exist, err := area.GetByCustomerId(uid, activityId)
@ -44,7 +44,7 @@ func (t *SignCtl) Qrcode() {
//获取签到模式 //获取签到模式
func (t *SignCtl) Mode() { func (t *SignCtl) Mode() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
//通过activity_id查询ox_sign_rule的id //通过activity_id查询ox_sign_rule的id
signUp := new(models.SignUp) signUp := new(models.SignUp)
@ -56,7 +56,7 @@ func (t *SignCtl) Mode() {
} }
func (t *SignCtl) List() { func (t *SignCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
signUps := make([]*models.SignUp, 0) signUps := make([]*models.SignUp, 0)
err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId). err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).
Asc("created_at").Find(&signUps) Asc("created_at").Find(&signUps)
@ -74,7 +74,7 @@ type SignResult struct {
//处理签到信息 //处理签到信息
func (t *SignCtl) SignInfo() { func (t *SignCtl) SignInfo() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := &models.Activity{} activity := &models.Activity{}
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -101,7 +101,7 @@ func (t *SignCtl) SignInfo() {
// 实名签到信息 // 实名签到信息
func (t *SignCtl) RealSignInfo() { func (t *SignCtl) RealSignInfo() {
aid := t.MustGetInt64("activity_id")
aid := t.MustGetInt("activity_id")
activity := &models.Activity{} activity := &models.Activity{}
exist, err := models.Get(activity, aid) exist, err := models.Get(activity, aid)

22
controllers/pc/tug_war.go

@ -17,7 +17,7 @@ type TugOfWarCtl struct {
} }
func (t *TugOfWarCtl) Ready() { // 准备中 func (t *TugOfWarCtl) Ready() { // 准备中
baheId := t.MustGetInt64("bahe_activity_id")
baheId := t.MustGetInt("bahe_activity_id")
bahe := new(models.TugOfWar) bahe := new(models.TugOfWar)
exist, err := models.Get(bahe, baheId) exist, err := models.Get(bahe, baheId)
@ -67,7 +67,7 @@ func (t *TugOfWarCtl) Ready() { // 准备中
} }
func (t *TugOfWarCtl) Start() { func (t *TugOfWarCtl) Start() {
baheId := t.MustGetInt64("bahe_activity_id")
baheId := t.MustGetInt("bahe_activity_id")
bahe := new(models.TugOfWar) bahe := new(models.TugOfWar)
exist, err := models.Get(bahe, baheId) exist, err := models.Get(bahe, baheId)
@ -83,7 +83,7 @@ func (t *TugOfWarCtl) Start() {
} }
func (t *TugOfWarCtl) Stop() { func (t *TugOfWarCtl) Stop() {
baheId := t.MustGetInt64("bahe_activity_id")
baheId := t.MustGetInt("bahe_activity_id")
bahe := new(models.TugOfWar) bahe := new(models.TugOfWar)
exist, err := models.Get(bahe, baheId) exist, err := models.Get(bahe, baheId)
@ -101,7 +101,7 @@ func (t *TugOfWarCtl) Stop() {
} }
func (t *TugOfWarCtl) Team() { func (t *TugOfWarCtl) Team() {
baheId := t.MustGetInt64("bahe_activity_id")
baheId := t.MustGetInt("bahe_activity_id")
customerId := t.GetAccountId() customerId := t.GetAccountId()
customer := new(models.Customer) customer := new(models.Customer)
@ -175,7 +175,7 @@ func (t *TugOfWarCtl) Team() {
} }
func (t *TugOfWarCtl) Member() { func (t *TugOfWarCtl) Member() {
baheId := t.MustGetInt64("bahe_activity_id")
baheId := t.MustGetInt("bahe_activity_id")
bahe := &models.TugOfWar{} bahe := &models.TugOfWar{}
exist, err := models.Get(bahe, baheId) exist, err := models.Get(bahe, baheId)
@ -209,16 +209,16 @@ func (t *TugOfWarCtl) Member() {
} }
type BaheScoreResult struct { type BaheScoreResult struct {
TotalScore int64 `json:"total_score" description:"总分数"`
Id int64 `json:"id" description:"id"`
ActivityId int64 `json:"activity_id" description:"活动id"`
BaheActivityId int64 `json:"bahe_activity_id" description:"拔河活动id"`
TotalScore int `json:"total_score" description:"总分数"`
Id int `json:"id" description:"id"`
ActivityId int `json:"activity_id" description:"活动id"`
BaheActivityId int `json:"bahe_activity_id" description:"拔河活动id"`
BaheTeamName string `json:"bahe_team_name" description:"拔河队伍得名称"` BaheTeamName string `json:"bahe_team_name" description:"拔河队伍得名称"`
Members []*models.BaheTeamMember `json:"members"` Members []*models.BaheTeamMember `json:"members"`
} }
func (t *TugOfWarCtl) Score() { func (t *TugOfWarCtl) Score() {
baheId := t.MustGetInt64("bahe_activity_id")
baheId := t.MustGetInt("bahe_activity_id")
bahe := &models.TugOfWar{} bahe := &models.TugOfWar{}
exist, err := models.Get(bahe, baheId) exist, err := models.Get(bahe, baheId)
@ -254,7 +254,7 @@ func (t *TugOfWarCtl) Score() {
} }
func (t *TugOfWarCtl) List() { func (t *TugOfWarCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
bahes := make([]*models.TugOfWar, 0) bahes := make([]*models.TugOfWar, 0)
err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId). err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId).

12
controllers/pc/upper_wall.go

@ -24,7 +24,7 @@ type UpperWallResult struct {
//获取所有已审核的上墙消息 //获取所有已审核的上墙消息
func (t *UpperWallCtl) List() { func (t *UpperWallCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -47,7 +47,7 @@ func (t *UpperWallCtl) List() {
//获取待审核列表 //获取待审核列表
func (t *UpperWallCtl) WaitReview() { func (t *UpperWallCtl) WaitReview() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -126,7 +126,7 @@ func (t *UpperWallCtl) Review() {
//获取黑名单列表 //获取黑名单列表
func (t *UpperWallCtl) Blacklist() { func (t *UpperWallCtl) Blacklist() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -148,7 +148,7 @@ func (t *UpperWallCtl) Blacklist() {
//获取目前上墙得总条数 //获取目前上墙得总条数
func (t *UpperWallCtl) Total() { func (t *UpperWallCtl) Total() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -167,7 +167,7 @@ func (t *UpperWallCtl) Total() {
//二维码 //二维码
// 跳到主页 // 跳到主页
func (t *UpperWallCtl) Qrcode() { func (t *UpperWallCtl) Qrcode() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
activity := new(models.Activity) activity := new(models.Activity)
@ -194,7 +194,7 @@ func (t *UpperWallCtl) Qrcode() {
} }
func (t *UpperWallCtl) Details() { func (t *UpperWallCtl) Details() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
msgWall := new(models.MsgWallServer) msgWall := new(models.MsgWallServer)
exist, err := msgWall.GetByActivityId(activityId) exist, err := msgWall.GetByActivityId(activityId)
t.CheckErr(err) t.CheckErr(err)

21
controllers/pc/vote.go

@ -2,7 +2,6 @@ package pc
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/controllers" "hudongzhuanjia/controllers"
"hudongzhuanjia/models" "hudongzhuanjia/models"
"hudongzhuanjia/utils" "hudongzhuanjia/utils"
@ -10,6 +9,8 @@ import (
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"strconv" "strconv"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
type VoteCtl struct { type VoteCtl struct {
@ -18,8 +19,8 @@ type VoteCtl struct {
//二维码 //二维码
func (t *VoteCtl) Qrcode() { func (t *VoteCtl) Qrcode() {
activityId := t.MustGetInt64("activity_id")
voteActivityId := t.MustGetInt64("vote_activity_id")
activityId := t.MustGetInt("activity_id")
voteActivityId := t.MustGetInt("vote_activity_id")
uid := t.GetAccountId() uid := t.GetAccountId()
area := new(models.AreaStore) area := new(models.AreaStore)
@ -43,7 +44,7 @@ func (t *VoteCtl) Qrcode() {
// 装备数据 // 装备数据
func (t *VoteCtl) ReadyVote() { func (t *VoteCtl) ReadyVote() {
voteId := t.MustGetInt64("vote_activity_id")
voteId := t.MustGetInt("vote_activity_id")
vote := new(models.NewVoteActivity) vote := new(models.NewVoteActivity)
exist, err := models.Get(vote, voteId) exist, err := models.Get(vote, voteId)
t.CheckErr(err) t.CheckErr(err)
@ -74,7 +75,7 @@ func (t *VoteCtl) ReadyVote() {
//开始投票 //开始投票
func (t *VoteCtl) StartVote() { func (t *VoteCtl) StartVote() {
voteId := t.MustGetInt64("vote_activity_id")
voteId := t.MustGetInt("vote_activity_id")
vote := new(models.NewVoteActivity) vote := new(models.NewVoteActivity)
exist, err := models.Get(vote, voteId) exist, err := models.Get(vote, voteId)
t.CheckErr(err) t.CheckErr(err)
@ -98,7 +99,7 @@ func (t *VoteCtl) StartVote() {
//停止投票 //停止投票
func (t *VoteCtl) StopVote() { func (t *VoteCtl) StopVote() {
voteId := t.MustGetInt64("vote_activity_id")
voteId := t.MustGetInt("vote_activity_id")
vote := new(models.NewVoteActivity) vote := new(models.NewVoteActivity)
exist, err := models.Get(vote, voteId) exist, err := models.Get(vote, voteId)
@ -120,7 +121,7 @@ func (t *VoteCtl) StopVote() {
//获取参与人数 //获取参与人数
func (t *VoteCtl) JoinTotal() { func (t *VoteCtl) JoinTotal() {
voteActivityId := t.MustGetInt64("vote_activity_id")
voteActivityId := t.MustGetInt("vote_activity_id")
vote := models.NewVoteActivity{} vote := models.NewVoteActivity{}
exist, err := models.Get(vote, voteActivityId) exist, err := models.Get(vote, voteActivityId)
@ -141,7 +142,7 @@ func (t *VoteCtl) JoinTotal() {
//获取所有的投票活动 //获取所有的投票活动
func (t *VoteCtl) List() { func (t *VoteCtl) List() {
activityId := t.MustGetInt64("activity_id")
activityId := t.MustGetInt("activity_id")
activity := new(models.Activity) activity := new(models.Activity)
exist, err := models.Get(activity, activityId) exist, err := models.Get(activity, activityId)
@ -151,7 +152,7 @@ func (t *VoteCtl) List() {
votes, err := models.GetVoteListByActivityId(activityId, activity.ArchId) votes, err := models.GetVoteListByActivityId(activityId, activity.ArchId)
t.CheckErr(err) t.CheckErr(err)
ids := make([]int64, 0)
ids := make([]int, 0)
for _, v := range votes { for _, v := range votes {
ids = append(ids, v.Id) ids = append(ids, v.Id)
} }
@ -175,7 +176,7 @@ func (t *VoteCtl) List() {
//获取投票的前几(头像、姓名、票数) //获取投票的前几(头像、姓名、票数)
func (t *VoteCtl) History() { func (t *VoteCtl) History() {
voteId := t.MustGetInt64("vote_activity_id")
voteId := t.MustGetInt("vote_activity_id")
total := t.MustGetInt("total") total := t.MustGetInt("total")
ladders, err := models.GetNewVoteTopByVoteActivityId(voteId, total) ladders, err := models.GetNewVoteTopByVoteActivityId(voteId, total)

4
controllers/pc/ws.go

@ -16,7 +16,7 @@ type WsCtl struct {
// ws doc // ws doc
func (t *WsCtl) Ops() { func (t *WsCtl) Ops() {
customerId := t.GetAccountId() customerId := t.GetAccountId()
activityId, _ := t.GetInt64("activity_id")
activityId, _ := t.GetInt("activity_id")
customer := new(models.Customer) customer := new(models.Customer)
exist, err := models.Get(customer, customerId) exist, err := models.Get(customer, customerId)
t.CheckErr(err) t.CheckErr(err)
@ -47,7 +47,7 @@ func (t *WsCtl) Ops() {
// ws doc // ws doc
func (t *WsCtl) SaveOp() { func (t *WsCtl) SaveOp() {
customerId := t.MustGetInt64("customer_id")
customerId := t.MustGetInt("customer_id")
extraData := t.Default("extra_data", "") extraData := t.Default("extra_data", "")
op := &models.CustomerOperation{ op := &models.CustomerOperation{
CustomerId: customerId, CustomerId: customerId,

5
hdws/ws/client.go

@ -2,14 +2,15 @@ package ws
import ( import (
"encoding/json" "encoding/json"
"gopkg.in/olahol/melody.v1" "gopkg.in/olahol/melody.v1"
) )
type Client struct { type Client struct {
Id string // account_typ:account_id Id string // account_typ:account_id
AccountId int64
AccountId int
AccountType string AccountType string
Pid int64
Pid int
Online bool Online bool
RoomId string RoomId string
node *Node node *Node

12
hdws/ws/jwt_go.go

@ -11,15 +11,15 @@ import (
type Claims struct { type Claims struct {
AccountType string AccountType string
AccountId int64
CustomerId int64
CustomerPid int64
ActivityId int64
AreaId int64
AccountId int
CustomerId int
CustomerPid int
ActivityId int
AreaId int
jwt.StandardClaims jwt.StandardClaims
} }
func GenJwtToken(accountType string, accountId, customerId, customerPid, areaId, activityId int64) (string, error) {
func GenJwtToken(accountType string, accountId, customerId, customerPid, areaId, activityId int) (string, error) {
claims := Claims{ claims := Claims{
accountType, accountType,
accountId, accountId,

2
hdws/ws/message.go

@ -5,7 +5,7 @@ import "encoding/json"
type Message struct { type Message struct {
Type string `json:"type"` // 对应处理函数 / sync 同步函数,存入数据库 / msg 发送消息,不存入数据库 / login 登录校验某个客户是否存在 Type string `json:"type"` // 对应处理函数 / sync 同步函数,存入数据库 / msg 发送消息,不存入数据库 / login 登录校验某个客户是否存在
From string `json:"-"` // 发送方 ==> 自行处理, 无需发送 From string `json:"-"` // 发送方 ==> 自行处理, 无需发送
Dest int64 `json:"dest"` // 目标id / 0 代表所有 非0代表某一个
Dest int `json:"dest"` // 目标id / 0 代表所有 非0代表某一个
Tag string `json:"tag"` // 目标类型 customer代表客户 user代表用户 entry代表录入人员 Tag string `json:"tag"` // 目标类型 customer代表客户 user代表用户 entry代表录入人员
RoomId string `json:"room_id"` // 房间id // activity_id RoomId string `json:"room_id"` // 房间id // activity_id
Data map[string]interface{} `json:"data"` Data map[string]interface{} `json:"data"`

6
hdws/ws/timer.go

@ -50,10 +50,10 @@ func syncFunc(c *Client, msg *Message) {
op := &models.CustomerOperation{ op := &models.CustomerOperation{
CustomerId: c.AccountId, CustomerId: c.AccountId,
Operation: operation.(string), Operation: operation.(string),
AreaId: int64(areaId.(float64)),
ModuleActivityId: int64(moduleActivityId.(float64)),
AreaId: int(areaId.(float64)),
ModuleActivityId: int(moduleActivityId.(float64)),
ModuleActivityType: moduleActivityType.(string), ModuleActivityType: moduleActivityType.(string),
ActivityId: int64(activityId.(float64)),
ActivityId: int(activityId.(float64)),
ExtraData: string(extraData), ExtraData: string(extraData),
UpdatedAt: time.Now(), UpdatedAt: time.Now(),
CreatedAt: time.Now(), CreatedAt: time.Now(),

12
libs/jwt/jwt_go.go

@ -11,15 +11,15 @@ import (
type Claims struct { type Claims struct {
AccountType string AccountType string
AccountId int64
CustomerId int64
CustomerPid int64
ActivityId int64
AreaId int64
AccountId int
CustomerId int
CustomerPid int
ActivityId int
AreaId int
jwt.StandardClaims jwt.StandardClaims
} }
func GenJwtToken(accountType string, accountId, customerId, customerPid, areaId, activityId int64) (string, error) {
func GenJwtToken(accountType string, accountId, customerId, customerPid, areaId, activityId int) (string, error) {
claims := Claims{ claims := Claims{
accountType, accountType,
accountId, accountId,

5
libs/qq/qq.go

@ -3,10 +3,11 @@ package qq
import ( import (
"encoding/json" "encoding/json"
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/helper"
"io/ioutil" "io/ioutil"
"net/http" "net/http"
"net/url" "net/url"
"github.com/ouxuanserver/osmanthuswine/src/helper"
) )
var ( var (
@ -49,7 +50,7 @@ func GetUserInfoUrl(accessToken, openid string) string {
type Token struct { type Token struct {
AccessToken string `json:"access_token"` AccessToken string `json:"access_token"`
ExpiresIn int64 `json:"expires_in"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"` RefreshToken string `json:"refresh_token"`
} }

7
libs/wx/wx.go

@ -2,10 +2,11 @@ package wx
import ( import (
"fmt" "fmt"
"github.com/kirinlabs/HttpRequest"
"github.com/ouxuanserver/osmanthuswine/src/helper"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"net/url" "net/url"
"github.com/kirinlabs/HttpRequest"
"github.com/ouxuanserver/osmanthuswine/src/helper"
) )
func GetCodeUrl() string { func GetCodeUrl() string {
@ -41,7 +42,7 @@ func GetTicketTokenUrl() string {
type Token struct { type Token struct {
AccessToken string `json:"access_token"` AccessToken string `json:"access_token"`
ExpiresIn int64 `json:"expires_in"`
ExpiresIn int `json:"expires_in"`
RefreshToken string `json:"refresh_token"` RefreshToken string `json:"refresh_token"`
Openid string `json:"openid"` Openid string `json:"openid"`
Scope string `json:"scope"` Scope string `json:"scope"`

15
models/CalorieUser.go

@ -1,20 +1,21 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const CalorieUserTableName = TableNamePrefix + "calorie_user" const CalorieUserTableName = TableNamePrefix + "calorie_user"
type CalorieUser struct { type CalorieUser struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
UserId int64 `json:"user_id" xorm:"not null comment('用户表id') INT(11)"`
CalorieId int64 `json:"calorie_id" xorm:"not null comment('calorie表id') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id') INT(11)"`
Score int64 `json:"score" xorm:"not null default(0) comment('分数') INT(11)"`
UserId int `json:"user_id" xorm:"not null comment('用户表id') INT(11)"`
CalorieId int `json:"calorie_id" xorm:"not null comment('calorie表id') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id') INT(11)"`
Score int `json:"score" xorm:"not null default(0) comment('分数') INT(11)"`
JoinTime int64 `json:"join_time" xorm:"not null default('0') comment('加入时间纳秒') VARCHAR(128)"` JoinTime int64 `json:"join_time" xorm:"not null default('0') comment('加入时间纳秒') VARCHAR(128)"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`

6
models/activity.go

@ -8,8 +8,8 @@ const ActivityTableName = TableNamePrefix + "activity"
//互动活动 //互动活动
type Activity struct { type Activity struct {
Id int64 `json:"id" xorm:"pk autoincr INT(11)"`
CustomerId int64 `json:"customer_id" xorm:"not null default(0) comment('customer_id, 创建客户id') INT(11)"`
Id int `json:"id" xorm:"pk autoincr INT(11)"`
CustomerId int `json:"customer_id" xorm:"not null default(0) comment('customer_id, 创建客户id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
Services []*ActivityModuleService `json:"services,omitempty" xorm:"-" description:"主活动下的服务"` Services []*ActivityModuleService `json:"services,omitempty" xorm:"-" description:"主活动下的服务"`
AreaStores []*AreaStore `json:"area_stores,omitempty" xorm:"-" description:"地区"` AreaStores []*AreaStore `json:"area_stores,omitempty" xorm:"-" description:"地区"`
@ -20,7 +20,7 @@ type Activity struct {
Name string `json:"name" xorm:"not null comment('主活动名字') VARCHAR(255)"` Name string `json:"name" xorm:"not null comment('主活动名字') VARCHAR(255)"`
Classification string `json:"classification" xorm:"not null comment('互动分类') VARCHAR(255)"` Classification string `json:"classification" xorm:"not null comment('互动分类') VARCHAR(255)"`
Status string `json:"status" xorm:"not null default('未开始') comment('状态[未开始,进行中,已结束]') VARCHAR(128)"` Status string `json:"status" xorm:"not null default('未开始') comment('状态[未开始,进行中,已结束]') VARCHAR(128)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('0正式、1彩排中的id') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('0正式、1彩排中的id') INT(11)"`
Province string `json:"province" xorm:"not null default('') comment('省') VARCHAR(128)" description:"省"` Province string `json:"province" xorm:"not null default('') comment('省') VARCHAR(128)" description:"省"`
City string `json:"city" xorm:"not null default('') comment('省') VARCHAR(128)" description:"市"` City string `json:"city" xorm:"not null default('') comment('省') VARCHAR(128)" description:"市"`
StartTime time.Time `json:"start_time" xorm:"not null default('1970-01-01 08:00:00') comment('互动开始时间') DATETIME"` StartTime time.Time `json:"start_time" xorm:"not null default('1970-01-01 08:00:00') comment('互动开始时间') DATETIME"`

10
models/activity_module_service.go

@ -10,16 +10,16 @@ const ActivityModuleServiceTableName = TableNamePrefix + "activity_module_servic
//活动模块服务 //活动模块服务
type ActivityModuleService struct { type ActivityModuleService struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id') INT(11)"`
ServiceModuleHistoryId int64 `json:"service_module_history_id" xorm:"not null comment('service_module_history表id') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('主活动id') INT(11)"`
ServiceModuleHistoryId int `json:"service_module_history_id" xorm:"not null comment('service_module_history表id') INT(11)"`
ServiceModuleName string `json:"service_module_name" xorm:"-" description:"模块服务名字"` ServiceModuleName string `json:"service_module_name" xorm:"-" description:"模块服务名字"`
ServiceModuleStatus string `json:"service_module_status" xorm:"not null default('关闭') comment('服务模块 免费开启。付费默认关闭。') VARCHAR(128)"` ServiceModuleStatus string `json:"service_module_status" xorm:"not null default('关闭') comment('服务模块 免费开启。付费默认关闭。') VARCHAR(128)"`
PhoneBgUrl string `json:"phone_bg_url" xorm:"not null default('') comment('服务模块的自定义手机屏的图片') VARCHAR(255)"` PhoneBgUrl string `json:"phone_bg_url" xorm:"not null default('') comment('服务模块的自定义手机屏的图片') VARCHAR(255)"`
PhoneBgSwitch string `json:"phone_bg_switch" xorm:"not null default('关闭') comment('模块手机的开关 开启|关闭') VARCHAR(11)"` PhoneBgSwitch string `json:"phone_bg_switch" xorm:"not null default('关闭') comment('模块手机的开关 开启|关闭') VARCHAR(11)"`
MaxBgUrl string `json:"max_bg_url" xorm:"not null default('') comment('服务模块的自定义大屏的图片') VARCHAR(255)"` MaxBgUrl string `json:"max_bg_url" xorm:"not null default('') comment('服务模块的自定义大屏的图片') VARCHAR(255)"`
MaxBgSwitch string `json:"max_bg_switch" xorm:"not null default('关闭') comment('模块大屏的开关 开启|关闭') VARCHAR(11)"` MaxBgSwitch string `json:"max_bg_switch" xorm:"not null default('关闭') comment('模块大屏的开关 开启|关闭') VARCHAR(11)"`
ModuleStyleId int64 `json:"module_style_id" xorm:"not null default(0) comment('每个模块对应的一个样式id 如果有的话') INT(11)"`
ModuleStyleId int `json:"module_style_id" xorm:"not null default(0) comment('每个模块对应的一个样式id 如果有的话') INT(11)"`
BesideRepeat string `json:"beside_repeat" xorm:"not null default('不去除') comment('是否去除重复') VARCHAR(11)"` BesideRepeat string `json:"beside_repeat" xorm:"not null default('不去除') comment('是否去除重复') VARCHAR(11)"`
ServiceModuleStartTime time.Time `json:"service_module_start_time" xorm:"not null default('1970-01-01 08:00:00') comment('服务开始时间') DATETIME"` ServiceModuleStartTime time.Time `json:"service_module_start_time" xorm:"not null default('1970-01-01 08:00:00') comment('服务开始时间') DATETIME"`
ServiceModuleEndTime time.Time `json:"service_module_end_time" xorm:"not null default('1970-01-01 08:00:00') comment('服务结束时间') DATETIME"` ServiceModuleEndTime time.Time `json:"service_module_end_time" xorm:"not null default('1970-01-01 08:00:00') comment('服务结束时间') DATETIME"`
@ -46,7 +46,7 @@ func (t *ActivityModuleService) Alias(name string) string {
} }
// //
//func (t *ActivityModuleService) GetByActivityIdAndHistoryId(aid, hid int64) (bool, error) {
//func (t *ActivityModuleService) GetByActivityIdAndHistoryId(aid, hid int) (bool, error) {
// return core.GetXormAuto().Where("is_delete=0 and activity_id=? and service_module_history_id=?", aid, hid).Get(t) // return core.GetXormAuto().Where("is_delete=0 and activity_id=? and service_module_history_id=?", aid, hid).Get(t)
//} //}

3
models/arch.go

@ -1,8 +1,9 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const ArchTableName = TableNamePrefix + "arch" const ArchTableName = TableNamePrefix + "arch"

12
models/area_store.go

@ -10,12 +10,12 @@ const AreaStoreTableName = TableNamePrefix + "area_store"
//店铺地区 //店铺地区
type AreaStore struct { type AreaStore struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Name string `json:"name" xorm:"not null default('') comment('名字') VARCHAR(255)"` Name string `json:"name" xorm:"not null default('') comment('名字') VARCHAR(255)"`
Type string `json:"type" xorm:"not null default('') comment('地区类型') VARCHAR(255)"` Type string `json:"type" xorm:"not null default('') comment('地区类型') VARCHAR(255)"`
Address string `json:"address" xorm:"not null default('') comment('地址') VARCHAR(255)"` Address string `json:"address" xorm:"not null default('') comment('地址') VARCHAR(255)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id') BIGINT(20)"`
CustomerId int64 `json:"customer_id" xorm:"not null default 0 comment('客户id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('主活动id') BIGINT(20)"`
CustomerId int `json:"customer_id" xorm:"not null default 0 comment('客户id') INT(11)"`
IsMainArea bool `json:"is_main_area" xorm:"not null default(0) comment('是否主地区1是') TINYINT(1)"` IsMainArea bool `json:"is_main_area" xorm:"not null default(0) comment('是否主地区1是') TINYINT(1)"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
@ -29,15 +29,15 @@ func (t *AreaStore) TableName() string {
func (t *AreaStore) GetByCustomerId(customerId, activityId interface{}) (bool, error) { func (t *AreaStore) GetByCustomerId(customerId, activityId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and customer_id=? and activity_id=?", customerId, activityId).Get(t) return core.GetXormAuto().Where("is_delete=0 and customer_id=? and activity_id=?", customerId, activityId).Get(t)
} }
func (t *AreaStore) GetAreaStoreById(id int64) (bool, error) {
func (t *AreaStore) GetAreaStoreById(id int) (bool, error) {
return core.GetXormAuto().Where("id=? and is_delete=0", id).Get(t) return core.GetXormAuto().Where("id=? and is_delete=0", id).Get(t)
} }
func (t *AreaStore) GetMainAreaById(aid int64) (bool, error) {
func (t *AreaStore) GetMainAreaById(aid int) (bool, error) {
return core.GetXormAuto().Where("activity_id=? and is_main_area=1 and is_delete=0", aid).Get(t) return core.GetXormAuto().Where("activity_id=? and is_main_area=1 and is_delete=0", aid).Get(t)
} }
func GetAreaStoresByActivityId(aid int64) ([]*AreaStore, error) {
func GetAreaStoresByActivityId(aid int) ([]*AreaStore, error) {
list := make([]*AreaStore, 0) list := make([]*AreaStore, 0)
err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Find(&list) err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Find(&list)
return list, err return list, err

4
models/auction_activity.go

@ -2,8 +2,8 @@ package models
//竞拍活动 //竞拍活动
//type AuctionActivity struct { //type AuctionActivity struct {
// Id int64 `json:"id"`
// ActivityId int64 `json:"activity_id" description:"活动的id"`
// Id int `json:"id"`
// ActivityId int `json:"activity_id" description:"活动的id"`
// AuctionActivityName string `json:"auction_activity_name" description:"竞拍名称"` // AuctionActivityName string `json:"auction_activity_name" description:"竞拍名称"`
// LatestMoney float64 `json:"latest_price" xorm:"-" description:"最新的竞拍叫价,通过查询AuctionHistory获得"` // LatestMoney float64 `json:"latest_price" xorm:"-" description:"最新的竞拍叫价,通过查询AuctionHistory获得"`
// MaxMoney float64 `json:"max_price" xorm:"-" description:"目前最高叫价,通过查询AuctionHistory获得"` // MaxMoney float64 `json:"max_price" xorm:"-" description:"目前最高叫价,通过查询AuctionHistory获得"`

4
models/auction_deal.go

@ -2,8 +2,8 @@ package models
//竞拍成交 //竞拍成交
//type AuctionDeal struct { //type AuctionDeal struct {
// Id int64 `json:"id"`
// RuleId int64 `json:"rule_id" description:"规则id"`
// Id int `json:"id"`
// RuleId int `json:"rule_id" description:"规则id"`
// PlayerCode int `json:"player_code" description:"竞拍参与者号码"` // PlayerCode int `json:"player_code" description:"竞拍参与者号码"`
// DealMoney float64 `json:"deal_money" description:"成交的金额"` // DealMoney float64 `json:"deal_money" description:"成交的金额"`
// IsPay bool `json:"is_pay" description:"是否支付"` // IsPay bool `json:"is_pay" description:"是否支付"`

22
models/auction_history.go

@ -10,18 +10,18 @@ const AuctionHistoryTableName = TableNamePrefix + "auction_history"
//竞拍历史 //竞拍历史
type AuctionHistory struct { type AuctionHistory struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
UserId int64 `json:"user_id" xorm:"not null comment('用户表id') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null comment('彩排id, 0是正式') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
UserId int `json:"user_id" xorm:"not null comment('用户表id') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null comment('彩排id, 0是正式') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
PlayerId int64 `json:"player_id" xorm:"not null comment('竞拍者id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
AreaId int64 `json:"area_id" xorm:"not null comment('地区id') INT(11)"`
PlayerId int `json:"player_id" xorm:"not null comment('竞拍者id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
AreaId int `json:"area_id" xorm:"not null comment('地区id') INT(11)"`
AreaName string `json:"area_name" xorm:"not null comment('地区名字') VARCHAR(128)"` AreaName string `json:"area_name" xorm:"not null comment('地区名字') VARCHAR(128)"`
UserName string `json:"user_name" xorm:"not null comment('用户名') VARCHAR(128)"` UserName string `json:"user_name" xorm:"not null comment('用户名') VARCHAR(128)"`
UserPhone string `json:"user_phone" xorm:"not null comment('用户手机') VARCHAR(128)"` UserPhone string `json:"user_phone" xorm:"not null comment('用户手机') VARCHAR(128)"`
AuctionGoodsName string `json:"auction_goods_name" xorm:"not null comment('竞拍商品名字') VARCHAR(255)"` AuctionGoodsName string `json:"auction_goods_name" xorm:"not null comment('竞拍商品名字') VARCHAR(255)"`
AuctionActivityId int64 `json:"auction_activity_id" xorm:"not null comment('竞拍活动id') INT(11)"`
AuctionActivityId int `json:"auction_activity_id" xorm:"not null comment('竞拍活动id') INT(11)"`
PlayerCode int64 `json:"player_code" xorm:"not null comment('竞拍参与者号码') INT(11)"` PlayerCode int64 `json:"player_code" xorm:"not null comment('竞拍参与者号码') INT(11)"`
Unit int `json:"unit" xorm:"not null default(1) comment('单位') TINYINT(1)"` Unit int `json:"unit" xorm:"not null default(1) comment('单位') TINYINT(1)"`
Money float64 `json:"money" xorm:"not null comment('计算总价格') DECIMAL(20)"` Money float64 `json:"money" xorm:"not null comment('计算总价格') DECIMAL(20)"`
@ -35,23 +35,23 @@ func (t *AuctionHistory) TableName() string {
return AuctionHistoryTableName return AuctionHistoryTableName
} }
func (t *AuctionHistory) GetHighestMoney(rid, aid int64, archId interface{}) (bool, error) {
func (t *AuctionHistory) GetHighestMoney(rid, aid int, archId interface{}) (bool, error) {
return core.GetXormAuto().Where("auction_activity_id = ? and arch_id=? and rehearsal_id=? and is_delete=0", return core.GetXormAuto().Where("auction_activity_id = ? and arch_id=? and rehearsal_id=? and is_delete=0",
aid, archId, rid).Desc("money").Asc("updated_at").Get(t) aid, archId, rid).Desc("money").Asc("updated_at").Get(t)
} }
func (t *AuctionHistory) CountHistory(rid, aid int64) (int64, error) {
func (t *AuctionHistory) CountHistory(rid, aid int) (int64, error) {
return core.GetXormAuto().Where("auction_activity_id = ? and rehearsal_id=? and is_delete=0", aid, rid).Count(t) return core.GetXormAuto().Where("auction_activity_id = ? and rehearsal_id=? and is_delete=0", aid, rid).Count(t)
} }
func GetAuctionHistoriesByAuctionId(aid, rid int64, orderBy string, archId interface{}) ([]*AuctionHistory, error) {
func GetAuctionHistoriesByAuctionId(aid, rid int, orderBy string, archId interface{}) ([]*AuctionHistory, error) {
histories := make([]*AuctionHistory, 0) histories := make([]*AuctionHistory, 0)
err := core.GetXormAuto().Where("is_delete=0 and auction_activity_id=? and rehearsal_id=? and arch_id=?", err := core.GetXormAuto().Where("is_delete=0 and auction_activity_id=? and rehearsal_id=? and arch_id=?",
aid, rid, archId).OrderBy(orderBy).Find(&histories) aid, rid, archId).OrderBy(orderBy).Find(&histories)
return histories, err return histories, err
} }
func GetAuctionHistoriesByAuctionIds(ids []int64, rid int64, archId interface{}) ([]*AuctionHistory, error) {
func GetAuctionHistoriesByAuctionIds(ids []int, rid int, archId interface{}) ([]*AuctionHistory, error) {
histories := make([]*AuctionHistory, 0) histories := make([]*AuctionHistory, 0)
err := core.GetXormAuto().Where("is_delete=0 and rehearsal_id=? and arch_id=?", rid, archId). err := core.GetXormAuto().Where("is_delete=0 and rehearsal_id=? and arch_id=?", rid, archId).
In("auction_activity_id", ids).Desc("money").Find(&histories) In("auction_activity_id", ids).Desc("money").Find(&histories)

13
models/auction_player.go

@ -1,19 +1,20 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const AuctionPlayerTableName = TableNamePrefix + "auction_player" const AuctionPlayerTableName = TableNamePrefix + "auction_player"
//竞拍者 //竞拍者
type AuctionPlayer struct { type AuctionPlayer struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
AuctionActivityId int64 `json:"auction_activity_id" xorm:"not null comment('竞拍活动id') INT(11)"`
UserId int64 `json:"user_id" xorm:"not null comment('客户的id') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
AuctionActivityId int `json:"auction_activity_id" xorm:"not null comment('竞拍活动id') INT(11)"`
UserId int `json:"user_id" xorm:"not null comment('客户的id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id, 0正式数据') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id, 0正式数据') INT(11)"`
Code int64 `json:"code" xorm:"not null comment('竞拍参与人的代号') INT(11)"` Code int64 `json:"code" xorm:"not null comment('竞拍参与人的代号') INT(11)"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(0)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(0)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
@ -24,7 +25,7 @@ func (t *AuctionPlayer) TableName() string {
return AuctionPlayerTableName return AuctionPlayerTableName
} }
func (t *AuctionPlayer) GetByAuctionIdAndUid(aid, uid, rid int64, archId interface{}) (bool, error) {
func (t *AuctionPlayer) GetByAuctionIdAndUid(aid, uid, rid int, archId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and auction_activity_id=? and arch_id=? and user_id=? and rehearsal_id=?", return core.GetXormAuto().Where("is_delete=0 and auction_activity_id=? and arch_id=? and user_id=? and rehearsal_id=?",
aid, archId, uid, rid).Get(t) aid, archId, uid, rid).Get(t)
} }

19
models/auction_result_record.go

@ -1,21 +1,22 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const AuctionResultRecordTableName = TableNamePrefix + "auction_result_record" const AuctionResultRecordTableName = TableNamePrefix + "auction_result_record"
type AuctionResultRecord struct { type AuctionResultRecord struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('0正式/!0彩排id') INT(11)"` // 增加彩排功能
AuctionActivityId int64 `json:"auction_activity_id" xorm:"not null comment('竞拍活动id') INT(11)"`
AreaId int64 `json:"area_id" xorm:"not null default('0') comment('地区id') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('0正式/!0彩排id') INT(11)"` // 增加彩排功能
AuctionActivityId int `json:"auction_activity_id" xorm:"not null comment('竞拍活动id') INT(11)"`
AreaId int `json:"area_id" xorm:"not null default('0') comment('地区id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
AreaName string `json:"area_name" xorm:"not null default('') comment('地区名字') VARCHAR(255)"` AreaName string `json:"area_name" xorm:"not null default('') comment('地区名字') VARCHAR(255)"`
UserId int64 `json:"user_id" xorm:"not null comment('用户id') INT(11)"`
UserId int `json:"user_id" xorm:"not null comment('用户id') INT(11)"`
UserName string `json:"user_name" xorm:"not null comment('用户名字') VARCHAR(255)"` UserName string `json:"user_name" xorm:"not null comment('用户名字') VARCHAR(255)"`
UserPhone string `json:"user_phone" xorm:"not null comment('用户手机号码') VARCHAR(128)"` UserPhone string `json:"user_phone" xorm:"not null comment('用户手机号码') VARCHAR(128)"`
PlayerCode int64 `json:"player_code" xorm:"not null default(0) comment('竞拍编号') INT(11)"` PlayerCode int64 `json:"player_code" xorm:"not null default(0) comment('竞拍编号') INT(11)"`
@ -31,12 +32,12 @@ func (t *AuctionResultRecord) TableName() string {
return AuctionResultRecordTableName return AuctionResultRecordTableName
} }
func (t *AuctionResultRecord) CountHistory(rid, aid int64, archId interface{}) (int64, error) {
func (t *AuctionResultRecord) CountHistory(rid, aid int, archId interface{}) (int64, error) {
return core.GetXormAuto().Where("auction_activity_id=? and arch_id=? and rehearsal_id=? and is_delete=0", return core.GetXormAuto().Where("auction_activity_id=? and arch_id=? and rehearsal_id=? and is_delete=0",
aid, archId, rid).Count(t) aid, archId, rid).Count(t)
} }
func GetAuctionRecordsByAuctionId(id, rid int64, archId interface{}) ([]*AuctionResultRecord, error) {
func GetAuctionRecordsByAuctionId(id, rid int, archId interface{}) ([]*AuctionResultRecord, error) {
records := make([]*AuctionResultRecord, 0) records := make([]*AuctionResultRecord, 0)
err := core.GetXormAuto().Where("is_delete=0 and rehearsal_id=? and auction_activity_id=? and arch_id=?", rid, id, archId). err := core.GetXormAuto().Where("is_delete=0 and rehearsal_id=? and auction_activity_id=? and arch_id=?", rid, id, archId).
Desc("created_at").Find(&records) Desc("created_at").Find(&records)

10
models/auction_rule.go

@ -4,11 +4,11 @@ package models
// //
////竞拍规则 ////竞拍规则
//type AuctionRule struct { //type AuctionRule struct {
// Id int64 `json:"id"`
// AuctionActivityId int64 `json:"auction_activity_id" description:"竞拍轮次的id, 对应auction_activity表的主键id"`
// AuctionTime int64 `json:"auction_time" description:"竞拍持续时间 秒为单位"`
// Id int `json:"id"`
// AuctionActivityId int `json:"auction_activity_id" description:"竞拍轮次的id, 对应auction_activity表的主键id"`
// AuctionTime int `json:"auction_time" description:"竞拍持续时间 秒为单位"`
// AuctionStatus string `json:"auction_status" description:"竞拍活动状态 [可竞拍,不可竞拍]"` // AuctionStatus string `json:"auction_status" description:"竞拍活动状态 [可竞拍,不可竞拍]"`
// AreaId int64 `json:"area_id" description:"地区id"`
// AreaId int `json:"area_id" description:"地区id"`
// AreaStatus string `json:"area_status" description:"多地区模式[开启,关闭]"` // AreaStatus string `json:"area_status" description:"多地区模式[开启,关闭]"`
// AuctionGoodsName string `json:"auction_goods_name" description:"竞拍物品名称"` // AuctionGoodsName string `json:"auction_goods_name" description:"竞拍物品名称"`
// AuctionGoodsDesc string `json:"auction_goods_desc" description:"竞拍物品描述"` // AuctionGoodsDesc string `json:"auction_goods_desc" description:"竞拍物品描述"`
@ -17,7 +17,7 @@ package models
// Pic string `json:"pic" description:"竞拍图片"` // Pic string `json:"pic" description:"竞拍图片"`
// BaseInterval float64 `json:"base_interval" description:"基础区间"` // BaseInterval float64 `json:"base_interval" description:"基础区间"`
// Threshold float64 `json:"threshold" description:"活动结束阀值"` // Threshold float64 `json:"threshold" description:"活动结束阀值"`
// UseTimes int64 `json:"use_times" description:"使用次数"`
// UseTimes int `json:"use_times" description:"使用次数"`
// IsDelete bool `json:"is_delete" xorm:"is_delete" description:"是否删除"` // IsDelete bool `json:"is_delete" xorm:"is_delete" description:"是否删除"`
// CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` // CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
// UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` // UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`

6
models/bahe_activity.go

@ -2,8 +2,8 @@ package models
//拔河比赛活动 //拔河比赛活动
//type BaheActivity struct { //type BaheActivity struct {
// Id int64 `json:"id"`
// ActivityId int64 `json:"activity_id" description:"活动的id"`
// Id int `json:"id"`
// ActivityId int `json:"activity_id" description:"活动的id"`
// BaheActivityName string `json:"bahe_activity_name" description:"拔河名称"` // BaheActivityName string `json:"bahe_activity_name" description:"拔河名称"`
// RandomTeam string `json:"random_team" description:"[开启,关闭]随机组队模式"` // RandomTeam string `json:"random_team" description:"[开启,关闭]随机组队模式"`
// MaxMoreCode string `json:"max_more_code" description:"[开启,关闭]大屏多二维码模式"` // MaxMoreCode string `json:"max_more_code" description:"[开启,关闭]大屏多二维码模式"`
@ -14,6 +14,6 @@ package models
// UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` // UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`
//} //}
//func (b *BaheActivity) GetBaheActivityById(id int64) (bool, error) {
//func (b *BaheActivity) GetBaheActivityById(id int) (bool, error) {
// return core.GetXormAuto().Where("id=? and is_delete=?", id, false).Get(b) // return core.GetXormAuto().Where("id=? and is_delete=?", id, false).Get(b)
//} //}

6
models/bahe_history.go

@ -4,9 +4,9 @@ package models
// //
////拔河的比赛结果的记录 ////拔河的比赛结果的记录
//type BaheHistory struct { //type BaheHistory struct {
// Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
// ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动的id') INT(11)"`
// WinnerId int64 `json:"winner_id" xorm:"not null comment('胜利队伍id') INT(11)"`
// Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
// ActivityId int `json:"activity_id" xorm:"not null comment('主活动的id') INT(11)"`
// WinnerId int `json:"winner_id" xorm:"not null comment('胜利队伍id') INT(11)"`
// MatchRes string `json:"match_res" xorm:"not null comment('比赛结果信息,[team_id=>人数,...]') INT(11)"` // MatchRes string `json:"match_res" xorm:"not null comment('比赛结果信息,[team_id=>人数,...]') INT(11)"`
// IsDelete bool `json:"is_delete" xorm:"default(0)"` // IsDelete bool `json:"is_delete" xorm:"default(0)"`
// CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` // CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`

8
models/bahe_rule.go

@ -2,14 +2,14 @@ package models
//拔河规则 //拔河规则
//type BaheRule struct { //type BaheRule struct {
// Id int64 `json:"id"`
// BaheActivityId int64 `json:"bahe_activity_id" description:"拔河轮次的id, 对应bahe_activity的主键id"`
// AreaId int64 `json:"area_id" description:"地区id"`
// Id int `json:"id"`
// BaheActivityId int `json:"bahe_activity_id" description:"拔河轮次的id, 对应bahe_activity的主键id"`
// AreaId int `json:"area_id" description:"地区id"`
// RandomTeam string `json:"random_team" description:"[开启,关闭]随机组队模式"` // RandomTeam string `json:"random_team" description:"[开启,关闭]随机组队模式"`
// MaxMoreCode string `json:"max_more_code" description:"[开启,关闭]大屏多二维码模式"` // MaxMoreCode string `json:"max_more_code" description:"[开启,关闭]大屏多二维码模式"`
// H5Choose string `json:"h_5_choose" description:"[开启,关闭]h5挑选队伍"` // H5Choose string `json:"h_5_choose" description:"[开启,关闭]h5挑选队伍"`
// BaheStatus string `json:"bahe_status" description:"拔河活动状态[未开始,进行中,结束]"` // BaheStatus string `json:"bahe_status" description:"拔河活动状态[未开始,进行中,结束]"`
// UseTimes int64 `json:"use_times" description:"使用次数"`
// UseTimes int `json:"use_times" description:"使用次数"`
// IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` // IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"`
// CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` // CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
// UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` // UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"`

13
models/bahe_team.go

@ -1,19 +1,20 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const BaheTeamTable = TableNamePrefix + "bahe_team" const BaheTeamTable = TableNamePrefix + "bahe_team"
//拔河队伍 //拔河队伍
type BaheTeam struct { type BaheTeam struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('活动id') INT(11)"`
BaheActivityId int64 `json:"bahe_activity_id" xorm:"not null comment('拔河活动id') INT(11) "`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('活动id') INT(11)"`
BaheActivityId int `json:"bahe_activity_id" xorm:"not null comment('拔河活动id') INT(11) "`
BaheTeamName string `json:"bahe_team_name" xorm:"not null comment('拔河队伍得名称') VARCHAR(255)"` BaheTeamName string `json:"bahe_team_name" xorm:"not null comment('拔河队伍得名称') VARCHAR(255)"`
TotalScore int64 `json:"total_score" xorm:"-" description:"总分数"`
TotalScore int `json:"total_score" xorm:"-" description:"总分数"`
Rank int `json:"rank" xorm:"-" description:"排名"` Rank int `json:"rank" xorm:"-" description:"排名"`
Members []*BaheTeamMember `json:"members" xorm:"-" description:"队伍人数"` Members []*BaheTeamMember `json:"members" xorm:"-" description:"队伍人数"`
Qrcode string `json:"qrcode" xorm:"-" description:"二维码"` Qrcode string `json:"qrcode" xorm:"-" description:"二维码"`
@ -26,7 +27,7 @@ func (t *BaheTeam) TableName() string {
return BaheTeamTable return BaheTeamTable
} }
func (t *BaheTeam) GetOtherTeam(id, bid int64) (bool, error) {
func (t *BaheTeam) GetOtherTeam(id, bid int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and id=? and bahe_activity_id=?", id, bid).Get(t) return core.GetXormAuto().Where("is_delete=0 and id=? and bahe_activity_id=?", id, bid).Get(t)
} }

12
models/bahe_team_member.go

@ -10,14 +10,14 @@ const BaheTeamMemberTableName = TableNamePrefix + "bahe_team_member"
//拔河队伍人员 //拔河队伍人员
type BaheTeamMember struct { type BaheTeamMember struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
BaheActivityId int64 `json:"bahe_activity_id" xorm:"not null default(0) comment('拔河活動id') BIGINT(20)"`
TeamId int64 `json:"team_id" xorm:"not null default(0) comment('队伍id') BIGINT(20)"`
BaheActivityId int `json:"bahe_activity_id" xorm:"not null default(0) comment('拔河活動id') BIGINT(20)"`
TeamId int `json:"team_id" xorm:"not null default(0) comment('队伍id') BIGINT(20)"`
TeamName string `json:"team_name" xorm:"not null default('') comment('队伍名字') VARCHAR(255)"` TeamName string `json:"team_name" xorm:"not null default('') comment('队伍名字') VARCHAR(255)"`
MemberId int64 `json:"member_id" xorm:"not null comment('用户id') BIGINT(20)"`
Score int64 `json:"score" xorm:"not null default(0) comment('分数') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式') BIGINT(20)"`
MemberId int `json:"member_id" xorm:"not null comment('用户id') BIGINT(20)"`
Score int `json:"score" xorm:"not null default(0) comment('分数') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式') BIGINT(20)"`
Avatar string `json:"avatar" xorm:"not null comment('头像') VARCHAR(255)"` Avatar string `json:"avatar" xorm:"not null comment('头像') VARCHAR(255)"`
NickName string `json:"nick_name" xorm:"not null comment('昵称') VARCHAR(255)"` NickName string `json:"nick_name" xorm:"not null comment('昵称') VARCHAR(255)"`
SortTime int64 `json:"sort_time" xorm:"not null default '0' comment('排序时间') VARCHAR(20)"` SortTime int64 `json:"sort_time" xorm:"not null default '0' comment('排序时间') VARCHAR(20)"`

6
models/barrage_history.go

@ -8,9 +8,9 @@ const BarrageHistoryTableName = TableNamePrefix + "barrage_history"
//弹幕历史记录 //弹幕历史记录
type BarrageHistory struct { type BarrageHistory struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动得id') INT(11)"`
UserId int64 `json:"user_id" xorm:"not null comment('用户得id') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('主活动得id') INT(11)"`
UserId int `json:"user_id" xorm:"not null comment('用户得id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
Content string `json:"content" xorm:"not null comment('内容') TEXT"` Content string `json:"content" xorm:"not null comment('内容') TEXT"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"`

5
models/base.go

@ -2,10 +2,11 @@ package models
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"github.com/xormplus/xorm"
"reflect" "reflect"
"strings" "strings"
"github.com/ouxuanserver/osmanthuswine/src/core"
"github.com/xormplus/xorm"
) )
const TableNamePrefix = "ox_" const TableNamePrefix = "ox_"

23
models/bully_screen_history.go

@ -1,34 +1,35 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const BullyScreenHistoryTableName = TableNamePrefix + "bully_screen_history" const BullyScreenHistoryTableName = TableNamePrefix + "bully_screen_history"
//霸屏历史表 //霸屏历史表
type BullyScreenHistory struct { type BullyScreenHistory struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
BullyScreenServerId int64 `json:"bully_screen_server_id" xorm:"not null default 0 comment('霸屏服务得id') INT(11)"`
BullyScreenServerId int `json:"bully_screen_server_id" xorm:"not null default 0 comment('霸屏服务得id') INT(11)"`
OutTradeNo string `json:"out_trade_no" xorm:"not null default '' comment('微信订单号') VARCHAR(128)"` OutTradeNo string `json:"out_trade_no" xorm:"not null default '' comment('微信订单号') VARCHAR(128)"`
CustomerId int64 `json:"customer_id" xorm:"not null default 0 comment('客户id') INT(11)"`
CustomerId int `json:"customer_id" xorm:"not null default 0 comment('客户id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户得id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
UserId int `json:"user_id" xorm:"not null default 0 comment('用户得id') INT(11)"`
Nickname string `json:"nickname" xorm:"not null default '' comment('发送者昵称') VARCHAR(128)"` Nickname string `json:"nickname" xorm:"not null default '' comment('发送者昵称') VARCHAR(128)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id/ 0是正式') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id/ 0是正式') INT(11)"`
Style int `json:"style" xorm:"not null default 0 comment('服务样式') INT(11)"` Style int `json:"style" xorm:"not null default 0 comment('服务样式') INT(11)"`
Second int `json:"second" xorm:"not null default 0 comment('霸屏时间(秒)') INT(11)"` Second int `json:"second" xorm:"not null default 0 comment('霸屏时间(秒)') INT(11)"`
Content string `json:"content" xorm:"not null comment('内容') TEXT"` Content string `json:"content" xorm:"not null comment('内容') TEXT"`
Status int `json:"status" xorm:"not null default(0) comment('[-1未支付,0未审核,1未通过,2已通过,3已推送,4已作废]') INT(11)"` Status int `json:"status" xorm:"not null default(0) comment('[-1未支付,0未审核,1未通过,2已通过,3已推送,4已作废]') INT(11)"`
Amount float64 `json:"amount" xorm:"not null default 0.00 comment('霸屏金额') DECIMAL(18)"` Amount float64 `json:"amount" xorm:"not null default 0.00 comment('霸屏金额') DECIMAL(18)"`
ReviewTime int64 `json:"review_time" xorm:"not null default 0 comment('审核的时间') INT(11)"`
Version int64 `json:"version" xorm:"not null version comment('乐观锁') INT(11)"`
ReviewTime int `json:"review_time" xorm:"not null default 0 comment('审核的时间') INT(11)"`
Version int `json:"version" xorm:"not null version comment('乐观锁') INT(11)"`
} }
func (t *BullyScreenHistory) TableName() string { func (t *BullyScreenHistory) TableName() string {
@ -39,7 +40,7 @@ func (t *BullyScreenHistory) GetByOutTradeNo(outTradeNo string) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and out_trade_no=?", outTradeNo).Get(t) return core.GetXormAuto().Where("is_delete=0 and out_trade_no=?", outTradeNo).Get(t)
} }
func (t *BullyScreenHistory) UpdateStatus(id int64, status int) (int64, error) {
func (t *BullyScreenHistory) UpdateStatus(id int, status int) (int64, error) {
t.Status = status t.Status = status
return core.GetXormAuto().ID(id).Cols("status").Update(t) return core.GetXormAuto().ID(id).Cols("status").Update(t)
} }
@ -51,7 +52,7 @@ func (t *BullyScreenHistory) UpdateStatusByOutTradeNo(outTradeNo string, status
Cols("status").Update(t) Cols("status").Update(t)
} }
func (t *BullyScreenHistory) UpdateStatusByIds(ids []int64, status int) error {
func (t *BullyScreenHistory) UpdateStatusByIds(ids []int, status int) error {
if len(ids) > 0 { if len(ids) > 0 {
t.Status = status t.Status = status
_, err := core.GetXormAuto().In("id", ids).Cols("status"). _, err := core.GetXormAuto().In("id", ids).Cols("status").

9
models/bully_screen_server.go

@ -1,16 +1,17 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const BullyScreenServerTableName = TableNamePrefix + "bully_screen_server" const BullyScreenServerTableName = TableNamePrefix + "bully_screen_server"
//霸屏服务 //霸屏服务
type BullyScreenServer struct { type BullyScreenServer struct {
Id int64 `json:"id"`
ActivityId int64 `json:"activity_id" description:"主活动的id"`
Id int `json:"id"`
ActivityId int `json:"activity_id" description:"主活动的id"`
ServerStartTime time.Time `json:"server_start_time" description:"服务开始时间"` ServerStartTime time.Time `json:"server_start_time" description:"服务开始时间"`
ServerEndTime time.Time `json:"server_end_time" description:"服务结束时间"` ServerEndTime time.Time `json:"server_end_time" description:"服务结束时间"`
Start string `json:"start" description:"霸屏是否开启 [开启|关闭]"` Start string `json:"start" description:"霸屏是否开启 [开启|关闭]"`
@ -29,6 +30,6 @@ func (t *BullyScreenServer) Alias(name string) string {
return Alias(t, name) return Alias(t, name)
} }
func (t *BullyScreenServer) GetByActivityId(aid int64) (bool, error) {
func (t *BullyScreenServer) GetByActivityId(aid int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t) return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t)
} }

9
models/bully_screen_wallet.go

@ -1,15 +1,16 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const BSWalletTableName = TableNamePrefix + "bully_screen_wallet" const BSWalletTableName = TableNamePrefix + "bully_screen_wallet"
type BullyScreenWallet struct { type BullyScreenWallet struct {
Id int64 `json:"id"`
CustomerId int64 `json:"customer_id"`
Id int `json:"id"`
CustomerId int `json:"customer_id"`
Balance float64 `json:"balance"` Balance float64 `json:"balance"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
@ -19,7 +20,7 @@ func (t *BullyScreenWallet) TableName() string {
return BSWalletTableName return BSWalletTableName
} }
func (t *BullyScreenWallet) IncrBalance(cid int64, money float64) (int64, error) {
func (t *BullyScreenWallet) IncrBalance(cid int, money float64) (int64, error) {
return core.GetXormAuto().Where("customer_id=?", cid). return core.GetXormAuto().Where("customer_id=?", cid).
Incr("balance", money).Cols("balance").Update(t) Incr("balance", money).Cols("balance").Update(t)
} }

8
models/bully_screen_wallet_hisotry.go

@ -5,15 +5,15 @@ import "time"
const BSWalletHistoryTableName = TableNamePrefix + "bully_screen_wallet_history" const BSWalletHistoryTableName = TableNamePrefix + "bully_screen_wallet_history"
type BullyScreenWalletHistory struct { type BullyScreenWalletHistory struct {
Id int64 `json:"id" xorm:"not null autoincr pk INT(11)"`
CustomerId int64 `json:"customer_id" xorm:"not null default 0 comment('客户表id') INT(11)"`
UserId int64 `json:"customer_id" xorm:"not null default 0 comment('客户表id') INT(11)"`
Id int `json:"id" xorm:"not null autoincr pk INT(11)"`
CustomerId int `json:"customer_id" xorm:"not null default 0 comment('客户表id') INT(11)"`
UserId int `json:"customer_id" xorm:"not null default 0 comment('客户表id') INT(11)"`
Money float64 `json:"money" xorm:"not null default 0.00 comment('金额[分正负]') DECIMAL(10)"` Money float64 `json:"money" xorm:"not null default 0.00 comment('金额[分正负]') DECIMAL(10)"`
HisBalance string `json:"his_balance" xorm:"not null default '0' comment('历史霸屏余额') VARCHAR(128)"` HisBalance string `json:"his_balance" xorm:"not null default '0' comment('历史霸屏余额') VARCHAR(128)"`
Type string `json:"type" xorm:"not null default '' comment('记录类型 霸屏/提现') VARCHAR(128)"` Type string `json:"type" xorm:"not null default '' comment('记录类型 霸屏/提现') VARCHAR(128)"`
BullyScreenUsername string `json:"bully_screen_username" xorm:"not null default '' comment('发起霸屏的那个用户的用户名') VARCHAR(128)"` BullyScreenUsername string `json:"bully_screen_username" xorm:"not null default '' comment('发起霸屏的那个用户的用户名') VARCHAR(128)"`
BullyScreenAccount string `json:"bully_screen_account" xorm:"not null default '' comment('支付霸屏的账户 只支持支付宝或微信') VARCHAR(128)"` BullyScreenAccount string `json:"bully_screen_account" xorm:"not null default '' comment('支付霸屏的账户 只支持支付宝或微信') VARCHAR(128)"`
CashDrawId int64 `json:"cash_draw_id" xorm:"not null default 0 comment('cash_draw提现表id') INT(11)"`
CashDrawId int `json:"cash_draw_id" xorm:"not null default 0 comment('cash_draw提现表id') INT(11)"`
Status string `json:"status" xorm:"not null default '交易成功' comment('交易状态') VARCHAR(128)"` Status string `json:"status" xorm:"not null default '交易成功' comment('交易状态') VARCHAR(128)"`
Mark string `json:"mark" xorm:"not null comment('备注') TEXT"` Mark string `json:"mark" xorm:"not null comment('备注') TEXT"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`

15
models/calorie.go

@ -1,17 +1,18 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const CalorieTableName = TableNamePrefix + "calorie" const CalorieTableName = TableNamePrefix + "calorie"
type Calorie struct { type Calorie struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
GameDuration int64 `json:"game_duration" xorm:"not null default(60) comment('游戏时长秒') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
GameDuration int `json:"game_duration" xorm:"not null default(60) comment('游戏时长秒') INT(11)"`
StartTime int64 `json:"start_time" xorm:"not null default(0) comment('游戏开始时间') INT(11)"` StartTime int64 `json:"start_time" xorm:"not null default(0) comment('游戏开始时间') INT(11)"`
Status string `json:"status" xorm:"not null default('未开始') comment('状态[未开始,准备中,进行中,已结束]') VARCHAR(11)"` Status string `json:"status" xorm:"not null default('未开始') comment('状态[未开始,准备中,进行中,已结束]') VARCHAR(11)"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"`
@ -23,14 +24,14 @@ func (t *Calorie) TableName() string {
return CalorieTableName return CalorieTableName
} }
func (t *Calorie) UpdateToStatusByActivityId(aid int64, before, after string) (int64, error) {
func (t *Calorie) UpdateToStatusByActivityId(aid int, before, after string) (int64, error) {
t.Status = after t.Status = after
t.UpdatedAt = time.Now() t.UpdatedAt = time.Now()
return core.GetXormAuto().Where("is_delete=0 and status=? and activity_id=?", before, aid). return core.GetXormAuto().Where("is_delete=0 and status=? and activity_id=?", before, aid).
Cols("status", "updated_at").Update(t) Cols("status", "updated_at").Update(t)
} }
func (t *Calorie) UpdateStatusById(id int64, status string) (int64, error) {
func (t *Calorie) UpdateStatusById(id int, status string) (int64, error) {
t.Status = status t.Status = status
t.UpdatedAt = time.Now() t.UpdatedAt = time.Now()
return core.GetXormAuto().Where("is_delete=0 and id=?", id).Cols("status", "start_time", "updated_at").Update(t) return core.GetXormAuto().Where("is_delete=0 and id=?", id).Cols("status", "start_time", "updated_at").Update(t)
@ -41,7 +42,7 @@ func (t *Calorie) GetCurrent(aid interface{}) (bool, error) {
aid, define.StatusReady, define.StatusRunning).Desc("created_at").Get(t) aid, define.StatusReady, define.StatusRunning).Desc("created_at").Get(t)
} }
func UpdateCalorieStatusByActivityId(aid int64) (int64, error) {
func UpdateCalorieStatusByActivityId(aid int) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid). return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).
Update(&Calorie{Status: define.StatusNotBegin}) Update(&Calorie{Status: define.StatusNotBegin})
} }

17
models/customer.go

@ -2,11 +2,12 @@ package models
import ( import (
"fmt" "fmt"
"github.com/pkg/errors"
"go.uber.org/zap"
"hudongzhuanjia/logger" "hudongzhuanjia/logger"
"time" "time"
"github.com/pkg/errors"
"go.uber.org/zap"
"github.com/ouxuanserver/osmanthuswine/src/core" "github.com/ouxuanserver/osmanthuswine/src/core"
"github.com/ouxuanserver/osmanthuswine/src/helper" "github.com/ouxuanserver/osmanthuswine/src/helper"
) )
@ -15,7 +16,7 @@ const CustomerTN = TableNamePrefix + "customer"
//客户表 //客户表
type Customer struct { type Customer struct {
Id int64 `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
Activities []*Activity `json:"activities" xorm:"-" description:"用户创建的主活动"` Activities []*Activity `json:"activities" xorm:"-" description:"用户创建的主活动"`
Nickname string `json:"nickname" xorm:"not null default('') comment('昵称') VARCHAR(255)"` Nickname string `json:"nickname" xorm:"not null default('') comment('昵称') VARCHAR(255)"`
Username string `json:"username" xorm:"not null default('') comment('用户名') VARCHAR(255)"` Username string `json:"username" xorm:"not null default('') comment('用户名') VARCHAR(255)"`
@ -24,17 +25,17 @@ type Customer struct {
Token string `json:"token" xorm:"not null default('') comment('登陆凭证token') VARCHAR(255)"` Token string `json:"token" xorm:"not null default('') comment('登陆凭证token') VARCHAR(255)"`
Balance float64 `json:"balance" xorm:"not null default(0.00) comment('余额') DECIMAL(18)"` Balance float64 `json:"balance" xorm:"not null default(0.00) comment('余额') DECIMAL(18)"`
SmsCode string `json:"sms_code" xorm:"not null default('') comment('短信验证码') VARCHAR(128)"` SmsCode string `json:"sms_code" xorm:"not null default('') comment('短信验证码') VARCHAR(128)"`
AreaId int64 `json:"area_id" xorm:"not null default(0) comment('地区id') INT(11)"` // 子账号的地区
ActivityId int64 `json:"activity_id" xrom:"not null default(0) comment('主活动id') INT(11)"`
AreaId int `json:"area_id" xorm:"not null default(0) comment('地区id') INT(11)"` // 子账号的地区
ActivityId int `json:"activity_id" xrom:"not null default(0) comment('主活动id') INT(11)"`
HeadImg string `json:"head_img" xorm:"not null default('') comment('头像') VARCHAR(255)"` HeadImg string `json:"head_img" xorm:"not null default('') comment('头像') VARCHAR(255)"`
Email string `json:"email" xorm:"not null default('') comment('邮箱') VARCHAR(128)"` Email string `json:"email" xorm:"not null default('') comment('邮箱') VARCHAR(128)"`
Phone string `json:"phone" xorm:"not null default('') comment('电话号码') VARCHAR(128)"` Phone string `json:"phone" xorm:"not null default('') comment('电话号码') VARCHAR(128)"`
QqOpenid string `json:"qq_openid" xorm:"not null default('') comment('qq openid') VARCHAR(255)"` QqOpenid string `json:"qq_openid" xorm:"not null default('') comment('qq openid') VARCHAR(255)"`
Tag string `json:"tag" xorm:"-" description:"tag ws过滤信息"` Tag string `json:"tag" xorm:"-" description:"tag ws过滤信息"`
Pid int64 `json:"pid" xorm:"not null default(0) comment('上级账号,该值为空时不允许登陆web客户端') INT(11)"` // 可能判断是否为子账号h
Pid int `json:"pid" xorm:"not null default(0) comment('上级账号,该值为空时不允许登陆web客户端') INT(11)"` // 可能判断是否为子账号h
IsSpecial int `json:"is_special" xorm:"not null default 0 comment('是否是特殊用户') TINYINT(1)"` IsSpecial int `json:"is_special" xorm:"not null default 0 comment('是否是特殊用户') TINYINT(1)"`
RoleId int64 `json:"role_id" xorm:"not null default(4) comment('1超级管理员|2平台管理员|3普通管理员|4代理会员|5渠道会员|6普通会员') INT(11)"`
TopId int64 `json:"top_id" xorm:"not null default(0) comment('角色的上级id') INT(11)"`
RoleId int `json:"role_id" xorm:"not null default(4) comment('1超级管理员|2平台管理员|3普通管理员|4代理会员|5渠道会员|6普通会员') INT(11)"`
TopId int `json:"top_id" xorm:"not null default(0) comment('角色的上级id') INT(11)"`
IsDelete bool `json:"-" xorm:"not null default(0) comment('软删除') TINYINT(1)"` IsDelete bool `json:"-" xorm:"not null default(0) comment('软删除') TINYINT(1)"`
CreatedAt time.Time `json:"-" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"-" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"-" xorm:"not null updated comment('更新时间') DATETIME"` UpdatedAt time.Time `json:"-" xorm:"not null updated comment('更新时间') DATETIME"`

11
models/customer_goods.go

@ -1,20 +1,21 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const CustomerGoodsTableName = TableNamePrefix + "customer_goods" const CustomerGoodsTableName = TableNamePrefix + "customer_goods"
type CustomerGoods struct { type CustomerGoods struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
IsDelete bool `json:"is_delete" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default 0 comment('是否删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间') TIMESTAMP"` CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间') TIMESTAMP"`
UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新时间') TIMESTAMP"` UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新时间') TIMESTAMP"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
GoodsPicUrl string `json:"goods_pic_url" xorm:"not null default '' comment('商品图片') VARCHAR(255)"` GoodsPicUrl string `json:"goods_pic_url" xorm:"not null default '' comment('商品图片') VARCHAR(255)"`
IsForceAdded int `json:"is_force_added" xorm:"not null default 0 comment('是否强制上架0不强制1强制') TINYINT(1)"` IsForceAdded int `json:"is_force_added" xorm:"not null default 0 comment('是否强制上架0不强制1强制') TINYINT(1)"`
FixedField string `json:"fixed_field" xorm:"not null default '' comment('固定不可改字段,|分隔') VARCHAR(255)"` FixedField string `json:"fixed_field" xorm:"not null default '' comment('固定不可改字段,|分隔') VARCHAR(255)"`
@ -37,7 +38,7 @@ func (t *CustomerGoods) Alias(name string) string {
return Alias(t, name) return Alias(t, name)
} }
func GetGoodsByActivityId(activityId, areaId int64) ([]*CustomerGoods, error) {
func GetGoodsByActivityId(activityId, areaId interface{}) ([]*CustomerGoods, error) {
goods := make([]*CustomerGoods, 0) goods := make([]*CustomerGoods, 0)
err := core.GetXormAuto().Where("is_delete=0 and activity_id=? and area_id=?", activityId, areaId). err := core.GetXormAuto().Where("is_delete=0 and activity_id=? and area_id=?", activityId, areaId).
Asc("created_at").Find(&goods) Asc("created_at").Find(&goods)

18
models/customer_operation.go

@ -10,11 +10,11 @@ import (
// 用户操作, 主从账号同步信息 // 用户操作, 主从账号同步信息
// 拔河/摇红包/摇奖券/订单/上墙/霸屏/抽奖/投票/竞拍/打赏/会务 // 拔河/摇红包/摇奖券/订单/上墙/霸屏/抽奖/投票/竞拍/打赏/会务
type CustomerOperation struct { type CustomerOperation struct {
Id int64 `json:"id"`
CustomerId int64 `json:"customer_id" description:"客户id"`
ActivityId int64 `json:"activity_id" description:"主活动id"`
AreaId int64 `json:"area_id" description:"地区id"`
ModuleActivityId int64 `json:"module_activity_id" description:"具体活动id"`
Id int `json:"id"`
CustomerId int `json:"customer_id" description:"客户id"`
ActivityId int `json:"activity_id" description:"主活动id"`
AreaId int `json:"area_id" description:"地区id"`
ModuleActivityId int `json:"module_activity_id" description:"具体活动id"`
ModuleActivityType string `json:"module_activity_type" description:"具体活动类型"` ModuleActivityType string `json:"module_activity_type" description:"具体活动类型"`
Operation string `json:"operation" description:"操作内容"` Operation string `json:"operation" description:"操作内容"`
OtherData interface{} `json:"other_data" xorm:"-" description:"额外的字段"` OtherData interface{} `json:"other_data" xorm:"-" description:"额外的字段"`
@ -33,7 +33,7 @@ func (op *CustomerOperation) SaveCustomerOperation() int64 {
return row return row
} }
func (op *CustomerOperation) GetOpsByCustomerId(customerId int64, areaId int64) []*CustomerOperation {
func (op *CustomerOperation) GetOpsByCustomerId(customerId int, areaId int) []*CustomerOperation {
ops := make([]*CustomerOperation, 0) ops := make([]*CustomerOperation, 0)
var err error var err error
if areaId == 0 { if areaId == 0 {
@ -48,13 +48,13 @@ func (op *CustomerOperation) GetOpsByCustomerId(customerId int64, areaId int64)
return ops return ops
} }
func (op *CustomerOperation) GetOpByCustomerId(customerId int64) (bool, error) {
func (op *CustomerOperation) GetOpByCustomerId(customerId int) (bool, error) {
return core.GetXormAuto().Where("customer_id=? and is_delete=0", customerId).OrderBy("created_at desc").Get(op) return core.GetXormAuto().Where("customer_id=? and is_delete=0", customerId).OrderBy("created_at desc").Get(op)
} }
func (op *CustomerOperation) GetOpByActivityId(activityId int64) (bool, error) {
func (op *CustomerOperation) GetOpByActivityId(activityId int) (bool, error) {
return core.GetXormAuto().Where("activity_id=? and is_delete=0", activityId).OrderBy("created_at desc").Get(op) return core.GetXormAuto().Where("activity_id=? and is_delete=0", activityId).OrderBy("created_at desc").Get(op)
} }
func (op *CustomerOperation) GetOpByCustomerIdAndActivityId(pid, activityId int64) (bool, error) {
func (op *CustomerOperation) GetOpByCustomerIdAndActivityId(pid, activityId int) (bool, error) {
return core.GetXormAuto().Where("customer_id=? and activity_id=?", pid, activityId).OrderBy("created_at desc").Get(op) return core.GetXormAuto().Where("customer_id=? and activity_id=?", pid, activityId).OrderBy("created_at desc").Get(op)
} }

24
models/customer_order.go

@ -9,22 +9,22 @@ import (
const CustomerOrderTableName = TableNamePrefix + "customer_order" const CustomerOrderTableName = TableNamePrefix + "customer_order"
type CustomerOrder struct { type CustomerOrder struct {
Id int64 `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
IsDelete bool `json:"is_delete" xorm:"not null default 0 comment('软删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default 0 comment('软删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
UserPrizeId int64 `json:"user_prize_id" xorm:"not null default 0 comment('用户奖品id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('主活动id') INT(11)"`
UserPrizeId int `json:"user_prize_id" xorm:"not null default 0 comment('用户奖品id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('主活动id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
AreaId int `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
AreaName string `json:"area_name" xorm:"not null default '' comment('地区名字') VARCHAR(255)"` AreaName string `json:"area_name" xorm:"not null default '' comment('地区名字') VARCHAR(255)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id/0正式') BIGINT(20)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id/0正式') BIGINT(20)"`
OrderNo string `json:"order_no" xorm:"not null default 0 comment('本机订单号') VARCHAR(255)"` OrderNo string `json:"order_no" xorm:"not null default 0 comment('本机订单号') VARCHAR(255)"`
OutTradeNo string `json:"out_trade_no" xorm:"not null default '' comment('微信订单流水号') VARCHAR(255)"` OutTradeNo string `json:"out_trade_no" xorm:"not null default '' comment('微信订单流水号') VARCHAR(255)"`
OrderEntryPersonId int64 `json:"order_enter_person_id" xorm:"not null default 0 comment('订单录入人员id') INT(11)"`
OrderEntryPersonId int `json:"order_enter_person_id" xorm:"not null default 0 comment('订单录入人员id') INT(11)"`
OrderEntryPersonName string `json:"order_entry_person_name" xorm:"not null default '' comment('订单录入人员名字') INT(11)"` OrderEntryPersonName string `json:"order_entry_person_name" xorm:"not null default '' comment('订单录入人员名字') INT(11)"`
BuyerId int64 `json:"buyer_id" xorm:"not null default 0 comment('user表id') BIGINT(20)"`
BuyerId int `json:"buyer_id" xorm:"not null default 0 comment('user表id') BIGINT(20)"`
TotalAmount float64 `json:"total_amount" xorm:"not null default 0.00 comment('订单总额')"` TotalAmount float64 `json:"total_amount" xorm:"not null default 0.00 comment('订单总额')"`
PayAmount float64 `json:"pay_amount" xorm:"not null default 0.00 comment('支付金额')"` PayAmount float64 `json:"pay_amount" xorm:"not null default 0.00 comment('支付金额')"`
Postage float64 `json:"postage" xorm:"not null default 0.00 comment('邮费[0免邮]')"` Postage float64 `json:"postage" xorm:"not null default 0.00 comment('邮费[0免邮]')"`
@ -44,9 +44,9 @@ type CustomerOrder struct {
AutoReceiveTime time.Time `json:"auto_receive_time" xorm:"comment('自动收货时间') DATETIME"` AutoReceiveTime time.Time `json:"auto_receive_time" xorm:"comment('自动收货时间') DATETIME"`
// 无关变量 // 无关变量
//GoodsId int64 `json:"goods_id,omitempty" xorm:"not null default 0 comment('customer_goods表id') BIGINT(20)"`
//GoodsName string `json:"goods_name,omitempty" xorm:"not null default '' comment('商品名字') VARCHAR(255)"`
//GoodsNum int `json:"goods_num,omitempty" xorm:"not null default 0 comment('商品数量') INT(11)"`
GoodsId int `json:"goods_id,omitempty" xorm:"not null default 0 comment('customer_goods表id') BIGINT(20)"`
GoodsName string `json:"goods_name,omitempty" xorm:"not null default '' comment('商品名字') VARCHAR(255)"`
GoodsNum int `json:"goods_num,omitempty" xorm:"not null default 0 comment('商品数量') INT(11)"`
OrderTime string `json:"order_time,omitempty" xorm:"-"` OrderTime string `json:"order_time,omitempty" xorm:"-"`
Good *CustomerGoods `json:"good,omitempty" xorm:"-"` Good *CustomerGoods `json:"good,omitempty" xorm:"-"`
User *User `json:"user,omitempty" xorm:"-"` User *User `json:"user,omitempty" xorm:"-"`
@ -62,13 +62,13 @@ func (t *CustomerOrder) GetByOutTradeNO(outTradeNo string) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and out_trade_no=?", outTradeNo).Get(t) return core.GetXormAuto().Where("is_delete=0 and out_trade_no=?", outTradeNo).Get(t)
} }
func (t *CustomerOrder) Count(activityId, rehearsalId int64, limitTime time.Time, archId interface{}) (int64, error) {
func (t *CustomerOrder) Count(activityId, rehearsalId int, limitTime time.Time, archId interface{}) (int64, error) {
return core.GetXormAuto().Where("user_prize_id=0 and created_at >= ? and "+ return core.GetXormAuto().Where("user_prize_id=0 and created_at >= ? and "+
"activity_id=? and rehearsal_id=? and arch_id=? and is_delete=0", "activity_id=? and rehearsal_id=? and arch_id=? and is_delete=0",
limitTime, activityId, rehearsalId, archId).Count(t) limitTime, activityId, rehearsalId, archId).Count(t)
} }
func GetCustomerOrdersByActivityId(userId, activityId, rehearsalId, areaId int64, status []string, page, pageSize int, archId interface{}) ([]*CustomerOrder, error) {
func GetCustomerOrdersByActivityId(userId, activityId, rehearsalId, areaId int, status []string, page, pageSize int, archId interface{}) ([]*CustomerOrder, error) {
orders := make([]*CustomerOrder, 0) orders := make([]*CustomerOrder, 0)
err := core.GetXormAuto().Where("is_delete=0 and buyer_id=? and activity_id=? and "+ err := core.GetXormAuto().Where("is_delete=0 and buyer_id=? and activity_id=? and "+
"rehearsal_id=? and area_id=? and arch_id=?", userId, activityId, rehearsalId, areaId, archId). "rehearsal_id=? and area_id=? and arch_id=?", userId, activityId, rehearsalId, areaId, archId).

13
models/customer_order_option.go

@ -2,19 +2,20 @@ package models
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const CustomerOrderOptionTableName = TableNamePrefix + "customer_order_option" const CustomerOrderOptionTableName = TableNamePrefix + "customer_order_option"
type CustomerOrderOption struct { type CustomerOrderOption struct {
Id int64 `json:"id" xorm:"not null pk INT(11)"`
Id int `json:"id" xorm:"not null pk INT(11)"`
IsDelete int `json:"-" xorm:"not null default 0 comment('删除') TINYINT(1)"` IsDelete int `json:"-" xorm:"not null default 0 comment('删除') TINYINT(1)"`
CreatedAt time.Time `json:"-" xorm:"created"` CreatedAt time.Time `json:"-" xorm:"created"`
UpdatedAt time.Time `json:"-" xorm:"updated"` UpdatedAt time.Time `json:"-" xorm:"updated"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
SettingBox string `json:"setting_box" xorm:"not null comment('json格式 选中的表单项') TEXT"` SettingBox string `json:"setting_box" xorm:"not null comment('json格式 选中的表单项') TEXT"`
SelfBox string `json:"self_box" xorm:"not null comment('json格式 邀请函选中的表单项') TEXT"` SelfBox string `json:"self_box" xorm:"not null comment('json格式 邀请函选中的表单项') TEXT"`
Status int `json:"status" xorm:"not null default 0 comment('订单活动的开启1|关闭0') TINYINT(1)"` Status int `json:"status" xorm:"not null default 0 comment('订单活动的开启1|关闭0') TINYINT(1)"`
@ -31,16 +32,16 @@ func (t *CustomerOrderOption) AliasName(n string) string {
return fmt.Sprintf("%s as %s", t.TableName(), n) return fmt.Sprintf("%s as %s", t.TableName(), n)
} }
func (t *CustomerOrderOption) GetByActivityId(aid int64) (bool, error) {
func (t *CustomerOrderOption) GetByActivityId(aid int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t) return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t)
} }
func (t *CustomerOrderOption) GetOpen(aid int64) (bool, error) {
func (t *CustomerOrderOption) GetOpen(aid int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, 1). return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, 1).
Desc("created_at").Get(t) Desc("created_at").Get(t)
} }
func (t *CustomerOrderOption) Switch(aid int64, status int) (int64, error) {
func (t *CustomerOrderOption) Switch(aid int, status int) (int64, error) {
t.Status = status t.Status = status
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Cols("status").Update(t) return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Cols("status").Update(t)
} }

9
models/customer_order_sub.go

@ -2,20 +2,21 @@ package models
import ( import (
"fmt" "fmt"
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const CustomerOrderSubTN = TableNamePrefix + "customer_order_sub" const CustomerOrderSubTN = TableNamePrefix + "customer_order_sub"
type CustomerOrderSub struct { type CustomerOrderSub struct {
Id int64 `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr comment('主键') INT(11)"`
IsDelete bool `json:"is_delete" xorm:"not null default 0 comment('软删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default 0 comment('软删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"`
OrderId int64 `json:"order_id" xorm:"not null default 0 comment('订单id') VARCHAR(128)"`
GoodsId int64 `json:"goods_id" xorm:"not null default 0 comment('商品id') INT(11)"`
OrderId int `json:"order_id" xorm:"not null default 0 comment('订单id') VARCHAR(128)"`
GoodsId int `json:"goods_id" xorm:"not null default 0 comment('商品id') INT(11)"`
GoodsNum int `json:"goods_num" xorm:"not null default 0 comment('商品数量') INT(11)"` GoodsNum int `json:"goods_num" xorm:"not null default 0 comment('商品数量') INT(11)"`
GoodName string `json:"good_name" xorm:"not null default '' comment('商品名字') VARCHAR(128)"` GoodName string `json:"good_name" xorm:"not null default '' comment('商品名字') VARCHAR(128)"`
GoodPrice float64 `json:"good_price" xorm:"not null default 0.00 comment('商品价格') DECIMAL(18,2)"` GoodPrice float64 `json:"good_price" xorm:"not null default 0.00 comment('商品价格') DECIMAL(18,2)"`

9
models/dan_mu_server.go

@ -1,15 +1,16 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const DanMuServerTableName = TableNamePrefix + "dan_mu_server" const DanMuServerTableName = TableNamePrefix + "dan_mu_server"
type DanMuServer struct { type DanMuServer struct {
Id int64 `json:"id" xorm:"not null pk autoincr"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('互动id') INT(11)" description:"主活动id"`
Id int `json:"id" xorm:"not null pk autoincr"`
ActivityId int `json:"activity_id" xorm:"not null comment('互动id') INT(11)" description:"主活动id"`
DanmuSwitch string `json:"danmu_switch" xorm:"not null default('关闭') comment('弹幕服务开启、关闭') VARCHAR(255)"` DanmuSwitch string `json:"danmu_switch" xorm:"not null default('关闭') comment('弹幕服务开启、关闭') VARCHAR(255)"`
DanmuOpacity int `json:"danmu_opacity" xorm:"not null default(100) comment('弹幕透明度') INT(11)"` DanmuOpacity int `json:"danmu_opacity" xorm:"not null default(100) comment('弹幕透明度') INT(11)"`
DanmuSpeed int `json:"danmu_speed" xorm:"not null default(50) comment('弹幕速度') INT(11)"` DanmuSpeed int `json:"danmu_speed" xorm:"not null default(50) comment('弹幕速度') INT(11)"`
@ -27,6 +28,6 @@ func (t *DanMuServer) TableName() string {
return DanMuServerTableName return DanMuServerTableName
} }
func (t *DanMuServer) GetByActivityId(aid int64) (bool, error) {
func (t *DanMuServer) GetByActivityId(aid int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t) return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t)
} }

6
models/invitation.go

@ -7,8 +7,8 @@ import (
) )
type Invitation struct { type Invitation struct {
Id int64 `json:"id" description:"主键"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id')" description:"主活动id"`
Id int `json:"id" description:"主键"`
ActivityId int `json:"activity_id" xorm:"not null comment('主活动id')" description:"主活动id"`
SettingBox string `json:"setting_box" xorm:"not null comment('表单选项json化')" description:"表单选项Json化"` SettingBox string `json:"setting_box" xorm:"not null comment('表单选项json化')" description:"表单选项Json化"`
SelfBox string `json:"self_box" xorm:"not null comment('表单选项json化')" description:"自定义表单选项json"` SelfBox string `json:"self_box" xorm:"not null comment('表单选项json化')" description:"自定义表单选项json"`
SubmitTimeLimit time.Time `json:"submit_time_limit" xorm:"not null comment('0为不限制 1为限制 限制必填时间段')" description:"0为不限制 1为限制 限制必填时间段"` SubmitTimeLimit time.Time `json:"submit_time_limit" xorm:"not null comment('0为不限制 1为限制 限制必填时间段')" description:"0为不限制 1为限制 限制必填时间段"`
@ -20,6 +20,6 @@ type Invitation struct {
UpdatedAt time.Time `json:"-" xorm:"updated"` UpdatedAt time.Time `json:"-" xorm:"updated"`
} }
func (i *Invitation) GetInvitationByActivityId(aid int64) (bool, error) {
func (i *Invitation) GetInvitationByActivityId(aid int) (bool, error) {
return core.GetXormAuto().Where("activity_id = ? and is_delete = ?", aid, false).Get(i) return core.GetXormAuto().Where("activity_id = ? and is_delete = ?", aid, false).Get(i)
} }

10
models/invitation_letter.go

@ -9,11 +9,11 @@ import (
const InvitationLetterTableName = TableNamePrefix + "invitation_letter" const InvitationLetterTableName = TableNamePrefix + "invitation_letter"
type InvitationLetter struct { type InvitationLetter struct {
Id int64 `json:"id" xorm:"pk autoincr" description:"主键"`
UserId int64 `json:"user_id" xorm:"not null default(0) comment('用户id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
InvitationId int64 `json:"invitation_id" xorm:"not null default(0) comment('邀请函id') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
Id int `json:"id" xorm:"pk autoincr" description:"主键"`
UserId int `json:"user_id" xorm:"not null default(0) comment('用户id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
InvitationId int `json:"invitation_id" xorm:"not null default(0) comment('邀请函id') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
ExtraData string `json:"extra_data" xorm:"comment('邀请函信息') TEXT"` ExtraData string `json:"extra_data" xorm:"comment('邀请函信息') TEXT"`
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"删除"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"删除"`

9
models/live_config.go

@ -1,22 +1,23 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const LiveConfigTN = TableNamePrefix + "live_config" const LiveConfigTN = TableNamePrefix + "live_config"
type LiveConfig struct { type LiveConfig struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"`
CusId int `json:"cus_id" xorm:"not null default 0 comment('客户id') INT(11)"` CusId int `json:"cus_id" xorm:"not null default 0 comment('客户id') INT(11)"`
LiveSwitch int `json:"live_switch" xorm:"not null default 0 comment('直播开关0关1开') INT(11)"` LiveSwitch int `json:"live_switch" xorm:"not null default 0 comment('直播开关0关1开') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地域') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int `json:"area_id" xorm:"not null default 0 comment('地域') INT(11)"`
LiveRoomId string `json:"live_room_id" xorm:"not null default '' comment('直播间id') VARCHAR(128)"` LiveRoomId string `json:"live_room_id" xorm:"not null default '' comment('直播间id') VARCHAR(128)"`
AdaptationFunc []interface{} `json:"adaptation_func" xorm:"json not null default '' comment('选中的适配功能及互动已买的服务id,json格式') VARCHAR(255)"` AdaptationFunc []interface{} `json:"adaptation_func" xorm:"json not null default '' comment('选中的适配功能及互动已买的服务id,json格式') VARCHAR(255)"`
StartTime time.Time `json:"start_time" xorm:"not null default '1970-01-01 08:00:00' comment('开播时间') DATETIME"` StartTime time.Time `json:"start_time" xorm:"not null default '1970-01-01 08:00:00' comment('开播时间') DATETIME"`

9
models/live_config_area.go

@ -1,19 +1,20 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const LiveConfigAreaTN = TableNamePrefix + "live_config_area" const LiveConfigAreaTN = TableNamePrefix + "live_config_area"
type LiveConfigArea struct { type LiveConfigArea struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
LiveH5Url string `json:"live_h5_url" xorm:"not null default '' comment('h5直播地址') VARCHAR(255)"` LiveH5Url string `json:"live_h5_url" xorm:"not null default '' comment('h5直播地址') VARCHAR(255)"`
LiveH5Qrcode string `json:"live_h5_qrcode" xorm:"not null default '' comment('h5直播地址二维码') VARCHAR(255)"` LiveH5Qrcode string `json:"live_h5_qrcode" xorm:"not null default '' comment('h5直播地址二维码') VARCHAR(255)"`
AdminLiveUrl string `json:"admin_live_url" xorm:"not null default '' comment('管理员直播地址,即直播页面中管理员登录页面') VARCHAR(255)"` AdminLiveUrl string `json:"admin_live_url" xorm:"not null default '' comment('管理员直播地址,即直播页面中管理员登录页面') VARCHAR(255)"`

10
models/live_red_envelope_rule.go

@ -9,15 +9,15 @@ import (
const LiveRedPackInfoTN = TableNamePrefix + "live_red_envelope_rule" const LiveRedPackInfoTN = TableNamePrefix + "live_red_envelope_rule"
type LiveRedEnvelopeRule struct { type LiveRedEnvelopeRule struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"`
UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
UserId int `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('互动id') INT(11)"`
AreaId int `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
Prompt string `json:"prompt" xorm:"not null default 0 comment('祝福语') VARCHAR(255)"` Prompt string `json:"prompt" xorm:"not null default 0 comment('祝福语') VARCHAR(255)"`
Amount float64 `json:"amount" xorm:"not null default 0 comment('红包金额') DECIMAL(18)"` Amount float64 `json:"amount" xorm:"not null default 0 comment('红包金额') DECIMAL(18)"`
Num int `json:"num" xorm:"not null default 0 comment('红包个数') INT(11)"` Num int `json:"num" xorm:"not null default 0 comment('红包个数') INT(11)"`

13
models/live_viewer.go

@ -1,28 +1,29 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const LiveViewerTN = TableNamePrefix + "live_viewer" const LiveViewerTN = TableNamePrefix + "live_viewer"
type LiveViewer struct { type LiveViewer struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` IsDelete bool `json:"-" xorm:"not null default 0 comment('是否删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated default CURRENT_TIMESTAMP comment('更新时间') TIMESTAMP"`
UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"`
UserId int `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('活动id') INT(11)"`
LiveConfigId int64 `json:"live_config_id" xorm:"not null default 0 comment('直播id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default 0 comment('活动id') INT(11)"`
LiveConfigId int `json:"live_config_id" xorm:"not null default 0 comment('直播id') INT(11)"`
} }
func (t *LiveViewer) TableName() string { func (t *LiveViewer) TableName() string {
return LiveViewerTN return LiveViewerTN
} }
func (t *LiveViewer) Record(uid, aid, lid int64) error {
func (t *LiveViewer) Record(uid, aid, lid int) error {
session := core.GetXormAuto().NewSession() session := core.GetXormAuto().NewSession()
defer session.Close() defer session.Close()
session.Begin() session.Begin()

13
models/lottery_draw_activity.go

@ -1,17 +1,18 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const LotteryDrawActivityTableName = TableNamePrefix + "lottery_draw_activity" const LotteryDrawActivityTableName = TableNamePrefix + "lottery_draw_activity"
//抽奖活动 //抽奖活动
type LotteryDrawActivity struct { type LotteryDrawActivity struct {
Id int64 `json:"id"`
ActivityId int64 `json:"activity_id" description:"主活动的id"`
CreatorId int64 `json:"creator_id" description:"创建者id"`
Id int `json:"id"`
ActivityId int `json:"activity_id" description:"主活动的id"`
CreatorId int `json:"creator_id" description:"创建者id"`
LotteryDrawActivityName string `json:"lottery_draw_activity_name" description:"抽奖轮次名称"` LotteryDrawActivityName string `json:"lottery_draw_activity_name" description:"抽奖轮次名称"`
LotteryDrawRule *LotteryDrawRule `json:"lottery_draw_rule" xorm:"-" description:"抽奖活动规则"` LotteryDrawRule *LotteryDrawRule `json:"lottery_draw_rule" xorm:"-" description:"抽奖活动规则"`
IsDelete bool `json:"-" xorm:"default(0)"` IsDelete bool `json:"-" xorm:"default(0)"`
@ -23,8 +24,8 @@ func (t *LotteryDrawActivity) TableName() string {
return LotteryDrawActivityTableName return LotteryDrawActivityTableName
} }
func GetLDActivityIdsByActivityId(aid int64) ([]int64, error) {
lotteryIds := make([]int64, 0)
func GetLDActivityIdsByActivityId(aid int) ([]int, error) {
lotteryIds := make([]int, 0)
err := core.GetXormAuto().Table(new(LotteryDrawActivity)).Select("id"). err := core.GetXormAuto().Table(new(LotteryDrawActivity)).Select("id").
Where("is_delete=0 and activity_id=?", aid).Find(&lotteryIds) Where("is_delete=0 and activity_id=?", aid).Find(&lotteryIds)
return lotteryIds, err return lotteryIds, err

4
models/lottery_draw_envelope_wallet.go

@ -6,8 +6,8 @@ import (
//抽奖红包钱包 //抽奖红包钱包
type LotteryDrawEnvelopeWallet struct { type LotteryDrawEnvelopeWallet struct {
Id int64 `json:"id"`
CustomerId int64 `json:"customer_id" description:"客户id"`
Id int `json:"id"`
CustomerId int `json:"customer_id" description:"客户id"`
Balance float64 `json:"balance" description:"余额"` Balance float64 `json:"balance" description:"余额"`
IsDelete bool `json:"is_delete" xorm:"default(0)"` IsDelete bool `json:"is_delete" xorm:"default(0)"`
CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`

27
models/lottery_draw_record.go

@ -1,28 +1,29 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const LotteryDrawRecordTableName = TableNamePrefix + "lottery_draw_record" const LotteryDrawRecordTableName = TableNamePrefix + "lottery_draw_record"
type LotteryDrawRecord struct { type LotteryDrawRecord struct {
Id int64 `json:"id" xorm:"pk autoincr"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id')"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null comment('彩排id/0正式')"`
UserPrizeId int64 `json:"user_prize_id" xorm:"not null comment('用户奖品id') INT(11)"`
LotteryDrawActivityId int64 `json:"lottery_draw_activity_id" xorm:"not null comment('抽奖活动id')"`
LotteryDrawRuleId int64 `json:"lottery_draw_rule_id" xorm:"not null comment('抽奖规则id') BIGINT(20)"`
LotteryDrawRuleLadderId int64 `json:"lottery_draw_rule_ladder_id" xorm:"not null comment('规则阶梯id')"`
Id int `json:"id" xorm:"pk autoincr"`
ActivityId int `json:"activity_id" xorm:"not null comment('主活动id')"`
RehearsalId int `json:"rehearsal_id" xorm:"not null comment('彩排id/0正式')"`
UserPrizeId int `json:"user_prize_id" xorm:"not null comment('用户奖品id') INT(11)"`
LotteryDrawActivityId int `json:"lottery_draw_activity_id" xorm:"not null comment('抽奖活动id')"`
LotteryDrawRuleId int `json:"lottery_draw_rule_id" xorm:"not null comment('抽奖规则id') BIGINT(20)"`
LotteryDrawRuleLadderId int `json:"lottery_draw_rule_ladder_id" xorm:"not null comment('规则阶梯id')"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
UserId int64 `json:"user_id" xorm:"not null comment('用户id')"`
UserId int `json:"user_id" xorm:"not null comment('用户id')"`
RollNum int `json:"roll_num" xrom:"not null default 0 comment('滚动次数') INT(11)"` RollNum int `json:"roll_num" xrom:"not null default 0 comment('滚动次数') INT(11)"`
UserName string `json:"user_name" description:"用户名" xorm:"not null comment('用户名')"` UserName string `json:"user_name" description:"用户名" xorm:"not null comment('用户名')"`
UserPhone string `json:"user_phone" description:"电话" xorm:"not null comment('电话号码')"` UserPhone string `json:"user_phone" description:"电话" xorm:"not null comment('电话号码')"`
PrizeName string `json:"prize_name" description:"奖品名字" xorm:"not null comment('奖品名字')"` PrizeName string `json:"prize_name" description:"奖品名字" xorm:"not null comment('奖品名字')"`
AreaName string `json:"area_name" description:"名字" xorm:"not null comment('地区名字')"` AreaName string `json:"area_name" description:"名字" xorm:"not null comment('地区名字')"`
AreaId int64 `json:"area_id" xorm:"not null default(0) comment('地区id')"`
AreaId int `json:"area_id" xorm:"not null default(0) comment('地区id')"`
Status int `json:"status" xorm:"not null default 0 comment('是否已经兑奖0否1是') TINYINT(1)"` Status int `json:"status" xorm:"not null default 0 comment('是否已经兑奖0否1是') TINYINT(1)"`
Name string `json:"name" xorm:"not null default '' comment('姓名') VARCHAR(128)"` Name string `json:"name" xorm:"not null default '' comment('姓名') VARCHAR(128)"`
Phone string `json:"phone" xorm:"not null default '' comment('电话号码') VARCHAR(128)"` Phone string `json:"phone" xorm:"not null default '' comment('电话号码') VARCHAR(128)"`
@ -51,12 +52,12 @@ func (t *LotteryDrawRecord) GetByUserIdAndLadderId(userId, ladderId, archId inte
return session.Get(t) return session.Get(t)
} }
func (t *LotteryDrawRecord) GetByUserPrizeId(upId int64) (bool, error) {
func (t *LotteryDrawRecord) GetByUserPrizeId(upId int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and user_prize_id=?", upId).Get(t) return core.GetXormAuto().Where("is_delete=0 and user_prize_id=?", upId).Get(t)
} }
func GetUserIdsByLotteryDrawRuleId(ruleId, rehearsalId, areaId, archId interface{}) ([]int64, error) {
recordIds := make([]int64, 0)
func GetUserIdsByLotteryDrawRuleId(ruleId, rehearsalId, areaId, archId interface{}) ([]int, error) {
recordIds := make([]int, 0)
err := core.GetXormAuto().Table(new(LotteryDrawRecord)).Select("user_id"). err := core.GetXormAuto().Table(new(LotteryDrawRecord)).Select("user_id").
Where("lottery_draw_rule_id=? and rehearsal_id=? and area_id=? and arch_id=? and is_delete=0", Where("lottery_draw_rule_id=? and rehearsal_id=? and area_id=? and arch_id=? and is_delete=0",
ruleId, rehearsalId, areaId, archId).Find(&recordIds) ruleId, rehearsalId, areaId, archId).Find(&recordIds)

17
models/lottery_draw_rule.go

@ -1,20 +1,21 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const LotteryDrawRuleTableName = TableNamePrefix + "lottery_draw_rule" const LotteryDrawRuleTableName = TableNamePrefix + "lottery_draw_rule"
//抽奖活动规则 //抽奖活动规则
type LotteryDrawRule struct { type LotteryDrawRule struct {
Id int64 `json:"id"`
LotteryDrawActivityId int64 `json:"lottery_draw_activity_id" description:"红包轮次的id"`
Id int `json:"id"`
LotteryDrawActivityId int `json:"lottery_draw_activity_id" description:"红包轮次的id"`
LotteryDrawRuleLadders []*LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-" description:"阶梯"` LotteryDrawRuleLadders []*LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-" description:"阶梯"`
AreaId int64 `json:"area_id" description:"地区id"`
AreaId int `json:"area_id" description:"地区id"`
AreaStatus string `json:"area_status" description:"多地区[开启,关闭]"` AreaStatus string `json:"area_status" description:"多地区[开启,关闭]"`
UseTimes int64 `json:"use_times" description:"使用次数"`
UseTimes int `json:"use_times" description:"使用次数"`
PrizeNum int `json:"prize_num" xorm:"-" description:"奖品总数"` PrizeNum int `json:"prize_num" xorm:"-" description:"奖品总数"`
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"`
CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`
@ -25,14 +26,14 @@ func (t *LotteryDrawRule) TableName() string {
return LotteryDrawRuleTableName return LotteryDrawRuleTableName
} }
func GetLDRuleIdsByLDActivityId(ids []int64) ([]int64, error) {
ruleIds := make([]int64, 0)
func GetLDRuleIdsByLDActivityId(ids []int) ([]int, error) {
ruleIds := make([]int, 0)
err := core.GetXormAuto().Table(new(LotteryDrawRule)).Select("id"). err := core.GetXormAuto().Table(new(LotteryDrawRule)).Select("id").
Where("is_delete=0").In("lottery_draw_activity_id", ids).Find(&ruleIds) Where("is_delete=0").In("lottery_draw_activity_id", ids).Find(&ruleIds)
return ruleIds, err return ruleIds, err
} }
//func UpdateLDRuleStatusByLDActiviytIds(ids []int64) (int64, error) {
//func UpdateLDRuleStatusByLDActiviytIds(ids []int) (int, error) {
// return core.GetXormAuto().Where("is_delete=0").In("lottery_draw_activity_id", ids). // return core.GetXormAuto().Where("is_delete=0").In("lottery_draw_activity_id", ids).
// Update(&LotteryDrawRule{LotteryDrawStatus: define.StatusNotBegin}) // Update(&LotteryDrawRule{LotteryDrawStatus: define.StatusNotBegin})
//} //}

9
models/lottery_draw_rule_ladder.go

@ -1,17 +1,18 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const LotteryDrawRuleLadderTableName = TableNamePrefix + "lottery_draw_rule_ladder" const LotteryDrawRuleLadderTableName = TableNamePrefix + "lottery_draw_rule_ladder"
//抽奖活动规则阶梯 //抽奖活动规则阶梯
type LotteryDrawRuleLadder struct { type LotteryDrawRuleLadder struct {
Id int64 `json:"id"`
LotteryDrawRuleId int64 `json:"lottery_draw_rule_id" description:"红包轮次的id"`
Id int `json:"id"`
LotteryDrawRuleId int `json:"lottery_draw_rule_id" description:"红包轮次的id"`
RollNum int `json:"roll_num" xorm:"not null default 0 comment('滚动次数') INT(11)"` RollNum int `json:"roll_num" xorm:"not null default 0 comment('滚动次数') INT(11)"`
PrizeName string `json:"prize_name" description:"奖品名字"` PrizeName string `json:"prize_name" description:"奖品名字"`
PrizeNumber int `json:"prize_number" description:"奖品数量"` PrizeNumber int `json:"prize_number" description:"奖品数量"`
@ -32,7 +33,7 @@ func (t *LotteryDrawRuleLadder) Alias(name string) string {
return Alias(t, name) return Alias(t, name)
} }
func UpdateLDLadderStatusByLDRuleIds(ids []int64) (int64, error) {
func UpdateLDLadderStatusByLDRuleIds(ids []int) (int64, error) {
return core.GetXormAuto().Where("is_delete=0"). return core.GetXormAuto().Where("is_delete=0").
In("lottery_draw_rule_id", ids). In("lottery_draw_rule_id", ids).
Update(&LotteryDrawRuleLadder{Status: define.StatusNotBegin}) Update(&LotteryDrawRuleLadder{Status: define.StatusNotBegin})

4
models/lottery_draw_wallet_history.go

@ -6,8 +6,8 @@ import (
//抽奖活动钱包历史 //抽奖活动钱包历史
type LotteryDrawWalletHistory struct { type LotteryDrawWalletHistory struct {
Id int64 `json:"id"`
CustomerId int64 `json:"customer_id" description:"客户id"`
Id int `json:"id"`
CustomerId int `json:"customer_id" description:"客户id"`
Money float64 `json:"money" description:"金额[分正负]"` Money float64 `json:"money" description:"金额[分正负]"`
Mark string `json:"mark" description:"备注"` Mark string `json:"mark" description:"备注"`
IsDelete bool `json:"is_delete" xorm:"default(0)"` IsDelete bool `json:"is_delete" xorm:"default(0)"`

8
models/lottery_draw_winner.go

@ -2,11 +2,11 @@ package models
//抽奖的中奖名单 //抽奖的中奖名单
//type LotteryDrawWinner struct { //type LotteryDrawWinner struct {
// Id int64 `json:"id"`
// LotteryDrawRuleId int64 `json:"lottery_draw_rule_id" description:"红包轮次的id"`
// LotteryDrawRuleLadderId int64 `json:"lottery_draw_rule_ladder_id" description:"抽奖奖品的id"`
// Id int `json:"id"`
// LotteryDrawRuleId int `json:"lottery_draw_rule_id" description:"红包轮次的id"`
// LotteryDrawRuleLadderId int `json:"lottery_draw_rule_ladder_id" description:"抽奖奖品的id"`
// LotteryDrawRuleLadder *LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-" description:"奖品得信息"` // LotteryDrawRuleLadder *LotteryDrawRuleLadder `json:"lottery_draw_rule_ladder" xorm:"-" description:"奖品得信息"`
// UserId int64 `json:"user_id" description:"用户表得id"`
// UserId int `json:"user_id" description:"用户表得id"`
// User *User `json:"user" xorm:"-" description:"用户信息"` // User *User `json:"user" xorm:"-" description:"用户信息"`
// IsDelete bool `json:"is_delete" xorm:"default(0)"` // IsDelete bool `json:"is_delete" xorm:"default(0)"`
// CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` // CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"`

2
models/module_service.go

@ -8,7 +8,7 @@ import (
//模块服务表 //模块服务表
type ModuleService struct { type ModuleService struct {
Id int64 `json:"id"`
Id int `json:"id"`
Name string `json:"name" description:"模块的名称"` Name string `json:"name" description:"模块的名称"`
Price float64 `json:"price" description:"模块价格"` Price float64 `json:"price" description:"模块价格"`
Free string `json:"free" description:"模块是否收费[收费|免费]"` Free string `json:"free" description:"模块是否收费[收费|免费]"`

10
models/module_service_history.go

@ -9,8 +9,8 @@ import (
const ModuleServiceHistoryTableName = TableNamePrefix + "module_service_history" const ModuleServiceHistoryTableName = TableNamePrefix + "module_service_history"
type ModuleServiceHistory struct { type ModuleServiceHistory struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ServiceModuleId int64 `json:"service_module_id" xorm:"not null comment('服务模块的id') INT(11)" description:"服务模块的id"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ServiceModuleId int `json:"service_module_id" xorm:"not null comment('服务模块的id') INT(11)" description:"服务模块的id"`
Name string `json:"name" xorm:"not null comment('模块名字') VARCHAR(255)" description:"模块的名称"` Name string `json:"name" xorm:"not null comment('模块名字') VARCHAR(255)" description:"模块的名称"`
Price float64 `json:"price" xorm:"not null default(0.0) comment('模块价格') DECIMAL(10) " description:"模块价格"` Price float64 `json:"price" xorm:"not null default(0.0) comment('模块价格') DECIMAL(10) " description:"模块价格"`
Free string `json:"free" xorm:"not null comment('模块是否收费[收费|免费]') VARCHAR(255)" description:"模块是否收费[收费|免费]"` Free string `json:"free" xorm:"not null comment('模块是否收费[收费|免费]') VARCHAR(255)" description:"模块是否收费[收费|免费]"`
@ -29,7 +29,7 @@ func (t *ModuleServiceHistory) Alias(name string) string {
return Alias(t, name) return Alias(t, name)
} }
func (t *ModuleServiceHistory) GetByModuleIdAndName(id int64, name string) (bool, error) {
func (t *ModuleServiceHistory) GetByModuleIdAndName(id int, name string) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and service_module_id=? and name=?", id, name).Get(t) return core.GetXormAuto().Where("is_delete=0 and service_module_id=? and name=?", id, name).Get(t)
} }
@ -37,8 +37,8 @@ func (t *ModuleServiceHistory) ExistSignModule(ids []interface{}) (bool, error)
return core.GetXormAuto().Where("is_delete=0 and name=?", "签到").In("id", ids...).Exist(t) return core.GetXormAuto().Where("is_delete=0 and name=?", "签到").In("id", ids...).Exist(t)
} }
func GetModuleServiceHistoryIdsByIdAndName(serviceId, serviceName interface{}) ([]int64, error) {
historyIds := make([]int64, 0)
func GetModuleServiceHistoryIdsByIdAndName(serviceId, serviceName interface{}) ([]int, error) {
historyIds := make([]int, 0)
err := core.GetXormAuto().Table(new(ModuleServiceHistory)).Select("id"). err := core.GetXormAuto().Table(new(ModuleServiceHistory)).Select("id").
Where("is_delete=0 and service_module_id=? and name=?", serviceId, serviceName).Find(&historyIds) Where("is_delete=0 and service_module_id=? and name=?", serviceId, serviceName).Find(&historyIds)
return historyIds, err return historyIds, err

4
models/module_style.go

@ -6,8 +6,8 @@ import (
//模块样式表 //模块样式表
type ModuleStyle struct { type ModuleStyle struct {
Id int64 `json:"id"`
ModuleServiceId int64 `json:"module_service_id" description:"服务模块的id"`
Id int `json:"id"`
ModuleServiceId int `json:"module_service_id" description:"服务模块的id"`
StyleName string `json:"style_name" description:"样式名字"` StyleName string `json:"style_name" description:"样式名字"`
StyleImage string `json:"style_image" description:"样式图片"` StyleImage string `json:"style_image" description:"样式图片"`
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否已删除"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否已删除"`

6
models/msg_wall_server.go

@ -7,8 +7,8 @@ import (
) )
type MsgWallServer struct { type MsgWallServer struct {
Id int64 `json:"id" xorm:"pk autoincr"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id')"`
Id int `json:"id" xorm:"pk autoincr"`
ActivityId int `json:"activity_id" xorm:"not null comment('主活动id')"`
MsgWallBgUrl string `json:"msg_wall_bg_url" xorm:"not null comment('消息墙背景url')"` MsgWallBgUrl string `json:"msg_wall_bg_url" xorm:"not null comment('消息墙背景url')"`
MsgWallBgStatus string `json:"msg_wall_bg_status" xorm:"not null default('关闭') comment('自定义消息墙背景开关[开启|关闭]')"` MsgWallBgStatus string `json:"msg_wall_bg_status" xorm:"not null default('关闭') comment('自定义消息墙背景开关[开启|关闭]')"`
UpWallStatus string `json:"up_wall_status" xorm:"not null default('关闭') comment('消息上墙开关[开启|关闭]')"` UpWallStatus string `json:"up_wall_status" xorm:"not null default('关闭') comment('消息上墙开关[开启|关闭]')"`
@ -18,6 +18,6 @@ type MsgWallServer struct {
UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新')"` UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新')"`
} }
func (t *MsgWallServer) GetByActivityId(aid int64) (bool, error) {
func (t *MsgWallServer) GetByActivityId(aid int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t) return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t)
} }

22
models/new_auction_activity.go

@ -10,9 +10,9 @@ import (
const NewAuctionActivityTableName = TableNamePrefix + "new_auction_activity" const NewAuctionActivityTableName = TableNamePrefix + "new_auction_activity"
type NewAuctionActivity struct { type NewAuctionActivity struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
Pid int64 `json:"pid" xorm:"not null default(0) comment('排序id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
Pid int `json:"pid" xorm:"not null default(0) comment('排序id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
Histories []*AuctionHistory `json:"histories" xorm:"-"` Histories []*AuctionHistory `json:"histories" xorm:"-"`
AuctionModel string `json:"auction_model" xorm:"not null default('加价竞拍') comment('竞拍模式:加价竞拍|减价竞拍') VARCHAR(128)"` AuctionModel string `json:"auction_model" xorm:"not null default('加价竞拍') comment('竞拍模式:加价竞拍|减价竞拍') VARCHAR(128)"`
AuctionGoodsName string `json:"auction_goods_name" xorm:"not null default('') comment('竞拍商品名字') VARCHAR(255)"` AuctionGoodsName string `json:"auction_goods_name" xorm:"not null default('') comment('竞拍商品名字') VARCHAR(255)"`
@ -41,42 +41,42 @@ func (t *NewAuctionActivity) Alias(name string) string {
return Alias(t, name) return Alias(t, name)
} }
func (t *NewAuctionActivity) IncrMoneyById(id int64, money float64) (int64, error) {
func (t *NewAuctionActivity) IncrMoneyById(id int, money float64) (int64, error) {
return core.GetXormAuto().Where("id=?", id).Incr("money", money).Update(t) return core.GetXormAuto().Where("id=?", id).Incr("money", money).Update(t)
} }
func (t *NewAuctionActivity) DecrMoneyById(id int64, money float64) (int64, error) {
func (t *NewAuctionActivity) DecrMoneyById(id int, money float64) (int64, error) {
return core.GetXormAuto().Where("id=?", id).Decr("money", money).Decr("goods_num", 1).Update(t) return core.GetXormAuto().Where("id=?", id).Decr("money", money).Decr("goods_num", 1).Update(t)
} }
func (t *NewAuctionActivity) UpdateToStatusByAid(aid int64, before, after string) (int64, error) {
func (t *NewAuctionActivity) UpdateToStatusByAid(aid int, before, after string) (int64, error) {
t.Status = after t.Status = after
t.UpdatedAt = time.Now() t.UpdatedAt = time.Now()
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, before). return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, before).
Cols("status", "updated_at").Update(t) Cols("status", "updated_at").Update(t)
} }
func (t *NewAuctionActivity) UpdateStatusById(id int64, status string) (int64, error) {
func (t *NewAuctionActivity) UpdateStatusById(id int, status string) (int64, error) {
t.Status = status t.Status = status
t.UpdatedAt = time.Now() t.UpdatedAt = time.Now()
return core.GetXormAuto().Where("is_delete=0 and id=?", id). return core.GetXormAuto().Where("is_delete=0 and id=?", id).
Cols("status", "updated_at").Update(t) Cols("status", "updated_at").Update(t)
} }
func (t *NewAuctionActivity) GetByActivityId(aid int64, status string) (bool, error) {
func (t *NewAuctionActivity) GetByActivityId(aid int, status string) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, status). return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, status).
Desc("created_at").Get(t) Desc("created_at").Get(t)
} }
func (t *NewAuctionActivity) GetCurrent(aid int64) (bool, error) {
func (t *NewAuctionActivity) GetCurrent(aid int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and (status=? or status=?)", return core.GetXormAuto().Where("is_delete=0 and activity_id=? and (status=? or status=?)",
aid, define.StatusReady, define.StatusRunning).Get(t) aid, define.StatusReady, define.StatusRunning).Get(t)
} }
func UpdateAuctionStatusByActivityId(aid int64) (int64, error) {
func UpdateAuctionStatusByActivityId(aid int) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid). return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).
Update(&NewAuctionActivity{Status: define.StatusNotBegin}) Update(&NewAuctionActivity{Status: define.StatusNotBegin})
} }
func GetAuctionsByActivityId(aid int64) ([]*NewAuctionActivity, error) {
func GetAuctionsByActivityId(aid int) ([]*NewAuctionActivity, error) {
auctions := make([]*NewAuctionActivity, 0) auctions := make([]*NewAuctionActivity, 0)
err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid). err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).
Asc("created_at").Find(&auctions) Asc("created_at").Find(&auctions)

19
models/new_vote_activity.go

@ -1,23 +1,24 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const NewVoteActivityTableName = TableNamePrefix + "new_vote_activity" const NewVoteActivityTableName = TableNamePrefix + "new_vote_activity"
type NewVoteActivity struct { type NewVoteActivity struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('互动id') INT(11)"`
Arch int `json:"arch" xorm:"not null default 0 comment('归档') INT(11)"` Arch int `json:"arch" xorm:"not null default 0 comment('归档') INT(11)"`
VoteActivityLadders []*NewVoteActivityLadder `json:"vote_activity_ladders" xorm:"-"` VoteActivityLadders []*NewVoteActivityLadder `json:"vote_activity_ladders" xorm:"-"`
Theme string `json:"theme" xorm:"not null default('') comment('投票主题') VARCHAR(255)"` Theme string `json:"theme" xorm:"not null default('') comment('投票主题') VARCHAR(255)"`
JoinWay string `json:"join_way" xorm:"not null comment('参与方式说明') TEXT"` JoinWay string `json:"join_way" xorm:"not null comment('参与方式说明') TEXT"`
Description string `json:"description" xorm:"not null comment('投票介绍') TEXT"` Description string `json:"description" xorm:"not null comment('投票介绍') TEXT"`
Model string `json:"model" xorm:"not null default('单选') comment('投票类型[单选|多选]') VARCHAR(128)"` Model string `json:"model" xorm:"not null default('单选') comment('投票类型[单选|多选]') VARCHAR(128)"`
ModelNum int64 `json:"model_num" xorm:"not null default(1) comment('投票类型选多少个') INT(11)"`
ModelNum int `json:"model_num" xorm:"not null default(1) comment('投票类型选多少个') INT(11)"`
VoteLastTime string `json:"vote_last_time" description:"投票时长秒 0表示无时间限制"` VoteLastTime string `json:"vote_last_time" description:"投票时长秒 0表示无时间限制"`
VoteEndTime int64 `json:"vote_end_time" xorm:"default(0)" description:"投票开始时间"` VoteEndTime int64 `json:"vote_end_time" xorm:"default(0)" description:"投票开始时间"`
ResultDisplay string `json:"result_display" description:"结果展示[百分比|票数]"` ResultDisplay string `json:"result_display" description:"结果展示[百分比|票数]"`
@ -35,31 +36,31 @@ func (t *NewVoteActivity) TableName() string {
return NewVoteActivityTableName return NewVoteActivityTableName
} }
//func (t *NewVoteActivity) GetByActivityId(aid int64, status string) (bool, error) {
//func (t *NewVoteActivity) GetByActivityId(aid int, status string) (bool, error) {
// return core.GetXormAuto().Where("is_delete=0 and activity_id=? and vote_status=?", aid, status). // return core.GetXormAuto().Where("is_delete=0 and activity_id=? and vote_status=?", aid, status).
// Desc("created_at").Get(t) // Desc("created_at").Get(t)
//} //}
func (t *NewVoteActivity) UpdateToStatusByAid(aid int64, before string, after string) (int64, error) {
func (t *NewVoteActivity) UpdateToStatusByAid(aid int, before string, after string) (int64, error) {
t.VoteStatus = after t.VoteStatus = after
t.UpdatedAt = time.Now() t.UpdatedAt = time.Now()
return core.GetXormAuto().Where("is_delete=0 and vote_status=? and activity_id=?", before, aid). return core.GetXormAuto().Where("is_delete=0 and vote_status=? and activity_id=?", before, aid).
Cols("vote_status", "updated_at").Update(t) Cols("vote_status", "updated_at").Update(t)
} }
func (t *NewVoteActivity) UpdateStatusById(id int64, status string) (int64, error) {
func (t *NewVoteActivity) UpdateStatusById(id int, status string) (int64, error) {
t.VoteStatus = status t.VoteStatus = status
t.UpdatedAt = time.Now() t.UpdatedAt = time.Now()
return core.GetXormAuto().Where("is_delete=0 and id=?", id). return core.GetXormAuto().Where("is_delete=0 and id=?", id).
Cols("vote_status", "updated_at").Update(t) Cols("vote_status", "updated_at").Update(t)
} }
func (t *NewVoteActivity) GetCurrent(aid int64) (bool, error) {
func (t *NewVoteActivity) GetCurrent(aid int) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and (vote_status=? or vote_status=?)", return core.GetXormAuto().Where("is_delete=0 and activity_id=? and (vote_status=? or vote_status=?)",
aid, define.StatusReady, define.StatusRunning).Desc("created_at").Get(t) aid, define.StatusReady, define.StatusRunning).Desc("created_at").Get(t)
} }
func UpdateVoteStatusByActivityId(aid int64) (int64, error) {
func UpdateVoteStatusByActivityId(aid int) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid). return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).
Update(&NewVoteActivity{VoteStatus: define.StatusNotBegin}) Update(&NewVoteActivity{VoteStatus: define.StatusNotBegin})
} }

19
models/new_vote_activity_history.go

@ -1,18 +1,19 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const VoteActivityHistoryTableName = TableNamePrefix + "new_vote_activity_history" const VoteActivityHistoryTableName = TableNamePrefix + "new_vote_activity_history"
type NewVoteActivityHistory struct { type NewVoteActivityHistory struct {
Id int64 `json:"id" xorm:"pk autoincr INT(11)"`
VoteActivityId int64 `json:"vote_activity_id" xorm:"not null default(0) comment('投票活动id') INT(11)"`
VoteActivityLadderId int64 `json:"vote_activity_ladder_id" xorm:"not null default(0) comment('投票活动对象') INT(11)"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式') INT(11)"`
UserId int64 `json:"user_id" xorm:"not null default(0) comment('投票人') INT(11)"`
Id int `json:"id" xorm:"pk autoincr INT(11)"`
VoteActivityId int `json:"vote_activity_id" xorm:"not null default(0) comment('投票活动id') INT(11)"`
VoteActivityLadderId int `json:"vote_activity_ladder_id" xorm:"not null default(0) comment('投票活动对象') INT(11)"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式') INT(11)"`
UserId int `json:"user_id" xorm:"not null default(0) comment('投票人') INT(11)"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间')"` CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间')"`
@ -27,17 +28,17 @@ func (t *NewVoteActivityHistory) Alias(name string) string {
return Alias(t, name) return Alias(t, name)
} }
func (t *NewVoteActivityHistory) ExistByLadderId(uid, lid, rid int64, archId interface{}) (bool, error) {
func (t *NewVoteActivityHistory) ExistByLadderId(uid, lid, rid int, archId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and user_id=? and vote_activity_ladder_id=? and "+ return core.GetXormAuto().Where("is_delete=0 and user_id=? and vote_activity_ladder_id=? and "+
" rehearsal_id=? and arch_id=?", uid, lid, rid, archId).Exist(t) " rehearsal_id=? and arch_id=?", uid, lid, rid, archId).Exist(t)
} }
func (t *NewVoteActivityHistory) ExistByVoteId(uid, vid, rid int64, archId interface{}) (bool, error) {
func (t *NewVoteActivityHistory) ExistByVoteId(uid, vid, rid int, archId interface{}) (bool, error) {
return core.GetXormAuto().Where("is_delete=0 and user_id=? and vote_activity_id=? and "+ return core.GetXormAuto().Where("is_delete=0 and user_id=? and vote_activity_id=? and "+
" rehearsal_id=? and arch_id=?", uid, vid, rid, archId).Exist(t) " rehearsal_id=? and arch_id=?", uid, vid, rid, archId).Exist(t)
} }
func (t *NewVoteActivityHistory) CountUser(uid, rid, vid int64, archId interface{}) (int64, error) {
func (t *NewVoteActivityHistory) CountUser(uid, rid, vid int, archId interface{}) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and user_id=? and rehearsal_id=? and "+ return core.GetXormAuto().Where("is_delete=0 and user_id=? and rehearsal_id=? and "+
" vote_activity_id=? and arch_id=?", uid, rid, vid, archId).Count(t) " vote_activity_id=? and arch_id=?", uid, rid, vid, archId).Count(t)
} }

13
models/new_vote_activity_ladder.go

@ -1,19 +1,20 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const VoteActivityLadderTableName = TableNamePrefix + "new_vote_activity_ladder" const VoteActivityLadderTableName = TableNamePrefix + "new_vote_activity_ladder"
type NewVoteActivityLadder struct { type NewVoteActivityLadder struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
VoteActivityId int64 `json:"vote_activity_id" xorm:"not null comment('投票轮次的id') INT(11)"`
VoteNumber int64 `json:"vote_number" xorm:"not null comment('投票的初始的票数') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
VoteActivityId int `json:"vote_activity_id" xorm:"not null comment('投票轮次的id') INT(11)"`
VoteNumber int `json:"vote_number" xorm:"not null comment('投票的初始的票数') INT(11)"`
VoteMember string `json:"vote_member" xorm:"not null comment('投票的人员名字') VARCHAR(255)"` VoteMember string `json:"vote_member" xorm:"not null comment('投票的人员名字') VARCHAR(255)"`
MemberImg string `json:"member_img" xorm:"not null comment('被投票人员的图片')"` MemberImg string `json:"member_img" xorm:"not null comment('被投票人员的图片')"`
TotalNumber int64 `json:"total_number" xorm:"not null default 0 comment('投票总数') INT(11)"`
TotalNumber int `json:"total_number" xorm:"not null default 0 comment('投票总数') INT(11)"`
IsVote bool `json:"is_vote" xorm:"-" description:"是否被投票"` IsVote bool `json:"is_vote" xorm:"-" description:"是否被投票"`
IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"`
CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"`
@ -24,7 +25,7 @@ func (t *NewVoteActivityLadder) TableName() string {
return VoteActivityLadderTableName return VoteActivityLadderTableName
} }
func (t *NewVoteActivityLadder) Incr(id, number int64) (int64, error) {
func (t *NewVoteActivityLadder) Incr(id, number int) (int64, error) {
return core.GetXormAuto().Where("is_delete=0 and id=?", id).Incr("total_number", number).Update(t) return core.GetXormAuto().Where("is_delete=0 and id=?", id).Incr("total_number", number).Update(t)
} }

13
models/order_draw_activity.go

@ -1,17 +1,18 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const OrderDrawActivityTableName = TableNamePrefix + "order_draw_activity" const OrderDrawActivityTableName = TableNamePrefix + "order_draw_activity"
//订单抽奖活动 //订单抽奖活动
type OrderDrawActivity struct { type OrderDrawActivity struct {
Id int64 `json:"id"`
ActivityId int64 `json:"activity_id" description:"活动的id"`
CreatorId int64 `json:"creator_id"`
Id int `json:"id"`
ActivityId int `json:"activity_id" description:"活动的id"`
CreatorId int `json:"creator_id"`
OrderDrawActivityName string `json:"order_draw_activity_name"` OrderDrawActivityName string `json:"order_draw_activity_name"`
OrderDrawRule *OrderDrawRule `json:"order_draw_rule" xorm:"-"` OrderDrawRule *OrderDrawRule `json:"order_draw_rule" xorm:"-"`
MoreAreaMode string `json:"more_area_mode"` MoreAreaMode string `json:"more_area_mode"`
@ -25,8 +26,8 @@ func (t *OrderDrawActivity) TableName() string {
return OrderDrawActivityTableName return OrderDrawActivityTableName
} }
func GetODActivityIdsByActivityId(aid int64) ([]int64, error) {
orderIds := make([]int64, 0)
func GetODActivityIdsByActivityId(aid int) ([]int, error) {
orderIds := make([]int, 0)
err := core.GetXormAuto().Table(new(OrderDrawActivity)).Select("id"). err := core.GetXormAuto().Table(new(OrderDrawActivity)).Select("id").
Where("is_delete=0 and activity_id=?", aid).Find(&orderIds) Where("is_delete=0 and activity_id=?", aid).Find(&orderIds)
return orderIds, err return orderIds, err

18
models/order_draw_record.go

@ -7,19 +7,19 @@ import (
const OrderDrawRecordTableName = TableNamePrefix + "order_draw_record" const OrderDrawRecordTableName = TableNamePrefix + "order_draw_record"
type OrderDrawRecord struct { type OrderDrawRecord struct {
Id int64 `json:"id" xorm:"not null pk autoincr"`
UserPrizeId int64 `json:"user_prize_id" xorm:"not null comment('用户奖品表id') INT(11)"`
ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id')"`
RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式')"`
OrderDrawActivityId int64 `json:"order_draw_activity_id" xorm:"not null comment('订单抽奖活动id')"`
OrderDrawRuleId int64 `json:"order_draw_rule_id" xorm:"not null comment('订单抽奖规则id')"`
OrderDrawRuleLadderId int64 `json:"order_draw_rule_ladder_id" xorm:"not null comment('订单规则阶梯id')"`
Id int `json:"id" xorm:"not null pk autoincr"`
UserPrizeId int `json:"user_prize_id" xorm:"not null comment('用户奖品表id') INT(11)"`
ActivityId int `json:"activity_id" xorm:"not null comment('主活动id')"`
RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式')"`
OrderDrawActivityId int `json:"order_draw_activity_id" xorm:"not null comment('订单抽奖活动id')"`
OrderDrawRuleId int `json:"order_draw_rule_id" xorm:"not null comment('订单抽奖规则id')"`
OrderDrawRuleLadderId int `json:"order_draw_rule_ladder_id" xorm:"not null comment('订单规则阶梯id')"`
OrderDrawRuleLadder *OrderDrawRuleLadder `json:"order_draw_rule_ladder" xorm:"-"` OrderDrawRuleLadder *OrderDrawRuleLadder `json:"order_draw_rule_ladder" xorm:"-"`
UserId int64 `json:"user_id" xorm:"not null comment('用户id')"`
UserId int `json:"user_id" xorm:"not null comment('用户id')"`
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
User *User `json:"user" xorm:"-"` User *User `json:"user" xorm:"-"`
PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字')"` PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字')"`
AreaId int64 `json:"area_id" xorm:"not null default(0) comment('地区id') BIGINT(20)"`
AreaId int `json:"area_id" xorm:"not null default(0) comment('地区id') BIGINT(20)"`
AreaName string `json:"area_name" xorm:"not null default('') comment('地区id')"` AreaName string `json:"area_name" xorm:"not null default('') comment('地区id')"`
IsDelete bool `json:"-" xorm:"default(0)"` IsDelete bool `json:"-" xorm:"default(0)"`
CreatedAt time.Time `json:"-" xorm:"created"` CreatedAt time.Time `json:"-" xorm:"created"`

13
models/order_draw_rule.go

@ -1,18 +1,19 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const OrderDrawRuleTableName = TableNamePrefix + "order_draw_rule" const OrderDrawRuleTableName = TableNamePrefix + "order_draw_rule"
//订单抽奖抽奖规则 //订单抽奖抽奖规则
type OrderDrawRule struct { type OrderDrawRule struct {
Id int64 `json:"id"`
OrderDrawActivityId int64 `json:"order_lottery_draw_activity_id" description:"订单抽奖活动的的id"`
Id int `json:"id"`
OrderDrawActivityId int `json:"order_lottery_draw_activity_id" description:"订单抽奖活动的的id"`
OrderDrawRuleLadders []*OrderDrawRuleLadder `json:"order_draw_rule_ladders" xorm:"-"` OrderDrawRuleLadders []*OrderDrawRuleLadder `json:"order_draw_rule_ladders" xorm:"-"`
AreaId int64 `json:"area_id" description:"地区id"`
AreaId int `json:"area_id" description:"地区id"`
UseTimes int `json:"use_times" description:"使用次数"` UseTimes int `json:"use_times" description:"使用次数"`
Name string `json:"name"` Name string `json:"name"`
PrizeNum int `json:"prize_num" xorm:"-"` PrizeNum int `json:"prize_num" xorm:"-"`
@ -30,8 +31,8 @@ func (t *OrderDrawRule) Alias(name string) string {
return Alias(t, name) return Alias(t, name)
} }
func GetODRuleIdsByODActivityIds(ids []int64) ([]int64, error) {
ruleIds := make([]int64, 0)
func GetODRuleIdsByODActivityIds(ids []int) ([]int, error) {
ruleIds := make([]int, 0)
err := core.GetXormAuto().Table(new(OrderDrawRule)).Select("id"). err := core.GetXormAuto().Table(new(OrderDrawRule)).Select("id").
Where("is_delete=0").In("order_draw_activity_id", ids).Find(&ruleIds) Where("is_delete=0").In("order_draw_activity_id", ids).Find(&ruleIds)
return ruleIds, err return ruleIds, err

9
models/order_draw_rule_ladder.go

@ -1,17 +1,18 @@
package models package models
import ( import (
"github.com/ouxuanserver/osmanthuswine/src/core"
"hudongzhuanjia/utils/define" "hudongzhuanjia/utils/define"
"time" "time"
"github.com/ouxuanserver/osmanthuswine/src/core"
) )
const OrderDrawRuleLadderTableName = TableNamePrefix + "order_draw_rule_ladder" const OrderDrawRuleLadderTableName = TableNamePrefix + "order_draw_rule_ladder"
//订单抽奖抽奖规则梯子 //订单抽奖抽奖规则梯子
type OrderDrawRuleLadder struct { type OrderDrawRuleLadder struct {
Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"`
OrderDrawRuleId int64 `json:"order_draw_rule_id" xorm:"not null comment('订单轮次的id') INT(11)"`
Id int `json:"id" xorm:"not null pk autoincr INT(11)"`
OrderDrawRuleId int `json:"order_draw_rule_id" xorm:"not null comment('订单轮次的id') INT(11)"`
PrizeLevel string `json:"prize_level" xorm:"not null default('1') comment('奖品等级') VARCHAR(128)"` PrizeLevel string `json:"prize_level" xorm:"not null default('1') comment('奖品等级') VARCHAR(128)"`
PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字') VARCHAR(255)"` PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字') VARCHAR(255)"`
PrizeNumber int `json:"prize_number" xorm:"not null default(0) comment('奖品数量') INT(11)"` PrizeNumber int `json:"prize_number" xorm:"not null default(0) comment('奖品数量') INT(11)"`
@ -32,7 +33,7 @@ func (t *OrderDrawRuleLadder) Alias(name string) string {
return Alias(t, name) return Alias(t, name)
} }
func UpdateODLadderStatusByODRuleIds(ids []int64) (int64, error) {
func UpdateODLadderStatusByODRuleIds(ids []int) (int64, error) {
return core.GetXormAuto().Where("is_delete=0").In("order_draw_rule_id", ids). return core.GetXormAuto().Where("is_delete=0").In("order_draw_rule_id", ids).
Update(&OrderDrawRuleLadder{Status: define.StatusNotBegin}) Update(&OrderDrawRuleLadder{Status: define.StatusNotBegin})
} }

2
models/order_draw_style.go

@ -6,7 +6,7 @@ import (
//订单抽奖样式 //订单抽奖样式
type OrderDrawStyle struct { type OrderDrawStyle struct {
Id int64 `json:"id"`
Id int `json:"id"`
StyleName string `json:"style_name" description:"样式的名字"` StyleName string `json:"style_name" description:"样式的名字"`
StyleImageUrl string `json:"style_image_url" description:"样式的图片地址"` StyleImageUrl string `json:"style_image_url" description:"样式的图片地址"`
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"`

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save