| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- <?php
- namespace app\controller;
- use app\business\StreamBusiness;
- use Illuminate\Support\Arr;
- use support\Db;
- use support\Log;
- use support\Request;
- class IssueController
- {
- public function index(Request $request)
- {
- $param=$request->all();
- Log::channel('issue')->info('接口回调',$param);
- Db::beginTransaction();
- try {
- $order=Db::table('wa_withdraw')->where('order_no',$param['mchOrderNo'])->first();
- if(empty($order)){
- throw new \Exception('订单号不存在!');
- }
- if($order->status != 2){
- throw new \Exception('当前订单已处理!');
- }
- if(Arr::get($param,'status') == 2){
- $status = 3;
- }else{
- if (empty($order)) {
- throw new \Exception('暂无订单');
- }
- if ($order->status != 2) {
- throw new \Exception('【' . $order->order_no . '】已被审核!');
- }
- //
- // if ($order->type == 1) {
- // $mold = moldType1;
- // $moldfield = moldTypefild1;
- // } elseif ($order->type == 2) {
- // $mold = moldType2;
- // $moldfield = moldTypefild2;
- // } elseif ($order->type == 3) {
- // $mold = moldType3;
- // $moldfield = moldTypefild3;
- // } elseif ($order->type == 4) {
- // $mold = moldType4;
- // $moldfield = moldTypefild4;
- // } elseif ($order->type == 4) {
- // $mold = moldType4;
- // $moldfield = moldTypefild4;
- // }
- StreamBusiness::addStream($order->user_id, $order->money, streamType6, $order->type, moldTypefild($order->type),$order->id);
- $status = 4;
- }
- Db::table('wa_withdraw')->where('id',$order->id)->update(['status'=>$status]);
- Db::commit();
- }catch (\Throwable $exception){
- Db::rollBack();
- Log::channel('issue')->error('接口回调'.$exception->getMessage(),$param);
- }
- return "success";
- }
- }
|