|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- package svc
-
- import (
- "applet/app/db"
- "applet/app/e"
- "applet/app/md"
- "applet/app/utils"
- "code.fnuoos.com/EggPlanet/egg_models.git/src/implement"
- "github.com/gin-gonic/gin"
- )
-
- func AdminLog(c *gin.Context) {
- var req *md.AdminLogListReq
- if err := c.ShouldBindJSON(&req); err != nil {
- e.OutErr(c, e.ERR_INVALID_ARGS, err)
- return
- }
- var resp md.AdminLogListResp
- noticeList := make([]md.AdminLogList, 0)
- NewAdminLogDb := implement.NewAdminLogDb(db.Db)
- notice, total, _ := NewAdminLogDb.FindAdminLogAndTotal(req.Page, req.Limit, req.Type, req.Memo, req.StartTime, req.EndTime)
- resp.Total = total
- resp.TypeList = []map[string]interface{}{
- {"name": "后台登录", "type": "后台登录"},
- }
- if notice != nil {
- for _, v := range *notice {
- NewAdminDb := implement.NewAdminDb(db.Db)
- admin, _ := NewAdminDb.GetAdmin(v.AdminId)
- phone := ""
- if admin != nil {
- phone = admin.Username
- }
- tmp := md.AdminLogList{
- Id: utils.IntToStr(v.Id),
- Type: v.Type,
- Memo: v.Memo,
- Time: v.Time.Format("2006-01-02 15:04:05"),
- Ip: v.Ip,
- Phone: phone,
- AdminId: utils.IntToStr(v.AdminId),
- }
- noticeList = append(noticeList, tmp)
- }
- }
- resp.List = noticeList
- e.OutSuc(c, resp, nil)
- return
- }
|