Authored by Rock Zhang

Merge branch 'develop' of git.dev.yoho.cn:web/yohobuy into develop

framework @ 75bbc3b0
Subproject commit 119c247f5cf929aa1e059e40609bb16dd6b58f05
Subproject commit 75bbc3b075de19f239532f60c5995d06c5f814e2
... ...
... ... @@ -24,7 +24,7 @@ class OrderData
* and open the template in the editor.
*/
public function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid) {
static function getOrderData($type, $page, $limit, $gender, $yh_channel, $uid) {
//构建必传参数
$param = Yohobuy::param();
$param['gender'] = $gender;
... ... @@ -36,7 +36,7 @@ class OrderData
$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(Yohobuy::API_URL2, $param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/*
... ... @@ -45,7 +45,7 @@ class OrderData
* and open the template in the editor.
*/
public function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) {
static function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) {
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['uid'] = $uid;
... ... @@ -62,7 +62,7 @@ class OrderData
* and open the template in the editor.
*/
public function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) {
static function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) {
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['uid'] = $uid;
... ... @@ -74,4 +74,20 @@ class OrderData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/*
* 支付订单
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
static function getPaymentData($contentCode, $gender, $yh_channel) {
$param = Yohobuy::param();
$param['content_code'] = $contentCode;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
//print_r($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param);
}
}
... ...
... ... @@ -55,16 +55,19 @@ function initInfosEvt($container) {
cHammer = new Hammer($container[0]);
//点赞或者收藏事件
cHammer.on('tap', function(e) {
var $this = $(e.target),
opt = 'ok',
$likeBtn,
$collectBtn,
$btn,
$info;
$likeBtn = $this.closest('.like-btn');
if ($likeBtn.length > 0) {
if ($likeBtn.hasClass('like')) {
e.preventDefault();
//点赞
$btn = $this.closest('.like-btn');
if ($btn.length > 0) {
if ($btn.hasClass('like')) {
opt = 'cancel';
}
... ... @@ -80,22 +83,23 @@ function initInfosEvt($container) {
var code = data.code;
if (code === 200) {
$likeBtn.next('.like-count').text(data.data);
$btn.next('.like-count').text(data.data);
//切换点赞状态
$likeBtn.toggleClass('like');
$btn.toggleClass('like');
}
},
error: function() {
tip.show('网络断开连接了~');
}
});
return;
}
// 2015/11/03 hf: 增加APP里的收藏资讯功能. 写得不对的地方还请大神修改!
$collectBtn = $this.closest('.collect-btn');
if ($collectBtn.length > 0) {
if ($collectBtn.hasClass('collected')) {
//APP收藏
$btn = $this.closest('.collect-btn');
if ($btn.length > 0) {
if ($btn.hasClass('collected')) {
opt = 'cancel';
}
... ... @@ -111,7 +115,7 @@ function initInfosEvt($container) {
if (data.code && data.code === 200) {
//切换收藏状态
$collectBtn.toggleClass('collected');
$btn.toggleClass('collected');
}
},
error: function() {
... ...
... ... @@ -6,6 +6,22 @@
var $ = require('jquery');
var info = require('../guang/info');
var $infoList = $('#info-list');
info.initInfoEvt($('#info-list'));
\ No newline at end of file
var winH = $(window).height();
var info = require('../guang/info'),
loadMore = info.loadMore;
var setting = {
page: 2,
end: false
};
info.initInfoEvt($infoList);
$(window).scroll(function() {
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $infoList.height()) {
loadMore($infoList, setting);
}
});
\ No newline at end of file
... ...
... ... @@ -136,8 +136,8 @@ orderHammer.on('tap', function(e) {
success: function(data) {
if (data.code === 200) {
//取消订单
alert('order cancel');
//取消订单页面刷新
location.href = location.href;
}
}
});
... ...
{{> layout/header}}
<div class="my-guang-page yoho-page">
<div class="info-list">
<div id="info-list" class="info-list">
{{# myGuang}}
{{> guang/info}}
{{/ myGuang}}
... ...
... ... @@ -242,4 +242,9 @@
<script>
seajs.use('js/me/address');
</script>
{{/if}}
{{#if myGuangPage}}
<script>
seajs.use('js/me/my-guang');
</script>
{{/if}}
\ No newline at end of file
... ...
... ... @@ -355,7 +355,7 @@ class HomeController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid();
$uid = '7566245'; //临时测试用
$uid = '10267443'; //临时测试用
$data = GradeModel::getGrade($gender, $channel, $uid);
$data['pageFooter'] = true;
$this->_view->display('vip-grade', $data);
... ... @@ -414,7 +414,7 @@ class HomeController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$uid = $this->getUid();
$uid = '7566245'; //测试用
$uid = '10267443'; //测试用
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
//如果没有订单数据,就给一个随便逛逛链接
... ... @@ -450,31 +450,27 @@ class HomeController extends AbstractAction
$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'];
}
$this->echoJson($data);
}
/*
* 我的订单-删除订单
*/
public function deleteOrderAction() {
public function delOrderAction() {
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//传入order_code和uid以删除订单
$order_code = $this->get('orderCode');
$order_code = $this->get('id');
$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'];
}
$this->echoJson($data);
}
/**
... ...
... ... @@ -174,5 +174,8 @@ class OrderModel
}
return $nav;
}
//获得支付链接
}
... ...