Authored by hf

do add guang search api docs

Showing 37 changed files with 796 additions and 364 deletions
... ... @@ -943,7 +943,8 @@
{
name: '',
active: true,
typeId: 1
typeId: 1,
url: ''
},
...
]
... ...
... ... @@ -18,17 +18,18 @@ class Yohobuy
{
// /* 正式环境 */
// const API_URL = 'http://api2.open.yohobuy.com/';
// const API_URL2 = 'http://api.open.yohobuy.com/';
// const SERVICE_URL = 'http://service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_URL = 'http://api2.open.yohobuy.com/';
const API_URL2 = 'http://api.open.yohobuy.com/';
const SERVICE_URL = 'http://service.api.yohobuy.com/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://test2.open.yohobuy.com/';
const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL
const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
// const API_URL = 'http://test2.open.yohobuy.com/';
// const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_URL_MYCENTER = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的个人中心接口URL
// const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
/**
* 私钥列表
... ...
... ... @@ -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);
}
}
... ...
... ... @@ -130,6 +130,24 @@ class UserData
}
/**
* 取消收藏的商品数据
*
* @param int $uid 用户ID
* @param int $fav_id 要取消的收藏id
* @return array 接口返回的数据
*/
public static function favoriteDelete($uid, $fav_id)
{
$param = Yohobuy::param();
$param['method'] = 'app.favorite.cancel';
$param['type'] = 'product';
$param['fav_id'] = $fav_id;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* YOHO币数据
*
* @param int $uid 用户ID
... ... @@ -160,15 +178,24 @@ class UserData
*/
public static function couponData($uid, $status, $page = 1, $limit = 10)
{
$urlList = array();
$param = Yohobuy::param();
$param['method'] = 'app.coupons.li';
$param['uid'] = $uid;
$param['status'] = $status;
$param['status'] = 0;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
$urlList['unused'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::get(Yohobuy::API_URL, $param);
unset($param['client_secret']);
$param['status'] = 1;
$param['client_secret'] = Sign::getSign($param);
$urlList['used'] = Yohobuy::httpBuildQuery(Yohobuy::API_URL, $param);
return Yohobuy::getMulti($urlList);
}
/**
... ... @@ -224,7 +251,7 @@ class UserData
$param['consignee'] = $consignee;
$param['email'] = $email;
if ($id !== null) { // 修改
if (!empty($id)) { // 修改
$param['id'] = $id;
$param['method'] = 'app.address.update';
} else { // 添加
... ... @@ -258,6 +285,24 @@ class UserData
}
/**
* 删除地址
*
* @param int $uid 用户ID
* @param int $id 地址唯一标识符id
* @return array 接口返回的数据
*/
public static function deleteAddress($uid, $id)
{
$param = Yohobuy::param();
$param['id'] = $id;
$param['method'] = 'app.address.del';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 意见反馈数据
*
* @param string $udid 客户端唯一标识
... ...
... ... @@ -106,6 +106,93 @@ class Images
return $domain;
}
/**
* 图片上传
* @param string $name 文件表单name, 即用于$_FILES[$name]
*/
public static function saveImage($name)
{
if (empty($_FILES[$name]))
{
return array();
}
$files = $_FILES[$name];
$images = array();
if (is_array($files['tmp_name']))
{
foreach ($files['tmp_name'] as $k => $tmp_name)
{
if(!empty($tmp_name))
{
$images[$files['name'][$k]] = $tmp_name;
}
}
}
else
{
$images[$files['name']] = $files['tmp_name'];
}
return self::uploadStreamImage($images);
}
/**
* 上传图片[图片上传域名限制于http://test.service.api.yohobuy.com]
*
* @param string | array(filename => absolute file path) $file
* url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
* @return mixed
*/
public static function uploadStreamImage($file)
{
$end ="\r\n";
$twoHyphens ="--";
$boundary = "*****";
$stream = '';
$files = is_array($file) ? $file : array($file);
foreach($files as $name => $filename)
{
if(!file_exists($filename))
{
continue;
}
$name = is_numeric($name) ? name.'.jpg' : $name;
$stream .= $twoHyphens.$boundary.$end;
$stream .="Content-Disposition: form-data; "."name=\"fileData\";filename=\"".$name ."\"".$end; // form file element name :fileData
$stream .= $end;
$stream .= file_get_contents($filename);
$stream .= $end;
}
if(empty($stream))
{
return false;
}
$stream .= $twoHyphens.$boundary.$end;
$stream .="Content-Disposition: form-data; "."name=\"project\"".$end;
$stream .= $end;
$stream .= "sns";//project sns
$stream .= $end;
$stream .= $twoHyphens .$boundary .$twoHyphens .$end;
$opts = array(
'http' => array(
'method' => 'POST',
'header' => 'content-type:multipart/form-data;boundary='.$boundary,
'content' => $stream
)
);
$context = stream_context_create($opts);
$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'] ;
}
else
{
return false;
}
}
/**
* 获取模板的图片地址
* @param $fileName
... ...
... ... @@ -5,16 +5,16 @@
*/
var $ = require('jquery'),
Hammer = require('yoho.hammer'),
ellipsis = require('mlellipsis'),
lazyLoad = require('yoho.lazyload');
Hammer = require('yoho.hammer'),
ellipsis = require('mlellipsis'),
lazyLoad = require('yoho.lazyload');
var tip = require('../plugin/tip');
var loading = require('../plugin/loading');
var $loadMoreInfo = $('#load-more-info');
var $loading = $(''),
$noMore = $('');
$noMore = $('');
var searching = false;
... ... @@ -34,8 +34,8 @@ function setLazyLoadAndMellipsis($infos) {
$infos.each(function() {
var $this = $(this),
$title = $this.find('.info-title'),
$text = $this.find('.info-text');
$title = $this.find('.info-title'),
$text = $this.find('.info-text');
$title[0].mlellipsis(2);
$text[0].mlellipsis(2);
... ... @@ -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,
$info;
$likeBtn = $this.closest('.like-btn');
if ($likeBtn.length > 0) {
if ($likeBtn.hasClass('like')) {
opt = 'ok',
$btn,
$info;
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() {
... ...
/**
* 地址管理
* @author: bikai<kai.bi@yoho.cn>
* @date: 2015/11/17
*/
var $ = require('jquery'),
tip = require('../plugin/tip');
var $action = $('.action'),
$addressForm = $('.edit-address'),
$submit = $('.submit'),
$addAddress = $('.add-address'),
$editAddressPage = $('.my-edit-address-page'),
$addressListPage = $('.my-address-list-page'),
$area = $('.area'),
$footer = $('#yoho-footer'),
isSubmiting,
newArea = [];
function editAddress(data) {
data = data || {};
$addressForm.find('[name="id"]').val(data.id || '');
$addressForm.find('[name="consignee"]').val(data.consignee || '');
$addressForm.find('[name="mobile"]').val(data.mobile || '');
$addressForm.find('[name="area_code"]').val(data.areaCode || '');
$addressForm.find('[name="area"]').val(data.area || '');
$addressForm.find('[name="address"]').val(data.address || '');
$editAddressPage.show();
// $addressForm.find('[name="address"]').blur();
// $addressForm.find('[name="consignee"]').focus();
}
function deleteAddress(data) {
}
// 添加地址
$addAddress.on('touchend', function() {
editAddress();
});
// 编辑或删除
$action.on('touchend', '.edit', function() {
editAddress($(this).data());
}).on('touchend', '.del', function() {
deleteAddress();
});
$submit.on('touchend', function() {
$addressForm.submit();
return false;
});
$addressForm.on('submit', function() {
if (isSubmiting) {
return false;
}
isSubmiting = true;
$.ajax({
method: 'POST',
url: '/home/saveaddress',
data: $(this).serialize()
}).then(function(res) {
if ($.type(res) !== 'object') {
res = {};
}
if (res.code !== 200) {
tip.show(res.message || '网络出了点问题~');
} else {
window.location.reload();
}
}).fail(function() {
tip.show('网络出了点问题~');
}).always(function() {
isSubmiting = false;
});
return false;
});
// 省市区
$area.on('touchend', function() {
$footer.hide();
$addressListPage.show();
});
$addressListPage.on('touchend', '.address', function() {
newArea.push($(this).children('.caption').text());
$(this).siblings().hide();
$(this).children('ul').show();
return false;
}).on('touchend', '.address-last', function() {
// 填结果到 html
newArea.push($(this).children('.caption').text());
$('[name="area"]').val(newArea.join(' '));
$('[name="area_code"]').val($(this).data('id'));
// 恢复默认的三级选择
$addressListPage.hide();
$addressListPage.find('ul').hide();
$addressListPage.children('ul').show().children('li').show();
$footer.show();
newArea = [];
return false;
});
... ...
/**
* 我的逛
* @author xuqi<qi.xu@yoho.cn>
* @date: 2015/11/17
*/
var $ = require('jquery');
var $infoList = $('#info-list');
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
... ...
... ... @@ -17,27 +17,32 @@ var winH = $(window).height();
var activeType = $navLi.filter('.active').data('type'); //当前active的项的index
var orderPage = {};
var order = {
page: 0,
end: false
};
var inAjax = false;
var loading = require('../plugin/loading');
var navHammer, orderHammer;
var orderHammer;
//加载订单
function getOrders() {
function getOrders(option) {
var opt = {
type: activeType,
page: orderPage[activeType] ? (orderPage[activeType] + 1) : 1
page: order.page + 1
};
var show = option && option.showLoadingMask;
if (inAjax) {
return;
}
inAjax = true;
loading.showLoadingMask();
show && loading.showLoadingMask();
$.ajax({
type: 'GET',
... ... @@ -46,23 +51,27 @@ function getOrders() {
success: function(data) {
var num;
if (data.code === 200) {
orderPage[opt.type] = opt.page;
if (data !== ' ') {
order.page = opt.page;
if (opt.page === 1) {
$curContainer.html(data.data);
$curContainer.html(data);
lazyLoad($curContainer.find('.lazy'));
} else {
num = $curContainer.children('.order').length;
$curContainer.append(data.data);
$curContainer.append(data);
//lazyload
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ') .lazy'));
lazyLoad($curContainer.children('.order:gt(' + (num - 1) + ')').find('.lazy'));
}
window.rePosFooter(); //重新计算底部位置
} else {
order.end = true;
}
inAjax = false;
loading.hideLoadingMask();
show && loading.hideLoadingMask();
}
});
}
... ... @@ -83,33 +92,6 @@ lazyLoad();
loading.init($('body')); //满屏loading
//导航切换
navHammer = new Hammer(document.getElementById('order-nav'));
navHammer.on('tap', function(e) {
var $cur = $(e.target).closest('li'),
index;
if ($cur.length === 0 || $cur.hasClass('active')) {
return;
}
index = $cur.index();
$navLi.filter('.active').removeClass('active');
$cur.addClass('active');
$curContainer.addClass('hide');
$curContainer = $orderContainer.children(':eq(' + index + ')').removeClass('hide');
activeType = $cur.data('type');
if (orderPage[activeType]) {
return;
} else {
getOrders();
}
});
//点击订单区域跳转订单详情页
orderHammer = new Hammer(document.getElementById('order-container'));
orderHammer.on('tap', function(e) {
... ... @@ -154,8 +136,8 @@ orderHammer.on('tap', function(e) {
success: function(data) {
if (data.code === 200) {
//取消订单
alert('order cancel');
//取消订单页面刷新
location.href = location.href;
}
}
});
... ... @@ -168,9 +150,13 @@ orderHammer.on('tap', function(e) {
});
$(window).scroll(function() {
if ($(window).scrollTop() + winH >
if (order.end === false && $(window).scrollTop() + winH >
$(document).height() - 0.25 * $orderContainer.height()) {
getOrders();
//下拉请求时不显示mask
getOrders({
noLoadingMask: true
});
}
});
... ...
... ... @@ -12,20 +12,16 @@ var $ = require('jquery'),
require('./jquery.uploadifive');
$('#upload-img').uploadifive({
'auto': false,
'buttonClass': 'nav-btn',
'formData': {
},
'fileType': 'image/*',
'uploadScript': 'url',
'fileObjName': 'imgName',
'fileSizeLimit': 1024,
'onAddQueueItem': function (file) {
auto: true,
buttonClass: 'nav-btn',
fileType: 'image/*',
uploadScript: '/home/suggestimgUpload',
fileObjName: 'fileData',
fileSizeLimit: 1024,
onAddQueueItem: function (file) {
console.log(file);
alert(1);
},
'onQueueComplete': function (file) {
onQueueComplete: function (file) {
console.log(file);
}
});
\ No newline at end of file
... ...
... ... @@ -11,7 +11,8 @@ var page = 1,
navSwiper,
notab = 0,
sort = '',
id = '';
id = '',
noResult = '<p class="no-result">未找到相关搜索结果</p>';
function hotrank(page, sort, tabId, notab) {
loading.showLoadingMask();
... ... @@ -28,7 +29,11 @@ function hotrank(page, sort, tabId, notab) {
if (page === 1) {
$('.rank-main').remove();
}
$('#hotRank').append(data);
if (data === ' ') {
$('#hotRank').html(noResult);
} else {
$('#hotRank').append(data);
}
lazyLoad($('img.lazy'));
$('.rank-main ul li:gt(2)').find('.item-content i').removeClass('top');
winH = $(window).height();
... ...
... ... @@ -102,7 +102,7 @@
.my-edit-address-page {
position: absolute;
bottom: 0;
top: pxToRem(90px);
top: 0;
width: 100%;
color: #d0d0d0;
background: #f0f0f0;
... ... @@ -142,8 +142,8 @@
input, textarea {
position: absolute;
top: 0;
right: 0;
width: pxToRem(400px);
right: pxToRem(40px);
width: pxToRem(360px);
height: pxToRem(88px);
color: #444;
padding: 0;
... ... @@ -156,8 +156,10 @@
}
textarea {
right: 0;
width: pxToRem(400px);
height: pxToRem(58px) * 2;
padding: pxToRem(20px) pxToRem(10px);
padding: pxToRem(20px) 0;
}
}
... ... @@ -171,4 +173,32 @@
font-size: pxToRem(32px);
line-height: pxToRem(88px);
}
}
\ No newline at end of file
}
.my-address-list-page {
position: absolute;
bottom: 0;
top: 0;
width: 100%;
color: #444;
background: #fff;
li {
padding: 0 pxToRem(30px);
font-size: pxToRem(32px);
line-height: pxToRem(88px);
border-bottom: 1px solid #e0e0e0;
.iconfont {
float: right;
color: #d0d0d0;
}
ul {
display: none;
position: absolute;
top: 0;
left: 0;
background: #fff;
width: 100%;
}
}
}
... ...
... ... @@ -45,9 +45,8 @@
p{
width: 55.517241%;
height: auto;
padding: 0 5% 10em / $pxConvertRem;;
padding: 0 5% 18em / $pxConvertRem;;
float: left;
font-size: 44em / $pxConvertRem;
&:first-of-type{
padding-top:30em / $pxConvertRem;
font-size: 60em / $pxConvertRem;
... ...
... ... @@ -184,9 +184,12 @@ $fav: sprite-map("me/fav/*.png",$spacing: 5px);
.fav-brand-swiper {
.swiper-header {
height: pxToRem(60px);
height: pxToRem(100px);
padding: pxToRem(20px) pxToRem(30px);
display: inline-block;
position: relative;
width: 100%;
@include box-sizing();
.swiper-logo {
height: 100%;
... ... @@ -229,6 +232,19 @@ $fav: sprite-map("me/fav/*.png",$spacing: 5px);
}
}
}
.fav-more {
$width: pxToRem(image_width(sprite-file($fav, fav-more)));
$height: pxToRem(image_height(sprite-file($fav, fav-more)));
@include rem-sprite($fav, fav-more);
width: $width;
height: $height;
position: absolute;
top: 50%;
right: pxToRem(30px);
margin-top: -$height / 2;
}
}
.swiper-container {
height: pxToRem(300px);
... ...
... ... @@ -5,19 +5,20 @@
position: relative;
padding: 0 pxToRem(30px);
color: #fff;
background: #ccc;
font-size: pxToRem(34px);
line-height: pxToRem(164px);
height: pxToRem(164px);
line-height: pxToRem(168px);
height: pxToRem(168px);
background: image-url("me/index/header-bg.jpg");
background-size: cover;
.user-avatar {
float: left;
position: relative;
top: pxToRem(8px);
width: pxToRem(132px);
height: pxToRem(132px);
top: pxToRem(16px);
width: pxToRem(126px);
height: pxToRem(126px);
border-radius: 50%;
border: pxToRem(8px) solid #a7a8a9;
border: pxToRem(6px) solid #a7a8a9;
}
.username {
... ... @@ -78,7 +79,7 @@
font-size: pxToRem(32px);
line-height: pxToRem(88px);
span {
a {
color: #e0e0e0;
float: right;
}
... ... @@ -110,6 +111,7 @@
background: #fff;
.list-item {
display: block;
position: relative;
padding: 0 pxToRem(30px);
font-size: pxToRem(32px);
... ...
... ... @@ -106,7 +106,14 @@
border-bottom: 1px solid #e0e0e0;
background: #fff;
> li{
a {
display: block;
height: 100%;
width: 100%;
color: #b0b0b0;
}
> li {
float: left;
height: 90rem / $pxConvertRem;
width: 25%;
... ... @@ -115,7 +122,7 @@
font-size: 26rem / $pxConvertRem;
text-align: center;
&.active {
&.active a {
color: #000;
}
}
... ...
... ... @@ -36,13 +36,14 @@
}
.price {
position: relative;
margin-top: pxToRem(20px);
font-size: pxToRem(20px);
line-height: 1;
span {
// chrome 最小支持12px
transform: scale(0.875);
// chrome 最小支持12px, 设计图是 10px ,用CSS3变换
@include transform(scale(0.875));
}
.sale-price {
... ... @@ -50,7 +51,9 @@
}
.old-price {
float: right;
position: absolute;
top: 0;
right: 0;
color: #ededed;
}
... ...
... ... @@ -6,7 +6,7 @@
<span class="tel">{{mobile}}</span>
<p class="address-info">{{area}} {{address}}</p>
<div class="action iconfont">
<a href="/home/address/edit?id={{address_id}}" class="edit">&#xe61e;</a>
<span class="edit" data-id="{{address_id}}" data-consignee="{{consignee}}" data-mobile="{{mobile}}" data-area-code="{{area_code}}" data-area="{{area}}" data-address="{{address}}">&#xe61e;</span>
<span class="del" data-id="{{address_id}}">&#xe621;</span>
</div>
</div>
... ... @@ -30,5 +30,7 @@
</div>
</div>
</div>
{{> me/address/edit-address}}
{{> me/address/address-list}}
</div>
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -3,18 +3,25 @@
<span class="active">未使用</span>
<span>已使用</span>
</div>
{{# couponsUrl}}
<div class="employ-list">
{{# unused}}
<div class="employ-main">
<span>50</span>
<p>【summer sale】下装满¥399减¥50券</p>
<p>有效期:2014.07.28 - 2014.09.15</p>
</div>
{{/ unused}}
</div>
<div class="employ-list not none">
{{# used}}
<div class="employ-main">
<span>60</span>
<p>【summer sale】下装满¥399减¥60券</p>
<p>有效期:2014.07.28 - 2014.09.15</p>
<span>{{ money }}</span>
<p>{{ coupon_name }}</p>
<p>{{ couponValidity }}</p>
</div>
{{/ used}}
</div>
{{/ couponsUrl}}
{{> layout/footer}}
\ No newline at end of file
... ...
... ... @@ -66,7 +66,7 @@
{{/ discount}}
</div>
</div>
<a href="{{link}}"></a>
<a class="fav-more" href="{{link}}"></a>
</div>
<div id="swiper-container-{{id}}" class="swiper-container" data-id="{{id}}">
<ul class="swiper-wrapper swiper-wrapper-{{id}}">
... ...
{{> layout/header}}
<div class="my-page yoho-page">
<div class="my-header">
<div class="user-info">
<div class="user-info"><!--/home/personaldetails-->
<img class="user-avatar" src="{{head_ico}}">
<span class="username">{{profile_name}}</span>
{{#vip_info}}
... ... @@ -11,15 +11,15 @@
</div>
</div>
<div class="my-link clearfix">
<a class="link-item" href="/home">
<a class="link-item" href="/home/favorite">
{{product_favorite_total}}
<p>收藏的商品</p>
</a>
<a class="link-item" href="/home">
<a class="link-item" href="/home/favoritebrand">
{{brand_favorite_total}}
<p>收藏的品牌</p>
</a>
<a class="link-item" href="/home">
<a class="link-item" href="/home/">
{{product_browse}}
<p>浏览记录</p>
</a>
... ... @@ -27,9 +27,9 @@
<div class="my-order">
<div class="order-title">
我的订单
<span class="iconfont">
<a class="iconfont" href="/home/order">
查看全部订单 &#xe604;
</span>
</a>
</div>
<div class="order-type clearfix">
<a class="type-item" href="/home/order">
... ... @@ -47,44 +47,44 @@
</div>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/address">
<span class="iconfont icon">&#xe637;</span>
地址管理
<span class="iconfont num">3 &#xe604;</span>
</div>
<span class="iconfont num">{{address_num}} &#xe604;</span>
</a>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/coupons">
<span class="iconfont icon">&#xe63a;</span>
优惠券
<span class="iconfont num">{{coupon_num}} &#xe604;</span>
</div>
<div class="list-item">
</a>
<a class="list-item" href="/home/currency">
<span class="iconfont icon">&#xe635;</span>
YOHO
<span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
</div>
</a>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/message">
<span class="iconfont icon">&#xe636;</span>
消息
<span class="iconfont num">{{inbox_total}} &#xe604;</span>
</div>
</a>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/onlineService">
<span class="iconfont icon">&#xe63c;</span>
在线客服
<span class="iconfont num">&#xe604;</span>
</div>
</a>
</div>
<div class="group-list">
<div class="list-item">
<a class="list-item" href="/home/">
<span class="iconfont icon">&#xe639;</span>
帮助
<span class="iconfont num">&#xe604;</span>
</div>
</a>
</div>
{{> product/recommend-for-you}}
... ...
{{> layout/header}}
<div class="my-guang-page yoho-page">
<div class="info-list">
<div id="info-list" class="info-list">
{{# myGuang}}
{{> guang/info}}
{{/ myGuang}}
... ...
... ... @@ -4,7 +4,7 @@
<ul id="order-nav" class="order-nav clearfix">
{{#each navs}}
<li {{#if active}}class="active"{{/if}} data-type="{{typeId}}">
{{name}}
<a href="{{url}}">{{name}}</a>
</li>
{{/each}}
</ul>
... ...
{{> layout/header}}
<div class="yoho-suggest-sub-page yoho-page">
{{# suggestSub}}
<div class="suggest-sub-form">
<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}}">
<textarea name="" id="suggest-textarea" placeholder="请输入意见反馈,我们会以消息形式回复您的建议或意见,改进产品体验,谢谢!"></textarea>
<div class="img-form">
<span class="img-add">
... ...
... ... @@ -237,4 +237,14 @@
<script>
seajs.use('js/me/online-service');
</script>
{{/if}}
{{#if addressPage}}
<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
... ...
<div class="my-address-list-page hide">
<ul class="address-list">
{{# addressList}}
<li class="address">
<span class="caption">{{caption}}</span>
<span class="iconfont">&#xe604;</span>
<ul>
{{# sub}}
<li class="address">
<span class="caption">{{caption}}</span>
<span class="iconfont">&#xe604;</span>
<ul class="address-list">
{{# sub}}
<li class="address-last" data-id="{{code}}">
<span class="caption">{{caption}}</span>
</li>
{{/ sub}}
</ul>
</li>
{{/ sub}}
</ul>
</li>
{{/ addressList}}
</ul>
</div>
\ No newline at end of file
... ...
{{> layout/header}}
<div class="my-edit-address-page yoho-page">
<div class="my-edit-address-page hide">
<form class="edit-address">
<input type="hidden" name="id" value="">
<label class="username">
用户名
<input type="text" name="name" value="张三">
收件人
<input type="text" name="consignee" value="">
</label>
<label class="mobile">
手机号码
<input type="text" name="mobile" value="18911110110">
<input type="text" name="mobile" value="">
</label>
<label class="area">
省市区
<input type="text" name="area" value="江苏省南京市栖霞区">
<input type="hidden" name="area_code" value="">
<input type="text" name="area" value="" readonly>
<span class="iconfont">&#xe604;</span>
</label>
<label class="address">
详细地址
<textarea name="address">东大街西大66号茶馆东大街西大66号茶馆东大街西大66号茶馆</textarea>
<textarea name="address"></textarea>
</label>
</form>
... ... @@ -24,5 +25,4 @@
<div class="submit">
确认
</div>
</div>
{{> layout/footer}}
\ No newline at end of file
</div>
\ No newline at end of file
... ...
... ... @@ -7,8 +7,8 @@
<li class="swiper-slider">
<img class="img-box" src="{{thumb}}">
<div class="price">
<span class="sale-price"{{salePrice}}</span>
<span class="old-price"{{price}}</span>
<span class="sale-price {{^price}}no-price{{/price}}"{{salePrice}}</span>
{{#price}}<span class="old-price"{{.}}</span>{{/price}}
</div>
</li>
{{/recommendList}}
... ...
<?php
use Action\AbstractAction;
use home\GradeModel;
use home\OrderModel;
use Plugin\Helpers;
use LibModels\Wap\Home\OrderData;
... ... @@ -11,11 +13,13 @@ use LibModels\Wap\Home\OrderData;
* @package
* @copyright yoho.inc
* @version 1.0 (2015-10-28 16:28:32)
* @author fei.hong <fei.hong@yoho.cn>
*/
class HomeController extends AbstractAction
{
protected $_uid;
// /**
// * 初始化
// */
... ... @@ -29,7 +33,7 @@ class HomeController extends AbstractAction
//
// parent::init();
// }
/**
* 个人中心入口
*/
... ... @@ -37,7 +41,7 @@ class HomeController extends AbstractAction
{
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心');
$this->setNavHeader('个人中心', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
... ... @@ -60,118 +64,48 @@ class HomeController extends AbstractAction
*/
public function favoriteAction()
{
// 设置网站标题
$this->setTitle('我的收藏');
$this->setNavHeader('我的收藏', true, SITE_MAIN);
$uid = $this->getUid();
$uid = 8826435;
$gender = Helpers::getGenderByCookie();
$favProducts = \Index\UserModel::getFavProductData($uid);
//print_r($favProducts);
$favBrands = \Index\UserModel::getFavBrandData($uid, $gender);
$this->_view->display('favorite', array(
'favPage' => true, //加载js
'pageHeader' => array(
'navBack' => true,
'navTitle' => '我的收藏',
'navHome' => true
),
'pageFooter' => true,
'favorite' => true,
'hasFavProduct' => array(
'0' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'title' => 'adidas Originals ZX FLUXM22508 ',
'price' => '¥800',
'discountPrice' => false,
'savePrice' => false,
'sellOut' => true
),
'1' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'title' => 'adidas Originals ZX FLUXM22508 ',
'price' => '¥800',
'discountPrice' => '¥500',
'savePrice' => '¥300',
'sellOut' => false
)
),
'hasFavBrand' => array(
'0' => array(
'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,
'discount' => 10,
'link' => '#',
'productList' => array(
'0' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'1' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'2' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'3' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
)
)
),
'1' => array(
'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,
'discount' => 10,
'link' => '#',
'productList' => array(
'0' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'1' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'2' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
),
'3' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => '¥240'
)
)
),
'2' => array(
'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,
'discount' => 10,
'link' => '#',
'productList' => array(
'imgUrl' => 'http://img11.static.yhbimg.com/goodsimg/2015/11/04/05/01ce2aff32fc3c90584f516167cd526d91.jpg?imageMogr2/thumbnail/235x314/extent/235x314/background/d2hpdGU=/position/center/quality/90',
'price' => '¥240',
'discount' => false
)
)
)
'hasFavProduct' => $favProducts,
'hasFavBrand' => $favBrands
));
}
/**
* 用户收藏的商品-删除
*/
public function favoriteDelAction()
{
$result = array();
if ($this->isAjax()) {
$uid = $this->getUid();
$fav_id = $this->post('fav_id', 0);
$result = \Index\UserModel::favoriteDelete($uid, $fav_id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
/**
* 用户收藏的品牌
*/
public function favoritebrandAction()
... ... @@ -185,12 +119,12 @@ class HomeController extends AbstractAction
}
/**
* 我的个人信息
* 个人信息
*/
public function mydetailsAction()
public function personalDetailsAction()
{
$this->setTitle('个人信息');
$this->setNavHeader('个人信息');
$this->setNavHeader('个人信息', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 967016;
... ... @@ -205,9 +139,10 @@ class HomeController extends AbstractAction
public function currencyAction()
{
$this->setTitle('YOHO币');
$this->setNavHeader('优惠券');
$this->setNavHeader('YOHO币', true, false);
$uid = 967016;
// $uid = $this->getUid();
$uid = 8826435;
$currency = \Index\UserModel::getYohoCoinData($uid);
$currency['pageFooter'] = true;
... ... @@ -221,7 +156,7 @@ class HomeController extends AbstractAction
{
$this->setTitle('优惠券');
$this->setNavHeader('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$status = $this->get('status', 0);
... ... @@ -229,8 +164,6 @@ class HomeController extends AbstractAction
'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
'couponsPage' => true
);
print_r($coupons);
$this->_view->display('coupons', $coupons);
}
... ... @@ -243,7 +176,7 @@ class HomeController extends AbstractAction
$page = $this->get('page', 0);
$size = $this->get('size', 10);
$uid = 967016;
$uid = 8826435;
$messages = \Index\UserModel::getMessageData($uid, $page, $size);
print_r($messages);
... ... @@ -256,15 +189,15 @@ class HomeController extends AbstractAction
{
// 设置网站标题
$this->setTitle('地址管理');
$this->setNavHeader('地址管理');
$this->setNavHeader('地址管理', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
// print_r($address);
// print_r($addressList);
$this->_view->display('address', array(
'addressPage' => true,
... ... @@ -283,7 +216,7 @@ class HomeController extends AbstractAction
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
... ... @@ -311,7 +244,7 @@ class HomeController extends AbstractAction
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
... ... @@ -324,16 +257,38 @@ class HomeController extends AbstractAction
}
}
/**
* 删除地址
*/
public function addressDelAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 8826435;
$id = $this->post('id', '');
$result = \Index\UserModel::deleteAddress($uid, $id);
}
if (empty($result)) {
echo ' ';
} else {
$this->echoJson($result);
}
}
//在线客服
public function onlineServiceAction()
{
// 设置网站标题
$this->setTitle('在线客服');
$this->setNavHeader('在线客服');
$this->setNavHeader('在线客服', true, SITE_MAIN);
$service = \Home\OnlineModel::getOnlineServiceInfo();
$service = home\OnlineModel::getOnlineServiceInfo();
$this->_view->display('online_service', array(
$this->_view->display('online-service', array(
'onlineServicePage' => true,
// 'pageFooter' => true,
'service' => $service
... ... @@ -347,11 +302,11 @@ class HomeController extends AbstractAction
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
if ($cateId > 0) {
$service = \Home\OnlineModel::getOnlineServiceDetail($cateId);
$service = home\OnlineModel::getOnlineServiceDetail($cateId);
}
$this->setTitle('在线客服');
$this->setNavHeader($cateName, true, '');
$this->_view->display('online_service_detail', $service);
$this->_view->display('online-service-detail', $service);
}
/**
... ... @@ -369,7 +324,7 @@ class HomeController extends AbstractAction
{
// 设置网站标题
$this->setTitle('意见反馈');
$this->setNavHeader('意见反馈');
$this->setNavHeader('意见反馈', true, SITE_MAIN);
$udid = $this->getUdid();
$page = $this->get('page', 1);
... ... @@ -377,56 +332,52 @@ class HomeController extends AbstractAction
$suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
print_r($suggest);
$this->_view->display('suggest', array(
'suggestPage' => true, //加载js
'pageFooter' => true,
'suggest' => true,
'suggestContent' => array(
0 => array(
'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',
'title' => '为什么手机不能退换货?',
'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',
'good' => true,
'bad' => false),
1 => array(
'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',
'title' => '为什么手机不能退换货?',
'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',
'good' => false,
'bad' => true),
2 => array(
'imgUrl' => 'http://img11.static.yhbimg.com/yhb-img01/2015/09/12/06/0115bdfeb4a7dca4b4bfdf0e850f82f2a1.jpg?imageView/2/w/640/h/240',
'title' => '为什么手机不能退换货?',
'content' => 'YOHO!有货的退换货承诺:自您签收商品7日内可以退货,15日内可以换货,在商品吊牌、标签、包装完整,不影响二次销售的情况下,YOHO!有货将为您办理退换货服务。',
'good' => false,
'bad' => false)
)
'suggestContent' => $suggest
));
}
/**
* 意见反馈-提交表单
* 意见反馈-提交表单页面
*/
public function suggest_subAction()
public function suggestSubAction()
{
$udid = $this->getUdid();
$page = $this->get('page', 1);
$limit = $this->get('limit', 30);
$suggest = \Index\UserModel::getSuggestData($udid, $page, $limit);
// 设置网站标题
$this->setTitle('反馈问题');
//print_r($suggest);
$this->_view->display('suggest_sub', array(
$param = \Api\Yohobuy::param();
unset($param['private_key']);
$param['project'] = 'suggest';
$param['client_secret'] = 'e7807a9522ab99af8b8fd926e1ebbd9a';
$data = array(
'suggestPage' => true, //加载js
'pageHeader' => array(
'navBack' => true,
'navTitle' => '反馈问题',
'navBtn' => '提交'
),
'param' => $param,
'suggestSub' => true,
'pageFooter' => true
));
);
//print_r($data);
$this->_view->display('suggest_sub', $data);
}
/**
* 异步上传图片
*/
public function suggestimgUploadAction()
{
$filename = $this->post('filename', '');
$result = \Index\UserModel::saveSuggestImg($filename);
$this->echoJson($result);
}
/**
... ... @@ -457,7 +408,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);
... ... @@ -476,7 +427,7 @@ class HomeController extends AbstractAction
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid();
$data = \Home\GradeModel::getPreferential($channel, $uid);
$data = GradeModel::getPreferential($channel, $uid);
$data['pageFooter'] = true;
$this->_view->display('privilege', $data);
}
... ... @@ -494,19 +445,19 @@ class HomeController extends AbstractAction
$data = OrderModel::getNavs($type);
if (!empty($data)) {
$order['navs'] = $data;
$order['orderPage'] = true;
} else {
$this->error();
}
$this->_view->display('order', array(
'order' => $order,
'pageFooter' => true
'pageFooter' => true,
'orderPage' => true
));
}
//ajax请求订单页面
public function getOrderAction()
public function getOrdersAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
... ... @@ -519,7 +470,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);
//如果没有订单数据,就给一个随便逛逛链接
... ... @@ -527,7 +478,11 @@ class HomeController extends AbstractAction
if (!empty($data)) {
$order['orders'] = $data;
} else {
$order['walkwayUrl'] = 'http://www.baidu.com';
if ($page > 1) {
echo " ";
} else {
$order['walkwayUrl'] = 'http://www.baidu.com';
}
}
//渲染模板
$this->_view->display('order-content', $order);
... ... @@ -552,32 +507,28 @@ 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);
}
/**
... ...
... ... @@ -121,55 +121,61 @@ class OrderModel
}
return $arr;
}
//根据type值设置nav属性
public function getNavs($type){
public function getNavs($type) {
$nav = array(
array(
'name' => '全部',
'typeId' => '1'
'typeId' => '1',
'url' => '/home/order?type=1'
),
array(
'name' => '待付款',
'typeId' => '2'
'typeId' => '2',
'url' => '/home/order?type=2'
),
array(
'name' => '待发货',
'typeId' => '3'
'typeId' => '3',
'url' => '/home/order?type=3'
),
array(
'name' => '待收货',
'typeId' => '4'
'typeId' => '4',
'url' => '/home/order?type=4'
)
);
foreach($nav as $key => $vo){
switch ($type) {
case 1:
if($vo['typeId'] == 1){
$nav[$key]['active'] = true;
}
break;
case 2:
if($vo['typeId'] == 2){
$nav[$key]['active'] = true;
}
break;
case 3:
if($vo['typeId'] == 3){
$nav[$key]['active'] = true;
}
break;
case 4:
if($vo['typeId'] == 4){
$nav[$key]['active'] = true;
}
break;
default:
break;
}
foreach ($nav as $key => $vo) {
switch ($type) {
case 1:
if ($vo['typeId'] == 1) {
$nav[$key]['active'] = true;
}
break;
case 2:
if ($vo['typeId'] == 2) {
$nav[$key]['active'] = true;
}
break;
case 3:
if ($vo['typeId'] == 3) {
$nav[$key]['active'] = true;
}
break;
case 4:
if ($vo['typeId'] == 4) {
$nav[$key]['active'] = true;
}
break;
default:
break;
}
}
return $nav;
}
//获得支付链接
}
... ...
... ... @@ -30,7 +30,7 @@ class UserModel
// 调用接口获取个人详情
$userData = UserData::userData($uid);
// 处理个人详情数
// 处理个人详情数
if (isset($userData['data']) && !empty($userData['data'])) {
$result = $userData['data'];
$result['gender'] = $result['gender'] == 1 ? '男' : '女';
... ... @@ -59,7 +59,11 @@ class UserModel
foreach ($infoNumData['data'] as &$val) {
empty($val) && $val = 0;
}
$result = $infoNumData['data'];
// 默认没有返回用户地址的数据,添加这块儿数据
$result['address_num'] = count(self::getAddressData($uid));
}
return $result;
... ... @@ -150,7 +154,19 @@ class UserModel
// 处理用户收藏的商品数据
if (isset($favProduct['data']) && !empty($favProduct['data'])) {
$result = $favProduct['data'];
$product = array();
foreach ($favProduct['data']['product_list'] as $val) {
$product = array();
$product['imgUrl'] = $val['image'];
$product['title'] = $val['product_name'];
$product['price'] = '¥'.$val['market_price'];
$product['discountPrice'] = '¥'.$val['sales_price'];
$product['savePrice'] = ($val['market_price'] - $val['sales_price'] > 0) ? '¥'.($val['market_price'] - $val['sales_price']) : false;
$product['sellOut'] = boolval($val['price_down']);
$result[] = $product;
}
}
return $result;
... ... @@ -172,7 +188,43 @@ class UserModel
// 处理用户收藏的品牌数据
if (isset($favBrand['data']) && !empty($favBrand['data'])) {
$result = $favBrand['data'];
$brand = array();
foreach ($favBrand['data']['brand_list'] as $val) {
$brand = array();
$brand['id'] = $val['brand_id'];
$brand['brandImg'] = Images::getImageUrl($val['brand_ico'], 235, 314);
$brand['brandName'] = $val['brand_name'];
$brand['update'] = $val['new_product_num'];
$brand['discount'] = $val['product_discount_num'];
$brand['link'] = '#';
// 处理品牌产品
$product = array();
foreach ($val['new_product'] as $one) {
$product = array();
$product['imgUrl'] = Images::getImageUrl($one['default_images'], 235, 314);
$product['price'] = '¥'.$one['market_price'];
$product['discount'] = '¥'.$one['sales_price'];
$brand['productList'][] = $product;
}
$result[] = $brand;
}
}
return $result;
}
public static function favoriteDelete($uid, $fav_id)
{
$result = array();
if (empty($fav_id)) {
$result['code'] = 400;
$result['message'] = '取消的商品不可用';
} else {
$result = UserData::favoriteDelete($uid, $fav_id);
}
return $result;
... ... @@ -213,8 +265,11 @@ class UserModel
$coupons = UserData::couponData($uid, $status);
// 处理优惠券数据
if (isset($coupons['data']) && !empty($coupons['data'])) {
$result = $coupons['data']['info'];
if (!empty($coupons['unused'])) {
$result['unused'] = $coupons['unused']['info'];
}
if (!empty($coupons['used'])) {
$result['used'] = $coupons['used']['info'];
}
return $result;
... ... @@ -333,6 +388,27 @@ class UserModel
}
/**
* 删除地址
*
* @param int $uid 用户ID
* @param int $id 地址唯一标识符id
* @return array|mixed 处理之后的返回数据
*/
public static function deleteAddress($uid, $id)
{
$result = array('code' => 400, 'message' => '错误');
// 调用接口删除地址
$address = UserData::deleteAddress($uid, $id);
// 处理返回结果
if ($address && isset($address['code'])) {
$result = $address;
}
return $result;
}
/**
* 处理意见反馈数据
*
* @param string $udid 客户端唯一标识
... ... @@ -353,14 +429,11 @@ class UserModel
$one = array();
foreach ($suggest['data']['list'] as $val) {
$one = array();
$one['hasImage'] = $val['has_image'];
$one['imgUrl'] = Helpers::getImageUrl($val['cover_image'], 640, 240);
$one['title'] = $val['filter_content'];
$one['content'] = $val['reply_content'];
$one['good'] = $val['is_reliable'];
$one['bad'] = !$val['is_reliable'];
$one['goodNum'] = $val['reliable'];
$one['badNum'] = $val['unreliable'];
$one['good'] = boolval($val['is_reliable']);
$one['bad'] = !$one['good'];
$result[] = $one;
}
... ... @@ -370,6 +443,25 @@ class UserModel
}
/**
* 图片上传
*
* @return array|mixed 保存意见反馈数据之后的返回
*/
public static function saveSuggestImg($filename)
{
$result = array();
if (!isset($_FILES[$filename])) {
$result['code'] = 400;
$result['message'] = '文件上传错误';
} else {
$result = Images::saveImage($filename);
}
return $result;
}
/**
* 保存意见反馈数据
*
* @param int $uid 用户ID
... ...