Authored by 王水玲

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

... ... @@ -12,7 +12,6 @@
namespace Api;
use Plugin\Cache;
class Yohobuy
{
/* 正式环境 */
... ... @@ -33,7 +32,6 @@ class Yohobuy
const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/'
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';
/* 预览环境 */
// const API_URL = 'http://preapi.yoho.cn/';
... ... @@ -67,18 +65,29 @@ class Yohobuy
*/
public static function clientType()
{
// 苹果设备
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
return 'iphone';
} // 苹果IPAD
elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
return 'ipad';
} elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'android')) {
return 'android';
} // 其它
if(self::isMobile()) {
return 'h5';
}
else {
return 'android';
return 'web';
}
// // 苹果设备
// if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone')) {
// return 'iphone';
// }
// // 苹果IPAD
// elseif (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
// return 'ipad';
// }
// elseif (stristr($_SERVER['HTTP_USER_AGENT'], 'android')) {
// return 'android';
// }
// // 其它
// else {
// return 'android';
// }
}
/**
... ... @@ -478,4 +487,37 @@ class Yohobuy
return $result;
}
/**
* 获取用户User-Agent
* @return bool
*/
public static function getUserAgent()
{
if (!isset($_SERVER['HTTP_USER_AGENT']) || empty($_SERVER['HTTP_USER_AGENT'])) {
return '';
}
return $_SERVER['HTTP_USER_AGENT'];
}
/**
* 判断是否手机
* @return bool
*/
public static function isMobile()
{
$userAgent = self::getUserAgent();
if (stristr($userAgent, 'ipad')) {
return false;
}
$mobileAgents = array('iphone','android',"240x320","acer","acoon","acs-","abacho","ahong","airness","alcatel","amoi","anywhereyougo.com","applewebkit/525","applewebkit/532","asus","audio","au-mic","avantogo","becker","benq","bilbo","bird","blackberry","blazer","bleu","cdm-","compal","coolpad","danger","dbtel","dopod","elaine","eric","etouch","fly ","fly_","fly-","go.web","goodaccess","gradiente","grundig","haier","hedy","hitachi","htc","huawei","hutchison","inno","ipad","ipaq","ipod","jbrowser","kddi","kgt","kwc","lenovo","lg ","lg2","lg3","lg4","lg5","lg7","lg8","lg9","lg-","lge-","lge9","longcos","maemo","mercator","meridian","micromax","midp","mini","mitsu","mmm","mmp","mobi","mot-","moto","nec-","netfront","newgen","nexian","nf-browser","nintendo","nitro","nokia","nook","novarra","obigo","palm","panasonic","pantech","philips","phone","pg-","playstation","pocket","pt-","qc-","qtek","rover","sagem","sama","samu","sanyo","samsung","sch-","scooter","sec-","sendo","sgh-","sharp","siemens","sie-","softbank","sony","spice","sprint","spv","symbian","tablet","talkabout","tcl-","teleca","telit","tianyu","tim-","toshiba","tsm","up.browser","utec","utstar","verykool","virgin","vk-","voda","voxtel","vx","wap","wellco","wig browser","wii","windows ce","wireless","xda","xde","zte");
$isMobile = false;
foreach ($mobileAgents as $device) {
if (stristr($userAgent, $device)) {
$isMobile = true;
break;
}
}
return $isMobile;
}
}
... ...
... ... @@ -38,7 +38,7 @@ class HelpData
$param['code'] = $code;
$param['return_type'] = 'html';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_OLD, $param, true);
return Yohobuy::post(Yohobuy::API_URL, $param, true);
}
}
... ...
<?php
namespace LibModels\Wap\Product;
use Api\Yohobuy;
/**
* SaleData 专区活动接口数据类
*
* @package LibModels\Wap\Product
* @author Gtskk
* @copyright 2016/4/25 20:03 Gtskk<iamgtskk@gmail.com>
* @version: 0.0.1
*/
class SaleData
{
const URL_SALE_SPECIAL = '/operating/service/v1/special';
/**
* @param $specialsaleId 专区ID
* @return array
*/
public static function getSpecial($specialsaleId)
{
/*$param = Yohobuy::param();
$param['special_id'] = $specialsaleId;
$param['method'] = 'app.resources.getOneSpecial';
$param['client_secret'] = Sign::getSign($param);
//TODO等待接口发布到测试环境
return Yohobuy::get('http://192.168.102.205:8080/gateway', $param);*/
return Yohobuy::yarClient(Yohobuy::SERVICE_URL . self::URL_SALE_SPECIAL, 'getOneSpecial', array($specialsaleId), 600);
}
}
\ No newline at end of file
... ...
... ... @@ -7,7 +7,7 @@ use Api\Sign;
/**
* 搜索有关数据操作类
*
*
* @name SearchData
* @package Library/LibModels/wap/Product
* @copyright yoho.inc
... ... @@ -19,9 +19,9 @@ class SearchData
/**
* 获取搜索的服务地址
*
*
* 备注:此处是根据环境来确定使用阿里云内网还是外网的URL
*
*
* @return string
*/
private static function getSearchUrl()
... ... @@ -31,19 +31,19 @@ class SearchData
case 'production':
case 'release':
//return 'http://search.yoho.cn/yohosearch/search.json';
return 'http://101.201.178.220/yohosearch/search.json'; //return 'http://100.98.132.63/yohosearch/search.json';
return 'http://search.yohoops.org/yohosearch/search.json'; //return 'http://100.98.132.63/yohosearch/search.json';
case 'preview':
return 'http://101.200.31.165/yohosearch/search.json';
case 'test':
case 'developer':
default:
return 'http://101.200.31.165/yohosearch/search.json';
return 'http://192.168.10.64:8080/yohosearch/search.json';
}
}
/**
* 模糊搜索提供的关键词
*
*
* @param string $keyword 关键词
* @return array 根据给定关键词搜索到的结果,包括数据数目count和提供的关键词keyword
*/
... ... @@ -61,24 +61,24 @@ class SearchData
/**
* 根据给定查询数据搜索数据列表 (老的)
*
* @param string $query 查询条件, 默认为null
* @param string $brand 品牌,默认为null
* @param string $gender 性别,默认为null,"1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $color 颜色id
* @param integer $size 尺码id
* @param integer $price 价格
* @param string $p_d 折扣,默认为null
* @param string $sort 商品所属品类,默认为null
* @param string $order 排序方式,默认为按照时间倒序排列s_t_desc,
* s_t_asc表示按时间正序排列,
* s_p_asc表示按价格正序排列,
*
* @param string $query 查询条件, 默认为null
* @param string $brand 品牌,默认为null
* @param string $gender 性别,默认为null,"1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $color 颜色id
* @param integer $size 尺码id
* @param integer $price 价格
* @param string $p_d 折扣,默认为null
* @param string $sort 商品所属品类,默认为null
* @param string $order 排序方式,默认为按照时间倒序排列s_t_desc,
* s_t_asc表示按时间正序排列,
* s_p_asc表示按价格正序排列,
* s_p_desc表示按价格倒序排列,
* p_d_asc表示按折扣正序排列,
* p_d_desc表示按折扣倒序排列
* @param integer $page 指定查询是多少页,默认为第一页
* @param integer $limit 指定查询多少个,默认是60个
* @param integer $channel表示哪个频道,1表示男生,2表示女生,3表示潮童,4表示创意生活
* @param integer $page 指定查询是多少页,默认为第一页
* @param integer $limit 指定查询多少个,默认是60个
* @param integer $channel表示哪个频道 ,1表示男生,2表示女生,3表示潮童,4表示创意生活
* @return array 搜索到的数据
*/
public static function searchByCondition($condition)
... ... @@ -104,24 +104,24 @@ class SearchData
/**
* 根据给定查询数据搜索数据列表 (新的)
*
* @param string $query 查询条件, 默认为null
* @param string $brand 品牌,默认为null
* @param string $gender 性别,默认为null,"1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $color 颜色id
* @param integer $size 尺码id
* @param integer $price 价格
* @param string $p_d 折扣,默认为null
* @param string $sort 商品所属品类,默认为null
* @param string $order 排序方式,默认为按照时间倒序排列s_t_desc,
* s_t_asc表示按时间正序排列,
* s_p_asc表示按价格正序排列,
*
* @param string $query 查询条件, 默认为null
* @param string $brand 品牌,默认为null
* @param string $gender 性别,默认为null,"1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $color 颜色id
* @param integer $size 尺码id
* @param integer $price 价格
* @param string $p_d 折扣,默认为null
* @param string $sort 商品所属品类,默认为null
* @param string $order 排序方式,默认为按照时间倒序排列s_t_desc,
* s_t_asc表示按时间正序排列,
* s_p_asc表示按价格正序排列,
* s_p_desc表示按价格倒序排列,
* p_d_asc表示按折扣正序排列,
* p_d_desc表示按折扣倒序排列
* @param integer $page 指定查询是多少页,默认为第一页
* @param integer $limit 指定查询多少个,默认是60个
* @param integer $channel表示哪个频道,1表示男生,2表示女生,3表示潮童,4表示创意生活
* @param integer $page 指定查询是多少页,默认为第一页
* @param integer $limit 指定查询多少个,默认是60个
* @param integer $channel表示哪个频道 ,1表示男生,2表示女生,3表示潮童,4表示创意生活
* @return array 搜索到的数据
*/
public static function searchElasticByCondition($condition, $cache = false)
... ...
... ... @@ -338,7 +338,7 @@ class Helpers
$result = array();
$result['id'] = $articleData['id'];
$result['showTags'] = $showTag;
$result['img'] = self::getImageUrl($articleData['src'], 640, 640);
$result['img'] = isset($articleData['src']) ? self::getImageUrl($articleData['src'], 640, 640) : '';
$result['url'] = $articleData['url']; //$isApp ? $articleData['url'] : self::url('/info/index', array('id' => $articleData['id']), 'guang');
$result['title'] = $articleData['title'];
$result['text'] = $articleData['intro'];
... ...
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
... ... @@ -18,7 +18,8 @@ var nickname = $('#nickname').val(),
sourceType = $('#sourceType').val(),
openId = $('#openId').val(),
phoneNum = $('#phone-num').val(),
areaCode = $('#area-code').val().replace('+', '');
areaCode = $('#area-code').val().replace('+', ''),
code = $('#code').val();
function startBind(password) {
$.ajax({
... ... @@ -30,7 +31,8 @@ function startBind(password) {
openId: openId,
sourceType: sourceType,
nickname: nickname,
password: password
password: password,
code: code
},
success: function(res) {
if (res.code === 200) {
... ...
... ... @@ -23,7 +23,7 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
var urlMid = useInRegister ? 'reg' : 'back';
// var isReg = parseInt($('#isReg').val());
var isReg = parseInt($('#isReg').val());
function startBind() {
$.ajax({
... ... @@ -54,6 +54,29 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
});
}
function startReg() {
$.ajax({
type: 'POST',
url: '/passport/' + urlMid + '/verifycode',
data: {
phoneNum: phoneNum,
areaCode: areaCode,
code: trim($captcha.val()),
token: $('#token').val()
},
success: function(data) {
if (data.code === 200) {
location.href = data.data;
} else {
//验证码不正确,显示提示
showErrTip(data.message);
}
}
});
}
function countDown() {
var count = 59,
itime;
... ... @@ -109,38 +132,18 @@ module.exports = function(useInRegister, useForBind, useForRelate) {
return;
}
startBind();
// $.ajax({
// type: 'POST',
// url: useForBind ? '/passport/bind/checkBindMsg' : '/passport/' + urlMid + '/verifycode',
// data: {
// phoneNum: phoneNum,
// areaCode: areaCode,
// code: trim($captcha.val()),
// token: $('#token').val()
// },
// success: function(data) {
// if (data.code === 200) {
// if (useForBind) {
// if (isReg) {
// startBind();
// } else {
// location.href = '/passport/bind/password?phoneNum=' +
// phoneNum + '&areaCode=' + areaCode + '&openId=' +
// openId + '&sourceType=' + sourceType + '&nickname=' + nickname;
// }
// } else {
// location.href = data.data;
// }
// } else {
//
// //验证码不正确,显示提示
// showErrTip(data.message);
// }
//
// }
// });
if (useForBind || useForRelate) {
if (isReg) {
startBind();
} else {
location.href = '/passport/bind/password?phoneNum=' +
phoneNum + '&areaCode=' + areaCode + '&openId=' +
openId + '&sourceType=' + sourceType + '&nickname=' + nickname + '&code=' + trim($captcha.val());
}
} else {
startReg();
}
});
countDown();
... ...
... ... @@ -5,7 +5,7 @@
width: 74PX;
height: 74PX;
margin: 60PX auto 30PX;
background: image-url("passport/success.png");
background: resolve("passport/success.png");
background-size: 100%;
}
... ...
... ... @@ -13,5 +13,6 @@
<input id="phone-num" type="hidden" value={{phoneNum}}>
<input id="area-code" type="hidden" value={{areaCode}}>
<input id="token" type="hidden" value={{token}}>
<input id="code" type="hidden" value={{code}}>
</div>
{{> layout/footer_passport}}
... ...
... ... @@ -3,7 +3,7 @@
<div class="text-container">
验证码已发送至
<span class="phone">
{{areaCode}} {{phoneNum}}
+{{areaCode}} {{phoneNum}}
</span>
</div>
<div class="input-container row has-clear">
... ...
... ... @@ -56,7 +56,7 @@ class BindController extends AbstractAction
$areaCode = $this->get('areaCode', '86');
$isReg = $this->get('isReg');
$phoneNum = $this->get('phoneNum');
$data = array(
'backUrl' => Helpers::url('/signin.html'), // 返回的URL链接
'showHeaderImg' => true, // 控制显示头部图片
... ... @@ -68,7 +68,7 @@ class BindController extends AbstractAction
'areaCode' => $areaCode, //国别码
'phoneNum' => $phoneNum, //手机号码
);
$data['relateCode'] = ($isReg == 3) ? true : false;//关联js
$data['bindCode'] = ($isReg == 3) ? false : true;//绑定js
... ... @@ -87,6 +87,7 @@ class BindController extends AbstractAction
// $nickname = $this->get('nickname');
$areaCode = $this->get('areaCode', '86');
$phoneNum = $this->get('phoneNum');
$code = $this->get('code');
$data = array(
'bindPwd' => true, //js标识
'backUrl' => Helpers::url('/signin.html'), // 返回的URL链接
... ... @@ -96,7 +97,8 @@ class BindController extends AbstractAction
'openId' => $openId, // openId
// 'nickname' => $nickname, //昵称
'areaCode' => $areaCode, //国别码
'phoneNum' => $phoneNum //国别码
'phoneNum' => $phoneNum, //国别码
'code' => $code // 验证码
);
// 渲染模板
... ...
<?php
use Action\AbstractAction;
use LibModels\Web\Product\SaleData;
use LibModels\Wap\Product\SaleData;
use Plugin\Helpers;
/**
... ... @@ -254,7 +254,7 @@ class IndexController extends AbstractAction
'p_d' => FILTER_DEFAULT,), false);
//专区ID和促销ID都为空时,跳转到主页
if (!isset($condition['specialsale_id']) && isset($condition['promotion'])) {
if (!isset($condition['specialsale_id']) && !isset($condition['promotion'])) {
$this->go(SITE_MAIN);
}
... ...