Authored by 梁志锋

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

... ... @@ -426,7 +426,7 @@
ps: {
id: 1,
banner: '',
log: '',
logo: '',
name: '',
isLike: '',
likeUrl: '',
... ...
... ... @@ -92,6 +92,10 @@ class AbstractAction extends Controller_Abstract
protected function echoJson($json)
{
headers_sent() || header('Content-Type: application/json; charset=utf-8;');
if(is_array($json))
{
$json = json_encode($json);
}
echo $json;
}
... ... @@ -122,5 +126,15 @@ class AbstractAction extends Controller_Abstract
{
return $this->_request->isXmlHttpRequest();
}
/**
* 跳转到错误页面
*/
protected function error()
{
headers_sent() || header('Location: /error.html');
exit;
}
}
... ...
... ... @@ -16,6 +16,7 @@ class Yohobuy
const API_URL = 'http://api2.open.yohobuy.com/';
const SERVICE_URL = 'http://service.api.yohobuy.com/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
/**
* 私钥列表
... ...
... ... @@ -49,4 +49,81 @@ class BrandData
return Yohobuy::get(Yohobuy::SERVICE_URL.'operations/api/v5/resource/get', $param);
}
/**
* 获取品牌介绍
*
* @param integer $brandId 品牌ID
* @return array 品牌介绍信息
*/
public static function getBrandIntro($brandId)
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = '$brandId';
$param['method'] = 'app.brand.getBrandIntro';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 获取品牌banner数据
* @param integer $brandId 品牌ID
* @return array banner数据
*/
public static function getBrandBanner($brandId)
{
// 构建必传参数
$param = Yohobuy::param();
$param['brand_id'] = '$brandId';
$param['method'] = 'app.brand.banner';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 查询品牌数据
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $brand 品牌Id
* @param integer $sort 品类Id
* @param integer $color 颜色Id
* @param integer $size 尺码Id
* @param string $price 价格
* @param string $p_d 折扣
* @param string $order 排序方式,默认s_t_desc
* @param integer $limit 限制查询的数目,默认为60
* @param integer $page 查询第几页,默认为第1页
* @param integer $channel 表示频道号,1位男生,2为女生
* @return array 品牌数据
*/
public static function selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $channel = 1, $order = 's_t_desc', $limit = 60, $page = 1)
{
$selectItems = array(
'gender' => $gender,
'brand' => $brand,
'sort' => $sort,
'color' => $color,
'size' => $size,
'price' => $price,
'p_d' => $p_d
);
// 拉取筛选参数
$queriedParams = array_filter($selectItems, function($v) {return $v !== null;});
// 构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.search.brand';
$param['page'] = $page;
$param['limit'] = $limit;
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -30,4 +30,46 @@ class ClassData
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 查询品类商品数据
*
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $brand 品牌Id
* @param integer $sort 品类Id
* @param integer $color 颜色Id
* @param integer $size 尺码Id
* @param string $price 价格
* @param string $p_d 折扣
* @param string $order 排序方式,默认s_t_desc
* @param integer $limit 限制查询的数目,默认为60
* @param integer $page 查询第几页,默认为第1页
* @param integer $channel 表示频道号,1位男生,2为女生
* @return array 品类商品数据
*/
public static function selectBrandDetail($gender, $brand, $sort, $color, $size, $price, $p_d, $channel = 1, $order = 's_t_desc', $limit = 60, $page = 1)
{
$selectItems = array(
'gender' => $gender,
'brand' => $brand,
'sort' => $sort,
'color' => $color,
'size' => $size,
'price' => $price,
'p_d' => $p_d
);
// 拉取筛选参数
$queriedParams = array_filter($selectItems, function($v) {return $v !== null;});
// 构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.search.category';
$param['page'] = $page;
$param['limit'] = $limit;
$param['yh_channel'] = $channel;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -4,6 +4,7 @@ namespace LibModels\Wap\Guang;
use Api\Sign;
use Api\Yohobuy;
use Plugin\Helpers;
/**
* 明星品牌和原创品牌相关的数据模型
... ... @@ -125,14 +126,15 @@ class PlusstarData
break;
}
//$result['getNewProduct'] = $newProduct['data']['product_list'];
$skn = '';
foreach ($newProduct['data']['product_list'] as $value) {
if (empty($value['goods_list'])) {
continue;
}
// 商品信息列表
$result['getNewProduct'][] = Helpers::formatProduct($value);
// 用户是否收藏该商品
$skn = $value['product_skn'];
$result['getUidProductFav'][ $skn ] = false;
... ... @@ -141,8 +143,6 @@ class PlusstarData
$result['getUidProductFav'][ $skn ] = empty($retval['data']) ? false : $retval['data'];
});
}
// @todo 需要根据页面结构封装返回数据
}
} while (false);
... ... @@ -151,63 +151,8 @@ class PlusstarData
return $result;
// @todo 根据页面展示数据封装
// $url = '';
// if($uid > 0){
// $isLike = Favorite::getUidProductFav($uid, $new_goods_info['product_skn']);
// }
// if($client_type == 'web'){
// $baseUrl = QUtilsConfig::$websiteRoot['yohobuy'];
// }else{
// $baseUrl = QUtilsConfig::$websiteRoot['h5'];
// }
// $goods_url = MakeUrl::h5ProductDetailUrl($baseUrl,$new_goods_info['product_id'],$new_goods_info['goods_list'][0]['goods_id'],$new_goods_info['cn_alphabet']);
// $url = MakeUrl::makeUrl('go.productDetail',$goods_url, array('product_skn'=>$new_goods_info['product_skn']),$client_type);
// if((int)$new_goods_info['market_price'] == (int)$new_goods_info['sales_price'])
// {
// $new_goods_info['market_price'] = '';
// }
// $tags = array(
// 'isNew' => false,
// 'isSale' => false,
// 'isLimit' => false,
// 'isYohood' => false,
// 'midYear' => false,
// 'yearEnd' => false,
// );
// foreach ($new_goods_info['tags'] as $v){
// if($v == 'is_new'){
// $tags['isNew'] = true;
// }elseif($v == 'is_discount'){
// $tags['isSale'] = true;
// }elseif($v == 'is_limited'){
// $tags['isLimit'] = true;
// }elseif($v == 'is_yohood'){
// $tags['isYohood'] = true;
// }elseif($v == 'mid-year'){
// $tags['midYear'] = true;
// }elseif($v == 'year-end'){
// $tags['yearEnd'] = true;
// }
// }
// $newPatterns[$new_goods_info['product_skn']]= array (
// 'id'=>$new_goods_info['product_skn'],
// 'product_id'=>$new_goods_info['product_id'],
// 'product_skn'=>$new_goods_info['product_skn'],
// 'thumb' => $new_goods_info['default_images'],
// 'name' => $new_goods_info['product_name'],
// 'isLike' => $isLike,
// 'price' => $new_goods_info['market_price'],
// 'salePrice' => $new_goods_info['sales_price'],
// 'isSale' => $new_goods_info['is_discount'] == 'Y' ? true : false,
// 'isFew' => $new_goods_info['is_soon_sold_out'] == 'Y' ? true : false,
// 'isNew' => $new_goods_info['is_new'] == 'Y' ? true : false,
// 'url' => $url,
// 'tags' => $tags
// );
}
}
... ...
... ... @@ -13,7 +13,7 @@ use Api\Sign;
* @version 1.0 (2015-10-10)
* @author gtskk <rocky.zhang@yoho.cn>
*/
class ClassData
class BackData
{
/**
* 获取地区数据
... ... @@ -32,7 +32,43 @@ class ClassData
}
/**
* 通过手机号发送验证码找回密码
* 通过邮箱找回密码
*
* @param string $email 邮箱地址
* @return array 返回状态数据
*/
public static function sendCodeToEmail($email)
{
// 构建必传参数
$param = Yohobuy::param();
$param['email'] = $email;
$param['method'] = 'app.register.backpwdByEmail';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 根据邮箱验证码修改密码(调用www.yohobuy.com接口)
*
* @param string $pwd 新密码
* @param string $code 邮箱验证码
* @return array 返回状态数据
*/
public static function modifyPasswordByEmail($pwd, $code)
{
$param['pwd'] = $pwd;
$param['re-input'] = $pwd;
$param['code'] = $code;
return Yohobuy::post(Yohobuy::YOHOBUY_URL.'passport/back/update', $param);
}
/**
* 通过手机找回密码
*
* @param string $mobile 手机号
* @param integer $area 地区码ID
... ... @@ -44,9 +80,55 @@ class ClassData
$param = Yohobuy::param();
$param['mobile'] = $mobile;
$param['area'] = $area;
$param['method'] = 'app.register.sendBackpwdCodeToMobile';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 校验密码修改手机验证码
*
* @param string $mobile 手机号
* @param string $code 验证码
* @param integer $area 地区码ID
* @return array 返回状态数据(token)
*/
public static function validateMobileCode($mobile, $code, $area = 86)
{
// 构建必传参数
$param = Yohobuy::param();
$param['mobile'] = $mobile;
$param['code'] = $code;
$param['area'] = $area;
$param['method'] = 'app.register.validBackpwdCode';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 根据手机验证码修改密码
*
* @param string $mobile 手机号
* @param string $token 验证手机验证码返回的token
* @param integer $area 地区码ID
* @return array 返回状态数据
*/
public static function modifyPasswordByMobile($mobile, $token, $newpwd, $area = 86)
{
// 构建必传参数
$param = Yohobuy::param();
$param['mobile'] = $mobile;
$param['token'] = $token;
$param['newpwd'] = $newpwd;
$param['area'] = $area;
$param['method'] = 'app.register.changepwdByMobileCode';
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
<?php
namespace LibModels\Wap\Passport;
use Api\Sign;
... ... @@ -17,4 +16,55 @@ use Api\Yohobuy;
class LoginData
{
/**
* 登录
*
* @param string $profile 邮箱或手机号
* @param string $password 密码
* @return array
*/
public static function signin($profile, $password)
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.signin';
$param['profile'] = $profile;
$param['password'] = $password;
return Yohobuy::post(Yohobuy::API_URL, $param);
}
/**
* 用户信息
*
* @param int $uid 用户唯一ID
* @return array
*/
public static function profile($uid)
{
$param = Yohobuy::param();
$param['method'] = 'app.passport.profile';
$param['uid'] = $uid;
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 第三方登录接口(包括alipay,qq,sina)
* @param string $nickname 姓名
* @param string $openId 第三方唯一识别码
* @param string $sourceType 登录方式
* @return array 登录返回结果
*/
public static function signinByOpenID($nickname, $openId, $sourceType)
{
// 构建必传参数
$param = Yohobuy::param();
$param['method'] = 'app.passport.signinByOpenID';
$param['openId'] = $openId;
$param['source_type'] = $sourceType;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
... ...
... ... @@ -82,8 +82,8 @@ class RegData
$param = Yohobuy::param();
$param['method'] = 'app.passport.register';
$param['area'] = $area;
$param['mobile'] = $mobile;
$param['profile'] = $password;
$param['profile'] = $mobile;
$param['password'] = $password;
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
... ...
... ... @@ -70,14 +70,14 @@ class NewsaleData
/**
* 筛选新品到着、折扣专区商品
*
* @param string gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param string $gender "1,3"表示男, "2,3"表示女, "1,2,3"表示全部
* @param integer $brand 品牌Id
* @param integer $sort 品类Id
* @param integer $color 颜色Id
* @param integer $size 尺码Id
* @param string $price 价格
* @param string $p_d 折扣
* @param string $channel 1表示男, 2表示女
* @param integer $channel 表示频道号,1位男生,2为女生
* @param integer $dayLimit 限制读取多少天,默认为1天
* @param integer $limit 查询返回的最大限制数, 默认为50
* @param integer $page 分页第几页, 默认第1页
... ... @@ -92,14 +92,14 @@ class NewsaleData
'color' => $color,
'size' => $size,
'price' => $price,
'p_d' => $p_d
'p_d' => $p_d,
'dayLimit' => $dayLimit
);
// 拉取筛选参数
$queriedParams = array_filter($selectItems, function($v) {return $v !== null;});
$param = Yohobuy::param();
$param['method'] = 'app.search.newProduct';
$param['dayLimit'] = $dayLimit;
$param['page'] = $page;
$param['limit'] = $limit;
$param['yh_channel'] = $channel;
... ...
... ... @@ -22,15 +22,55 @@ class Helpers
}
/**
* 从数组中中获取指定键值对应的元素
* @param array $array 需要获取的数组
* @param array|string $keys 指定键值,数组或者字符串
* @return array 获取的数据
* 格式化商品信息
*
* @param array $productData 需要格式化的商品数据
* @return array | false
*/
/*public static function array_get($array, $keys)
public static function formatProduct($productData)
{
return array_intersect_key($array, array_flip((array) $keys));
// 商品信息有问题,则不显示
if (!isset($productData['product_skn'])) {
return false;
}
// 市场价和售价一样,则不显示市场价
if (intval($productData['market_price']) === intval($productData['sales_price'])) {
$productData['market_price'] = false;
}
$result = array();
$result['id'] = $productData['product_skn'];
$result['product_id'] = $productData['product_id'];
$result['thumb'] = Helpers::getImageUrl($productData['default_images'], 235, 314);
$result['name'] = $productData['product_name'];
$result['price'] = $productData['market_price'];
$result['salePrice'] = $productData['sales_price'];
$result['isFew'] = ($productData['is_soon_sold_out'] === 'Y') ? true : false;
$result['url'] = ''; // @todo
$result['tags'] = array(
'isNew' => false, // 新品
'isSale' => false, // 在售
'isLimit' => false, // 限量
'isNewFestival' => false, // 新品节
'isReNew' => false, // 再到着
'isYohood' => false, // YOHOOD
'midYear' => false, // 年中
'yearEnd' => false, // 年末
);
foreach ($productData['tags'] as $tag) {
if ($tag['is_limited'] === 'Y') {
$result['tags']['isLimit'] = true;
} elseif ($tag['is_yohood'] === 'Y') {
$result['tags']['isYohood'] = true;
} elseif ($tag['is_new'] === 'Y') {
$result['tags']['isNew'] = true;
}
}
return $result;
}
*/
}
\ No newline at end of file
... ...
... ... @@ -15,5 +15,5 @@ return array(
// 访问模式,根据自己的服务器是否支持ssl访问,若支持请选择https;若不支持请选择http
'transport' => 'http',
// 页面跳转同步通知页面路径 (需http://格式的完整路径,不允许加?id=123这类自定义参数)
'return_url' => SITE_MAIN . '/passport/sso/partnercallback/partner/alipay',
'return_url' => SITE_MAIN . '/passport/login/alipaycallback',
);
... ...
... ... @@ -73,7 +73,7 @@ class Call extends Factory
if (is_array($token) && isset($token['openid']))
{
$this->qc = new QC($token['access_token'], $token['openid']);
$this->qc = new \QC($token['access_token'], $token['openid']);
$userInfo = $this->qc->get_user_info();
... ... @@ -110,7 +110,7 @@ class Call extends Factory
if (is_array($token) && isset($token['openid']))
{
$this->qc = new QC($token['access_token'], $token['openid']);
$this->qc = new \QC($token['access_token'], $token['openid']);
$friends = $this->qc->get_idollist($params);
... ... @@ -138,7 +138,7 @@ class Call extends Factory
if (is_array($token) && isset($token['openid']))
{
$this->qc = new QC($token['access_token'], $token['openid']);
$this->qc = new \QC($token['access_token'], $token['openid']);
$param = array('title' => '来自YOHO.CN的分享', 'url' => $link, 'summary' => $content,
'images' => $image, 'site' => 'yoho.cn', 'fromurl' => SITE_MAIN,);
... ...
<?php
defined('SITE_MAIN') || define('SITE_MAIN', 'http://www.yoho.cn');
defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
return array(
'appid' => '100229394',
'appkey' => 'c0af9c29e0900813028c2ccb42021792',
'callback' => SITE_MAIN . '/passport/sso/partnercallback/partner/qqconnect',
'callback' => SITE_MAIN . '/passport/login/qqcallback',
'scope' => 'get_user_info,add_share,upload_pic,get_idollist,get_fanslist',
'errorReport' => false,
);
\ No newline at end of file
... ...
<?php
defined('SITE_MAIN') || define('SITE_MAIN', 'http://www.yoho.cn');
defined('SITE_MAIN') || define('SITE_MAIN', $_SERVER['HTTP_HOST']);
return array(
'appId' => '2707954749',
'appKey' => '431730e25a8a0983964a740731c3cb7d',
'appCallbackUrl' => SITE_MAIN . '/passport/sso/partnercallback/partner/sinaweibo',
'appCallbackUrl' => SITE_MAIN . '/passport/login/sinacallback',
);
\ No newline at end of file
... ...
... ... @@ -32,7 +32,7 @@ class TemplateLayout implements View_Interface
*/
public function assign($name, $value = null)
{
$this->tpl_vars[$name] = $value;
$this->_tpl_vars[$name] = $value;
}
/**
... ... @@ -43,10 +43,10 @@ class TemplateLayout implements View_Interface
*/
public function clear($name = null)
{
if (isset($this->tpl_vars[$name])) {
unset($this->tpl_vars[$name]);
if (isset($this->_tpl_vars[$name])) {
unset($this->_tpl_vars[$name]);
} else {
$this->tpl_vars = array();
$this->_tpl_vars = array();
}
}
... ...
... ... @@ -16,12 +16,13 @@ $resend.on('touchstart', function(e) {
$.ajax({
url: $resend.data('url'),
type: 'GET'
}).then(function(data) {
if (data.code === 200) {
showErrTip(data.message);
} else {
showErrTip(data.message);
type: 'GET',
success: function(data) {
if (data.code === 200) {
showErrTip(data.message);
} else {
showErrTip(data.message);
}
}
});
});
\ No newline at end of file
... ...
... ... @@ -37,12 +37,13 @@ $btnSure.on('touchstart', function() {
type: 'POST',
data: {
email: email
}
}).then(function(data) {
if (data.code === 200) {
location.href = data.data;
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
location.href = data.data;
} else {
showErrTip(data.message);
}
}
});
} else {
... ...
... ... @@ -45,12 +45,13 @@ $btnNext.on('touchstart', function() {
data: {
area: country.split('+')[1],
mobile: pn
}
}).then(function(data) {
if (data.code === 200) {
location.href = '/passport/back/code';
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
location.href = '/passport/back/code';
} else {
showErrTip(data.message);
}
}
});
} else {
... ...
... ... @@ -37,17 +37,18 @@ $btnOk.on('touchstart', function() {
url: '/passport/back/update',
data: {
password: pwd
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('密码修改成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = '/';
}, 1000);
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
showErrTip('密码修改成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = '/';
}, 1000);
} else {
showErrTip(data.message);
}
}
});
} else {
... ...
... ... @@ -50,15 +50,16 @@ module.exports = function(useInRegister) {
$.ajax({
type: 'POST',
url: '/passport/' + urlMid + '/sendPhone'
}).then(function (data) {
if (data.code === 200) {
$captchaTip.text('重发验证码 (60秒)').addClass('disable');
countDown();
} else {
url: '/passport/' + urlMid + '/sendPhone',
success: function(data) {
if (data.code === 200) {
$captchaTip.text('重发验证码 (60秒)').addClass('disable');
countDown();
} else {
//验证码不正确,显示提示
showErrTip(data.message);
//验证码不正确,显示提示
showErrTip(data.message);
}
}
});
});
... ... @@ -73,14 +74,15 @@ module.exports = function(useInRegister) {
url: '/passport/' + urlMid + '/verifycode',
data: {
verifyCode: trim($captcha.val())
}
}).then(function (data) {
if (data.code === 200) {
location.href = data.data;
} else {
},
success: function(data) {
if (data.code === 200) {
location.href = data.data;
} else {
//验证码不正确,显示提示
showErrTip(data.message);
//验证码不正确,显示提示
showErrTip(data.message);
}
}
});
});
... ...
... ... @@ -81,20 +81,22 @@ $loginBtn.on('touchstart', function() {
area: country.split('+')[1],
account: pn,
pwd: pwd
},
success: function(data) {
if (data.code === 200) {
showErrTip('登录成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
}
},
error: function() {
showErrTip('网络断开连接啦~');
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('登录成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
}
}, function() {
showErrTip('网络断开连接啦~');
});
} else {
showErrTip('账号或密码有错误,请重新输入');
... ...
... ... @@ -84,20 +84,22 @@ $loginBtn.on('touchstart', function() {
data: {
account: acc,
pwd: pwd
},
success: function(data) {
if (data.code === 200) {
showErrTip('登录成功');
//1s后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
}
},
error: function() {
showErrTip('网络断开连接啦~');
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('登录成功');
//1s后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
showErrTip(data.message);
}
}, function() {
showErrTip('网络断开连接啦~');
});
} else {
showErrTip('账号或密码有错误,请重新输入');
... ...
... ... @@ -39,23 +39,24 @@ $btnSure.on('touchstart', function() {
url: '/passport/register/regmobile',
data: {
password: pwd
}
}).then(function(data) {
if (data.code === 200) {
showErrTip('注册成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
if (data.code === 401 || data.code === 404 || data.code === 505) {
showErrTip(data.message);
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
showErrTip('注册成功');
//1000ms后跳转页面
setTimeout(function() {
location.href = data.data;
}, 1000);
} else {
if (data.code === 401 || data.code === 404 || data.code === 505) {
showErrTip(data.message);
} else {
showErrTip(data.message);
setTimeout(function() {
location.href = data.data;
}, 1000);
}
}
}
});
... ...
... ... @@ -45,12 +45,13 @@ $btnNext.on('touchstart', function() {
data: {
area: country.split('+')[1],
profile: pn
}
}).then(function(data) {
if (data.code === 200) {
location.href = '/passport/register/code';
} else {
showErrTip(data.message);
},
success: function(data) {
if (data.code === 200) {
location.href = '/passport/register/code';
} else {
showErrTip(data.message);
}
}
});
} else {
... ...
... ... @@ -4,7 +4,7 @@
seajs.config({
base: 'http://172.16.6.248:8000'
});
seajs.use('js/{{modulePath}}');
</script>
{{> layout/use}}
</body>
</html>
\ No newline at end of file
... ...
{{!-- 逛(PLUS+STAR) --}}
{{#if psList}}
<script>
seajs.use('js/guang/plus-star/list');
</script>
{{/if}}
{{#if psDetail}}
<script>
seajs.use('js/guang/plus-star/detail');
</script>
{{/if}}
{{!-- 注册 --}}
{{#if regIndex}}
<script>
seajs.use('js/passport/register/register');
</script>
{{/if}}
{{#if regCode}}
<script>
seajs.use('js/passport/register/code');
</script>
{{/if}}
{{#if regPwd}}
<script>
seajs.use('js/passport/register/password');
</script>
{{/if}}
{{!-- 登陆 --}}
{{#if loginIndex}}
<script>
seajs.use('js/passport/login/login');
</script>
{{/if}}
{{#if loginInterational}}
<script>
seajs.use('js/passport/login/interational');
</script>
{{/if}}
{{!-- 密码找回 --}}
{{#if backEmail}}
<script>
seajs.use('js/passport/back/email');
</script>
{{/if}}
{{#if backEmailSuccess}}
<script>
seajs.use('js/passport/back/email-success');
</script>
{{/if}}
{{#if backMobile}}
<script>
seajs.use('js/passport/back/mobile');
</script>
{{/if}}
{{#if backCode}}
<script>
seajs.use('js/passport/back/code');
</script>
{{/if}}
{{#if backNewPwd}}
<script>
seajs.use('js/passport/back/new-password');
</script>
{{/if}}
\ No newline at end of file
... ...
... ... @@ -17,7 +17,7 @@ class PlusstarController extends AbstractAction
*/
public function listAction()
{
$data = array('ps' => array('star' => array(), 'plus' => array()));
$data = array('psList' => true, 'ps' => array('star' => array(), 'plus' => array()));
$brandList = array();
$build = array();
... ... @@ -94,12 +94,72 @@ class PlusstarController extends AbstractAction
*/
public function detailAction()
{
$data = array();
$id = $this->get('id');
$gender = $this->get('gender', '1,3');
$uid = 0; // @todo
$udid = null; // @todo
do {
/* 判断参数是否有效 */
if (!is_numeric($id) || ($gender !== '1,3' && $gender !== '2,3')) {
break;
}
/* 判断品牌信息是否为空 */
$brandInfo = PlusstarData::brandInfo($id, $gender, $uid, $udid);
if (empty($brandInfo['getBrandInfo']['brand_id'])) {
break;
}
$data['psDetail'] = true;
$data['ps']['id'] = $brandInfo['getBrandInfo']['brand_id'];
$data['ps']['banner'] = Helpers::getImageUrl($brandInfo['getBrandInfo']['cover_img'], 640, 309);
$data['ps']['logo'] = Helpers::getImageUrl($brandInfo['getBrandInfo']['brand_ico'], 160, 160);
$data['ps']['name'] = $brandInfo['getBrandInfo']['brand_name'];
$data['ps']['isLike'] = $brandInfo['getUidBrandFav'];
$data['ps']['likeUrl'] = "http://guang.m.yohobuy.com/plustar/brandinfo?id=285&amp;openby:yohobuy={&quot;action&quot;:&quot;go.weblogin&quot;,&quot;params&quot;:{&quot;jumpurl&quot;:{&quot;url&quot;:&quot;http:\/\/guang.m.yohobuy.com\/plustar\/brandinfo&quot;,&quot;param&quot;:{&quot;id&quot;:285}},&quot;requesturl&quot;:{&quot;url&quot;:&quot;\/guang\/api\/v1\/favorite\/togglebrand&quot;,&quot;param&quot;:{&quot;brand_id&quot;:&quot;701&quot;}},&quot;priority&quot;:&quot;Y&quot;}}";
$data['ps']['intro'] = empty($brandInfo['brand_intro']) ? '' : strip_tags($brandInfo['brand_intro']);
$data['ps']['newArrival'] = array();
$data['ps']['newArrival']['moreUrl'] = ''; // @todo
$data['ps']['newArrival']['naList'] = $brandInfo['getNewProduct'];
$data['ps']['infos'] = array();
if (empty($brandInfo['getArticleByBrand'])) {
break;
}
// 相关文章
$build = array();
foreach ($brandInfo['getArticleByBrand'] as $value) {
$build = array();
$build['id'] = $value['id'];
$build['showTags'] = false; // 不显示标签
$build['img'] = Helpers::getImageUrl($value['src'], 640, 640, $value['cover_image_type']);
$build['url'] = $value['url']; // @todo
$build['title'] = $value['title'];
$build['text'] = $value['intro'];
$build['publishTime'] = $value['publish_time'];
$build['pageView'] = $value['views_num'];
$build['like'] = array();
$build['like']['isLiked'] = $value['like']['isLiked'];
$build['like']['count'] = $value['like']['count'];
$build['share'] = ''; //分享链接
$build['author'] = false; // 作者信息(接口暂未上线)
$data['ps']['infos'][] = $build;
}
$brandInfo = array();
} while (false);
$test = PlusstarData::brandInfo(67, '1,3', 123456);
var_dump($test);
if (array() === $data) {
$this->error();
} else {
$this->_view->display('detail', $data);
}
}
}
... ...
<?php
use Action\AbstractAction;
use LibModels\Wap\Passport\BackData;
use Hood\Core\Security\AuthCode;
/**
* 频道选择
*/
... ... @@ -23,6 +26,23 @@ class BackController extends AbstractAction
$this->_view->display('email', $data);
}
/**
* 发送邮箱验证码
*/
public function sendemailAction()
{
if($this->isAjax())
{
$email = $this->get('email', '');
// 发送邮箱验证码
$result = BackData::sendCodeToEmail($email);
$result['data'] = '/passport/back/success';
$this->echoJson($result);
}
}
public function successAction()
{
$data = array(
... ... @@ -38,24 +58,59 @@ class BackController extends AbstractAction
$this->_view->display('email-success', $data);
}
/**
* 根据邮箱修改密码
*
* @return array 根据邮箱修改密码的结果
*/
public function passwordByEmailAction()
{
if($this->isAjax())
{
$pwd = $this->get('pwd', '');
$code = $this->get('code', '');
$data = BackData::modifyPasswordByEmail($pwd, $code);
$this->returnJson(200, '成功', '');// 前端不需要判断结果
}
}
public function mobileAction()
{
// 获取地区信息
$areas = array();
$areaDatas = $data = BackData::getAreasData();
if($areaDatas['code'] == 200)
{
$areas = $areaDatas['data'];
}
// 处理地区信息
foreach ($areas as &$val) {
$val['areaCode'] = $val['area'];
if($val['area'] == 86)
{
$val['selected'] = true;
}
unset($val['area']);
}
/*// 排序
uasort($areas, function($a, $b) {
if($a['id'] === $b['id'])
{
return 0;
}
return ($a['id'] < $b['id'] ? -1 : 1);
});*/
$data = array(
'backUrl' => 'm.yohobuy.com',
'headerText' => '找回密码',
'isPassportPage' => true,
'modulePath' => 'passport/back/mobile',
'countrys' => array(
array(
'areaCode' => '+86',
'selected' => true,
'name' => '中国'
),
array(
'areaCode' => '+864',
'name' => '中国香港'
)
),
'countrys' => $areas,
'countryCode' => '+86'
);
... ... @@ -63,23 +118,67 @@ class BackController extends AbstractAction
$this->_view->display('mobile', $data);
}
public function codeAction()
/**
* 发送手机验证码
*/
public function mobilecodeSendAction()
{
if($this->isAjax())
{
$mobile = $this->get('mobile', '');
$area = $this->get('area', 86);
// 发送手机验证码
$result = BackData::sendCodeToMobile($mobile, $area);
$this->returnJson($result['code'], $result['message'], $result['data']);
}
}
public function mobilecodeAction()
{
$mobile = $this->get('mobile', '');
$area = $this->get('area', 86);
$data = array(
'backUrl' => 'm.yohobuy.com',
'headerText' => '找回密码',
'isPassportPage' => true,
'modulePath' => 'passport/back/code',
'areaCode' => '+86',
'phoneNum' => '15895869035'
'phoneNum' => $mobile
);
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('mobile-code', $data);
}
/**
* 校验手机验证码
*
* @return array 校验手机验证码的结果(token)
*/
public function mobilecodeValidateAction()
{
if($this->isAjax())
{
$mobile = $this->get('mobile', '');
$code = $this->get('code', '');
$area = $this->get('area', 86);
// 校验手机验证码
$result = BackData::validateMobileCode($mobile, $code, $area);
$this->returnJson($result['code'], $result['message'], $result['data']);
}
}
public function passwordAction()
{
$mobile = $this->get('mobile', '');
$token = $this->get('token', '');
$area = $this->get('area', 86);
$data = array(
'backUrl' => 'm.yohobuy.com',
'headerText' => '找回密码',
... ... @@ -99,4 +198,25 @@ class BackController extends AbstractAction
$this->_view->assign('title', 'YOHO!有货');
$this->_view->display('new-password', $data);
}
/**
* 根据手机验证码修改密码
*
* @return array 根据手机验证码修改密码的结果
*/
public function passwordByMobileAction()
{
if($this->isAjax())
{
$mobile = $this->get('mobile', '');
$token = $this->get('token', '');
$newpwd = $this->get('newpwd', 86);
$area = $this->get('area', 86);
// 根据手机验证码修改密码
$result = BackData::modifyPasswordByMobile($mobile, $token, $newpwd, $area);
$this->returnJson($result['code'], $result['message'], $result['data']);
}
}
}
\ No newline at end of file
... ...
... ... @@ -2,6 +2,7 @@
use Action\AbstractAction;
use Plugin\Partner\Factory;
use LibModels\Wap\Passport\LoginData;
class LoginController extends AbstractAction
{
... ... @@ -75,4 +76,83 @@ class LoginController extends AbstractAction
exit();
}
/**
* 支付宝账号登录:回调方法
*/
public function alipaycallbackAction()
{
$nickname = '';
$alipay = Factory::create('alipay');
$access = $alipay->getAccessToken();
if (!isset($_GET['real_name']))
{
/* 获取支付宝用户的详细信息 */
$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'];
}
var_dump($userInfo);
}
else
{
$nickname = $_GET['real_name'];
$alipayEmail = isset($_GET['email']) ? $_GET['email'] : '';
}
var_dump($access);
$result = LoginData::signinByOpenID($nickname, $access['user_id'], 'qq');
if($result['code'] == 200)
{
echo '登陆成功';
}
}
/**
* QQ账号登录:回调方法
*/
public function qqcallbackAction()
{
$qqconnect = Factory::create('qqconnect');
$access = $qqconnect->getAccessToken();
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo = $qqconnect->getUserInfo($access);
var_dump($access, $partnerInfo);
if ($partnerInfo && is_array($partnerInfo))
{
$result = LoginData::signinByOpenID($partnerInfo['nickname'], $access['openid'], 'qq');
if($result['code'] == 200)
{
echo '登陆成功';
}
}
}
/**
* 新浪微博账号登录:回调方法
*/
public function sinacallbackAction()
{
$sina = Factory::create('sina');
$access = $sina->getAccessToken();
/* 获取QQ腾讯用户的详细信息 */
$partnerInfo = $sina->getUserInfo($access);
var_dump($access, $partnerInfo);
if ($partnerInfo && is_array($partnerInfo))
{
$result = LoginData::signinByOpenID($partnerInfo['screen_name'], $access['uid'], 'sina');
if($result['code'] == 200)
{
echo '登陆成功';
}
}
}
}
\ No newline at end of file
... ...
... ... @@ -36,7 +36,7 @@ class NewsaleController extends AbstractAction
/**
* Ajax方式筛选新品到着商品
* Ajax方式筛选新品到着、折扣专区商品
*
* @return array 根据指定条件筛选之后的商品
*/
... ... @@ -56,9 +56,9 @@ class NewsaleController extends AbstractAction
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$data = Newsale::selectNewProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);
$data = Newsale::selectNewSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);
$this->echoJson($data);
$this->returnJson(200, '获取成功', $data);
}
}
... ... @@ -88,31 +88,4 @@ class NewsaleController extends AbstractAction
$this->_view->display('new', compact('focus', 'products'));
}
/**
* Ajax方式筛选折扣专区商品
*
* @return array 根据指定条件筛选之后的商品
*/
public function selectSaleAction()
{
if($this->isAjax())
{
$gender = $this->get('gender', '1,3');
$brand = $this->get('brand', null);
$sort = $this->get('sort', null);
$color = $this->get('color', null);
$size = $this->get('size', null);
$price = $this->get('price', null);
$p_d = $this->get('p_d', null);
$channel = $this->get('channel', '1');
$dayLimit = $this->get('dayLimit', '1');
$limit = $this->get('limit', 50);
$page = $this->get('page', 1);
$data = Newsale::selectSaleProducts($gender, $brand, $sort, $color, $size, $price, $p_d, $channel, $dayLimit, $limit, $page);
$this->echoJson($data);
}
}
}
\ No newline at end of file
... ...