abiao лет назад: 5
Родитель
Сommit
c012796f62
1 измененных файлов с 15 добавлено и 11 удалено
  1. 15 11
      go/gopath/src/fohow.com/apps/models/live_model/live_broad.go

+ 15 - 11
go/gopath/src/fohow.com/apps/models/live_model/live_broad.go

@@ -15,17 +15,19 @@ const (
 type LiveBroad struct {
 	Id int64 `orm:"column(id);pk"                                        json:"id"` // int(11)
 
-	Title     string    `orm:"column(title)"                                         json:"title"`
-	RoomId    int64     `orm:"column(room_id)"                                       json:"room_id"`   // int(11)
-	Recommend int64     `orm:"column(recommend)"                                     json:"recommend"` // int(11)
-	Cover     string    `orm:"column(cover)"                                         json:"cover"`
-	BeginDate time.Time `orm:"column(begin_time);null;type(datetime)"                json:"begin_time"` // datetime
-	EndDate   time.Time `orm:"column(end_time);null;type(datetime)"                  json:"end_time"`   // datetime
-	Show      bool      `orm:"column(show);null"                         json:"show"`                   // tinyint(1)
-	Remark    string    `orm:"column(remark)"                                         json:"remark"`
-	State     string    `orm:"-"                                       json:"state"`                             // varchar(255)
-	CreatedAt time.Time `orm:"column(created_at);null;auto_now_add;type(datetime)"  json:"created_at,omitempty"` // datetime
-	UpdatedAt time.Time `orm:"column(updated_at);null;auto_now;type(datetime)"      json:"updated_at,omitempty"` // datetime
+	Title          string    `orm:"column(title)"                                         json:"title"`
+	RoomId         int64     `orm:"column(room_id)"                                       json:"room_id"`   // int(11)
+	Recommend      int64     `orm:"column(recommend)"                                     json:"recommend"` // int(11)
+	Cover          string    `orm:"column(cover)"                                         json:"cover"`
+	BeginDate      time.Time `orm:"column(begin_time);null;type(datetime)"                json:"-"`    // datetime
+	EndDate        time.Time `orm:"column(end_time);null;type(datetime)"                  json:"-"`    // datetime
+	Show           bool      `orm:"column(show);null"                                     json:"show"` // tinyint(1)
+	Remark         string    `orm:"column(remark)"                                        json:"remark"`
+	State          string    `orm:"-"                                                     json:"state"`               // varchar(255)
+	BeginTimeFomat string    `orm:"-"                                             json:"begin_time"`                  // varchar(255)
+	EndTimeFomat   string    `orm:"-"                                             json:"end_time"`                    // varchar(255)
+	CreatedAt      time.Time `orm:"column(created_at);null;auto_now_add;type(datetime)"  json:"created_at,omitempty"` // datetime
+	UpdatedAt      time.Time `orm:"column(updated_at);null;auto_now;type(datetime)"      json:"updated_at,omitempty"` // datetime
 }
 
 func (self *LiveBroad) TableName() string {
@@ -79,6 +81,8 @@ func GetLatest(page, perPage, recommend int64, useCache bool) (LiveBroads []*Liv
 	}
 	for _, pd := range LiveBroads {
 		pd.Cover = GetCdnFullImgUrl(pd.Cover)
+		pd.BeginTimeFomat = pd.BeginDate.Format("2006-01-02 15:04")
+		pd.EndTimeFomat = pd.EndDate.Format("2006-01-02 15:04")
 	}
 	cache.Cache.Put(k, LiveBroads, 10*time.Minute)
 	return LiveBroads