Пример #1
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $customerId = $this->_params['customerId'];
     $pushDate = $this->_params['pushDate'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     // 判断经纪人和客户之间关系是否存在(给定日期)
     $relation = Model_Mobile_BrokerUserRelation::getBrokerCustomerRelationWithDate($brokerId, $customerId, $pushDate);
     if (!$relation) {
         throw new Exception_CustomerRush_RelationNotFound("BrokerId: {$brokerId}; CustomerId: {$customerId}; Date: {$pushDate}");
     }
     // 判断经纪人和客户是否已经有效锁定(未过期临时锁定 或 永久锁定)
     $status = intval($relation->isLocked());
     if ($status) {
         if ($relation->isTempLocked()) {
             $statusMsg = '临时锁定';
         } else {
             $statusMsg = '永久锁定';
         }
     } else {
         $statusMsg = '客户失效了 重新抢吧';
     }
     return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => $status, 'statusMsg' => $statusMsg));
 }