ppt_report.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "eta_gn/eta_api/models"
  5. "eta_gn/eta_api/models/system"
  6. "eta_gn/eta_api/services"
  7. "eta_gn/eta_api/utils"
  8. "fmt"
  9. "strconv"
  10. "strings"
  11. "time"
  12. "github.com/rdlucklib/rdluck_tools/paging"
  13. )
  14. // ReportClassify
  15. // @Title 获取ppt报告分类
  16. // @Description 获取ppt报告分类
  17. // @Param Source query int false "来源:1-我的;2-协作;3-公共"
  18. // @Success 200 {object} models.PptReportClassifyItem
  19. // @router /report/classify [get]
  20. func (this *PptV2Controller) ReportClassify() {
  21. br := new(models.BaseResponse).Init()
  22. defer func() {
  23. if br.ErrMsg == "" {
  24. br.IsSendEmail = false
  25. }
  26. this.Data["json"] = br
  27. this.ServeJSON()
  28. }()
  29. sysUser := this.SysUser
  30. if sysUser == nil {
  31. br.Msg = "请登录"
  32. br.ErrMsg = "请登录,SysUser Is Empty"
  33. return
  34. }
  35. source, _ := this.GetInt("Source", 1)
  36. if source < 1 || source > 3 {
  37. source = 1
  38. }
  39. // 获取PPT, source:1-我的;2-协作;3-公共
  40. pptList := make([]*models.PptV2, 0)
  41. {
  42. cond := ``
  43. pars := make([]interface{}, 0)
  44. switch source {
  45. case 1:
  46. cond += ` AND admin_id = ?`
  47. pars = append(pars, sysUser.AdminId)
  48. case 2:
  49. cond += ` AND collaborate_type = ? AND (admin_id = ? OR FIND_IN_SET(?, collaborate_users)) `
  50. pars = append(pars, utils.ReportWriteTypeGroup, sysUser.AdminId)
  51. case 3:
  52. cond += ` AND report_source = ? AND state = ?`
  53. pars = append(pars, utils.ReportSourceOuter, models.ReportStatePass)
  54. }
  55. pptOb := new(models.PptV2)
  56. list, e := pptOb.GetItemsByCondition(cond, pars, models.PptReportQueryFields, "modify_time DESC")
  57. if e != nil {
  58. br.Msg = "获取失败"
  59. br.ErrMsg = fmt.Sprintf("获取PPT失败, %v", e)
  60. return
  61. }
  62. pptList = list
  63. }
  64. classifyPpt := make(map[int][]*models.PptReportItem)
  65. for _, v := range pptList {
  66. // 当前编辑人
  67. t := v.Format2ReportItem(v)
  68. editor, e := services.UpdatePptEditing(v.PptId, 0, sysUser.AdminId, sysUser.RealName, false)
  69. if e != nil {
  70. br.Msg = "获取失败"
  71. br.ErrMsg = fmt.Sprintf("获取PPT编辑状态失败, err: %s", e.Error())
  72. return
  73. }
  74. t.Editor = editor
  75. // 权限
  76. if source == 1 || source == 2 {
  77. t.HasAuth = true
  78. } else {
  79. if v.AdminId == sysUser.AdminId {
  80. t.HasAuth = true
  81. }
  82. if t.HasAuth == false && v.CollaborateUsers != "" {
  83. authorArr := strings.Split(v.CollaborateUsers, ",")
  84. strId := strconv.Itoa(sysUser.AdminId)
  85. if utils.InArrayByStr(authorArr, strId) {
  86. t.HasAuth = true
  87. }
  88. }
  89. }
  90. if classifyPpt[v.ClassifyId] == nil {
  91. classifyPpt[v.ClassifyId] = make([]*models.PptReportItem, 0)
  92. }
  93. classifyPpt[v.ClassifyId] = append(classifyPpt[v.ClassifyId], t)
  94. }
  95. visibleUsers, err := models.GetClassifyVisibleAll()
  96. if err != nil {
  97. br.Msg = "获取失败"
  98. br.ErrMsg = fmt.Sprintf("获取可见用户失败, err: %s", err.Error())
  99. return
  100. }
  101. visibleUsersMap := make(map[int][]int)
  102. for _, v := range visibleUsers {
  103. visibleUsersMap[v.ClassifyId] = append(visibleUsersMap[v.ClassifyId], v.AdminId)
  104. }
  105. var resp []*models.PptReportClassifyItem
  106. // 获取分类
  107. classifies := make([]*models.Classify, 0)
  108. {
  109. // 获取所有分类
  110. ob := new(models.Classify)
  111. cond := ` AND enabled = ?`
  112. pars := make([]interface{}, 0)
  113. pars = append(pars, 1, utils.ReportTypePPT)
  114. list, e := ob.GetItemsByCondition(cond, pars, []string{}, "sort ASC, create_time ASC")
  115. if e != nil {
  116. br.Msg = "获取失败"
  117. br.ErrMsg = fmt.Sprintf("获取分类失败, %v", e)
  118. return
  119. }
  120. // 上级中的分类类型可能与最下层的不一致,但是要把上级也一起取出来, 所以这里要过滤一遍
  121. classifyIds := make([]int, 0)
  122. for _, v := range list {
  123. if v.ClassifyType != utils.ReportTypePPT {
  124. continue
  125. }
  126. // 没有PPT的分类也都过滤掉
  127. //if len(classifyPpt[v.Id]) == 0 {
  128. // continue
  129. //}
  130. // 根据LevelPath去处理
  131. pathArr := strings.Split(v.LevelPath, ",")
  132. for _, p := range pathArr {
  133. id, _ := strconv.Atoi(p)
  134. if id <= 0 {
  135. continue
  136. }
  137. if utils.InArrayByInt(classifyIds, id) {
  138. continue
  139. }
  140. classifyIds = append(classifyIds, id)
  141. }
  142. }
  143. // 过滤掉不在ID中的
  144. for _, v := range list {
  145. if !utils.InArrayByInt(classifyIds, v.Id) {
  146. continue
  147. }
  148. if visible, ok := visibleUsersMap[v.Id]; ok {
  149. if !utils.InArrayByInt(visible, sysUser.AdminId) {
  150. continue
  151. }
  152. }
  153. classifies = append(classifies, v)
  154. }
  155. }
  156. resp = services.GetPptReportClassifyTreeRecursive(classifies, 0, classifyPpt)
  157. resp = services.RecursiveFilterPptNoChildTreeClassify(resp)
  158. br.Data = resp
  159. br.Ret = 200
  160. br.Success = true
  161. br.Msg = "获取成功"
  162. }
  163. // ReportList
  164. // @Title 获取ppt报告列表-分页
  165. // @Description 获取ppt报告列表-分页
  166. // @Param Source query int false "来源:1-我的;2-协作;3-公共"
  167. // @Param ClassifyId query int false "分类ID"
  168. // @Param Keyword query string false "搜索关键词"
  169. // @Success 200 {object} models.PptPageReportResp
  170. // @router /report/list [get]
  171. func (this *PptV2Controller) ReportList() {
  172. br := new(models.BaseResponse).Init()
  173. defer func() {
  174. if br.ErrMsg == "" {
  175. br.IsSendEmail = false
  176. }
  177. this.Data["json"] = br
  178. this.ServeJSON()
  179. }()
  180. sysUser := this.SysUser
  181. if sysUser == nil {
  182. br.Msg = "请登录"
  183. br.ErrMsg = "请登录,SysUser Is Empty"
  184. return
  185. }
  186. pageSize, _ := this.GetInt("PageSize")
  187. currentIndex, _ := this.GetInt("CurrentIndex")
  188. source, _ := this.GetInt("Source", 1)
  189. if source < 1 || source > 3 {
  190. source = 1
  191. }
  192. classifyId, _ := this.GetInt("ClassifyId", 0)
  193. keyword := this.GetString("Keyword")
  194. var startSize int
  195. if pageSize <= 0 {
  196. pageSize = utils.PageSize20
  197. }
  198. if currentIndex <= 0 {
  199. currentIndex = 1
  200. }
  201. startSize = utils.StartIndex(currentIndex, pageSize)
  202. resp := new(models.PptPageReportResp)
  203. resp.List = make([]*models.PptReportItem, 0)
  204. // 获取PPT, source:1-我的;2-协作;3-公共
  205. pptList := make([]*models.PptV2, 0)
  206. cond := ``
  207. pars := make([]interface{}, 0)
  208. {
  209. switch source {
  210. case 1:
  211. cond += ` AND admin_id = ?`
  212. pars = append(pars, sysUser.AdminId)
  213. case 2:
  214. cond += ` AND collaborate_type = ? AND (admin_id = ? OR FIND_IN_SET(?, collaborate_users)) `
  215. pars = append(pars, utils.ReportWriteTypeGroup, sysUser.AdminId, sysUser.AdminId)
  216. case 3:
  217. cond += ` AND report_source = ? AND state = ?`
  218. pars = append(pars, utils.ReportSourceOuter, models.ReportStatePass)
  219. }
  220. if classifyId > 0 {
  221. // 查询分类及子集
  222. classifyOb := new(models.Classify)
  223. childCond := ` AND FIND_IN_SET(?, level_path)`
  224. childPars := make([]interface{}, 0)
  225. childPars = append(childPars, classifyId)
  226. children, e := classifyOb.GetItemsByCondition(childCond, childPars, []string{"id"}, "")
  227. if e != nil {
  228. br.Msg = "获取失败"
  229. br.ErrMsg = fmt.Sprintf("获取分类及子分类失败, %v", e)
  230. return
  231. }
  232. var childIds []int
  233. for _, v := range children {
  234. childIds = append(childIds, v.Id)
  235. }
  236. if len(childIds) == 0 {
  237. page := paging.GetPaging(currentIndex, pageSize, 0)
  238. resp.Paging = page
  239. br.Data = resp
  240. br.Ret = 200
  241. br.Success = true
  242. br.Msg = "获取成功"
  243. return
  244. }
  245. cond += ` AND classify_id IN (?)`
  246. pars = append(pars, childIds)
  247. }
  248. keyword = strings.TrimSpace(keyword)
  249. if keyword != "" {
  250. cond += ` AND title LIKE ?`
  251. pars = append(pars, fmt.Sprint("%", keyword, "%"))
  252. }
  253. }
  254. noVisibleClassifyIds, err := models.GetNoVisibleClassifyIdByAdminId(this.SysUser.AdminId)
  255. if err != nil {
  256. br.Msg = "获取失败"
  257. br.ErrMsg = "获取不可见分类id失败,Err:" + err.Error()
  258. return
  259. }
  260. if len(noVisibleClassifyIds) > 0 {
  261. cond += ` AND classify_id NOT IN (?) `
  262. pars = append(pars, noVisibleClassifyIds)
  263. }
  264. pptOb := new(models.PptV2)
  265. total, e := pptOb.GetCountByCondition(cond, pars)
  266. if e != nil {
  267. br.Msg = "获取失败"
  268. br.ErrMsg = fmt.Sprintf("获取PPT总数失败, %v", e)
  269. return
  270. }
  271. list, e := pptOb.GetPageItemsByCondition(cond, pars, models.PptReportQueryFields, "modify_time DESC", startSize, pageSize)
  272. if e != nil {
  273. br.Msg = "获取失败"
  274. br.ErrMsg = fmt.Sprintf("获取PPT失败, %v", e)
  275. return
  276. }
  277. pptList = list
  278. for _, v := range pptList {
  279. // 当前编辑人
  280. t := v.Format2ReportItem(v)
  281. editor, e := services.UpdatePptEditing(v.PptId, 0, sysUser.AdminId, sysUser.RealName, false)
  282. if e != nil {
  283. br.Msg = "获取失败"
  284. br.ErrMsg = fmt.Sprintf("获取PPT编辑状态失败, err: %s", e.Error())
  285. return
  286. }
  287. t.Editor = editor
  288. // 权限
  289. if source == 1 || source == 2 {
  290. t.HasAuth = true
  291. } else {
  292. if v.AdminId == sysUser.AdminId {
  293. t.HasAuth = true
  294. }
  295. if t.HasAuth == false && v.CollaborateUsers != "" {
  296. authorArr := strings.Split(v.CollaborateUsers, ",")
  297. strId := strconv.Itoa(sysUser.AdminId)
  298. if utils.InArrayByStr(authorArr, strId) {
  299. t.HasAuth = true
  300. }
  301. }
  302. }
  303. resp.List = append(resp.List, t)
  304. }
  305. page := paging.GetPaging(currentIndex, pageSize, total)
  306. resp.Paging = page
  307. br.Data = resp
  308. br.Ret = 200
  309. br.Success = true
  310. br.Msg = "获取成功"
  311. }
  312. // CreateReport
  313. // @Title 新增ppt报告
  314. // @Description 新增ppt报告
  315. // @Param request body models.PptReportCreateReq true "type json string"
  316. // @Success 200 Ret=200 新增成功
  317. // @router /report/add [post]
  318. func (this *PptV2Controller) CreateReport() {
  319. br := new(models.BaseResponse).Init()
  320. defer func() {
  321. if br.ErrMsg == "" {
  322. br.IsSendEmail = false
  323. }
  324. this.Data["json"] = br
  325. this.ServeJSON()
  326. }()
  327. sysUser := this.SysUser
  328. if sysUser == nil {
  329. br.Msg = "请登录"
  330. br.ErrMsg = "请登录,SysUser Is Empty"
  331. return
  332. }
  333. var req models.PptReportCreateReq
  334. if e := json.Unmarshal(this.Ctx.Input.RequestBody, &req); e != nil {
  335. br.Msg = "参数解析异常"
  336. br.ErrMsg = fmt.Sprintf("参数解析失败, %v", e)
  337. return
  338. }
  339. req.Title = strings.TrimSpace(req.Title)
  340. if req.Title == "" {
  341. br.Msg = "请输入标题"
  342. return
  343. }
  344. if req.AddType != 1 && req.AddType != 2 {
  345. req.AddType = 1
  346. }
  347. if req.ClassifyId <= 0 {
  348. br.Msg = "请选择分类"
  349. return
  350. }
  351. if req.CollaborateType != 1 && req.CollaborateType != 2 {
  352. br.Msg = "协作方式异常"
  353. br.ErrMsg = fmt.Sprintf("协作方式异常, %d", req.CollaborateType)
  354. return
  355. }
  356. if req.CollaborateType == 2 && len(req.CollaborateUserIds) == 0 {
  357. br.Msg = "请选择协作人"
  358. return
  359. }
  360. // 新报告
  361. newItem := new(models.PptV2)
  362. newItem.Title = req.Title
  363. newItem.AddType = req.AddType
  364. newItem.ClassifyId = req.ClassifyId
  365. newItem.CollaborateType = req.CollaborateType
  366. if len(req.CollaborateUserIds) > 0 {
  367. var partnerArr []string
  368. for _, v := range req.CollaborateUserIds {
  369. partnerArr = append(partnerArr, strconv.Itoa(v))
  370. }
  371. newItem.CollaborateUsers = strings.Trim(strings.Join(partnerArr, ","), `"`)
  372. }
  373. newItem.PptVersion = 2
  374. newItem.AdminId = sysUser.AdminId
  375. newItem.AdminRealName = sysUser.RealName
  376. newItem.ReportSource = utils.ReportSourceLocal // 固定本地PPT
  377. newItem.State = models.ReportStateUnpublished // 默认未发布
  378. newItem.CreateTime = time.Now()
  379. newItem.ModifyTime = time.Now()
  380. // 继承PPT内容
  381. if req.AddType == utils.ReportAddTypeInherit && req.InheritPptId > 0 {
  382. inheritPpt, e := models.GetPptV2ById(req.InheritPptId)
  383. if e != nil {
  384. if utils.IsErrNoRow(e) {
  385. br.Msg = "被继承报告不存在"
  386. return
  387. }
  388. br.Msg = "操作失败"
  389. br.ErrMsg = fmt.Sprintf("操作失败, %v", e)
  390. return
  391. }
  392. newItem.TemplateType = inheritPpt.TemplateType
  393. newItem.BackgroundImg = inheritPpt.BackgroundImg
  394. newItem.ReportType = inheritPpt.ReportType
  395. newItem.PptDate = inheritPpt.PptDate
  396. newItem.Content = inheritPpt.Content
  397. newItem.CoverContent = inheritPpt.CoverContent
  398. newItem.TitleSetting = inheritPpt.TitleSetting
  399. }
  400. // 非继承PPT,有内容时写入内容(如合并PPT时)
  401. if req.InheritPptId <= 0 {
  402. newItem.TemplateType = req.FirstPage.TemplateType
  403. newItem.BackgroundImg = req.FirstPage.ImgUrl
  404. newItem.ReportType = req.FirstPage.ReportType
  405. newItem.PptDate = req.FirstPage.PptDate
  406. newItem.Content = req.Content
  407. newItem.CoverContent = req.CoverContent
  408. newItem.TitleSetting = req.TitleSetting
  409. }
  410. // 初始的PPT页数
  411. if newItem.Content != "" {
  412. var pageContents []services.PPTContent
  413. _ = json.Unmarshal([]byte(newItem.Content), &pageContents) // 这里转不过去问题也不大,编辑时自动保存会更新页数字段
  414. newItem.PptPage = len(pageContents)
  415. }
  416. newId, e := models.AddPptV2(newItem)
  417. if e != nil {
  418. br.Msg = "操作失败"
  419. br.ErrMsg = fmt.Sprintf("新增PPT报告失败, %v", e)
  420. return
  421. }
  422. // 更新报告分类计数
  423. go func() {
  424. _ = services.UpdateClassifyReportNum(req.ClassifyId)
  425. }()
  426. resp := models.AddPptResp{
  427. PptId: newId,
  428. }
  429. br.Data = resp
  430. br.Ret = 200
  431. br.Success = true
  432. br.Msg = "操作成功"
  433. }
  434. // AuthList
  435. // @Title 获取有权限的列表
  436. // @Description 获取有权限的列表
  437. // @Param PageSize query int true "每页数据条数"
  438. // @Param CurrentIndex query int true "当前页页码,从1开始"
  439. // @Param Keyword query string false "搜索关键词"
  440. // @Param ClassifyId query int false "分类ID"
  441. // @Success 200 {object} models.PptPageReportResp
  442. // @router /report/auth_list [get]
  443. func (this *PptV2Controller) AuthList() {
  444. br := new(models.BaseResponse).Init()
  445. defer func() {
  446. if br.ErrMsg == "" {
  447. br.IsSendEmail = false
  448. }
  449. this.Data["json"] = br
  450. this.ServeJSON()
  451. }()
  452. sysUser := this.SysUser
  453. if sysUser == nil {
  454. br.Msg = "请登录"
  455. br.ErrMsg = "请登录,SysUser Is Empty"
  456. br.Ret = 408
  457. return
  458. }
  459. pageSize, _ := this.GetInt("PageSize")
  460. currentIndex, _ := this.GetInt("CurrentIndex")
  461. keyword := this.GetString("Keyword")
  462. classifyId, _ := this.GetInt("ClassifyId", 0)
  463. var startSize int
  464. if pageSize <= 0 {
  465. pageSize = utils.PageSize20
  466. }
  467. if currentIndex <= 0 {
  468. currentIndex = 1
  469. }
  470. startSize = utils.StartIndex(currentIndex, pageSize)
  471. var pptList []*models.PptReportItem
  472. // 无相关搜索时,返回空集(其实我感觉没必要,没关键词查全部也属于正常=_=!)
  473. if keyword == `` && classifyId <= 0 {
  474. page := paging.GetPaging(currentIndex, pageSize, 0)
  475. resp := new(models.PptPageReportResp)
  476. resp.Paging = page
  477. resp.List = pptList
  478. br.Ret = 200
  479. br.Success = true
  480. br.Msg = "获取成功"
  481. br.Data = resp
  482. return
  483. }
  484. // 查询自己创建的以及协作人包含自己的报告、以及外部已审批报告
  485. var cond string
  486. var pars []interface{}
  487. cond += ` AND (admin_id = ? OR (admin_id <> ? AND FIND_IN_SET(?, collaborate_users)) OR (report_source = ? AND state = ?))`
  488. pars = append(pars, sysUser.AdminId, sysUser.AdminId, sysUser.AdminId, utils.ReportSourceOuter, models.ReportStatePass)
  489. if classifyId > 0 {
  490. cond += ` AND classify_id = ? `
  491. pars = append(pars, classifyId)
  492. }
  493. keyword = strings.TrimSpace(keyword)
  494. if keyword != `` {
  495. cond += ` AND title LIKE ? `
  496. pars = utils.GetLikeKeywordPars(pars, keyword, 1)
  497. }
  498. noVisisbleClassifyIds, err := models.GetNoVisibleClassifyIdByAdminId(sysUser.AdminId)
  499. if err != nil {
  500. br.Msg = "获取失败"
  501. br.ErrMsg = fmt.Sprintf("获取不可见分类失败, %v", err)
  502. return
  503. }
  504. if len(noVisisbleClassifyIds) > 0 {
  505. cond += ` AND classify_id NOT IN (?)`
  506. pars = append(pars, noVisisbleClassifyIds)
  507. }
  508. pptOb := new(models.PptV2)
  509. total, e := pptOb.GetCountByCondition(cond, pars)
  510. if e != nil {
  511. br.Msg = "获取失败"
  512. br.ErrMsg = fmt.Sprintf("获取PPT总数失败, %v", e)
  513. return
  514. }
  515. list, e := pptOb.GetPageItemsByCondition(cond, pars, models.PptReportQueryFields, "", startSize, pageSize)
  516. if e != nil {
  517. br.Msg = "获取失败"
  518. br.ErrMsg = fmt.Sprintf("获取PPT失败, %v", e)
  519. return
  520. }
  521. // 分类完整路径、协作人姓名
  522. classifyIdFull := make(map[int]string)
  523. {
  524. ob := new(models.Classify)
  525. classifies, e := ob.GetItemsByCondition("", make([]interface{}, 0), []string{}, "")
  526. if e != nil {
  527. br.Msg = "获取失败"
  528. br.ErrMsg = fmt.Sprintf("获取分类失败, %v", e)
  529. return
  530. }
  531. classifyIdName := make(map[string]string)
  532. for _, v := range classifies {
  533. classifyIdName[strconv.Itoa(v.Id)] = v.ClassifyName
  534. }
  535. for _, v := range classifies {
  536. arr := strings.Split(v.LevelPath, ",")
  537. if len(arr) == 0 {
  538. continue
  539. }
  540. var nameArr []string
  541. for _, a := range arr {
  542. n := classifyIdName[a]
  543. if n == "" {
  544. continue
  545. }
  546. nameArr = append(nameArr, n)
  547. }
  548. classifyIdFull[v.Id] = strings.Join(nameArr, "/")
  549. }
  550. }
  551. adminIdName := make(map[int]string)
  552. {
  553. cond := ` AND enabled = 1`
  554. pars := make([]interface{}, 0)
  555. sysAdmin, e := system.GetSysAdminList(cond, pars, []string{}, "")
  556. if e != nil {
  557. br.Msg = "获取失败"
  558. br.ErrMsg = "获取用户失败,Err:" + e.Error()
  559. return
  560. }
  561. for _, v := range sysAdmin {
  562. adminIdName[v.AdminId] = v.RealName
  563. }
  564. }
  565. // 格式化数据
  566. for _, v := range list {
  567. t := v.Format2ReportItem(v)
  568. t.HasAuth = true // 该列表固定有权限
  569. t.FullClassify = classifyIdFull[v.ClassifyId] // 分类的完整路径
  570. // 协作人
  571. if v.CollaborateUsers != "" {
  572. var authors []models.PptReportCollaborateUser
  573. authorArr := strings.Split(v.CollaborateUsers, ",")
  574. for _, au := range authorArr {
  575. uid, _ := strconv.Atoi(au)
  576. if uid <= 0 {
  577. continue
  578. }
  579. name := adminIdName[uid]
  580. if name == "" {
  581. continue
  582. }
  583. authors = append(authors, models.PptReportCollaborateUser{
  584. AdminId: uid,
  585. RealName: name,
  586. })
  587. }
  588. t.CollaborateUsers = authors
  589. }
  590. pptList = append(pptList, t)
  591. }
  592. page := paging.GetPaging(currentIndex, pageSize, total)
  593. resp := new(models.PptPageReportResp)
  594. resp.Paging = page
  595. resp.List = pptList
  596. br.Ret = 200
  597. br.Success = true
  598. br.Msg = "获取成功"
  599. br.Data = resp
  600. }