门店查询逻辑

This commit is contained in:
李琦
2026-01-27 08:55:46 +08:00
parent 57c986615b
commit 762e1e8df8

View File

@@ -119,12 +119,19 @@ class RegisterForm extends BaseModel
try {
// 确定实际使用的门店ID
// 如果是购药register_type=3且当前门店药店配置了委托诊所则使用委托诊所ID
// 如果是诊所在线复诊register_type=2需要确保是诊所store.type=0
$actualStoreId = \Yii::$app->store;
if ($this->register_type == 3) {
$currentStore = Store::findOne($actualStoreId);
if ($currentStore && !empty($currentStore->delegate_store_id)) {
$actualStoreId = $currentStore->delegate_store_id;
}
} elseif ($this->register_type == 2) {
// 诊所在线复诊确保是诊所store.type=0
$currentStore = Store::findOne($actualStoreId);
if ($currentStore && $currentStore->type != 0) {
throw new Exception('诊所在线复诊只能在诊所进行');
}
}
$UserRegister = new Register();