This commit is contained in:
2026-04-24 17:17:31 +08:00
parent d408ffabe8
commit 5cb9706274
2 changed files with 210 additions and 51 deletions
@@ -6,8 +6,8 @@ namespace app\common\service\qywx;
use app\common\model\QywxExternalContact;
use app\common\model\QywxMediaChannel;
use think\db\Query;
use think\facade\Db;
use think\db\Query;
class MediaChannelService
{
@@ -75,6 +75,35 @@ class MediaChannelService
return (string) ($channel['channel_name'] ?? '');
}
/**
* 挂号老数据渠道:doctor_appointment.channels 对应 dict_data(type_value=channels) 的 value。
*
* @param array<string, mixed>|null $channel
* @return int[]
*/
public static function getLegacyAppointmentChannelValues(?array $channel): array
{
if ($channel === null) {
return [];
}
$names = array_values(array_unique(array_filter([
trim((string) ($channel['channel_name'] ?? '')),
trim((string) ($channel['source_tag_name'] ?? '')),
])));
if ($names === []) {
return [];
}
$rows = Db::name('dict_data')
->where('type_value', 'channels')
->whereIn('name', $names)
->column('value');
return array_values(array_filter(array_map('intval', $rows), static fn (int $value): bool => $value > 0));
}
/**
* @param array<string, mixed>|null $channel
*/