12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- // @Author gmy 2024/9/24 16:05:00
- package controllers
- import (
- "encoding/json"
- "eta/eta_hub/models"
- "eta/eta_hub/models/document_manage_model"
- "eta/eta_hub/models/system"
- "eta/eta_hub/services/document_manage_service"
- )
- type OutsideReportController struct {
- BaseAuthController
- }
- // DocumentSave
- // @Title 新建文档
- // @Description 新建文档
- // @Success 200 “操作成功”
- // @router /document/save [post]
- func (this *OutsideReportController) DocumentSave() {
- br := new(models.BaseResponse).Init()
- defer func() {
- this.Data["json"] = br
- this.ServeJSON()
- }()
- var req *document_manage_model.OutsideReportBO
- if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
- br.Msg = "参数解析异常!"
- br.ErrMsg = "参数解析失败,Err:" + e.Error()
- return
- }
- userName := req.UserName
- sysUser, err := system.GetUserByAdminName(userName)
- req.SysUserId = sysUser.AdminId
- req.SysUserName = sysUser.AdminName
- err = document_manage_service.DocumentSave(req)
- if err != nil {
- br.Msg = "保存文档失败"
- br.ErrMsg = "保存文档失败,Err:" + err.Error()
- return
- }
- br.Ret = 200
- br.Msg = "操作成功"
- return
- }
|