IssueController.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace app\controller;
  3. use app\business\StreamBusiness;
  4. use Illuminate\Support\Arr;
  5. use support\Db;
  6. use support\Log;
  7. use support\Request;
  8. class IssueController
  9. {
  10. public function index(Request $request)
  11. {
  12. $param=$request->all();
  13. Log::channel('issue')->info('接口回调',$param);
  14. Db::beginTransaction();
  15. try {
  16. $order=Db::table('wa_withdraw')->where('order_no',$param['out_trade_no'])->first();
  17. if(empty($order)){
  18. throw new \Exception('订单号不存在!');
  19. }
  20. if($order->status != 2){
  21. throw new \Exception('当前订单已处理!');
  22. }
  23. if(Arr::get($param,'refCode') == 3){
  24. $status = 3;
  25. }else{
  26. if (empty($order)) {
  27. throw new \Exception('暂无订单');
  28. }
  29. if ($order->status != 2) {
  30. throw new \Exception('【' . $order->order_no . '】已被审核!');
  31. }
  32. StreamBusiness::addStream($order->user_id, $order->money, streamType6, $order->type, moldTypefild($order->type),$order->id);
  33. $status = 4;
  34. }
  35. Db::table('wa_withdraw')->where('id',$order->id)->update(['status'=>$status]);
  36. Db::commit();
  37. }catch (\Throwable $exception){
  38. Db::rollBack();
  39. Log::channel('issue')->error('接口回调'.$exception->getMessage(),$param);
  40. }
  41. return "success";
  42. }
  43. }