用于在用户请求生成 infoXmed VIP 会员激活二维码、批量二维码或提及 infoXmed 会员卡时触发。触发关键词包括...
Extracts parameters from natural language input and calls the infoxmed batch QR code generation API, then saves the returned zip file locally.
From user input, extract and map these fields:
User Input FieldAPI ParameterExtraction Rule医院名称 / 机构agentFormat: {商务渠道人}-{医院名称}, e.g. 商务二部 蔡宏-宜兴市人民医院时限 / 卡类型cardNameExtract core card name from input. Map: 月卡/季卡/半年卡/年卡/周卡. Strip "会员"/"会员卡" suffix, keep only X卡可扫码数量 / 次数 / 张数timesExtract number. If not specified and vipCarType=2, default 9999绑定商务渠道人 / 商务(part of agent)Combined into agent field as prefix before -扫码类型vipCarType``2 if times > 1 or user specifies multi-use; 1 if one-time QR code. Default: infer from times
Fixed parameters:
password: Read from environment variable INFOXMED_VIP_PASSWORD. If not set, stop and tell the user to configure it (see Setup section below).count: 1First detect the platform, then check the environment variable using the platform-appropriate command:
macOS / Linux:
bash
echo $INFOXMED_VIP_PASSWORD
Windows (PowerShell):
powershell
echo $env:INFOXMED_VIP_PASSWORD
If the variable is set (non-empty): proceed with the API call.
If the variable is empty or not set: DO NOT call the API. Instead, run the following interactive setup flow:
bash
# Detect shell profile
if [ -n "$ZSH_VERSION" ] || [[ "$SHELL" == */zsh ]]; then
PROFILE="$HOME/.zshrc"
elif [ -n "$BASH_VERSION" ] || [[ "$SHELL" == */bash ]]; then
PROFILE="$HOME/.bashrc"
elif [[ "$SHELL" == */fish ]]; then
PROFILE="$HOME/.config/fish/config.fish"
else
PROFILE="$HOME/.profile"
fi
# Write to profile (fish uses different syntax)
if [[ "$SHELL" == */fish ]]; then
echo 'set -gx INFOXMED_VIP_PASSWORD "USER_PROVIDED_PASSWORD"' >> "$PROFILE"
else
echo '' >> "$PROFILE"
echo '# Infoxmed VIP QR API password' >> "$PROFILE"
echo 'export INFOXMED_VIP_PASSWORD="USER_PROVIDED_PASSWORD"' >> "$PROFILE"
fi
# Set for current session
export INFOXMED_VIP_PASSWORD="USER_PROVIDED_PASSWORD"
powershell
# Set permanently for current user (persists across reboots)
[System.Environment]::SetEnvironmentVariable("INFOXMED_VIP_PASSWORD", "USER_PROVIDED_PASSWORD", "User")
# Set for current session
$env:INFOXMED_VIP_PASSWORD = "USER_PROVIDED_PASSWORD"
User sayscardName value半年会员卡 / 半年卡 / 半年半年卡月卡 / 月会员卡 / 一个月月卡季卡 / 季度卡 / 三个月季卡年卡 / 年会员卡 / 一年年卡周卡 / 周会员卡 / 一周周卡
text
if times == 1 or user explicitly says "一次性":
vipCarType = 1, times = 1
else:
vipCarType = 2, times = user_specified or 9999
macOS / Linux:
bash
curl -s -o /tmp/vip_qr_{timestamp}.zip \
"https://api.infox-med.com/system/batchGenerateVipQr?password=${INFOXMED_VIP_PASSWORD}&agent={url_encoded_agent}&count=1&cardName={url_encoded_cardName}&vipCarType={vipCarType}×={times}" \
-H "Origin: https://admin.infox-med.com" \
-H "Referer: https://admin.infox-med.com/"
Windows (PowerShell):
powershell
Invoke-WebRequest -Uri "https://api.infox-med.com/system/batchGenerateVipQr?password=$env:INFOXMED_VIP_PASSWORD&agent={url_encoded_agent}&count=1&cardName={url_encoded_cardName}&vipCarType={vipCarType}×={times}" `
-Headers @{ "Origin" = "https://admin.infox-med.com"; "Referer" = "https://admin.infox-med.com/" } `
-OutFile "$env:TEMP\vip_qr_{timestamp}.zip"
If any required info is missing, ask the user. Required fields:
User input:
请生成二维码 医院名称:宜兴市人民医院 时限:半年会员卡 可扫码数量:1000次 绑定商务渠道人:商务二部 蔡宏
Extracted parameters:
agent = 商务二部 蔡宏-宜兴市人民医院count = 1cardName = 半年卡vipCarType = 2 (because times=1000 > 1)times = 1000password = ${INFOXMED_VIP_PASSWORD}API call:
text
GET https://api.infox-med.com/system/batchGenerateVipQr?password=${INFOXMED_VIP_PASSWORD}&agent=商务二部%20蔡宏-宜兴市人民医院&count=1&cardName=半年卡&vipCarType=2×=1000