-
Notifications
You must be signed in to change notification settings - Fork 0
/
show_notice_service.go
40 lines (37 loc) · 799 Bytes
/
show_notice_service.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//Package service ...
/*
* @Descripttion:
* @Author: congz
* @Date: 2020-06-12 23:12:42
* @LastEditors: congz
* @LastEditTime: 2020-08-09 10:18:54
*/
package service
import (
"kvmall/models"
"kvmall/pkg/e"
"kvmall/pkg/logging"
"kvmall/serializer"
)
// ShowNoticeService 公告详情服务
type ShowNoticeService struct {
}
// Show 公告详情服务
func (service *ShowNoticeService) Show() serializer.Response {
var notice models.Notice
code := e.SUCCESS
if err := models.DB.First(¬ice, 1).Error; err != nil {
logging.Info(err)
code = e.ERROR_DATABASE
return serializer.Response{
Status: code,
Msg: e.GetMsg(code),
Error: err.Error(),
}
}
return serializer.Response{
Status: code,
Msg: e.GetMsg(code),
Data: serializer.BuildNotice(notice),
}
}