コード例 #1
0
ファイル: Common.php プロジェクト: WTer/NJB
 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
0
ファイル: Favorite.php プロジェクト: WTer/NJB
 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
0
ファイル: Producer.php プロジェクト: WTer/NJB
 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
0
ファイル: Product.php プロジェクト: WTer/NJB
 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
0
ファイル: Order.php プロジェクト: WTer/NJB
 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);
     }
 }