PropertyController.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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. Log::info('物业ID-11');
  31. $result = PropertyOrderLogic::bind($params);
  32. if (true === $result) {
  33. return $this->success('下单成功', [], 1, 1);
  34. }
  35. return $this->fail(PropertyOrderLogic::getError());
  36. }
  37. /**
  38. * @notes 二维码扫码下物业单
  39. * @return \think\response\Json
  40. */
  41. public function orderByQrcode()
  42. {
  43. $params = (new PropertyOrderValidate())->post()->goCheck('add');
  44. $result = PropertyOrderLogic::add($params);
  45. if (false === $result) {
  46. return $this->fail(PropertyOrderLogic::getError());
  47. }
  48. return $this->success('下单成功', [], 1, 1);
  49. }
  50. /**
  51. * 提现申请
  52. * @return \think\response\Json
  53. */
  54. public function withdrawCash()
  55. {
  56. $params = (new PropertyValidate())->post()->goCheck('withdrawCash', [
  57. 'user_id' => $this->userId,
  58. 'user_info' => $this->userInfo
  59. ]);
  60. $result = PropertyCommissionLogic::withdrawCash($params);
  61. if (false === $result) {
  62. return $this->fail(PropertyCommissionLogic::getError());
  63. }
  64. return $this->success('申请成功,等待审核', [], 1, 1);
  65. }
  66. /**
  67. * 物业负责人资金账户信息
  68. * @return \think\response\Json
  69. */
  70. public function assetAccount()
  71. {
  72. $params = [
  73. 'user_id' => $this->userId,
  74. 'user_info' => $this->userInfo
  75. ];
  76. return $this->success('资金账户', PropertyCommissionLogic::assetAccount($params), 1, 1);
  77. }
  78. /**
  79. * 下单列表
  80. * @return \think\response\Json
  81. */
  82. public function orderLists()
  83. {
  84. return $this->dataLists(new PropertyOrderLists());
  85. }
  86. /**
  87. * 进出记录列表
  88. * @return \think\response\Json
  89. */
  90. public function surplusLists()
  91. {
  92. return $this->dataLists(new PropertySurplusLogLists());
  93. }
  94. /**
  95. * 分成列表
  96. * @return \think\response\Json
  97. */
  98. public function commissionLists()
  99. {
  100. return $this->dataLists(new PropertyCommissionLists());
  101. }
  102. /**
  103. * 订单支付详情
  104. * @return \think\response\Json
  105. */
  106. public function commissionOrderDetail()
  107. {
  108. $params = (new ServiceOrderValidate())->goCheck('detail');
  109. //获取订单用户信息
  110. $params['user_id'] = RechargeOrder::where('sn',$params['sn'])->value('user_id');
  111. $result = ServiceOrderLogic::orderPayInfo($params);
  112. if (false === $result) {
  113. return $this->fail(ServiceOrderLogic::getError());
  114. }
  115. return $this->data($result);
  116. }
  117. }