本文整理汇总了PHP中ExceptionHandler::Response方法的典型用法代码示例。如果您正苦于以下问题:PHP ExceptionHandler::Response方法的具体用法?PHP ExceptionHandler::Response怎么用?PHP ExceptionHandler::Response使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ExceptionHandler
的用法示例。
在下文中一共展示了ExceptionHandler::Response方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_ProvinceCityList
public function get_ProvinceCityList()
{
try {
$List = array();
//{"name":"\u5317\u4eac","citys":[{"10001":"\u5317\u4eac"}]},
$City = array();
$District = array();
$District[] = array('100001' => '海淀');
$District[] = array('100002' => '朝阳');
$City[] = array('100000' => '北京', 'District' => $District);
$Province = array('Province' => '北京', 'City' => $City);
$List[] = $Province;
$City = array();
$District = array();
$District[] = array('200001' => '越秀区');
$District[] = array('200002' => '天河区');
$City[] = array('200000' => '广州', 'District' => $District);
$District = array();
$District[] = array('200011' => '南山区');
$District[] = array('200022' => '福田区');
//$City = array();
$City[] = array('200010' => '深圳', 'District' => $District);
$Province = array('Province' => '广东', 'City' => $City);
$List[] = $Province;
/*
$List = array();
$List[] = array('ProvinceName' => '北京', 'CityName' => array(array('100001' => 'Haidian', '100002' => 'Chaoyang')));
$List[] = array('ProvinceName' => 'HaiNan', 'CityName' => array(array('200001' => 'Haikou', '200002' => 'Sanya')));
$List[] = array('ProvinceName' => 'Guangdong', 'CityName' => array(array('300001' => 'Guangzhou', '300002' => 'Shenzhen')));
*/
//$List[] = array('HaiNan' => array('Haikou', 'Sanya'));
//$List[] = array('Guangdong' => array('Guangzhou', 'Shenzhen'));
$requestBody = array("Count" => 2, "List" => $List);
return json_encode($requestBody);
} catch (Exception $ex) {
return ExceptionHandler::Response($ex, $this->_app);
}
}
示例2: getConsumerFavoriteCount
public function getConsumerFavoriteCount($ConsumerId)
{
try {
$OrderCount = R::getRow('SELECT COUNT(id) AS totalCount FROM consumerfavoriteproduct WHERE consumerid=?', [$ConsumerId]);
echo ResponseJsonHandler::normalizeJsonResponse($OrderCount);
} catch (Exception $ex) {
return ExceptionHandler::Response($ex, $this->_app);
}
}
示例3: verifySmsCode
public function verifySmsCode($SmsCodeId, $UserSmsCode, $Telephone)
{
try {
$producer = R::getRow('SELECT id FROM producersmscode WHERE id=? AND code=? AND telephone=?', array($SmsCodeId, $UserSmsCode, $Telephone));
if (!isset($producer) || empty($producer)) {
throw new RecordNotFoundException("SMS code is incorrect, SmsCodeId:" . $SmsCodeId);
}
//expirationtime > NOW()
$producer = R::getRow('SELECT id FROM producersmscode WHERE id=? AND code=? AND telephone=? AND expirationtime > NOW()', array($SmsCodeId, $UserSmsCode, $Telephone));
if (!isset($producer) || empty($producer)) {
throw new SmsException("SMS expired.");
}
echo json_encode(array("msg" => "success"));
} catch (Exception $ex) {
return ExceptionHandler::Response($ex, $this->_app);
}
}
示例4: get_Images
public function get_Images($ProductId)
{
try {
/*$product = R::find('product', 'ProductId=?', array($ProductId));
echo json_encode(R::exportAll($product));*/
$records = R::getAll('SELECT id, description, bigportraiturl, smallportraiturl FROM productimage WHERE productid=?', array($ProductId));
if (!isset($records) || empty($records)) {
throw new RecordNotFoundException("Record not found, id:" . $ProductId);
}
/*$Count = count($records);
$OrderList = array();
foreach ($records as $record)
{
$List[] = array('Id' => $record['id'], 'description' => $record['description'], 'bigportraiturl' => $record['bigportraiturl'], 'smallportraiturl' => $record['smallportraiturl']);
}
sendSuccess(array(
'Count' => $Count,
'List' => $List,
));*/
$response = new ResponseJSON(["id", "description", "bigportraiturl", "smallportraiturl"]);
foreach ($records as $record) {
$response->appendData($record);
}
//print json_encode($response2->exportResponse())."\n";
echo $response->exportResponse() . "\n";
} catch (Exception $ex) {
return ExceptionHandler::Response($ex, $this->_app);
}
}
示例5: delete_Consignee
public function delete_Consignee($ConsigneeId)
{
try {
$record = R::findOne('consignee', 'id=?', array($ConsigneeId));
if (!isset($record) || empty($record)) {
throw new RecordNotFoundException("Record not found, id:" . $ConsigneeId);
}
R::trash($record);
} catch (Exception $ex) {
return ExceptionHandler::Response($ex, $this->_app);
}
}