AssetLeaseController.php 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  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\lists\asset\AssetLeaseLists;
  18. use app\adminapi\logic\notice\NoticeLogic;
  19. use app\adminapi\validate\article\ArticleValidate;
  20. use app\adminapi\validate\asset\AssetValidate;
  21. use app\common\enum\asset\AssetEnum;
  22. use app\adminapi\validate\asset\AssetLeaseValidate;
  23. use app\adminapi\validate\notice\NoticeValidate;
  24. use app\common\logic\PaymentLogic;
  25. /**
  26. * 资产租赁控制器
  27. * Class NoticeController
  28. * @package app\adminapi\controller\notice
  29. */
  30. class AssetLeaseController extends BaseAdminController
  31. {
  32. public array $notNeedLogin = ['autoUpdataLeaseStatus'];
  33. /**
  34. * @notes 查看资产列表
  35. * @return \think\response\Json
  36. * @author 段誉
  37. * @date 2021/12/29 9:55
  38. */
  39. public function lists()
  40. {
  41. return $this->dataLists(new AssetLeaseLists());
  42. }
  43. /**
  44. * @notes 添加资产
  45. * @return \think\response\Json
  46. * @author heshihu
  47. * @date 2022/2/22 9:57
  48. */
  49. public function add()
  50. {
  51. $params = (new AssetLeaseValidate())->post()->goCheck('add');
  52. $params['referee_uid'] =$this->adminId;
  53. $result =AssetLeaseLists::add($params);
  54. if ($result['code'] <> 200) {
  55. return $this->fail($result['msg']);
  56. }
  57. return $this->success($result['msg'], [], 1, 1);
  58. }
  59. /**
  60. * @notes 编辑资产
  61. * @return \think\response\Json
  62. * @author heshihu
  63. * @date 2022/2/22 10:12
  64. */
  65. public function edit()
  66. {
  67. $params = (new AssetLeaseValidate())->post()->goCheck('edit');
  68. $params['referee_uid'] =$this->adminId;
  69. $result = AssetLeaseLists::edit($params);
  70. if (true === $result) {
  71. return $this->success('编辑成功', [], 1, 1);
  72. }
  73. return $this->fail(AssetLeaseLists::getError());
  74. }
  75. /**
  76. * @notes 租赁详情
  77. * @return \think\response\Json
  78. * @author heshihu
  79. * @date 2022/2/22 10:15
  80. */
  81. public function detail()
  82. {
  83. $params = (new AssetLeaseValidate())->goCheck('detail');
  84. $result = AssetLeaseLists::detail($params);
  85. return $this->data($result);
  86. }
  87. /**
  88. * @notes 获取可租赁房产
  89. * @return \think\response\Json
  90. * @author 段誉
  91. * @date 2022/3/29 11:18
  92. */
  93. public function getAssetForRent()
  94. {
  95. $params = $this->request->get();
  96. $result = AssetLists::getRentAssetList($params);
  97. return $this->success('查询成功', $result, 1, 1);
  98. }
  99. public function getApprovalSattusDesc(){
  100. $list = AssetEnum::APPROVAL_STATUS_SCENE;
  101. $params = $this->request->get();
  102. if(isset($params['flag'])){
  103. if($params['flag']){
  104. $lists =[ ['id'=>0,'status_desc'=>'全部']];
  105. $list = array_merge($lists,$list);
  106. }
  107. }
  108. return $this->success('查询成功',$list, 1, 1);
  109. }
  110. public function doApprove(){
  111. $params = (new AssetLeaseValidate())->post()->goCheck('approve');
  112. $params['approve_uid'] =$this->adminId;
  113. $result = AssetLeaseLists::approve($params);
  114. if (true === $result) {
  115. return $this->success('审核完成!', [], 1, 1);
  116. }
  117. return $this->fail(AssetLeaseLists::getError());
  118. }
  119. public function updatePayStatus(){
  120. $params = (new AssetLeaseValidate())->post()->goCheck('pay');
  121. $result = AssetLeaseLists::updatePayStatus($params);
  122. if (true === $result) {
  123. return $this->success('修改成功!', [], 1, 1);
  124. }
  125. return $this->fail(AssetLeaseLists::getError());
  126. }
  127. public function autoUpdataLeaseStatus(){
  128. $result = AssetLeaseLists::autoUpdateStatus();
  129. return $this->success('更新成功',[], 1, 1);
  130. }
  131. public function setEnd(){
  132. $params = (new AssetLeaseValidate())->post()->goCheck('end');
  133. $params['approve_uid'] =$this->adminId;
  134. $result = AssetLeaseLists::setEnd($params);
  135. if (true === $result) {
  136. return $this->success('终止成功', [], 1, 1);
  137. }
  138. return $this->fail(AssetLeaseLists::getError());
  139. }
  140. }