作者 tangxvhui

赛季设置调整

... ... @@ -105,9 +105,10 @@ func (c RankController) RankSeasonAdd() {
c.ResposeJson(msg)
}()
type Parameter struct {
Name string `json:"name"`
BeginTime string `json:"begin_time"`
EndTime string `json:"end_time"`
RankTypeId int64 `json:"rank_type_id"`
Name string `json:"name"`
BeginTime string `json:"begin_time"`
EndTime string `json:"end_time"`
}
var param Parameter
if err := json.Unmarshal(c.Ctx.Input.RequestBody, &param); err != nil {
... ... @@ -120,7 +121,7 @@ func (c RankController) RankSeasonAdd() {
endTime int64
)
companyid := c.GetCompanyId()
err := serverank.AddRankSeason(beginTime, endTime, param.Name, companyid)
err := serverank.AddRankSeason(param.RankTypeId, beginTime, endTime, param.Name, companyid)
msg = protocol.NewReturnResponse(nil, err)
return
}
... ... @@ -176,6 +177,7 @@ func (c RankController) RankRangeAdd() {
c.ResposeJson(msg)
}()
type Parameter struct {
RankTypeId int64 `json:"rank_type_id"`
Name string `json:"name"`
RangeType int8 `json:"range_type"`
RelationId []int64 `json:"relation_id"`
... ... @@ -207,7 +209,7 @@ func (c RankController) RankRangeAdd() {
return
}
companyid := c.GetCompanyId()
err := serverank.AddRankRange(param.Name, param.RangeType, param.RelationId, companyid)
err := serverank.AddRankRange(param.RankTypeId, param.Name, param.RangeType, param.RelationId, companyid)
msg = protocol.NewReturnResponse(nil, err)
return
}
... ...
... ... @@ -11,6 +11,7 @@ type RankPeriod struct {
Id int64 `orm:"column(id);auto" description:"主键"`
CompanyId int64 `orm:"column(company_id);null" description:"公司编号 表company.id"`
SeasonName string `orm:"column(season_name);size(50);null" description:"赛季名称"`
RankTypeId int64 `orm:"column(rank_type_id);size(50);null" description:"赛季类型id"`
BeginTime time.Time `orm:"column(begin_time);type(timestamp);null" description:"开始时间"`
EndTime time.Time `orm:"column(end_time);type(timestamp);null" description:"结束时间"`
CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
... ...
... ... @@ -9,14 +9,15 @@ import (
)
type RankRange struct {
Id int64 `orm:"column(id);auto"`
Name string `orm:"column(name);size(50);null" description:"名称"`
CompanyId int64 `orm:"column(company_id);null" description:"公司编号 表company.id"`
Type int8 `orm:"column(type);null" description:"1:所有员工 2:指定员工 3:所有部门 4:指定部门"`
Data string `orm:"column(data);size(1000);null" description:"人员范围数据(type:2,4 有值 对于人员数据/部门数据)"`
CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"更新时间"`
SortNum int `orm:"column(sort_num)"`
Id int64 `orm:"column(id);auto"`
Name string `orm:"column(name);size(50);null" description:"名称"`
CompanyId int64 `orm:"column(company_id);null" description:"公司编号 表company.id"`
RankTypeId int64 `orm:"column(rank_type_id);null" description:""`
Type int8 `orm:"column(type);null" description:"1:所有员工 2:指定员工 3:所有部门 4:指定部门"`
Data string `orm:"column(data);size(1000);null" description:"人员范围数据(type:2,4 有值 对于人员数据/部门数据)"`
CreateAt time.Time `orm:"column(create_at);type(timestamp);null" description:"创建时间"`
UpdateAt time.Time `orm:"column(update_at);type(timestamp);null" description:"更新时间"`
SortNum int `orm:"column(sort_num)"`
}
func (t *RankRange) TableName() string {
... ...
... ... @@ -176,13 +176,14 @@ func RankSeasonList(pageindex int, pagesize int, companyid int64) (protocol.Resp
return rspData, err
}
func AddRankSeason(beginTime int64, endTime int64, name string, companyid int64) error {
func AddRankPeriod(rankTypeId int64, beginTime int64, endTime int64, name string, companyid int64) error {
var (
err error
)
m := &models.RankPeriod{
CompanyId: companyid,
SeasonName: name,
RankTypeId: rankTypeId,
BeginTime: time.Unix(beginTime, 0),
EndTime: time.Unix(endTime, 0),
Status: 0,
... ... @@ -232,16 +233,17 @@ func GetRankRangeList(companyid int64) []protocol.RankRangeItem {
return rspData
}
func AddRankRange(name string, rangetype int8, relationId []int64, companyid int64) error {
func AddRankRange(rankTypeId int64, name string, rangetype int8, relationId []int64, companyid int64) error {
var (
rankRangeDatas []models.RankRangeData
rankRange *models.RankRange
err error
)
rankRange = &models.RankRange{
Name: name,
CompanyId: companyid,
Type: rangetype,
Name: name,
CompanyId: companyid,
RankTypeId: rankTypeId,
Type: rangetype,
}
o := orm.NewOrm()
o.Begin()
... ...