IssueController.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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['merchantUniqueOrderId'])->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') == '100'){
  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. public function indextwo(Request $request)
  44. {
  45. $param=$request->all();
  46. Log::channel('issue')->info('接口回调',$param);
  47. Db::beginTransaction();
  48. try {
  49. $order=Db::table('wa_withdraw')->where('order_no',$param['merchantUniqueOrderId'])->first();
  50. if(empty($order)){
  51. throw new \Exception('订单号不存在!');
  52. }
  53. if($order->status != 2){
  54. throw new \Exception('当前订单已处理!');
  55. }
  56. if(Arr::get($param,'status') == '100'){
  57. $status = 3;
  58. }else{
  59. if (empty($order)) {
  60. throw new \Exception('暂无订单');
  61. }
  62. if ($order->status != 2) {
  63. throw new \Exception('【' . $order->order_no . '】已被审核!');
  64. }
  65. StreamBusiness::addStream($order->user_id, $order->money, streamType6, $order->type, moldTypefild($order->type), $order->id);
  66. $status = 4;
  67. }
  68. Db::table('wa_withdraw')->where('id',$order->id)->update(['status'=>$status]);
  69. Db::commit();
  70. }catch (\Throwable $exception){
  71. Db::rollBack();
  72. Log::channel('issue')->error('接口回调'.$exception->getMessage(),$param);
  73. }
  74. return "success";
  75. }
  76. public function issue_three(Request $request)
  77. {
  78. $param=$request->all();
  79. Log::channel('issue')->info('接口回调',$param);
  80. Db::beginTransaction();
  81. try {
  82. $order=Db::table('wa_withdraw')->where('order_no',$param['tradeid'])->first();
  83. if(empty($order)){
  84. throw new \Exception('订单号不存在!');
  85. }
  86. if($order->status != 2){
  87. throw new \Exception('当前订单已处理!');
  88. }
  89. if(Arr::get($param,'status') == 88){
  90. $status = 3;
  91. }else{
  92. if (empty($order)) {
  93. throw new \Exception('暂无订单');
  94. }
  95. if ($order->status != 2) {
  96. throw new \Exception('【' . $order->order_no . '】已被审核!');
  97. }
  98. StreamBusiness::addStream($order->user_id, $order->money, streamType6, $order->type, moldTypefild($order->type),$order->id);
  99. $status = 4;
  100. }
  101. Db::table('wa_withdraw')->where('id',$order->id)->update(['status'=>$status]);
  102. Db::commit();
  103. }catch (\Throwable $exception){
  104. Db::rollBack();
  105. Log::channel('issue')->error('接口回调'.$exception->getMessage(),$param);
  106. }
  107. return "success";
  108. }
  109. }