AssetController.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  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\article\ArticleLogic;
  18. use app\adminapi\logic\notice\NoticeLogic;
  19. use app\adminapi\validate\article\ArticleValidate;
  20. use app\adminapi\validate\asset\AssetValidate;
  21. use app\adminapi\validate\notice\NoticeValidate;
  22. /**
  23. * 资产控制器
  24. * Class NoticeController
  25. * @package app\adminapi\controller\notice
  26. */
  27. class AssetController extends BaseAdminController
  28. {
  29. public array $notNeedLogin = ['getAssetData'];
  30. /**
  31. * @notes 查看资产列表
  32. * @return \think\response\Json
  33. * @author 段誉
  34. * @date 2021/12/29 9:55
  35. */
  36. public function lists()
  37. {
  38. return $this->dataLists(new AssetLists());
  39. }
  40. /**
  41. * @notes 添加资产
  42. * @return \think\response\Json
  43. * @author heshihu
  44. * @date 2022/2/22 9:57
  45. */
  46. public function add()
  47. {
  48. $params = (new AssetValidate())->post()->goCheck('add');
  49. AssetLists::add($params);
  50. return $this->success('添加成功', [], 1, 1);
  51. }
  52. /**
  53. * @notes 编辑资产
  54. * @return \think\response\Json
  55. * @author heshihu
  56. * @date 2022/2/22 10:12
  57. */
  58. public function edit()
  59. {
  60. $params = (new AssetValidate())->post()->goCheck('edit');
  61. $result = AssetLists::edit($params);
  62. if (true === $result) {
  63. return $this->success('编辑成功', [], 1, 1);
  64. }
  65. return $this->fail(AssetLists::getError());
  66. }
  67. /**
  68. * @notes 删除资产
  69. * @return \think\response\Json
  70. * @author heshihu
  71. * @date 2022/2/22 10:17
  72. */
  73. public function delete()
  74. {
  75. $params = (new AssetValidate())->post()->goCheck('delete');
  76. AssetLists::delete($params);
  77. return $this->success('删除成功', [], 1, 1);
  78. }
  79. /**
  80. * @notes 资产详情
  81. * @return \think\response\Json
  82. * @author heshihu
  83. * @date 2022/2/22 10:15
  84. */
  85. public function detail()
  86. {
  87. $params = (new AssetValidate())->goCheck('detail');
  88. $result = AssetLists::detail($params);
  89. return $this->data($result);
  90. }
  91. /**
  92. * @notes 获取资产数据
  93. * @return \think\response\Json
  94. * @author 段誉
  95. * @date 2022/3/29 11:18
  96. */
  97. public function getAssetData()
  98. {
  99. $result = AssetLists::getAssetData();
  100. return $this->success('查询成功', $result, 1, 1);
  101. }
  102. }