Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
bwallet
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Go
bwallet
Commits
19739590
Commit
19739590
authored
Jul 23, 2020
by
shajiaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix
parent
3261dd3b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
0 deletions
+4
-0
news.go
models/news.go
+2
-0
news.go
service/news_service/news.go
+2
-0
No files found.
models/news.go
View file @
19739590
...
@@ -14,6 +14,7 @@ type News struct {
...
@@ -14,6 +14,7 @@ type News struct {
Highlight
uint8
`gorm:"not null;default:0" json:"highlight"`
Highlight
uint8
`gorm:"not null;default:0" json:"highlight"`
Status
uint8
`gorm:"not null;default:0" json:"status"`
Status
uint8
`gorm:"not null;default:0" json:"status"`
PlatformId
int
`gorm:"not null;default:1" json:"platform_id"`
PlatformId
int
`gorm:"not null;default:1" json:"platform_id"`
CreateTime
int64
`gorm:"not null;" json:"create_time"`
}
}
func
(
w
News
)
TableName
()
string
{
func
(
w
News
)
TableName
()
string
{
...
@@ -76,6 +77,7 @@ func AddNews(data map[string]interface{}) (error) {
...
@@ -76,6 +77,7 @@ func AddNews(data map[string]interface{}) (error) {
Highlight
:
data
[
"highlight"
]
.
(
uint8
),
Highlight
:
data
[
"highlight"
]
.
(
uint8
),
Status
:
data
[
"status"
]
.
(
uint8
),
Status
:
data
[
"status"
]
.
(
uint8
),
PlatformId
:
data
[
"platform_id"
]
.
(
int
),
PlatformId
:
data
[
"platform_id"
]
.
(
int
),
CreateTime
:
data
[
"create_time"
]
.
(
int64
),
}
}
if
err
:=
db
.
Create
(
&
news
)
.
Error
;
err
!=
nil
{
if
err
:=
db
.
Create
(
&
news
)
.
Error
;
err
!=
nil
{
return
err
return
err
...
...
service/news_service/news.go
View file @
19739590
...
@@ -2,6 +2,7 @@ package news_service
...
@@ -2,6 +2,7 @@ package news_service
import
(
import
(
"bwallet/models"
"bwallet/models"
"time"
)
)
type
News
struct
{
type
News
struct
{
...
@@ -46,6 +47,7 @@ func (n *News) Add() error {
...
@@ -46,6 +47,7 @@ func (n *News) Add() error {
"highlight"
:
n
.
Highlight
,
"highlight"
:
n
.
Highlight
,
"status"
:
n
.
Status
,
"status"
:
n
.
Status
,
"platform_id"
:
n
.
PlatformId
,
"platform_id"
:
n
.
PlatformId
,
"create_time"
:
time
.
Now
()
.
UTC
()
.
Unix
(),
}
}
if
err
:=
models
.
AddNews
(
news
);
err
!=
nil
{
if
err
:=
models
.
AddNews
(
news
);
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment