isEmpty()) { return false; } $changeObject = AccountLogEnum::getChangeObject($changeType); if(!$changeObject) { return false; } switch ($changeObject) { // 可提现余额(用户收入) case AccountLogEnum::BW: $left_amount = $user->user_earnings; break; // 不可提现余额 case AccountLogEnum::BNW: $left_amount = $user->user_money; break; // 成长值 case AccountLogEnum::GROWTH: $left_amount = $user->user_growth; break; // 积分 case AccountLogEnum::INTEGRAL: $left_amount = $user->user_integral; break; } $accountLog = new AccountLog(); $data = [ 'sn' => generate_sn($accountLog, 'sn', 20), 'user_id' => $userId, 'change_object' => $changeObject, 'change_type' => $changeType, 'action' => $action, 'left_amount' => $left_amount, 'change_amount' => $changeAmount, 'association_sn' => $associationSn, 'remark' => $remark, 'feature' => $feature ? json_encode($feature, JSON_UNESCAPED_UNICODE) : '', ]; return $accountLog->save($data); } }