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;
... ... @@ -71,4 +72,35 @@ class LoginData
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,7 +178,6 @@ class NewsaleData
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 {
... ... @@ -220,7 +219,7 @@ class NewsaleModel
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);
}
}
... ... @@ -251,7 +250,6 @@ class NewsaleModel
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,9 +54,7 @@ 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);
}
... ... @@ -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)) {
... ...
... ... @@ -106,7 +106,7 @@ class NewsaleController extends AbstractAction
$tab_id = $this->get('tab_id', null);
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$notab = (boolean)$this->get('notab', false);
$notab = (boolean) $this->get('notab', false);
// 获取性别
$gender = Helpers::getGenderByCookie();
... ...