Commit a2bb9799 authored by haoyanbin's avatar haoyanbin

Time

parent c16cde2b
package models package models
import ( import (
// "gorm.io/gorm" // "gorm.io/gorm"
"go-admin/common/models" "go-admin/common/models"
"time"
) )
type OrgSeason struct { type OrgSeason struct {
models.Model models.Model
LeagueId string `json:"leagueId" gorm:"type:bigint(20);comment:org_league表id"` LeagueId string `json:"leagueId" gorm:"type:bigint(20);comment:org_league表id"`
DivisionId string `json:"divisionId" gorm:"type:bigint(20);comment:org_division表id"` DivisionId string `json:"divisionId" gorm:"type:bigint(20);comment:org_division表id"`
SeasonName string `json:"seasonName" gorm:"type:varchar(255);comment:赛季名称"` SeasonName string `json:"seasonName" gorm:"type:varchar(255);comment:赛季名称"`
TotalRounds string `json:"totalRounds" gorm:"type:varchar(60);comment:总轮次"` TotalRounds string `json:"totalRounds" gorm:"type:varchar(60);comment:总轮次"`
StartTime string `json:"startTime" gorm:"type:date;comment:赛季开始时间"` StartTime time.Time `json:"startTime" gorm:"type:date;comment:赛季开始时间"`
EndTime string `json:"endTime" gorm:"type:date;comment:赛季结束时间"` EndTime time.Time `json:"endTime" gorm:"type:date;comment:赛季结束时间"`
Status string `json:"status" gorm:"type:tinyint(1);comment:赛季开启状态 1 是 0 否"` Status string `json:"status" gorm:"type:tinyint(1);comment:赛季开启状态 1 是 0 否"`
models.ModelTime models.ModelTime
models.ControlBy models.ControlBy
} }
func (OrgSeason) TableName() string { func (OrgSeason) TableName() string {
return "org_season" return "org_season"
} }
func (e *OrgSeason) Generate() models.ActiveRecord { func (e *OrgSeason) Generate() models.ActiveRecord {
...@@ -31,4 +32,4 @@ func (e *OrgSeason) Generate() models.ActiveRecord { ...@@ -31,4 +32,4 @@ func (e *OrgSeason) Generate() models.ActiveRecord {
func (e *OrgSeason) GetId() interface{} { func (e *OrgSeason) GetId() interface{} {
return e.Id return e.Id
} }
\ No newline at end of file
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"go-admin/app/operate/models" "go-admin/app/operate/models"
"go-admin/common/dto" "go-admin/common/dto"
common "go-admin/common/models" common "go-admin/common/models"
"go-admin/common/utils"
"time" "time"
) )
...@@ -37,15 +38,15 @@ func (m *OrgAdGetPageReq) GetNeedSearch() interface{} { ...@@ -37,15 +38,15 @@ func (m *OrgAdGetPageReq) GetNeedSearch() interface{} {
} }
type OrgAdInsertReq struct { type OrgAdInsertReq struct {
Id int `json:"-" comment:""` // Id int `json:"-" comment:""` //
UserId string `json:"userId" comment:"sys_user表id"` UserId string `json:"userId" comment:"sys_user表id"`
AdName string `json:"adName" comment:"广告名称"` AdName string `json:"adName" comment:"广告名称"`
AdType string `json:"adType" comment:"类型"` AdType string `json:"adType" comment:"类型"`
AdImg string `json:"adImg" comment:"广告图"` AdImg string `json:"adImg" comment:"广告图"`
AdUrl string `json:"adUrl" comment:"链接地址"` AdUrl string `json:"adUrl" comment:"链接地址"`
Status string `json:"status" comment:"广告状态 1 开启 0关闭"` Status string `json:"status" comment:"广告状态 1 开启 0关闭"`
StartTime time.Time `json:"startTime" comment:"广告有效期 开始时间"` StartTime string `json:"startTime" comment:"广告有效期 开始时间"`
EndTime time.Time `json:"endTime" comment:"广告有效期 结束时间"` EndTime string `json:"endTime" comment:"广告有效期 结束时间"`
common.ControlBy common.ControlBy
} }
...@@ -59,8 +60,8 @@ func (s *OrgAdInsertReq) Generate(model *models.OrgAd) { ...@@ -59,8 +60,8 @@ func (s *OrgAdInsertReq) Generate(model *models.OrgAd) {
model.AdImg = s.AdImg model.AdImg = s.AdImg
model.AdUrl = s.AdUrl model.AdUrl = s.AdUrl
model.Status = s.Status model.Status = s.Status
model.StartTime = s.StartTime model.StartTime = utils.StringToTime(s.StartTime)
model.EndTime = s.EndTime model.EndTime = utils.StringToTime(s.EndTime)
} }
func (s *OrgAdInsertReq) GetId() interface{} { func (s *OrgAdInsertReq) GetId() interface{} {
...@@ -68,15 +69,15 @@ func (s *OrgAdInsertReq) GetId() interface{} { ...@@ -68,15 +69,15 @@ func (s *OrgAdInsertReq) GetId() interface{} {
} }
type OrgAdUpdateReq struct { type OrgAdUpdateReq struct {
Id int `uri:"id" comment:""` // Id int `uri:"id" comment:""` //
UserId string `json:"userId" comment:"sys_user表id"` UserId string `json:"userId" comment:"sys_user表id"`
AdName string `json:"adName" comment:"广告名称"` AdName string `json:"adName" comment:"广告名称"`
AdType string `json:"adType" comment:"类型"` AdType string `json:"adType" comment:"类型"`
AdImg string `json:"adImg" comment:"广告图"` AdImg string `json:"adImg" comment:"广告图"`
AdUrl string `json:"adUrl" comment:"链接地址"` AdUrl string `json:"adUrl" comment:"链接地址"`
Status string `json:"status" comment:"广告状态 1 开启 0关闭"` Status string `json:"status" comment:"广告状态 1 开启 0关闭"`
StartTime time.Time `json:"startTime" comment:"广告有效期 开始时间"` StartTime string `json:"startTime" comment:"广告有效期 开始时间"`
EndTime time.Time `json:"endTime" comment:"广告有效期 结束时间"` EndTime string `json:"endTime" comment:"广告有效期 结束时间"`
common.ControlBy common.ControlBy
} }
...@@ -90,8 +91,8 @@ func (s *OrgAdUpdateReq) Generate(model *models.OrgAd) { ...@@ -90,8 +91,8 @@ func (s *OrgAdUpdateReq) Generate(model *models.OrgAd) {
model.AdImg = s.AdImg model.AdImg = s.AdImg
model.AdUrl = s.AdUrl model.AdUrl = s.AdUrl
model.Status = s.Status model.Status = s.Status
model.StartTime = s.StartTime model.StartTime = utils.StringToTime(s.StartTime)
model.EndTime = s.EndTime model.EndTime = utils.StringToTime(s.EndTime)
} }
func (s *OrgAdUpdateReq) GetId() interface{} { func (s *OrgAdUpdateReq) GetId() interface{} {
......
...@@ -4,6 +4,7 @@ import ( ...@@ -4,6 +4,7 @@ import (
"go-admin/app/operate/models" "go-admin/app/operate/models"
"go-admin/common/dto" "go-admin/common/dto"
common "go-admin/common/models" common "go-admin/common/models"
"go-admin/common/utils"
"time" "time"
) )
...@@ -72,8 +73,8 @@ func (s *OrgSeasonInsertReq) Generate(model *models.OrgSeason) { ...@@ -72,8 +73,8 @@ func (s *OrgSeasonInsertReq) Generate(model *models.OrgSeason) {
model.DivisionId = s.DivisionId model.DivisionId = s.DivisionId
model.SeasonName = s.SeasonName model.SeasonName = s.SeasonName
model.TotalRounds = s.TotalRounds model.TotalRounds = s.TotalRounds
model.StartTime = s.StartTime model.StartTime = utils.StringToTime(s.StartTime)
model.EndTime = s.EndTime model.EndTime = utils.StringToTime(s.EndTime)
model.Status = s.Status model.Status = s.Status
} }
...@@ -101,8 +102,8 @@ func (s *OrgSeasonUpdateReq) Generate(model *models.OrgSeason) { ...@@ -101,8 +102,8 @@ func (s *OrgSeasonUpdateReq) Generate(model *models.OrgSeason) {
model.DivisionId = s.DivisionId model.DivisionId = s.DivisionId
model.SeasonName = s.SeasonName model.SeasonName = s.SeasonName
model.TotalRounds = s.TotalRounds model.TotalRounds = s.TotalRounds
model.StartTime = s.StartTime model.StartTime = utils.StringToTime(s.StartTime)
model.EndTime = s.EndTime model.EndTime = utils.StringToTime(s.EndTime)
model.Status = s.Status model.Status = s.Status
} }
......
...@@ -29,6 +29,11 @@ func StringToFloat(data string) float64 { ...@@ -29,6 +29,11 @@ func StringToFloat(data string) float64 {
return reply return reply
} }
func StringToTime(data string) time.Time {
timeData, _ := time.Parse("2006-01-02 15:04:05", data)
return timeData
}
//上传文件 //上传文件
func UploadFile(f multipart.File, h *multipart.FileHeader) (string, error) { func UploadFile(f multipart.File, h *multipart.FileHeader) (string, error) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment