public static function &getInstance()
 {
     if (self::$_instance === null) {
         self::$_instance = new self();
     }
     return self::$_instance;
 }
Esempio n. 2
0
 public function handle_request_internal()
 {
     $brokerId = $this->_params['brokerId'];
     $customerId = $this->_params['customerId'];
     // 判断经纪人是否存在
     $broker = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId);
     if (!$broker) {
         throw new Exception_Broker_NotFound('BrokerId: ' . $brokerId);
     }
     $customer = Model_Mobile_BrokerUserRelationSub::getStatusByCustomerIdBrokerId($brokerId, $customerId);
     if (empty($customer)) {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'message' => 'customerId不存在');
     }
     $rs = Model_Mobile_BrokerUserRelationSub::updateStatus($customer['brokerId'], $customer['userDeviceId']);
     if ($rs) {
         $date = date('Ymd');
         Model_Mobile_CustomerUserRushedCount::updateCustomerNum($customer['userDeviceId'], $date);
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '释放成功'));
     } elseif ($rs == 0) {
         return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('message' => '已经释放'));
     } else {
         return array('status' => Const_APIStatus::RETURN_CODE_ERROR, 'message' => '释放失败');
     }
 }
Esempio n. 3
0
 public function handle_request()
 {
     // 获取
     $now = date('Y-m-d H:i:s');
     if ($this->time) {
         $tmpTime = $this->time;
     } else {
         $tmpTime = date('Y-m-d H:i:s', strtotime($now) - 3600);
     }
     //        $id = $this->getLastJobId();
     $customers = Model_Mobile_BrokerUserRelationSub::getBrokerUserRelationSubList($tmpTime, $now, $this->per);
     if (empty($customers)) {
         $this->setMyFlag(0, 'over');
         echo date("Y-m-d H:i:s") . '没有处理数据了' . "\n";
         exit;
     }
     // 筛选
     $ids = array();
     foreach ($customers as $val) {
         if ($val['status'] == 1) {
             $ids[] = array('id' => $val['id'], 'customerId' => $val['userDeviceId'], 'tempLockExpireTime' => $val['tempLockExpireTime']);
         }
     }
     // update
     if ($ids) {
         foreach ($ids as $key => $val) {
             Model_Mobile_BrokerUserRelationSub::updateBrokerUserRelationSub($val['id']);
             //update customer_user_rushed_count_201502分表
             $date = date('Ymd', strtotime($val['tempLockExpireTime']));
             $customerId = $val['customerId'];
             Model_Mobile_CustomerUserRushedCount::updateCustomerNum($customerId, $date);
             $this->setMyFlag($val['id']);
         }
         $this->log(sprintf("[%s] - Update (%d) rows - [%s]", date('Y-m-d H:i:s'), $this->per, json_encode($ids)));
     }
 }
Esempio n. 4
0
 public function updateCustomerRushedCount($keyData, $data, $tableYearMonth)
 {
     return Model_Mobile_CustomerUserRushedCount::getInstance()->updateData($keyData, $data, $tableYearMonth);
 }