|
|
@@ -86,7 +86,17 @@ export class RcsNumberService {
|
|
|
if (availableOperatorConfigs.length === 0) {
|
|
|
throw new Error(`无可用国家`)
|
|
|
}
|
|
|
+
|
|
|
operatorConfig = availableOperatorConfigs[Math.floor(Math.random() * availableOperatorConfigs.length)]
|
|
|
+ let totalWeight = availableOperatorConfigs.reduce((sum, config) => sum + config.weighting, 0);
|
|
|
+ let randomWeight = Math.random() * totalWeight;
|
|
|
+ for (let config of availableOperatorConfigs) {
|
|
|
+ randomWeight -= config.weighting;
|
|
|
+ if (randomWeight < 0) {
|
|
|
+ operatorConfig = config
|
|
|
+ break
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
const channels = await this.channelService.all()
|