isEmpty()){ return false; } $type = AccountLog::getChangeType($source_type); $left_amount = 0; switch ($type){ case 'money': $left_amount = $user->user_money; break; case 'integral': $left_amount = $user->user_integral; break; case 'growth': $left_amount = $user->user_growth; break; case 'earnings': $left_amount = $user->earnings; } $account_log = new AccountLog(); $account_log->log_sn = createSn('account_log','log_sn','',4); $account_log->user_id = $user_id; $account_log->source_type = $source_type; $account_log->source_id = $source_id; $account_log->source_sn = $source_sn; $account_log->change_amount = $amount; $account_log->left_amount = $left_amount; $account_log->remark = AccountLog::getRemarkDesc($source_type,$source_sn,$remark); $account_log->extra = $extra; $account_log->change_type = $change_type; $account_log->create_time = time(); $account_log->save(); //更新会员等级 if($type === 'growth' && $change_type == 1){ LevelLogic::updateUserLevel([$user]); } return true; } }