Authored by yangyang

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

  1 +<?php
  2 +
  3 +namespace LibModels\Wap\Home;
  4 +
  5 +use Api\Yohobuy;
  6 +use Api\Sign;
  7 +/*
  8 + * To change this license header, choose License Headers in Project Properties.
  9 + * To change this template file, choose Tools | Templates
  10 + * and open the template in the editor.
  11 + */
  12 +
  13 +/**
  14 + * Description of OrderData
  15 + *
  16 + * @author Administrator
  17 + */
  18 +class OrderData
  19 +{
  20 + /*
  21 + * 获取订单数据
  22 + * To change this template file, choose Tools | Templates
  23 + * and open the template in the editor.
  24 + */
  25 + public function getOrderData($type,$page,$limit,$gender,$yh_channel,$uid){
  26 + $param = Yohobuy::param();
  27 + $param['gender'] = $gender;
  28 + $param['limit'] = $limit;
  29 + $param['method'] = 'app.SpaceOrders.get';
  30 + $param['page'] = $page;
  31 + $param['type'] = $type;
  32 + $param['uid'] = $uid;
  33 + $param['yh_channel'] = $yh_channel;
  34 + $param['client_secret'] = Sign::getSign($param);
  35 + print_r($param);
  36 + return Yohobuy::get(Yohobuy::API_URL,$param);
  37 + }
  38 +}
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 use Action\AbstractAction; 3 use Action\AbstractAction;
4 use home\GradeModel; 4 use home\GradeModel;
  5 +use home\OrderModel;
5 use Plugin\Helpers; 6 use Plugin\Helpers;
6 7
7 /** 8 /**
@@ -290,4 +291,31 @@ class HomeController extends AbstractAction @@ -290,4 +291,31 @@ class HomeController extends AbstractAction
290 $this -> _view -> display('privilege',$data); 291 $this -> _view -> display('privilege',$data);
291 } 292 }
292 293
  294 + /*
  295 + *我的订单页面
  296 + */
  297 + public function orderAction(){
  298 +
  299 + do{
  300 + //判断是不是ajax请求
  301 +// if(!$this -> isAjax()){
  302 +// break;
  303 +// }
  304 + //判断参数是否有效
  305 + $type = $this -> get('type',1);
  306 + $page = $this -> get('page',1);
  307 + $limit = $this -> get('limit',10);
  308 + $gender = Helpers::getGenderByCookie();
  309 + $yh_channel = $this -> get('yh_channel',1);
  310 + $uid = $this -> getUid();
  311 + if(!empty($type) && !is_numeric($type)){
  312 + break;
  313 + }
  314 + //$data = OrderModel::getOrder();
  315 + $data = OrderModel::getOrder($type,$page,$limit,$gender,$yh_channel,$uid);
  316 + //print_r($data);
  317 + }
  318 + while(false);
  319 + //$this -> _view -> display('order',$data);
  320 + }
293 } 321 }
  1 +<?php
  2 +
  3 + namespace home;
  4 +
  5 + use LibModels\Wap\Home\OrderData;
  6 +/*
  7 + * To change this license header, choose License Headers in Project Properties.
  8 + * To change this template file, choose Tools | Templates
  9 + * and open the template in the editor.
  10 + */
  11 +
  12 +/**
  13 + * Description of Order
  14 + *
  15 + */
  16 +class OrderModel
  17 +{
  18 +
  19 + /**
  20 + * 订单相关数据处理
  21 + */
  22 + public function getOrder($type = 1,$page = 1,$limit,$gender,$yh_channel,$uid){
  23 +
  24 + $data = OrderData::getOrderData($type,$page,$limit,$gender,$yh_channel,$uid);
  25 +
  26 + return $data;
  27 + }
  28 +
  29 +}