<?php
/*
 本代码由 口号帮 创建
 创建时间 2019-05-08 16:22:09
 技术支持 口号帮 
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace App\Http\Controllers\Admin;use App\Models\CashOutList;use App\Models\CashRateSetting;use App\Models\Member;use App\Models\MemberInfo;use App\Models\MemberMoneyRecord;use App\Traits\CustomExcel;use Carbon\Carbon;use Illuminate\Http\Request;use App\Http\Controllers\Controller;class CashOutController extends Controller{use CustomExcel;public function index(){return view('admin.account.cash.index');}public function data(Request $request,CashOutList $message){$message=$message->query();if($request->create_start)goto P2gBodyx2;goto P2gNextx2;P2gBodyx2:$message=$message->where('created_at','>=',$request->create_start);goto P2gx1;P2gNextx2:P2gx1:if($request->create_end)goto P2gBodyx4;goto P2gNextx4;P2gBodyx4:$message=$message->where('created_at','<',$request->create_end);goto P2gx3;P2gNextx4:P2gx3:if($request->phone)goto P2gBodyx6;goto P2gNextx6;P2gBodyx6:$member=Member::where(['phone'=>$request->phone])->first();$message=$message->where(['mid'=>$member->id]);goto P2gx5;P2gNextx6:P2gx5:if($request->type)goto P2gBodyx8;goto P2gNextx8;P2gBodyx8:$message=$message->where(['status'=>$request->type]);goto P2gx7;P2gNextx8:P2gx7:$data=$message->with('member','user')->orderBy('id','desc')->paginate($request->get('limit',$this->pageSize))->toArray();$P2gAC0=array();$P2gAC0['code']=0;$P2gAC0['msg']='正在请求中...';$P2gAC0['count']=$data['total'];$P2gAC0['data']=$data['data'];$data=$P2gAC0;return response()->json($data);}public function excel(){}public function edit($id){$info=CashOutList::with(['user','member'])->find($id);$account=MemberInfo::where(['mid'=>$info->mid])->first();$money=MemberMoneyRecord::where(['mid'=>$info->member->id])->orderBy('id','desc')->first();return view('admin.account.cash.create',compact('info','money','account'));}public function update(Request $request){if(isset($request->status))goto P2gBodyxa;goto P2gNextxa;P2gBodyxa:$data['status']=$request->status;$data['mark']=$request->mark;$rate=CashRateSetting::where(['type'=>1])->first();$data['rate_money']=$request->received;$data['uid']=auth()->user()->id;$data['rate']=$rate->rate;$member=Member::where('id',$request->mid)->first();$data['mid']=$request->mid;$account=MemberInfo::where(['mid'=>$member->id])->first();$P2g0=$request->status==3;if($P2g0)goto P2gBodyxc;goto P2gNextxc;P2gBodyxc:$data['image']=$request->logo;$P2g0=$account->alipay_account . '(';$P2g1=$P2g0 . $account->alipay_name;$P2g2=$P2g1 . ')';$data['account']=$P2g2;$data['deal_at']=Carbon::now();$money=MemberMoneyRecord::where(['mid'=>$member->id])->orderBy('id','desc')->first();MemberMoneyRecord::create(['mid'=>$member->id,'money'=>$request->money,'type'=>7,'total_money'=>$money->total_money,'mark'=>'用户提现手续费'.($request->money-$request->received).'元','freeze_money'=>$money->freeze_money-$request->money,'uid'=>$data['uid'],'cash_id'=>$request->id]);goto P2gxb;P2gNextxc:P2gxb:CashOutList::where(['id'=>$request->id])->update($data);return redirect()->route('admin.cash');goto P2gx9;P2gNextxa:return redirect()->url("cash/".$request->id."/edit");P2gx9:}public function exportExcelData(Request $request){$message=CashOutList::select();if($request->create_start)goto P2gBodyxe;goto P2gNextxe;P2gBodyxe:$message=$message->where('created_at','>=',$request->create_start);goto P2gxd;P2gNextxe:P2gxd:if($request->create_end)goto P2gBodyxg;goto P2gNextxg;P2gBodyxg:$message=$message->where('created_at','<',$request->create_end);goto P2gxf;P2gNextxg:P2gxf:if($request->phone)goto P2gBodyxi;goto P2gNextxi;P2gBodyxi:$member=Member::where(['phone'=>$request->phone])->first();$message=$message->where(['mid'=>$member->id]);goto P2gxh;P2gNextxi:P2gxh:if($request->type)goto P2gBodyxk;goto P2gNextxk;P2gBodyxk:$message=$message->where('status','=',$request->type);goto P2gxj;P2gNextxk:P2gxj:$list=$message->with(['member','user'])->orderBy('id','desc')->get();$A__AA__="count";$P2gAC0=$A__AA__($list);if($P2gAC0)goto P2gBodyxm;goto P2gNextxm;P2gBodyxm:$P2gAC0=array();$result=$P2gAC0;$P2gAC0=array();$P2gAC0[]='编号';$P2gAC0[]='电话';$P2gAC0[]='申请金额(元)';$P2gAC0[]='打款金额';$P2gAC0[]='打款账户';$P2gAC0[]='打款凭证';$P2gAC0[]='操作人';$P2gAC0[]='备注';$P2gAC0[]='时间';$result[]=$P2gAC0;$P2g0=$P2gAC0;foreach($list as $item){$P2gAC0=array();$arr=$P2gAC0;$arr[]=$item->id;$P2g0=$item->id;$arr[]=$item->member['phone'];$P2g0=$item->member['phone'];$arr[]=$item->apply_money;$P2g0=$item->apply_money;$arr[]=$item->check_money;$P2g0=$item->check_money;$arr[]=$item->account;$P2g0=$item->account;$arr[]=$item->image;$P2g0=$item->image;$arr[]=$item->user['name'];$P2g0=$item->user['name'];$arr[]=$item->mark;$P2g0=$item->mark;$arr[]=$item->created_at;$P2g0=$item->created_at;$result[]=$arr;$P2g0=$arr;}$A__AA_A="date";$P2gAC0=$A__AA_A('YmdHis');$P2g0='退款流水' . $P2gAC0;$title=$P2g0;$this->excelExport($title,$result);die();goto P2gxl;P2gNextxm:P2gxl:}}
?>