diff --git a/controllers/client/login.go b/controllers/client/login.go index 61fa5d1..21f5d67 100644 --- a/controllers/client/login.go +++ b/controllers/client/login.go @@ -66,18 +66,13 @@ func (t *UserCtl) WxLogin() { activity, exist, err := activity_service.GetActivityById(activityId) t.CheckErr(err) - customerId := t.DefaultInt64("customer_id", activity.CustomerId) customer := new(models.Customer) - exist, err = models.Get(customer, customerId) + exist, err = models.Get(customer, activity.CustomerId) t.CheckErr(err) t.Assert(exist, code.MSG_CUSTOMER_NOT_EXIST, "客户不存在") area := new(models.AreaStore) - if customer.Pid == 0 { - exist, err = area.GetMainAreaById(activityId) - } else { - exist, err = area.GetAreaStoreById(customer.AreaId) - } + exist, err = area.GetByCustomerId(customer.Id, activity.Id) t.CheckErr(err) t.Assert(exist, code.MSG_AREASTORE_NOT_EXIST, "地区不存在") @@ -126,10 +121,26 @@ func (t *UserCtl) WxLogin() { history := new(models.SignHistory) signExist, err := history.GetByUserId(activityId, activity.ArchId, user.Id, activity.RehearsalId, area.Id) t.CheckErr(err) - var signIn = "未签到" - if signExist && history.Status == 2 { // 存在数据 + if customer.IsSpecial == 1 { + if signExist { + history = new(models.SignHistory) + history.Type = 0 + history.UserId = user.Id + history.RehearsalId = activity.RehearsalId + history.ActivityId = activityId + history.SignRuleId = sign.Id + history.AreaId = area.Id + history.ArchId = activity.ArchId + history.Status = 2 + _, err = models.Add(history) + t.CheckErr(err) + } signIn = "已签到" + } else { + if signExist && history.Status == 2 { // 存在数据 + signIn = "已签到" + } } jwtToken, err := jwt.GenJwtToken(define.TYPE_H5USER, user.Id, customer.Id, customer.Pid, area.Id, activityId) diff --git a/controllers/client/sign.go b/controllers/client/sign.go index 3b0687a..8422121 100644 --- a/controllers/client/sign.go +++ b/controllers/client/sign.go @@ -8,7 +8,6 @@ import ( ws_send_service "hudongzhuanjia/services/ws_send" "hudongzhuanjia/utils/code" "hudongzhuanjia/utils/define" - "time" ) //签到 @@ -182,9 +181,6 @@ func (t *SignCtl) Sign() { history.AreaId = areaId history.ArchId = activity.ArchId history.Status = 2 - history.IsDelete = false - history.UpdatedAt = time.Now() - history.CreatedAt = time.Now() _, err = models.Add(history) t.CheckErr(err) diff --git a/models/base.go b/models/base.go index f012503..d1d0e27 100644 --- a/models/base.go +++ b/models/base.go @@ -61,7 +61,6 @@ func init() { new(SignHistory), new(SignUp), new(TugOfWar), - new(TugOfWarTest), new(UpperWall), new(User), new(UserWalletHistory), diff --git a/models/customer.go b/models/customer.go index b4d669b..9688196 100644 --- a/models/customer.go +++ b/models/customer.go @@ -32,6 +32,7 @@ type Customer struct { 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 + 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)"` IsDelete bool `json:"-" xorm:"not null default(0) comment('软删除') TINYINT(1)"`