From fa021089ce858b510911bce44a3c43624940c2ff Mon Sep 17 00:00:00 2001 From: tommy <3405129587@qq.com> Date: Fri, 31 Jul 2020 15:22:53 +0800 Subject: [PATCH] fix:bug --- controllers/author.go | 7 ++-- controllers/base.go | 4 +-- controllers/client/activity.go | 4 +-- controllers/client/auction.go | 8 ++--- controllers/client/barrage.go | 4 +-- controllers/client/bully_screen.go | 10 +++--- controllers/client/calorie.go | 4 +-- controllers/client/good.go | 29 ++++++++-------- controllers/client/invite_envelope.go | 6 ++-- controllers/client/live.go | 25 +++++++------- controllers/client/login.go | 13 +++---- controllers/client/lottery.go | 18 +++++----- controllers/client/order_entry.go | 38 +++++++++++++-------- controllers/client/reward.go | 6 ++-- controllers/client/shake_red_envelope.go | 8 ++--- controllers/client/sign.go | 22 ++++++------ controllers/client/tug_war.go | 10 +++--- controllers/client/upper_wall.go | 4 +-- controllers/client/vote.go | 13 +++---- controllers/common/im.go | 2 +- controllers/common/wechat_oauth.go | 3 +- controllers/pc/activity.go | 6 ++-- controllers/pc/area_store.go | 2 +- controllers/pc/auction.go | 26 +++++++------- controllers/pc/barrage.go | 6 ++-- controllers/pc/bully_screen.go | 14 ++++---- controllers/pc/calorie.go | 16 ++++----- controllers/pc/login.go | 4 +-- controllers/pc/lottery_draw.go | 38 ++++++++++----------- controllers/pc/order_draw.go | 53 +++++++++++++++-------------- controllers/pc/reward.go | 12 +++---- controllers/pc/shake_red_envelope.go | 27 ++++++++------- controllers/pc/sign.go | 12 +++---- controllers/pc/tug_war.go | 22 ++++++------ controllers/pc/upper_wall.go | 12 +++---- controllers/pc/vote.go | 21 ++++++------ controllers/pc/ws.go | 4 +-- hdws/ws/client.go | 5 +-- hdws/ws/jwt_go.go | 12 +++---- hdws/ws/message.go | 2 +- hdws/ws/timer.go | 6 ++-- libs/jwt/jwt_go.go | 12 +++---- libs/qq/qq.go | 5 +-- libs/wx/wx.go | 7 ++-- models/CalorieUser.go | 15 ++++---- models/activity.go | 6 ++-- models/activity_module_service.go | 10 +++--- models/arch.go | 3 +- models/area_store.go | 12 +++---- models/auction_activity.go | 4 +-- models/auction_deal.go | 4 +-- models/auction_history.go | 22 ++++++------ models/auction_player.go | 13 +++---- models/auction_result_record.go | 19 ++++++----- models/auction_rule.go | 10 +++--- models/bahe_activity.go | 6 ++-- models/bahe_history.go | 6 ++-- models/bahe_rule.go | 8 ++--- models/bahe_team.go | 13 +++---- models/bahe_team_member.go | 12 +++---- models/barrage_history.go | 6 ++-- models/base.go | 5 +-- models/bully_screen_history.go | 23 +++++++------ models/bully_screen_server.go | 9 ++--- models/bully_screen_wallet.go | 9 ++--- models/bully_screen_wallet_hisotry.go | 8 ++--- models/calorie.go | 15 ++++---- models/customer.go | 17 ++++----- models/customer_goods.go | 11 +++--- models/customer_operation.go | 18 +++++----- models/customer_order.go | 24 ++++++------- models/customer_order_option.go | 13 +++---- models/customer_order_sub.go | 9 ++--- models/dan_mu_server.go | 9 ++--- models/invitation.go | 6 ++-- models/invitation_letter.go | 10 +++--- models/live_config.go | 9 ++--- models/live_config_area.go | 9 ++--- models/live_red_envelope_rule.go | 10 +++--- models/live_viewer.go | 13 +++---- models/lottery_draw_activity.go | 13 +++---- models/lottery_draw_envelope_wallet.go | 4 +-- models/lottery_draw_record.go | 27 ++++++++------- models/lottery_draw_rule.go | 17 ++++----- models/lottery_draw_rule_ladder.go | 9 ++--- models/lottery_draw_wallet_history.go | 4 +-- models/lottery_draw_winner.go | 8 ++--- models/module_service.go | 2 +- models/module_service_history.go | 10 +++--- models/module_style.go | 4 +-- models/msg_wall_server.go | 6 ++-- models/new_auction_activity.go | 22 ++++++------ models/new_vote_activity.go | 19 ++++++----- models/new_vote_activity_history.go | 19 ++++++----- models/new_vote_activity_ladder.go | 13 +++---- models/order_draw_activity.go | 13 +++---- models/order_draw_record.go | 18 +++++----- models/order_draw_rule.go | 13 +++---- models/order_draw_rule_ladder.go | 9 ++--- models/order_draw_style.go | 2 +- models/order_draw_winner.go | 10 +++--- models/order_entry_person.go | 11 +++--- models/order_gift.go | 9 ++--- models/real_sign_history.go | 14 ++++---- models/real_sign_list.go | 9 ++--- models/rehearsal.go | 10 +++--- models/reward_history.go | 20 +++++------ models/reward_server.go | 9 ++--- models/reward_wallet.go | 9 ++--- models/reward_wallet_history.go | 8 ++--- models/sensitive.go | 5 +-- models/shake_red_envelope_activity.go | 13 +++---- models/shake_red_envelope_record.go | 24 ++++++------- models/shake_red_envelope_rule.go | 17 ++++----- models/shake_red_envelope_rule_ladder.go | 6 ++-- models/shake_red_envelope_user.go | 13 +++---- models/shake_red_envelope_wallet.go | 4 +-- models/shake_red_envelope_wallet_history.go | 4 +-- models/shake_red_envelope_winner.go | 6 ++-- models/sign_history.go | 17 ++++----- models/sign_rule.go | 4 +-- models/sign_up.go | 9 ++--- models/tug_of_war.go | 12 +++---- models/ui_base.go | 4 +-- models/upper_wall.go | 8 ++--- models/user.go | 9 ++--- models/user_order.go | 15 ++++---- models/user_prize.go | 15 ++++---- models/user_red_pack.go | 9 ++--- models/user_transfer.go | 5 +-- models/user_wallet_history.go | 4 +-- models/vote_activity.go | 4 +-- models/vote_envelope_wallet.go | 4 +-- models/vote_history.go | 8 ++--- models/vote_rule.go | 10 +++--- models/vote_rule_ladder.go | 8 ++--- models/vote_style.go | 2 +- models/vote_wallet_history.go | 4 +-- services/activity/activity.go | 15 ++++---- services/activity/module.go | 7 ++-- services/auction/auction.go | 13 +++---- services/bahe/score.go | 6 ++-- services/bahe/tug_war.go | 8 ++--- services/balance/balance.go | 9 ++--- services/bully_reward/current.go | 2 +- services/bully_reward/dao.go | 33 +++++++++--------- services/calorie/calorie.go | 15 ++++---- services/im/im.go | 4 +-- services/invitation/setting.go | 2 +- services/lottery/lottery.go | 41 +++++++++++----------- services/lottery/order.go | 9 ++--- services/pay/order.go | 9 ++--- services/red_envelope/red_envelop.go | 7 ++-- services/upper_wall/upper_wall.go | 5 +-- services/vote/vote.go | 14 ++++---- services/ws_send/send.go | 15 ++++---- test/bindata.go | 4 +-- test/config.go | 7 ++-- test/config_test.go | 15 ++++---- utils/utils.go | 15 ++------ 160 files changed, 934 insertions(+), 863 deletions(-) diff --git a/controllers/author.go b/controllers/author.go index c2dcebc..6907223 100644 --- a/controllers/author.go +++ b/controllers/author.go @@ -1,10 +1,11 @@ package controllers import ( - jwt2 "github.com/dgrijalva/jwt-go" "hudongzhuanjia/libs/jwt" "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" + + jwt2 "github.com/dgrijalva/jwt-go" ) //执行路由方法前校验登陆态,并且解析page、pageSize @@ -15,7 +16,7 @@ type AuthorCtl struct { func (t *AuthorCtl) Prepare() { t.BaseCtl.Prepare() - skip, _ := t.GetInt64("skip") + skip, _ := t.GetInt("skip") if skip != 0 { t.claims = &jwt.Claims{ AccountType: "customer", @@ -52,7 +53,7 @@ func (t *AuthorCtl) Prepare() { } } -func (t *AuthorCtl) GetAccountId() int64 { +func (t *AuthorCtl) GetAccountId() int { return t.claims.AccountId } diff --git a/controllers/base.go b/controllers/base.go index d9493b5..6bbaf2c 100644 --- a/controllers/base.go +++ b/controllers/base.go @@ -2,13 +2,14 @@ package controllers import ( "fmt" - "go.uber.org/zap" "hudongzhuanjia/logger" "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" "net/http" "strconv" + "go.uber.org/zap" + "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) if err != nil { - logger.Error("get int64 from request error", err) t.ERROR(fmt.Sprintf("%v的数据类型不为int", key), code.MSG_ERR_Param) return value, false } diff --git a/controllers/client/activity.go b/controllers/client/activity.go index 79a9de4..1b68efd 100644 --- a/controllers/client/activity.go +++ b/controllers/client/activity.go @@ -19,7 +19,7 @@ type ActivityCtl struct { } func (t *ActivityCtl) ModuleStatus() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") moduleName := t.MustGet("module_name") exist, err := activity_service.ExistModuleByActivityId(activityId, moduleName) t.CheckErr(err) @@ -30,7 +30,7 @@ func (t *ActivityCtl) ModuleStatus() { // 某个模块的活动状态 func (t *ActivityCtl) ModuleCurrent() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") moduleName := t.MustGet("module_name") uid := t.GetAccountId() diff --git a/controllers/client/auction.go b/controllers/client/auction.go index 51ed01e..c4167ad 100644 --- a/controllers/client/auction.go +++ b/controllers/client/auction.go @@ -18,10 +18,10 @@ type AuctionCtl struct { // 竞拍动作 // todo: 进行替换 func (t *AuctionCtl) Auction() { - auctionId := t.MustGetInt64("auction_activity_id") + auctionId := t.MustGetInt("auction_activity_id") totalMoney := t.MustGetDouble("total_money") uid := t.GetAccountId() - areaId := t.MustGetInt64("area_id") + areaId := t.MustGetInt("area_id") if totalMoney < 0 { t.ERROR("金额不能为0", code.MSG_ERR) @@ -148,7 +148,7 @@ func (t *AuctionCtl) Auction() { } func (t *AuctionCtl) ExistRecord() { - auctionId := t.MustGetInt64("auction_activity_id") + auctionId := t.MustGetInt("auction_activity_id") uid := t.GetAccountId() auction := new(models.NewAuctionActivity) @@ -172,7 +172,7 @@ func (t *AuctionCtl) ExistRecord() { // 已经竞拍到了 func (t *AuctionCtl) UserAuctions() { uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) diff --git a/controllers/client/barrage.go b/controllers/client/barrage.go index 9bf02ee..aec98bb 100644 --- a/controllers/client/barrage.go +++ b/controllers/client/barrage.go @@ -19,8 +19,8 @@ type BarrageCtl struct { //发送弹幕 func (t *BarrageCtl) Send() { 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") //检查内容是否包含敏感 diff --git a/controllers/client/bully_screen.go b/controllers/client/bully_screen.go index 3ae0286..3b68c12 100644 --- a/controllers/client/bully_screen.go +++ b/controllers/client/bully_screen.go @@ -5,7 +5,7 @@ import ( "hudongzhuanjia/libs/filter" "hudongzhuanjia/models" bully_screen_service "hudongzhuanjia/services/bully_reward" - "hudongzhuanjia/services/pay" + pay_service "hudongzhuanjia/services/pay" "hudongzhuanjia/utils/code" "time" ) @@ -17,12 +17,12 @@ type BullyScreenCtl struct { //用户霸屏 func (t *BullyScreenCtl) PaScreen() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") uid := t.GetAccountId() content := t.MustGet("content") second := t.MustGetDouble("second") style := t.MustGetInt("style") - customerId := t.MustGetInt64("customer_id") + customerId := t.MustGetInt("customer_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -51,7 +51,7 @@ func (t *BullyScreenCtl) PaScreen() { var res = make(map[string]interface{}, 0) res["out_trade_no"] = "" 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()) t.CheckErr(err) } @@ -83,7 +83,7 @@ func (t *BullyScreenCtl) PaScreen() { // 审核列表 [未审核,未通过,已通过] func (t *BullyScreenCtl) List() { uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") bss := new(models.BullyScreenServer) exist, err := bss.GetByActivityId(activityId) diff --git a/controllers/client/calorie.go b/controllers/client/calorie.go index d93fc63..0cf8e9e 100644 --- a/controllers/client/calorie.go +++ b/controllers/client/calorie.go @@ -13,7 +13,7 @@ type CalorieCtl struct { // h5 1/s func (t *CalorieCtl) Shake() { - calorieId := t.MustGetInt64("calorie_id") + calorieId := t.MustGetInt("calorie_id") score := t.DefaultInt("score", 0) uid := t.GetAccountId() @@ -37,7 +37,7 @@ func (t *CalorieCtl) Shake() { if calorie.Status == define.StatusRunning && score > 0 { _, err = calorieUser.IncrScore(activity.ArchId, calorieUser.Id, score) t.CheckErr(err) - calorieUser.Score += int64(score) // 增加 + calorieUser.Score += int(score) // 增加 } count, err := calorieUser.CountByCalorieId(calorie.Id, activity.ArchId, activity.RehearsalId) diff --git a/controllers/client/good.go b/controllers/client/good.go index b7a5ef4..31ce5ee 100644 --- a/controllers/client/good.go +++ b/controllers/client/good.go @@ -3,7 +3,6 @@ package client import ( "encoding/json" "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/controllers" "hudongzhuanjia/models" pay_service "hudongzhuanjia/services/pay" @@ -11,6 +10,8 @@ import ( "hudongzhuanjia/utils/define" "strings" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type GoodCtl struct { @@ -18,7 +19,7 @@ type GoodCtl struct { } func (t *GoodCtl) GoodDetail() { - goodsId := t.MustGetInt64("customer_goods_id") + goodsId := t.MustGetInt("customer_goods_id") good := new(models.CustomerGoods) exist, err := models.Get(good, goodsId) t.CheckErr(err) @@ -27,7 +28,7 @@ func (t *GoodCtl) GoodDetail() { } func (t *GoodCtl) GoodOption() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") option := new(models.CustomerOrderOption) exist, err := option.GetByActivityId(activityId) @@ -42,8 +43,8 @@ func (t *GoodCtl) GoodOption() { // 商品列表 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) exist, err := option.GetByActivityId(activityId) @@ -65,9 +66,9 @@ func (t *GoodCtl) ListGood() { } func (t *GoodCtl) ListOrder() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") status := t.MustGet("status") - areaId := t.MustGetInt64("area_id") + areaId := t.MustGetInt("area_id") uid := t.GetAccountId() statusList := strings.Split(status, ",") @@ -88,7 +89,7 @@ func (t *GoodCtl) ListOrder() { orders, err := models.GetCustomerOrdersByActivityId(uid, activity.Id, activity.RehearsalId, areaId, statusList, t.Page, t.PageSize, activity.ArchId) t.CheckErr(err) - orderIds := make([]int64, 0) + orderIds := make([]int, 0) for _, order := range orders { orderIds = append(orderIds, order.Id) } @@ -107,8 +108,8 @@ func (t *GoodCtl) ListOrder() { } 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"` Phone string `json:"phone"` Address string `json:"address"` @@ -122,8 +123,8 @@ func (t *GoodCtl) Order() { if t.Request.OriginRequest.Method == "POST" { t.CheckErr(t.Bind(¶m)) } 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.Phone = t.MustGet("phone") param.Address = t.MustGet("address") @@ -173,7 +174,7 @@ func (t *GoodCtl) Order() { // 检测库存 for _, good := range goods { for _, g := range param.Goods { - if good.Id == int64(g["id"]) { + if good.Id == int(g["id"]) { if good.Stock-g["num"] < 0 { session.Rollback() t.ERROR("商品库存不足", code.MSG_DATA_NOT_EXIST) @@ -200,7 +201,7 @@ func (t *GoodCtl) Order() { } 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) if err != nil { session.Rollback() diff --git a/controllers/client/invite_envelope.go b/controllers/client/invite_envelope.go index 22a2a3a..4be1e95 100644 --- a/controllers/client/invite_envelope.go +++ b/controllers/client/invite_envelope.go @@ -13,8 +13,8 @@ type InvitationLetterCtl struct { func (t *InvitationLetterCtl) Invite() { 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") activity := new(models.Activity) @@ -42,7 +42,7 @@ func (t *InvitationLetterCtl) Invite() { } func (t *InvitationLetterCtl) Setting() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") uid := t.GetAccountId() activity := new(models.Activity) diff --git a/controllers/client/live.go b/controllers/client/live.go index da2d3b1..1912255 100644 --- a/controllers/client/live.go +++ b/controllers/client/live.go @@ -2,7 +2,6 @@ package client import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/controllers" "hudongzhuanjia/libs/filter" "hudongzhuanjia/libs/im" @@ -14,6 +13,8 @@ import ( "hudongzhuanjia/utils/define" "sync" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) // 轮询接口 @@ -26,7 +27,7 @@ func QueryOnline() error { if err != nil { return err } - liveIds := make([]int64, 0) + liveIds := make([]int, 0) for _, live := range lives { // 查询在线人数 liveIds = append(liveIds, live.Id) } @@ -35,7 +36,7 @@ func QueryOnline() error { return err } - var idm = make(map[int64][]string, 0) + var idm = make(map[int][]string, 0) for _, live := range lives { for _, viewer := range viewers { if live.Id == viewer.LiveConfigId { @@ -50,7 +51,7 @@ func QueryOnline() error { wg.Add(len(idm)) var errs []error for lid, ids := range idm { - go func(int64, []string) { + go func(int, []string) { defer func() { recover() }() defer wg.Done() res, err := im.QueryState(ids) @@ -79,8 +80,8 @@ type LiveCtl struct { // 详情 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) exist, err := live.GetByActivityId(activityId) @@ -123,7 +124,7 @@ func (t *LiveCtl) Detail() { } func (t *LiveCtl) Like() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") _, err := new(models.LiveConfig).Like(activityId) t.CheckErr(err) @@ -139,7 +140,7 @@ func (t *LiveCtl) Like() { } func (t *LiveCtl) LoopQuery() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") live := new(models.LiveConfig) exist, err := live.GetByActivityId(activityId) t.CheckErr(err) @@ -154,11 +155,11 @@ func (t *LiveCtl) LoopQuery() { // 维护一个队列进行循环, 遍历是否付款成功 func (t *LiveCtl) SendLiveRedPack() { userId := t.GetAccountId() // 用户 uid - activityId := t.MustGetInt64("activity_id") // activity_id + activityId := t.MustGetInt("activity_id") // activity_id num := t.MustGetInt("num") // 红包数量 prompt := t.MustGet("prompt") // 提示 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 t.ERROR("每个红包的平均金额必须在1.00元到200.00元之间", code.MSG_ERR) @@ -175,7 +176,7 @@ func (t *LiveCtl) SendLiveRedPack() { t.CheckErr(err) 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()) t.CheckErr(err) @@ -218,7 +219,7 @@ func (t *LiveCtl) SendLiveRedPack() { // 领取红包 func (t *LiveCtl) GetLiveRedPack() { - ruleId := t.MustGetInt64("live_red_envelope_rule_id") + ruleId := t.MustGetInt("live_red_envelope_rule_id") userId := t.GetAccountId() rule := new(models.LiveRedEnvelopeRule) diff --git a/controllers/client/login.go b/controllers/client/login.go index 56fe75a..2dbef7e 100644 --- a/controllers/client/login.go +++ b/controllers/client/login.go @@ -2,7 +2,6 @@ package client import ( "fmt" - mpoauth2 "github.com/chanxuehong/wechat/mp/oauth2" "hudongzhuanjia/controllers" "hudongzhuanjia/libs/im" "hudongzhuanjia/libs/jwt" @@ -13,6 +12,8 @@ import ( "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" "time" + + mpoauth2 "github.com/chanxuehong/wechat/mp/oauth2" ) //用户 @@ -24,7 +25,7 @@ type UserCtl struct { func (t *UserCtl) EntryLogin() { account := t.MustGet("account") password := t.MustGet("password") - activityId := t.MustGetInt64("activity_id") // 需要获取 + activityId := t.MustGetInt("activity_id") // 需要获取 entryPeople := new(models.OrderEntryPerson) exist, err := entryPeople.Auth(account, password, activityId) @@ -59,7 +60,7 @@ func (t *UserCtl) EntryLogin() { } func (t *UserCtl) WxLogin() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") wxcode := t.MustGet("code") logger.Error("微信code:", wxcode) @@ -191,9 +192,9 @@ func (t *UserCtl) Login() { // 模拟wx login 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) exist, err := models.Get(user, uid) diff --git a/controllers/client/lottery.go b/controllers/client/lottery.go index 8424477..20fea65 100644 --- a/controllers/client/lottery.go +++ b/controllers/client/lottery.go @@ -15,7 +15,7 @@ type LotteryCtl struct { func (t *LotteryCtl) UserLotteries() { userId := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -33,7 +33,7 @@ func (t *LotteryCtl) UserLotteries() { func (t *LotteryCtl) CashLottery() { uid := t.GetAccountId() - prizeId := t.MustGetInt64("prize_id") + prizeId := t.MustGetInt("prize_id") name := t.MustGet("name") phone := t.MustGet("phone") wxNo := t.MustGet("wx_no") @@ -61,7 +61,7 @@ func (t *LotteryCtl) CashLottery() { func (t *LotteryCtl) CheckLottery() { uid := t.GetAccountId() - ladderId := t.MustGetInt64("lottery_draw_ladder_id") + ladderId := t.MustGetInt("lottery_draw_ladder_id") ladder := &models.LotteryDrawRuleLadder{} exist, err := models.Get(ladder, ladderId) @@ -95,8 +95,8 @@ func (t *LotteryCtl) CheckLottery() { //获取中奖名单 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) exist, err := models.Get(activity, activityId) @@ -119,9 +119,9 @@ func (t *LotteryCtl) Winners() { // 抽奖用户 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) exist, err := models.Get(activity, activityId) @@ -137,7 +137,7 @@ func (t *LotteryCtl) Users() { t.CheckErr(err) t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "活动模块不存在") - recordIds := make([]int64, 0) + recordIds := make([]int, 0) if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT { // 去重标志 recordIds, err = models.GetUserIdsByLotteryDrawRuleId(ladder.LotteryDrawRuleId, activity.RehearsalId, areaId, activity.ArchId) diff --git a/controllers/client/order_entry.go b/controllers/client/order_entry.go index 95479b9..dab10ab 100644 --- a/controllers/client/order_entry.go +++ b/controllers/client/order_entry.go @@ -2,13 +2,14 @@ package client import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/controllers" "hudongzhuanjia/models" invitation_service "hudongzhuanjia/services/invitation" "hudongzhuanjia/utils" "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type OrderEntryCtl struct { @@ -18,13 +19,22 @@ type OrderEntryCtl struct { // 用户查看所有商品 func (t *OrderEntryCtl) List() { _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) t.CheckErr(err) if _type == define.TYPE_H5USER { - uid := t.GetAccountId() for index := range goods { url := fmt.Sprintf("%s/PcClient/Client/OrderEntryCtl/order?"+ "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() { - userId := t.MustGetInt64("user_id") - goodId := t.MustGetInt64("good_id") + userId := t.MustGetInt("user_id") + goodId := t.MustGetInt("good_id") entryId := t.GetAccountId() entryPerson := models.OrderEntryPerson{} @@ -384,7 +394,7 @@ func (t *OrderEntryCtl) ManualOrder() { } func (t *OrderEntryCtl) DeleteOrder() { - orderId := t.MustGetInt64("order_id") + orderId := t.MustGetInt("order_id") order := new(models.CustomerOrder) exist, err := models.Get(order, orderId) t.CheckErr(err) @@ -399,8 +409,8 @@ func (t *OrderEntryCtl) DeleteOrder() { } 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"` GoodName string `json:"good_name"` OrderTime string `json:"order_time"` @@ -411,7 +421,7 @@ type OrderListResult struct { func (t *OrderEntryCtl) EntryOrders() { uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") entry := new(models.OrderEntryPerson) exist, err := models.Get(entry, uid) @@ -460,7 +470,7 @@ type UserOrdersResult struct { // 用户查看订单列表 func (t *OrderEntryCtl) UserOrders() { uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -487,9 +497,9 @@ func (t *OrderEntryCtl) UserOrders() { // 二维码 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", define.HOST, userId, activityId, goodId) qr, err := utils.Qrcode2Base64(Url) diff --git a/controllers/client/reward.go b/controllers/client/reward.go index 1600267..25428e8 100644 --- a/controllers/client/reward.go +++ b/controllers/client/reward.go @@ -17,7 +17,7 @@ type RewardCtl struct { } func (t *RewardCtl) Reward() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") content := t.MustGet("content") amount := t.MustGetDouble("amount") uid := t.GetAccountId() @@ -57,7 +57,7 @@ func (t *RewardCtl) Reward() { var expireAt = time.Now().Add(24 * time.Hour).Unix() res["out_trade_no"] = "" 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) t.CheckErr(err) } @@ -91,7 +91,7 @@ func (t *RewardCtl) Reward() { func (t *RewardCtl) List() { uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) diff --git a/controllers/client/shake_red_envelope.go b/controllers/client/shake_red_envelope.go index 614c6e2..d993065 100644 --- a/controllers/client/shake_red_envelope.go +++ b/controllers/client/shake_red_envelope.go @@ -18,7 +18,7 @@ type ShakeRedEnvelopeCtl struct { } func (t *ShakeRedEnvelopeCtl) Status() { - ruleId := t.MustGetInt64("shake_red_envelope_rule_id") + ruleId := t.MustGetInt("shake_red_envelope_rule_id") rule := new(models.ShakeRedEnvelopeRule) exist, err := models.Get(rule, ruleId) t.CheckErr(err) @@ -29,9 +29,9 @@ func (t *ShakeRedEnvelopeCtl) Status() { } func (t *ShakeRedEnvelopeCtl) Shake() { - ruleId := t.MustGetInt64("shake_red_envelope_rule_id") + ruleId := t.MustGetInt("shake_red_envelope_rule_id") userId := t.GetAccountId() - areaId := t.MustGetInt64("area_id") + areaId := t.MustGetInt("area_id") // 查询摇红包规则 rule := new(models.ShakeRedEnvelopeRule) @@ -144,7 +144,7 @@ func (t *ShakeRedEnvelopeCtl) Shake() { // 用户红包 func (t *ShakeRedEnvelopeCtl) UserRedEnvelopes() { uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) diff --git a/controllers/client/sign.go b/controllers/client/sign.go index 67ea176..e652d7e 100644 --- a/controllers/client/sign.go +++ b/controllers/client/sign.go @@ -16,8 +16,8 @@ type SignCtl struct { } 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() _type := t.MustGetInt("type") @@ -86,7 +86,7 @@ func (t *SignCtl) CheckSign() { } func (t *SignCtl) Setting() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") service := new(models.ModuleService) exist, err := service.GetByName(define.MODULE_SIGNIN) @@ -115,9 +115,9 @@ func (t *SignCtl) Setting() { //签到动作 func (t *SignCtl) Sign() { uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") _type := t.DefaultInt("type", 0) // 默认 0 - areaId := t.MustGetInt64("area_id") + areaId := t.MustGetInt("area_id") //根据activity_id查找主活动的信息 activity := new(models.Activity) @@ -199,9 +199,9 @@ func (t *SignCtl) Sign() { // 实名签到 func (t *SignCtl) RealSign() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") userId := t.GetAccountId() - areaId := t.MustGetInt64("area_id") + areaId := t.MustGetInt("area_id") user := new(models.User) exist, err := models.Get(user, userId) @@ -293,8 +293,8 @@ func (t *SignCtl) RealSign() { func (t *SignCtl) ApplySign() { 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) exist, err := models.Get(activity, activityId) @@ -318,8 +318,8 @@ func (t *SignCtl) ApplySign() { func (t *SignCtl) CheckRealSign() { 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) exist, err := models.Get(activity, activityId) diff --git a/controllers/client/tug_war.go b/controllers/client/tug_war.go index c5f94db..aadc80d 100644 --- a/controllers/client/tug_war.go +++ b/controllers/client/tug_war.go @@ -15,7 +15,7 @@ type TugOfWarCtl struct { func (t *TugOfWarCtl) Status() { // 获取此次活动的状态 - baheId := t.MustGetInt64("bahe_activity_id") + baheId := t.MustGetInt("bahe_activity_id") uid := t.GetAccountId() // 找到活动 bahe := new(models.TugOfWar) @@ -63,8 +63,8 @@ func (t *TugOfWarCtl) Status() { func (t *TugOfWarCtl) Shake() { 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{} exist, err := models.Get(bahe, baheId) @@ -107,8 +107,8 @@ func (t *TugOfWarCtl) Shake() { } 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() bahe := new(models.TugOfWar) diff --git a/controllers/client/upper_wall.go b/controllers/client/upper_wall.go index 65e5684..d161cf8 100644 --- a/controllers/client/upper_wall.go +++ b/controllers/client/upper_wall.go @@ -16,7 +16,7 @@ type UpperWallCtl struct { //发送上墙消息 func (t *UpperWallCtl) Send() { uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") category := t.MustGetInt("category") content, _ := t.Get("content") img, _ := t.Get("img") @@ -58,7 +58,7 @@ func (t *UpperWallCtl) Send() { } func (t *UpperWallCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") userId := t.GetAccountId() activity := new(models.Activity) diff --git a/controllers/client/vote.go b/controllers/client/vote.go index 2fb030d..4d03d83 100644 --- a/controllers/client/vote.go +++ b/controllers/client/vote.go @@ -2,10 +2,11 @@ package client import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/controllers" "hudongzhuanjia/models" "hudongzhuanjia/utils/code" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type VoteCtl struct { @@ -15,7 +16,7 @@ type VoteCtl struct { //投票 func (t *VoteCtl) Vote() { uid := t.GetAccountId() - ladderId := t.MustGetInt64("vote_activity_ladder_id") + ladderId := t.MustGetInt("vote_activity_ladder_id") //检查是否可以投票 ladder := new(models.NewVoteActivityLadder) @@ -48,7 +49,7 @@ func (t *VoteCtl) Vote() { } else { num, err := history.CountUser(uid, activity.RehearsalId, vote.Id, activity.ArchId) t.CheckErr(err) - if num >= vote.ModelNum { + if int(num) >= vote.ModelNum { t.ERROR(fmt.Sprintf("您投票人数已超过%d人", vote.ModelNum), code.MSG_ERR) } } @@ -68,7 +69,7 @@ func (t *VoteCtl) Vote() { // 投票活动列表 func (t *VoteCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") // 该活动是否进行中 activity := new(models.Activity) @@ -87,9 +88,9 @@ func (t *VoteCtl) List() { } func (t *VoteCtl) Detail() { - voteActivityId := t.MustGetInt64("vote_activity_id") + voteActivityId := t.MustGetInt("vote_activity_id") uid := t.GetAccountId() - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) diff --git a/controllers/common/im.go b/controllers/common/im.go index 8f7da05..510f068 100644 --- a/controllers/common/im.go +++ b/controllers/common/im.go @@ -25,7 +25,7 @@ func (t *ImTestCtl) Refund() { } 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{}{ "content": "测试", }) diff --git a/controllers/common/wechat_oauth.go b/controllers/common/wechat_oauth.go index fe10541..5ed4787 100644 --- a/controllers/common/wechat_oauth.go +++ b/controllers/common/wechat_oauth.go @@ -4,7 +4,6 @@ import ( "crypto/sha1" "encoding/xml" "fmt" - "go.uber.org/atomic" "hudongzhuanjia/controllers" "hudongzhuanjia/libs/filter" "hudongzhuanjia/logger" @@ -12,6 +11,8 @@ import ( "hudongzhuanjia/utils/define" "os" "time" + + "go.uber.org/atomic" ) var Now = time.Now() diff --git a/controllers/pc/activity.go b/controllers/pc/activity.go index 09d49df..555b0ec 100644 --- a/controllers/pc/activity.go +++ b/controllers/pc/activity.go @@ -16,10 +16,10 @@ type ActivityCtl struct { } func (t *ActivityCtl) StartActivity() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") mode := t.MustGetInt("mode") // 标识彩排 mode=0正式 mode=1彩排 uid := t.GetAccountId() - limit := t.DefaultInt64("limit", 10) + limit := t.DefaultInt("limit", 10) activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -69,7 +69,7 @@ func (t *ActivityCtl) StartActivity() { } func (t *ActivityCtl) StopActivity() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) diff --git a/controllers/pc/area_store.go b/controllers/pc/area_store.go index 03e95a6..82e78e7 100644 --- a/controllers/pc/area_store.go +++ b/controllers/pc/area_store.go @@ -11,7 +11,7 @@ type AreaStoreCtl struct { } func (t *AreaStoreCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") list, err := models.GetAreaStoresByActivityId(activityId) t.CheckErr(err) diff --git a/controllers/pc/auction.go b/controllers/pc/auction.go index 6eebbef..f68cb69 100644 --- a/controllers/pc/auction.go +++ b/controllers/pc/auction.go @@ -19,7 +19,7 @@ type AuctionCtl struct { // 竞拍准备状态 func (t *AuctionCtl) ReadyAuction() { - auctionId := t.MustGetInt64("auction_activity_id") + auctionId := t.MustGetInt("auction_activity_id") auction := new(models.NewAuctionActivity) exist, err := models.Get(auction, auctionId) t.CheckErr(err) @@ -36,7 +36,7 @@ func (t *AuctionCtl) ReadyAuction() { } func (t *AuctionCtl) StartAuction() { - auctionId := t.MustGetInt64("auction_activity_id") + auctionId := t.MustGetInt("auction_activity_id") auction := new(models.NewAuctionActivity) exist, err := models.Get(auction, auctionId) @@ -57,7 +57,7 @@ func (t *AuctionCtl) StartAuction() { } func (t *AuctionCtl) StopAuction() { - auctionId := t.MustGetInt64("auction_activity_id") + auctionId := t.MustGetInt("auction_activity_id") auction := new(models.NewAuctionActivity) exist, err := models.Get(auction, auctionId) t.CheckErr(err) @@ -142,8 +142,8 @@ func (t *AuctionCtl) StopAuction() { } 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{} exist, err := models.Get(auction, auctionId) @@ -163,7 +163,7 @@ func (t *AuctionCtl) History() { histories, err := models.GetAuctionHistoriesByAuctionId(auctionId, rehearsalId, orderBy, activity.ArchId) t.CheckErr(err) - userIdMap := make(map[int64]struct{}, 0) // 去重操作 + userIdMap := make(map[int]struct{}, 0) // 去重操作 for u := range histories { if _, ok := userIdMap[histories[u].UserId]; ok { //去掉重复的 @@ -180,8 +180,8 @@ func (t *AuctionCtl) History() { } 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{} exist, err := models.Get(activity, activityId) @@ -191,7 +191,7 @@ func (t *AuctionCtl) List() { auctions, err := models.GetAuctionsByActivityId(activityId) t.CheckErr(err) // 更具某个数据进行 - upIds := make([]int64, 0) + upIds := make([]int, 0) for _, item := range auctions { if item.AuctionModel == "加价竞拍" { upIds = append(upIds, item.Id) @@ -202,7 +202,7 @@ func (t *AuctionCtl) List() { for i := range auctions { if auctions[i].AuctionModel == define.INCR_AUCTION { - userIdMap := make(map[int64]struct{}, 0) // 去重操作 + userIdMap := make(map[int]struct{}, 0) // 去重操作 for u := range upH { if _, ok := userIdMap[upH[u].UserId]; ok { //去掉重复的 @@ -225,7 +225,7 @@ func (t *AuctionCtl) List() { // 成交记录 func (t *AuctionCtl) Records() { - auctionId := t.MustGetInt64("auction_activity_id") + auctionId := t.MustGetInt("auction_activity_id") auction := &models.NewAuctionActivity{} exist, err := models.Get(auction, auctionId) t.CheckErr(err) @@ -248,8 +248,8 @@ func (t *AuctionCtl) Records() { func (t *AuctionCtl) Qrcode() { //将服务器得地址和activity_id,动态生成二维码 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{} exist, err := models.Get(activity, activityId) diff --git a/controllers/pc/barrage.go b/controllers/pc/barrage.go index da1a20e..69111e6 100644 --- a/controllers/pc/barrage.go +++ b/controllers/pc/barrage.go @@ -13,7 +13,7 @@ type BarrageCtl struct { //获取活动的详情 func (t *BarrageCtl) Details() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") server := new(models.DanMuServer) exist, err := server.GetByActivityId(activityId) t.CheckErr(err) @@ -25,14 +25,14 @@ func (t *BarrageCtl) Details() { } func (t *BarrageCtl) SaveSetting() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) t.CheckErr(err) 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.DanmuFontSize = t.MustGet("font_size") server.DanmuOpacity = t.MustGetInt("opacity") diff --git a/controllers/pc/bully_screen.go b/controllers/pc/bully_screen.go index a3ccd1e..9e815fb 100644 --- a/controllers/pc/bully_screen.go +++ b/controllers/pc/bully_screen.go @@ -4,7 +4,7 @@ import ( "hudongzhuanjia/controllers" "hudongzhuanjia/models" bully_reward_service "hudongzhuanjia/services/bully_reward" - "hudongzhuanjia/services/pay" + pay_service "hudongzhuanjia/services/pay" "hudongzhuanjia/utils" "hudongzhuanjia/utils/code" "strings" @@ -17,7 +17,7 @@ type BullyScreenCtl struct { //获取待审核列表 func (t *BullyScreenCtl) WaitReview() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -46,7 +46,7 @@ func (t *BullyScreenCtl) Review() { customerId := t.GetAccountId() status := t.MustGetBool("status") ids := strings.Split(t.MustGet("ids"), "|") - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -103,7 +103,7 @@ func (t *BullyScreenCtl) Review() { //获取黑名单列表 func (t *BullyScreenCtl) Blacklist() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -128,7 +128,7 @@ func (t *BullyScreenCtl) Blacklist() { //获取目前霸屏得总金额 func (t *BullyScreenCtl) Amount() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -151,7 +151,7 @@ func (t *BullyScreenCtl) Amount() { //获取最新得霸屏记录 func (t *BullyScreenCtl) Latest() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -180,7 +180,7 @@ func (t *BullyScreenCtl) Latest() { // 霸屏服务器开关 func (t *BullyScreenCtl) Details() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") server := new(models.BullyScreenServer) exist, err := server.GetByActivityId(activityId) t.CheckErr(err) diff --git a/controllers/pc/calorie.go b/controllers/pc/calorie.go index daf6562..1647cbf 100644 --- a/controllers/pc/calorie.go +++ b/controllers/pc/calorie.go @@ -16,7 +16,7 @@ type CalorieCtl struct { } func (t *CalorieCtl) Ready() { - calorieId := t.MustGetInt64("calorie_id") + calorieId := t.MustGetInt("calorie_id") calorie := new(models.Calorie) exist, err := models.Get(calorie, calorieId) @@ -42,7 +42,7 @@ func (t *CalorieCtl) Ready() { // 开始, 加一个开始时间 func (t *CalorieCtl) Start() { - calorieId := t.MustGetInt64("calorie_id") + calorieId := t.MustGetInt("calorie_id") calorie := new(models.Calorie) exist, err := models.Get(calorie, calorieId) @@ -64,7 +64,7 @@ func (t *CalorieCtl) Start() { // 彩排活动需要恢复 func (t *CalorieCtl) Stop() { - calorieId := t.MustGetInt64("calorie_id") + calorieId := t.MustGetInt("calorie_id") calorie := new(models.Calorie) exist, err := models.Get(calorie, calorieId) @@ -86,7 +86,7 @@ func (t *CalorieCtl) Stop() { // 列出轮次, 包括倒计时 func (t *CalorieCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") calories, err := models.GetCaloriesByActivityId(activityId) t.CheckErr(err) t.JSON(map[string]interface{}{ @@ -97,9 +97,9 @@ func (t *CalorieCtl) List() { // 二维码 func (t *CalorieCtl) Qrcode() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") uid := t.GetAccountId() - calorieId := t.MustGetInt64("calorie_id") + calorieId := t.MustGetInt("calorie_id") area := new(models.AreaStore) exist, err := area.GetByCustomerId(uid, activityId) @@ -120,8 +120,8 @@ func (t *CalorieCtl) Qrcode() { // 统计一些数据, 包括参与人数, 包括当前排名 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) activity := new(models.Activity) diff --git a/controllers/pc/login.go b/controllers/pc/login.go index 6306f3f..58fee44 100644 --- a/controllers/pc/login.go +++ b/controllers/pc/login.go @@ -14,7 +14,7 @@ import ( "hudongzhuanjia/libs/qq" "hudongzhuanjia/libs/wx" "hudongzhuanjia/models" - "hudongzhuanjia/services/activity" + activity_service "hudongzhuanjia/services/activity" "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" ) @@ -62,7 +62,7 @@ func (t *UserCtl) Checkin() { // debug func (t *UserCtl) DebugLogin() { - customerId := t.DefaultInt64("customer_id", 1) + customerId := t.DefaultInt("customer_id", 1) customer := new(models.Customer) exist, err := models.Get(customer, customerId) t.CheckErr(err) diff --git a/controllers/pc/lottery_draw.go b/controllers/pc/lottery_draw.go index 82e58f1..6d37a01 100644 --- a/controllers/pc/lottery_draw.go +++ b/controllers/pc/lottery_draw.go @@ -19,8 +19,8 @@ type LotteryDrawCtl struct { //开始抽奖 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) exist, err := models.Get(ladder, ladderId) @@ -61,9 +61,9 @@ func (t *LotteryDrawCtl) Start() { // 滚动 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) exist, err := models.Get(activity, activityId) @@ -102,9 +102,9 @@ func (t *LotteryDrawCtl) StartRoll() { } 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) exist, err := models.Get(activity, activityId) @@ -138,8 +138,8 @@ func (t *LotteryDrawCtl) StopRoll() { //停止抽奖 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) exist, err := models.Get(activity, activityId) @@ -177,7 +177,7 @@ func (t *LotteryDrawCtl) Stop() { //获取所有抽奖活动列表 func (t *LotteryDrawCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") customerId := t.GetAccountId() customer := new(models.Customer) @@ -200,7 +200,7 @@ func (t *LotteryDrawCtl) List() { //抽奖奖品 func (t *LotteryDrawCtl) Prize() { - ruleId := t.MustGetInt64("lottery_draw_rule_id") + ruleId := t.MustGetInt("lottery_draw_rule_id") list, err := models.GetLotteryDrawLadderByRuleId(ruleId) t.CheckErr(err) @@ -216,8 +216,8 @@ func (t *LotteryDrawCtl) Prize() { // 抽奖用户 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() //customer := new(models.Customer) @@ -238,7 +238,7 @@ func (t *LotteryDrawCtl) Users() { moduleService, exist, err := activity_service.GetModuleService(define.MODULE_LOTTERY, activityId) t.CheckErr(err) t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "活动模块不存在") - recordIds := make([]int64, 0) + recordIds := make([]int, 0) if moduleService.BesideRepeat == define.MODULE_BESIDE_REPEAT { // 去重标志 recordIds, err = models.GetUserIdsByLotteryDrawRuleId(ruleId, activity.RehearsalId, area.Id, activity.ArchId) @@ -255,9 +255,9 @@ func (t *LotteryDrawCtl) Users() { //抽奖动作 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") // 奖品数量 customerId := t.GetAccountId() @@ -379,7 +379,7 @@ func (t *LotteryDrawCtl) Lottery() { //获取中奖名单 func (t *LotteryDrawCtl) ListOfWinners() { - ruleId := t.MustGetInt64("lottery_draw_rule_id") + ruleId := t.MustGetInt("lottery_draw_rule_id") rule := &models.LotteryDrawRule{} exist, err := models.Get(rule, ruleId) diff --git a/controllers/pc/order_draw.go b/controllers/pc/order_draw.go index cbb4512..34f7913 100644 --- a/controllers/pc/order_draw.go +++ b/controllers/pc/order_draw.go @@ -2,7 +2,6 @@ package pc import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/controllers" "hudongzhuanjia/models" activity_service "hudongzhuanjia/services/activity" @@ -11,6 +10,8 @@ import ( "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) // 订单 @@ -20,7 +21,7 @@ type OrderDrawCtl struct { // 开启订单活动 func (t *OrderDrawCtl) Switch() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") status := t.MustGetInt("status") activity := models.Activity{} @@ -48,7 +49,7 @@ func (t *OrderDrawCtl) Switch() { // 开始抽奖 func (t *OrderDrawCtl) Start() { - ladderId := t.MustGetInt64("order_draw_ladder_id") + ladderId := t.MustGetInt("order_draw_ladder_id") ladder := new(models.OrderDrawRuleLadder) exist, err := models.Get(ladder, ladderId) @@ -70,7 +71,7 @@ func (t *OrderDrawCtl) Start() { // 开始抽奖 func (t *OrderDrawCtl) Stop() { - ladderId := t.MustGetInt64("order_draw_ladder_id") + ladderId := t.MustGetInt("order_draw_ladder_id") ladder := new(models.OrderDrawRuleLadder) exist, err := models.Get(ladder, ladderId) @@ -92,24 +93,24 @@ func (t *OrderDrawCtl) Stop() { } 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"` OrderDrawLadders []*OrderLadderResult `json:"order_draw_ladders"` - PrizeNumber int64 `json:"prize_number"` + PrizeNumber int `json:"prize_number"` } 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"` Status string `json:"status"` PrizeImg string `json:"prize_img"` - PrizeNumber int64 `json:"prize_number"` + PrizeNumber int `json:"prize_number"` } //获取所有订单奖品 func (t *OrderDrawCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") customerId := t.GetAccountId() // area := &models.AreaStore{} @@ -135,7 +136,7 @@ func (t *OrderDrawCtl) List() { "a.id=r.order_draw_activity_id and r.is_delete=0"). Where("a.is_delete=0 and a.activity_id=?", activityId).Find(&result) - ruleIds := make([]int64, 0) + ruleIds := make([]int, 0) for _, v := range result { 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) t.CheckErr(err) - ladderIds := make([]int64, 0) + ladderIds := make([]int, 0) for _, ladder := range ladders { 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"). 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=?", @@ -185,7 +186,7 @@ func (t *OrderDrawCtl) List() { //抽奖奖品 func (t *OrderDrawCtl) Prize() { - ruleId := t.MustGetInt64("order_draw_rule_id") + ruleId := t.MustGetInt("order_draw_rule_id") list := make([]*models.OrderDrawRuleLadder, 0) 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 { - UserId int64 `json:"user_id"` + UserId int `json:"user_id"` Username string `json:"username"` Avatar string `json:"avatar"` } //统计人数和订单数量 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) exist, err := models.Get(activity, activityId) @@ -227,7 +228,7 @@ func (t *OrderDrawCtl) Users() { t.CheckErr(err) t.Assert(exist, code.MSG_MODULE_NOT_EXIST, "模块服务不存在") 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"). Where("order_draw_rule_id=? and rehearsal_id=? and arch_id=? and is_delete=0", ruleId, activity.RehearsalId, activity.ArchId).Find(&recordIds) @@ -245,9 +246,9 @@ func (t *OrderDrawCtl) Users() { // 订单抽奖动作 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") customerId := t.GetAccountId() @@ -342,7 +343,7 @@ func (t *OrderDrawCtl) Draw() { } type WinnerResult struct { - UserId int64 `json:"user_id"` + UserId int `json:"user_id"` Username string `json:"user_name"` UserPhone string `json:"user_phone"` Avatar string `json:"avatar"` @@ -350,7 +351,7 @@ type WinnerResult struct { } func (t *OrderDrawCtl) ListOfWinners() { - ruleId := t.MustGetInt64("order_draw_rule_id") + ruleId := t.MustGetInt("order_draw_rule_id") rule := &models.OrderDrawRule{} exist, err := models.Get(rule, ruleId) @@ -378,7 +379,7 @@ func (t *OrderDrawCtl) ListOfWinners() { // 获取所有订单 type OrdersResult struct { - UserId int64 `json:"user_id"` + UserId int `json:"user_id"` AreaName string `json:"area_name"` GoodsName string `json:"goods_name"` Nickname string `json:"nickname"` @@ -387,7 +388,7 @@ type OrdersResult struct { } func (t *OrderDrawCtl) Orders() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := &models.Activity{} exist, err := models.Get(activity, activityId) diff --git a/controllers/pc/reward.go b/controllers/pc/reward.go index 4dc0332..6d0a61b 100644 --- a/controllers/pc/reward.go +++ b/controllers/pc/reward.go @@ -6,7 +6,7 @@ import ( "hudongzhuanjia/models" bully_reward_service "hudongzhuanjia/services/bully_reward" im_service "hudongzhuanjia/services/im" - "hudongzhuanjia/services/pay" + pay_service "hudongzhuanjia/services/pay" "hudongzhuanjia/utils" "hudongzhuanjia/utils/code" "strings" @@ -19,7 +19,7 @@ type RewardCtl struct { //获取最新的打赏记录 func (t *RewardCtl) Latest() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := &models.Activity{} exist, err := models.Get(activity, activityId) @@ -52,7 +52,7 @@ func (t *RewardCtl) Latest() { //获取待审核列表 func (t *RewardCtl) WaitReview() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := &models.Activity{} exist, err := models.Get(activity, activityId) @@ -140,7 +140,7 @@ func (t *RewardCtl) Review() { //获取打赏得总金额 func (t *RewardCtl) Amount() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -163,7 +163,7 @@ func (t *RewardCtl) Amount() { // 黑名单 func (t *RewardCtl) Blacklist() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -189,7 +189,7 @@ func (t *RewardCtl) Blacklist() { // 开启打赏 func (t *RewardCtl) Details() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") server := new(models.RewardServer) exist, err := server.GetByActivityId(activityId) t.CheckErr(err) diff --git a/controllers/pc/shake_red_envelope.go b/controllers/pc/shake_red_envelope.go index d50e235..4b434cd 100644 --- a/controllers/pc/shake_red_envelope.go +++ b/controllers/pc/shake_red_envelope.go @@ -2,7 +2,6 @@ package pc import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/controllers" "hudongzhuanjia/models" im_service "hudongzhuanjia/services/im" @@ -11,6 +10,8 @@ import ( "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type ShakeRedEnvelopeCtl struct { @@ -18,7 +19,7 @@ type ShakeRedEnvelopeCtl struct { } func (t *ShakeRedEnvelopeCtl) Ready() { - ruleId := t.MustGetInt64("shake_red_envelope_rule_id") + ruleId := t.MustGetInt("shake_red_envelope_rule_id") rule := new(models.ShakeRedEnvelopeRule) exist, err := models.Get(rule, ruleId) @@ -38,7 +39,7 @@ func (t *ShakeRedEnvelopeCtl) Ready() { t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") t.CheckRunning(activity.Status) - sids := make([]int64, 0) + sids := make([]int, 0) err = core.GetXormAuto().Table(new(models.ShakeRedEnvelopeActivity)).Select("id"). Where("is_delete=0 and activity_id=?", activity.Id).Find(&sids) t.CheckErr(err) @@ -53,7 +54,7 @@ func (t *ShakeRedEnvelopeCtl) Ready() { //开始摇红包 func (t *ShakeRedEnvelopeCtl) Start() { - ruleId := t.MustGetInt64("shake_red_envelope_rule_id") + ruleId := t.MustGetInt("shake_red_envelope_rule_id") uid := t.GetAccountId() //根据摇红包规则id查找该条记录并且更给状态 @@ -104,7 +105,7 @@ func (t *ShakeRedEnvelopeCtl) Start() { //停止摇红包 func (t *ShakeRedEnvelopeCtl) Stop() { - ruleId := t.MustGetInt64("shake_red_envelope_rule_id") + ruleId := t.MustGetInt("shake_red_envelope_rule_id") uid := t.GetAccountId() rule := new(models.ShakeRedEnvelopeRule) @@ -145,7 +146,7 @@ func (t *ShakeRedEnvelopeCtl) Stop() { } func (t *ShakeRedEnvelopeCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") customerId := t.GetAccountId() area := new(models.AreaStore) @@ -162,7 +163,7 @@ func (t *ShakeRedEnvelopeCtl) List() { list := make([]*models.ShakeRedEnvelopeActivity, 0) total, err := core.GetXormAuto().Where("is_delete=0 and is_pay=1 and activity_id=?", activityId).FindAndCount(&list) t.CheckErr(err) - aIds := make([]int64, 0) + aIds := make([]int, 0) for _, v := range list { aIds = append(aIds, v.Id) } @@ -170,7 +171,7 @@ func (t *ShakeRedEnvelopeCtl) List() { 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) t.CheckErr(err) - rIds := make([]int64, 0) + rIds := make([]int, 0) for _, v := range rules { rIds = append(rIds, v.Id) } @@ -204,10 +205,10 @@ func (t *ShakeRedEnvelopeCtl) List() { //二维码 func (t *ShakeRedEnvelopeCtl) Qrcode() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") 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) exist, err := area.GetByCustomerId(customerId, activityId) @@ -235,7 +236,7 @@ type ShakeRedEnvelopeRecordAndUser struct { // 参数优化 func (t *ShakeRedEnvelopeCtl) Winners() { - ruleId := t.MustGetInt64("shake_red_envelope_rule_id") + ruleId := t.MustGetInt("shake_red_envelope_rule_id") rule := &models.ShakeRedEnvelopeRule{} exist, err := models.Get(rule, ruleId) @@ -266,7 +267,7 @@ func (t *ShakeRedEnvelopeCtl) Winners() { // 统计摇红包参与人数和剩余红包数量 func (t *ShakeRedEnvelopeCtl) Count() { - ruleId := t.MustGetInt64("shake_red_envelope_rule_id") + ruleId := t.MustGetInt("shake_red_envelope_rule_id") rule := new(models.ShakeRedEnvelopeRule) exist, err := models.Get(rule, ruleId) diff --git a/controllers/pc/sign.go b/controllers/pc/sign.go index 98f09dd..f7ce7de 100644 --- a/controllers/pc/sign.go +++ b/controllers/pc/sign.go @@ -18,9 +18,9 @@ type SignCtl struct { //获取二维码 func (t *SignCtl) Qrcode() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") uid := t.GetAccountId() - signUpId := t.MustGetInt64("sign_rule_id") + signUpId := t.MustGetInt("sign_rule_id") area := new(models.AreaStore) exist, err := area.GetByCustomerId(uid, activityId) @@ -44,7 +44,7 @@ func (t *SignCtl) Qrcode() { //获取签到模式 func (t *SignCtl) Mode() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") //通过activity_id查询ox_sign_rule的id signUp := new(models.SignUp) @@ -56,7 +56,7 @@ func (t *SignCtl) Mode() { } func (t *SignCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") signUps := make([]*models.SignUp, 0) err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId). Asc("created_at").Find(&signUps) @@ -74,7 +74,7 @@ type SignResult struct { //处理签到信息 func (t *SignCtl) SignInfo() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := &models.Activity{} exist, err := models.Get(activity, activityId) @@ -101,7 +101,7 @@ func (t *SignCtl) SignInfo() { // 实名签到信息 func (t *SignCtl) RealSignInfo() { - aid := t.MustGetInt64("activity_id") + aid := t.MustGetInt("activity_id") activity := &models.Activity{} exist, err := models.Get(activity, aid) diff --git a/controllers/pc/tug_war.go b/controllers/pc/tug_war.go index 5bcabda..eebb758 100644 --- a/controllers/pc/tug_war.go +++ b/controllers/pc/tug_war.go @@ -17,7 +17,7 @@ type TugOfWarCtl struct { } func (t *TugOfWarCtl) Ready() { // 准备中 - baheId := t.MustGetInt64("bahe_activity_id") + baheId := t.MustGetInt("bahe_activity_id") bahe := new(models.TugOfWar) exist, err := models.Get(bahe, baheId) @@ -67,7 +67,7 @@ func (t *TugOfWarCtl) Ready() { // 准备中 } func (t *TugOfWarCtl) Start() { - baheId := t.MustGetInt64("bahe_activity_id") + baheId := t.MustGetInt("bahe_activity_id") bahe := new(models.TugOfWar) exist, err := models.Get(bahe, baheId) @@ -83,7 +83,7 @@ func (t *TugOfWarCtl) Start() { } func (t *TugOfWarCtl) Stop() { - baheId := t.MustGetInt64("bahe_activity_id") + baheId := t.MustGetInt("bahe_activity_id") bahe := new(models.TugOfWar) exist, err := models.Get(bahe, baheId) @@ -101,7 +101,7 @@ func (t *TugOfWarCtl) Stop() { } func (t *TugOfWarCtl) Team() { - baheId := t.MustGetInt64("bahe_activity_id") + baheId := t.MustGetInt("bahe_activity_id") customerId := t.GetAccountId() customer := new(models.Customer) @@ -175,7 +175,7 @@ func (t *TugOfWarCtl) Team() { } func (t *TugOfWarCtl) Member() { - baheId := t.MustGetInt64("bahe_activity_id") + baheId := t.MustGetInt("bahe_activity_id") bahe := &models.TugOfWar{} exist, err := models.Get(bahe, baheId) @@ -209,16 +209,16 @@ func (t *TugOfWarCtl) Member() { } 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:"拔河队伍得名称"` Members []*models.BaheTeamMember `json:"members"` } func (t *TugOfWarCtl) Score() { - baheId := t.MustGetInt64("bahe_activity_id") + baheId := t.MustGetInt("bahe_activity_id") bahe := &models.TugOfWar{} exist, err := models.Get(bahe, baheId) @@ -254,7 +254,7 @@ func (t *TugOfWarCtl) Score() { } func (t *TugOfWarCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") bahes := make([]*models.TugOfWar, 0) err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", activityId). diff --git a/controllers/pc/upper_wall.go b/controllers/pc/upper_wall.go index c91c111..9fede23 100644 --- a/controllers/pc/upper_wall.go +++ b/controllers/pc/upper_wall.go @@ -24,7 +24,7 @@ type UpperWallResult struct { //获取所有已审核的上墙消息 func (t *UpperWallCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -47,7 +47,7 @@ func (t *UpperWallCtl) List() { //获取待审核列表 func (t *UpperWallCtl) WaitReview() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -126,7 +126,7 @@ func (t *UpperWallCtl) Review() { //获取黑名单列表 func (t *UpperWallCtl) Blacklist() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -148,7 +148,7 @@ func (t *UpperWallCtl) Blacklist() { //获取目前上墙得总条数 func (t *UpperWallCtl) Total() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -167,7 +167,7 @@ func (t *UpperWallCtl) Total() { //二维码 // 跳到主页 func (t *UpperWallCtl) Qrcode() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") uid := t.GetAccountId() activity := new(models.Activity) @@ -194,7 +194,7 @@ func (t *UpperWallCtl) Qrcode() { } func (t *UpperWallCtl) Details() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") msgWall := new(models.MsgWallServer) exist, err := msgWall.GetByActivityId(activityId) t.CheckErr(err) diff --git a/controllers/pc/vote.go b/controllers/pc/vote.go index f6c1bc2..f576784 100644 --- a/controllers/pc/vote.go +++ b/controllers/pc/vote.go @@ -2,7 +2,6 @@ package pc import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/controllers" "hudongzhuanjia/models" "hudongzhuanjia/utils" @@ -10,6 +9,8 @@ import ( "hudongzhuanjia/utils/define" "strconv" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type VoteCtl struct { @@ -18,8 +19,8 @@ type VoteCtl struct { //二维码 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() area := new(models.AreaStore) @@ -43,7 +44,7 @@ func (t *VoteCtl) Qrcode() { // 装备数据 func (t *VoteCtl) ReadyVote() { - voteId := t.MustGetInt64("vote_activity_id") + voteId := t.MustGetInt("vote_activity_id") vote := new(models.NewVoteActivity) exist, err := models.Get(vote, voteId) t.CheckErr(err) @@ -74,7 +75,7 @@ func (t *VoteCtl) ReadyVote() { //开始投票 func (t *VoteCtl) StartVote() { - voteId := t.MustGetInt64("vote_activity_id") + voteId := t.MustGetInt("vote_activity_id") vote := new(models.NewVoteActivity) exist, err := models.Get(vote, voteId) t.CheckErr(err) @@ -98,7 +99,7 @@ func (t *VoteCtl) StartVote() { //停止投票 func (t *VoteCtl) StopVote() { - voteId := t.MustGetInt64("vote_activity_id") + voteId := t.MustGetInt("vote_activity_id") vote := new(models.NewVoteActivity) exist, err := models.Get(vote, voteId) @@ -120,7 +121,7 @@ func (t *VoteCtl) StopVote() { //获取参与人数 func (t *VoteCtl) JoinTotal() { - voteActivityId := t.MustGetInt64("vote_activity_id") + voteActivityId := t.MustGetInt("vote_activity_id") vote := models.NewVoteActivity{} exist, err := models.Get(vote, voteActivityId) @@ -141,7 +142,7 @@ func (t *VoteCtl) JoinTotal() { //获取所有的投票活动 func (t *VoteCtl) List() { - activityId := t.MustGetInt64("activity_id") + activityId := t.MustGetInt("activity_id") activity := new(models.Activity) exist, err := models.Get(activity, activityId) @@ -151,7 +152,7 @@ func (t *VoteCtl) List() { votes, err := models.GetVoteListByActivityId(activityId, activity.ArchId) t.CheckErr(err) - ids := make([]int64, 0) + ids := make([]int, 0) for _, v := range votes { ids = append(ids, v.Id) } @@ -175,7 +176,7 @@ func (t *VoteCtl) List() { //获取投票的前几(头像、姓名、票数) func (t *VoteCtl) History() { - voteId := t.MustGetInt64("vote_activity_id") + voteId := t.MustGetInt("vote_activity_id") total := t.MustGetInt("total") ladders, err := models.GetNewVoteTopByVoteActivityId(voteId, total) diff --git a/controllers/pc/ws.go b/controllers/pc/ws.go index 835dde2..163477f 100644 --- a/controllers/pc/ws.go +++ b/controllers/pc/ws.go @@ -16,7 +16,7 @@ type WsCtl struct { // ws doc func (t *WsCtl) Ops() { customerId := t.GetAccountId() - activityId, _ := t.GetInt64("activity_id") + activityId, _ := t.GetInt("activity_id") customer := new(models.Customer) exist, err := models.Get(customer, customerId) t.CheckErr(err) @@ -47,7 +47,7 @@ func (t *WsCtl) Ops() { // ws doc func (t *WsCtl) SaveOp() { - customerId := t.MustGetInt64("customer_id") + customerId := t.MustGetInt("customer_id") extraData := t.Default("extra_data", "") op := &models.CustomerOperation{ CustomerId: customerId, diff --git a/hdws/ws/client.go b/hdws/ws/client.go index 0a6ccf7..7b35f93 100644 --- a/hdws/ws/client.go +++ b/hdws/ws/client.go @@ -2,14 +2,15 @@ package ws import ( "encoding/json" + "gopkg.in/olahol/melody.v1" ) type Client struct { Id string // account_typ:account_id - AccountId int64 + AccountId int AccountType string - Pid int64 + Pid int Online bool RoomId string node *Node diff --git a/hdws/ws/jwt_go.go b/hdws/ws/jwt_go.go index 5e6781d..faec3fd 100644 --- a/hdws/ws/jwt_go.go +++ b/hdws/ws/jwt_go.go @@ -11,15 +11,15 @@ import ( type Claims struct { AccountType string - AccountId int64 - CustomerId int64 - CustomerPid int64 - ActivityId int64 - AreaId int64 + AccountId int + CustomerId int + CustomerPid int + ActivityId int + AreaId int 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{ accountType, accountId, diff --git a/hdws/ws/message.go b/hdws/ws/message.go index 81063d8..101ece6 100644 --- a/hdws/ws/message.go +++ b/hdws/ws/message.go @@ -5,7 +5,7 @@ import "encoding/json" type Message struct { Type string `json:"type"` // 对应处理函数 / sync 同步函数,存入数据库 / msg 发送消息,不存入数据库 / login 登录校验某个客户是否存在 From string `json:"-"` // 发送方 ==> 自行处理, 无需发送 - Dest int64 `json:"dest"` // 目标id / 0 代表所有 非0代表某一个 + Dest int `json:"dest"` // 目标id / 0 代表所有 非0代表某一个 Tag string `json:"tag"` // 目标类型 customer代表客户 user代表用户 entry代表录入人员 RoomId string `json:"room_id"` // 房间id // activity_id Data map[string]interface{} `json:"data"` diff --git a/hdws/ws/timer.go b/hdws/ws/timer.go index 1c9af26..9c1438d 100644 --- a/hdws/ws/timer.go +++ b/hdws/ws/timer.go @@ -50,10 +50,10 @@ func syncFunc(c *Client, msg *Message) { op := &models.CustomerOperation{ CustomerId: c.AccountId, Operation: operation.(string), - AreaId: int64(areaId.(float64)), - ModuleActivityId: int64(moduleActivityId.(float64)), + AreaId: int(areaId.(float64)), + ModuleActivityId: int(moduleActivityId.(float64)), ModuleActivityType: moduleActivityType.(string), - ActivityId: int64(activityId.(float64)), + ActivityId: int(activityId.(float64)), ExtraData: string(extraData), UpdatedAt: time.Now(), CreatedAt: time.Now(), diff --git a/libs/jwt/jwt_go.go b/libs/jwt/jwt_go.go index 02959f9..fdbbefd 100644 --- a/libs/jwt/jwt_go.go +++ b/libs/jwt/jwt_go.go @@ -11,15 +11,15 @@ import ( type Claims struct { AccountType string - AccountId int64 - CustomerId int64 - CustomerPid int64 - ActivityId int64 - AreaId int64 + AccountId int + CustomerId int + CustomerPid int + ActivityId int + AreaId int 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{ accountType, accountId, diff --git a/libs/qq/qq.go b/libs/qq/qq.go index e35579c..3c5de7e 100644 --- a/libs/qq/qq.go +++ b/libs/qq/qq.go @@ -3,10 +3,11 @@ package qq import ( "encoding/json" "fmt" - "github.com/ouxuanserver/osmanthuswine/src/helper" "io/ioutil" "net/http" "net/url" + + "github.com/ouxuanserver/osmanthuswine/src/helper" ) var ( @@ -49,7 +50,7 @@ func GetUserInfoUrl(accessToken, openid string) string { type Token struct { AccessToken string `json:"access_token"` - ExpiresIn int64 `json:"expires_in"` + ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` } diff --git a/libs/wx/wx.go b/libs/wx/wx.go index bbf790e..b186410 100644 --- a/libs/wx/wx.go +++ b/libs/wx/wx.go @@ -2,10 +2,11 @@ package wx import ( "fmt" - "github.com/kirinlabs/HttpRequest" - "github.com/ouxuanserver/osmanthuswine/src/helper" "hudongzhuanjia/utils/define" "net/url" + + "github.com/kirinlabs/HttpRequest" + "github.com/ouxuanserver/osmanthuswine/src/helper" ) func GetCodeUrl() string { @@ -41,7 +42,7 @@ func GetTicketTokenUrl() string { type Token struct { AccessToken string `json:"access_token"` - ExpiresIn int64 `json:"expires_in"` + ExpiresIn int `json:"expires_in"` RefreshToken string `json:"refresh_token"` Openid string `json:"openid"` Scope string `json:"scope"` diff --git a/models/CalorieUser.go b/models/CalorieUser.go index 5c61259..404db26 100644 --- a/models/CalorieUser.go +++ b/models/CalorieUser.go @@ -1,20 +1,21 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const CalorieUserTableName = TableNamePrefix + "calorie_user" 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)"` - 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)"` 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"` diff --git a/models/activity.go b/models/activity.go index 658fe7a..1c12361 100644 --- a/models/activity.go +++ b/models/activity.go @@ -8,8 +8,8 @@ const ActivityTableName = TableNamePrefix + "activity" //互动活动 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)"` Services []*ActivityModuleService `json:"services,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)"` Classification string `json:"classification" xorm:"not null comment('互动分类') VARCHAR(255)"` 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:"省"` 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"` diff --git a/models/activity_module_service.go b/models/activity_module_service.go index 74a69a6..6df031e 100644 --- a/models/activity_module_service.go +++ b/models/activity_module_service.go @@ -10,16 +10,16 @@ const ActivityModuleServiceTableName = TableNamePrefix + "activity_module_servic //活动模块服务 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:"模块服务名字"` 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)"` 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)"` 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)"` 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"` @@ -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) //} diff --git a/models/arch.go b/models/arch.go index 7e2ffb6..8d2da5d 100644 --- a/models/arch.go +++ b/models/arch.go @@ -1,8 +1,9 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const ArchTableName = TableNamePrefix + "arch" diff --git a/models/area_store.go b/models/area_store.go index cf8b3d0..fa0d049 100644 --- a/models/area_store.go +++ b/models/area_store.go @@ -10,12 +10,12 @@ const AreaStoreTableName = TableNamePrefix + "area_store" //店铺地区 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)"` Type string `json:"type" 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)"` 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"` @@ -29,15 +29,15 @@ func (t *AreaStore) TableName() string { 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) } -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) } -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) } -func GetAreaStoresByActivityId(aid int64) ([]*AreaStore, error) { +func GetAreaStoresByActivityId(aid int) ([]*AreaStore, error) { list := make([]*AreaStore, 0) err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Find(&list) return list, err diff --git a/models/auction_activity.go b/models/auction_activity.go index 5b06817..2557741 100644 --- a/models/auction_activity.go +++ b/models/auction_activity.go @@ -2,8 +2,8 @@ package models //竞拍活动 //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:"竞拍名称"` // LatestMoney float64 `json:"latest_price" xorm:"-" description:"最新的竞拍叫价,通过查询AuctionHistory获得"` // MaxMoney float64 `json:"max_price" xorm:"-" description:"目前最高叫价,通过查询AuctionHistory获得"` diff --git a/models/auction_deal.go b/models/auction_deal.go index 8a4db8e..4c7d71b 100644 --- a/models/auction_deal.go +++ b/models/auction_deal.go @@ -2,8 +2,8 @@ package models //竞拍成交 //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:"竞拍参与者号码"` // DealMoney float64 `json:"deal_money" description:"成交的金额"` // IsPay bool `json:"is_pay" description:"是否支付"` diff --git a/models/auction_history.go b/models/auction_history.go index a2f15c7..8f6b788 100644 --- a/models/auction_history.go +++ b/models/auction_history.go @@ -10,18 +10,18 @@ const AuctionHistoryTableName = TableNamePrefix + "auction_history" //竞拍历史 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)"` - 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)"` UserName string `json:"user_name" 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)"` - 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)"` Unit int `json:"unit" xorm:"not null default(1) comment('单位') TINYINT(1)"` Money float64 `json:"money" xorm:"not null comment('计算总价格') DECIMAL(20)"` @@ -35,23 +35,23 @@ func (t *AuctionHistory) TableName() string { 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", 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) } -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) err := core.GetXormAuto().Where("is_delete=0 and auction_activity_id=? and rehearsal_id=? and arch_id=?", aid, rid, archId).OrderBy(orderBy).Find(&histories) 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) err := core.GetXormAuto().Where("is_delete=0 and rehearsal_id=? and arch_id=?", rid, archId). In("auction_activity_id", ids).Desc("money").Find(&histories) diff --git a/models/auction_player.go b/models/auction_player.go index 48ba5f4..9aea020 100644 --- a/models/auction_player.go +++ b/models/auction_player.go @@ -1,19 +1,20 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const AuctionPlayerTableName = TableNamePrefix + "auction_player" //竞拍者 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)"` - 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)"` 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"` @@ -24,7 +25,7 @@ func (t *AuctionPlayer) TableName() string { 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=?", aid, archId, uid, rid).Get(t) } diff --git a/models/auction_result_record.go b/models/auction_result_record.go index 5126979..eba62eb 100644 --- a/models/auction_result_record.go +++ b/models/auction_result_record.go @@ -1,21 +1,22 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const AuctionResultRecordTableName = TableNamePrefix + "auction_result_record" 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)"` 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)"` UserPhone string `json:"user_phone" xorm:"not null comment('用户手机号码') VARCHAR(128)"` PlayerCode int64 `json:"player_code" xorm:"not null default(0) comment('竞拍编号') INT(11)"` @@ -31,12 +32,12 @@ func (t *AuctionResultRecord) TableName() string { 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", 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) 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) diff --git a/models/auction_rule.go b/models/auction_rule.go index 245896d..98a9fea 100644 --- a/models/auction_rule.go +++ b/models/auction_rule.go @@ -4,11 +4,11 @@ package models // ////竞拍规则 //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:"竞拍活动状态 [可竞拍,不可竞拍]"` -// AreaId int64 `json:"area_id" description:"地区id"` +// AreaId int `json:"area_id" description:"地区id"` // AreaStatus string `json:"area_status" description:"多地区模式[开启,关闭]"` // AuctionGoodsName string `json:"auction_goods_name" description:"竞拍物品名称"` // AuctionGoodsDesc string `json:"auction_goods_desc" description:"竞拍物品描述"` @@ -17,7 +17,7 @@ package models // Pic string `json:"pic" description:"竞拍图片"` // BaseInterval float64 `json:"base_interval" 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:"是否删除"` // CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` // UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` diff --git a/models/bahe_activity.go b/models/bahe_activity.go index f30adc1..8c0a91f 100644 --- a/models/bahe_activity.go +++ b/models/bahe_activity.go @@ -2,8 +2,8 @@ package models //拔河比赛活动 //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:"拔河名称"` // RandomTeam string `json:"random_team" description:"[开启,关闭]随机组队模式"` // MaxMoreCode string `json:"max_more_code" description:"[开启,关闭]大屏多二维码模式"` @@ -14,6 +14,6 @@ package models // 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) //} diff --git a/models/bahe_history.go b/models/bahe_history.go index cf7e1b4..644a57f 100644 --- a/models/bahe_history.go +++ b/models/bahe_history.go @@ -4,9 +4,9 @@ package models // ////拔河的比赛结果的记录 //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)"` // IsDelete bool `json:"is_delete" xorm:"default(0)"` // CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` diff --git a/models/bahe_rule.go b/models/bahe_rule.go index b0dd53c..95ee57e 100644 --- a/models/bahe_rule.go +++ b/models/bahe_rule.go @@ -2,14 +2,14 @@ package models //拔河规则 //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:"[开启,关闭]随机组队模式"` // MaxMoreCode string `json:"max_more_code" description:"[开启,关闭]大屏多二维码模式"` // H5Choose string `json:"h_5_choose" description:"[开启,关闭]h5挑选队伍"` // 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:"是否删除"` // CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` // UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` diff --git a/models/bahe_team.go b/models/bahe_team.go index 4da0ffc..a402e11 100644 --- a/models/bahe_team.go +++ b/models/bahe_team.go @@ -1,19 +1,20 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const BaheTeamTable = TableNamePrefix + "bahe_team" //拔河队伍 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)"` - TotalScore int64 `json:"total_score" xorm:"-" description:"总分数"` + TotalScore int `json:"total_score" xorm:"-" description:"总分数"` Rank int `json:"rank" xorm:"-" description:"排名"` Members []*BaheTeamMember `json:"members" xorm:"-" description:"队伍人数"` Qrcode string `json:"qrcode" xorm:"-" description:"二维码"` @@ -26,7 +27,7 @@ func (t *BaheTeam) TableName() string { 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) } diff --git a/models/bahe_team_member.go b/models/bahe_team_member.go index 19f93d0..751c321 100644 --- a/models/bahe_team_member.go +++ b/models/bahe_team_member.go @@ -10,14 +10,14 @@ const BaheTeamMemberTableName = TableNamePrefix + "bahe_team_member" //拔河队伍人员 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)"` - 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)"` - 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)"` NickName string `json:"nick_name" xorm:"not null comment('昵称') VARCHAR(255)"` SortTime int64 `json:"sort_time" xorm:"not null default '0' comment('排序时间') VARCHAR(20)"` diff --git a/models/barrage_history.go b/models/barrage_history.go index 701b5d1..d46ec0b 100644 --- a/models/barrage_history.go +++ b/models/barrage_history.go @@ -8,9 +8,9 @@ const BarrageHistoryTableName = TableNamePrefix + "barrage_history" //弹幕历史记录 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)"` Content string `json:"content" xorm:"not null comment('内容') TEXT"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"` diff --git a/models/base.go b/models/base.go index 2932c8b..55f3886 100644 --- a/models/base.go +++ b/models/base.go @@ -2,10 +2,11 @@ package models import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" - "github.com/xormplus/xorm" "reflect" "strings" + + "github.com/ouxuanserver/osmanthuswine/src/core" + "github.com/xormplus/xorm" ) const TableNamePrefix = "ox_" diff --git a/models/bully_screen_history.go b/models/bully_screen_history.go index 0c263be..1ab665a 100644 --- a/models/bully_screen_history.go +++ b/models/bully_screen_history.go @@ -1,34 +1,35 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const BullyScreenHistoryTableName = TableNamePrefix + "bully_screen_history" //霸屏历史表 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)"` CreatedAt time.Time `json:"created_at" xorm:"not null created 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)"` - 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)"` - 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)"` - 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)"` Second int `json:"second" xorm:"not null default 0 comment('霸屏时间(秒)') INT(11)"` 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)"` 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 { @@ -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) } -func (t *BullyScreenHistory) UpdateStatus(id int64, status int) (int64, error) { +func (t *BullyScreenHistory) UpdateStatus(id int, status int) (int64, error) { t.Status = status return core.GetXormAuto().ID(id).Cols("status").Update(t) } @@ -51,7 +52,7 @@ func (t *BullyScreenHistory) UpdateStatusByOutTradeNo(outTradeNo string, status 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 { t.Status = status _, err := core.GetXormAuto().In("id", ids).Cols("status"). diff --git a/models/bully_screen_server.go b/models/bully_screen_server.go index 1ee05b3..a77e51b 100644 --- a/models/bully_screen_server.go +++ b/models/bully_screen_server.go @@ -1,16 +1,17 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const BullyScreenServerTableName = TableNamePrefix + "bully_screen_server" //霸屏服务 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:"服务开始时间"` ServerEndTime time.Time `json:"server_end_time" description:"服务结束时间"` Start string `json:"start" description:"霸屏是否开启 [开启|关闭]"` @@ -29,6 +30,6 @@ func (t *BullyScreenServer) Alias(name string) string { 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) } diff --git a/models/bully_screen_wallet.go b/models/bully_screen_wallet.go index 7d18a13..913fe34 100644 --- a/models/bully_screen_wallet.go +++ b/models/bully_screen_wallet.go @@ -1,15 +1,16 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const BSWalletTableName = TableNamePrefix + "bully_screen_wallet" 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"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` @@ -19,7 +20,7 @@ func (t *BullyScreenWallet) TableName() string { 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). Incr("balance", money).Cols("balance").Update(t) } diff --git a/models/bully_screen_wallet_hisotry.go b/models/bully_screen_wallet_hisotry.go index 0a8a6c3..890ac68 100644 --- a/models/bully_screen_wallet_hisotry.go +++ b/models/bully_screen_wallet_hisotry.go @@ -5,15 +5,15 @@ import "time" const BSWalletHistoryTableName = TableNamePrefix + "bully_screen_wallet_history" 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)"` HisBalance string `json:"his_balance" xorm:"not null default '0' 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)"` 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)"` Mark string `json:"mark" xorm:"not null comment('备注') TEXT"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` diff --git a/models/calorie.go b/models/calorie.go index eba13ab..83cf045 100644 --- a/models/calorie.go +++ b/models/calorie.go @@ -1,17 +1,18 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/utils/define" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const CalorieTableName = TableNamePrefix + "calorie" 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)"` Status string `json:"status" xorm:"not null default('未开始') comment('状态[未开始,准备中,进行中,已结束]') VARCHAR(11)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"` @@ -23,14 +24,14 @@ func (t *Calorie) TableName() string { 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.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and status=? and activity_id=?", before, aid). 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.UpdatedAt = time.Now() 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) } -func UpdateCalorieStatusByActivityId(aid int64) (int64, error) { +func UpdateCalorieStatusByActivityId(aid int) (int64, error) { return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid). Update(&Calorie{Status: define.StatusNotBegin}) } diff --git a/models/customer.go b/models/customer.go index 9688196..b6b097b 100644 --- a/models/customer.go +++ b/models/customer.go @@ -2,11 +2,12 @@ package models import ( "fmt" - "github.com/pkg/errors" - "go.uber.org/zap" "hudongzhuanjia/logger" "time" + "github.com/pkg/errors" + "go.uber.org/zap" + "github.com/ouxuanserver/osmanthuswine/src/core" "github.com/ouxuanserver/osmanthuswine/src/helper" ) @@ -15,7 +16,7 @@ const CustomerTN = TableNamePrefix + "customer" //客户表 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:"用户创建的主活动"` Nickname string `json:"nickname" 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)"` 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)"` - 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)"` Email string `json:"email" 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)"` 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)"` - 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)"` CreatedAt time.Time `json:"-" xorm:"not null created comment('创建时间') DATETIME"` UpdatedAt time.Time `json:"-" xorm:"not null updated comment('更新时间') DATETIME"` diff --git a/models/customer_goods.go b/models/customer_goods.go index 557609d..5acf955 100644 --- a/models/customer_goods.go +++ b/models/customer_goods.go @@ -1,20 +1,21 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const CustomerGoodsTableName = TableNamePrefix + "customer_goods" 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)"` CreatedAt time.Time `json:"created_at" xorm:"created 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)"` 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)"` @@ -37,7 +38,7 @@ func (t *CustomerGoods) Alias(name string) string { return Alias(t, name) } -func GetGoodsByActivityId(activityId, areaId int64) ([]*CustomerGoods, error) { +func GetGoodsByActivityId(activityId, areaId interface{}) ([]*CustomerGoods, error) { goods := make([]*CustomerGoods, 0) err := core.GetXormAuto().Where("is_delete=0 and activity_id=? and area_id=?", activityId, areaId). Asc("created_at").Find(&goods) diff --git a/models/customer_operation.go b/models/customer_operation.go index 376277e..0a7062b 100644 --- a/models/customer_operation.go +++ b/models/customer_operation.go @@ -10,11 +10,11 @@ import ( // 用户操作, 主从账号同步信息 // 拔河/摇红包/摇奖券/订单/上墙/霸屏/抽奖/投票/竞拍/打赏/会务 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:"具体活动类型"` Operation string `json:"operation" description:"操作内容"` OtherData interface{} `json:"other_data" xorm:"-" description:"额外的字段"` @@ -33,7 +33,7 @@ func (op *CustomerOperation) SaveCustomerOperation() int64 { return row } -func (op *CustomerOperation) GetOpsByCustomerId(customerId int64, areaId int64) []*CustomerOperation { +func (op *CustomerOperation) GetOpsByCustomerId(customerId int, areaId int) []*CustomerOperation { ops := make([]*CustomerOperation, 0) var err error if areaId == 0 { @@ -48,13 +48,13 @@ func (op *CustomerOperation) GetOpsByCustomerId(customerId int64, areaId int64) 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) } -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) } -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) } diff --git a/models/customer_order.go b/models/customer_order.go index f90abf5..43e9699 100644 --- a/models/customer_order.go +++ b/models/customer_order.go @@ -9,22 +9,22 @@ import ( const CustomerOrderTableName = TableNamePrefix + "customer_order" 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)"` CreatedAt time.Time `json:"created_at" xorm:"not null created 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)"` - 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)"` - 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)"` 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)"` - 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('订单总额')"` PayAmount float64 `json:"pay_amount" xorm:"not null default 0.00 comment('支付金额')"` 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"` // 无关变量 - //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:"-"` Good *CustomerGoods `json:"good,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) } -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 "+ "activity_id=? and rehearsal_id=? and arch_id=? and is_delete=0", 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) 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). diff --git a/models/customer_order_option.go b/models/customer_order_option.go index 7f80d11..3102644 100644 --- a/models/customer_order_option.go +++ b/models/customer_order_option.go @@ -2,19 +2,20 @@ package models import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const CustomerOrderOptionTableName = TableNamePrefix + "customer_order_option" 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)"` CreatedAt time.Time `json:"-" xorm:"created"` 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"` 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)"` @@ -31,16 +32,16 @@ func (t *CustomerOrderOption) AliasName(n string) string { 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) } -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). 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 return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Cols("status").Update(t) } diff --git a/models/customer_order_sub.go b/models/customer_order_sub.go index bd5bdc6..187de9c 100644 --- a/models/customer_order_sub.go +++ b/models/customer_order_sub.go @@ -2,20 +2,21 @@ package models import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const CustomerOrderSubTN = TableNamePrefix + "customer_order_sub" 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)"` CreatedAt time.Time `json:"created_at" xorm:"not null created 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)"` 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)"` diff --git a/models/dan_mu_server.go b/models/dan_mu_server.go index 45437c2..a685676 100644 --- a/models/dan_mu_server.go +++ b/models/dan_mu_server.go @@ -1,15 +1,16 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const DanMuServerTableName = TableNamePrefix + "dan_mu_server" 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)"` 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)"` @@ -27,6 +28,6 @@ func (t *DanMuServer) TableName() string { 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) } diff --git a/models/invitation.go b/models/invitation.go index 9299351..9f58f1f 100644 --- a/models/invitation.go +++ b/models/invitation.go @@ -7,8 +7,8 @@ import ( ) 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化"` 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为限制 限制必填时间段"` @@ -20,6 +20,6 @@ type Invitation struct { 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) } diff --git a/models/invitation_letter.go b/models/invitation_letter.go index 96a2055..e7ab3d7 100644 --- a/models/invitation_letter.go +++ b/models/invitation_letter.go @@ -9,11 +9,11 @@ import ( const InvitationLetterTableName = TableNamePrefix + "invitation_letter" 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)"` ExtraData string `json:"extra_data" xorm:"comment('邀请函信息') TEXT"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"删除"` diff --git a/models/live_config.go b/models/live_config.go index 7d1eeba..abaad85 100644 --- a/models/live_config.go +++ b/models/live_config.go @@ -1,22 +1,23 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const LiveConfigTN = TableNamePrefix + "live_config" 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)"` 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"` 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)"` - 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)"` 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"` diff --git a/models/live_config_area.go b/models/live_config_area.go index 75875dc..968c965 100644 --- a/models/live_config_area.go +++ b/models/live_config_area.go @@ -1,19 +1,20 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const LiveConfigAreaTN = TableNamePrefix + "live_config_area" 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)"` 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"` - 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)"` 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)"` diff --git a/models/live_red_envelope_rule.go b/models/live_red_envelope_rule.go index 46a7661..44632b9 100644 --- a/models/live_red_envelope_rule.go +++ b/models/live_red_envelope_rule.go @@ -9,15 +9,15 @@ import ( const LiveRedPackInfoTN = TableNamePrefix + "live_red_envelope_rule" 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)"` 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"` - 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)"` Amount float64 `json:"amount" xorm:"not null default 0 comment('红包金额') DECIMAL(18)"` Num int `json:"num" xorm:"not null default 0 comment('红包个数') INT(11)"` diff --git a/models/live_viewer.go b/models/live_viewer.go index 53a9692..120d471 100644 --- a/models/live_viewer.go +++ b/models/live_viewer.go @@ -1,28 +1,29 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const LiveViewerTN = TableNamePrefix + "live_viewer" 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)"` 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"` - 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)"` - 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 { return LiveViewerTN } -func (t *LiveViewer) Record(uid, aid, lid int64) error { +func (t *LiveViewer) Record(uid, aid, lid int) error { session := core.GetXormAuto().NewSession() defer session.Close() session.Begin() diff --git a/models/lottery_draw_activity.go b/models/lottery_draw_activity.go index fe888e7..a6c8f7c 100644 --- a/models/lottery_draw_activity.go +++ b/models/lottery_draw_activity.go @@ -1,17 +1,18 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const LotteryDrawActivityTableName = TableNamePrefix + "lottery_draw_activity" //抽奖活动 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:"抽奖轮次名称"` LotteryDrawRule *LotteryDrawRule `json:"lottery_draw_rule" xorm:"-" description:"抽奖活动规则"` IsDelete bool `json:"-" xorm:"default(0)"` @@ -23,8 +24,8 @@ func (t *LotteryDrawActivity) TableName() string { 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"). Where("is_delete=0 and activity_id=?", aid).Find(&lotteryIds) return lotteryIds, err diff --git a/models/lottery_draw_envelope_wallet.go b/models/lottery_draw_envelope_wallet.go index 1005560..7429db7 100644 --- a/models/lottery_draw_envelope_wallet.go +++ b/models/lottery_draw_envelope_wallet.go @@ -6,8 +6,8 @@ import ( //抽奖红包钱包 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:"余额"` IsDelete bool `json:"is_delete" xorm:"default(0)"` CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` diff --git a/models/lottery_draw_record.go b/models/lottery_draw_record.go index a7875e1..2fb3862 100644 --- a/models/lottery_draw_record.go +++ b/models/lottery_draw_record.go @@ -1,28 +1,29 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const LotteryDrawRecordTableName = TableNamePrefix + "lottery_draw_record" 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)"` - 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)"` UserName string `json:"user_name" 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('奖品名字')"` 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)"` Name string `json:"name" 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) } -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) } -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"). Where("lottery_draw_rule_id=? and rehearsal_id=? and area_id=? and arch_id=? and is_delete=0", ruleId, rehearsalId, areaId, archId).Find(&recordIds) diff --git a/models/lottery_draw_rule.go b/models/lottery_draw_rule.go index c78dceb..ea790e7 100644 --- a/models/lottery_draw_rule.go +++ b/models/lottery_draw_rule.go @@ -1,20 +1,21 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const LotteryDrawRuleTableName = TableNamePrefix + "lottery_draw_rule" //抽奖活动规则 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:"阶梯"` - AreaId int64 `json:"area_id" description:"地区id"` + AreaId int `json:"area_id" description:"地区id"` 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:"奖品总数"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` @@ -25,14 +26,14 @@ func (t *LotteryDrawRule) TableName() string { 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"). Where("is_delete=0").In("lottery_draw_activity_id", ids).Find(&ruleIds) 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). // Update(&LotteryDrawRule{LotteryDrawStatus: define.StatusNotBegin}) //} diff --git a/models/lottery_draw_rule_ladder.go b/models/lottery_draw_rule_ladder.go index ff0449a..3546c16 100644 --- a/models/lottery_draw_rule_ladder.go +++ b/models/lottery_draw_rule_ladder.go @@ -1,17 +1,18 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/utils/define" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const LotteryDrawRuleLadderTableName = TableNamePrefix + "lottery_draw_rule_ladder" //抽奖活动规则阶梯 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)"` PrizeName string `json:"prize_name" description:"奖品名字"` PrizeNumber int `json:"prize_number" description:"奖品数量"` @@ -32,7 +33,7 @@ func (t *LotteryDrawRuleLadder) Alias(name string) string { return Alias(t, name) } -func UpdateLDLadderStatusByLDRuleIds(ids []int64) (int64, error) { +func UpdateLDLadderStatusByLDRuleIds(ids []int) (int64, error) { return core.GetXormAuto().Where("is_delete=0"). In("lottery_draw_rule_id", ids). Update(&LotteryDrawRuleLadder{Status: define.StatusNotBegin}) diff --git a/models/lottery_draw_wallet_history.go b/models/lottery_draw_wallet_history.go index f5bed05..81852a1 100644 --- a/models/lottery_draw_wallet_history.go +++ b/models/lottery_draw_wallet_history.go @@ -6,8 +6,8 @@ import ( //抽奖活动钱包历史 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:"金额[分正负]"` Mark string `json:"mark" description:"备注"` IsDelete bool `json:"is_delete" xorm:"default(0)"` diff --git a/models/lottery_draw_winner.go b/models/lottery_draw_winner.go index affc58b..2ce6862 100644 --- a/models/lottery_draw_winner.go +++ b/models/lottery_draw_winner.go @@ -2,11 +2,11 @@ package models //抽奖的中奖名单 //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:"奖品得信息"` -// UserId int64 `json:"user_id" description:"用户表得id"` +// UserId int `json:"user_id" description:"用户表得id"` // User *User `json:"user" xorm:"-" description:"用户信息"` // IsDelete bool `json:"is_delete" xorm:"default(0)"` // CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` diff --git a/models/module_service.go b/models/module_service.go index 565e26a..b6797f2 100644 --- a/models/module_service.go +++ b/models/module_service.go @@ -8,7 +8,7 @@ import ( //模块服务表 type ModuleService struct { - Id int64 `json:"id"` + Id int `json:"id"` Name string `json:"name" description:"模块的名称"` Price float64 `json:"price" description:"模块价格"` Free string `json:"free" description:"模块是否收费[收费|免费]"` diff --git a/models/module_service_history.go b/models/module_service_history.go index 8e39117..a5cfe60 100644 --- a/models/module_service_history.go +++ b/models/module_service_history.go @@ -9,8 +9,8 @@ import ( const ModuleServiceHistoryTableName = TableNamePrefix + "module_service_history" 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:"模块的名称"` 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:"模块是否收费[收费|免费]"` @@ -29,7 +29,7 @@ func (t *ModuleServiceHistory) Alias(name string) string { 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) } @@ -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) } -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"). Where("is_delete=0 and service_module_id=? and name=?", serviceId, serviceName).Find(&historyIds) return historyIds, err diff --git a/models/module_style.go b/models/module_style.go index 2b9e952..b259b46 100644 --- a/models/module_style.go +++ b/models/module_style.go @@ -6,8 +6,8 @@ import ( //模块样式表 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:"样式名字"` StyleImage string `json:"style_image" description:"样式图片"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否已删除"` diff --git a/models/msg_wall_server.go b/models/msg_wall_server.go index 3568641..7042e2e 100644 --- a/models/msg_wall_server.go +++ b/models/msg_wall_server.go @@ -7,8 +7,8 @@ import ( ) 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')"` MsgWallBgStatus string `json:"msg_wall_bg_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('更新')"` } -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) } diff --git a/models/new_auction_activity.go b/models/new_auction_activity.go index fcdbafa..36ef4be 100644 --- a/models/new_auction_activity.go +++ b/models/new_auction_activity.go @@ -10,9 +10,9 @@ import ( const NewAuctionActivityTableName = TableNamePrefix + "new_auction_activity" 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:"-"` 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)"` @@ -41,42 +41,42 @@ func (t *NewAuctionActivity) Alias(name string) string { 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) } -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) } -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.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, before). 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.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and id=?", id). 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). 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=?)", 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). Update(&NewAuctionActivity{Status: define.StatusNotBegin}) } -func GetAuctionsByActivityId(aid int64) ([]*NewAuctionActivity, error) { +func GetAuctionsByActivityId(aid int) ([]*NewAuctionActivity, error) { auctions := make([]*NewAuctionActivity, 0) err := core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid). Asc("created_at").Find(&auctions) diff --git a/models/new_vote_activity.go b/models/new_vote_activity.go index 41de907..48f92a6 100644 --- a/models/new_vote_activity.go +++ b/models/new_vote_activity.go @@ -1,23 +1,24 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/utils/define" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const NewVoteActivityTableName = TableNamePrefix + "new_vote_activity" 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)"` VoteActivityLadders []*NewVoteActivityLadder `json:"vote_activity_ladders" xorm:"-"` Theme string `json:"theme" xorm:"not null default('') comment('投票主题') VARCHAR(255)"` JoinWay string `json:"join_way" 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)"` - 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表示无时间限制"` VoteEndTime int64 `json:"vote_end_time" xorm:"default(0)" description:"投票开始时间"` ResultDisplay string `json:"result_display" description:"结果展示[百分比|票数]"` @@ -35,31 +36,31 @@ func (t *NewVoteActivity) TableName() string { 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). // 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.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and vote_status=? and activity_id=?", before, aid). 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.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and id=?", id). 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=?)", 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). Update(&NewVoteActivity{VoteStatus: define.StatusNotBegin}) } diff --git a/models/new_vote_activity_history.go b/models/new_vote_activity_history.go index 18abd82..4a573e1 100644 --- a/models/new_vote_activity_history.go +++ b/models/new_vote_activity_history.go @@ -1,18 +1,19 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const VoteActivityHistoryTableName = TableNamePrefix + "new_vote_activity_history" 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)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除') TINYINT(1)"` CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间')"` @@ -27,17 +28,17 @@ func (t *NewVoteActivityHistory) Alias(name string) string { 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 "+ " 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 "+ " 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 "+ " vote_activity_id=? and arch_id=?", uid, rid, vid, archId).Count(t) } diff --git a/models/new_vote_activity_ladder.go b/models/new_vote_activity_ladder.go index 63e9c25..70eccc1 100644 --- a/models/new_vote_activity_ladder.go +++ b/models/new_vote_activity_ladder.go @@ -1,19 +1,20 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const VoteActivityLadderTableName = TableNamePrefix + "new_vote_activity_ladder" 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)"` 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:"是否被投票"` 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"` @@ -24,7 +25,7 @@ func (t *NewVoteActivityLadder) TableName() string { 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) } diff --git a/models/order_draw_activity.go b/models/order_draw_activity.go index f1f9bec..42a41b4 100644 --- a/models/order_draw_activity.go +++ b/models/order_draw_activity.go @@ -1,17 +1,18 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const OrderDrawActivityTableName = TableNamePrefix + "order_draw_activity" //订单抽奖活动 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"` OrderDrawRule *OrderDrawRule `json:"order_draw_rule" xorm:"-"` MoreAreaMode string `json:"more_area_mode"` @@ -25,8 +26,8 @@ func (t *OrderDrawActivity) TableName() string { 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"). Where("is_delete=0 and activity_id=?", aid).Find(&orderIds) return orderIds, err diff --git a/models/order_draw_record.go b/models/order_draw_record.go index 9ae6798..605601b 100644 --- a/models/order_draw_record.go +++ b/models/order_draw_record.go @@ -7,19 +7,19 @@ import ( const OrderDrawRecordTableName = TableNamePrefix + "order_draw_record" 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:"-"` - 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)"` User *User `json:"user" xorm:"-"` 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')"` IsDelete bool `json:"-" xorm:"default(0)"` CreatedAt time.Time `json:"-" xorm:"created"` diff --git a/models/order_draw_rule.go b/models/order_draw_rule.go index e24df29..492f8da 100644 --- a/models/order_draw_rule.go +++ b/models/order_draw_rule.go @@ -1,18 +1,19 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const OrderDrawRuleTableName = TableNamePrefix + "order_draw_rule" //订单抽奖抽奖规则 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:"-"` - AreaId int64 `json:"area_id" description:"地区id"` + AreaId int `json:"area_id" description:"地区id"` UseTimes int `json:"use_times" description:"使用次数"` Name string `json:"name"` PrizeNum int `json:"prize_num" xorm:"-"` @@ -30,8 +31,8 @@ func (t *OrderDrawRule) Alias(name string) string { 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"). Where("is_delete=0").In("order_draw_activity_id", ids).Find(&ruleIds) return ruleIds, err diff --git a/models/order_draw_rule_ladder.go b/models/order_draw_rule_ladder.go index 440f7da..4664da5 100644 --- a/models/order_draw_rule_ladder.go +++ b/models/order_draw_rule_ladder.go @@ -1,17 +1,18 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/utils/define" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const OrderDrawRuleLadderTableName = TableNamePrefix + "order_draw_rule_ladder" //订单抽奖抽奖规则梯子 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)"` PrizeName string `json:"prize_name" xorm:"not null comment('奖品名字') VARCHAR(255)"` 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) } -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). Update(&OrderDrawRuleLadder{Status: define.StatusNotBegin}) } diff --git a/models/order_draw_style.go b/models/order_draw_style.go index 72a9724..690bc62 100644 --- a/models/order_draw_style.go +++ b/models/order_draw_style.go @@ -6,7 +6,7 @@ import ( //订单抽奖样式 type OrderDrawStyle struct { - Id int64 `json:"id"` + Id int `json:"id"` StyleName string `json:"style_name" description:"样式的名字"` StyleImageUrl string `json:"style_image_url" description:"样式的图片地址"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` diff --git a/models/order_draw_winner.go b/models/order_draw_winner.go index dc466a6..fd2d35d 100644 --- a/models/order_draw_winner.go +++ b/models/order_draw_winner.go @@ -1,12 +1,12 @@ package models //type OrderDrawWinner struct { -// Id int64 `json:"id"` -// OrderDrawActivityId int64 `json:"order_draw_activity_id"` -// OrderDrawRuleId int64 `json:"order_draw_rule_id"` -// OrderDrawRuleLadderId int64 `json:"order_draw_rule_ladder_id"` +// Id int `json:"id"` +// OrderDrawActivityId int `json:"order_draw_activity_id"` +// OrderDrawRuleId int `json:"order_draw_rule_id"` +// OrderDrawRuleLadderId int `json:"order_draw_rule_ladder_id"` // OrderDrawRuleLadder *OrderDrawRuleLadder `json:"order_draw_rule_ladder" xorm:"-"` -// UserId int64 `json:"user_id"` +// UserId int `json:"user_id"` // User *User `json:"user" xorm:"-"` // IsDelete bool `json:"-" xorm:"default(0)"` // CreatedAt time.Time `json:"-" xorm:"created"` diff --git a/models/order_entry_person.go b/models/order_entry_person.go index 7b94371..4bb6fea 100644 --- a/models/order_entry_person.go +++ b/models/order_entry_person.go @@ -1,21 +1,22 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const OrderEntryPersonTableName = TableNamePrefix + "order_entry_person" type OrderEntryPerson struct { - Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` + Id int `json:"id" xorm:"pk autoincr BIGINT(20)"` Name string `json:"name" xorm:"not null default('') comment('名字') VARCHAR(255)"` Account string `json:"account" xorm:"not null default('') comment('账号') VARCHAR(255)"` Password string `json:"password" xorm:"not null default('') comment('密码') VARCHAR(255)"` - Pid int64 `json:"pid" xorm:"not null default 0 comment('主账号') VARCHAR(255)"` - AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地区id') BIGINT(20)"` + Pid int `json:"pid" xorm:"not null default 0 comment('主账号') VARCHAR(255)"` + AreaId int `json:"area_id" xorm:"not null default 0 comment('地区id') BIGINT(20)"` AreaName string `json:"area_name" xorm:"-"` - ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('主活动id') BIGINT(20)"` + ActivityId int `json:"activity_id" xorm:"not null default 0 comment('主活动id') BIGINT(20)"` ActivityName string `json:"activity_name" xorm:"-"` Token string `json:"token" xorm:"-"` IsDelete bool `json:"-" xorm:"not null default(0) comment('软删除') TINYINT(1)"` diff --git a/models/order_gift.go b/models/order_gift.go index e05d1f9..790ba16 100644 --- a/models/order_gift.go +++ b/models/order_gift.go @@ -1,16 +1,17 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/utils/define" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const OrderGiftTableName = TableNamePrefix + "order_gift" type OrderGift 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)"` + 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)"` OrderGiftSwitch string `json:"order_gift_switch" xorm:"not null default('关闭') comment('订单送礼开关[开启|关闭]') VARCHAR(2)"` Num int `json:"num" xorm:"not null default(0) comment('前多少人下单有礼0不限制') INT(11)"` GiftName string `json:"gift_name" xorm:"not null default('') comment('礼品名字') VARCHAR(255)"` @@ -24,7 +25,7 @@ func (t *OrderGift) TableName() string { return OrderGiftTableName } -func (t *OrderGift) GetByActivityId(aid int64) (bool, error) { +func (t *OrderGift) GetByActivityId(aid int) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and order_gift_switch=? "+ "and activity_id=?", define.StatusOpen, aid).Get(t) } diff --git a/models/real_sign_history.go b/models/real_sign_history.go index 3767865..1916cca 100644 --- a/models/real_sign_history.go +++ b/models/real_sign_history.go @@ -3,13 +3,13 @@ package models //const RealSignHistoryTN = TableNamePrefix + "real_sign_history" //type RealSignHistory struct { -// Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` -// ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('主活动') INT(11)"` -// UserId int64 `json:"user_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('主活动') 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)"` -// RehearsalId int64 `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"` +// RehearsalId int `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"` // Content string `json:"content" xorm:"not null comment('提交审核的内容') TEXT"` -// Status int64 `json:"status" xorm:"not null default 0 comment('是否通过审核') TINYINT(1)"` +// Status int `json:"status" xorm:"not null default 0 comment('是否通过审核') TINYINT(1)"` // IsDelete int `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)"` // CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME"` // UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') TIMESTAMP"` @@ -19,12 +19,12 @@ package models // return RealSignHistoryTN //} // -//func (t *RealSignHistory) Info(uid, aid, rid int64) (bool, error) { +//func (t *RealSignHistory) Info(uid, aid, rid int) (bool, error) { // return core.GetXormAuto().Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=?", // uid, aid, rid).Get(t) //} // -//func (t *RealSignHistory) Check(uid, aid, rid int64) (bool, error) { +//func (t *RealSignHistory) Check(uid, aid, rid int) (bool, error) { // return core.GetXormAuto().Where("is_delete=0 and user_id=? and activity_id=? and rehearsal_id=? and status=1", // uid, aid, rid).Get(t) //} diff --git a/models/real_sign_list.go b/models/real_sign_list.go index c30e19c..4d58ade 100644 --- a/models/real_sign_list.go +++ b/models/real_sign_list.go @@ -1,19 +1,20 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const RealSignListTN = TableNamePrefix + "real_sign_list" type RealSignList 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)"` CreatedAt time.Time `json:"created_at" xorm:"created 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)"` + ActivityId int `json:"activity_id" xorm:"not null default 0 comment('主活动id') INT(11)"` JsonList string `json:"json_list" xorm:"not null comment('名单记录') TEXT"` Status int `json:"status" xorm:"not null default 0 comment('是否已被验证[0/1]') TINYINT(1)"` } @@ -23,7 +24,7 @@ func (t *RealSignList) TableName() string { } // 可能使用模糊匹配 -func (t *RealSignList) CheckSignIn(aid int64, ext string) (bool, error) { +func (t *RealSignList) CheckSignIn(aid int, ext string) (bool, error) { ext += " 1 = 1 " return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Where(ext).Get(t) } diff --git a/models/rehearsal.go b/models/rehearsal.go index 6db5ec5..80fc1de 100644 --- a/models/rehearsal.go +++ b/models/rehearsal.go @@ -6,11 +6,11 @@ const RehearsalTableName = TableNamePrefix + "rehearsal" // 彩排信息 type Rehearsal struct { - Id int64 `json:"id" xorm:"pk autoincr"` - CustomerId int64 `json:"customer_id" xorm:"not null default(0) comment('客户id')"` - ActivityId int64 `json:"activity_id" xorm:"not null default(0) comment('主活动id')"` - LimitNumber int64 `json:"limit_number" xorm:"not null default(10) comment('限定人数')"` - Status int64 `json:"status" xorm:"not null default(0) comment('0未开始/1进行中/2已结束')"` + Id int `json:"id" xorm:"pk autoincr"` + CustomerId int `json:"customer_id" xorm:"not null default(0) comment('客户id')"` + ActivityId int `json:"activity_id" xorm:"not null default(0) comment('主活动id')"` + LimitNumber int `json:"limit_number" xorm:"not null default(10) comment('限定人数')"` + Status int `json:"status" xorm:"not null default(0) comment('0未开始/1进行中/2已结束')"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('删除')"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间')"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间')"` diff --git a/models/reward_history.go b/models/reward_history.go index c3cf01e..f03723e 100644 --- a/models/reward_history.go +++ b/models/reward_history.go @@ -10,25 +10,25 @@ const ReWardHistoryTableName = TableNamePrefix + "reward_history" //打赏历史 type RewardHistory 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)"` CreatedAt time.Time `json:"create_at" xorm:"created comment('创建时间') TIMESTAMP"` UpdatedAt time.Time `json:"update_at" xorm:"updated comment('更新时间') TIMESTAMP"` 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)"` - RewardServerId int64 `json:"reward_server_id" xorm:"not null default 0 comment('打赏服务id') INT(11)"` - ActivityId int64 `json:"activity_id" xorm:"not null default 0 comment('主活动id') INT(11)"` + CustomerId int `json:"customer_id" xorm:"not null default 0 comment('客户id') INT(11)"` + RewardServerId int `json:"reward_server_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)"` - 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('用户得id') 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('用户得id') INT(11)"` Content string `json:"content" xorm:"not null comment('内容') text"` Amount float64 `json:"amount" xorm:"not null default(0.00) comment('金额')"` Status int `json:"status" xorm:"not null default(0) comment('-1未支付,0未审核,1未通过,2已通过,3已推送,4已退款') INT(11)"` - ReviewTime int64 `json:"review_time" xorm:"not null default(0) comment('审核时间') INT(11)"` + ReviewTime int `json:"review_time" xorm:"not null default(0) comment('审核时间') INT(11)"` ExpireTime int64 `json:"expire_time" xorm:"not null default(0) comment('过期时间') INT(11)"` Type int `json:"type" xorm:"not null default 0 comment('线下h5/直播 = 0/1') TINYINT(1)"` - Version int64 `json:"version" xorm:"not null version comment('乐观锁') INT(11)"` + Version int `json:"version" xorm:"not null version comment('乐观锁') INT(11)"` // 额外字段 RewardAmount string `json:"reward_amount" xorm:"-" description:"同上, 字符串"` @@ -43,12 +43,12 @@ func (t *RewardHistory) GetByOutTradeNo(outTradeNo string) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and out_trade_no=?", outTradeNo).Get(t) } -func (t *RewardHistory) UpdateStatus(id int64, status int) (int64, error) { +func (t *RewardHistory) UpdateStatus(id int, status int) (int64, error) { t.Status = status return core.GetXormAuto().Where("id=?", id).Cols("status").Update(t) } -func (t *RewardHistory) UpdateStatusByIds(ids []int64, status int) error { +func (t *RewardHistory) UpdateStatusByIds(ids []int, status int) error { if len(ids) > 0 { _, err := core.GetXormAuto().In("id", ids).Cols("status"). Update(&RewardHistory{Status: status}) diff --git a/models/reward_server.go b/models/reward_server.go index 6dcb982..8ad2bf4 100644 --- a/models/reward_server.go +++ b/models/reward_server.go @@ -1,16 +1,17 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const RewardServerTableName = TableNamePrefix + "reward_server" //打赏服务 type RewardServer struct { - Id int64 `json:"id" xorm:"pk autoincr"` - ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id')" description:"主活动id"` + Id int `json:"id" xorm:"pk autoincr"` + ActivityId int `json:"activity_id" xorm:"not null comment('主活动id')" description:"主活动id"` ServerStartTime time.Time `json:"server_start_time" xorm:"not null comment('服务开始时间')" description:"服务开始时间"` ServerEndTime time.Time `json:"server_end_time" xorm:"not null comment('服务结束时间')" description:"服务结束时间"` ServerDisplay string `json:"server_display" xorm:"not null comment('霸屏展示的方式 [消息界面|互动界面]')" description:"霸屏展示的方式 [消息界面|互动界面]"` @@ -25,6 +26,6 @@ func (t *RewardServer) TableName() string { return RewardServerTableName } -func (t *RewardServer) GetByActivityId(aid int64) (bool, error) { +func (t *RewardServer) GetByActivityId(aid int) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t) } diff --git a/models/reward_wallet.go b/models/reward_wallet.go index 8240377..abe4acf 100644 --- a/models/reward_wallet.go +++ b/models/reward_wallet.go @@ -1,16 +1,17 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const RewardWalletTableName = TableNamePrefix + "reward_wallet" //打赏钱包 type RewardWallet 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:"余额"` IsDelete bool `json:"is_delete" xorm:"default(0)"` CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` @@ -21,6 +22,6 @@ func (t *RewardWallet) TableName() string { return RewardWalletTableName } -func (t *RewardWallet) IncrBalance(cid int64, money float64) (int64, error) { +func (t *RewardWallet) IncrBalance(cid int, money float64) (int64, error) { return core.GetXormAuto().Where("customer_id=?", cid).Incr("balance", money).Update(t) } diff --git a/models/reward_wallet_history.go b/models/reward_wallet_history.go index 4e008d3..640e9ed 100644 --- a/models/reward_wallet_history.go +++ b/models/reward_wallet_history.go @@ -8,13 +8,13 @@ const RewardWalletHistoryTableName = TableNamePrefix + "reward_wallet_history" //客户打赏得钱包流水 type RewardWalletHistory struct { - Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` - RewardHistoryId int64 `json:"reward_history_id" xorm:"not null default(0) comment('打赏历史表id') INT(11)"` - CustomerId int64 `json:"customer_id" xrom:"not null comment('客户表id') INT(11)"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + RewardHistoryId int `json:"reward_history_id" xorm:"not null default(0) comment('打赏历史表id') INT(11)"` + CustomerId int `json:"customer_id" xrom:"not null comment('客户表id') INT(11)"` Money float64 `json:"money" xorm:"not null default(0.00) comment('金额[分正负]') DECIMAL(10)"` HisBalance string `json:"his_balance" xrom:"not null default('0') comment('历史红包余额') VARCHAR(255)"` Type string `json:"type" xorm:"not null default('打赏') comment('记录类型 打赏/提现') VARCHAR(255)"` - 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)"` RewardUsername string `json:"reward_username" xorm:"not null default('') comment('发起打赏的那个用户的用户名') VARCHAR(255)"` RewardAccount string `json:"reward_account" xorm:"not null default('') comment('支付打赏的账户 手机号') VARCHAR(255)"` CashMethod string `json:"cash_method" xorm:"not null default('') comment('提现方式') VARCHAR(255)"` diff --git a/models/sensitive.go b/models/sensitive.go index 7268788..3d1c4a0 100644 --- a/models/sensitive.go +++ b/models/sensitive.go @@ -1,13 +1,14 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "strings" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type Sensitive struct { - Id int64 `json:"id"` + Id int `json:"id"` Keyword string `json:"keyword" description:"关键字"` Host string `json:"host" description:"二级域名"` Category string `json:"category" description:"类别"` diff --git a/models/shake_red_envelope_activity.go b/models/shake_red_envelope_activity.go index 7ba6a23..51896d4 100644 --- a/models/shake_red_envelope_activity.go +++ b/models/shake_red_envelope_activity.go @@ -1,16 +1,17 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const ShakeRedEnvelopeActivityTableName = TableNamePrefix + "shake_red_envelope_activity" //摇红包活动 type ShakeRedEnvelopeActivity struct { - Id int64 `json:"id" xorm:"pk autoincr BIGINT(20)"` - ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id') BIGINT(20)" description:"活动的id"` + Id int `json:"id" xorm:"pk autoincr BIGINT(20)"` + ActivityId int `json:"activity_id" xorm:"not null comment('主活动id') BIGINT(20)" description:"活动的id"` RedEnvelopeActivityName string `json:"red_envelope_activity_name" xorm:"not null default('') comment('红包活动名字') VARCHAR(255)"` ShakeRedEnvelopeRule *ShakeRedEnvelopeRule `json:"shake_red_envelope_rule" xorm:"-" description:"规则"` MoreAreaMode string `json:"more_area_mode" xorm:"not null default('') comment('多地区') VARCHAR(125)"` @@ -31,11 +32,11 @@ func (t *ShakeRedEnvelopeActivity) Alias(name string) string { return Alias(t, name) } -func (t *ShakeRedEnvelopeActivity) GetPayedById(id int64) (bool, error) { +func (t *ShakeRedEnvelopeActivity) GetPayedById(id int) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and is_pay=1 and id=?", id).Get(t) } -func GetSREActivityIdsByActivityId(aid int64) ([]int64, error) { - shakeRbIds := make([]int64, 0) +func GetSREActivityIdsByActivityId(aid int) ([]int, error) { + shakeRbIds := make([]int, 0) err := core.GetXormAuto().Table(new(ShakeRedEnvelopeActivity)).Select("id"). Where("is_delete=0 and activity_id=?", aid).Find(&shakeRbIds) return shakeRbIds, err diff --git a/models/shake_red_envelope_record.go b/models/shake_red_envelope_record.go index 0168910..edf2b0d 100644 --- a/models/shake_red_envelope_record.go +++ b/models/shake_red_envelope_record.go @@ -9,20 +9,20 @@ import ( const ShakeRedEnvelopeRecordTableName = TableNamePrefix + "shake_red_envelope_record" type ShakeRedEnvelopeRecord 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:"-" xorm:"default(0)" description:"是否删除"` CreatedAt time.Time `json:"-" xorm:"created" description:"创建时间"` UpdatedAt time.Time `json:"-" xorm:"updated" description:"更新时间"` - 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('彩排id/0正式') 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('彩排id/0正式') INT(11)"` ShakeRedEnvelopeType int `json:"red_envelope_type" xorm:"not null default 0 comment('红包类型[0摇红包1直播红包]')"` - ShakeRedEnvelopeRuleId int64 `json:"shake_red_envelope_rule_id,omitempty" xorm:"not null default 0 comment('摇红包规则id') INT(11)"` - ShakeRedEnvelopeActivityId int64 `json:"shake_red_envelope_activity_id,omitempty" xorm:"not null default 0 comment('摇红包活动id') INT(11)"` + ShakeRedEnvelopeRuleId int `json:"shake_red_envelope_rule_id,omitempty" xorm:"not null default 0 comment('摇红包规则id') INT(11)"` + ShakeRedEnvelopeActivityId int `json:"shake_red_envelope_activity_id,omitempty" 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)"` Name string `json:"name" xorm:"not null default '' comment('红包名字') VARCHAR(255)"` - 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)"` Amount float64 `json:"amount" xorm:"not null default 0.00 comment('金额') DECIMAL(18)"` IsValid bool `json:"is_valid,omitempty" xorm:"-"` IsDraw int `json:"is_draw" xorm:"not null default 0 comment('-1未被摇中,0已被摇中1被提取')"` @@ -34,24 +34,24 @@ func (t *ShakeRedEnvelopeRecord) TableName() string { return ShakeRedEnvelopeRecordTableName } -func (t *ShakeRedEnvelopeRecord) ExistRecord(reid, srid, uid int64) (bool, error) { +func (t *ShakeRedEnvelopeRecord) ExistRecord(reid, srid, uid int) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and rehearsal_id=? and "+ "shake_red_envelope_rule_id=? and user_id=?", reid, srid, uid).Exist(t) } -func (t *ShakeRedEnvelopeRecord) Total(aid, rid, said, srid int64) (int64, error) { +func (t *ShakeRedEnvelopeRecord) Total(aid, rid, said, srid int) (int64, error) { return core.GetXormAuto().Where("is_delete=0 and activity_id=? and rehearsal_id=? and "+ "shake_red_envelope_activity_id=? and shake_red_envelope_rule_id=?", aid, rid, said, srid).Count(t) } -func (t *ShakeRedEnvelopeRecord) Sum(aid, rid, said, srid int64) (float64, error) { +func (t *ShakeRedEnvelopeRecord) Sum(aid, rid, said, srid int) (float64, error) { return core.GetXormAuto().Where("is_delete=0 and activity_id=? and rehearsal_id=? and "+ "shake_red_envelope_activity_id=? and shake_red_envelope_rule_id=?", aid, rid, said, srid). Sum(t, "amount") } -func (t *ShakeRedEnvelopeRecord) Count(aid, rid, said, srid int64, status int64) (int64, error) { +func (t *ShakeRedEnvelopeRecord) Count(aid, rid, said, srid int, status int) (int64, error) { return core.GetXormAuto().Where("is_delete=0 and is_draw=? and activity_id=? and rehearsal_id=? and "+ "shake_red_envelope_activity_id=? and shake_red_envelope_rule_id=?", status, aid, rid, said, srid).Count(t) } @@ -61,7 +61,7 @@ func (t *ShakeRedEnvelopeRecord) GetByRuleId(ruleId, rehearsalId, _type, archId "shake_red_envelope_rule_id=? and rehearsal_id=? and arch_id=?", _type, ruleId, rehearsalId, archId).Get(t) } -func GetRedEnvelopesByUserId(userId, activityId, rehearsalId int64, archId interface{}) ([]*ShakeRedEnvelopeRecord, error) { +func GetRedEnvelopesByUserId(userId, activityId, rehearsalId int, archId interface{}) ([]*ShakeRedEnvelopeRecord, error) { records := make([]*ShakeRedEnvelopeRecord, 0) err := core.GetXormAuto().Where("user_id=? and rehearsal_id=? and activity_id=? and arch_id=? and "+ "is_delete=0 and is_draw<>-1", userId, rehearsalId, activityId, archId).Desc("created_at"). diff --git a/models/shake_red_envelope_rule.go b/models/shake_red_envelope_rule.go index 23f9580..2ebf0f4 100644 --- a/models/shake_red_envelope_rule.go +++ b/models/shake_red_envelope_rule.go @@ -1,22 +1,23 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/utils/define" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const ShakeRedEnvelopeRuleTableName = TableNamePrefix + "shake_red_envelope_rule" //摇红包活动规则 type ShakeRedEnvelopeRule 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('是否删除')"` CreatedAt time.Time `json:"-" xorm:"not null created comment('创建时间')"` UpdatedAt time.Time `json:"-" xorm:"not null default 'CURRENT_TIMESTAMP' updated comment('更新时间')"` - ShakeRedEnvelopeActivityId int64 `json:"shake_red_envelope_activity_id" xorm:"not null comment('主活动id')" description:"主活动的id"` - AreaId int64 `json:"area_id" xorm:"not null comment('地区id')" description:"地区id"` + ShakeRedEnvelopeActivityId int `json:"shake_red_envelope_activity_id" xorm:"not null comment('主活动id')" description:"主活动的id"` + AreaId int `json:"area_id" xorm:"not null comment('地区id')" description:"地区id"` Model string `json:"model" description:"[普通红包,随机红包,阶梯红包]"` RedEnvelopeNum int `json:"red_envelope_num" xorm:"not null comment('红包个数')" description:"红包个数"` RandSum float64 `json:"rand_sum" xorm:"decimal not null comment('红包总金额')"` @@ -31,14 +32,14 @@ func (t *ShakeRedEnvelopeRule) TableName() string { return ShakeRedEnvelopeRuleTableName } -func (t *ShakeRedEnvelopeRule) UpdateStatus(id int64, status string) (int64, error) { +func (t *ShakeRedEnvelopeRule) UpdateStatus(id int, status string) (int64, error) { t.ShakeRedEnvelopeStatus = status t.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and id=?", id). Cols("shake_red_envelope_status", "updated_at").Update(t) } -func (t *ShakeRedEnvelopeRule) UpdateToStatusBySids(sids []int64, before, after string) (int64, error) { +func (t *ShakeRedEnvelopeRule) UpdateToStatusBySids(sids []int, before, after string) (int64, error) { t.ShakeRedEnvelopeStatus = after t.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and shake_red_envelope_status=? ", before). @@ -46,7 +47,7 @@ func (t *ShakeRedEnvelopeRule) UpdateToStatusBySids(sids []int64, before, after Update(t) } -func (t *ShakeRedEnvelopeRule) GetCurrent(aid int64) (bool, error) { +func (t *ShakeRedEnvelopeRule) GetCurrent(aid int) (bool, error) { return core.GetXormAuto().Table(t).Alias("r"). Join("LEFT", new(ShakeRedEnvelopeActivity).Alias("a"), "a.id=r.shake_red_envelope_activity_id and a.is_delete=0"). @@ -54,7 +55,7 @@ func (t *ShakeRedEnvelopeRule) GetCurrent(aid int64) (bool, error) { define.StatusReady, define.StatusRunning, aid).Get(t) } -func UpdateSRERuleStatusBySREActivityIds(ids []int64) (int64, error) { +func UpdateSRERuleStatusBySREActivityIds(ids []int) (int64, error) { return core.GetXormAuto().Where("is_delete=0").In("shake_red_envelope_activity_id", ids). Update(&ShakeRedEnvelopeRule{ShakeRedEnvelopeStatus: define.StatusNotBegin}) } diff --git a/models/shake_red_envelope_rule_ladder.go b/models/shake_red_envelope_rule_ladder.go index caf769e..a90ce51 100644 --- a/models/shake_red_envelope_rule_ladder.go +++ b/models/shake_red_envelope_rule_ladder.go @@ -8,9 +8,9 @@ const ShakeRedEnvelopeRuleLadderTableName = TableNamePrefix + "shake_red_envelop //摇红包规则阶梯 type ShakeRedEnvelopeRuleLadder struct { - Id int64 `json:"id"` - ShakeRedEnvelopeRuleId int64 `json:"shake_red_envelope_rule_id" description:"红包轮次的id"` - RedEnvelopeNum int64 `json:"red_envelope_num" description:"红包个数"` + Id int `json:"id"` + ShakeRedEnvelopeRuleId int `json:"shake_red_envelope_rule_id" description:"红包轮次的id"` + RedEnvelopeNum int `json:"red_envelope_num" description:"红包个数"` Probability float64 `json:"probability" description:"概率"` Des string `json:"des" xorm:"-" description:"规则描述"` Single float64 `json:"single" description:"单个金额"` diff --git a/models/shake_red_envelope_user.go b/models/shake_red_envelope_user.go index cc991e1..a4509e8 100644 --- a/models/shake_red_envelope_user.go +++ b/models/shake_red_envelope_user.go @@ -1,19 +1,20 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const ShakeRedEnvelopeUserTableName = TableNamePrefix + "shake_red_envelope_user" type ShakeRedEnvelopeUser struct { - Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` - RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式') INT(11)"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` + RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id/0正式') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` - ShakeRedEnvelopeActivityId int64 `json:"shake_red_envelope_activity_id" xrom:"not null comment('摇红包活动id') INT(11)"` - ShakeRedEnvelopeRuleId int64 `json:"shake_red_envelope_rule_id" xorm:"not null comment('轮次id') INT(11)"` - UserId int64 `json:"user_id" xorm:"not null comment('用户id') INT(11)"` + ShakeRedEnvelopeActivityId int `json:"shake_red_envelope_activity_id" xrom:"not null comment('摇红包活动id') INT(11)"` + ShakeRedEnvelopeRuleId int `json:"shake_red_envelope_rule_id" xorm:"not null comment('轮次id') INT(11)"` + UserId int `json:"user_id" xorm:"not null comment('用户id') INT(11)"` IsDelete int `json:"is_delete" xorm:"not null default(0) comment('软删除') TINYINT(1)"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间')"` UpdateAt time.Time `json:"update_at" xorm:"not null updated comment('更新时间')"` diff --git a/models/shake_red_envelope_wallet.go b/models/shake_red_envelope_wallet.go index 3e3c6c8..0c65911 100644 --- a/models/shake_red_envelope_wallet.go +++ b/models/shake_red_envelope_wallet.go @@ -4,8 +4,8 @@ import "time" //摇红包钱包 type ShakeRedEnvelopeWallet 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:"余额"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` diff --git a/models/shake_red_envelope_wallet_history.go b/models/shake_red_envelope_wallet_history.go index 3935061..8188a26 100644 --- a/models/shake_red_envelope_wallet_history.go +++ b/models/shake_red_envelope_wallet_history.go @@ -4,8 +4,8 @@ import "time" //摇红包钱包历史 type ShakeRedEnvelopeWalletHistory struct { - Id int64 `json:"id"` - CustomerId int64 `json:"customer_id" description:"客户id"` + Id int `json:"id"` + CustomerId int `json:"customer_id" description:"客户id"` HisBalance float64 `json:"his_balance" description:"历史余额"` Type string `json:"type" description:"记录类型 充值、消费、转出、未领取、发送失败"` RechargeType string `json:"recharge_type" description:"充值方式 支付宝、微信"` diff --git a/models/shake_red_envelope_winner.go b/models/shake_red_envelope_winner.go index 43db144..ae7a979 100644 --- a/models/shake_red_envelope_winner.go +++ b/models/shake_red_envelope_winner.go @@ -2,10 +2,10 @@ package models //摇红包中奖名单 //type ShakeRedEnvelopeWinner struct { -// Id int64 `json:"id"` -// ShakeRedEnvelopeRuleId int64 `json:"shake_red_envelope_rule_id" description:"红包轮次的id"` +// Id int `json:"id"` +// ShakeRedEnvelopeRuleId int `json:"shake_red_envelope_rule_id" description:"红包轮次的id"` // Amount float64 `json:"amount" description:"金额"` -// UserId int64 `json:"user_id" description:"用户表得id"` +// UserId int `json:"user_id" description:"用户表得id"` // User *User `json:"user" xorm:"-" description:"用户信息"` // IsOpen bool `json:"is_open"` // IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` diff --git a/models/sign_history.go b/models/sign_history.go index fef77c4..d4e0fed 100644 --- a/models/sign_history.go +++ b/models/sign_history.go @@ -1,26 +1,27 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const SignHistoryTN = TableNamePrefix + "sign_history" //签到历史表 type SignHistory struct { - Id int64 `json:"id" xorm:"pk autoincr comment('主键') INT(11)"` - AreaId int64 `json:"area_id" xorm:"not null default 0 comment('地区id') INT(11)"` + Id int `json:"id" xorm:"pk autoincr comment('主键') 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)"` - 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('彩排id/ 0正式') INT(11)"` - SignRuleId int64 `json:"sign_rule_id" xorm:"not null default 0 comment('sign_up表id') 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('彩排id/ 0正式') INT(11)"` + SignRuleId int `json:"sign_rule_id" xorm:"not null default 0 comment('sign_up表id') INT(11)"` Type int `json:"type" xorm:"not null default 0 comment('普通签到') TINYINT(1)"` - UserId int64 `json:"user_id" xorm:"not null default 0 comment('用户表id') TINYINT(11)"` + UserId int `json:"user_id" xorm:"not null default 0 comment('用户表id') TINYINT(11)"` SignMethod int `json:"sign_method" xorm:"not null default 0 comment('1扫码签到2实名签到3人脸签到') TINYINT(1)"` Content string `json:"content" xorm:"json comment('提交审核的内容') TEXT"` Nickname string `json:"nickname" xorm:"not null default('') comment('微信昵称') VARCHAR(128)"` - Status int64 `json:"status" xorm:"not null default 0 comment('是否通过审核[0未通过审核1申请审核2通过审核]') TINYINT(1)"` + Status int `json:"status" xorm:"not null default 0 comment('是否通过审核[0未通过审核1申请审核2通过审核]') 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"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"` diff --git a/models/sign_rule.go b/models/sign_rule.go index 4fd7758..aa7cf1a 100644 --- a/models/sign_rule.go +++ b/models/sign_rule.go @@ -2,8 +2,8 @@ package models //签到规则 //type SignRule struct { -// Id int64 `json:"id"` -// ActivityId int64 `json:"activity_id" description:"主活动签到活动的id"` +// Id int `json:"id"` +// ActivityId int `json:"activity_id" description:"主活动签到活动的id"` // SignModel string `json:"sign_model" description:"[普通签到|设备人脸识别|H5人脸识别|扫码签到|手环签到|手绘签到|ibeacon签到] 签到模式"` // MaxModel string `json:"max_model" description:"[logo墙|数字看板|] 大屏类型"` // OnlyEntered string `json:"only_entered" description:"[允许|不允许] 允许不报名的和不允许不报名的"` diff --git a/models/sign_up.go b/models/sign_up.go index bc423da..46d63c8 100644 --- a/models/sign_up.go +++ b/models/sign_up.go @@ -1,15 +1,16 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const SignUpTN = TableNamePrefix + "sign_up" type SignUp 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)"` + 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)"` Title string `json:"title"` MaxModel string `json:"max_model"` OnlyInvitation int `json:"only_invitation"` @@ -27,6 +28,6 @@ func (t *SignUp) TableName() string { return SignUpTN } -func (t *SignUp) GetByActivityId(aid int64) (bool, error) { +func (t *SignUp) GetByActivityId(aid int) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid).Get(t) } diff --git a/models/tug_of_war.go b/models/tug_of_war.go index 52ae18b..50a5c2c 100644 --- a/models/tug_of_war.go +++ b/models/tug_of_war.go @@ -8,11 +8,11 @@ import ( ) type TugOfWar struct { - Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` Model string `json:"model" xorm:"not null default '随机分配模式' comment('拔河模式.随机分配模式|H5挑选模式|大屏幕二维码模式') VARCHAR(128)"` Status string `json:"status" xorm:"not null default '未开始' comment('拔河活动状态[未开始,准备中,进行中,已结束]') VARCHAR(128)"` Number int `json:"number" xorm:"not null default 0 comment('预测人数') INT(11)"` - 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)"` IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新时间"` @@ -22,7 +22,7 @@ func (t *TugOfWar) TableName() string { return TableNamePrefix + "tug_of_war" } -func (t *TugOfWar) GetByActivityId(aid int64, status string) (bool, error) { +func (t *TugOfWar) GetByActivityId(aid int, status string) (bool, error) { return core.GetXormAuto().Where("is_delete=0 and activity_id=? and status=?", aid, status). Desc("created_at").Get(t) } @@ -32,20 +32,20 @@ func (t *TugOfWar) GetCurrent(activityId interface{}) (bool, error) { activityId, define.StatusReady, define.StatusRunning).Get(t) } -func (t *TugOfWar) UpdateStatusById(id int64, status string) (int64, error) { +func (t *TugOfWar) UpdateStatusById(id int, status string) (int64, error) { t.Status = status t.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and id=?", id).Cols("status", "updated_at").Update(t) } -func (t *TugOfWar) UpdateToStatusByAid(aid int64, before, after string) (int64, error) { +func (t *TugOfWar) UpdateToStatusByAid(aid int, before, after string) (int64, error) { t.Status = after t.UpdatedAt = time.Now() return core.GetXormAuto().Where("is_delete=0 and status=? and activity_id=?", before, aid). Cols("status", "updated_at").Update(t) } -func UpdateTOWStatusByActivityId(aid int64) (int64, error) { +func UpdateTOWStatusByActivityId(aid int) (int64, error) { return core.GetXormAuto().Where("is_delete=0 and activity_id=?", aid). Update(&TugOfWar{Status: define.StatusNotBegin}) } diff --git a/models/ui_base.go b/models/ui_base.go index d790138..75110f7 100644 --- a/models/ui_base.go +++ b/models/ui_base.go @@ -2,8 +2,8 @@ package models //背景图 //type UiBase struct { -// Id int64 `json:"id"` -// ActivityId int64 `json:"activity_id" description:"主活动的id"` +// Id int `json:"id"` +// ActivityId int `json:"activity_id" description:"主活动的id"` // PhoneImageUrl string `json:"phone_image_url" description:"手机端通用背景地址"` // MaxImageUrl string `json:"max_image_url" description:"互动大屏背景地址"` // LogoUrl string `json:" logo_url" description:"自定义logo地址"` diff --git a/models/upper_wall.go b/models/upper_wall.go index 8b5ef56..5cf0f36 100644 --- a/models/upper_wall.go +++ b/models/upper_wall.go @@ -6,12 +6,12 @@ import ( //上墙 type UpperWall struct { - Id int64 `json:"id" xorm:"pk autoincr INT(11)"` - ActivityId int64 `json:"activity_id" xorm:"not null comment('主活动id') INT(11)"` - RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排、0正式') INT(11)"` + Id int `json:"id" xorm:"pk autoincr INT(11)"` + ActivityId int `json:"activity_id" xorm:"not null comment('主活动id') INT(11)"` + RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排、0正式') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` Category string `json:"category" xorm:"not null comment('类型[1文本|2图片|3图片+文本]') INT(11)"` - UserId int64 `json:"user_id" xorm:"not null comment('用户得id') INT(11)"` + UserId int `json:"user_id" xorm:"not null comment('用户得id') INT(11)"` User *User `json:"user" xorm:"-" description:"用户信息"` Content string `json:"content" xorm:"comment('内容') text" ` Img string `json:"img" xorm:"comment('图片') text" description:"图片"` diff --git a/models/user.go b/models/user.go index 3f51c30..f40d5b4 100644 --- a/models/user.go +++ b/models/user.go @@ -1,15 +1,16 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const UserTN = TableNamePrefix + "user" //用户 type User 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:"default(0)" description:"是否删除"` CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新时间"` @@ -27,8 +28,8 @@ type User struct { Avatar string `json:"avatar" xorm:"not null default '' comment('头像') VARCHAR(128)"` Gender string `json:"gender" xorm:"not null default '' comment('性别[男,女]') VARCHAR(128)"` Balance float64 `json:"balance" xorm:"not null default 0.00 comment('余额') DECIMAL(18,2)"` - //ActivityId int64 `json:"activity_id" description:"主活动id"` // 不存在 - //AreaId int64 `json:"area_id" description:"地区id"` // 不存在 + //ActivityId int `json:"activity_id" description:"主活动id"` // 不存在 + //AreaId int `json:"area_id" description:"地区id"` // 不存在 //AreaName string `json:"area_name" description:"地区名字"` // 无关变量 diff --git a/models/user_order.go b/models/user_order.go index 3bb7d8d..fb4e4cf 100644 --- a/models/user_order.go +++ b/models/user_order.go @@ -1,29 +1,30 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const UserOrderTableName = TableNamePrefix + "user_order" type UserOrder 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)" description:"是否删除"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME" description:"创建时间"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME" description:"更新时间"` // 订单信息 DeviceInfo string `json:"device_info" xorm:"not null default('') comment('设备号') VARCHAR(32)"` - GoodType int64 `json:"good_type" xorm:"not null default(0) comment('1霸屏2打赏3直播红包4商品订单')"` + GoodType int `json:"good_type" xorm:"not null default(0) comment('1霸屏2打赏3直播红包4商品订单')"` Body string `json:"body" xorm:"not null default('') comment('') VARCHAR(128)"` OutTradeNo string `json:"out_trade_no" xorm:"not null default('') comment('商户订单号') VARCHAR(32)"` FeeType string `json:"fee_type" xorm:"not null default('CNY') comment('货币种类') VARCHAR(16)"` - TotalFee int64 `json:"total_fee" xorm:"not null default(0) comment('订单总金额,单位是分') INT(88)"` + TotalFee int `json:"total_fee" xorm:"not null default(0) comment('订单总金额,单位是分') INT(88)"` TradeType string `json:"trade_type" xorm:"not null default('JSAPI') comment('交易类型') VARCHAR(16)"` OpenId string `json:"open_id" xorm:"not null default('') comment('用户标识') VARCHAR(128)"` - 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)"` + 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)"` TransactionId string `json:"transaction_id" xorm:"not null default('') comment('微信支付订单号') VARCHAR(32)"` ExpireAt int64 `json:"time_expire" xorm:"not null default('0') comment('交易过期') INT(20)"` PrepayId string `json:"prepay_id" xorm:"not null default('') comment('预支付交易会话标识') VARCHAR(64)"` @@ -61,7 +62,7 @@ func (t *UserOrder) UpdateByOutTradeNo(outTradeNo interface{}, filed ...string) } // -//func (t *UserOrder) UpdateRefundByOutTradeNo(outTradeNo interface{}) (int64, error) { +//func (t *UserOrder) UpdateRefundByOutTradeNo(outTradeNo interface{}) (int, error) { // return core.GetXormAuto().Where("out_trade_no=?", outTradeNo). // Cols("status", "refund_recv_account", "refund_account").Update(t) //} diff --git a/models/user_prize.go b/models/user_prize.go index cb9c1fe..f3b10ea 100644 --- a/models/user_prize.go +++ b/models/user_prize.go @@ -1,18 +1,19 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const UserPrizeTableName = TableNamePrefix + "user_prize" type UserPrize struct { - Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` - UserId int64 `json:"user_id" xorm:"not null comment('用户表id') INT(11)"` - ActivityId int64 `json:"activity_id" xorm:"not null comment('互动表id') INT(11)"` - RehearsalId int64 `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id') INT(11)"` - CustomerOrderId int64 `json:"customer_order_id" xorm:"not null default 0 comment('客户订单id') 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)"` + ActivityId int `json:"activity_id" xorm:"not null comment('互动表id') INT(11)"` + RehearsalId int `json:"rehearsal_id" xorm:"not null default(0) comment('彩排id') INT(11)"` + CustomerOrderId int `json:"customer_order_id" xorm:"not null default 0 comment('客户订单id') INT(11)"` ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"` ActivityName string `json:"activity_name" xorm:"not null default('') comment('互动名字') VARCHAR(128)"` PrizeName string `json:"prize_name" xorm:"not null default('') comment('奖品名字') VARCHAR(128)"` @@ -28,7 +29,7 @@ func (t *UserPrize) TableName() string { return UserPrizeTableName } -func (t *UserPrize) SoftDeleteById(id int64) (int64, error) { +func (t *UserPrize) SoftDeleteById(id int) (int64, error) { t.IsDelete = true return core.GetXormAuto().Where("id=?", id).Cols("is_delete").Update(t) } diff --git a/models/user_red_pack.go b/models/user_red_pack.go index c2c4c31..f07c947 100644 --- a/models/user_red_pack.go +++ b/models/user_red_pack.go @@ -1,15 +1,16 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const UserRedPackTableName = TableNamePrefix + "user_red_pack" // todo: 红包号码 type UserRedPack struct { - Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` MchBillno string `json:"mch_billno" xorm:"not null default('') comment('商户订单号') VARCHAR(28)"` SendName string `json:"send_name" xorm:"not null default('') comment('商户名称') VARCHAR(32)"` ReOpenid string `json:"re_openid" xorm:"not null default '' comment('接收红包用户openid') VARCHAR(32)"` @@ -23,8 +24,8 @@ type UserRedPack struct { SendTime string `json:"send_time" xorm:"not null default '' comment('红包发送时间') VARCHAR(32)"` RefundTime string `json:"refund_time" xorm:"not null default '' comment('红包退款时间') VARCHAR(32)"` RefundAmount string `json:"refund_amount" xorm:"not null default '' comment('红包退款金额') VARCHAR(32)"` - 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)"` + 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)"` IsDelete bool `json:"is_delete" xorm:"not null default(0) comment('是否删除') TINYINT(1)" description:"是否删除"` CreatedAt time.Time `json:"created_at" xorm:"not null created comment('创建时间') DATETIME" description:"创建时间"` UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME" description:"更新时间"` diff --git a/models/user_transfer.go b/models/user_transfer.go index 26d0af1..4035d63 100644 --- a/models/user_transfer.go +++ b/models/user_transfer.go @@ -1,14 +1,15 @@ package models import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) const UserTransferTN = TableNamePrefix + "user_transfer" type UserTransfer struct { - Id int64 `json:"id" xorm:"not null pk autoincr INT(11)"` + Id int `json:"id" xorm:"not null pk autoincr INT(11)"` CreatedAt time.Time `json:"created_at" xorm:"created comment('创建时间') TIMESTAMP"` UpdatedAt time.Time `json:"updated_at" xorm:"updated comment('更新时间') TIMESTAMP"` IsDelete int `json:"is_delete" xorm:"not null default 0 comment('是否删除') TINYINT(1)"` diff --git a/models/user_wallet_history.go b/models/user_wallet_history.go index 37af62b..6f17eaf 100644 --- a/models/user_wallet_history.go +++ b/models/user_wallet_history.go @@ -6,8 +6,8 @@ import ( //用户得钱包流水 type UserWalletHistory struct { - Id int64 `json:"id" xorm:"pk autoincr INT(11)"` - UserId int64 `json:"user_id" xorm:"not null comment('用户id') INT(11)"` + Id int `json:"id" xorm:"pk autoincr INT(11)"` + UserId int `json:"user_id" xorm:"not null comment('用户id') INT(11)"` Amount float64 `json:"amount" xorm:"not null comment('金额, 分正负') DECIMAL"` Mark string `json:"mark" xorm:"not null comment('备注') VARCHAR(125)"` IsDelete bool `json:"is_delete" xorm:"default(0) comment('软删除') TINYINT(1)"` diff --git a/models/vote_activity.go b/models/vote_activity.go index 0d52d08..2c88821 100644 --- a/models/vote_activity.go +++ b/models/vote_activity.go @@ -2,8 +2,8 @@ package models //投票活动 //type VoteActivity struct { -// Id int64 `json:"id"` -// ActivityId int64 `json:"activity_id" description:"活动的id"` +// Id int `json:"id"` +// ActivityId int `json:"activity_id" description:"活动的id"` // VoteActivityName string `json:"vote_activity_name" description:"投票轮次名称"` // VoteRule *VoteRule `json:"vote_rule" xorm:"-" description:"投票规则"` // IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` diff --git a/models/vote_envelope_wallet.go b/models/vote_envelope_wallet.go index 1ac6a0e..a7a3921 100644 --- a/models/vote_envelope_wallet.go +++ b/models/vote_envelope_wallet.go @@ -2,8 +2,8 @@ package models ////投票得红包钱包 //type VoteEnvelopeWallet 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:"余额"` // IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` // CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` diff --git a/models/vote_history.go b/models/vote_history.go index 4b07b37..c4b37f1 100644 --- a/models/vote_history.go +++ b/models/vote_history.go @@ -3,10 +3,10 @@ package models // ////投票历史表 //type VoteHistory struct { -// Id int64 `json:"id"` -// VoteRuleId int64 `json:"vote_rule_id" description:"投票规则的id"` -// UserId int64 `json:"user_id" description:"用户id"` -// VoteRuleLadderId int64 `json:"vote_rule_ladder_id" description:"投票规则阶梯id"` +// Id int `json:"id"` +// VoteRuleId int `json:"vote_rule_id" description:"投票规则的id"` +// UserId int `json:"user_id" description:"用户id"` +// VoteRuleLadderId int `json:"vote_rule_ladder_id" description:"投票规则阶梯id"` // IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` // CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` // UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新时间"` diff --git a/models/vote_rule.go b/models/vote_rule.go index 3b44eb9..d575dde 100644 --- a/models/vote_rule.go +++ b/models/vote_rule.go @@ -2,21 +2,21 @@ package models ////投票规则 //type VoteRule struct { -// Id int64 `json:"id"` -// VoteActivityId int64 `json:"vote_activity_id" description:"投票的id"` -// AreaId int64 `json:"area_id" description:"地区id"` +// Id int `json:"id"` +// VoteActivityId int `json:"vote_activity_id" description:"投票的id"` +// AreaId int `json:"area_id" description:"地区id"` // Theme string `json:"theme" description:"投票主题"` // JoinWay string `json:"join_way" description:"参与方式"` // Description string `json:"description" description:"投票描述"` // Model string `json:"model" description:"[单选|多选]"` -// StyleImageId int64 `json:"style_image_id" description:"投票的样式表的id"` +// StyleImageId int `json:"style_image_id" description:"投票的样式表的id"` // Style *VoteStyle `json:"style" xorm:"-" description:"投票样式表"` // VoteRuleLadders []*VoteRuleLadder `json:"vote_rule_ladders" xorm:"-" description:"投票的物品或人"` // Repeat string `json:"repeat" description:"[允许|不允许] 重复投票"` // RcCode string `json:"rc_code" description:"链接地址或者二维码地址"` // ResultDisplay string `json:"result_display" description:"[百分比|票数]"` // ResultOrder string `json:"result_order" description:"[添加顺序|多到少|少到多]"` -// ResultLimit int64 `json:"result_limit" description:"默认显示多少名"` +// ResultLimit int `json:"result_limit" description:"默认显示多少名"` // DisplayVoteNumber string `json:"display_vote_number" description:"[显示|不显示] 投票人数"` // PhoneVoteDisplayResult string `json:"phone_vote_display_result" description:"[显示|不显示] 手机端投票是否显示结果"` // VoteNeedNameAndPhone string `json:"vote_need_name_and_phone" description:"[需要|不需要] 投票是否需要名字和手机号码"` diff --git a/models/vote_rule_ladder.go b/models/vote_rule_ladder.go index c5f984f..0f9d122 100644 --- a/models/vote_rule_ladder.go +++ b/models/vote_rule_ladder.go @@ -2,12 +2,12 @@ package models ////投票规则阶梯 //type VoteRuleLadder struct { -// Id int64 `json:"id"` -// VoteRuleId int64 `json:"vote_rule_id" description:"投票规则的id"` -// VoteNumber int64 `json:"vote_number" description:"投票的初始票数"` +// Id int `json:"id"` +// VoteRuleId int `json:"vote_rule_id" description:"投票规则的id"` +// VoteNumber int `json:"vote_number" description:"投票的初始票数"` // VoteMember string `json:"vote_member" description:"被投票的人员名字"` // MemberImg string `json:"member_img" description:"被投票的人员图片"` -// VoteTotal int64 `json:"vote_total" xorm:"-" description:"投票的总数"` +// VoteTotal int `json:"vote_total" xorm:"-" description:"投票的总数"` // IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` // CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建时间"` // UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新时间"` diff --git a/models/vote_style.go b/models/vote_style.go index f46e5b1..eee5be5 100644 --- a/models/vote_style.go +++ b/models/vote_style.go @@ -2,7 +2,7 @@ package models //投票样式 //type VoteStyle struct { -// Id int64 `json:"id"` +// Id int `json:"id"` // StyleName string `json:"style_name" description:"样式的名字"` // StyleImageUrl string `json:"style_image_url" description:"样式的图片地址"` // IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` diff --git a/models/vote_wallet_history.go b/models/vote_wallet_history.go index ccfd1a0..918213e 100644 --- a/models/vote_wallet_history.go +++ b/models/vote_wallet_history.go @@ -2,8 +2,8 @@ package models //投票钱包历史 //type VoteWalletHistory 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:"金额[分正负]"` // Mark string `json:"mark" description:"备注"` // IsDelete bool `json:"is_delete" xorm:"default(0)" description:"是否删除"` diff --git a/services/activity/activity.go b/services/activity/activity.go index 3a40727..1668112 100644 --- a/services/activity/activity.go +++ b/services/activity/activity.go @@ -2,12 +2,13 @@ package activity_service import ( "fmt" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" "hudongzhuanjia/utils/define" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) -func GetActivitiesByCustomerId(cid int64) ([]*models.Activity, error) { +func GetActivitiesByCustomerId(cid int) ([]*models.Activity, error) { // 登陆限制 // 获取用户拥有的activity activities := make([]*models.Activity, 0) @@ -18,7 +19,7 @@ func GetActivitiesByCustomerId(cid int64) ([]*models.Activity, error) { } // customer -> activity -> activity module service -> module service history -> module service // customer -> activity -> 某次具体的活动(已经启动了的) - aids := make([]int64, 0) + aids := make([]int, 0) for _, activity := range activities { aids = append(aids, activity.Id) } @@ -44,7 +45,7 @@ func GetActivitiesByCustomerId(cid int64) ([]*models.Activity, error) { return nil, err } - hids := make([]int64, 0) + hids := make([]int, 0) for _, service := range services { hids = append(hids, service.ServiceModuleHistoryId) } @@ -74,7 +75,7 @@ func GetActivitiesByCustomerId(cid int64) ([]*models.Activity, error) { return activities, nil } -func GetActivityById(id int64) (*models.Activity, bool, error) { +func GetActivityById(id int) (*models.Activity, bool, error) { activity := new(models.Activity) exist, err := models.Get(activity, id) if err != nil || !exist { @@ -87,7 +88,7 @@ func GetActivityById(id int64) (*models.Activity, bool, error) { return nil, false, err } - hids := make([]int64, 0) + hids := make([]int, 0) for _, service := range services { hids = append(hids, service.ServiceModuleHistoryId) } @@ -154,7 +155,7 @@ func GetActivityById(id int64) (*models.Activity, bool, error) { return activity, true, nil } -func ExistModuleByActivityId(aid int64, module string) (bool, error) { +func ExistModuleByActivityId(aid int, module string) (bool, error) { switch module { case define.MODULE_TUGWAR: // 拔河 bahe := new(models.TugOfWar) diff --git a/services/activity/module.go b/services/activity/module.go index 6153696..502bf43 100644 --- a/services/activity/module.go +++ b/services/activity/module.go @@ -1,12 +1,13 @@ package activity_service import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) -//func GetModuleService(moduleName string, activityId int64) (*models.ActivityModuleService, bool, error) { -// hids := make([]int64, 0) +//func GetModuleService(moduleName string, activityId int) (*models.ActivityModuleService, bool, error) { +// hids := make([]int, 0) // err := core.GetXormAuto().Table(new(models.ModuleServiceHistory)).Select("id"). // Where("is_delete=0 and name=?", moduleName).Find(&hids) // if err != nil { diff --git a/services/auction/auction.go b/services/auction/auction.go index 8fdc6fa..916e571 100644 --- a/services/auction/auction.go +++ b/services/auction/auction.go @@ -2,14 +2,15 @@ package auction_service import ( "errors" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" "hudongzhuanjia/utils/define" "strconv" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) -func GetCurrentAuction(aid, rid, uid int64, archId int) (map[string]interface{}, error) { +func GetCurrentAuction(aid, rid, uid int, archId int) (map[string]interface{}, error) { auction := new(models.NewAuctionActivity) exist, err := auction.GetCurrent(aid) if err != nil { @@ -86,15 +87,15 @@ func GetCurrentAuction(aid, rid, uid int64, archId int) (map[string]interface{}, } type UserAuctionsResult struct { - Id int64 `json:"id"` - AuctionActivityId int64 `json:"auction_activity_id"` + Id int `json:"id"` + AuctionActivityId int `json:"auction_activity_id"` AuctionGoodsName string `json:"auction_goods_name"` GoodsPicUrl string `json:"goods_pic_url"` DealPrice float64 `json:"deal_price"` - Unit int64 `json:"unit"` + Unit int `json:"unit"` } -func GetUserAuctions(activityId, rehearsalId, userId int64, archId interface{}) ([]*UserAuctionsResult, error) { +func GetUserAuctions(activityId, rehearsalId, userId int, archId interface{}) ([]*UserAuctionsResult, error) { records := make([]*UserAuctionsResult, 0) err := core.GetXormAuto().Table(new(models.AuctionResultRecord)).Alias("r"). Select("r.id, a.id as auction_activity_id, a.auction_goods_name, a.goods_pic_url, r.deal_price, a.unit"). diff --git a/services/bahe/score.go b/services/bahe/score.go index 4c10b42..f1b3489 100644 --- a/services/bahe/score.go +++ b/services/bahe/score.go @@ -6,18 +6,18 @@ import ( "github.com/ouxuanserver/osmanthuswine/src/core" ) -func GetScoreByTeamId(tid, rid int64) (int64, error) { +func GetScoreByTeamId(tid, rid int) (int64, error) { return core.GetXormAuto().Where("team_id=? and rehearsal_id=?", tid, rid). SumInt(&models.BaheTeamMember{}, "score") } -func GetUsersByBaheActivityId(id int64) []*models.BaheTeamMember { +func GetUsersByBaheActivityId(id int) []*models.BaheTeamMember { teams := make([]*models.BaheTeam, 0) err := core.GetXormAuto().Where("bahe_activity_id=? and is_delete=?", id, false).Find(&teams) if err != nil { return nil } - teamIds := make([]int64, 0) + teamIds := make([]int, 0) for i := range teams { teamIds = append(teamIds, teams[i].Id) } diff --git a/services/bahe/tug_war.go b/services/bahe/tug_war.go index e84caed..bb1662a 100644 --- a/services/bahe/tug_war.go +++ b/services/bahe/tug_war.go @@ -10,11 +10,11 @@ import ( type CountMembersResult struct { Number int `json:"number,omitempty"` - TeamId int64 `json:"team_id,omitempty"` + TeamId int `json:"team_id,omitempty"` Color string `json:"color,omitempty"` } -func CountMembers(baheId int64) ([]*CountMembersResult, error) { +func CountMembers(baheId int) ([]*CountMembersResult, error) { result := make([]*CountMembersResult, 0) err := core.GetXormAuto().Table(new(models.BaheTeam)).Alias("t"). Select("count(m.id) as number, t.id as team_id, t.bahe_team_name as color"). @@ -24,7 +24,7 @@ func CountMembers(baheId int64) ([]*CountMembersResult, error) { return result, err } -func GetMember(bid, rid, uid int64) (*models.BaheTeamMember, bool, error) { +func GetMember(bid, rid, uid int) (*models.BaheTeamMember, bool, error) { member := new(models.BaheTeamMember) exist, err := core.GetXormAuto().Where("is_delete=0 and rehearsal_id=? and "+ "bahe_activity_id=? and member_id=?", rid, bid, uid).Get(member) @@ -72,7 +72,7 @@ func GetCurrentTugWar(activityId, uid, rehearsalId interface{}, archId interface type JoinTeamResult struct { Number int - TeamId int64 + TeamId int TeamName string } diff --git a/services/balance/balance.go b/services/balance/balance.go index ddced62..38fd360 100644 --- a/services/balance/balance.go +++ b/services/balance/balance.go @@ -1,11 +1,12 @@ package balance_service import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) -func IncrUserBalance(id int64, balance float64) (int64, error) { +func IncrUserBalance(id int, balance float64) (int, error) { res, err := core.GetXormAuto().Exec("update ox_user set balance=balance+?, updated_at=? "+ "where id=? and ox_user.is_delete=0", balance, time.Now(), id) if err != nil { @@ -14,7 +15,7 @@ func IncrUserBalance(id int64, balance float64) (int64, error) { return res.RowsAffected() } -func IncrRewardBalance(cid int64, balance float64) (int64, error) { +func IncrRewardBalance(cid int, balance float64) (int, error) { res, err := core.GetXormAuto().Exec("update ox_reward_wallet set balance=balance+?, updated_at=? "+ "where customer_id=? and is_delete=0", balance, time.Now(), cid) if err != nil { @@ -24,7 +25,7 @@ func IncrRewardBalance(cid int64, balance float64) (int64, error) { return res.RowsAffected() } -func IncrBullyScreenBalance(cid int64, balance float64) (int64, error) { +func IncrBullyScreenBalance(cid int, balance float64) (int, error) { res, err := core.GetXormAuto().Exec("update ox_bully_screen_wallet set balance=balance+?, update_at=? "+ "Where customer_id=? and is_delete=0", balance, time.Now(), cid) if err != nil { diff --git a/services/bully_reward/current.go b/services/bully_reward/current.go index 6c15add..caf87e6 100644 --- a/services/bully_reward/current.go +++ b/services/bully_reward/current.go @@ -5,7 +5,7 @@ import ( "hudongzhuanjia/models" ) -func GetCurrentBullyScreen(activityId int64) (map[string]interface{}, error) { +func GetCurrentBullyScreen(activityId int) (map[string]interface{}, error) { server := new(models.BullyScreenServer) exist, err := server.GetByActivityId(activityId) if err != nil { diff --git a/services/bully_reward/dao.go b/services/bully_reward/dao.go index 461cc6b..6dc39e6 100644 --- a/services/bully_reward/dao.go +++ b/services/bully_reward/dao.go @@ -1,8 +1,9 @@ package bully_reward_service import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type BullyListResult struct { @@ -12,7 +13,7 @@ type BullyListResult struct { Second int `json:"second"` } -func GetBullyList(userId, bullyId int64) ([]*BullyListResult, error) { +func GetBullyList(userId, bullyId int) ([]*BullyListResult, error) { list := make([]*BullyListResult, 0) err := core.GetXormAuto().Table(new(models.BullyScreenHistory)).Select("id, content, status, second"). Where("is_delete=0 and user_id=? and bully_screen_server_id=? and status<> -1", userId, bullyId). @@ -21,13 +22,13 @@ func GetBullyList(userId, bullyId int64) ([]*BullyListResult, error) { } type RewardListResult struct { - Id int64 `json:"id"` + Id int `json:"id"` Content string `json:"content"` Amount float64 `json:"amount"` Status int `json:"status"` } -func GetRewardList(userId, rehearsalId, rewardId int64, archId interface{}) ([]*RewardListResult, error) { +func GetRewardList(userId, rehearsalId, rewardId int, archId interface{}) ([]*RewardListResult, error) { list := make([]*RewardListResult, 0) err := core.GetXormAuto().Table(new(models.RewardHistory)).Select("id, content, amount, status"). Where("is_delete=0 and user_id=? and reward_server_id=? and rehearsal_id=? and arch_id=? and status <> -1", @@ -40,7 +41,7 @@ type RewardResult struct { User *models.User `json:"user" xorm:"extends"` } -func GetRewardLatest(serverId, rehearsalId int64, archId interface{}) (*RewardResult, error) { +func GetRewardLatest(serverId, rehearsalId int, archId interface{}) (*RewardResult, error) { result := new(RewardResult) _, err := core.GetXormAuto().Table(new(models.RewardHistory)).Alias("h"). Join("LEFT", new(models.User).Alias("u"), "h.user_id=u.id and u.is_delete=0"). @@ -49,7 +50,7 @@ func GetRewardLatest(serverId, rehearsalId int64, archId interface{}) (*RewardRe return result, err } -func GetRewardReview(serverId, rehearsalId int64, archId interface{}) ([]*RewardResult, error) { +func GetRewardReview(serverId, rehearsalId int, archId interface{}) ([]*RewardResult, error) { result := make([]*RewardResult, 0) err := core.GetXormAuto().Table(new(models.RewardHistory)).Alias("h"). Join("LEFT", new(models.User).Alias("u"), "h.user_id=u.id and u.is_delete=0"). @@ -58,7 +59,7 @@ func GetRewardReview(serverId, rehearsalId int64, archId interface{}) ([]*Reward return result, err } -func GetRewardBlacklist(serverId, rehearsalId int64, archId interface{}) ([]*RewardResult, error) { +func GetRewardBlacklist(serverId, rehearsalId int, archId interface{}) ([]*RewardResult, error) { result := make([]*RewardResult, 0) err := core.GetXormAuto().Table(new(models.RewardHistory)).Alias("h"). Join("LEFT", new(models.User).Alias("u"), "h.user_id=u.id and u.is_delete=0"). @@ -72,7 +73,7 @@ type RewardStatus struct { Order *models.UserOrder `json:"order" xorm:"extends"` } -func CheckRewardStatus(serverId int64, archId int) error { +func CheckRewardStatus(serverId int, archId int) error { result := make([]*RewardStatus, 0) err := core.GetXormAuto().Table(new(models.RewardHistory)).Alias("h"). Join("LEFT", new(models.UserOrder).AliasName("u"), @@ -82,8 +83,8 @@ func CheckRewardStatus(serverId int64, archId int) error { if err != nil { return err } - success := make([]int64, 0) - destroy := make([]int64, 0) + success := make([]int, 0) + destroy := make([]int, 0) for _, v := range result { if v.Order.Status == 1 { success = append(success, v.History.Id) @@ -108,7 +109,7 @@ type BullyScreenResult struct { User *models.User `json:"user" xorm:"extends"` } -func GetBullyScreenReview(bullyScreenServerId, rehearsalId int64, archId interface{}) ([]*BullyScreenResult, error) { +func GetBullyScreenReview(bullyScreenServerId, rehearsalId int, archId interface{}) ([]*BullyScreenResult, error) { result := make([]*BullyScreenResult, 0) err := core.GetXormAuto().Table(new(models.BullyScreenHistory)).Alias("h"). Join("LEFT", new(models.User).Alias("u"), "h.user_id=u.id and u.is_delete=0"). @@ -117,7 +118,7 @@ func GetBullyScreenReview(bullyScreenServerId, rehearsalId int64, archId interfa return result, err } -func GetBullyScreenBlacklist(bullyScreenServerId, rehearsalId int64, archId interface{}) ([]*BullyScreenResult, error) { +func GetBullyScreenBlacklist(bullyScreenServerId, rehearsalId int, archId interface{}) ([]*BullyScreenResult, error) { result := make([]*BullyScreenResult, 0) err := core.GetXormAuto().Table(new(models.BullyScreenHistory)).Alias("h"). Join("LEFT", new(models.User).Alias("u"), "u.id=h.user_id and u.is_delete=0"). @@ -126,7 +127,7 @@ func GetBullyScreenBlacklist(bullyScreenServerId, rehearsalId int64, archId inte return result, err } -func GetBullyScreenLatest(bullyScreenServerId, rehearsalId int64, archId interface{}) (*BullyScreenResult, error) { +func GetBullyScreenLatest(bullyScreenServerId, rehearsalId int, archId interface{}) (*BullyScreenResult, error) { result := new(BullyScreenResult) _, err := core.GetXormAuto().Table(new(models.BullyScreenHistory)).Alias("h"). Join("LEFT", new(models.User).Alias("u"), "u.id=h.user_id and u.is_delete=0"). @@ -140,7 +141,7 @@ type BullyScreenStatus struct { Order *models.UserOrder `json:"order" xorm:"extends"` } -func CheckBullyScreenStatus(serverId int64) error { +func CheckBullyScreenStatus(serverId int) error { result := make([]*BullyScreenStatus, 0) err := core.GetXormAuto().Table(new(models.BullyScreenHistory)).Alias("h"). Join("LEFT", new(models.UserOrder).AliasName("u"), @@ -150,8 +151,8 @@ func CheckBullyScreenStatus(serverId int64) error { if err != nil { return err } - success := make([]int64, 0) - destroy := make([]int64, 0) + success := make([]int, 0) + destroy := make([]int, 0) for _, v := range result { if v.Order.Status == 1 { success = append(success, v.History.Id) diff --git a/services/calorie/calorie.go b/services/calorie/calorie.go index bd82e26..adf5919 100644 --- a/services/calorie/calorie.go +++ b/services/calorie/calorie.go @@ -2,12 +2,13 @@ package calorie_service import ( "errors" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) -func GetCurrentCalorie(aid, uid, rid int64, archId int) (map[string]interface{}, error) { +func GetCurrentCalorie(aid, uid, rid int, archId int) (map[string]interface{}, error) { calorie := new(models.Calorie) exist, err := calorie.GetCurrent(aid) if err != nil { @@ -79,13 +80,13 @@ func GetCurrentCalorie(aid, uid, rid int64, archId int) (map[string]interface{}, } type CalorieCountResult struct { - Id int64 `json:"id"` - ActivityId int64 `json:"activity_id"` - CalorieId int64 `json:"calorie_id"` - UserId int64 `json:"user_id"` + Id int `json:"id"` + ActivityId int `json:"activity_id"` + CalorieId int `json:"calorie_id"` + UserId int `json:"user_id"` Avatar string `json:"avatar"` Nickname string `json:"nickname"` - Score int64 `json:"score"` + Score int `json:"score"` } func RankCalorieUser(calorieId, archId, rehearsalId interface{}, limit int) ([]*CalorieCountResult, error) { diff --git a/services/im/im.go b/services/im/im.go index 8d9ea45..a955432 100644 --- a/services/im/im.go +++ b/services/im/im.go @@ -26,7 +26,7 @@ const NoticeLotteryDrawRollStart = 265 // 开始滚动 const NoticeLotteryDrawRollStop = 266 // 停止滚动 const NoticeLiveGoodBuy = 267 // 商品购买通知 -func SendNoticeByActivityId(activityId int64, _type NoticeStatus, data map[string]interface{}, members ...string) error { +func SendNoticeByActivityId(activityId int, _type NoticeStatus, data map[string]interface{}, members ...string) error { live := new(models.LiveConfig) exist, err := live.GetByActivityId(activityId) if err != nil { @@ -39,7 +39,7 @@ func SendNoticeByActivityId(activityId int64, _type NoticeStatus, data map[strin return im.SendGroupSystemNotification(groupId, int(_type), data, members...) } -func SendGroupCustomMessage(userId interface{}, activityId int64, _type NoticeStatus, data map[string]interface{}) error { +func SendGroupCustomMessage(userId interface{}, activityId int, _type NoticeStatus, data map[string]interface{}) error { live := new(models.LiveConfig) exist, err := live.GetByActivityId(activityId) if err != nil || !exist { diff --git a/services/invitation/setting.go b/services/invitation/setting.go index 131e569..a51ece3 100644 --- a/services/invitation/setting.go +++ b/services/invitation/setting.go @@ -7,7 +7,7 @@ import ( "strings" ) -func GetOptionItem(aid int64) ([]string, error) { +func GetOptionItem(aid int) ([]string, error) { // 添加邀请函的内容 option := new(models.CustomerOrderOption) exist, err := option.GetByActivityId(aid) diff --git a/services/lottery/lottery.go b/services/lottery/lottery.go index 24290f5..e2c6718 100644 --- a/services/lottery/lottery.go +++ b/services/lottery/lottery.go @@ -1,24 +1,25 @@ package lottery_service import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" "hudongzhuanjia/utils/define" "math/rand" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type LotteryUser struct { - UserId int64 + UserId int Username string UserPhone string Avatar string PrizeName string - LadderId int64 + LadderId int PrizeImg string } -func GetLotteryUsers(ids []int64) ([]*LotteryUser, error) { +func GetLotteryUsers(ids []int) ([]*LotteryUser, error) { users := make([]*LotteryUser, 0) err := core.GetXormAuto().Table(new(models.User)). Select("id as user_id, nickname as username, avatar, phone"). @@ -26,7 +27,7 @@ func GetLotteryUsers(ids []int64) ([]*LotteryUser, error) { return users, err } -func RandLotteryUserIds(users []int64) { +func RandLotteryUserIds(users []int) { r := rand.New(rand.NewSource(time.Now().Unix())) if len(users) <= 0 { return @@ -37,10 +38,10 @@ func RandLotteryUserIds(users []int64) { } } -func GetLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, areaId, archId interface{}) ([]int64, error) { +func GetLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, areaId, archId interface{}) ([]int, error) { var err error - userIds := make([]int64, 0) - recordIds := make([]int64, 0) + userIds := make([]int, 0) + recordIds := make([]int, 0) if repeat == define.MODULE_BESIDE_REPEAT { // 去除同规则中将用户 err = core.GetXormAuto().Table(new(models.LotteryDrawRecord)).Select("user_id"). @@ -63,20 +64,20 @@ func GetLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, } type LotteryListResult struct { - LotteryDrawActivityId int64 `json:"lottery_draw_activity_id"` - LotteryDrawRuleId int64 `json:"lottery_draw_rule_id"` + LotteryDrawActivityId int `json:"lottery_draw_activity_id"` + LotteryDrawRuleId int `json:"lottery_draw_rule_id"` LotteryDrawActivityName string `json:"lottery_draw_name"` LotteryDrawLadders []*LotteryLadderResult `json:"lottery_draw_ladders"` - PrizeNumber int64 `json:"prize_number"` + PrizeNumber int `json:"prize_number"` } type LotteryLadderResult struct { - LotteryDrawRuleId int64 `json:"-"` - LotteryDrawLadderId int64 `json:"lottery_draw_ladder_id"` + LotteryDrawRuleId int `json:"-"` + LotteryDrawLadderId int `json:"lottery_draw_ladder_id"` Status string `json:"status"` PrizeName string `json:"prize_name"` PrizeImg string `json:"prize_img"` - PrizeNumber int64 `json:"prize_number"` + PrizeNumber int `json:"prize_number"` } func GetLotteryAndLadder(activityId, rehearsalId, archId interface{}) ([]*LotteryListResult, error) { @@ -90,7 +91,7 @@ func GetLotteryAndLadder(activityId, rehearsalId, archId interface{}) ([]*Lotter return nil, err } - ruleIds := make([]int64, 0) + ruleIds := make([]int, 0) for _, v := range result { ruleIds = append(ruleIds, v.LotteryDrawRuleId) } @@ -103,12 +104,12 @@ func GetLotteryAndLadder(activityId, rehearsalId, archId interface{}) ([]*Lotter return nil, err } - ladderIds := make([]int64, 0) + ladderIds := make([]int, 0) for _, ladder := range ladders { ladderIds = append(ladderIds, ladder.LotteryDrawLadderId) } - records := make([]map[string]int64, 0) + records := make([]map[string]int, 0) err = core.GetXormAuto().Table(new(models.LotteryDrawRecord)).Alias("r"). Select("r.lottery_draw_rule_ladder_id as ladder_id, count(r.id) as num"). Where("is_delete=0 and rehearsal_id=? and arch_id=?", rehearsalId, archId). @@ -138,7 +139,7 @@ func GetLotteryAndLadder(activityId, rehearsalId, archId interface{}) ([]*Lotter } type LotteryUsersResult struct { - UserId int64 `json:"user_id"` + UserId int `json:"user_id"` Username string `json:"username"` Avatar string `json:"avatar"` } @@ -157,7 +158,7 @@ func GetLotteryUsersResultByRollNum(ladderId, rehearsalId, archId interface{}, r return users, err } -func GetLotteryUsersResult(areaId, activityId, rehearsalId, archId interface{}, ids []int64) ([]*LotteryUsersResult, error) { +func GetLotteryUsersResult(areaId, activityId, rehearsalId, archId interface{}, ids []int) ([]*LotteryUsersResult, error) { result := make([]*LotteryUsersResult, 0) session := core.GetXormAuto().Table(new(models.SignHistory)).Alias("h"). Select("h.user_id, u.nickname as username, u.avatar").Distinct("h.user_id"). @@ -175,7 +176,7 @@ func GetLotteryUsersResult(areaId, activityId, rehearsalId, archId interface{}, } type WinnersResult struct { - UserId int64 `json:"user_id"` + UserId int `json:"user_id"` UserName string `json:"user_name"` UserPhone string `json:"user_phone"` Avatar string `json:"avatar"` diff --git a/services/lottery/order.go b/services/lottery/order.go index d787813..ddfd562 100644 --- a/services/lottery/order.go +++ b/services/lottery/order.go @@ -1,15 +1,16 @@ package lottery_service import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" "hudongzhuanjia/utils/define" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) -func GetOrderLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, areaId interface{}) ([]int64, error) { +func GetOrderLotteryUserIds(repeat string, activityId, ruleId, ladderId, rehearsalId, areaId interface{}) ([]int, error) { var err error - var userIds = make([]int64, 0) - var recordIds = make([]int64, 0) + var userIds = make([]int, 0) + var recordIds = make([]int, 0) if repeat == define.MODULE_BESIDE_REPEAT { //查询已经中奖的用户,剔除已经中奖的用户 err = core.GetXormAuto().Table(new(models.OrderDrawRecord)).Select("user_id"). diff --git a/services/pay/order.go b/services/pay/order.go index 1725cd2..a0a442d 100644 --- a/services/pay/order.go +++ b/services/pay/order.go @@ -3,18 +3,19 @@ package pay_service import ( "encoding/xml" "fmt" - pay_core "github.com/chanxuehong/wechat/mch/core" - "github.com/chanxuehong/wechat/mch/pay" - "github.com/syndtr/goleveldb/leveldb/errors" "hudongzhuanjia/logger" "hudongzhuanjia/models" "hudongzhuanjia/utils" "hudongzhuanjia/utils/define" "strconv" "time" + + pay_core "github.com/chanxuehong/wechat/mch/core" + "github.com/chanxuehong/wechat/mch/pay" + "github.com/syndtr/goleveldb/leveldb/errors" ) -func UnifiedOrder(content, openId string, fee, goodType, userId, activityId, expireAt int64) (map[string]interface{}, error) { +func UnifiedOrder(content, openId string, fee, goodType, userId, activityId int, expireAt int64) (map[string]interface{}, error) { client, err := Client() if err != nil { return nil, err diff --git a/services/red_envelope/red_envelop.go b/services/red_envelope/red_envelop.go index 4758801..89db942 100644 --- a/services/red_envelope/red_envelop.go +++ b/services/red_envelope/red_envelop.go @@ -2,15 +2,16 @@ package red_envelope_service import ( "errors" - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" "hudongzhuanjia/utils" "hudongzhuanjia/utils/define" "math/rand" "time" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) -func GetCurrentRB(aid, uid, rid int64, archId int) (map[string]interface{}, error) { +func GetCurrentRB(aid, uid, rid int, archId int) (map[string]interface{}, error) { // 信息 一轮只能有一个 rule := new(models.ShakeRedEnvelopeRule) exist, err := rule.GetCurrent(aid) @@ -85,7 +86,7 @@ func GenRedPack(amount, num int) []int { } // 提前生成红包 -func GenRedEnvelope(aid int64, name string, rid int64, rule *models.ShakeRedEnvelopeRule, archId int) error { +func GenRedEnvelope(aid int, name string, rid int, rule *models.ShakeRedEnvelopeRule, archId int) error { // 判断红包是否存在 // 根据算法提前生成红包 r := rand.New(rand.NewSource(time.Now().Unix())) diff --git a/services/upper_wall/upper_wall.go b/services/upper_wall/upper_wall.go index 3d7aa4c..6299e24 100644 --- a/services/upper_wall/upper_wall.go +++ b/services/upper_wall/upper_wall.go @@ -1,12 +1,13 @@ package upper_wall import ( - "github.com/ouxuanserver/osmanthuswine/src/core" "hudongzhuanjia/models" + + "github.com/ouxuanserver/osmanthuswine/src/core" ) type UpperWallResult struct { - Id int64 `json:"id"` + Id int `json:"id"` Content string `json:"content"` Img string `json:"img"` Category string `json:"category"` diff --git a/services/vote/vote.go b/services/vote/vote.go index 75de1e1..47837b7 100644 --- a/services/vote/vote.go +++ b/services/vote/vote.go @@ -5,7 +5,7 @@ import ( "hudongzhuanjia/models" ) -func GetCurrentVote(aid, uid, rid int64) (map[string]interface{}, error) { +func GetCurrentVote(aid, uid, rid int) (map[string]interface{}, error) { vote := new(models.NewVoteActivity) exist, err := vote.GetCurrent(aid) if err != nil { @@ -20,24 +20,24 @@ func GetCurrentVote(aid, uid, rid int64) (map[string]interface{}, error) { } //type VoteRankResult struct { -// TotalNumber int64 `json:"total_number"` -// Id int64 `json:"id"` -// VoteActivityId int64 `json:"vote_activity_id" description:"投票轮次的id"` -// VoteNumber int64 `json:"vote_number" description:"投票的初始票数"` +// TotalNumber int `json:"total_number"` +// Id int `json:"id"` +// VoteActivityId int `json:"vote_activity_id" description:"投票轮次的id"` +// VoteNumber int `json:"vote_number" description:"投票的初始票数"` // VoteMember string `json:"vote_member" description:"被投票的人员名字"` // MemberImg string `json:"member_img" description:"被投票的人员图片"` // IsVoted bool `json:"is_vote" description:"是否已經被投票"` //} //type VoteRankResults []*VoteRankResult // -//func RankVote(vid, uid, rid int64) ([]*VoteRankResult, error) { +//func RankVote(vid, uid, rid int) ([]*VoteRankResult, error) { // result := make([]*models.NewVoteActivityLadder, 0) // err := core.GetXormAuto().Where("vote_activity_id=? and is_delete=0", vid). // Desc("total_number").Desc("updated_at").Find(&result) // if err != nil { // return nil, err // } -// ladderIds := make([]int64, 0) +// ladderIds := make([]int, 0) // for index, item := range result { // result[index].TotalNumber += result[index].VoteNumber // ladderIds = append(ladderIds, item.Id) diff --git a/services/ws_send/send.go b/services/ws_send/send.go index ba3cafb..6cd3dac 100644 --- a/services/ws_send/send.go +++ b/services/ws_send/send.go @@ -1,8 +1,9 @@ package ws_send_service import ( - "github.com/kirinlabs/HttpRequest" "hudongzhuanjia/utils/define" + + "github.com/kirinlabs/HttpRequest" ) // https://api.hudongzhuanjia.com:20182/PcClient/Connect/MessageCtl/Receive @@ -14,13 +15,13 @@ import ( type Message struct { Type string `json:"type"` Tag string `json:"tag"` - Dest int64 `json:"dest"` + Dest int `json:"dest"` RoomId string `json:"room_id"` Data map[string]interface{} `json:"data"` } // pc send upper wall -func SendUpperWall(roomId string, tag string, dest int64, data map[string]interface{}) { +func SendUpperWall(roomId string, tag string, dest int, data map[string]interface{}) { m := Message{ Type: "upper_wall", Tag: tag, @@ -31,7 +32,7 @@ func SendUpperWall(roomId string, tag string, dest int64, data map[string]interf HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m)) } -func SendShakeRedEnvelope(roomId string, tag string, dest int64, data map[string]interface{}) { +func SendShakeRedEnvelope(roomId string, tag string, dest int, data map[string]interface{}) { m := Message{ Type: "shake_rb", Tag: tag, @@ -42,7 +43,7 @@ func SendShakeRedEnvelope(roomId string, tag string, dest int64, data map[string HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m)) } -func SendBarrage(roomId string, tag string, dest int64, data map[string]interface{}) { +func SendBarrage(roomId string, tag string, dest int, data map[string]interface{}) { m := Message{ Type: "barrage", Tag: tag, @@ -53,7 +54,7 @@ func SendBarrage(roomId string, tag string, dest int64, data map[string]interfac HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m)) } -func SendSign(roomId string, tag string, dest int64, data map[string]interface{}) { +func SendSign(roomId string, tag string, dest int, data map[string]interface{}) { m := Message{ Type: "sign_up", Tag: tag, @@ -64,7 +65,7 @@ func SendSign(roomId string, tag string, dest int64, data map[string]interface{} HttpRequest.Debug(true).JSON().Post(define.SendUrl, HttpRequest.Json(&m)) } -func SendAuction(roomId string, tag string, dest int64, data map[string]interface{}) { +func SendAuction(roomId string, tag string, dest int, data map[string]interface{}) { m := Message{ Type: "auction", Tag: tag, diff --git a/test/bindata.go b/test/bindata.go index d7b3a75..e1ec94f 100644 --- a/test/bindata.go +++ b/test/bindata.go @@ -45,7 +45,7 @@ type asset struct { type bindataFileInfo struct { name string - size int64 + size int mode os.FileMode modTime time.Time } @@ -56,7 +56,7 @@ func (fi bindataFileInfo) Name() string { } // Size return file size -func (fi bindataFileInfo) Size() int64 { +func (fi bindataFileInfo) Size() int { return fi.size } diff --git a/test/config.go b/test/config.go index fb97c4a..04194c6 100644 --- a/test/config.go +++ b/test/config.go @@ -3,8 +3,9 @@ package test import ( "encoding/json" "fmt" - "github.com/kirinlabs/HttpRequest" "io/ioutil" + + "github.com/kirinlabs/HttpRequest" ) const RootHost = "http://127.0.0.1:20181" @@ -13,8 +14,8 @@ const UserId = 19 type ApiConfig struct { Host string `json:"host"` - ActivityId int64 `json:"activity_id"` // 互动id - UserId int64 `json:"user_id"` //用户id + ActivityId int `json:"activity_id"` // 互动id + UserId int `json:"user_id"` //用户id UserToken string `json:"user_token"` // token CustomerId string `json:"customer_id"` CustomerToken string `json:"customer_token"` diff --git a/test/config_test.go b/test/config_test.go index 35fdefc..e05499d 100644 --- a/test/config_test.go +++ b/test/config_test.go @@ -2,10 +2,6 @@ package test import ( "fmt" - "github.com/gorilla/websocket" - "github.com/ouxuanserver/osmanthuswine/src/helper" - "github.com/panjf2000/ants" - . "github.com/smartystreets/goconvey/convey" pay_service "hudongzhuanjia/services/pay" "hudongzhuanjia/utils" "hudongzhuanjia/utils/define" @@ -17,6 +13,11 @@ import ( "sync" "testing" "time" + + "github.com/gorilla/websocket" + "github.com/ouxuanserver/osmanthuswine/src/helper" + "github.com/panjf2000/ants" + . "github.com/smartystreets/goconvey/convey" ) func TestHttpGet(t *testing.T) { @@ -80,10 +81,10 @@ func TestTimeDurationGame(t *testing.T) { } func TestInts(t *testing.T) { - f := func(i *[]int64) { - i = &([]int64{1, 2, 3, 4, 5}) + f := func(i *[]int) { + i = &([]int{1, 2, 3, 4, 5}) } - a := make([]int64, 0) + a := make([]int, 0) f(&a) fmt.Println(a) } diff --git a/utils/utils.go b/utils/utils.go index 5ff6e77..5cb502f 100644 --- a/utils/utils.go +++ b/utils/utils.go @@ -4,7 +4,6 @@ import ( "crypto/sha1" "encoding/base64" "fmt" - "github.com/skip2/go-qrcode" "hudongzhuanjia/logger" "hudongzhuanjia/utils/define" "io/ioutil" @@ -14,17 +13,9 @@ import ( "strconv" "strings" "time" -) - -func Int(str string) int { - i, _ := strconv.Atoi(str) - return i -} -func Int64(str string) int64 { - i, _ := strconv.ParseInt(str, 10, 64) - return i -} + "github.com/skip2/go-qrcode" +) func Float64(str string) float64 { f, _ := strconv.ParseFloat(strings.TrimSpace(str), 64) @@ -102,7 +93,7 @@ func PathExists(path string) (bool, error) { return false, err } -func CountDownFormat(duration int64) string { +func CountDownFormat(duration int) string { m := duration / 60 // 分钟 s := duration - m*60 // 剩余秒 h := m / 60 // 小时