Authored by yangyang

修改了home.php,增加了order控制器。增加了orderdata.php和模型层order.php

<?php
namespace LibModels\Wap\Home;
use Api\Yohobuy;
use Api\Sign;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of OrderData
*
* @author Administrator
*/
class OrderData
{
/*
* 获取订单数据
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public function getOrderData($type,$page,$limit,$gender,$yh_channel,$uid){
$param = Yohobuy::param();
$param['gender'] = $gender;
$param['limit'] = $limit;
$param['method'] = 'app.SpaceOrders.get';
$param['page'] = $page;
$param['type'] = $type;
$param['uid'] = $uid;
$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
print_r($param);
return Yohobuy::get(Yohobuy::API_URL,$param);
}
}
... ...
... ... @@ -2,6 +2,7 @@
use Action\AbstractAction;
use home\GradeModel;
use home\OrderModel;
use Plugin\Helpers;
/**
... ... @@ -290,4 +291,31 @@ class HomeController extends AbstractAction
$this -> _view -> display('privilege',$data);
}
/*
*我的订单页面
*/
public function orderAction(){
do{
//判断是不是ajax请求
// if(!$this -> isAjax()){
// break;
// }
//判断参数是否有效
$type = $this -> get('type',1);
$page = $this -> get('page',1);
$limit = $this -> get('limit',10);
$gender = Helpers::getGenderByCookie();
$yh_channel = $this -> get('yh_channel',1);
$uid = $this -> getUid();
if(!empty($type) && !is_numeric($type)){
break;
}
//$data = OrderModel::getOrder();
$data = OrderModel::getOrder($type,$page,$limit,$gender,$yh_channel,$uid);
//print_r($data);
}
while(false);
//$this -> _view -> display('order',$data);
}
}
... ...
<?php
namespace home;
use LibModels\Wap\Home\OrderData;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of Order
*
*/
class OrderModel
{
/**
* 订单相关数据处理
*/
public function getOrder($type = 1,$page = 1,$limit,$gender,$yh_channel,$uid){
$data = OrderData::getOrderData($type,$page,$limit,$gender,$yh_channel,$uid);
return $data;
}
}
... ...