user_id = $userId; $model->user_type = $userType; $model->account_table = $accountTable; $model->field_name = $fieldName; $model->before_amount = $before; $model->after_amount = $after; $model->change_amount = $change; $model->source_type = $sourceType; $model->source_table = $sourceTable; $model->source_id = $sourceId; $model->order_id = (int)($extra['order_id'] ?? 0); $model->order_type = (int)($extra['order_type'] ?? 0); $model->order_no = (string)($extra['order_no'] ?? ''); $model->remark = (string)($extra['remark'] ?? ''); $model->created_at = $time; $model->updated_at = $time; if (!$model->save(false)) { Yii::warning('写入 xk_account_able_change_log 失败', __METHOD__); } } public static function logCashAccountAbleChange( int $userId, int $userType, $before, $after, string $sourceType, string $sourceTable, int $sourceId = 0, array $extra = [] ): void { self::recordWithdrawableChange( $userId, $userType, self::ACCOUNT_TABLE_CASH, self::FIELD_ABLE_CASH, $before, $after, $sourceType, $sourceTable, $sourceId, $extra ); } public static function logSupplierBalanceChange( int $userId, $before, $after, string $sourceType, string $sourceTable, int $sourceId = 0, array $extra = [] ): void { self::recordWithdrawableChange( $userId, 3, self::ACCOUNT_TABLE_BALANCE, self::FIELD_BALANCE, $before, $after, $sourceType, $sourceTable, $sourceId, $extra ); } }