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

namespace App\Traits;use App\Models\Apply;use App\Models\ApplyLog;use App\Models\MemberMoneyRecord;use App\Models\SystemMessageBack;use Illuminate\Support\Carbon;trait ApplyLogs{public function setLogs($id,$uid,$status,$mark,$mid=0){ApplyLog::create(['apply_id'=>$id,'status'=>$status,'uid'=>$uid,'mark'=>$mark,'mid'=>$mid]);}public function setMoneyBack($id,$content){$info=Apply::find($id);$money=MemberMoneyRecord::where(['mid'=>$info->mid])->orderBy('id','desc')->first();$P2g0=$info->status==5;if($P2g0)goto P2gBodyx2;goto P2gNextx2;P2gBodyx2:MemberMoneyRecord::create(['mid'=>$info->mid,'money'=>$info->money,'type'=>3,'total_money'=>$money->total_money+$info->money,'mark'=>'取消订单','order_id'=>$id,'freeze_money'=>$money->freeze_money]);goto P2gx1;P2gNextx2:$P2g0=$info->status>=2;$P2g2=(bool)$P2g0;if($P2g2)goto P2gBodyx4;goto P2gNextx4;P2gBodyx4:$P2g1=$info->status<5;$P2g2=(bool)$P2g1;goto P2gx3;P2gNextx4:P2gx3:if($P2g2)goto P2gBodyx5;goto P2gNextx5;P2gBodyx5:MemberMoneyRecord::create(['mid'=>$info->mid,'money'=>$info->money,'type'=>3,'total_money'=>$money->total_money+$info->money,'mark'=>'取消订单','order_id'=>$id,'freeze_money'=>$money->freeze_money-$info->money]);goto P2gx1;P2gNextx5:P2gx1:$P2g0=$info->status>=2;if($P2g0)goto P2gBodyx7;goto P2gNextx7;P2gBodyx7:Apply::where(['id'=>$id])->update(['status'=>6,'refuse_time'=>Carbon::now(),'refuse_content'=>$content]);goto P2gx6;P2gNextx7:Apply::where(['id'=>$id])->update(['status'=>3,'refuse_content'=>$content]);P2gx6:}public function setSystemMessage($title,$content,$phone,$id){SystemMessageBack::create(['title'=>$title,'content'=>$content,'message_type'=>'system','object_id'=>0,'numbers'=>$phone,'send_type'=>1,'send_user_type'=>3,'order_id'=>$id]);}public function getMemberMoney($mid){$money=MemberMoneyRecord::where(['mid'=>$mid])->orderBy('id','desc')->first();return $money;}}
?>