...
|
...
|
@@ -45,6 +45,12 @@ func (c RankController) EditRankType() { |
|
|
msg = protocol.BadRequestParam("1")
|
|
|
return
|
|
|
}
|
|
|
param.Name = strings.TrimSpace(param.Name)
|
|
|
n := []rune(param.Name)
|
|
|
if len(n) > 5 || len(n) == 0 {
|
|
|
msg = protocol.BadRequestParam("10103")
|
|
|
return
|
|
|
}
|
|
|
companyid := c.GetCompanyId()
|
|
|
err := serverank.UpdateRankType(param.Id, param.Name, companyid)
|
|
|
msg = protocol.NewReturnResponse(nil, err)
|
...
|
...
|
@@ -126,7 +132,17 @@ func (c RankController) RankSeasonAdd() { |
|
|
}
|
|
|
param.Name = strings.TrimSpace(param.Name)
|
|
|
if len(param.Name) == 0 {
|
|
|
msg = protocol.BadRequestParam("1")
|
|
|
msg = protocol.BadRequestParam("10104")
|
|
|
return
|
|
|
}
|
|
|
param.BeginTime = strings.TrimSpace(param.BeginTime)
|
|
|
if len(param.BeginTime) == 0 {
|
|
|
msg = protocol.BadRequestParam("10105")
|
|
|
return
|
|
|
}
|
|
|
param.EndTime = strings.TrimSpace(param.EndTime)
|
|
|
if len(param.EndTime) == 0 {
|
|
|
msg = protocol.BadRequestParam("10106")
|
|
|
return
|
|
|
}
|
|
|
var (
|
...
|
...
|
@@ -135,13 +151,13 @@ func (c RankController) RankSeasonAdd() { |
|
|
)
|
|
|
t1, err := time.ParseInLocation("2006-01-02", param.BeginTime, time.Local)
|
|
|
if err != nil {
|
|
|
msg = protocol.BadRequestParam("1")
|
|
|
msg = protocol.BadRequestParam("10105")
|
|
|
return
|
|
|
}
|
|
|
beginTime = t1.Unix()
|
|
|
t2, err := time.ParseInLocation("2006-01-02", param.EndTime, time.Local)
|
|
|
if err != nil {
|
|
|
msg = protocol.BadRequestParam("1")
|
|
|
msg = protocol.BadRequestParam("10106")
|
|
|
return
|
|
|
}
|
|
|
endTime = t2.Unix() + 86399 //60*60*24-1
|
...
|
...
|
@@ -185,6 +201,16 @@ func (c RankController) RankSeasonEdit() { |
|
|
msg = protocol.BadRequestParam("1")
|
|
|
return
|
|
|
}
|
|
|
param.BeginTime = strings.TrimSpace(param.BeginTime)
|
|
|
if len(param.BeginTime) == 0 {
|
|
|
msg = protocol.BadRequestParam("10105")
|
|
|
return
|
|
|
}
|
|
|
param.EndTime = strings.TrimSpace(param.EndTime)
|
|
|
if len(param.EndTime) == 0 {
|
|
|
msg = protocol.BadRequestParam("10106")
|
|
|
return
|
|
|
}
|
|
|
var (
|
|
|
beginTime int64
|
|
|
endTime int64
|
...
|
...
|
@@ -192,14 +218,14 @@ func (c RankController) RankSeasonEdit() { |
|
|
t1, err := time.ParseInLocation("2006-01-02", param.BeginTime, time.Local)
|
|
|
if err != nil {
|
|
|
log.Error(err.Error())
|
|
|
msg = protocol.BadRequestParam("1")
|
|
|
msg = protocol.BadRequestParam("10105")
|
|
|
return
|
|
|
}
|
|
|
beginTime = t1.Unix()
|
|
|
t2, err := time.ParseInLocation("2006-01-02", param.EndTime, time.Local)
|
|
|
if err != nil {
|
|
|
log.Error(err.Error())
|
|
|
msg = protocol.BadRequestParam("1")
|
|
|
msg = protocol.BadRequestParam("10106")
|
|
|
return
|
|
|
}
|
|
|
|
...
|
...
|
@@ -261,6 +287,12 @@ func (c RankController) RankRangeAdd() { |
|
|
msg = protocol.BadRequestParam("1")
|
|
|
return
|
|
|
}
|
|
|
param.Name = strings.TrimSpace(param.Name)
|
|
|
n := []rune(param.Name)
|
|
|
if len(n) == 0 || len(n) > 5 {
|
|
|
msg = protocol.BadRequestParam("10107")
|
|
|
return
|
|
|
}
|
|
|
switch param.RangeType {
|
|
|
case 1:
|
|
|
//员工
|
...
|
...
|
@@ -306,6 +338,14 @@ func (c RankController) RankRangeEdit() { |
|
|
msg = protocol.BadRequestParam("1")
|
|
|
return
|
|
|
}
|
|
|
|
|
|
param.Name = strings.TrimSpace(param.Name)
|
|
|
n := []rune(param.Name)
|
|
|
if len(n) == 0 || len(n) > 5 {
|
|
|
msg = protocol.BadRequestParam("10107")
|
|
|
return
|
|
|
}
|
|
|
|
|
|
switch param.RangeType {
|
|
|
case 1:
|
|
|
//员工
|
...
|
...
|
@@ -498,8 +538,8 @@ func (c RankController) RankTypeConfigSet() { |
|
|
}()
|
|
|
type Parameter struct {
|
|
|
RankTypeId int64 `json:"rank_type_id"`
|
|
|
AutoCreate int `json:"auto_create"` //【0:不自动创建】【1:自动创建】
|
|
|
AutoCreateDay int64 `json:"auto_create_day"` //赛季时间, 单位:天
|
|
|
AutoCreate int8 `json:"auto_create"` //【0:不自动创建】【1:自动创建】
|
|
|
AutoCreateDay int `json:"auto_create_day"` //赛季时间, 单位:天
|
|
|
}
|
|
|
var param Parameter
|
|
|
if err := json.Unmarshal(c.Ctx.Input.RequestBody, ¶m); err != nil {
|
...
|
...
|
@@ -525,13 +565,14 @@ func (c RankController) RankTypeConfigSet() { |
|
|
msg = protocol.NewReturnResponse(nil, e)
|
|
|
return
|
|
|
}
|
|
|
v := models.RankTypeConfigSet{
|
|
|
AutoCreate: param.AutoCreate,
|
|
|
AutoCreateLength: param.AutoCreateDay,
|
|
|
if param.AutoCreate > 1 || param.AutoCreate < 0 {
|
|
|
e := protocol.NewErrWithMessage("1")
|
|
|
msg = protocol.NewReturnResponse(nil, e)
|
|
|
return
|
|
|
}
|
|
|
bt, _ := json.Marshal(v)
|
|
|
rankType.ConfigSet = string(bt)
|
|
|
err = models.UpdateRankById(rankType, []string{"ConfigSet"})
|
|
|
rankType.AutoCreate = param.AutoCreate
|
|
|
rankType.AutoPeriod = param.AutoCreateDay
|
|
|
err = models.UpdateRankById(rankType, []string{"AutoCreate", "AutoCreateDay"})
|
|
|
if err != nil {
|
|
|
log.Error("更新rank_type数据失败;%s", err)
|
|
|
e := protocol.NewErrWithMessage("1")
|
...
|
...
|
@@ -576,8 +617,13 @@ func (c RankController) RankTypeConfigShow() { |
|
|
msg = protocol.NewReturnResponse(nil, e)
|
|
|
return
|
|
|
}
|
|
|
v := &models.RankTypeConfigSet{}
|
|
|
json.Unmarshal([]byte(rankType.ConfigSet), v)
|
|
|
v := struct {
|
|
|
AutoCreate int8 `json:"auto_create"`
|
|
|
AutoCreateDay int `json:"auto_create_day"`
|
|
|
}{
|
|
|
AutoCreate: rankType.AutoCreate,
|
|
|
AutoCreateDay: rankType.AutoPeriod,
|
|
|
}
|
|
|
msg = protocol.NewReturnResponse(v, nil)
|
|
|
return
|
|
|
} |
...
|
...
|
|