Compare commits
merge into: tommy:master
tommy:dev
tommy:master
tommy:token_replace
pull from: tommy:token_replace
tommy:dev
tommy:master
tommy:token_replace
96 Commits
master
...
token_repl
178 changed files with 3648 additions and 2756 deletions
-
104controllers/author.go
-
4controllers/base.go
-
14controllers/client/activity.go
-
37controllers/client/area.go
-
27controllers/client/auction.go
-
7controllers/client/barrage.go
-
17controllers/client/bully_screen.go
-
14controllers/client/calorie.go
-
85controllers/client/good.go
-
16controllers/client/invite_envelope.go
-
41controllers/client/live.go
-
203controllers/client/login.go
-
53controllers/client/lottery.go
-
554controllers/client/order_entry.go
-
14controllers/client/reward.go
-
29controllers/client/shake_red_envelope.go
-
129controllers/client/sign.go
-
46controllers/client/tug_war.go
-
12controllers/client/upper_wall.go
-
36controllers/client/vote.go
-
18controllers/client/wx.go
-
3controllers/common/im.go
-
3controllers/common/wechat_oauth.go
-
11controllers/pc/activity.go
-
2controllers/pc/area_store.go
-
74controllers/pc/auction.go
-
6controllers/pc/barrage.go
-
31controllers/pc/bully_screen.go
-
22controllers/pc/calorie.go
-
21controllers/pc/login.go
-
116controllers/pc/lottery_draw.go
-
511controllers/pc/order_draw.go
-
50controllers/pc/reward.go
-
101controllers/pc/shake_red_envelope.go
-
67controllers/pc/sign.go
-
84controllers/pc/tug_war.go
-
70controllers/pc/upper_wall.go
-
59controllers/pc/vote.go
-
38controllers/pc/ws.go
-
23go.mod
-
66go.sum
-
11hdws/ws/client.go
-
4hdws/ws/http.go
-
12hdws/ws/jwt_go.go
-
93hdws/ws/login.go
-
2hdws/ws/message.go
-
2hdws/ws/msg.go
-
61hdws/ws/node.go
-
10hdws/ws/timer.go
-
12libs/jwt/jwt_go.go
-
5libs/qq/qq.go
-
7libs/wx/wx.go
-
3main.go
-
50models/CalorieUser.go
-
18models/activity.go
-
12models/activity_module_service.go
-
7models/arch.go
-
51models/area_store.go
-
4models/auction_activity.go
-
4models/auction_deal.go
-
35models/auction_history.go
-
18models/auction_player.go
-
32models/auction_result_record.go
-
10models/auction_rule.go
-
6models/bahe_activity.go
-
6models/bahe_history.go
-
8models/bahe_rule.go
-
13models/bahe_team.go
-
34models/bahe_team_member.go
-
7models/barrage_history.go
-
107models/base.go
-
28models/bully_screen_history.go
-
11models/bully_screen_server.go
-
9models/bully_screen_wallet.go
-
8models/bully_screen_wallet_hisotry.go
-
17models/calorie.go
-
44models/customer.go
-
27models/customer_goods.go
-
18models/customer_operation.go
-
100models/customer_order.go
-
35models/customer_order_option.go
-
45models/customer_order_sub.go
-
9models/dan_mu_server.go
-
6models/invitation.go
-
24models/invitation_letter.go
-
9models/live_config.go
-
9models/live_config_area.go
-
10models/live_red_envelope_rule.go
-
20models/live_viewer.go
-
13models/lottery_draw_activity.go
-
4models/lottery_draw_envelope_wallet.go
-
67models/lottery_draw_record.go
-
17models/lottery_draw_rule.go
-
11models/lottery_draw_rule_ladder.go
-
4models/lottery_draw_wallet_history.go
-
8models/lottery_draw_winner.go
-
2models/module_service.go
-
16models/module_service_history.go
-
4models/module_style.go
-
6models/msg_wall_server.go
@ -0,0 +1,37 @@ |
|||
package client |
|||
|
|||
import ( |
|||
"hudongzhuanjia/controllers" |
|||
"hudongzhuanjia/libs/jwt" |
|||
"hudongzhuanjia/models" |
|||
"hudongzhuanjia/utils/code" |
|||
"hudongzhuanjia/utils/define" |
|||
) |
|||
|
|||
type AreaCtl struct { |
|||
controllers.BaseCtl |
|||
} |
|||
|
|||
// 登陆
|
|||
func (t *AreaCtl) Login() { |
|||
activityId := t.MustGetInt("activity_id") |
|||
username := t.MustGet("username") |
|||
password := t.MustGet("password") |
|||
|
|||
activity := &models.Activity{} |
|||
exist, err := models.Get(activity, activityId) |
|||
t.CheckErr(err) |
|||
t.Assert(exist, code.MSG_ACTIVITY_NOT_EXIST, "互动不存在") |
|||
|
|||
area := &models.AreaStore{} |
|||
exist, err = area.Login(activityId, username, password) |
|||
t.CheckErr(err) |
|||
t.Assert(exist, code.MSG_ERR_Authority, "用户信息异常") |
|||
token, err := jwt.GenJwtToken(define.TYPE_AREAADMIN, area.Id, area.CustomerId, area.CustomerId, area.Id, area.ActivityId) |
|||
t.CheckErr(err) |
|||
t.SetSession(define.TOKEN, token) |
|||
t.JSON(map[string]interface{}{ |
|||
"token": token, |
|||
"area": area, |
|||
}) |
|||
} |
@ -1,53 +1,59 @@ |
|||
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)"` |
|||
Avatar string `json:"avatar" xorm:"-"` |
|||
Nickname string `json:"nickname" xorm:"-"` |
|||
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)"` |
|||
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 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"` |
|||
UpdatedAt time.Time `json:"updated_at" xorm:"not null default(CURRENT_TIMESTAMP) updated comment('创建时间') TIMESTAMP"` |
|||
|
|||
// 无关变量
|
|||
Avatar string `json:"avatar" xorm:"-"` |
|||
Nickname string `json:"nickname" xorm:"-"` |
|||
} |
|||
|
|||
func (t *CalorieUser) TableName() string { |
|||
return CalorieUserTableName |
|||
} |
|||
|
|||
func (t *CalorieUser) GetByCalorieIdAndUserId(cid, uid, rid int64) (bool, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and calorie_id=? and user_id=? and rehearsal_id=?", cid, uid, rid).Get(t) |
|||
func (t *CalorieUser) GetByCalorieIdAndUserId(calorieId, archId, userId, rehearsalId interface{}) (bool, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and calorie_id=? and arch_id=? and user_id=? and rehearsal_id=?", |
|||
calorieId, archId, userId, rehearsalId).Get(t) |
|||
} |
|||
|
|||
func (t *CalorieUser) IncrScore(score int) (int64, error) { |
|||
func (t *CalorieUser) IncrScore(archId, id, score interface{}) (int64, error) { |
|||
t.JoinTime = time.Now().UnixNano() |
|||
return core.GetXormAuto().Where("is_delete=0 and id=?", t.Id).Cols("score", "join_time").Incr("score", score).Update(t) |
|||
return core.GetXormAuto().Where("is_delete=0 and arch_id=? and id=?", archId, id). |
|||
Cols("score", "join_time").Incr("score", score).Update(t) |
|||
} |
|||
|
|||
func (t *CalorieUser) CountByCalorieId(calorieId, rehearsalId interface{}) (int64, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and calorie_id=? and rehearsal_id=?", |
|||
calorieId, rehearsalId).Count(&CalorieUser{}) |
|||
func (t *CalorieUser) CountByCalorieId(calorieId, archId, rehearsalId interface{}) (int64, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and calorie_id=? and arch_id=? and rehearsal_id=?", |
|||
calorieId, archId, rehearsalId).Count(&CalorieUser{}) |
|||
} |
|||
|
|||
func GetCalorieUsersByCalorieIdAndScore(calorieId, rehearsalId, score interface{}) ([]*CalorieUser, error) { |
|||
func GetCalorieUsersByCalorieIdAndScore(calorieId, archId, rehearsalId, score interface{}) ([]*CalorieUser, error) { |
|||
users := make([]*CalorieUser, 0) |
|||
err := core.GetXormAuto().Where("is_delete=0 and calorie_id=? and rehearsal_id=? and score<=?", |
|||
calorieId, rehearsalId, score).Desc("score").Asc("join_time").Find(&users) |
|||
err := core.GetXormAuto().Where("is_delete=0 and calorie_id=? and arch_id=? and rehearsal_id=? and score<=?", |
|||
calorieId, archId, rehearsalId, score).Desc("score").Asc("join_time").Find(&users) |
|||
return users, err |
|||
} |
|||
|
|||
func (t *CalorieUser) Count(calorieId, rehearsalId interface{}) (int64, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and calorie_id=? and rehearsal_id=?", |
|||
calorieId, rehearsalId).Count(t) |
|||
func (t *CalorieUser) Count(calorieId, archId, rehearsalId interface{}) (int64, error) { |
|||
return core.GetXormAuto().Where("is_delete=0 and calorie_id=? and arch_id=? and rehearsal_id=?", |
|||
calorieId, archId, rehearsalId).Count(t) |
|||
} |
@ -1,43 +1,58 @@ |
|||
package models |
|||
|
|||
import ( |
|||
"time" |
|||
|
|||
"github.com/ouxuanserver/osmanthuswine/src/core" |
|||
"github.com/ouxuanserver/osmanthuswine/src/helper" |
|||
) |
|||
|
|||
const AreaStoreTableName = TableNamePrefix + "area_store" |
|||
|
|||
//店铺地区
|
|||
type AreaStore struct { |
|||
Id int64 `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)"` |
|||
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"` |
|||
UpdatedAt time.Time `json:"updated_at" xorm:"not null updated comment('更新时间') DATETIME"` |
|||
Model `xorm:"extends"` |
|||
//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"`
|
|||
//
|
|||
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 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 int `json:"is_main_area" xorm:"not null default(0) comment('是否主地区1是') TINYINT(1)"` |
|||
AreaServicePhone string `json:"area_service_phone" xorm:"not null default '' comment('地区客服电话') VARCHAR(128)"` |
|||
AdminName string `json:"admin_name" xorm:"not null default '' comment('地区管理员名称') VARCHAR(128)"` |
|||
Phone string `json:"phone" xorm:"not null default '' comment('地区管理员账号即手机号') VARCHAR(128)"` |
|||
Password string `json:"password" xorm:"not null default '' comment('密码') VARCHAR(255)"` |
|||
RawPassword string `json:"raw_password" xorm:"not null default '' comment('密码') VARCHAR(255)"` |
|||
IsImport int `json:"is_import" xorm:"not null default 0 comment('是否导入的数据') TINYINT(1)"` |
|||
AreaGoodsRuleSwitch int `json:"area_goods_rule_switch" xorm:"not null default 0 comment('地区专属商品规则1开启(用自己地区的商品)0关闭(共用主会场的商品)') TINYINT(1)"` |
|||
UserId int `json:"user_id" xorm:"not null default 0 comment('用户id') INT(11)"` |
|||
} |
|||
|
|||
func (t *AreaStore) TableName() string { |
|||
return AreaStoreTableName |
|||
} |
|||
func (t *AreaStore) Login(activityId int, username, password string) (bool, error) { |
|||
password = helper.Md5("hdzj==" + password) |
|||
return core.GetXormAuto().NoAutoCondition().Where("activity_id=? and phone=? and password=?", activityId, username, password).Get(t) |
|||
} |
|||
|
|||
func (t *AreaStore) GetByUserId(activityId, userId int) (bool, error) { |
|||
return core.GetXormAuto().Where("user_id=? and activity_id=?", userId, activityId).Get(t) |
|||
} |
|||
|
|||
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) { |
|||
return core.GetXormAuto().Where("activity_id=? and is_main_area=1 and is_delete=0", aid).Get(t) |
|||
func (t *AreaStore) GetMainAreaById(aid int) (bool, error) { |
|||
return core.GetXormAuto().NoAutoCondition().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 |
|||
|
Some files were not shown because too many files changed in this diff
Write
Preview
Loading…
Cancel
Save
Reference in new issue