UserRoleEnum::DOCTOR],//默认医生会话 ]; } public function attributeLabels() { return [ 'user_id' => '用户端id', 'service_id' => '服务端id', ]; } //创建会话 public function session() { if (!$this->validate()) { throw new Exception($this->getErrorMsg()); } $ims = new ImMessageSession(); $ims->attributes = $this->attributes; $ims->saveOrFail(); return $ims; } }