Authored by uedxwg

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

... ... @@ -22,16 +22,13 @@ class Yohobuy
// 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_LOGINSESSION = 'http://m1.yohobuy.com/';
/* 测试环境 */
const API_URL = 'http://testapi.yoho.cn:28078/';
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const YOHOBUY_ORDER = 'http://192.168.102.209:8084/order/'; //我的订单
const API_URL_MYCENTER = 'http://192.168.102.207:8081/users/'; // 我的个人中心接口URL
const API_URL_SHOPINGCART = 'http://192.168.102.213:8080/api-gateway-web/'; // 我的购物车接口URL
const API_URL_PRODUCTDETAIL = 'http://192.168.102.212:8083/product/'; // 商品详情页
const API_URL_LOGISTICS = 'http://192.168.102.205:8080/gateway'; //查看物流接口URL
const API_URL_LOGINSESSION = 'http://m1.yohobuy.com/';
/**
* 私钥列表
... ...
... ... @@ -59,7 +59,6 @@ class OrderData
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
public static function deleteOrderData($order_code, $uid, $gender, $yh_channel)
{
//构建必传参数
... ... @@ -94,7 +93,7 @@ class OrderData
}
/*
* 支付url
* 支付页面的资源位
* To change this template file, choose Tools | Templates
*/
public static function paymentData($gender, $yh_channel, $code)
... ...
<?php
namespace LibModels\Wap\Passport;
use Api\Sign;
... ... @@ -15,7 +16,7 @@ use Api\Yohobuy;
*/
class LoginData
{
/**
* 登录
*
... ... @@ -32,10 +33,10 @@ class LoginData
$param['profile'] = $profile;
$param['password'] = $password;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
* 用户信息
*
... ... @@ -48,7 +49,7 @@ class LoginData
$param['method'] = 'app.passport.profile';
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
... ... @@ -68,7 +69,38 @@ class LoginData
$param['openId'] = $openId;
$param['source_type'] = $sourceType;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 写入SESSION会话
*
* @param int $uid 用户ID
* @return array
*/
public static function signinSession($uid)
{
$param = array();
$param['uid'] = $uid;
$param['token'] = md5($uid . '#@!@#');
return Yohobuy::get(Yohobuy::API_URL_LOGINSESSION . 'Passport/session/index', $param);
}
/**
* 写入SESSION会话
*
* @param int $uid 用户ID
* @return array
*/
public static function checkSession($uid)
{
$param = array();
$param['uid'] = $uid;
$param['token'] = md5($uid . '#@!@#');
return Yohobuy::get(Yohobuy::API_URL_LOGINSESSION . 'Passport/session/val', $param);
}
}
... ...
... ... @@ -31,9 +31,13 @@ class DetailData
*/
public static function baseInfo($productId, $uid)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_BASE_INFO, array(
'param' => intval($productId), 'userId' => intval($uid)
));
$param = Yohobuy::param();
$param['method'] = 'h5.product.data';
$param['product_id'] = $productId;
$param['uid'] = $uid;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
... ... @@ -44,7 +48,12 @@ class DetailData
*/
public static function sizeInfo($productSkn)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_SIZE_INFO, array('param' => intval($productSkn)));
$param = Yohobuy::param();
$param['method'] = 'h5.product.intro';
$param['productskn'] = $productSkn;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
... ... @@ -57,11 +66,14 @@ class DetailData
*/
public static function consultList($productId, $pageNum, $pageSize)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_CONSULT_LIST, array(
'productId' => intval($productId),
'pageNum' => intval($pageNum),
'pageSize' => intval($pageSize),
));
$param = Yohobuy::param();
$param['method'] = 'h5.consult.li';
$param['product_id'] = $productId;
$param['page'] = $pageNum;
$param['limit'] = $pageSize;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
... ... @@ -74,25 +86,22 @@ class DetailData
*/
public static function commentList($productId, $pageNum, $pageSize)
{
return Yohobuy::jsonPost(Yohobuy::API_URL_PRODUCTDETAIL . self::PRODUCT_COMMENT_LIST, array(
'productId' => intval($productId),
'pageNum' => intval($pageNum),
'pageSize' => intval($pageSize),
));
// 暂未提供提口
}
/**
* 为你优选的商品列表
*
* @todo 需要替换成JAVA接口
* @param int $productSkn 商品SKN号
* @return array
*/
public static function preference($productSkn)
public static function preference($productSkn, $channel, $brandId)
{
$param = Yohobuy::param();
$param['method'] = 'app.product.topreference';
$param['product_skn'] = $productSkn;
$param['method'] = 'h5.preference.Search';
$param['productskn'] = $productSkn;
$param['yhchannel'] = $channel;
$param['brandId'] = $brandId;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param, 3600); // 缓存1小时
... ... @@ -108,7 +117,7 @@ class DetailData
public static function addConsult($uid, $productId, $content)
{
$param = Yohobuy::param();
$param['method'] = 'app.consult.add';
$param['method'] = 'h5.consult.add';
$param['product_id'] = $productId;
$param['content'] = $content;
$param['uid'] = $uid;
... ...
... ... @@ -95,9 +95,9 @@ class NewsaleData
});
$param = Yohobuy::param();
if(!is_null($dayLimit)) {
if (!is_null($dayLimit)) {
$param['method'] = 'app.search.newProduct';
}else {
} else {
$param['method'] = 'app.search.sales';
}
$param['page'] = $page;
... ... @@ -178,30 +178,29 @@ class NewsaleData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 获取热销排行榜商品数据
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
* @return array 新品到着商品数据
*/
public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.top';
$param['gender'] = $gender;
!empty($sort) && $param['sort'] = $sort;
!empty($tab_id) && $param['tab_id'] = $tab_id;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
/**
* 获取热销排行榜商品数据
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
* @return array 新品到着商品数据
*/
public static function getTopProducts($gender, $sort = null, $tab_id = null, $limit = 50, $page = 1)
{
$param = Yohobuy::param();
$param['method'] = 'app.search.top';
$param['gender'] = $gender;
!empty($sort) && $param['sort'] = $sort;
!empty($tab_id) && $param['tab_id'] = $tab_id;
$param['page'] = $page;
$param['limit'] = $limit;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -683,6 +683,7 @@ class HomeController extends AbstractAction
$order['walkwayUrl'] = Helpers::url('/product/new');
} else {
echo ' ';
exit();
}
//渲染模板
... ...
... ... @@ -23,7 +23,7 @@ class OrderModel
{
$result = array();
//调用接口获得数据
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, $uid);
$data = OrderData::getOrderData($type, $page, $limit, $gender, $yh_channel, 5772257); var_dump($data); exit;
// 判断是否还有数据, 没有数据则返回空
if (isset($data['data']['page_total']) && $page > $data['data']['page_total']) {
return $result;
... ... @@ -33,7 +33,7 @@ class OrderModel
foreach ($data['data']['order_list'] as $key => $vo) {
//订单号,支付状态,订单商品数量,订单总价格
$result[$key]['orderNum'] = $vo['order_code'];
$result[$key]['orderStatus'] = $vo['status_str'];
$result[$key]['orderStatus'] = ($vo['is_cancel'] === 'Y') ? '已取消' : $vo['status_str'];
$result[$key]['count'] = count($vo['order_goods']);
$result[$key]['sumCost'] = $vo['amount'];
//类内调用格式化订单商品数据方法
... ...
... ... @@ -96,8 +96,8 @@ class DetailModel
if (isset($baseInfo['promotionBoList'])) {
$build = array();
foreach ($baseInfo['promotionBoList'] as $value) {
$build['title'] = $value['promotionTitle'];
$build['type'] = $value['promotionType'];
$build['text'] = $value['promotionTitle'];
//$build['type'] = $value['promotionType'];
$result['goodsDiscount']['list'][] = $build;
}
}
... ... @@ -146,6 +146,8 @@ class DetailModel
'storeName' => $baseInfo['brand']['brandName'],
'url' => Helpers::url('', array(), $baseInfo['brand']['brandDomain'])
);
// 为你优选的链接
$result['preferenceUrl'] = Helpers::url('/product/detail/preference', array('productSkn' => $baseInfo['erpProductId'], 'brandId' => $baseInfo['brand']['id']));
}
// 商品信息
... ... @@ -448,12 +450,12 @@ class DetailModel
* @param int $productSkn 商品SKN
* @return array
*/
public static function getPreference($productSkn)
public static function getPreference($productSkn, $channel, $brandId)
{
$result = array();
if (is_numeric($productSkn)) {
$preference = DetailData::preference($productSkn);
$preference = DetailData::preference($productSkn, $channel, $brandId);
if (!empty($preference['data'])) {
foreach ($preference['data'] as $value) {
$result['recommendList'][] = Helpers::formatProduct($value, false, true, true, 299, 388, false, false);
... ...
... ... @@ -21,6 +21,7 @@ use Plugin\Cache;
class NewsaleModel
{
/* 男生频道取新品到着及折扣专区数据的位置码 */
const CODE_TOP_NEW_BOYS = '3cf2c1be5217fbab6009ce83959e1e12';
const CODE_TOP_SALE_BOYS = '153180b9a88c0b565848850c523bb637';
/* 女生频道取新品到着及折扣专区数据的位置码 */
... ... @@ -125,7 +126,6 @@ class NewsaleModel
return $result;
}
/**
* 获取折扣专区的商品列表
*
... ... @@ -162,7 +162,6 @@ class NewsaleModel
return $result;
}
/**
* 顶部焦点图缓存控制
* @param const $cacheKey 缓存常量值
... ... @@ -184,7 +183,7 @@ class NewsaleModel
$newsale = NewsaleData::getNewsaleFocus($codeKey);
// 调用接口获取数据并封装
if (isset($newsale['code']) && isset($newsale['data']['list']) && !empty($newsale['data']['list'])) {
if (isset($newsale['code']) && !empty($newsale['data']['list'])) {
if(count($newsale['data']['list'][0]['data']) === 1) {
$result = Helpers::formatBanner($newsale['data']['list'][0]['data'][0], 640, 240);
} else {
... ... @@ -217,41 +216,40 @@ class NewsaleModel
public static function selectData($data)
{
$result = array();
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
foreach ($data['data']['product_list'] as $val) {
$result['goods'][] = Helpers::formatProduct($val, true, false, false, 299,388);
$result['goods'][] = Helpers::formatProduct($val, true, false, false, 299, 388);
}
}
return $result;
}
/**
* 筛选出来的热销排行榜商品数据处理
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param boolean $notab 时候返回顶部tab的数据,默认返回
* @param integer $limit 查询返回的最大限制数
* @param integer $page 分页第几页
* @return array 处理之后的数据
*/
/**
* 筛选出来的热销排行榜商品数据处理
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string|null $sort 品类ID查询参数
* @param integer|null $tab_id Tab的ID
* @param boolean $notab 时候返回顶部tab的数据,默认返回
* @param integer $limit 查询返回的最大限制数
* @param integer $page 分页第几页
* @return array 处理之后的数据
*/
public static function selectTopData($gender, $sort, $tab_id, $notab, $limit, $page)
{
$result = array();
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
$data = NewsaleData::getTopProducts($gender, $sort, $tab_id, $limit, $page);
if (isset($data['code']) && $data['code'] === 200 && isset($data['data']['product_list'])) {
$result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
$result = NewSaleProcess::topData($data['data'], $notab, $limit, $page);
}
return $result;
}
/**
* 获取筛选数据
* @param array $data 接口返回的数据
... ... @@ -269,4 +267,5 @@ class NewsaleModel
return $result;
}
}
... ...
... ... @@ -19,6 +19,9 @@ class LoginController extends AbstractAction
{
$this->setTitle('登录');
$refer = $this->get('refer', SITE_MAIN . '/?go=1');
$this->setCookie('refer', $refer);
$data = array(
'loginIndex' => true, // 模板中使用JS的标识
'backUrl' => '/', // 返回的URL链接
... ... @@ -33,8 +36,6 @@ class LoginController extends AbstractAction
'emailRetriveUrl' => '/passport/back/email', // 通过邮箱找回密码的URL链接
);
// 生成HTML(signin.html)
$this->_view->html('signin');
// 渲染模板
$this->_view->display('index', $data);
}
... ... @@ -53,13 +54,11 @@ class LoginController extends AbstractAction
$data['isPassportPage'] = true; // 模板中模块标识
$data['areaCode'] = '+86'; // 默认区号
$data['countrys'] = RegData::getAreasData(); // 地区信息列表
//
// 生成HTML(login.html)
$this->_view->html('login');
// 渲染模板
$this->_view->display('international', $data);
}
/**
* 退出
*
... ... @@ -68,7 +67,7 @@ class LoginController extends AbstractAction
public function outAction()
{
$this->setCookie('_UID', '');
headers_sent() || header('Location: /');
}
... ... @@ -124,8 +123,7 @@ class LoginController extends AbstractAction
// $name = $profile['data']['mobile'];
// }
$data['data'] = '/'; // @todo
}
while (false);
} while (false);
$this->echoJson($data);
}
... ... @@ -188,8 +186,7 @@ class LoginController extends AbstractAction
$nickname = $userInfo['response']['user_info']['user_name'];
// $alipayEmail = $userInfo['response']['user_info']['email'];
}
}
else {
} else {
$nickname = $_GET['real_name'];
// $alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
}
... ...
... ... @@ -272,7 +272,7 @@ class RegController extends AbstractAction
if (empty($refer)) {
$refer = SITE_MAIN . '/?go=1';
}
$data['data'] = $refer;
$data['data'] = rawurldecode($refer);
}
} while (false);
... ...
... ... @@ -182,7 +182,9 @@ class DetailController extends AbstractAction
if ($this->isAjax()) {
$productSkn = $this->get('productSkn'); // 50000058
$result = \Product\DetailModel::getPreference($productSkn);
$brandId = $this->get('brandId');
$channel = Helpers::getChannelByCookie();
$result = \Product\DetailModel::getPreference($productSkn, $channel, $brandId);
}
if (empty($result)) {
... ...
... ... @@ -79,11 +79,11 @@ class NewsaleController extends AbstractAction
$this->setTitle('热销排行榜');
$this->setNavHeader('热销排行榜');
$channel = Helpers::getChannelByCookie();
$channel = Helpers::getChannelByCookie();
// 设置一些默认参数
$data = array(
'hotrankPage' => true,
'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
'headerBanner' => \Product\NewsaleModel::getNewFocus($channel),
'showDownloadApp' => true,
'pageFooter' => true,
'cartUrl' => Helpers::url('/product/newsale/selectHotrank', null),
... ... @@ -92,32 +92,32 @@ class NewsaleController extends AbstractAction
$this->_view->display('hotrank', $data);
}
/**
* Ajax方式获取热销排行榜商品
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectHotrankAction()
{
$result = array();
if ($this->isAjax()) {
$sort = $this->get('sort', null);
$tab_id = $this->get('tab_id', null);
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$notab = (boolean)$this->get('notab', false);
// 获取性别
$gender = Helpers::getGenderByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('hotlist', $result);
}
}
/**
* Ajax方式获取热销排行榜商品
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectHotrankAction()
{
$result = array();
if ($this->isAjax()) {
$sort = $this->get('sort', null);
$tab_id = $this->get('tab_id', null);
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$notab = (boolean) $this->get('notab', false);
// 获取性别
$gender = Helpers::getGenderByCookie();
$result = \Product\NewsaleModel::selectTopData($gender, $sort, $tab_id, $notab, $limit, $page);
}
if (empty($result)) {
echo ' ';
} else {
$this->_view->display('hotlist', $result);
}
}
/**
* Ajax方式筛选新品到着、折扣专区商品
... ... @@ -127,7 +127,7 @@ class NewsaleController extends AbstractAction
public function selectNewSaleAction()
{
$result = array();
if ($this->isAjax()) {
$gender = $this->get('gender', null);
$brand = $this->get('brand', null);
... ... @@ -149,7 +149,7 @@ class NewsaleController extends AbstractAction
$channel = Helpers::getChannelByCookie();
$data = NewsaleData::selectNewSaleProducts(
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
$gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page, $order
);
$result = \Product\NewsaleModel::selectData($data);
}
... ...