diff --git a/gin_server_admin/api/v1/archiveapi/archiveapihandle.go b/gin_server_admin/api/v1/archiveapi/archiveapihandle.go index ccf1305..4b7dd97 100644 --- a/gin_server_admin/api/v1/archiveapi/archiveapihandle.go +++ b/gin_server_admin/api/v1/archiveapi/archiveapihandle.go @@ -1,6 +1,7 @@ package archiveapi import ( + "strconv" "time" "github.com/flipped-aurora/gin-vue-admin/server/commonus" @@ -51,6 +52,7 @@ func (a *ArchiveApiHandle) ArchiveTypeList(c *gin.Context) { for _, listVal := range archiveList { var listCont archiveTypeOutPut listCont.Id = listVal.Id + listCont.OutId = strconv.FormatInt(listVal.Id, 10) listCont.ColumnrName = listVal.Title listCont.Sort = listVal.Sort if listVal.Stater == 1 { @@ -120,13 +122,37 @@ func (a *ArchiveApiHandle) GetArchiveInfo(c *gin.Context) { response.Result(102, arrData, "参数错误!请重新提交!", c) return } + if arrData.OutId != "" { + outIdVal, outIdErr := strconv.ParseInt(arrData.OutId, 10, 64) + if outIdErr != nil { + response.Result(1022, arrData, "参数错误!请重新提交!", c) + return + } + arrData.Id = outIdVal + // response.Result(1022, outIdVal, "参数错误!请重新提交!", c) + // return + // // arrData.Id = outIdVal + } var archiveInfo archivesmodel.ArchivesType archiveInfoErr := global.GVA_DB_Master.Where("at_id = ?", arrData.Id).First(&archiveInfo).Error if archiveInfoErr != nil { response.Result(103, archiveInfoErr, "该栏目不存在!", c) return } - response.Result(0, archiveInfo, "获取成功!", c) + outPutInfo := commonus.MapOut() + // outIdset, outIdsetErr := strconv.ParseInt(archiveInfo.Id, 10, 64) + outIdset := strconv.FormatInt(archiveInfo.Id, 10) + + outPutInfo["id"] = outIdset + + outPutInfo["id"] = archiveInfo.Id + outPutInfo["title"] = archiveInfo.Title + outPutInfo["stater"] = archiveInfo.Stater + outPutInfo["parentId"] = archiveInfo.ParentId + outPutInfo["time"] = archiveInfo.Time + outPutInfo["uid"] = archiveInfo.UID + outPutInfo["sort"] = archiveInfo.Sort + response.Result(0, outPutInfo, "获取成功!", c) } //改变栏目状态 @@ -137,10 +163,18 @@ func (a *ArchiveApiHandle) EiteArchiveState(c *gin.Context) { response.Result(101, err, "参数错误!请重新提交!", c) return } - if arrData.Id == 0 { + if arrData.Id == 0 && arrData.OutId == "" { response.Result(102, arrData, "参数错误!请重新提交!", c) return } + if arrData.OutId != "" { + outIdVal, outIdErr := strconv.ParseInt(arrData.OutId, 10, 64) + if outIdErr != nil { + response.Result(102, arrData, "参数错误!请重新提交!", c) + return + } + arrData.Id = outIdVal + } if arrData.State == 0 { arrData.State = 1 } @@ -199,6 +233,14 @@ func (a *ArchiveApiHandle) EiteArchiveInfo(c *gin.Context) { response.Result(102, arrData, "参数错误!请重新提交!", c) return } + if arrData.OutId != "" { + outIdVal, outIdErr := strconv.ParseInt(arrData.OutId, 10, 64) + if outIdErr != nil { + response.Result(102, arrData, "参数错误!请重新提交!", c) + return + } + arrData.Id = outIdVal + } if arrData.Title == "" { response.Result(103, err, "请输入栏目名称!", c) return @@ -231,6 +273,7 @@ func (a *ArchiveApiHandle) BatchEiteArchiveState(c *gin.Context) { response.Result(102, arrData, "参数错误!请重新提交!", c) return } + if arrData.State == 0 { arrData.State = 1 } diff --git a/gin_server_admin/api/v1/archiveapi/graphicinformation.go b/gin_server_admin/api/v1/archiveapi/graphicinformation.go index e462d3a..1fa9077 100644 --- a/gin_server_admin/api/v1/archiveapi/graphicinformation.go +++ b/gin_server_admin/api/v1/archiveapi/graphicinformation.go @@ -2,6 +2,7 @@ package archiveapi import ( "encoding/json" + "strconv" "time" "github.com/flipped-aurora/gin-vue-admin/server/commonus" @@ -23,13 +24,22 @@ func (g *GraphicInformation) ArchiveFileList(c *gin.Context) { response.Result(101, err, "参数错误!请重新提交!", c) return } - if requestData.ParentId == 0 { - response.Result(102, err, "参数错误!请重新提交!", c) - return - } + //查询条件 whereMap := commonus.MapOut() - whereMap["g_parent"] = requestData.ParentId + + if requestData.ParentId != 0 { + whereMap["g_parent"] = requestData.ParentId + } + + if requestData.ParentIdStr != "" { + outIdVal, outIdErr := strconv.ParseInt(requestData.ParentIdStr, 10, 64) + if outIdErr != nil { + response.Result(102, requestData, "参数错误!请重新提交!", c) + return + } + whereMap["g_parent"] = outIdVal + } //判断集团 if requestData.Group != 0 { whereMap["g_write_group"] = requestData.Group @@ -90,9 +100,18 @@ func (g *GraphicInformation) ArchiveFileList(c *gin.Context) { fileListInfo.Title = fileCont.Title fileListInfo.ColumnId = fileCont.ParentSun + fileListInfo.ParentColumnId = fileCont.Parent + + archiveTypeCont.Id = fileCont.Parent + arcTypeErrParent := archiveTypeCont.GetArchiveTypeInfo() + if arcTypeErrParent == nil { + fileListInfo.ParentColumnTitle = archiveTypeCont.Title + } else { + fileListInfo.ParentColumnTitle = "" + } + archiveTypeCont.Id = fileCont.ParentSun arcTypeErr := archiveTypeCont.GetArchiveTypeInfo() - // fmt.Printf("%v========>%v------->%v\n", arcTypeErr, archiveTypeCont, archiveTypeCont.Title) if arcTypeErr == nil { fileListInfo.ColumnTitle = archiveTypeCont.Title } else { @@ -113,6 +132,7 @@ func (g *GraphicInformation) ArchiveFileList(c *gin.Context) { } else { fileListInfo.State = false } + fileListInfo.OutId = strconv.FormatInt(fileCont.Id, 10) fileListAry = append(fileListAry, fileListInfo) } @@ -215,6 +235,14 @@ func (g *GraphicInformation) GetArchiveFileInfo(c *gin.Context) { response.Result(101, getID, "参数错误!请重新提交!", c) return } + if getID.OutId != "" { + outIdVal, outIdErr := strconv.ParseInt(getID.OutId, 10, 64) + if outIdErr != nil { + response.Result(102, getID, "参数错误!请重新提交!", c) + return + } + getID.Id = outIdVal + } var archiveFileInfo archivesmodel.ArchiveFile archiveFileInfo.InitInfo() sysUserErr := global.GVA_DB_BooImgkDate.Where("g_id = ?", getID.Id).First(&archiveFileInfo).Error @@ -237,6 +265,7 @@ func (g *GraphicInformation) EiteArchiveFileInfo(c *gin.Context) { response.Result(108, archiveFileInfo, "!请提交文档ID!", c) return } + if archiveFileInfo.Title == "" { response.Result(102, archiveFileInfo, "请输入文档标题!", c) return @@ -299,6 +328,14 @@ func (g *GraphicInformation) ModifyArchiveFileInfo(c *gin.Context) { response.Result(102, arrData, "参数错误!请重新提交!", c) return } + if arrData.OutId != "" { + outIdVal, outIdErr := strconv.ParseInt(arrData.OutId, 10, 64) + if outIdErr != nil { + response.Result(102, arrData, "参数错误!请重新提交!", c) + return + } + arrData.Id = outIdVal + } if arrData.State == 0 { arrData.State = 3 } @@ -448,6 +485,7 @@ func (g *GraphicInformation) GetArchiveFileAttributeList(c *gin.Context) { var bookAttrCont archiveFileAttrOutPut getMyInfo, myInfoIstrue := getUserInfo([]string{"worker_man.wm_number", "worker_man_data.wmd_name"}, map[string]interface{}{"wm_key": bookAttrVal.UserId}) bookAttrCont.Id = bookAttrVal.Id + bookAttrCont.OutId = strconv.FormatInt(bookAttrVal.Id, 10) bookAttrCont.FileId = bookAttrVal.FileId bookAttrCont.UserId = bookAttrVal.UserId bookAttrCont.Time = bookAttrVal.Time diff --git a/gin_server_admin/api/v1/archiveapi/requestdata.go b/gin_server_admin/api/v1/archiveapi/requestdata.go index 970c53a..b982cfe 100644 --- a/gin_server_admin/api/v1/archiveapi/requestdata.go +++ b/gin_server_admin/api/v1/archiveapi/requestdata.go @@ -52,9 +52,10 @@ type eiteArchiveCont struct { //文档列表查询 type fileList struct { commonus.PageSetLimt - ParentId int64 `json:"parentId"` //父级 - Title string `json:"title"` //标题 - ColumnId int64 `json:"columnId"` //栏目ID + ParentId int64 `json:"parentId"` //父级 + ParentIdStr string `json:"parentIdStr"` //父级 + Title string `json:"title"` //标题 + ColumnId int64 `json:"columnId"` //栏目ID GroupStruct } @@ -69,17 +70,19 @@ type GroupStruct struct { //文档列表返回结构 type callBackFilesList struct { commonus.SetId - Title string `json:"title"` //标题 - ColumnId int64 `json:"columnId"` //栏目ID - ColumnTitle string `json:"columnTitle"` //栏目标题 - Scope int `json:"scope"` //可见范围 - Reading int64 `json:"reading"` //阅读量 - Comment int64 `json:"comment"` //评论数 - Collect int64 `json:"collect"` //收藏数 - Likes int64 `json:"like"` //点赞数 - Tread int64 `json:"tread"` //踩 - Score int64 `json:"score"` //综合评分 - State bool `json:"state"` //状态 + Title string `json:"title"` //标题 + ParentColumnId int64 `json:"parentColumnId"` //父级栏目ID + ParentColumnTitle string `json:"parentColumnTitle"` //父级栏目标题 + ColumnId int64 `json:"columnId"` //栏目ID + ColumnTitle string `json:"columnTitle"` //栏目标题 + Scope int `json:"scope"` //可见范围 + Reading int64 `json:"reading"` //阅读量 + Comment int64 `json:"comment"` //评论数 + Collect int64 `json:"collect"` //收藏数 + Likes int64 `json:"like"` //点赞数 + Tread int64 `json:"tread"` //踩 + Score int64 `json:"score"` //综合评分 + State bool `json:"state"` //状态 } //文档属性列表 @@ -94,6 +97,7 @@ type archiveFileAttrOutPut struct { archivesmodel.BookAttribute Number string `json:"number"` Name string `json:"name"` + OutId string `json:"outID"` } //文档评论属性列表输出 diff --git a/gin_server_admin/commonus/mapOutput.go b/gin_server_admin/commonus/mapOutput.go index 818c3c9..fd91226 100644 --- a/gin_server_admin/commonus/mapOutput.go +++ b/gin_server_admin/commonus/mapOutput.go @@ -61,7 +61,7 @@ func OutPutList(total, count int64, page, pageSize int, data interface{}) (print outMap["total"] = total outMap["page"] = page outMap["pageSize"] = pageSize - outMap["data"] = data + outMap["list"] = data printMap = outMap return } diff --git a/gin_server_admin/commonus/publicstruct.go b/gin_server_admin/commonus/publicstruct.go index 9f05054..fc8b009 100644 --- a/gin_server_admin/commonus/publicstruct.go +++ b/gin_server_admin/commonus/publicstruct.go @@ -2,10 +2,12 @@ package commonus //公共变量 type SetId struct { - Id int64 `json:"id"` + Id int64 `json:"id"` + OutId string `json:"outID"` } //批量ID type BatchId struct { - Id []int64 `json:"id"` + Id []int64 `json:"id"` + OutId string `json:"outID"` }