|
|
@@ -25,6 +25,7 @@ import { CarrierIdService } from 'src/carrier-id/carrier-id.service'
|
|
|
import { BlackList } from './entities/black-list.entity'
|
|
|
import { hwyzm } from './impl/hwyzm.service'
|
|
|
import { cowboy } from './impl/cowboy.service'
|
|
|
+import { SysConfigService } from 'src/sys-config/sys-config.service'
|
|
|
|
|
|
@Injectable()
|
|
|
export class RcsNumberService {
|
|
|
@@ -45,6 +46,7 @@ export class RcsNumberService {
|
|
|
private operatorConfigService: OperatorConfigService,
|
|
|
private channelService: ChannelService,
|
|
|
private carrierIdService: CarrierIdService,
|
|
|
+ private sysConfigService: SysConfigService,
|
|
|
private mwze167: mwze167,
|
|
|
private durian: durian,
|
|
|
private i18nvc: i18nvc,
|
|
|
@@ -75,7 +77,7 @@ export class RcsNumberService {
|
|
|
return page
|
|
|
}
|
|
|
|
|
|
- async create(country?: string, deviceId?: string, taskId?: number) {
|
|
|
+ async create(country?: string, deviceId?: string, taskId?: number, store?: boolean) {
|
|
|
let operatorConfig: OperatorConfig
|
|
|
if (country) {
|
|
|
operatorConfig = await this.operatorConfigService.findByCountry(country)
|
|
|
@@ -111,13 +113,24 @@ export class RcsNumberService {
|
|
|
}
|
|
|
|
|
|
const channels = await this.channelService.all()
|
|
|
+
|
|
|
+ let storeNumberChannels: string[] = []
|
|
|
+ if (store) {
|
|
|
+ storeNumberChannels = (await this.sysConfigService.getString('store_number_channels', ''))
|
|
|
+ .split(',')
|
|
|
+ .map((i) => i.trim())
|
|
|
+ .filter((i) => i)
|
|
|
+ }
|
|
|
+
|
|
|
const availableChannels = channels.filter((channel) => {
|
|
|
return (
|
|
|
- channel.countryConfig.find(
|
|
|
+ (store ? storeNumberChannels.includes(channel.source.toString()) : true) &&
|
|
|
+ (channel.countryConfig.find(
|
|
|
(config) =>
|
|
|
config.countryCode.toLowerCase() === operatorConfig.country ||
|
|
|
config.countryCode.toUpperCase() === operatorConfig.country
|
|
|
- )?.enabled || false
|
|
|
+ )?.enabled ||
|
|
|
+ false)
|
|
|
)
|
|
|
})
|
|
|
if (!availableChannels.length) {
|