manager.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733
  1. package controllers
  2. import (
  3. "encoding/json"
  4. "html/template"
  5. "regexp"
  6. "strings"
  7. "github.com/astaxie/beego"
  8. "github.com/astaxie/beego/logs"
  9. "github.com/astaxie/beego/orm"
  10. "github.com/lifei6671/mindoc/conf"
  11. "github.com/lifei6671/mindoc/models"
  12. "github.com/lifei6671/mindoc/utils"
  13. "path/filepath"
  14. "strconv"
  15. "github.com/lifei6671/mindoc/utils/pagination"
  16. "math"
  17. "gopkg.in/russross/blackfriday.v2"
  18. )
  19. type ManagerController struct {
  20. BaseController
  21. }
  22. func (c *ManagerController) Prepare() {
  23. c.BaseController.Prepare()
  24. if !c.Member.IsAdministrator() {
  25. c.Abort("403")
  26. }
  27. }
  28. func (c *ManagerController) Index() {
  29. c.TplName = "manager/index.tpl"
  30. c.Data["Model"] = models.NewDashboard().Query()
  31. }
  32. // 用户列表.
  33. func (c *ManagerController) Users() {
  34. c.Prepare()
  35. c.TplName = "manager/users.tpl"
  36. pageIndex, _ := c.GetInt("page", 0)
  37. members, totalCount, err := models.NewMember().FindToPager(pageIndex, conf.PageSize)
  38. if err != nil {
  39. c.Data["ErrorMessage"] = err.Error()
  40. return
  41. }
  42. if totalCount > 0 {
  43. pager := pagination.NewPagination(c.Ctx.Request,totalCount,conf.PageSize,c.BaseUrl())
  44. c.Data["PageHtml"] = pager.HtmlPages()
  45. } else {
  46. c.Data["PageHtml"] = ""
  47. }
  48. b, err := json.Marshal(members)
  49. if err != nil {
  50. c.Data["Result"] = template.JS("[]")
  51. } else {
  52. c.Data["Result"] = template.JS(string(b))
  53. }
  54. }
  55. // 添加用户.
  56. func (c *ManagerController) CreateMember() {
  57. c.Prepare()
  58. account := strings.TrimSpace(c.GetString("account"))
  59. password1 := strings.TrimSpace(c.GetString("password1"))
  60. password2 := strings.TrimSpace(c.GetString("password2"))
  61. email := strings.TrimSpace(c.GetString("email"))
  62. phone := strings.TrimSpace(c.GetString("phone"))
  63. role, _ := c.GetInt("role", 1)
  64. status, _ := c.GetInt("status", 0)
  65. if ok, err := regexp.MatchString(conf.RegexpAccount, account); account == "" || !ok || err != nil {
  66. c.JsonResult(6001, "账号只能由英文字母数字组成,且在3-50个字符")
  67. }
  68. if l := strings.Count(password1, ""); password1 == "" || l > 50 || l < 6 {
  69. c.JsonResult(6002, "密码必须在6-50个字符之间")
  70. }
  71. if password1 != password2 {
  72. c.JsonResult(6003, "确认密码不正确")
  73. }
  74. if ok, err := regexp.MatchString(conf.RegexpEmail, email); !ok || err != nil || email == "" {
  75. c.JsonResult(6004, "邮箱格式不正确")
  76. }
  77. if role != 0 && role != 1 && role != 2 {
  78. role = 1
  79. }
  80. if status != 0 && status != 1 {
  81. status = 0
  82. }
  83. member := models.NewMember()
  84. if _, err := member.FindByAccount(account); err == nil && member.MemberId > 0 {
  85. c.JsonResult(6005, "账号已存在")
  86. }
  87. member.Account = account
  88. member.Password = password1
  89. member.Role = role
  90. member.Avatar = conf.GetDefaultAvatar()
  91. member.CreateAt = c.Member.MemberId
  92. member.Email = email
  93. member.RealName = strings.TrimSpace(c.GetString("real_name",""))
  94. if phone != "" {
  95. member.Phone = phone
  96. }
  97. if err := member.Add(); err != nil {
  98. c.JsonResult(6006, err.Error())
  99. }
  100. c.JsonResult(0, "ok", member)
  101. }
  102. //更新用户状态.
  103. func (c *ManagerController) UpdateMemberStatus() {
  104. c.Prepare()
  105. member_id, _ := c.GetInt("member_id", 0)
  106. status, _ := c.GetInt("status", 0)
  107. if member_id <= 0 {
  108. c.JsonResult(6001, "参数错误")
  109. }
  110. if status != 0 && status != 1 {
  111. status = 0
  112. }
  113. member := models.NewMember()
  114. if _, err := member.Find(member_id); err != nil {
  115. c.JsonResult(6002, "用户不存在")
  116. }
  117. if member.MemberId == c.Member.MemberId {
  118. c.JsonResult(6004, "不能变更自己的状态")
  119. }
  120. if member.Role == conf.MemberSuperRole {
  121. c.JsonResult(6005, "不能变更超级管理员的状态")
  122. }
  123. member.Status = status
  124. if err := member.Update(); err != nil {
  125. logs.Error("", err)
  126. c.JsonResult(6003, "用户状态设置失败")
  127. }
  128. c.JsonResult(0, "ok", member)
  129. }
  130. //变更用户权限.
  131. func (c *ManagerController) ChangeMemberRole() {
  132. c.Prepare()
  133. member_id, _ := c.GetInt("member_id", 0)
  134. role, _ := c.GetInt("role", 0)
  135. if member_id <= 0 {
  136. c.JsonResult(6001, "参数错误")
  137. }
  138. if role != conf.MemberAdminRole && role != conf.MemberGeneralRole {
  139. c.JsonResult(6001, "用户权限不正确")
  140. }
  141. member := models.NewMember()
  142. if _, err := member.Find(member_id); err != nil {
  143. c.JsonResult(6002, "用户不存在")
  144. }
  145. if member.MemberId == c.Member.MemberId {
  146. c.JsonResult(6004, "不能变更自己的权限")
  147. }
  148. if member.Role == conf.MemberSuperRole {
  149. c.JsonResult(6005, "不能变更超级管理员的权限")
  150. }
  151. member.Role = role
  152. if err := member.Update(); err != nil {
  153. c.JsonResult(6003, "用户权限设置失败")
  154. }
  155. member.ResolveRoleName()
  156. c.JsonResult(0, "ok", member)
  157. }
  158. //编辑用户信息.
  159. func (c *ManagerController) EditMember() {
  160. c.Prepare()
  161. c.TplName = "manager/edit_users.tpl"
  162. member_id, _ := c.GetInt(":id", 0)
  163. if member_id <= 0 {
  164. c.Abort("404")
  165. }
  166. member, err := models.NewMember().Find(member_id)
  167. if err != nil {
  168. beego.Error(err)
  169. c.Abort("404")
  170. }
  171. if c.Ctx.Input.IsPost() {
  172. password1 := c.GetString("password1")
  173. password2 := c.GetString("password2")
  174. email := c.GetString("email")
  175. phone := c.GetString("phone")
  176. description := c.GetString("description")
  177. member.Email = email
  178. member.Phone = phone
  179. member.Description = description
  180. member.RealName = c.GetString("real_name")
  181. if password1 != "" && password2 != password1 {
  182. c.JsonResult(6001, "确认密码不正确")
  183. }
  184. if password1 != "" && member.AuthMethod != conf.AuthMethodLDAP {
  185. member.Password = password1
  186. }
  187. if err := member.Valid(password1 == ""); err != nil {
  188. c.JsonResult(6002, err.Error())
  189. }
  190. if password1 != "" {
  191. password, err := utils.PasswordHash(password1)
  192. if err != nil {
  193. beego.Error(err)
  194. c.JsonResult(6003, "对用户密码加密时出错")
  195. }
  196. member.Password = password
  197. }
  198. if err := member.Update(); err != nil {
  199. c.JsonResult(6004, err.Error())
  200. }
  201. c.JsonResult(0, "ok")
  202. }
  203. c.Data["Model"] = member
  204. }
  205. //删除一个用户,并将该用户的所有信息转移到超级管理员上.
  206. func (c *ManagerController) DeleteMember() {
  207. c.Prepare()
  208. member_id, _ := c.GetInt("id", 0)
  209. if member_id <= 0 {
  210. c.JsonResult(404, "参数错误")
  211. }
  212. member, err := models.NewMember().Find(member_id)
  213. if err != nil {
  214. beego.Error(err)
  215. c.JsonResult(500, "用户不存在")
  216. }
  217. if member.Role == conf.MemberSuperRole {
  218. c.JsonResult(500, "不能删除超级管理员")
  219. }
  220. superMember, err := models.NewMember().FindByFieldFirst("role", 0)
  221. if err != nil {
  222. beego.Error(err)
  223. c.JsonResult(5001, "未能找到超级管理员")
  224. }
  225. err = models.NewMember().Delete(member_id, superMember.MemberId)
  226. if err != nil {
  227. beego.Error(err)
  228. c.JsonResult(5002, "删除失败")
  229. }
  230. c.JsonResult(0, "ok")
  231. }
  232. //项目列表.
  233. func (c *ManagerController) Books() {
  234. c.Prepare()
  235. c.TplName = "manager/books.tpl"
  236. pageIndex, _ := c.GetInt("page", 1)
  237. books, totalCount, err := models.NewBookResult().FindToPager(pageIndex, conf.PageSize)
  238. if err != nil {
  239. c.Abort("500")
  240. }
  241. if totalCount > 0 {
  242. //html := utils.GetPagerHtml(c.Ctx.Request.RequestURI, pageIndex, 8, totalCount)
  243. pager := pagination.NewPagination(c.Ctx.Request,totalCount,conf.PageSize, c.BaseUrl())
  244. c.Data["PageHtml"] = pager.HtmlPages()
  245. } else {
  246. c.Data["PageHtml"] = ""
  247. }
  248. for i,book := range books {
  249. books[i].Description = utils.StripTags(string(blackfriday.Run([]byte(book.Description))))
  250. books[i].ModifyTime = book.ModifyTime.Local()
  251. books[i].CreateTime = book.CreateTime.Local()
  252. }
  253. c.Data["Lists"] = books
  254. }
  255. //编辑项目.
  256. func (c *ManagerController) EditBook() {
  257. c.Prepare()
  258. c.TplName = "manager/edit_book.tpl"
  259. identify := c.GetString(":key")
  260. if identify == "" {
  261. c.Abort("404")
  262. }
  263. book, err := models.NewBook().FindByFieldFirst("identify", identify)
  264. if err != nil {
  265. c.Abort("500")
  266. }
  267. if c.Ctx.Input.IsPost() {
  268. bookName := strings.TrimSpace(c.GetString("book_name"))
  269. description := strings.TrimSpace(c.GetString("description", ""))
  270. commentStatus := c.GetString("comment_status")
  271. tag := strings.TrimSpace(c.GetString("label"))
  272. orderIndex, _ := c.GetInt("order_index", 0)
  273. isDownload := strings.TrimSpace(c.GetString("is_download")) == "on"
  274. enableShare := strings.TrimSpace(c.GetString("enable_share")) == "on"
  275. isUseFirstDocument := strings.TrimSpace(c.GetString("is_use_first_document")) == "on"
  276. autoRelease := strings.TrimSpace(c.GetString("auto_release")) == "on"
  277. publisher := strings.TrimSpace(c.GetString("publisher"))
  278. historyCount,_ := c.GetInt("history_count",0)
  279. if strings.Count(description, "") > 500 {
  280. c.JsonResult(6004, "项目描述不能大于500字")
  281. }
  282. if commentStatus != "open" && commentStatus != "closed" && commentStatus != "group_only" && commentStatus != "registered_only" {
  283. commentStatus = "closed"
  284. }
  285. if tag != "" {
  286. tags := strings.Split(tag, ";")
  287. if len(tags) > 10 {
  288. c.JsonResult(6005, "最多允许添加10个标签")
  289. }
  290. }
  291. book.Publisher = publisher
  292. book.HistoryCount = historyCount
  293. book.BookName = bookName
  294. book.Description = description
  295. book.CommentStatus = commentStatus
  296. book.Label = tag
  297. book.OrderIndex = orderIndex
  298. if autoRelease {
  299. book.AutoRelease = 1
  300. } else {
  301. book.AutoRelease = 0
  302. }
  303. if isDownload {
  304. book.IsDownload = 0
  305. }else{
  306. book.IsDownload = 1
  307. }
  308. if enableShare {
  309. book.IsEnableShare = 0
  310. }else{
  311. book.IsEnableShare = 1
  312. }
  313. if isUseFirstDocument {
  314. book.IsUseFirstDocument = 1
  315. }else{
  316. book.IsUseFirstDocument = 0
  317. }
  318. if err := book.Update(); err != nil {
  319. c.JsonResult(6006, "保存失败")
  320. }
  321. c.JsonResult(0, "ok")
  322. }
  323. if book.PrivateToken != "" {
  324. book.PrivateToken = conf.URLFor("DocumentController.Index", ":key", book.Identify, "token", book.PrivateToken)
  325. }
  326. bookResult := models.NewBookResult()
  327. bookResult.ToBookResult(*book)
  328. c.Data["Model"] = bookResult
  329. }
  330. // 删除项目.
  331. func (c *ManagerController) DeleteBook() {
  332. c.Prepare()
  333. bookId, _ := c.GetInt("book_id", 0)
  334. if bookId <= 0 {
  335. c.JsonResult(6001, "参数错误")
  336. }
  337. book := models.NewBook()
  338. err := book.ThoroughDeleteBook(bookId)
  339. if err == orm.ErrNoRows {
  340. c.JsonResult(6002, "项目不存在")
  341. }
  342. if err != nil {
  343. logs.Error("DeleteBook => ", err)
  344. c.JsonResult(6003, "删除失败")
  345. }
  346. c.JsonResult(0, "ok")
  347. }
  348. // CreateToken 创建访问来令牌.
  349. func (c *ManagerController) CreateToken() {
  350. c.Prepare()
  351. action := c.GetString("action")
  352. identify := c.GetString("identify")
  353. book, err := models.NewBook().FindByFieldFirst("identify", identify)
  354. if err != nil {
  355. c.JsonResult(6001, "项目不存在")
  356. }
  357. if action == "create" {
  358. if book.PrivatelyOwned == 0 {
  359. c.JsonResult(6001, "公开项目不能创建阅读令牌")
  360. }
  361. book.PrivateToken = string(utils.Krand(conf.GetTokenSize(), utils.KC_RAND_KIND_ALL))
  362. if err := book.Update(); err != nil {
  363. logs.Error("生成阅读令牌失败 => ", err)
  364. c.JsonResult(6003, "生成阅读令牌失败")
  365. }
  366. c.JsonResult(0, "ok", conf.URLFor("DocumentController.Index", ":key", book.Identify, "token", book.PrivateToken))
  367. } else {
  368. book.PrivateToken = ""
  369. if err := book.Update(); err != nil {
  370. logs.Error("CreateToken => ", err)
  371. c.JsonResult(6004, "删除令牌失败")
  372. }
  373. c.JsonResult(0, "ok", "")
  374. }
  375. }
  376. //项目设置.
  377. func (c *ManagerController) Setting() {
  378. c.Prepare()
  379. c.TplName = "manager/setting.tpl"
  380. options, err := models.NewOption().All()
  381. if c.Ctx.Input.IsPost() {
  382. for _, item := range options {
  383. item.OptionValue = c.GetString(item.OptionName)
  384. item.InsertOrUpdate()
  385. }
  386. c.JsonResult(0, "ok")
  387. }
  388. if err != nil {
  389. c.Abort("500")
  390. }
  391. c.Data["SITE_TITLE"] = c.Option["SITE_NAME"]
  392. for _, item := range options {
  393. c.Data[item.OptionName] = item.OptionValue
  394. }
  395. }
  396. // Transfer 转让项目.
  397. func (c *ManagerController) Transfer() {
  398. c.Prepare()
  399. account := c.GetString("account")
  400. if account == "" {
  401. c.JsonResult(6004, "接受者账号不能为空")
  402. }
  403. member, err := models.NewMember().FindByAccount(account)
  404. if err != nil {
  405. logs.Error("FindByAccount => ", err)
  406. c.JsonResult(6005, "接受用户不存在")
  407. }
  408. if member.Status != 0 {
  409. c.JsonResult(6006, "接受用户已被禁用")
  410. }
  411. if !c.Member.IsAdministrator() {
  412. c.Abort("403")
  413. }
  414. identify := c.GetString("identify")
  415. book, err := models.NewBook().FindByFieldFirst("identify", identify)
  416. if err != nil {
  417. c.JsonResult(6001, err.Error())
  418. }
  419. rel, err := models.NewRelationship().FindFounder(book.BookId)
  420. if err != nil {
  421. beego.Error("FindFounder => ", err)
  422. c.JsonResult(6009, "查询项目创始人失败")
  423. }
  424. if member.MemberId == rel.MemberId {
  425. c.JsonResult(6007, "不能转让给自己")
  426. }
  427. err = models.NewRelationship().Transfer(book.BookId, rel.MemberId, member.MemberId)
  428. if err != nil {
  429. logs.Error("Transfer => ", err)
  430. c.JsonResult(6008, err.Error())
  431. }
  432. c.JsonResult(0, "ok")
  433. }
  434. func (c *ManagerController) Comments() {
  435. c.Prepare()
  436. c.TplName = "manager/comments.tpl"
  437. if !c.Member.IsAdministrator() {
  438. c.Abort("403")
  439. }
  440. }
  441. //DeleteComment 标记评论为已删除
  442. func (c *ManagerController) DeleteComment() {
  443. c.Prepare()
  444. comment_id, _ := c.GetInt("comment_id", 0)
  445. if comment_id <= 0 {
  446. c.JsonResult(6001, "参数错误")
  447. }
  448. comment := models.NewComment()
  449. if _, err := comment.Find(comment_id); err != nil {
  450. c.JsonResult(6002, "评论不存在")
  451. }
  452. comment.Approved = 3
  453. if err := comment.Update("approved"); err != nil {
  454. c.JsonResult(6003, "删除评论失败")
  455. }
  456. c.JsonResult(0, "ok", comment)
  457. }
  458. //设置项目私有状态.
  459. func (c *ManagerController) PrivatelyOwned() {
  460. c.Prepare()
  461. status := c.GetString("status")
  462. identify := c.GetString("identify")
  463. if status != "open" && status != "close" {
  464. c.JsonResult(6003, "参数错误")
  465. }
  466. state := 0
  467. if status == "open" {
  468. state = 0
  469. } else {
  470. state = 1
  471. }
  472. if !c.Member.IsAdministrator() {
  473. c.Abort("403")
  474. }
  475. book, err := models.NewBook().FindByFieldFirst("identify", identify)
  476. if err != nil {
  477. c.JsonResult(6001, err.Error())
  478. }
  479. book.PrivatelyOwned = state
  480. logs.Info("", state, status)
  481. err = book.Update()
  482. if err != nil {
  483. logs.Error("PrivatelyOwned => ", err)
  484. c.JsonResult(6004, "保存失败")
  485. }
  486. c.JsonResult(0, "ok")
  487. }
  488. //附件列表.
  489. func (c *ManagerController) AttachList() {
  490. c.Prepare()
  491. c.TplName = "manager/attach_list.tpl"
  492. pageIndex, _ := c.GetInt("page", 1)
  493. attachList, totalCount, err := models.NewAttachment().FindToPager(pageIndex, conf.PageSize)
  494. if err != nil {
  495. c.Abort("500")
  496. }
  497. if totalCount > 0 {
  498. pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl())
  499. c.Data["PageHtml"] = pager.HtmlPages()
  500. } else {
  501. c.Data["PageHtml"] = ""
  502. }
  503. for _, item := range attachList {
  504. p := filepath.Join(conf.WorkingDirectory, item.FilePath)
  505. item.IsExist = utils.FileExists(p)
  506. }
  507. c.Data["Lists"] = attachList
  508. }
  509. //附件详情.
  510. func (c *ManagerController) AttachDetailed() {
  511. c.Prepare()
  512. c.TplName = "manager/attach_detailed.tpl"
  513. attach_id, _ := strconv.Atoi(c.Ctx.Input.Param(":id"))
  514. if attach_id <= 0 {
  515. c.Abort("404")
  516. }
  517. attach, err := models.NewAttachmentResult().Find(attach_id)
  518. if err != nil {
  519. beego.Error("AttachDetailed => ", err)
  520. if err == orm.ErrNoRows {
  521. c.Abort("404")
  522. } else {
  523. c.Abort("500")
  524. }
  525. }
  526. attach.FilePath = filepath.Join(conf.WorkingDirectory, attach.FilePath)
  527. attach.HttpPath = conf.URLForWithCdnImage(attach.HttpPath)
  528. attach.IsExist = utils.FileExists(attach.FilePath)
  529. c.Data["Model"] = attach
  530. }
  531. //删除附件.
  532. func (c *ManagerController) AttachDelete() {
  533. c.Prepare()
  534. attach_id, _ := c.GetInt("attach_id")
  535. if attach_id <= 0 {
  536. c.Abort("404")
  537. }
  538. attach, err := models.NewAttachment().Find(attach_id)
  539. if err != nil {
  540. beego.Error("AttachDelete => ", err)
  541. c.JsonResult(6001, err.Error())
  542. }
  543. if err := attach.Delete(); err != nil {
  544. beego.Error("AttachDelete => ", err)
  545. c.JsonResult(6002, err.Error())
  546. }
  547. c.JsonResult(0, "ok")
  548. }
  549. //标签列表
  550. func (c *ManagerController) LabelList() {
  551. c.Prepare()
  552. c.TplName = "manager/label_list.tpl"
  553. pageIndex, _ := c.GetInt("page", 1)
  554. labels, totalCount, err := models.NewLabel().FindToPager(pageIndex, conf.PageSize)
  555. if err != nil {
  556. c.ShowErrorPage(50001, err.Error())
  557. }
  558. if totalCount > 0 {
  559. pager := pagination.NewPagination(c.Ctx.Request, totalCount, conf.PageSize, c.BaseUrl())
  560. c.Data["PageHtml"] = pager.HtmlPages()
  561. } else {
  562. c.Data["PageHtml"] = ""
  563. }
  564. c.Data["TotalPages"] = int(math.Ceil(float64(totalCount) / float64(conf.PageSize)))
  565. c.Data["Lists"] = labels
  566. }
  567. //删除标签
  568. func (c *ManagerController) LabelDelete(){
  569. labelId,err := strconv.Atoi(c.Ctx.Input.Param(":id"))
  570. if err != nil {
  571. beego.Error("获取删除标签参数时出错:",err)
  572. c.JsonResult(50001,"参数错误")
  573. }
  574. if labelId <= 0 {
  575. c.JsonResult(50001,"参数错误")
  576. }
  577. label,err := models.NewLabel().FindFirst("label_id",labelId)
  578. if err != nil {
  579. beego.Error("查询标签时出错:",err)
  580. c.JsonResult(50001,"查询标签时出错:" + err.Error())
  581. }
  582. if err := label.Delete();err != nil {
  583. c.JsonResult(50002,"删除失败:" + err.Error())
  584. }else{
  585. c.JsonResult(0,"ok")
  586. }
  587. }