refactor🎨: 调整登陆日志和api和操作日志模块

This commit is contained in:
zhangwenjian committed 2021-07-04 13:43:11 +08:00
1 parent 37d318b4d9
commit b9b3cbee93
7 files changed
+41 -35

No files matched your search

+4 -4
View File
@@ -234,13 +234,13 @@ npm run dev
<table>
<tr>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/wx.png" width="180px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq.png" width="200px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qq2.png" width="200px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qun3.png" width="200px"></td>
<td><img src="https://raw.githubusercontent.com/wenjianzhang/image/master/img/qun4.png" width="200px"></td>
</tr>
<tr>
<td>微信</td>
<td>此群已满</td>
<td><a target="_blank" href="https://shang.qq.com/wpa/qunwpa?idkey=0f2bf59f5f2edec6a4550c364242c0641f870aa328e468c4ee4b7dbfb392627b"><img border="0" src="https://pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流乙号" title="go-admin技术交流乙号"></a></td>
<td><a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=pLgk1KCbSFniW7wczs7eDVyTfd5-kvSK&jump_from=webapi"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流丁号" title="go-admin技术交流丁号"></a>🆕</td>
<td><a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=5HnJ2DqQJ7AM0maNDeIjDksk-dqFDrn2&jump_from=webapi"><img border="0" src="//pub.idqqimg.com/wpa/images/group.png" alt="go-admin技术交流柄号" title="go-admin技术交流柄号"></a>🆕</td>
</tr>
</table>
+3 -5
View File
@@ -4,7 +4,6 @@ import (
"github.com/gin-gonic/gin"
"github.com/gin-gonic/gin/binding"
"github.com/go-admin-team/go-admin-core/sdk/api"
"github.com/go-admin-team/go-admin-core/sdk/pkg/jwtauth/user"
"go-admin/app/admin/models"
"go-admin/app/admin/service"
@@ -61,10 +60,10 @@ func (e SysLoginLog) GetPage(c *gin.Context) {
// @Security Bearer
func (e SysLoginLog) Get(c *gin.Context) {
s := service.SysLoginLog{}
req := dto.SysLoginLogById{}
req := dto.SysLoginLogGetReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
Bind(&req).
MakeService(&s.Service).
Errors
if err != nil {
@@ -91,7 +90,7 @@ func (e SysLoginLog) Get(c *gin.Context) {
// @Security Bearer
func (e SysLoginLog) Delete(c *gin.Context) {
s := service.SysLoginLog{}
req := dto.SysLoginLogById{}
req := dto.SysLoginLogDeleteReq{}
err := e.MakeContext(c).
MakeOrm().
Bind(&req, binding.JSON, nil).
@@ -102,7 +101,6 @@ func (e SysLoginLog) Delete(c *gin.Context) {
e.Error(500, err, err.Error())
return
}
req.SetUpdateBy(user.GetUserId(c))
err = s.Remove(&req)
if err != nil {
e.Error(500, err, "删除失败")
+12 -2
View File
@@ -77,10 +77,20 @@ func (s *SysApiUpdateReq) GetId() interface{} {
// SysApiGetReq 功能获取请求参数
type SysApiGetReq struct {
dto.ObjectGetReq
Id int `uri:"id"`
}
func (s *SysApiGetReq) GetId() interface{} {
return s.Id
}
// SysApiDeleteReq 功能删除请求参数
type SysApiDeleteReq struct {
dto.ObjectDeleteReq
Ids []int `json:"ids"`
}
func (s *SysApiDeleteReq) GetId() interface{} {
return s.Ids
}
+8 -10
View File
@@ -61,21 +61,19 @@ func (s *SysLoginLogControl) GetId() interface{} {
return s.ID
}
type SysLoginLogById struct {
Id int `uri:"id"`
Ids []int `json:"ids"`
common.ControlBy
type SysLoginLogGetReq struct {
Id int `uri:"id"`
}
func (s *SysLoginLogById) GetId() interface{} {
func (s *SysLoginLogGetReq) GetId() interface{} {
return s.Id
}
func (s *SysLoginLogById) Generate() *SysLoginLogById {
cp := *s
return &cp
// SysLoginLogDeleteReq 功能删除请求参数
type SysLoginLogDeleteReq struct {
Ids []int `json:"ids"`
}
func (s *SysLoginLogById) GenerateM() (*models.SysLoginLog, error) {
return &models.SysLoginLog{}, nil
func (s *SysLoginLogDeleteReq) GetId() interface{} {
return s.Ids
}
+9 -9
View File
@@ -79,19 +79,19 @@ func (s *SysOperaLogControl) GetId() interface{} {
return s.ID
}
type SysOperaLogById struct {
Id int `uri:"id"`
Ids []int `json:"ids"`
type SysOperaLogGetReq struct {
Id int `uri:"id"`
}
func (s *SysOperaLogById) GetId() interface{} {
if len(s.Ids) > 0 {
s.Ids = append(s.Ids, s.Id)
return s.Ids
}
func (s *SysOperaLogGetReq) GetId() interface{} {
return s.Id
}
func (s *SysOperaLogById) SetUpdateBy(id int) {
// SysOperaLogDeleteReq 功能删除请求参数
type SysOperaLogDeleteReq struct {
Ids []int `json:"ids"`
}
func (s *SysOperaLogDeleteReq) GetId() interface{} {
return s.Ids
}
+3 -3
View File
@@ -34,8 +34,8 @@ func (e *SysLoginLog) GetPage(c *dto.SysLoginLogSearch, list *[]models.SysLoginL
return nil
}
// GetSysLoginLog 获取SysLoginLog对象
func (e *SysLoginLog) Get(d *dto.SysLoginLogById, model *models.SysLoginLog) error {
// Get 获取SysLoginLog对象
func (e *SysLoginLog) Get(d *dto.SysLoginLogGetReq, model *models.SysLoginLog) error {
var err error
db := e.Orm.First(model, d.GetId())
err = db.Error
@@ -52,7 +52,7 @@ func (e *SysLoginLog) Get(d *dto.SysLoginLogById, model *models.SysLoginLog) err
}
// Remove 删除SysLoginLog
func (e *SysLoginLog) Remove(c *dto.SysLoginLogById) error {
func (e *SysLoginLog) Remove(c *dto.SysLoginLogDeleteReq) error {
var err error
var data models.SysLoginLog
+2 -2
View File
@@ -35,7 +35,7 @@ func (e *SysOperaLog) GetPage(c *dto.SysOperaLogGetPageReq, list *[]models.SysOp
}
// Get 获取SysOperaLog对象
func (e *SysOperaLog) Get(d *dto.SysOperaLogById, model *models.SysOperaLog) error {
func (e *SysOperaLog) Get(d *dto.SysOperaLogGetReq, model *models.SysOperaLog) error {
var data models.SysOperaLog
err := e.Orm.Model(&data).
@@ -67,7 +67,7 @@ func (e *SysOperaLog) Insert(model *models.SysOperaLog) error {
}
// Remove 删除SysOperaLog
func (e *SysOperaLog) Remove(d *dto.SysOperaLogById) error {
func (e *SysOperaLog) Remove(d *dto.SysOperaLogDeleteReq) error {
var err error
var data models.SysOperaLog