Authored by 梁志锋

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

... ... @@ -1043,8 +1043,11 @@
### 我的逛
{
myGuang: [
{...} //逛资讯
..
]
myGuang: {
infos: [
{...} //逛资讯
..
],
//若无收藏则不传infos
}
}
\ No newline at end of file
... ...
... ... @@ -29,7 +29,6 @@ class GuangData
$param['limit'] = $limit;
$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
// return Yohobuy::post(Yohobuy::API_URL, $param);
return Yohobuy::post(Yohobuy::SERVICE_URL . self::GUANG_URI . 'getUserFavArticleList', $param);
}
... ...
... ... @@ -46,6 +46,7 @@ class OrderData
*/
static function cancelOrderData($order_code, $uid, $gender, $yh_channel, $method) {
//构建必传参数
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['uid'] = $uid;
... ... @@ -53,6 +54,7 @@ class OrderData
$param['yh_channel'] = $yh_channel;
$param['method'] = $method;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ... @@ -63,6 +65,7 @@ class OrderData
*/
static function deleteOrderData($order_code, $uid, $gender, $yh_channel, $method) {
//构建必传参数
$param = Yohobuy::param();
$param['order_code'] = $order_code;
$param['uid'] = $uid;
... ... @@ -70,23 +73,56 @@ class OrderData
$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.
*/
static function getPaymentData($contentCode, $gender, $yh_channel) {
static function LogisticsData() {
//构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.express.li';
//$param['gender'] = $gender;
//$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get('http://api.open.yohobuy.com/', $param);
}
/*
* 支付url
* To change this template file, choose Tools | Templates
*/
static function paymentData($gender, $yh_channel, $code) {
//构建必传参数
$param = Yohobuy::param();
$param['content_code'] = $contentCode;
$param['content_code'] = $code;
$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);
}
/*
* 随便逛逛url
* To change this template file, choose Tools | Templates
*/
static function strollData($gender, $yh_channel, $code) {
//构建必传参数
$param = Yohobuy::param();
$param['content_code'] = $code;
$param['gender'] = $gender;
$param['yh_channel'] = $yh_channel;
$param['client_secret'] = Sign::getSign($param);
//调用接口获得数据
return Yohobuy::get(Yohobuy::SERVICE_URL . '/operations/api/v5/resource/get', $param);
}
... ...
... ... @@ -329,11 +329,12 @@ class UserData
* @param int $suggest_type 意见类型
* @return array 意见反馈接口返回的数据
*/
public static function savesuggestData($uid, $content, $suggest_type, $limit = 30)
public static function savesuggestData($uid, $content, $suggest_type)
{
$param = Yohobuy::param();
$param['uid'] = $uid;
$param['content'] = $content;
$param['suggest_type'] = $suggest_type;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::SERVICE_URL . 'suggest/api/v1/suggest/saveSuggest', $param);
... ...
... ... @@ -24,9 +24,6 @@ class Images
),
'yhb-head' => 'head.static.yhbimg.com'
);
private static $staticDomain = array(
'bucket' => ''
);
private static $qiniuDomain = 'yhfair.qiniudn.com';
/**
... ... @@ -171,7 +168,7 @@ class Images
$stream .= $twoHyphens.$boundary.$end;
$stream .="Content-Disposition: form-data; "."name=\"project\"".$end;
$stream .= $end;
$stream .= "sns";//project sns
$stream .= "suggest";//project sns
$stream .= $end;
$stream .= $twoHyphens .$boundary .$twoHyphens .$end;
$opts = array(
... ... @@ -185,7 +182,18 @@ class Images
$result = json_decode(file_get_contents('http://upload.static.yohobuy.com', false, $context), true);
if(!empty($result['data']['imagesList']))
{
return count($file) == 1 || !is_array($file) ? current($result['data']['imagesList']) : $result['data']['imagesList'] ;
if(count($file) == 1 || !is_array($file))
{
return self::getSourceUrl(current($result['data']['imagesList']), 'suggest');
}
else
{
foreach ($result['data']['imagesList'] as &$val) {
$val = self::getSourceUrl($val, 'suggest');
}
return $result['data']['imagesList'];
}
}
else
{
... ...
... ... @@ -5,7 +5,8 @@
*/
var $ = require('jquery');
var $footer = $('#yoho-footer');
var $footer = $('#yoho-footer'),
$header = $('.yoho-header');
function cookie(name) {
var cookies = document.cookie,
... ... @@ -152,6 +153,13 @@ function rePosFooter() {
}
}());
$header.on('touchstart', 'a', function() {
$header.find('a').removeClass('highlight');
$(this).addClass('highlight');
}).on('touchend touchcancel', 'a', function() {
$(this).removeClass('highlight');
});
//暴露公共接口
window.cookie = cookie;
... ...
... ... @@ -130,8 +130,11 @@ function initInfosEvt($container) {
/**
* 资讯LoadMore
* @param $container 资讯容器 jqyeryObject
* @param opt 请求参数
* @param url[可选], 扩展请求的url而不使用默认值
*/
function loadMore($container, opt) {
function loadMore($container, opt, url) {
var num;
if (searching) {
... ... @@ -152,7 +155,7 @@ function loadMore($container, opt) {
searching = true;
$.ajax({
type: 'GET',
url: ' /guang/index/page',
url: url ? url : '/guang/index/page',//对于指定url的使用指定url(存在不同的控制器)
data: opt,
success: function(data) {
var $newItems;
... ...
... ... @@ -214,8 +214,13 @@ function tsAnimate() {
setTimeout(tsAnimate, 3000);
// 底部留出tab 的高度
$('.home-header .search-btn').on('touchstart', function() {
$(this).addClass('highlight');
}).on('touchend touchcancel', function() {
$(this).removeClass('highlight');
});
// 底部留出tab 的高度
$('#yoho-footer').css({
'margin-bottom': '2.5rem'
});
... ...
... ... @@ -6,28 +6,22 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload'),
Swiper = require('yoho.iswiper');
//导航
var $navLi = $('#fav-tab > li'),
$favContainer = $('.fav-content');
var $curContainer = $favContainer.children('.fav-type').first();//保存当前显示的$favContainer
var favTabHammer;
//轮播图
var $swiperList = $('.swiper-container'),
swiperArray = [],
swiperObj = {};
//lazyLoad();
$favContainer = $('.fav-content'),
$curContainer = $favContainer.children('.fav-type').first(),
$swiperList = $('.swiper-container'),
swiperObj = {},
favTabHammer,
favContentHammer;
favTabHammer = new Hammer(document.getElementById('fav-tab'));
favTabHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
index;
index,
id,
i;
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
... ... @@ -42,9 +36,10 @@ favTabHammer.on('tap', function(e) {
$curContainer = $favContainer.children(':eq(' + index + ')').removeClass('hide');
if (index === 1) {
//导航
for (var i = 0; i < $swiperList.length; i++) {
var id = $swiperList.eq(i).attr('data-id');
for (i = 0; i < $swiperList.length; i++) {
id = $swiperList.eq(i).attr('data-id');
swiperObj[id] = new Swiper('#swiper-container-' + id, {
slidesPerView: 'auto',
grabCursor: true,
... ... @@ -57,3 +52,31 @@ favTabHammer.on('tap', function(e) {
}
});
//删除收藏的商品
favContentHammer = new Hammer(document.getElementById('fav-content'));
favContentHammer.on('tap', function (e) {
var id = '';
if ($(e.target).hasClass('del-fav')) {
id = $(e.target).closest('li').attr('data-id');
$.ajax({
method: 'post',
url: '/home/favoriteDel',
data: {
id: id
}
}).then(function (data) {
if (data.code === 200) {
$(e.target).closest('li').remove();
}
}).fail(function () {
//TODO
});
}
});
\ No newline at end of file
... ...
... ... @@ -18,10 +18,13 @@ var setting = {
end: false
};
info.initInfoEvt($infoList);
//对于有逛收藏的页面进行事件处理
if ($infoList.length > 0) {
info.initInfosEvt($infoList);
$(window).scroll(function() {
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $infoList.height()) {
loadMore($infoList, setting);
}
});
\ No newline at end of file
$(window).scroll(function() {
if ($(window).scrollTop() + winH >= $(document).height() - 0.25 * $infoList.height()) {
loadMore($infoList, setting, '/home/myguang');
}
});
}
\ No newline at end of file
... ...
... ... @@ -7,21 +7,59 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
lazyLoad = require('yoho.lazyload');
Handlebars = require('yoho.handlebars');
var $uploadImgList = $('.upload-img-list'),
headerNavHammer,
imgTpl,
template;
require('./jquery.uploadifive');
$('#upload-img').uploadifive({
auto: true,
buttonClass: 'nav-btn',
fileType: 'image/*',
fileType: 'image*/*',
uploadScript: '/home/suggestimgUpload',
fileObjName: 'fileData',
fileSizeLimit: 1024,
onAddQueueItem: function (file) {
console.log(file);
height: '100%',
width: '100%',
onAddQueueItem: function (files) {
//TODO
},
onQueueComplete: function (file) {
console.log(file);
onUploadComplete: function (file, data) {
$uploadImgList.html(template(data));
}
});
imgTpl = '{{# imgList}}' +
'<li><img src="{{imgUrl}}" /></li>' +
'{{/ imgList}}';
template = Handlebars.compile(imgTpl);
headerNavHammer = new Hammer(document.getElementById('yoho-header'));
headerNavHammer.on('tap', function (e) {
var suggestText = $('#suggest-textarea').val();
if ($(e.target).hasClass('nav-btn')) {
$.ajax({
method: 'post',
url: '/home/savesuggest',
data: {
content: suggestText
}
}).then(function (data) {
//TODO
}).fail(function () {
//TODO
});
}
});
\ No newline at end of file
... ...
... ... @@ -79,19 +79,4 @@
.info-list.hide {
display: none;
}
.load-more-info {
width: 100%;
height: 70rem / $pxConvertRem;
line-height: 70rem / $pxConvertRem;
text-align: center;
font-size: 14px;
overflow: hidden;
.status {
&.hide {
display: none;
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -63,11 +63,21 @@
.search-btn {
position: absolute;
right: 32rem / $pxConvertRem;
right: 0;
top: 0;
bottom: 0;
a{
width: 90rem / $pxConvertRem;
height: 90rem / $pxConvertRem;
text-align: center;
a {
display: block;
color: #fff;
font-size: 40rem / $pxConvertRem;
line-height: 90rem / $pxConvertRem;
}
&.highlight {
background: rgba(200,200,200,.4);
}
}
}
... ...
... ... @@ -51,20 +51,6 @@
color: #000;
}
}
.load-more-info {
width: 100%;
height: 70rem / $pxConvertRem;
line-height: 70rem / $pxConvertRem;
text-align: center;
font-size: 14px;
overflow: hidden;
.status {
&.hide {
display: none;
}
}
}
}
.load-more-img {
... ...
... ... @@ -108,6 +108,21 @@ a {
@include border-radius(10px);
}
.load-more-info {
width: 100%;
height: 70rem / $pxConvertRem;
line-height: 70rem / $pxConvertRem;
text-align: center;
font-size: 14px;
overflow: hidden;
.status {
&.hide {
display: none;
}
}
}
/*px转化rem*/
@function pxToRem($px) {
$pxConvertRem: 40px;
... ...
... ... @@ -24,26 +24,31 @@
background: #4f4138;
}
.nav-back {
a.highlight {
background: rgba(200,200,200,.1);
}
%nav {
display: block;
position: absolute;
left: 34rem / $pxConvertRem;
top: 28rem / $pxConvertRem;
width: 18rem / $pxConvertRem;
height: 32rem / $pxConvertRem;
background: image-url('layout/back.png') no-repeat;
background-size: 100% 100%;
top: 0;
width: 90rem / $pxConvertRem;
height: 90rem / $pxConvertRem;
font-size: 40rem / $pxConvertRem;
line-height: 90rem / $pxConvertRem;
color: #fff;
text-align: center;
outline: none;
}
.nav-back {
@extend %nav;
left: 0;
}
.nav-home {
position: absolute;
top: 28rem / $pxConvertRem;
right: 34rem / $pxConvertRem;
width: 20px;
height: 20px;
background: image-url('layout/home.png') no-repeat;
background-size: 100% 100%;
outline: none;
@extend %nav;
right: 0;
}
.nav-title {
... ...
$fav: sprite-map("me/fav/*.png",$spacing: 5px);
.yoho-favorite-page {
width: 100%;
height: auto;
... ...
$vip: sprite-map("me/vip/*.png", $spacing: 10px);
$fav: sprite-map("me/fav/*.png", $spacing: 5px);
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service";
@import "home", "vip-grade", "order", "order-detail", "coupons", "personal-details", "yoho-coin", "fav", "suggest", "address", "online-service", "my-guang";
... ...
.my-guang-page {
.null {
height: 240rem / $pxConvertRem;
width: 100%;
position: absolute;
text-align: center;
top: 50%;
margin-top: -120rem / $pxConvertRem;
span {
color: #b0b0b0;
font-size: 24rem / $pxConvertRem;
margin-top: 20rem / $pxConvertRem;
}
}
.icon-null {
width: pxToRem(188px);
height: pxToRem(171px);
@include rem-sprite($fav, fav-null);
margin: 0 auto;
margin-bottom: 30rem / $pxConvertRem;
}
}
\ No newline at end of file
... ...
... ... @@ -156,12 +156,34 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
.img-form {
padding: 0 pxToRem(30px);
.upload-img-list {
float: left;
> li {
display: block;
width: pxToRem(130px);
height: pxToRem(130px);
overflow: hidden;
float: left;
margin-right: pxToRem(30px);
> img {
display: block;
width: 100%;
height: 100%;
overflow: hidden;
}
}
}
.img-add {
display: block;
width: pxToRem(130px);
height: pxToRem(130px);
border: 1px dashed #e0e0e0;
position: relative;
text-indent: -1000px;
float: left;
&:after {
$width: pxToRem(image_width(sprite-file($suggest, suggest-add)));
... ... @@ -180,7 +202,7 @@ $suggest: sprite-map("me/suggest/*.png",$spacing: 5px);
margin-left: -$width / 2;
}
> input[type="file"] {
input[type="file"], {
position: absolute;
//@include stretch();
@include opacity(0.2);
... ...
... ... @@ -5,11 +5,11 @@
<li class="active">收藏的商品</li>
<li>收藏的品牌</li>
</ul>
<div class="fav-content">
<div class="fav-content" id="fav-content">
<div class="fav-type">
<ul class="fav-product-list">
{{# hasFavProduct}}
<li>
<li data-id="{{fav_id}}">
<div class="fav-img-box">
<img src="{{imgUrl}}" alt=""/>
</div>
... ...
{{> me/my-guang/infos}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="my-guang-page yoho-page">
<div id="info-list" class="info-list">
{{# myGuang}}
{{> guang/info}}
{{/ myGuang}}
</div>
{{# myGuang}}
{{#if infos}}
<div id="info-list" class="info-list">
{{> me/my-guang/infos}}
</div>
<div id="load-more-info" class="load-more-info">
<div class="loading status hide">
正在加载...
</div>
<span class="no-more status">没有更多啦</span>
</div>
{{^}}
<div class="null">
<div class="icon-null"></div>
<span>您当前还未收藏任何资讯!</span>
</div>
{{/if}}
{{/ myGuang}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
{{> layout/header}}
<div class="yoho-suggest-sub-page yoho-page">
{{# suggestSub}}
<div class="suggest-sub-form"
data-version="{{param.app_version}}"
data-type="{{param.client_type}}"
data-os-version="{{param.os_version}}"
data-screen-size="{{param.screen_size}}"
data-v="{{param.v}}"
data-project="{{param.project}}"
data-client-secret="{{param.client_secret}}">
<div class="suggest-sub-form">
<textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea>
<div class="img-form">
<ul class="upload-img-list"></ul>
<span class="img-add">
<input id="upload-img" type="file" name="fileselect[]" multiple />
<input id="upload-img" type="file" multiple />
</span>
</div>
</div>
... ...
... ... @@ -16,8 +16,8 @@
<script src="http://static.buy.test.yoho.cn/dist/myohobuy/{{version}}/index-debug.js"></script>
{{/if}}
{{#if devEnv}}
<script src="http://localhost:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://localhost:8000/'});</script>
<script src="http://172.16.6.204:8000/static/js/sea.js?nowrap"></script>
<script>seajs.config({base: 'http://172.16.6.204:8000/'});</script>
{{/if}}
<script type="text/javascript">
(function(w,d,s,j,f){
... ...
{{#pageHeader}}
<header class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}">
<header id="yoho-header" class="yoho-header{{#if boys}} boys{{/if}}{{#if girls}} girls{{/if}}{{#if kids}} kids{{/if}}{{#if lifeStyle}} life-style{{/if}}">
{{#if navBack}}
<a href="javascript:history.go(-1);" class="nav-back"></a>
<a href="javascript:history.go(-1);" class="iconfont nav-back">&#xe610;</a>
{{/if}}
{{#navHome}}
<a href="{{.}}" class="nav-home"></a>
<a href="{{.}}" class="iconfont nav-home">&#xe611;</a>
{{/navHome}}
{{#navTitle}}
<p class="nav-title">{{.}}</p>
... ...
{{#each infos}}
{{> guang/info}}
{{/each}}
\ No newline at end of file
... ...
... ... @@ -68,13 +68,14 @@ class HomeController extends AbstractAction
$this->setTitle('我的收藏');
$this->setNavHeader('我的收藏', true, SITE_MAIN);
$tab = $this->get('tab', '');
$tab = $this->get('tab', '');
$uid = $this->getUid();
$uid = 8826435;
$gender = Helpers::getGenderByCookie();
$favProducts = \Index\UserModel::getFavProductData($uid);
$favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
$data = array(
'favPage' => true, //加载js
'pageFooter' => true,
... ... @@ -82,7 +83,7 @@ class HomeController extends AbstractAction
'hasFavProduct' => $favProducts,
'hasFavBrand' => $favBrands
);
// 判断时候为品牌
// 判断是否为品牌收藏
if ($tab === 'brand') {
$data['brandTab'] = true;
}
... ... @@ -97,16 +98,20 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax()) {
if ($this->isAjax())
{
$uid = $this->getUid();
$fav_id = $this->post('fav_id', 0);
$result = \Index\UserModel::favoriteDelete($uid, $fav_id);
}
if (empty($result)) {
if (empty($result))
{
echo ' ';
} else {
}
else
{
$this->echoJson($result);
}
}
... ... @@ -207,7 +212,8 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax()) {
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
$address = $this->post('address', '');
... ... @@ -221,9 +227,12 @@ class HomeController extends AbstractAction
$result = \Index\UserModel::saveAddressData($uid, $address, $area_code, $consignee, $email, $id, $mobile, $zip_code);
}
if (empty($result)) {
if (empty($result))
{
echo ' ';
} else {
}
else
{
$this->echoJson($result);
}
}
... ... @@ -235,7 +244,8 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax()) {
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
$id = $this->post('id', '');
... ... @@ -243,9 +253,12 @@ class HomeController extends AbstractAction
$result = \Index\UserModel::setDefaultAddress($uid, $id);
}
if (empty($result)) {
if (empty($result))
{
echo ' ';
} else {
}
else
{
$this->echoJson($result);
}
}
... ... @@ -257,7 +270,8 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax()) {
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
$id = $this->post('id', '');
... ... @@ -265,9 +279,12 @@ class HomeController extends AbstractAction
$result = \Index\UserModel::deleteAddress($uid, $id);
}
if (empty($result)) {
if (empty($result))
{
echo ' ';
} else {
}
else
{
$this->echoJson($result);
}
}
... ... @@ -294,7 +311,8 @@ class HomeController extends AbstractAction
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0) {
if ($cateId > 0)
{
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
... ... @@ -310,11 +328,26 @@ class HomeController extends AbstractAction
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
$uid = $this->getUid();
$yh_channel = Helpers::getChannelByCookie();
$uid=5687179;
$gender = Helpers::getGenderByCookie();
$guangInfo = \home\GuangModel::getMyGuang($uid, $page,$yh_channel,$gender, $limit);
$this->_view->display('my-guang', array('myGuang'=>$guangInfo));
$yh_channel = Helpers::getChannelByCookie();
$guangInfo = \home\GuangModel::getMyGuang($uid, $page, $yh_channel, $gender, $limit);
$totalPage = $guangInfo['totalPage'];
unset($guangInfo['totalPage']);
if ($page == 1)
{
$this->setTitle('我收藏的');
$this->setNavHeader('我收藏的', true, '');
$this->_view->display('my-guang', array('myGuangPage' => true, 'myGuang' => array('infos' => $guangInfo), 'pageFooter' => true));
}
else if ($page > 1 && $page<=$totalPage)
{
$this->_view->display('my-guang-partial', array('infos' => $guangInfo));
}
else if ($page > 1 && $page>$totalPage)
{
echo ' ';//退出循环
}
}
/**
... ... @@ -349,10 +382,6 @@ class HomeController extends AbstractAction
// 设置网站标题
$this->setTitle('反馈问题');
$param = \Api\Yohobuy::param();
unset($param['private_key']);
$param['project'] = 'suggest';
$param['client_secret'] = 'e7807a9522ab99af8b8fd926e1ebbd9a';
$data = array(
'suggestPage' => true, //加载js
'pageHeader' => array(
... ... @@ -360,11 +389,9 @@ class HomeController extends AbstractAction
'navTitle' => '反馈问题',
'navBtn' => '提交'
),
'param' => $param,
'suggestSub' => true,
'pageFooter' => true
);
//print_r($data);
$this->_view->display('suggest_sub', $data);
}
... ... @@ -374,8 +401,8 @@ class HomeController extends AbstractAction
*/
public function suggestimgUploadAction()
{
$filename = $this->post('filename', '');
$result = \Index\UserModel::saveSuggestImg($filename);
//$filename = $this->post('filename', '');
$result = \Index\UserModel::saveSuggestImg('fileData');
$this->echoJson($result);
}
... ... @@ -385,10 +412,11 @@ class HomeController extends AbstractAction
*/
public function savesuggestAction()
{
if ($this->isAjax()) {
if ($this->isAjax())
{
$uid = $this->getUid();
$content = $this->post('content', '');
$suggest_type = $this->get('suggest_type', 2);
$suggest_type = $this->post('suggest_type', 2);
$result = \Index\UserModel::saveSuggestData($uid, $content, $suggest_type);
$this->echoJson($result);
... ... @@ -433,22 +461,25 @@ class HomeController extends AbstractAction
}
/*
* 我的订单页面
* 我的订单页面,获得nav导航条焦点。并且异步请求订单详情列表页(getOrders)
*/
public function orderAction()
{
//获得type值
//获得type值,type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论。
$type = $this->get('type', 1);
$this->setTitle('我的订单');
$this->setNavHeader('我的订单');
$data = OrderModel::getNavs($type);
if (!empty($data)) {
if (!empty($data))
{
$order['navs'] = $data;
} else {
}
else
{
$this->error();
}
//渲染模板
$this->_view->display('order', array(
'order' => $order,
'pageFooter' => true,
... ... @@ -460,7 +491,8 @@ class HomeController extends AbstractAction
public function getOrdersAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
if (!$this->isAjax())
{
$this->error();
}
//获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
... ... @@ -473,15 +505,24 @@ class HomeController extends AbstractAction
$uid = '10267443'; //测试用
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
//如果没有订单数据,就给一个随便逛逛链接
/* 如果取不到订单数据时,分两种情况:
1、page>1时,echo一个空格字符串到浏览器。
2、page=1时,就给一个随便逛逛的链接。
* */
$order = array();
if (!empty($data)) {
if (!empty($data))
{
$order['orders'] = $data;
} else {
if ($page > 1) {
}
else
{
if ($page > 1)
{
echo " ";
} else {
$order['walkwayUrl'] = 'http://www.baidu.com';
}
elseif ($page = 1)
{
$order['walkwayUrl'] = self::strollAction();
}
}
//渲染模板
... ... @@ -496,17 +537,20 @@ class HomeController extends AbstractAction
{
//判断是不是ajax请求
if (!$this->isAjax()) {
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.close';
//调用取消订单接口,返回订单取消状态
$data = OrderData::cancelOrderData($order_code, $uid, $gender, $yh_channel, $method);
//将取消状态返回至浏览器
$this->echoJson($data);
}
... ... @@ -517,7 +561,8 @@ class HomeController extends AbstractAction
public function delOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
if (!$this->isAjax())
{
$this->error();
}
//传入order_code和uid以删除订单
... ... @@ -527,10 +572,37 @@ class HomeController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.delOrderByCode';
//调用接口删除订单,并返回订单删除状态
$data = OrderData::deleteOrderData($order_code, $uid, $gender, $yh_channel, $method);
//将订单删除状态返回至浏览器
$this->echoJson($data);
}
/*
* 我的订单-支付链接获取
*/
private function paymentAction()
{
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
OrderModel::payment($gender, $yh_channel);
}
/*
* 我的订单-随便逛逛链接获取
*/
private function strollAction()
{
//获取性别、频道数据
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
//调用接口获取随便逛逛url地址,并return数据
$data = OrderModel::stroll($gender, $yh_channel);
return $data;
}
/**
* 订单详情页
*/
... ...
... ... @@ -13,68 +13,20 @@ class GuangModel
{
//获取我的逛列表
public static function getMyGuang($uid, $page,$yh_channel=1, $gender = '1,3', $limit = 10)
public static function getMyGuang($uid, $page, $yh_channel = 1, $gender = '1,3', $limit = 10)
{
$result = array();
//调用接口获取数据
$res = GuangData::getGuangInfo($uid, $page, $yh_channel,$gender, $limit);
$guangInfo = $res['data']['data'];
if ($guangInfo)
$res = GuangData::getGuangInfo($uid, $page, $yh_channel, $gender, $limit);
$result['totalPage']=intval($res['data']['totalPage']);
if (!empty($res['data']['data']))
{
foreach ($guangInfo as $k => $v)
foreach ($res['data']['data'] as $k => $v)
{
$result[$k]['id'] = $v['id'];
$result[$k]['author'] = $v['author'];
$tag = self::getTag(TRUE, intval($v['category_id']));
$result[$k]['url'] = $v['url'];
$result[$k]['img'] = $v['src'];
$result[$k]['title'] = $v['title'];
$result[$k]['text'] = $v['intro'];
$result[$k]['pageView'] = $v['views_num'];
$result[$k]['publish_time'] = $v['publish_time'];
$like = ($v['isPraise'] == "Y") ? true : false;
$collect = ($v['isFavor'] == "Y") ? true : false;
$result[$k]['like'] = array('isLiked' => $like, 'count' => $v['praise_num']);
$result[$k]['collect'] = array('isCollected' => $collect, 'url' => $v['url']);
$result[$k] += $tag;
$result[$k]['share'] = $v['url'];
$result[$k] = Helpers::formatArticle($v, true, false, true, $uid);
}
}
return $result;
}
//【标签】isTip-小贴士;isCollocation-搭配 isFashionMan-潮人 isFashionGood-潮品 isTopic-话题
private static function getTag($isShow, $tagId)
{
$ret['showTags'] = $isShow;
$ret['isTopic'] = false;
$ret['isCollocation'] = false;
$ret['isFashionMan'] = false;
$ret['isFashionGood'] = false;
$ret['isTip'] = false;
switch ($tagId)
{
case 1:
$ret['isTopic'] = true;
break;
case 2:
$ret['isCollocation'] = true;
break;
case 3:
$ret['isFashionMan'] = true;
break;
case 4:
$ret['isFashionGood'] = true;
break;
case 5:
$ret['isTip'] = true;
break;
default:
$ret['showTags'] = FALSE;
break;
}
return $ret;
}
}
... ...
... ... @@ -18,11 +18,16 @@ use Configs\CacheConfig;
*/
class OrderModel
{
/* 频道选择页取背景图片的位置码 */
const CODE_PAYMENT = '04cf5abaa7c20178325a07c4a833782c'; //支付订单资源码
const CODE_STROLL = 'a7989369aa86681c678bc40f171b8f1d'; //随便逛逛url地址资源码
/**
* 订单相关数据处理
*/
public function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) {
static function getOrder($type = 1, $page = 1, $limit, $gender, $yh_channel, $uid) {
$result = array();
if (USE_CACHE) {
$key = CacheConfig::KEY_ACTION_HOME_ORDER_ORDER;
... ... @@ -37,32 +42,37 @@ class OrderModel
//检查数据返回是否正常,正常则处理数据
if ($data['code'] == 200 && isset($data['data'])) {
foreach ($data['data']['order_list'] as $key => $vo) {
//订单号,支付状态,订单商品数量,订单总价格
//订单号,支付状态,订单商品数量,订单总价格(订单总价加上运费)
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['orderStatus'] = $vo['status_str'];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'] + $vo['shipping_cost'];
//订单商品列表数据
//类内调用格式化订单商品数据方法
$result[$key]['goods'] = self::formatOrderGoods($vo['order_goods']);
//订单status判断订单处于什么状态。
//根据订单status判断订单处于什么状态。
do {
//订单取消状态
//订单取消状态 = Y 时,跳出判断订单状态循环,并设置订单状态为已取消。
if ($vo['is_cancel'] === 'Y') {
$result[$key]['canceled'] = true;
break;
}
//支付方式不是货到付款时,计算订单状态
/* 先判断订单付款方式,根据不同的付款方式计算订单状态。(注:货到付款没有待付款状态)
* 付款方式:1 => 在线支付,2 => 货到付款,3 => 现金支付,4 => 抵消支付;
*/
//支付方式为非货到付款时,计算订单状态。
if ($vo['payment_type'] != 2) {
switch ($vo['status']) {
case 0:
$result[$key]['unpaid'] = true;
break;
//未发货&未收货 状态,统一合并到待收货状态。
case 1:
case 2:
case 3:
case 4:
case 5:
$result[$key]['unreceived'] = true;
//待收货状态,给查看物流url
$result[$key]['logisticsUrl'] = "暂无logisticsUrl数据";
break;
case 6:
... ... @@ -72,11 +82,11 @@ class OrderModel
break;
}
} elseif ($vo['payment_type'] == 2) {
//订单为货到付款订单时,订单没有未支付状态
//订单为货到付款订单时,计算订单状态。(货到付款没有待付款状态)
switch ($vo['status']) {
case 0 || 1 || 2 || 3 || 4 || 5:
$result[$key]['unreceived'] = true;
//此处备注,接口没有返回logisticsUrl数据
//待收货状态,给查看物流url
$resault[$key]['logisticsUrl'] = "备注:暂无logisticsUrl数据";
break;
case 6:
... ... @@ -113,6 +123,7 @@ class OrderModel
$arr[$key]['size'] = $vo['size_name'];
$arr[$key]['price'] = $vo['goods_price'];
$arr[$key]['count'] = $vo['buy_number'];
//gift=>是否赠品,advanceBuy=>是否加价购;
if ($vo['goods_type'] == 'gift') {
$arr[$key]['gift'] = true;
} elseif ($vo['goods_type'] == 'price_gift') {
... ... @@ -123,7 +134,7 @@ class OrderModel
}
//根据type值设置nav属性
public function getNavs($type) {
static function getNavs($type) {
$nav = array(
array(
'name' => '全部',
... ... @@ -174,8 +185,29 @@ class OrderModel
}
return $nav;
}
//获得支付链接
static function payment($gender, $yh_channel) {
$code = self::CODE_PAYMENT;
$data = OrderData::paymentData($gender, $yh_channel, $code);
}
//查看物流
// static function Logistics(){
// OrderData::LogisticsData();
// }
//随便逛逛url获取
static function stroll($gender, $yh_channel) {
//获取随便逛逛url资源码
$code = self::CODE_STROLL;
//调用接口获得数据
$data = OrderData::strollData($gender, $yh_channel, $code);
$stroll = 1;
//检查数据返回是否正常,正常则处理数据
if ($data['code'] == 200) {
$strollUrl = $data['data'][0]['data'][0]['url'];
}
return $strollUrl;
}
}
... ...
... ... @@ -472,8 +472,17 @@ class UserModel
*/
public static function saveSuggestData($uid, $content, $suggest_type)
{
$result = array('code' => 400, 'message' => '保存出错');
// 调用接口保存意见反馈数据
return UserData::savesuggestData($uid, $content, $suggest_type);
$save = UserData::savesuggestData($uid, $content, $suggest_type);
if (isset($save['code']) && $save['code'] == 200) {
$result['code'] = 200;
$result['message'] = '谢谢您的反馈';
}
return $result;
}
/**
... ...