PropertyController.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. <?php
  2. namespace app\api\controller;
  3. use app\adminapi\validate\property\PropertyOrderValidate;
  4. use app\api\lists\property\PropertyCommissionLists;
  5. use app\api\lists\property\PropertyOrderLists;
  6. use app\api\lists\property\PropertySurplusLogLists;
  7. use app\api\logic\PropertyCommissionLogic;
  8. use app\api\logic\PropertyOrderLogic;
  9. use app\api\logic\ServiceOrderLogic;
  10. use app\api\validate\PropertyValidate;
  11. use app\api\validate\ServiceOrderValidate;
  12. use app\common\model\orders\RechargeOrder;
  13. use think\facade\Log;
  14. /**
  15. * 物业模块类
  16. */
  17. class PropertyController extends BaseApiController
  18. {
  19. public array $notNeedLogin = ['orderByQrcode'];
  20. /**
  21. * @notes 用户绑定物业信息
  22. * @return \think\response\Json
  23. */
  24. public function bindProperty()
  25. {
  26. $params = (new PropertyOrderValidate())->post()->goCheck('bind', [
  27. 'householder_name'=>'',
  28. 'householder_mobile'=>$this->userInfo['mobile']
  29. ]);
  30. $result = PropertyOrderLogic::bind($params);
  31. if (true === $result) {
  32. return $this->success('下单成功', [], 1, 1);
  33. }
  34. return $this->fail(PropertyOrderLogic::getError());
  35. }
  36. /**
  37. * @notes 二维码扫码下物业单
  38. * @return \think\response\Json
  39. */
  40. public function orderByQrcode()
  41. {
  42. $params = (new PropertyOrderValidate())->post()->goCheck('add');
  43. $result = PropertyOrderLogic::add($params);
  44. if (true === $result) {
  45. return $this->success('下单成功', [], 1, 1);
  46. }
  47. return $this->fail(PropertyOrderLogic::getError());
  48. }
  49. /**
  50. * 提现申请
  51. * @return \think\response\Json
  52. */
  53. public function withdrawCash()
  54. {
  55. $params = (new PropertyValidate())->post()->goCheck('withdrawCash', [
  56. 'user_id' => $this->userId,
  57. 'user_info' => $this->userInfo
  58. ]);
  59. $result = PropertyCommissionLogic::withdrawCash($params);
  60. if (false === $result) {
  61. return $this->fail(PropertyCommissionLogic::getError());
  62. }
  63. return $this->success('申请成功,等待审核', [], 1, 1);
  64. }
  65. /**
  66. * 物业负责人资金账户信息
  67. * @return \think\response\Json
  68. */
  69. public function assetAccount()
  70. {
  71. $params = [
  72. 'user_id' => $this->userId,
  73. 'user_info' => $this->userInfo
  74. ];
  75. return $this->success('资金账户', PropertyCommissionLogic::assetAccount($params), 1, 1);
  76. }
  77. /**
  78. * 下单列表
  79. * @return \think\response\Json
  80. */
  81. public function orderLists()
  82. {
  83. return $this->dataLists(new PropertyOrderLists());
  84. }
  85. /**
  86. * 进出记录列表
  87. * @return \think\response\Json
  88. */
  89. public function surplusLists()
  90. {
  91. return $this->dataLists(new PropertySurplusLogLists());
  92. }
  93. /**
  94. * 分成列表
  95. * @return \think\response\Json
  96. */
  97. public function commissionLists()
  98. {
  99. return $this->dataLists(new PropertyCommissionLists());
  100. }
  101. /**
  102. * 订单支付详情
  103. * @return \think\response\Json
  104. */
  105. public function commissionOrderDetail()
  106. {
  107. $params = (new ServiceOrderValidate())->goCheck('detail');
  108. //获取订单用户信息
  109. $params['user_id'] = RechargeOrder::where('sn',$params['sn'])->value('user_id');
  110. $result = ServiceOrderLogic::orderPayInfo($params);
  111. if (false === $result) {
  112. return $this->fail(ServiceOrderLogic::getError());
  113. }
  114. return $this->data($result);
  115. }
  116. }