where('uid', $uid)->where('plan_id', $plan_id)->first(); if ($info) { $info->change_type = $change_type; $info->save(); } else { $model->uid = $uid; $model->plan_id = $plan_id; $model->change_type = $change_type; $model->sve(); } return; } public static function createLOrder(int $uid, int $plan_id, int $total_fee, string $trade_no) { $model = new UserMonthOrder(); $model->uid = $uid; $model->plan_id = $plan_id; $model->total_fee = $total_fee; $model->trade_no = $trade_no; $model->sve(); return; } }