AssetLeaseController.php 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  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 heshihu
  91. * @date 2022/2/22 10:17
  92. */
  93. public function delete()
  94. {
  95. $params = (new AssetLeaseValidate())->post()->goCheck('delete');
  96. AssetLeaseLists::delete($params);
  97. return $this->success('删除成功', [], 1, 1);
  98. }
  99. /**
  100. * @notes 获取可租赁房产
  101. * @return \think\response\Json
  102. * @author 段誉
  103. * @date 2022/3/29 11:18
  104. */
  105. public function getAssetForRent()
  106. {
  107. $params = $this->request->get();
  108. $result = AssetLists::getRentAssetList($params);
  109. return $this->success('查询成功', $result, 1, 1);
  110. }
  111. public function getApprovalSattusDesc(){
  112. $list = AssetEnum::APPROVAL_STATUS_SCENE;
  113. $params = $this->request->get();
  114. if(isset($params['flag'])){
  115. if($params['flag']){
  116. $lists =[ ['id'=>0,'status_desc'=>'全部']];
  117. $list = array_merge($lists,$list);
  118. }
  119. }
  120. return $this->success('查询成功',$list, 1, 1);
  121. }
  122. public function doApprove(){
  123. $params = (new AssetLeaseValidate())->post()->goCheck('approve');
  124. $params['approve_uid'] =$this->adminId;
  125. $result = AssetLeaseLists::approve($params);
  126. if (true === $result) {
  127. return $this->success('审核完成!', [], 1, 1);
  128. }
  129. return $this->fail(AssetLeaseLists::getError());
  130. }
  131. public function updatePayStatus(){
  132. $params = (new AssetLeaseValidate())->post()->goCheck('pay');
  133. $result = AssetLeaseLists::updatePayStatus($params);
  134. if (true === $result) {
  135. return $this->success('修改成功!', [], 1, 1);
  136. }
  137. return $this->fail(AssetLeaseLists::getError());
  138. }
  139. public function autoUpdataLeaseStatus(){
  140. $result = AssetLeaseLists::autoUpdateStatus();
  141. return $this->success('更新成功',[], 1, 1);
  142. }
  143. public function setEnd(){
  144. $params = (new AssetLeaseValidate())->post()->goCheck('end');
  145. $params['approve_uid'] =$this->adminId;
  146. $result = AssetLeaseLists::setEnd($params);
  147. if (true === $result) {
  148. return $this->success('终止成功', [], 1, 1);
  149. }
  150. return $this->fail(AssetLeaseLists::getError());
  151. }
  152. }