|
|
@ -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) |
|
|
|