コード例 #1
0
 public function handle_request_internal()
 {
     $request = APF::get_instance()->get_request();
     $params = $request->get_parameters();
     $fields = array('commId', 'roomNum', 'fitmentId', 'area');
     $apiParams = array('cityId' => static::$intBrokerCityID, 'brokerId' => static::$intBrokerID, 'operateState' => 1);
     foreach ($fields as $field) {
         if (!isset($params[$field]) || $params[$field] == '') {
             $this->responseJSON('error', array(), '参数不全');
             return;
         }
         $apiParams[$field] = $params[$field];
     }
     try {
         /**
          * @var $result Bll_Service_Client_HttpResponse
          */
         $result = Bll_Service_Image::repeatImgMd5ByBrokerId($apiParams);
         $data = array();
         if ($result->isFailed()) {
             $this->responseJSON('error', $data, '调用API超时');
             return;
         }
         if ($result['status'] != 'ok') {
             $this->responseJSON('error', $data, '调用API失败');
             return;
         }
         foreach ($result['imgMd5'] as $imgMd5) {
             $pathPart = explode('/', $imgMd5['path']);
             if (isset($pathPart[1]) && strlen($pathPart[1])) {
                 $data[$pathPart[1]] = 1;
             }
         }
         $this->responseJSON('ok', $data, '');
     } catch (Exception $e) {
         $this->responseJSON('error', array(), '参数错误');
     }
 }