Authored by Lynnic

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

... ... @@ -16,8 +16,8 @@ use Plugin\Cache;
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/';
... ... @@ -29,14 +29,14 @@ class Yohobuy
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_PRODUCTDETAIL = 'http://172.16.6.145:8080/'; // 商品详情页
const API_URL_PRODUCTDETAIL = 'http://192.168.102.209:18080/yoho-product/'; // 商品详情页
/**
* 私钥列表
*
* @var array
*/
private static $privateKeyList = array(
'android' => 'fd4ad5fcfa0de589ef238c0e7331b585',
'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa',
... ... @@ -384,4 +384,51 @@ class Yohobuy
\Yar_Concurrent_Client::loop($callback);
}
/**
* 提交json格式数据请求java有关接口
*
* @param string $url 接口URL
* @param array $data 参数列表
* @param bool $returnJson 控制是否返回json格式数据
* @param int $timeout 超时时间
* @param array $cookie
* @return mixed
*/
public static function jsonPost($url, $data = array(), $returnJson = false, $timeout = 3, $cookie = array())
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
if (!empty($cookie)) {
$cookie_str = array();
foreach ($cookie as $key => $val) {
$cookie_str[] = urlencode($key) . '=' . urlencode($val);
}
curl_setopt($ch, CURLOPT_COOKIE, implode(';', $cookie_str));
}
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
if (!empty($data)) {
$data_string = json_encode($data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
// 设置json的Header
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
'Content-Type: application/json',
'Content-Length: ' . strlen($data_string)
));
}
$result = curl_exec($ch);
if (!$returnJson && !empty($result)) {
$result = json_decode($result, true);
}
curl_close($ch);
$data = array();
return $result;
}
}
... ...
... ... @@ -45,4 +45,6 @@ class CacheConfig
const KEY_ACTION_GUANG_DETAIL_DATA = 'key_action_guang_detail_data'; // 逛内容详情
const KEY_ACTION_GUANG_RSS_DATA = 'key_action_guang_detail_data'; // 逛订阅内容
const KEY_ACTION_ADDRESS_LIST_DATA = 'key_action_address_list_data'; // 地址树数据
}
... ...
... ... @@ -171,12 +171,11 @@ class UserData
* 优惠券数据
*
* @param int $uid 用户ID
* @param int $status 优惠券状态,0表示未使用,1表示已使用
* @param int $page 第几页,默认1
* @param int $limit 限制读取的数目,默认10
* @return array 优惠券接口返回的数据
*/
public static function couponData($uid, $status, $page = 1, $limit = 10)
public static function couponData($uid, $page = 1, $limit = 10)
{
$urlList = array();
... ...
... ... @@ -17,403 +17,30 @@ use Api\Yohobuy;
class DetailData
{
const PRODUCT_BASE_INFO = 'queryProductBasicInfo';
const PRODUCT_GOODS_INFO = 'queryGoodsById';
const PRODUCT_BASE_INFO = 'product/queryProductDetailByProductId';
const PRODUCT_SIZE_INFO = 'product/queryProductIntroBySkn';
/**
* 商品基本信息
*
* @param int $productId
* @param int $productId 商品ID
* @param int $uid 用户ID
* @return array
*/
public static function baseInfo($productId, $uid)
{
$data = json_decode('{
"arrivalTime": 1309514897,
"attribute": 1,
"auditingTime": 0,
"brand": {
"brandAlif": "R",
"brandBanner": "/2011/06/26/14/02d2214a0a7feb6112a8ebbd39de301192.jpg",
"brandCertificate": "",
"brandCss": "",
"brandDomain": "REVELATOR",
"brandGroupId": 0,
"brandIco": "http://img13.static.yhbimg.com/brandLogo/2011/06/26/14/020b083d91ebd1ff9a0600a8421fdbb388.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90",
"brandInitials": "",
"brandKeyword": "REVELATOR",
"brandLevel": 1,
"brandName": "REVELATOR",
"brandNameCn": "",
"brandNameEn": "REVELATOR",
"brandOutline": "所有围绕在我们身边并且默默在对这个世界付出的人,都是我们所认知的启示者。",
"brandScale": 3,
"brandSign": "",
"brandStyle": "个性,潮流,嘻哈,街头,",
"brandTemplate": 1,
"brandTypeId": 3,
"brandUrl": "",
"hotKeyword": "REVELATOR",
"id": 119,
"isHot": "N",
"isIndependent": "N",
"orderBy": 0,
"parentId": 0,
"relateBrandIds": "",
"shelvesBrandTime": 0,
"staticContentCode": "",
"status": 0
},
"brandId": 119,
"categoryBoList": [
{
"categoryId": 1,
"categoryName": "上衣",
"isleaf": true,
"level": 1
},
{
"categoryId": 11,
"categoryName": "T恤",
"isleaf": true,
"level": 2
},
{
"categoryId": 114,
"categoryName": "T恤",
"isleaf": true,
"level": 3
}
],
"cnAlphabet": "REVELATORTHERDuanXiuTXu",
"createTime": 1308726112,
"editTime": 0,
"erpProductId": 50004331,
"expectArrivalTime": 1309514897,
"firstShelveTime": 1309514897,
"folderId": 0,
"gender": "1",
"goodsList": [
{
"colorId": 1,
"colorImage": "http://img12.static.yhbimg.com/goodsimg/2012/03/02/14/02ea70da41df2d162fe1ec1c5d53367086.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90",
"colorName": "白",
"factorySn": "",
"firstShelveTime": 1309514897,
"goodsImagesList": [
{
"angle": 0,
"genderCover": 0,
"goodsId": 3241,
"id": 131463,
"imageName": "",
"imageUrl": "http://img12.static.yhbimg.com/goodsimg/2012/03/02/14/02ea70da41df2d162fe1ec1c5d53367086.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90",
"intro": 0,
"isDefault": "Y",
"orderBy": 1,
"productId": 2631,
"status": 1
},
{
"angle": 0,
"genderCover": 0,
"goodsId": 3241,
"id": 131462,
"imageName": "",
"imageUrl": "http://img13.static.yhbimg.com/goodsimg/2012/03/02/14/02df4081143c563f1d0ea8192a316f40fd.jpg?imageMogr2/thumbnail/{width}x{height}/extent/{width}x{height}/background/d2hpdGU=/position/center/quality/90",
"intro": 0,
"isDefault": "N",
"orderBy": 0,
"productId": 2631,
"status": 1
}
],
"goodsName": "THE R TEE",
"goodsSizeBoList": [
{
"createTime": 0,
"goodsId": 3241,
"goodsSizeSkuId": 102000,
"goodsSizeStorageNum": 0,
"id": 203,
"orderBy": 1175,
"sizeName": "M",
"sortId": 0,
"updateTime": 0
},
{
"createTime": 0,
"goodsId": 3241,
"goodsSizeSkuId": 102001,
"goodsSizeStorageNum": 0,
"id": 201,
"orderBy": 1169,
"sizeName": "L",
"sortId": 0,
"updateTime": 0
}
],
"id": 3241,
"isDefault": "N",
"isDown": "N",
"matchExplain": "",
"productId": 2631,
"productSkc": 3241,
"status": 1,
"viewNum": 0
}
],
"id": 2631,
"isAdvance": "N",
"isAuditing": "Y",
"isDown": "N",
"isEdit": 1,
"isHot": "N",
"isJit": "N",
"isLimited": "N",
"isNew": "N",
"isOutlets": "N",
"isPromotion": 0,
"isRecommend": "N",
"isReplenishment": 0,
"isRetrieval": "N",
"isSales": "Y",
"isSpecial": "N",
"isCollect": "N",
"maxSortId": 1,
"middleSortId": 11,
"phrase": "以品牌字首R字母為设计重点,环绕式轮廓线营造渐层视觉 ",
"productName": "REVELATORTHER 短袖T恤",
"productPriceBo": {
"formatMarketPrice": "¥255.0",
"formatSalesPrice": "¥99.0",
"formatSpecialPrice": "¥99.0",
"marketPrice": 255,
"productId": 2631,
"salesPrice": 99,
"specialPrice": 99,
"vipPrice": "¥0.0",
"vipPrices": [
{
"vipLevel": 1,
"vipPrice": "¥94",
"vipTitle": "银卡"
},
{
"vipLevel": 2,
"vipPrice": "¥89",
"vipTitle": "金卡"
},
{
"vipLevel": 3,
"vipPrice": "¥87",
"vipTitle": "白金"
}
]
},
"productTagBoList": [
{
"tagLabel": "is_discount",
"tagValue": "Y"
},
{
"tagLabel": "is_soon_sold_out",
"tagValue": "Y"
}
],
"promotionBoList": [
{
"promotionTitle": "【秋冬热促】满¥2188减¥800",
"promotionType": "满减"
},
{
"promotionTitle": "【秋冬热促】满¥1488减¥500",
"promotionType": "满减"
}
],
"consultBoWrapper": {
"consultBoList": [
{
"answer": "您好,我们会联系品牌尽快补货,目前没有办法给您确切的答复,建议您进行到货通知的登记,补货到了,会第一时间短信联系您的。感谢您对yoho!有货的关注。",
"answerTime": "2012-05-02 15:10:08",
"ask": "请问 这件的灰色的L码还会不会补货?",
"askTime": "2012-05-02 14:23:09",
"id": 68252
}
],
"consultTotal": 5
},
"commentBoWrapper": {
"commentBoList": [
{
"productId":"您好,我们会联系品牌尽快补货,目前没有办法给您确切的答复,建议您进行到货通知的登记,补货到了,会第一时间短信联系您的。感谢您对yoho!有货的关注。",
"id":"2012-05-02 15:10:08",
"uid":"请问 这件的灰色的L码还会不会补货?",
"content":"2012-05-02 14:23:09",
"createTime":"2012-05-02 14:23:09",
"sizeName":"L",
"colorName":"red",
"nickName":"xieyong",
"headIcon":"http://dddd"
}
],
"commentTotal": 5
},
"productUrl":"http://m.yohobuy.com/product/pro_2631_3241/REVELATORTHERDuanXiuTXu.html",
"salableTime": "0",
"salesPhrase": "",
"seasons": "summer",
"sellChannels": "0",
"seriesId": 0,
"shelveTime": 1325135169,
"shopId": 0,
"smallSortId": 114,
"sortId": 0,
"status": 1,
"storage": 0,
"style": "",
"supplierId": 0,
"vipDiscountType": 1
}', true);
return $data;
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array('param' => intval($productId), 'userId' => intval($uid)) );
}
/**
* 商品尺码信息
*
* @param int $productSkn
* @param int $productSkn 商品SKN号
* @return array
*/
public static function sizeInfo($productSkn)
{
$data = json_decode('{
"modelBos": [],
"null": false,
"productDescBo": {
"colorName": "灰色",
"erpProductId": "50002468",
"gender": 1,
"null": false,
"standardBos": []
},
"productExtra": {
"null": true
},
"productIntroBo": {
"productId": 10,
"productIntro": "<p>\r\n\t破壳小队长印花笔记本,夸张而卡通的设计,简单白皙的纸张,配有手缝带,味道十足。<br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/02efe1bb1bc80d0ffd2911dc2f160c7974-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/02b741288ddc8095598bbc7c487c8bc892-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/028c47cc3002d40c42f35120007f13ff17-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/026c9a61457a93c0473e4674f85344c8f0-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t<br />\r\n\t<img src=\"http://img04.static.yohobuy.com/thumb/2011/06/23/04/02da50cfde3d6cf203d8cb3df1eaa29353-0750x1500-1-goodsimg.jpg\" /><br />\r\n\t<br />\r\n\t&nbsp;</p>"
},
"productMaterialList": [],
"sizeImage": "http://static.yohobuy.com/images/1.jpg",
"sizeInfoBo": {
"sizeAttributeBos": [
{
"attributeName": "后衣长",
"id": 49
},
{
"attributeName": "前衣长",
"id": 48
},
{
"attributeName": "袖长",
"id": 5
},
{
"attributeName": "胸围",
"id": 4
},
{
"attributeName": "肩宽",
"id": 3
},
{
"attributeName": "后中长",
"id": 1
}
],
"sizeBoList": [
{
"id": 201,
"sizeName": "L",
"sortAttributes": [
{
"id": 49,
"sizeValue": ""
},
{
"id": 48,
"sizeValue": ""
},
{
"id": 5,
"sizeValue": "64"
},
{
"id": 4,
"sizeValue": "108"
},
{
"id": 3,
"sizeValue": "49"
},
{
"id": 1,
"sizeValue": "67"
}
]
},
{
"id": 203,
"sizeName": "M",
"sortAttributes": [
{
"id": 5,
"sizeValue": "62"
},
{
"id": 4,
"sizeValue": "102"
},
{
"id": 3,
"sizeValue": "46"
},
{
"id": 1,
"sizeValue": "64"
},
{
"id": 49,
"sizeValue": ""
},
{
"id": 48,
"sizeValue": ""
}
]
}
]
},
"washTipsBoList": [
{
"caption": "不可转笼翻转干燥",
"img": "http://static.yohobuy.com/images/wash_2.png"
},
{
"caption": "30度水温弱速洗",
"img": "http://static.yohobuy.com/images/wash_3.png"
},
{
"caption": "分色洗涤",
"img": "http://static.yohobuy.com/images/wash_7.png"
}
]
}', true);
return $data;
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn) ) );
}
}
... ...
... ... @@ -87,8 +87,6 @@
<div class="gap-block"></div>
{{> product/product_description}}
{{#cartInfo}}
<div class="cart-bar">
<span class="num-tag">{{numInCart}}</span>
... ...
{{> product/product_description}}
\ No newline at end of file
... ...
... ... @@ -20,20 +20,20 @@ class HomeController extends AbstractAction
protected $_uid;
// /**
// * 初始化
// */
// public function init()
// {
// // 检查用户是否登录, 未登录则跳转到登录页
// $uid = $this->getUid(true);
// $action = $this->getRequest()->getActionName();
// if (!$uid && $action !== 'index') {
// $this->go(Helpers::url('/signin.html'));
// }
//
// parent::init();
// }
/**
* 初始化
*/
public function init()
{
// 检查用户是否登录, 未登录则跳转到登录页
$uid = 8826435; //$this->getUid(true);
$action = $this->getRequest()->getActionName();
if (!$uid && $action !== 'index') {
$this->go(Helpers::url('/signin.html'));
}
parent::init();
}
/**
* 个人中心入口
... ... @@ -44,21 +44,20 @@ class HomeController extends AbstractAction
$this->setTitle('个人中心');
$this->setNavHeader('个人中心');
$data = array(
'myIndexPage' => true,
'pageFooter' => true
);
$data = array(
'myIndexPage' => true,
'pageFooter' => true
);
$uid = $this->getUid();
if ($uid) {
$data['isLogin'] = true;
$uid = 8826435;
$data += \Index\UserModel::getUserProfileData($uid);
$data += \Index\UserModel::getInfoNumData($uid);
// 优选新品数据
$channel = Helpers::getChannelByCookie();
$data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
}
if ($uid) {
$data['isLogin'] = true;
$data += \Index\UserModel::getUserProfileData($uid);
$data += \Index\UserModel::getInfoNumData($uid);
// 优选新品数据
$channel = Helpers::getChannelByCookie();
$data['recommendForYou'] = \Index\UserModel::getPreferenceData($channel);
}
$this->_view->display('index', $data);
}
... ... @@ -74,23 +73,22 @@ class HomeController extends AbstractAction
$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,
'favorite' => true,
'hasFavProduct' => $favProducts,
'hasFavBrand' => $favBrands
);
// 判断是否为品牌收藏页
if ($tab === 'brand') {
$data['brandTab'] = true;
}
$data = array(
'favPage' => true, //加载js
'pageFooter' => true,
'favorite' => true,
'hasFavProduct' => $favProducts,
'hasFavBrand' => $favBrands
);
// 判断是否为品牌收藏页
if ($tab === 'brand') {
$data['brandTab'] = true;
}
$this->_view->display('favorite', $data);
}
... ... @@ -102,20 +100,16 @@ 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);
}
}
... ... @@ -128,8 +122,7 @@ class HomeController extends AbstractAction
$this->setTitle('个人信息');
$this->setNavHeader('个人信息', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 967016;
$uid = $this->getUid();
$data = \Index\UserModel::getUserProfileData($uid);
$data['personalDetailsPage'] = true;
$data['pageFooter'] = true;
... ... @@ -144,8 +137,7 @@ class HomeController extends AbstractAction
$this->setTitle('YOHO币');
$this->setNavHeader('YOHO币', true, false);
// $uid = $this->getUid();
$uid = 8826435;
$uid = $this->getUid();
$currency = \Index\UserModel::getYohoCoinData($uid);
$currency['pageFooter'] = true;
... ... @@ -157,14 +149,12 @@ class HomeController extends AbstractAction
*/
public function couponsAction()
{
$this->setTitle('优惠券');
$this->setNavHeader('优惠券', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$status = $this->get('status', 0);
$this->setNavHeader('优惠券');
$uid = $this->getUid();
$coupons = array(
'couponsUrl' => \Index\UserModel::getCouponData($uid, $status),
'couponsUrl' => \Index\UserModel::getCouponData($uid),
'couponsPage' => true
);
$this->_view->display('coupons', $coupons);
... ... @@ -175,11 +165,10 @@ class HomeController extends AbstractAction
*/
public function messageAction()
{
// $uid = $this->getUid();
$uid = $this->getUid();
$page = $this->get('page', 0);
$size = $this->get('size', 10);
$uid = 8826435;
$messages = \Index\UserModel::getMessageData($uid, $page, $size);
print_r($messages);
... ... @@ -192,16 +181,12 @@ class HomeController extends AbstractAction
{
// 设置网站标题
$this->setTitle('地址管理');
$this->setNavHeader('地址管理', true, SITE_MAIN);
// $uid = $this->getUid();
$uid = 8826435;
$this->setNavHeader('地址管理');
$uid = $this->getUid();
$address = \Index\UserModel::getAddressData($uid);
$addressList = \Index\UserModel::getAddressListData($uid);
// print_r($addressList);
$this->_view->display('address', array(
'addressPage' => true,
'pageFooter' => true,
... ... @@ -217,10 +202,8 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
if ($this->isAjax()) {
$uid = $this->getUid();
$address = $this->post('address', '');
$area_code = $this->post('area_code', '');
$consignee = $this->post('consignee', '');
... ... @@ -232,12 +215,9 @@ 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);
}
}
... ... @@ -249,21 +229,15 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
if ($this->isAjax()) {
$uid = $this->getUid();
$id = $this->post('id', '');
$result = \Index\UserModel::setDefaultAddress($uid, $id);
}
if (empty($result))
{
if (empty($result)) {
echo ' ';
}
else
{
} else {
$this->echoJson($result);
}
}
... ... @@ -275,21 +249,16 @@ class HomeController extends AbstractAction
{
$result = array();
if ($this->isAjax())
{
// $uid = $this->getUid();
$uid = 8826435;
if ($this->isAjax()) {
$uid = $this->getUid();
$id = $this->post('id', '');
$result = \Index\UserModel::deleteAddress($uid, $id);
}
if (empty($result))
{
if (empty($result)) {
echo ' ';
}
else
{
} else {
$this->echoJson($result);
}
}
... ... @@ -316,8 +285,7 @@ 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('在线客服');
... ... @@ -333,25 +301,19 @@ class HomeController extends AbstractAction
$page = $this->get('page', 1);
$limit = $this->get('limit', 10);
$uid = $this->getUid();
$uid=5687179;
$gender = Helpers::getGenderByCookie();
$yh_channel = Helpers::getChannelByCookie();
$guangInfo = \home\GuangModel::getMyGuang($uid, $page, $yh_channel, $gender, $limit);
$totalPage = $guangInfo['totalPage'];
unset($guangInfo['totalPage']);
if ($page == 1)
{
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)
{
} else if ($page > 1 && $page <= $totalPage) {
$this->_view->display('my-guang-partial', array('infos' => $guangInfo));
}
else if ($page > 1 && $page>$totalPage)
{
echo ' ';//退出循环
} else if ($page > 1 && $page > $totalPage) {
echo ' '; //退出循环
}
}
... ... @@ -383,7 +345,6 @@ class HomeController extends AbstractAction
*/
public function suggestSubAction()
{
// 设置网站标题
$this->setTitle('反馈问题');
... ... @@ -417,8 +378,7 @@ class HomeController extends AbstractAction
*/
public function savesuggestAction()
{
if ($this->isAjax())
{
if ($this->isAjax()) {
$uid = $this->getUid();
$content = $this->post('content', '');
$suggest_type = $this->post('suggest_type', 2);
... ... @@ -433,12 +393,11 @@ class HomeController extends AbstractAction
*/
public function upAndDownAction()
{
if ($this->isAjax())
{
$uid = $this->getUid();
$udid = $this->getUdid();
$suggest_id = $this->post('suggest_id', 0);
$result = \Index\UserModel::upAndDown($uid, $udid, $suggest_id);
if ($this->isAjax()) {
$uid = $this->getUid();
$udid = $this->getUdid();
$suggest_id = $this->post('suggest_id', 0);
$result = \Index\UserModel::upAndDown($uid, $udid, $suggest_id);
$this->echoJson($result);
}
... ... @@ -457,7 +416,6 @@ class HomeController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$channel = Helpers::getChannelByCookie();
$uid = $this->getUid();
$uid = '10267443'; //临时测试用
$data = GradeModel::getGrade($gender, $channel, $uid);
$data['pageFooter'] = true;
$this->_view->display('vip-grade', $data);
... ... @@ -492,12 +450,9 @@ class HomeController extends AbstractAction
$this->setTitle('我的订单');
$this->setNavHeader('我的订单');
$data = OrderModel::getNavs($type);
if (!empty($data))
{
if (!empty($data)) {
$order['navs'] = $data;
}
else
{
} else {
$this->error();
}
//渲染模板
... ... @@ -512,8 +467,7 @@ class HomeController extends AbstractAction
public function getOrdersAction()
{
//判断是不是ajax请求
if (!$this->isAjax())
{
if (!$this->isAjax()) {
$this->error();
}
//获取基本参数:type:1=>全部,2=>待付款,3=>待发货,4=>待收货,5=>待评论
... ... @@ -523,7 +477,6 @@ class HomeController extends AbstractAction
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$uid = $this->getUid();
$uid = '10267443'; //测试用
//调用模型层getOrder方法获得并处理数据
$data = OrderModel::getOrder($type, $page, $limit, $gender, $yh_channel, $uid);
/* 如果取不到订单数据时,分两种情况:
... ... @@ -531,18 +484,12 @@ class HomeController extends AbstractAction
2、page=1时,就给一个随便逛逛的链接。
* */
$order = array();
if (!empty($data))
{
if (!empty($data)) {
$order['orders'] = $data;
}
else
{
if ($page > 1)
{
} else {
if ($page > 1) {
echo " ";
}
elseif ($page == 1)
{
} elseif ($page == 1) {
$order['walkwayUrl'] = self::strollAction();
}
}
... ... @@ -558,14 +505,12 @@ class HomeController extends AbstractAction
{
//判断是不是ajax请求
if (!$this->isAjax())
{
if (!$this->isAjax()) {
$this->error();
}
//传入order_code和uid以取消订单
$order_code = $this->get('id');
$uid = $this->getUid();
$uid = '10267443'; //测试用
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.close';
... ... @@ -582,14 +527,12 @@ class HomeController extends AbstractAction
public function delOrderAction()
{
//判断是不是ajax请求
if (!$this->isAjax())
{
if (!$this->isAjax()) {
$this->error();
}
//传入order_code和uid以删除订单
$order_code = $this->get('id');
$uid = $this->getUid();
$uid = '10267443'; //测试用
$gender = Helpers::getGenderByCookie();
$yh_channel = $this->get('yh_channel', 1);
$method = 'app.SpaceOrders.delOrderByCode';
... ...
... ... @@ -258,12 +258,12 @@ class UserModel
* @param int $uid 用户ID
* @return array|mixed 处理之后的优惠券数据
*/
public static function getCouponData($uid, $status)
public static function getCouponData($uid)
{
$result = array();
// 调用接口获取优惠券数据
$coupons = UserData::couponData($uid, $status);
$coupons = UserData::couponData($uid);
// 处理优惠券数据
if (!empty($coupons['unused'])) {
... ... @@ -307,6 +307,15 @@ class UserModel
{
$result = array();
if (USE_CACHE) {
$key = CacheConfig::KEY_ACTION_ADDRESS_LIST_DATA;
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
// 调用接口获取地址列表数据
$address = UserData::addressListData($uid);
... ... @@ -315,6 +324,17 @@ class UserModel
$result = $address['data'];
}
if (USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else {
Cache::set($key, $result, 1800); // 缓存30分钟
}
}
return $result;
}
... ...
... ... @@ -36,6 +36,8 @@ class DetailModel
// 商品名称
if (isset($baseInfo['productName'])) {
$result['goodsName'] = $baseInfo['productName'];
} else {
return $result;
}
// 商品价格
... ... @@ -159,10 +161,14 @@ class DetailModel
}
}
// 调用尺码需要的SKN号
if (isset($baseInfo['erpProductId'])) {
$result['skn'] = $baseInfo['erpProductId'];
}
// 悬浮的购物车信息
$result['cartInfo'] = array(
'numInCart' => 0,
'goodsInstore' => $baseInfo['storage'],
);
// 底部简介的URL链接
$result['introUrl'] = Helpers::url('/product/intro_' . $baseInfo['erpProductId'] . '/' . $baseInfo['cnAlphabet'] . '.html');
}
return $result;
... ... @@ -198,11 +204,8 @@ class DetailModel
$result['goodsDescription']['detail'][] = $value['standardName'] . ':' . $value['standardVal'];
}
}
if (isset($sizeInfo['productIntroBo']['productIntro'])) {
$productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />', true);
if ($productIntro) {
$result['goodsDescription']['desc'] = strtr($productIntro, array('<p>\r\n\t' => ''));
}
if (isset($sizeInfo['phrase'])) {
$result['goodsDescription']['desc'] = $sizeInfo['phrase'];
}
// 尺码信息
... ... @@ -267,43 +270,46 @@ class DetailModel
// 商品材质
if (!empty($sizeInfo['productMaterialList'])) {
$result['materials'] = array(
'title' => '商品材质',
'enTitle' => 'MATERIALS',
'list' => array(),
);
foreach ($sizeInfo['productMaterialList'] as $value) {
$result['materials']['list'][] = array(
'img' => $value['imageUrl'],
'desc' => $value['remark'],
);
}
}
// 洗涤提示
if (!empty($sizeInfo['washTipsBoList'])) {
$result['washTips']['list'] = array();
foreach ($sizeInfo['washTipsBoList'] as $value) {
$result['washTips']['list'][] = $value;
}
}
// 详情配图
if (isset($sizeInfo['productIntroBo']['productIntro'])) {
$productIntro = strstr($sizeInfo['productIntroBo']['productIntro'], '<br />');
if ($productIntro) {
$result['productDetail'] = array(
'title' => '商品详情',
'enTitle' => 'DETAILS',
'desc' => strtr($productIntro, array(
'\r\n\t' => '',
'</p>' => '',
'<img src=' => '<img class=\"lazy\" src=\"data:image/gif;base64,R0lGODlhAQABAJEAAAAAAP///93d3f///yH5BAEAAAMALAAAAAABAAEAAAICVAEAOw==\" data-original=',
)),
);
}
}
}
return $result;
'materials' : {
'title' : '商品材质',
'enTitle' : '',
'list''
'img' : '',
'desc' : '用各种洗涤剂',//remark
'materialType' : ''
},
'washTips' : {
'list' : [
{
"caption":"不可干洗",
"img":"http://static.yohobuy.com/images/wash_5.png"
}
]
}
'productDetail' : {
'title' : '商品详情',
'enTitle' : '',
'desc' : 'Married to the MOB是由Leah McSweeney创立的女装品牌,一向标榜不羁、大胆的女性streetwear设计',
'img' : ''
},
'cartInfo' : {
'numInCart' : 3,
'goodsInstore' : 0
}
}
}
... ...
... ... @@ -186,15 +186,13 @@ class LoginController extends AbstractAction
$userInfo = $alipay->getUserInfo($access);
if ($userInfo && $userInfo['is_success'] === 'T' && isset($userInfo['response']['user_info']['user_name'])) {
$nickname = $userInfo['response']['user_info']['user_name'];
$alipayEmail = $userInfo['response']['user_info']['email'];
// $alipayEmail = $userInfo['response']['user_info']['email'];
}
var_dump($userInfo);
}
else {
$nickname = $_GET['real_name'];
$alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
// $alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
}
var_dump($access);
$result = LoginData::signinByOpenID($nickname, $access['user_id'], 'qq');
... ...
... ... @@ -16,17 +16,22 @@ class DetailController extends AbstractAction
*/
public function indexAction()
{
$productId = $this->param('productId', 123);
$productId = $this->param('productId');
$productId = 22399;
if (!is_numeric($productId)) {
$this->error();
}
$goodsId = $this->param('goodsId', 3241);
$goodsId = $this->param('goodsId');
$goodsId = 32443;
if (!is_numeric($goodsId)) {
$this->error();
}
$uid = $this->getUid();
$data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid);
$data = \Product\DetailModel::getBaseInfo($productId, $goodsId, $uid); var_dump($data);
if (array() === $data) {
$this->error();
}
$data['goodsDetailPage'] = true;
if (isset($data['goodsName'])) {
... ... @@ -34,235 +39,27 @@ class DetailController extends AbstractAction
}
$this->setNavHeader('商品详情');
// $data = array (
// 'goodsDetailPage' => true,
// 'pageHeader' => array (
// 'navBack' => 'sss ',
// 'navHome' => 'sss ',
// 'navTitle' => '商品详情TEST'
// ),
//
// 'bannerTop' => array (
// 'list' => array (
// array (
// 'url' => '',
// 'img' => 'http://img13.static.yhbimg.com/goodsimg/2015/10/18/03/0250c3935f86dbd2baa7d45603d19fd637.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90'
// ),
// array (
// 'url' => '',
// 'img' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/12/03/01bf4cf4444035a1930d33a9d0f8bff4fa.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90'
// ),
// array (
// 'url' => '',
// 'img' => 'http://img11.static.yhbimg.com/goodsimg/2015/10/12/03/01d7ef2f624eeea15e80bb374607aea317.jpg?imageMogr2/thumbnail/450x600/extent/450x600/background/d2hpdGU=/position/center/quality/90'
// )
// )
// ),
// 'goodsName' => 'Stussy No. 4 BOX TEE DC SPAR HIGH WC
//SHOE BQT KEN BLOCK',
// 'goodsSubtitle'=>'【全民拼抢购】经典印花T恤,满4件免一件!全场低至
//9.9元,拼购时代High起来。',
//
// 'goodsPrice' =>array(
// 'currentPrice'=>'¥298.00',
// 'previousPrice'=>'¥598.00'
// ),
// 'periodOfMarket'=>'11月',
// 'goodsTitle' => '¥298.00',
// 'vipLevel' => array (
// 'list' => array (
// array (
// 'img'=>'http://static.dev.yohobuy.com/img/product/silver.png',
// 'text' => '¥284.00'
// ),
// array (
// 'img'=>'http://static.dev.yohobuy.com/img/product/golden.png',
// 'text' => '¥269.00'
// ),
// array (
// 'img'=>'http://static.dev.yohobuy.com/img/product/platinum.png',
// 'text' => '¥263.00'
// )
// )
// ),
// 'goodsDiscount'=>array(
// 'list'=>array(
// '【summer final sale】满¥499立享6.8折',
// '【BACK TO SCHOOL】满¥499赠送Paul
// Franke帽子一个,多买多送!',
// '【BACK TO SCHOOL】满¥499赠送Paul
// Franke帽子一个,多买多送!'
// )
// ),
// 'feedbacks'=>array(
// 'commentsNum'=>0,
// 'consultsNum'=>1,
// // 'commentName'=>'商品评价',
// // 'consultName' =>'购买咨询',
// 'link'=>'',
// 'comments'=>array(
// array(
// 'userName'=>'Lynnic',
// 'desc'=>'购买了白色Mate7',
// 'content'=>'活动时买的,挺超值。上身效果也不错。质量
//很好,买送人的,很满意。而且物流相当给...',
// 'time'=>'2014-08-12 10:24:26'
// )
// ),
// 'consults'=>array(
// array(
// 'question' =>'您好 我一米七七 140斤 穿M的行吗',
// 'time'=>'2014-08-12 10:24:26',
// 'answer'=>'您好,建议您参考XL的款式,由于版型和个人穿衣风格不同,需要'
// )
// )
// ),
//
// 'enterStore'=>array(
// 'img'=>'http://static.dev.yohobuy.com/img/product/store.png',
// 'storeName'=>'Stussy',
// 'url'=>'http://stussy.m.yohobuy.com/'
// ),
//
// 'goodsDescription'=>array(
// 'title' =>'商品描述',
// 'enTitle'=>'DESCRIPTON',
//
// 'detail'=>array(
// 'nubmer' =>'51018059',
// 'color' =>'黑',
// 'type' =>'帽子',
// 'gender' =>'女款',
// 'hatType' =>'棒球帽',
// 'bongrace' =>'平檐款式',
// 'goodsDetail'=>'字母图案',
// 'style'=>'街头'
// )
// ),
//
// 'sizeInfo'=>array(
// 'title' => '尺码信息',
// 'enTitle' =>'xSIZE INFO',
//
// 'detail' =>array(
// 'list'=>array(
// array(
// 'name'=>'尺寸',
// 'sizem'=>'m',
// 'sizexl' =>'XL'
// ),
// array(
// 'name'=>'肩宽',
// 'sizem'=>'43',
// 'sizexl' =>'46'
// ),
// array(
// 'name'=>'衣长',
// 'sizem'=>'102',
// 'sizexl' =>'106'
// ),
// array(
// 'name'=>'肩宽',
// 'sizem'=>'90',
// 'sizexl' =>'96'
// ),
// array(
// 'name'=>'胸围',
// 'sizem'=>'90',
// 'sizexl' =>'96'
// ),
// array(
// 'name'=>'xx',
// 'sizem'=>'xx',
// 'sizexl' =>'xx'
// )
// )
// )
// ),
//
// 'measurementMethod'=>array(
// 'title' => '测量方式',
// 'enTitle' =>'MEASUREMENT METHOD',
//
// 'detail'=>array(
// 'sort' =>'上衣' ,
// 'enSort'=>'TOPS',
// 'img' =>'http://static.dev.yohobuy.com/img/product/tops.png',
// 'items'=>array(
// '肩宽(两端肩线间的直线长度)',
// '胸围(两端肩线间的直线长度)',
// '肩宽(两端肩线间的直线长度)',
// '肩宽(两端肩线间的直线长度)',
// '肩宽(两端肩线间的直线长度)',
// '肩宽(两端肩线间的直线长度)'
// )
// )
// ),
//
// 'reference' => array(
// 'title' => '模特试穿',
// 'enTitle' =>'REFERENCE',
//
// 'detail' =>array(
// 'list'=>array(
// array(
// 'fieldName'=>'1 ',
// 'firstModel'=>'http://static.dev.yohobuy.com/img/product/avatar1.png',
// 'secondModel' =>'http://static.dev.yohobuy.com/img/product/avatar2.png'
// ),
// array(
// 'fieldName'=>'模特',
// 'firstModel'=>'Oliver',
// 'secondModel' =>'Jvly'
// ),
// array(
// 'fieldName'=>'身高',
// 'firstModel'=>'175',
// 'secondModel' =>'170'
// ),
// array(
// 'fieldName'=>'体重',
// 'firstModel'=>'53',
// 'secondModel' =>'59'
// ),
// array(
// 'fieldName'=>'三围',
// 'firstModel'=>'78/70/87',
// 'secondModel' =>'78/70/87'
// ),
// array(
// 'fieldName'=>'吊牌尺',
// 'firstModel'=>'S',
// 'secondModel' =>'L'
// )
// )
// )
// ),
//
// 'materials' => array(
// 'title' => '商品材质',
// 'enTitle' =>'MATERIALS',
// 'img' => 'http://static.dev.yohobuy.com/img/product/material.png',
// 'desc' =>'用各种洗涤剂,可手洗机洗,但不宜氯漂,宜阴干,避免曝晒,以免深色衣物褪色,在日光下晾晒时,将里面朝外。浸泡时间不能太长,避免褪色,深色与浅色衣服最好请分开洗涤,避免染色。',
// 'materialType'=>'http://static.dev.yohobuy.com/img/product/material-type.png'
// ),
//
// 'productDetail' =>array(
// 'title' => '商品详情',
// 'enTitle' =>'DETAILS',
// 'desc' => 'Married to the MOB是由Leah McSweeney创立的女装品牌,一向标榜不羁、大胆的女性streetwear设计。喜欢恶搞的女生们,赶紧入手吧。',
// 'img' =>'http://static.dev.yohobuy.com/img/product/product.png'
// ),
//
// 'cartInfo' =>array(
// 'numInCart' => 3,
// 'goodsInstore'=>0
// )
//
// );
// 渲染模板
$this->_view->display('index', $data);
}
/**
* 尺码描述信息
*/
public function introAction()
{
$productSkn = $this->param('productSkn');
if (!is_numeric($productSkn)) {
$this->error();
}
$data = \Product\DetailModel::getSizeInfo($productSkn);
if (array() === $data) {
echo ' ';
exit();
}
$this->_view->display('intro', $data);
}
public function commentsAction()
{
... ...
... ... @@ -117,4 +117,19 @@ routes.brandsearch.route.module = Category
routes.brandsearch.route.controller = Brand
routes.brandsearch.route.action = Search
; 商品详情
routes.product.type = "regex"
routes.product.match = "#/product/pro_([0-9]+)_([0-9]+)/(.*)#"
routes.product.route.module = Product
routes.product.route.controller = Detail
routes.product.route.action = Index
routes.product.map.1 = productId
routes.product.map.2 = goodsId
routes.buy.type = "regex"
routes.buy.match = "#/product/intro_([0-9]+)/(.*).html#"
routes.buy.route.module = Product
routes.buy.route.controller = Detail
routes.buy.route.action = Intro
routes.buy.map.1 = productSkn
... ...
... ... @@ -4,19 +4,3 @@ routes.goodsfilter.match = "/search/filter"
routes.goodsfilter.route.module = Index
routes.goodsfilter.route.controller = Search
routes.goodsfilter.route.action = Filter
routes.product.type = "regex"
routes.product.match = "#/product/pro_([0-9]+)_([0-9]+)/(.*)#"
routes.product.route.module = Product
routes.product.route.controller = Detail
routes.product.route.action = Index
routes.product.map.1 = productId
routes.product.map.2 = goodsId
routes.buy.type = "regex"
routes.buy.match = "#/product/buy_([0-9]+)_([0-9]+).html#"
routes.buy.route.module = Product
routes.buy.route.controller = Detail
routes.buy.route.action = Index
routes.buy.map.1 = productId
routes.buy.map.2 = goodsId
\ No newline at end of file
... ...