public function handle_request_internal() { $brokerId = $this->_params['brokerId']; $brokerInfo = Model_Broker_AjkBrokerExtend::findWithBrokerId($brokerId); if (!$brokerInfo) { throw new Exception_BrokerNotFoundException('经纪人不存在', Const_APIStatus::E_BROKER_NOT_EXISTS); } //名片格式 $bnsCardFileJson = json_decode($this->_params['bnsCardFile'], true); $size = $bnsCardFileJson['size']; $width = $bnsCardFileJson['width']; $height = $bnsCardFileJson['height']; $format = $bnsCardFileJson['format']; //判断图片大小,格式是否正确 if ($size > 614400 || $size < 20480) { throw new Exception_Broker_UpLoadFailed('pic_error,文件应大于20KB,小于600KB'); } elseif ($width < 300 || $height < 200) { throw new Exception_Broker_UpLoadFailed('pic_error,图片应大于300*200像素'); } elseif (!in_array($format, array('JPEG', 'JPG', 'GIF', 'PNG'))) { throw new Exception_Broker_UpLoadFailed('pic_error,图片限jpg、jpeg、gif、png格式'); } //上传名片接口 $bnsCardFile = 'display/' . $bnsCardFileJson['hash'] . '_' . $bnsCardFileJson['host']; //$bnsCardFile = 'c9ed1c5f41cd95df97391e5e60ab3c96_1'; $setBizCard = Bll_BrokerBaseBll::setBizCard($brokerId, $brokerInfo->cityId, $brokerInfo->areaCode, $brokerInfo->userMobile, '', $bnsCardFile, $brokerInfo->companyId, $brokerInfo->cstBrokerCompanyId); if ($setBizCard == 1) { return array('status' => Const_APIStatus::RETURN_CODE_OK, 'data' => array('status' => 1)); } else { throw new Exception_Broker_UpLoadApiFailed($setBizCard['message']); } }