Authored by yangyang

home中增加了取消订单,删除订单控制器,和接口处理

... ... @@ -39,4 +39,39 @@ class OrderData
return Yohobuy::get(Yohobuy::API_URL2, $param);
}
/*
* 取消订单
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) {
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['method'] = $method;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/*
* 删除订单
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) {
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['uid'] = $uid;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['method'] = $method;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -4,6 +4,7 @@ use Action\AbstractAction;
use home\GradeModel;
use home\OrderModel;
use Plugin\Helpers;
use LibModels\Wap\Home\OrderData;
/**
* 个人中心相关的控制器
... ... @@ -44,8 +45,7 @@ class HomeController extends AbstractAction
/**
* 用户订单
*/
public function ordersAction()
{
public function ordersAction() {
// 设置网站标题
$this->setTitle('我的订单');
$this->setNavHeader('我的订单', true, SITE_MAIN);
... ... @@ -131,7 +131,7 @@ class HomeController extends AbstractAction
),
'hasFavBrand' => array(
'0' => array(
'id'=> '1',
'id' => '1',
'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'brandName' => 'VANS',
'update' => 12,
... ... @@ -161,7 +161,7 @@ class HomeController extends AbstractAction
)
),
'1' => array(
'id'=> '2',
'id' => '2',
'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'brandName' => 'VANS',
'update' => 12,
... ... @@ -191,7 +191,7 @@ class HomeController extends AbstractAction
)
),
'2' => array(
'id'=> '3',
'id' => '3',
'brandImg' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'brandName' => 'VANS',
'update' => 12,
... ... @@ -441,12 +441,10 @@ class HomeController extends AbstractAction
));
}
/**
* 意见反馈-提交表单
*/
public function suggest_subAction()
{
public function suggest_subAction() {
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 30);
... ... @@ -464,15 +462,13 @@ class HomeController extends AbstractAction
'suggestSub' => true,
'pageFooter' => true
));
}
/**
* 异步保存意见反馈数据
*/
public function savesuggestAction()
{
if($this->isAjax()) {
public function savesuggestAction() {
if ($this->isAjax()) {
$uid = $this->getUid();
$content = $this->post('content', '');
$suggest_type = $this->get('suggest_type', 2);
... ... @@ -503,6 +499,7 @@ class HomeController extends AbstractAction
/*
* 会员特权查看页
*/
public function preferentialAction() {
//设置网站seo信息
$this->setTitle('会员等级');
... ... @@ -519,7 +516,12 @@ class HomeController extends AbstractAction
/*
* 我的订单页面
*/
public function orderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
$type = $this->get('type', 1);
$page = $this->get('page', 1);
... ... @@ -528,8 +530,8 @@ class HomeController extends AbstractAction
$yh_channel = $this->get('yh_channel', 1);
$uid = $this->getUid();
$uid = '7566245'; //测试用
$this -> setTitle('我的订单');
$this -> setNavHeader('我的订单');
$this->setTitle('我的订单');
$this->setNavHeader('我的订单');
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
//如果没有订单数据,就给一个随便逛逛链接
... ... @@ -549,15 +551,48 @@ class HomeController extends AbstractAction
}
/*
* 我的订单-处理ajax请求页面(切换订单状态)
* 我的订单-取消订单
*/
public function cancelOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//传入order_code和uid以取消订单
$order_code = $this->get('orderCode');
$uid = $this->getUid();
$uid = '10267443'; //测试用
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.close';
$data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method);
if ($data['code'] == 200) {
echo $data['message'];
}
}
/*
* 我的订单-删除订单
*/
public function getOrdersAction() {
public function deleteOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
self::orderAction();
//传入order_code和uid以删除订单
$order_code = $this->get('orderCode');
$uid = $this->getUid();
$uid = '10267443'; //测试用
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.delOrderByCode';
$data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method);
if ($data['code'] == 200) {
echo $data['message'];
}
}
}
... ...