diff --git a/member/models/forms/RegisterForm.php b/member/models/forms/RegisterForm.php index 85caae8..686921a 100644 --- a/member/models/forms/RegisterForm.php +++ b/member/models/forms/RegisterForm.php @@ -120,19 +120,20 @@ class RegisterForm extends BaseModel $t = \Yii::$app->db->beginTransaction(); try { // 确定实际使用的门店ID(履约诊所) - // 在线场景优先使用前端传入的 store_id(如委托诊所);药店复诊再按配置覆盖为委托诊所 + // 在线场景:有委托诊所配置时服务端强制写成委托诊所;发起方写入 origin_store_id $actualStoreId = (int) ($this->store_id ?: \Yii::$app->store); - if ($this->register_type == 3) { + if (in_array((int) $this->register_type, [2, 3], true)) { $currentStore = Store::findOne(\Yii::$app->store); + if ($this->register_type == 2) { + // 诊所在线复诊:发起方诊所校验(会话门店须为诊所) + if ($currentStore && $currentStore->type != 0) { + throw new Exception('诊所在线复诊只能在诊所进行'); + } + } + // type=2/3:配置了委托诊所则履约店强制为委托诊所(不单靠前端传参) if ($currentStore && !empty($currentStore->delegate_store_id)) { $actualStoreId = (int) $currentStore->delegate_store_id; } - } elseif ($this->register_type == 2) { - // 诊所在线复诊:发起方诊所校验(会话门店须为诊所) - $currentStore = Store::findOne(\Yii::$app->store); - if ($currentStore && $currentStore->type != 0) { - throw new Exception('诊所在线复诊只能在诊所进行'); - } } $originStoreId = (int) ($this->origin_store_id ?: \Yii::$app->store);