AssetController.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | likeadmin快速开发前后端分离管理后台(PHP版)
  4. // +----------------------------------------------------------------------
  5. // | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
  6. // | 开源版本可自由商用,可去除界面版权logo
  7. // | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
  8. // | github下载:https://github.com/likeshop-github/likeadmin
  9. // | 访问官网:https://www.likeadmin.cn
  10. // | likeadmin团队 版权所有 拥有最终解释权
  11. // +----------------------------------------------------------------------
  12. // | author: likeadminTeam
  13. // +----------------------------------------------------------------------
  14. namespace app\adminapi\controller\asset;
  15. use app\adminapi\controller\BaseAdminController;
  16. use app\adminapi\lists\asset\AssetLists;
  17. use app\adminapi\logic\notice\NoticeLogic;
  18. use app\adminapi\validate\asset\AssetValidate;
  19. use app\adminapi\validate\notice\NoticeValidate;
  20. /**
  21. * 资产控制器
  22. * Class NoticeController
  23. * @package app\adminapi\controller\notice
  24. */
  25. class AssetController extends BaseAdminController
  26. {
  27. /**
  28. * @notes 查看资产列表
  29. * @return \think\response\Json
  30. * @author 段誉
  31. * @date 2021/12/29 9:55
  32. */
  33. public function lists()
  34. {
  35. return $this->dataLists(new AssetLists());
  36. }
  37. /**
  38. * @notes 添加资产
  39. * @return \think\response\Json
  40. * @author heshihu
  41. * @date 2022/2/22 9:57
  42. */
  43. public function add()
  44. {
  45. $params = (new AssetValidate())->post()->goCheck('add');
  46. AssetLists::add($params);
  47. return $this->success('添加成功', [], 1, 1);
  48. }
  49. /**
  50. * @notes 编辑资产
  51. * @return \think\response\Json
  52. * @author heshihu
  53. * @date 2022/2/22 10:12
  54. */
  55. public function edit()
  56. {
  57. $params = (new AssetValidate())->post()->goCheck('edit');
  58. $result = AssetLists::edit($params);
  59. if (true === $result) {
  60. return $this->success('编辑成功', [], 1, 1);
  61. }
  62. return $this->fail(AssetLists::getError());
  63. }
  64. /**
  65. * @notes 删除资讯
  66. * @return \think\response\Json
  67. * @author heshihu
  68. * @date 2022/2/22 10:17
  69. */
  70. public function delete()
  71. {
  72. $params = (new AssetValidate())->post()->goCheck('delete');
  73. AssetLists::delete($params);
  74. return $this->success('删除成功', [], 1, 1);
  75. }
  76. /**
  77. * @notes 查看通知设置详情
  78. * @return \think\response\Json
  79. * @author 段誉
  80. * @date 2022/3/29 11:18
  81. */
  82. public function detail()
  83. {
  84. $params = (new NoticeValidate())->goCheck('detail');
  85. $result = NoticeLogic::detail($params);
  86. return $this->data($result);
  87. }
  88. /**
  89. * @notes 通知设置
  90. * @return \think\response\Json
  91. * @author 段誉
  92. * @date 2022/3/29 11:18
  93. */
  94. public function set()
  95. {
  96. $params = $this->request->post();
  97. $result = NoticeLogic::set($params);
  98. if ($result) {
  99. return $this->success('设置成功');
  100. }
  101. return $this->fail(NoticeLogic::getError());
  102. }
  103. }