private function checkCanUserReply(DoctorPatientRef $ref) { $followupOwner = $ref->getFollowupOwner(); $space = $ref->space; $canReplyFollowupOwner = false == $followupOwner->isNull() && $followupOwner->isOpenFollowup(); $doctorChargeFlowProduct = ProductClient::getInstance()->getDoctorChargeFlowProduct($ref->space); $message = ''; if (false == $canReplyFollowupOwner && false == $space->isCaseOpen()) { $message = '医生已经关闭了咨询区,您暂时不能向医生提问'; } elseif ($ref->isClosePost()) { $message = '医患关系已关闭,无法继续交流'; } elseif ($space->isChargeOpened() && $ref->isSpaceCanPost() == false && $doctorChargeFlowProduct instanceof Product && false == $ref->hasSpaceLeftAllowCnt()) { $message = '您和医生的交流次数已用完'; } return $message; }
private function spaceReplyCase4Flow(DoctorPatientRef $ref, $options, $attachmentIds, $user, $content) {/*{{{*/ if(false == $ref->isSpaceCanPost()) { $this->setErrorCode(842); return 0; } if ($ref->isClosePost()) { DoctorPatientPostClient::getInstance()->switchPatientPostCan($ref->space->user->id, $ref->id); } if($ref->replyLimitationIsApproaching()) { $option['removeReplyLimitation'] = isset($options['removeReplyLimitation']) ? $options['removeReplyLimitation'] : 0; } if(isset($option['removeReplyLimitation']) && $option['removeReplyLimitation']) { if($ref->space->isChargeOpened()) { //当是收费咨询的时候,取消remove参数。因为传0或者1都会在addPost再次改变次数 unset($option['removeReplyLimitation']); FlowClient::getInstance()->addFreeServcieCardBySystem($ref); } } //加入默认患友会 if($user->id == $ref->space->user->id && $ref->space->isPatientOpened() && $ref->isReGroupMember() == false) { FlowClient::getInstance()->addUserToDefaultReGroup($ref->id, $user->id); } $attachmentIds = explode(',', $attachmentIds); $option['attachmentIds'] = $attachmentIds; if(isset($options['isPrivated']) && $options['isPrivated']) { $option['isPrivated'] = true; } $post = DoctorPatientPostClient::getInstance()->addPost($ref->id, $user->id, $content, $option); DBC::requireFalse($post->isNull(), '系统繁忙,请稍后重试'); if (false == $post->isNull()) { ScoreClient::getInstance()->replyForFlow($user, $ref); } try{ FlowClient::getInstance()->addLog($ref, $user, DoctorPatientLog::TYPE_SYSTEM_LOG, 'CaseDataBucket::spaceReplyCase', $post); }catch(Exception $ex) {} return $post; }/*}}}*/