Commit 19739590 authored by shajiaiming's avatar shajiaiming

fix

parent 3261dd3b
......@@ -14,6 +14,7 @@ type News struct {
Highlight uint8 `gorm:"not null;default:0" json:"highlight"`
Status uint8 `gorm:"not null;default:0" json:"status"`
PlatformId int `gorm:"not null;default:1" json:"platform_id"`
CreateTime int64 `gorm:"not null;" json:"create_time"`
}
func (w News) TableName() string {
......@@ -76,6 +77,7 @@ func AddNews(data map[string]interface{}) (error) {
Highlight: data["highlight"].(uint8),
Status: data["status"].(uint8),
PlatformId: data["platform_id"].(int),
CreateTime: data["create_time"].(int64),
}
if err := db.Create(&news).Error; err != nil {
return err
......
......@@ -2,6 +2,7 @@ package news_service
import (
"bwallet/models"
"time"
)
type News struct {
......@@ -46,6 +47,7 @@ func (n *News) Add() error {
"highlight": n.Highlight,
"status": n.Status,
"platform_id": n.PlatformId,
"create_time": time.Now().UTC().Unix(),
}
if err := models.AddNews(news); err != nil {
......
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