Authored by yangyang

解决冲突


guang.m.yohobuy.com/guang/index/clear?type=boys
guang.m.yohobuy.com/guang/index/clear?type=girls
guang.m.yohobuy.com/guang/index/clear?type=kids
guang.m.yohobuy.com/guang/index/clear?type=lifestyle
http://new.yohobuy.com/cache/clear?key=Default_Kids_index&token=yoho9646abcdef
http://new.yohobuy.com/cache/clear?key=Default_Lifestyle_index&token=yoho9646abcdef
http://new.yohobuy.com/cache/clear?key=Default_Woman_index&token=yoho9646abcdef
##http://new.yohobuy.com/cache/clear?key=Default_Default_index&token=yoho9646abcdef
其中token就按照上述中去填写,key代表具体要清的缓存的键
具体key的对应关系如下:
key 说明
Default_Kids_index 潮童页面缓存
Default_Lifestyle_index 创意生活页面缓存
Default_Woman_index 女生页面缓存
Default_Default_index 男生
\ No newline at end of file
... ...
No preview for this file type
No preview for this file type
... ... @@ -261,6 +261,7 @@ class AbstractAction extends Controller_Abstract
* 获取Session
*
* @param string $name 名称
* @return mixed
*/
public function getSession($name)
{
... ... @@ -270,18 +271,25 @@ class AbstractAction extends Controller_Abstract
/**
* 获取当前登录的用户ID
*
* @param bool $useSession 是否使用Session会话
* @return int
* @todo
*/
protected function getUid()
protected function getUid($useSession = false)
{
if (!$this->_uid) {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$this->_uid = $cookieList[1];
$this->_uname = $cookieList[0];
// 从SESSION获取
if ($useSession) {
$this->_uid = $this->getSession('_UID');
}
// 从COOKIE获取
else {
$cookie = $this->getCookie('_UID');
if (!empty($cookie)) {
$cookieList = explode('::', $cookie);
if (isset($cookieList[1]) && is_numeric($cookieList[1])) {
$this->_uid = $cookieList[1];
$this->_uname = $cookieList[0];
}
}
}
}
... ...
... ... @@ -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
... ... @@ -267,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 客户端唯一标识
... ...
... ... @@ -133,14 +133,8 @@ class Images
{
$images[$files['name']] = $files['tmp_name'];
}
if($_SERVER['HTTP_HOST'] != 'test.service.api.yohobuy.com') //代理转接
{
return self::agentCurlImage($images);
}
else
{
return self::uploadStreamImage($images);
}
return self::uploadStreamImage($images);
}
/**
... ... @@ -199,43 +193,6 @@ class Images
}
}
/**
* 代理上传图片
*
* @param array|string $files
* @return array
*/
private static function agentCurlImage($file)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_VERBOSE, 0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (compatible;)");
curl_setopt($ch, CURLOPT_URL, 'http://test.service.api.yohobuy.com/sns/ajax/uploadimg');
curl_setopt($ch, CURLOPT_POST, true);
$params = array();
$files = is_array($file) ? $file : array($file);
foreach($files as $key => $name)
{
$key = is_numeric($key) ? $key.'.jpg' : $key;
$filename = dirname($name).'/'.$key;
rename($name, $filename);
if (@class_exists('\CURLFile'))
{
$params["images[$key]"] = new \CURLFile(realpath($filename));
}
else
{
$params["images[$key]"] = '@' . realpath($filename);
}
}
curl_setopt($ch, CURLOPT_POSTFIELDS, $params);
$response = json_decode(curl_exec($ch), true);
return $response['data'];
}
/**
* 获取模板的图片地址
* @param $fileName
... ...
... ... @@ -112,7 +112,7 @@ orderHammer.on('tap', function(e) {
//Order delete
$.ajax({
type: 'GET',
url: '/home/deleteOrder',
url: '/home/delOrder',
data: {
id: 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,11 +11,11 @@
</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>
... ... @@ -54,26 +54,26 @@
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/">
<a class="list-item" href="/home/coupons">
<span class="iconfont icon">&#xe63a;</span>
优惠券
<span class="iconfont num">{{coupon_num}} &#xe604;</span>
</a>
<a class="list-item" href="/home/">
<a class="list-item" href="/home/currency">
<span class="iconfont icon">&#xe635;</span>
YOHO
<span class="iconfont num">{{yoho_coin_num}} &#xe604;</span>
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/">
<a class="list-item" href="/home/message">
<span class="iconfont icon">&#xe636;</span>
消息
<span class="iconfont num">{{inbox_total}} &#xe604;</span>
</a>
</div>
<div class="group-list">
<a class="list-item" href="/home/">
<a class="list-item" href="/home/onlineService">
<span class="iconfont icon">&#xe63c;</span>
在线客服
<span class="iconfont num">&#xe604;</span>
... ...
... ... @@ -18,10 +18,27 @@ use LibModels\Wap\Home\OrderData;
class HomeController extends AbstractAction
{
protected $_uid;
// /**
// * 初始化
// */
// public function init()
// {
// // 检查用户是否登录, 未登录则跳转到登录页
// $uid = $this->getUid(true);
// if (!$uid) {
// $this->go(Helpers::url('/signin.html'));
// }
//
// parent::init();
// }
/**
* 个人中心入口
*/
public function indexAction() {
public function indexAction()
{
// 设置网站标题
$this->setTitle('个人中心');
$this->setNavHeader('个人中心', true, SITE_MAIN);
... ... @@ -30,7 +47,7 @@ class HomeController extends AbstractAction
$uid = 8826435;
$data = \Index\UserModel::getUserProfileData($uid);
$data += \Index\UserModel::getInfoNumData($uid);
// 优选新品数据
$channel = Helpers::getChannelByCookie();
$data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
... ... @@ -45,131 +62,54 @@ class HomeController extends AbstractAction
/**
* 用户收藏的商品
*/
public function favoriteAction() {
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() {
public function favoriteDelAction()
{
$result = array();
//$this->echoJson();
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() {
public function favoritebrandAction()
{
$uid = $this->getUid();
$gender = Helpers::getGenderByCookie();
... ... @@ -181,7 +121,8 @@ class HomeController extends AbstractAction
/**
* 个人信息
*/
public function personalDetailsAction() {
public function personalDetailsAction()
{
$this->setTitle('个人信息');
$this->setNavHeader('个人信息', true, SITE_MAIN);
... ... @@ -195,12 +136,13 @@ class HomeController extends AbstractAction
/**
* YOHO币
*/
public function currencyAction() {
public function currencyAction()
{
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$currency = \Index\UserModel::getYohoCoinData($uid);
$currency['pageFooter'] = true;
... ... @@ -210,7 +152,8 @@ class HomeController extends AbstractAction
/**
* 优惠券
*/
public function couponsAction() {
public function couponsAction()
{
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
... ... @@ -221,19 +164,19 @@ class HomeController extends AbstractAction
'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
'couponsPage' => true
);
$this->_view->display('coupons', $coupons);
}
/**
* 我的消息
*/
public function messageAction() {
public function messageAction()
{
// $uid = $this->getUid();
$page = $this->get('page', 0);
$size = $this->get('size', 10);
$uid = 967016;
$uid = 8826435;
$messages = \Index\UserModel::getMessageData($uid, $page, $size);
print_r($messages);
... ... @@ -242,13 +185,14 @@ class HomeController extends AbstractAction
/**
* 地址管理
*/
public function addressAction() {
public function addressAction()
{
// 设置网站标题
$this->setTitle('地址管理');
$this->setNavHeader('地址管理', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
... ... @@ -266,12 +210,13 @@ class HomeController extends AbstractAction
/**
* 修改地址或者添加新地址
*/
public function saveAddressAction() {
public function saveAddressAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
... ... @@ -293,12 +238,13 @@ class HomeController extends AbstractAction
/**
* 设置默认地址
*/
public function defaultAddressAction() {
public function defaultAddressAction()
{
$result = array();
if ($this->isAjax()) {
// $uid = $this->getUid();
$uid = 967016;
$uid = 8826435;
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
... ... @@ -311,8 +257,31 @@ 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() {
public function onlineServiceAction()
{
// 设置网站标题
$this->setTitle('在线客服');
$this->setNavHeader('在线客服', true, SITE_MAIN);
... ... @@ -327,7 +296,8 @@ class HomeController extends AbstractAction
}
//在线客服-具体详情
public function onlineServiceDetailAction() {
public function onlineServiceDetailAction()
{
$service = array();
$cateId = $this->get('cateId', 0);
$cateName = $this->get('cateName', '');
... ... @@ -342,14 +312,16 @@ class HomeController extends AbstractAction
/**
* 我的逛
*/
public function myGuangAction() {
public function myGuangAction()
{
echo 'My Guang';
}
/**
* 意见反馈
*/
public function suggestAction() {
public function suggestAction()
{
// 设置网站标题
$this->setTitle('意见反馈');
$this->setNavHeader('意见反馈', true, SITE_MAIN);
... ... @@ -371,27 +343,28 @@ class HomeController extends AbstractAction
/**
* 意见反馈-提交表单页面
*/
public function suggestSubAction() {
// 设置网站标题
$this->setTitle('反馈问题');
$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);
public function suggestSubAction()
{
// 设置网站标题
$this->setTitle('反馈问题');
$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);
}
... ... @@ -399,19 +372,19 @@ class HomeController extends AbstractAction
/**
* 异步上传图片
*/
public function suggestimgUploadAction() {
if ($this->isAjax()) {
$filename = $this->get('filename', '');
$result = \Plugin\Images::saveImage($filename);
public function suggestimgUploadAction()
{
$filename = $this->post('filename', '');
$result = \Index\UserModel::saveSuggestImg($filename);
$this->echoJson($result);
}
$this->echoJson($result);
}
/**
* 异步保存意见反馈数据
*/
public function savesuggestAction() {
public function savesuggestAction()
{
if ($this->isAjax()) {
$uid = $this->getUid();
$content = $this->post('content', '');
... ... @@ -425,7 +398,8 @@ class HomeController extends AbstractAction
/**
* 会员等级展示页
*/
public function gradeAction() {
public function gradeAction()
{
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
... ... @@ -444,7 +418,8 @@ class HomeController extends AbstractAction
* 会员特权查看页
*/
public function preferentialAction() {
public function preferentialAction()
{
//设置网站seo信息
$this->setTitle('会员等级');
//显示网站导航头部信息
... ... @@ -461,7 +436,8 @@ class HomeController extends AbstractAction
* 我的订单页面
*/
public function orderAction() {
public function orderAction()
{
//获得type值
$type = $this->get('type', 1);
$this->setTitle('我的订单');
... ... @@ -481,7 +457,8 @@ class HomeController extends AbstractAction
}
//ajax请求订单页面
public function getOrdersAction() {
public function getOrdersAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
... ... @@ -515,28 +492,31 @@ class HomeController extends AbstractAction
* 我的订单-取消订单
*/
public function cancelOrderAction() {
public function cancelOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
}
//传入order_code和uid以取消订单
$order_code = $this->get('id');
$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);
$this->echoJson($data);
$this->echoJson($data);
}
/*
* 我的订单-删除订单
*/
public function delOrderAction() {
public function delOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax()) {
$this->error();
... ... @@ -549,33 +529,14 @@ class HomeController extends AbstractAction
$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) {
$arr = array();
$arr['code'] = $data['code'];
$arr['message'] = $data['message'];
echo json_encode($arr);
}
}
/**
* 付款
*/
public function getPaymentAction() {
$contentCode = $this->get('content_code');
$contentCode = '04cf5abaa7c20178325a07c4a833782c';
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$data = OrderData::getPaymentData($contentCode, $gender, $yh_channel);
//print_r($data);
if ($data['code'] == 200) {
}
$this->echoJson($data);
}
/**
* 订单详情页
*/
public function orderDetailAction() {
public function orderDetailAction()
{
$data = array(
'name' => '毛毛莉Lydia',
'phoneNum' => '18600001133',
... ...
<?php
namespace home;
namespace Home;
use LibModels\Wap\Home\GradeData;
use Action\AbstractAction;
use Plugin\Helpers;
/**
... ... @@ -15,7 +14,8 @@ class GradeModel
* 获取个人中心-会员等级数据
*/
public static function getGrade($gender, $channel, $uid) {
public static function getGrade($gender, $channel, $uid)
{
$result = array();
if (USE_CACHE) {
... ... @@ -28,41 +28,41 @@ class GradeModel
//调用接口获取数据
$data = GradeData::getGradeData($gender, $channel, $uid);
if (!empty($data['grade'])) {
switch (intval($data['grade']['current_vip_level'])) {
case 0://普通会员
$result['vipGrade']['vip0'] = true;
break;
case 1://银卡会员
$result['vipGrade']['vip1'] = true;
break;
case 2://金卡会员
$result['vipGrade']['vip2'] = true;
break;
case 3://白金会员
$result['vipGrade']['vip3'] = true;
break;
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
//升级下一等级会员的进度;
$result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
//距离升级所需消费金额
if ($data['grade']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
}
//消费总计
$result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
//username 调用获取用户基本信息数据,获得username;
//$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $data['userProfile']['username'];
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
//当前vip等级享受的特权
$result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
}
if (!empty($data['grade'])) {
switch (intval($data['grade']['current_vip_level'])) {
case 0://普通会员
$result['vipGrade']['vip0'] = true;
break;
case 1://银卡会员
$result['vipGrade']['vip1'] = true;
break;
case 2://金卡会员
$result['vipGrade']['vip2'] = true;
break;
case 3://白金会员
$result['vipGrade']['vip3'] = true;
break;
}
//今年总消费
$result['vipGrade']['costOfThisYear'] = $data['grade']['current_year_cost'];
//升级下一等级会员的进度;
$result['vipGrade']['percent'] = 100 * (round($data['grade']['current_total_cost'] / $data['grade']['next_need_cost'], 2));
//距离升级所需消费金额
if ($data['grade']['current_vip_level'] != 3) {
$result['vipGrade']['costGap'] = $data['grade']['upgrade_need_cost'];
}
//消费总计
$result['vipGrade']['sumCost'] = $data['grade']['current_total_cost'];
//username 调用获取用户基本信息数据,获得username;
//$userProfile = GradeData::getUserProfileData($gender,$uid,$channel);
$result['vipGrade']['name'] = $data['userProfile']['username'];
//跳转url(会员特权详情)
$result['vipGrade']['allUrl'] = Helpers::url('/Home/preferential', null);
//当前vip等级享受的特权
$result['vipGrade']['privilege'] = $data['grade']['enjoy_preferential'];
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
... ... @@ -82,7 +82,8 @@ class GradeModel
* 获取个人中心-会员特权详情页
*/
public function getPreferential($channel, $uid) {
public function getPreferential($channel, $uid)
{
$result = array();
if (USE_CACHE) {
... ...
... ... @@ -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;
... ... @@ -336,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 客户端唯一标识
... ... @@ -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
... ...
<?php
namespace home;
namespace Home;
use LibModels\Wap\Home\OnlineData;
use Action\AbstractAction;
use Plugin\Helpers;
/**
... ... @@ -20,13 +19,10 @@ class OnlineModel
$cateInfo = $res['data'];
$question = array();
$tab = array();
if ($cateInfo)
{
foreach ($cateInfo as $key => $value)
{
if ($cateInfo) {
foreach ($cateInfo as $key => $value) {
//强制截成3个tab
if ($key > 2)
{
if ($key > 2) {
break;
}
$tab[$key]['tabid'] = 'tab' . $value['id'];
... ... @@ -37,12 +33,10 @@ class OnlineModel
$question[$key]['current'] = (!$key) ? TRUE : FALSE;
$sub = $value['sub'];
$qTmp = array();
if ($sub)
{
foreach ($sub as $sk => $sv)
{
if ($sub) {
foreach ($sub as $sk => $sv) {
$qTmp[$sk]['title'] = $sv['category_name'];
$qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'].'&cateName='.$sv['category_name'];
$qTmp[$sk]['link'] = '/home/onlineservicedetail?cateId=' . $sv['id'] . '&cateName=' . $sv['category_name'];
}
}
$question[$key]['list'] = $qTmp;
... ... @@ -64,19 +58,15 @@ class OnlineModel
public static function getOnlineServiceDetail($cateId, $clinetType = 'iphone')
{
$result = array();
if (!$cateId)
{
if (!$cateId) {
return $result;
}
$res = OnlineData::getOnlineServiceDetail($cateId, $clinetType);
$questionInfo = $res['data'];
if ($questionInfo)
{
if ($questionInfo) {
$list = array();
if ($questionInfo)
{
foreach ($questionInfo as $qk => $qv)
{
if ($questionInfo) {
foreach ($questionInfo as $qk => $qv) {
$list[$qk]['q'] = $qv['title'];
$list[$qk]['a'] = $qv['content'];
}
... ...