IssueController.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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['mchOrderNo'])->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,'status') == 2){
  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. //
  33. // if ($order->type == 1) {
  34. // $mold = moldType1;
  35. // $moldfield = moldTypefild1;
  36. // } elseif ($order->type == 2) {
  37. // $mold = moldType2;
  38. // $moldfield = moldTypefild2;
  39. // } elseif ($order->type == 3) {
  40. // $mold = moldType3;
  41. // $moldfield = moldTypefild3;
  42. // } elseif ($order->type == 4) {
  43. // $mold = moldType4;
  44. // $moldfield = moldTypefild4;
  45. // } elseif ($order->type == 4) {
  46. // $mold = moldType4;
  47. // $moldfield = moldTypefild4;
  48. // }
  49. StreamBusiness::addStream($order->user_id, $order->money, streamType6, $order->type, moldTypefild($order->type),$order->id);
  50. $status = 4;
  51. }
  52. Db::table('wa_withdraw')->where('id',$order->id)->update(['status'=>$status]);
  53. Db::commit();
  54. }catch (\Throwable $exception){
  55. Db::rollBack();
  56. Log::channel('issue')->error('接口回调'.$exception->getMessage(),$param);
  57. }
  58. return "success";
  59. }
  60. }