Authored by wangqing

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

Showing 49 changed files with 2103 additions and 928 deletions
<?php
/**
* 有货相关接口类
*
* @name Yohobuy
* @package library/Api
* @copyright yoho.inc
* @version 1.0 (2015-9-30 16:42:51)
* @author fei.hong <fei.hong@yoho.cn>
*/
namespace Api;
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/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';**/
const API_URL = 'http://apih5.yoho.cn/';
const API_URL2 = 'http://apih5.yoho.cn/';
const SERVICE_URL = 'http://serviceh5.yoho.cn/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://api2.open.yohobuy.com/';
// /* 测试环境 */
// const API_URL = 'http://192.168.102.205:8080/gateway/'; // 先临时使用网关
/* const API_URL = 'http://testapi.yoho.cn:28078/';
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/';
// const API_URL2 = 'http://preapi.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* PC重构地址 */
// const API_URL = 'http://test.open.yohobuy.com/';
// const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/**
* 私钥列表
*
* @var array
*/
public static $privateKeyList = array(
'android' => 'fd4ad5fcfa0de589ef238c0e7331b585',
'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa',
'ipad' => 'ad9fcda2e679cf9229e37feae2cdcf80',
'web' => '0ed29744ed318fd28d2c07985d3ba633',
);
/**
* 取得当前的客户端类型
*/
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';
}
// 其它
else {
return 'android';
}
}
/**
* 取得当前的IP地址
*
* @param bool $int 返回int类型的ip地址,默认是
* @return mixed 当前的IP地址
*/
public static function ip($int = true)
{
if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP']) {
$onlineip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) {
$onlineip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$onlineip = $_SERVER['REMOTE_ADDR'];
}
return $int ? ip2long($onlineip) : $onlineip;
}
/**
* 取得公共的参数
*
* @return array
*/
public static function param()
{
$clientType = self::clientType();
$param = array(
'app_version' => '3.8.2',
'client_type' => $clientType,
'os_version' => 'yohobuy:h5',
'private_key' => self::$privateKeyList[$clientType],
'screen_size' => '720x1280',
'v' => '7',
);
return $param;
}
/**
* 构建URL
*
* @param string $url
* @param array $data
* @return string
*/
public static function httpBuildQuery($url, $data)
{
// 销毁私钥参数
if (isset($data['private_key'])) {
unset($data['private_key']);
}
if (strstr($url, '?') !== false) {
$url .= '&' . http_build_query($data, null, '&');
} else {
$url .= '?' . http_build_query($data, null, '&');
}
return $url;
}
/**
* get方式调用接口
*
* @param string $url 接口URL
* @param array $data 参数列表
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param bool $returnJson 控制是否返回json格式数据
* @param int $timeout 超时时间
* @return mixed
*/
public static function get($url, $data = array(), $cache = false, $returnJson = false, $timeout = 5)
{
// 销毁私钥参数
if (isset($data['private_key'])) {
unset($data['private_key']);
}
if (!empty($data)) {
$url = self::httpBuildQuery($url, $data);
}
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($url, 'master');
if (!empty($result)) {
return $result;
}
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
if (!$returnJson && !empty($result)) {
$result = json_decode($result, true);
}
curl_close($ch);
$data = array();
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($url, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($url, $result, $cache);
}
}
return $result;
}
/**
* post提交数据
*
* @param string $url 接口URL
* @param array $data 参数列表
* @param bool $returnJson 控制是否返回json格式数据
* @param int $timeout 超时时间
* @param array $header
* @param array $cookie
* @return mixed
*/
public static function post($url, $data = array(), $returnJson = false, $timeout = 10, $header = array(), $cookie = array())
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
if (!empty($header)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
} else {
curl_setopt($ch, CURLOPT_HEADER, 0);
}
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_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 YOHOWEB');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
// 销毁私钥参数
if (isset($data['private_key'])) {
unset($data['private_key']);
}
if (!empty($data)) {
$str = http_build_query($data, null, '&');
// 新加支持application/x-www-form-urlencoded调用方式
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
}
$result = curl_exec($ch);
if (!$returnJson && !empty($result)) {
$result = json_decode($result, true);
}
curl_close($ch);
$data = array();
return $result;
}
/**
* 批量调用接口
*
* @param array $urlList 接口列表
* @param array $options CURL设置项
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param int $timeout 超时时间,单位是秒
* @return array
*/
public static function getMulti($urlList = array(), $options = array(), $cache = false, $timeout = 5)
{
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
$key = md5(implode(',', array_values($urlList)));
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
$result = array();
$response = array();
$running = 0;
$data = '';
$error = '';
$defaultOptions = array(
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_CONNECTTIMEOUT => $timeout,
CURLOPT_TIMEOUT => $timeout,
CURLOPT_NOSIGNAL => 1, //忽略所有的curl传递给php的信号,减少并发crash
);
$mh = curl_multi_init();
$ch = array();
// 应用CURL配置
if (empty($options)) {
$options = $defaultOptions;
} else {
$options = array_merge($defaultOptions, $options);
}
// 添加子链接句柄
foreach ($urlList as $name => $api) {
$ch[$name] = curl_init($api);
curl_setopt_array($ch[$name], $options);
curl_multi_add_handle($mh, $ch[$name]);
$result[$name] = array();
}
// 调用API接口
do {
do {
$status = curl_multi_exec($mh, $running);
} while ($status == CURLM_CALL_MULTI_PERFORM);
if ($status != CURLM_OK) {
break;
}
if ($running > 0) {
curl_multi_select($mh, 0.5);
}
} while ($running);
// 获取API接口响应的结果
foreach ($urlList as $name => $api) {
$error = curl_error($ch[$name]);
if ($error != '') {
continue;
}
$data = curl_multi_getcontent($ch[$name]);
if (!$data) {
continue;
}
$response = json_decode($data, true);
if (empty($response['data'])) {
continue;
}
$result[$name] = $response['data'];
curl_multi_remove_handle($mh, $ch[$name]);
curl_close($ch[$name]);
}
curl_multi_close($mh);
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result[$name])) {
$result = Cache::get($key, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($key, $result, $cache);
}
}
return $result;
}
/**
* rpc调用远程服务(YAR)
*
* @see http://php.net/manual/zh/yar-client.setopt.php
* @param string $uri
* @param string $method
* @param array $parameters
* @param mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param int $timeout
* @return array
*/
public static function yarClient($uri, $method, $parameters = array(), $cache = false, $timeout = 3000)
{
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
$key = self::httpBuildQuery($uri . $method, $parameters);
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
$client = new \Yar_Client($uri);
$client->SetOpt(YAR_OPT_PACKAGER, 'php');
$client->SetOpt(YAR_OPT_TIMEOUT, $timeout);
$client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, $timeout);
try {
$result = call_user_func_array(array($client, $method), $parameters);
} catch (\Exception $e) {
$result = array();
}
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($key, $result, $cache);
}
}
return $result;
}
/**
* 并行(异步)调用远程服务
*
* @see http://php.net/manual/zh/class.yar-concurrent-client.php
* @param string $uri
* @param string $method
* @param array $parameter
* @param callable $callback
* @param int $timeout
* @return void
*/
public static function yarConcurrentCall($uri, $method, $parameters, $callback, $timeout = 3000)
{
\Yar_Concurrent_Client::call($uri, $method, $parameters, $callback, null, array(
YAR_OPT_PACKAGER => 'php',
YAR_OPT_TIMEOUT => $timeout,
YAR_OPT_CONNECT_TIMEOUT => $timeout
));
}
public static function yarConcurrentLoop($callback = null)
{
\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 = 10, $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;
}
}
<?php
/**
* 有货相关接口类
*
* @name Yohobuy
* @package library/Api
* @copyright yoho.inc
* @version 1.0 (2015-9-30 16:42:51)
* @author fei.hong <fei.hong@yoho.cn>
*/
namespace Api;
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/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';**/
// const API_URL = 'http://apih5.yoho.cn/';
// const API_URL2 = 'http://apih5.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
// /* 测试环境 */
// const API_URL = 'http://192.168.102.205:8080/gateway/'; // 先临时使用网关
const API_URL = 'http://testapi.yoho.cn:28078/';
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/';
// const API_URL2 = 'http://preapi.yoho.cn/';
// const SERVICE_URL = 'http://serviceh5.yoho.cn/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/* PC重构地址 */
// const API_URL = 'http://test.open.yohobuy.com/';
// const SERVICE_URL = 'http://test.service.api.yohobuy.com/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://api2.open.yohobuy.com/';
/**
* 私钥列表
*
* @var array
*/
public static $privateKeyList = array(
'android' => 'fd4ad5fcfa0de589ef238c0e7331b585',
'iphone' => 'a85bb0674e08986c6b115d5e3a4884fa',
'ipad' => 'ad9fcda2e679cf9229e37feae2cdcf80',
'web' => '0ed29744ed318fd28d2c07985d3ba633',
);
/**
* 取得当前的客户端类型
*/
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';
}
// 其它
else {
return 'android';
}
}
/**
* 取得当前的IP地址
*
* @param bool $int 返回int类型的ip地址,默认是
* @return mixed 当前的IP地址
*/
public static function ip($int = true)
{
if (isset($_SERVER['HTTP_CLIENT_IP']) && $_SERVER['HTTP_CLIENT_IP']) {
$onlineip = $_SERVER['HTTP_CLIENT_IP'];
} elseif (isset($_SERVER['HTTP_X_FORWARDED_FOR']) && $_SERVER['HTTP_X_FORWARDED_FOR']) {
$onlineip = $_SERVER['HTTP_X_FORWARDED_FOR'];
} else {
$onlineip = $_SERVER['REMOTE_ADDR'];
}
return $int ? ip2long($onlineip) : $onlineip;
}
/**
* 取得公共的参数
*
* @return array
*/
public static function param()
{
$clientType = self::clientType();
$param = array(
'app_version' => '3.8.2',
'client_type' => $clientType,
'os_version' => 'yohobuy:h5',
'private_key' => self::$privateKeyList[$clientType],
'screen_size' => '720x1280',
'v' => '7',
);
return $param;
}
/**
* 构建URL
*
* @param string $url
* @param array $data
* @return string
*/
public static function httpBuildQuery($url, $data)
{
// 销毁私钥参数
if (isset($data['private_key'])) {
unset($data['private_key']);
}
if (strstr($url, '?') !== false) {
$url .= '&' . http_build_query($data, null, '&');
} else {
$url .= '?' . http_build_query($data, null, '&');
}
return $url;
}
/**
* get方式调用接口
*
* @param string $url 接口URL
* @param array $data 参数列表
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param bool $returnJson 控制是否返回json格式数据
* @param int $timeout 超时时间
* @return mixed
*/
public static function get($url, $data = array(), $cache = false, $returnJson = false, $timeout = 5)
{
// 销毁私钥参数
if (isset($data['private_key'])) {
unset($data['private_key']);
}
if (!empty($data)) {
$url = self::httpBuildQuery($url, $data);
}
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($url, 'master');
if (!empty($result)) {
return $result;
}
}
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
if (!$returnJson && !empty($result)) {
$result = json_decode($result, true);
}
curl_close($ch);
$data = array();
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($url, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($url, $result, $cache);
}
}
return $result;
}
/**
* post提交数据
*
* @param string $url 接口URL
* @param array $data 参数列表
* @param bool $returnJson 控制是否返回json格式数据
* @param int $timeout 超时时间
* @param array $header
* @param array $cookie
* @return mixed
*/
public static function post($url, $data = array(), $returnJson = false, $timeout = 10, $header = array(), $cookie = array())
{
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
if (!empty($header)) {
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
} else {
curl_setopt($ch, CURLOPT_HEADER, 0);
}
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_USERAGENT, 'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/534.30 (KHTML, like Gecko) Chrome/12.0.742.122 YOHOWEB');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
// 销毁私钥参数
if (isset($data['private_key'])) {
unset($data['private_key']);
}
if (!empty($data)) {
$str = http_build_query($data, null, '&');
// 新加支持application/x-www-form-urlencoded调用方式
//curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_POSTFIELDS, $str);
}
$result = curl_exec($ch);
if (!$returnJson && !empty($result)) {
$result = json_decode($result, true);
}
curl_close($ch);
$data = array();
return $result;
}
/**
* 批量调用接口
*
* @param array $urlList 接口列表
* @param array $options CURL设置项
* @parma mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param int $timeout 超时时间,单位是秒
* @return array
*/
public static function getMulti($urlList = array(), $options = array(), $cache = false, $timeout = 5)
{
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
$key = md5(implode(',', array_values($urlList)));
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
$result = array();
$response = array();
$running = 0;
$data = '';
$error = '';
$defaultOptions = array(
CURLOPT_HEADER => 0,
CURLOPT_RETURNTRANSFER => 1,
CURLOPT_CONNECTTIMEOUT => $timeout,
CURLOPT_TIMEOUT => $timeout,
CURLOPT_NOSIGNAL => 1, //忽略所有的curl传递给php的信号,减少并发crash
);
$mh = curl_multi_init();
$ch = array();
// 应用CURL配置
if (empty($options)) {
$options = $defaultOptions;
} else {
$options = array_merge($defaultOptions, $options);
}
// 添加子链接句柄
foreach ($urlList as $name => $api) {
$ch[$name] = curl_init($api);
curl_setopt_array($ch[$name], $options);
curl_multi_add_handle($mh, $ch[$name]);
$result[$name] = array();
}
// 调用API接口
do {
do {
$status = curl_multi_exec($mh, $running);
} while ($status == CURLM_CALL_MULTI_PERFORM);
if ($status != CURLM_OK) {
break;
}
if ($running > 0) {
curl_multi_select($mh, 0.5);
}
} while ($running);
// 获取API接口响应的结果
foreach ($urlList as $name => $api) {
$error = curl_error($ch[$name]);
if ($error != '') {
continue;
}
$data = curl_multi_getcontent($ch[$name]);
if (!$data) {
continue;
}
$response = json_decode($data, true);
if (empty($response['data'])) {
continue;
}
$result[$name] = $response['data'];
curl_multi_remove_handle($mh, $ch[$name]);
curl_close($ch[$name]);
}
curl_multi_close($mh);
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result[$name])) {
$result = Cache::get($key, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($key, $result, $cache);
}
}
return $result;
}
/**
* rpc调用远程服务(YAR)
*
* @see http://php.net/manual/zh/yar-client.setopt.php
* @param string $uri
* @param string $method
* @param array $parameters
* @param mixed $cache 控制是否启用接口数据的缓存(时间单位为秒). 如3600表示缓存1小时, false表示不缓存
* @param int $timeout
* @return array
*/
public static function yarClient($uri, $method, $parameters = array(), $cache = false, $timeout = 3000)
{
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
$key = self::httpBuildQuery($uri . $method, $parameters);
// 先尝试获取一级缓存(master), 有数据则直接返回.
$result = Cache::get($key, 'master');
if (!empty($result)) {
return $result;
}
}
$client = new \Yar_Client($uri);
$client->SetOpt(YAR_OPT_PACKAGER, 'php');
$client->SetOpt(YAR_OPT_TIMEOUT, $timeout);
$client->SetOpt(YAR_OPT_CONNECT_TIMEOUT, $timeout);
try {
$result = call_user_func_array(array($client, $method), $parameters);
} catch (\Exception $e) {
$result = array();
}
/* 开启缓存的情况 */
if ($cache && USE_CACHE) {
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if (empty($result)) {
$result = Cache::get($key, 'slave');
}
// 接口调用成功时,这里会设置一级(master)和二级(slave)的缓存数据.
else {
Cache::set($key, $result, $cache);
}
}
return $result;
}
/**
* 并行(异步)调用远程服务
*
* @see http://php.net/manual/zh/class.yar-concurrent-client.php
* @param string $uri
* @param string $method
* @param array $parameter
* @param callable $callback
* @param int $timeout
* @return void
*/
public static function yarConcurrentCall($uri, $method, $parameters, $callback, $timeout = 3000)
{
\Yar_Concurrent_Client::call($uri, $method, $parameters, $callback, null, array(
YAR_OPT_PACKAGER => 'php',
YAR_OPT_TIMEOUT => $timeout,
YAR_OPT_CONNECT_TIMEOUT => $timeout
));
}
public static function yarConcurrentLoop($callback = null)
{
\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 = 10, $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;
}
}
... ...
... ... @@ -32,7 +32,7 @@ class IndexData
* @param string $client_type
* @return array
*/
public static function getResourceData($content_code, $client_type = 'web')
public static function getResourceData($content_code, $client_type = 'web')
{
// 构建必传参数
$params = Yohobuy::param();
... ... @@ -68,4 +68,33 @@ class IndexData
unset($param['v']);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
/**
* 意见反馈
*
* @param int $feedback_id
* @param int $question_id
* @param string $answer
* @param int $solution
* @return array
*/
public static function suggestFeedback($feedback_id, $question_id, $answer, $solution)
{
//TODO 走老接口
$param = Yohobuy::param();
$param['page'] = 1;
$param['open_key'] = '12345';
$param['method'] = 'open.feedback.submit';
$param['feedback_id'] = $feedback_id;
$param['question_id'] = $question_id;
$param['answer'] = $answer;
$param['solution'] = $solution;
unset($param['app_version']);
unset($param['client_type']);
unset($param['os_version']);
unset($param['screen_size']);
unset($param['v']);
return Yohobuy::get(Yohobuy::API_URL, $param);
}
}
\ No newline at end of file
... ...
... ... @@ -867,7 +867,6 @@ class Process
$cacheKey = sprintf("%s_%s", CacheConfig::KEY_INDEX_BRANDS_LIST_DATA, $type_key);
Cache::set($cacheKey, $floor, 7200);
$result['hotBrands']['brandUrl'] = '/common/getIndexResourceBrand?type=' . $type_key;
//print_r($result['hotBrands']['brandUrl']);
}
return $result;
}
... ...
... ... @@ -110,6 +110,7 @@ class HelperSearch
*/
public static function getProductList($product,$imgSize)
{
$params = self::$params;
$goods = array();
foreach($product as $key => $val){
//NEW
... ... @@ -125,6 +126,10 @@ class HelperSearch
// 年中大促
foreach($val['goods_list'] as $k => $v){
$goods_list[$k]['url'] = Helpers::getUrlBySkc($val['product_id'], $v['goods_id'], $val['cn_alphabet']);
//筛选符合颜色条件的封面图片
if (isset($params['color']) && $params['color'] == $v['color_id']) {
$val['default_images'] = Images::getImageUrl($v['images_url'],$imgSize[0],$imgSize[1]);
}
}
if (!empty($val['default_images'])) {
$val['default_images'] = Images::getImageUrl($val['default_images'],$imgSize[0],$imgSize[1]);
... ... @@ -439,6 +444,10 @@ class HelperSearch
if (self::checkSearch('brand')) {
return array();
}
//品牌数量小于等于10,隐藏更多按钮
if (count($result['brandsShow']) < 11) {
$result['hideMore'] = true;
}
return $result;
}
/**
... ... @@ -613,18 +622,18 @@ class HelperSearch
}
$result = array();
$style = $filter['style'];
$styleNum = 0;
$styleName = '';
foreach ($style as $v) {
//选中的筛选条件
if (in_array($v['style_id'], $styleIds)) {
$selectedStyle = explode(',', self::$params['style']);
$selectedKey = array_search($v['style_id'], $selectedStyle);
unset($selectedStyle[$selectedKey]);
$selectedParams = $params;
$selectedParams['style'] = implode(',', $selectedStyle);
self::$selected['style'][] = array(
'name' => $v['style_name'],
'href' => self::buildUrl($selectedParams)
);
if (!$styleNum) {
$styleName = $v['style_name']."";
}
elseif ($styleNum ===1){
$styleName .= substr($v['style_name'], 0, 3).'...';
}
$styleNum ++;
}
$selectedStyle = isset(self::$params['style']) && !empty(self::$params['style']) ? explode(',', self::$params['style']) : array();
//风格id在提交的参数中,构造url参数去除该风格id
... ... @@ -648,9 +657,11 @@ class HelperSearch
'href' => $url,
);
}
//搜索页已选中,返回空
if (self::checkSearch('style')) {
return array();
if (isset(self::$params['style']) && !empty(self::$params['style'])) {
self::$selected['style'] = array(
'name' => rtrim($styleName, '、'),
'href' => self::buildUrl($params)
);
}
$data[0] = array(
'attr' => 'style',
... ... @@ -668,6 +679,10 @@ class HelperSearch
$style = self::style($filter);
$other = self::standard($filter);
$result = array_merge($style,$other);
//搜索页已选中,返回空
if (self::checkSearch('style') || self::checkSearch('parameter')) {
return array();
}
return $result;
}
... ... @@ -926,7 +941,6 @@ class HelperSearch
if ($data) {
$result['conditions'] = $data;
}
// print_r($result); exit;
return $result;
}
... ... @@ -992,7 +1006,7 @@ class HelperSearch
*/
public static function current()
{
$url = explode('?', $_SERVER['REQUEST_URI']);
$url = explode('?', 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
self::$listNav[0]['href'] = $url[0];
return $url[0];
}
... ... @@ -1102,8 +1116,12 @@ class HelperSearch
public static function checkSearch($param)
{
if (isset(self::$params[$param]) && isset(self::$options['controller']) && self::$options['controller'] == 'Search') {
return true;
if (isset(self::$options['controller']) && self::$options['controller'] == 'Search') {
foreach (self::$params as $key =>$val) {
if (strpos($key, $param) !== false) {
return true;
}
}
}
}
... ... @@ -1354,7 +1372,9 @@ class HelperSearch
//清除选中
$result['checkedConditions']['clearUrl'] = self::current();
//频道
$result['channel'] = self::gender(self::$filter);
$result['channel'] = array();
//性别
$result['gender'] = self::gender(self::$filter);
//品牌
$result['brand'] = self::brand(self::$filter);
//价格
... ...
... ... @@ -129,7 +129,7 @@ class Helpers
*/
public static function getShoppingKeyByCookie()
{
$cookie = isset($_COOKIE['_spk']) ? $_COOKIE['_spk'] : '';
$cookie = isset($_COOKIE['_SPK']) ? $_COOKIE['_SPK'] : '';
return $cookie;
}
... ...
... ... @@ -142,15 +142,28 @@ function changeSizeChosed(newSizeIndex) {
$curSizeBlock.removeClass('chosed');
sizes = $sizeRowList.eq(newSizeIndex).children();
for (i = 0; i < sizes.length; i++) {
if ($(sizes[i]).data('name') === $curSizeBlock.data('name')) {
if ($(sizes[i]).data('id') === $curSizeBlock.data('id')) {
$curSizeBlock = $(sizes[i]);
queryString = '#' + $curSizeBlock.data('name');
queryString = '#' + $curSizeBlock.data('id');
curColorIndex = $(queryString).data('index');
$curSizeBlock.addClass('chosed');
return $curSizeBlock.data('num');
}
}
$curSizeBlock.addClass('chosed');
return $curSizeBlock.data('num');
//特殊处理: 老的选中尺码在新选中的颜色对应尺码中不存在,需要下述1,2,3
// 1.重置尺码选择的标志变量.
$curSizeBlock = null;
hasChooseSize = false;
// 2.当前颜色行隐藏
$colorRowList.eq(curColorIndex).addClass('hide');
// 3.目标颜色行第一行显示
$colorRowList.eq(0).removeClass('hide');
curColorIndex = 0;
return -1;
}
return 0;
}
... ... @@ -228,7 +241,15 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
// 颜色块切换勾选样式
$this.siblings('.chosed').removeClass('chosed');
$this.toggleClass('chosed');
// 特殊处理
if (-1 === curGoodNum) {
$curColorBlock = $($colorRowList.eq(0).children().get(index));
$curColorBlock.addClass('chosed');
} else {
$this.toggleClass('chosed');
}
$('#good-num').val(1);
// 设置按钮的样式和文字
... ... @@ -261,7 +282,7 @@ $yohoPage.on('touchstart', '.color-list .block', function() {
} else {
hasChooseSize = true;
index = $('#' + $this.data('name')).data('index') - 1;
index = $('#' + $this.data('id')).data('index') - 1;
// 颜色当前行隐藏
$colorRowList.eq(curColorIndex).addClass('hide');
... ...
... ... @@ -29,20 +29,7 @@ var brandsData,
loading.showLoadingMask();
//热门品牌滑动
hotBrandsSwiper = new Swiper('.brands-swiper', {
grabCursor: true,
slidesPerView: 'auto',
wrapperClass: 'brands-list',
slideElement: 'li'
});
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
loop: true,
autoplay: 3000,
pagination: '.swiper-pagination .pagination-inner'
});
lazyLoad($('img.lazy'));
$('.yoho-header').css({
... ... @@ -58,6 +45,22 @@ $('.yoho-header').css({
$('.hide-when-loading').show();
loading.hideLoadingMask();
//banner滑动
swiper = new Swiper('.swiper-container', {
lazyLoading: true,
loop: true,
autoplay: 3000,
pagination: '.swiper-pagination .pagination-inner'
});
//热门品牌滑动
hotBrandsSwiper = new Swiper('.brands-swiper', {
grabCursor: true,
slidesPerView: 'auto',
wrapperClass: 'brands-list',
slideElement: 'li'
});
})();
$fixTitleBar = $('<div class="title-bar fixed-title-bar"><h2></h2></div>');
... ... @@ -163,19 +166,21 @@ if ($('.brand-search-page').length) {
$keyword.on('input', function() {
if ($keyword.val().length) {
$icon.css('color', '#000');
$(this).closest('.search-box').css('width', '11.25rem');
$icon.css('color', '#444');
// $(this).closest('.search-box').css('width', '11.25rem');
$searchAction.show().find('.clear-text').show();
} else {
$icon.css('color', '#b2b2b2');
$(this).closest('.search-box').css('width', '12.5rem');
$searchAction.hide();
// $(this).closest('.search-box').css('width', '12.5rem');
$searchAction.find('.clear-text').hide();
}
searchResult();
}).focus();
// 2016.1.13 产品(高扬)要求进入页面默认显示取消按钮
$icon.css('color', '#000');
$icon.css('color', '#444');
$keyword.closest('.search-box').css('width', '11.25rem');
$searchAction.show().find('.clear-text').hide();
... ...
... ... @@ -33,41 +33,50 @@ module.exports = function(specificGender) {
if (kidsType) {
url = '/product/recom/maylikekids';
} else if (lifestyleType) {
url = '/product/recom/maylikelife';
//有货币页面加载男生首页的数据
url = specificGender === 'lifestyle' ? '/product/recom/maylike?gender=1,3' : '/product/recom/maylikelife';
} else {
gender = (specificGender === 'boys' || $('.mobile-wrap').hasClass('boys-wrap')) ?
'1,3' : '2,3',
url = '/product/recom/maylike?gender=' + gender;
}
//以防cookie异常,强制加载男首
if (specificGender === 'boys') {
url = '/product/recom/maylike?gender=1,3';
}
$curNav = $navList.children('.focus');
if (lifestyleType) {
navHammer = new Hammer($navList[0]);
navHammer.on('tap', function(e) {
var $this = $(e.target).closest('li'),
$goods = $('.goods-list'),
$content;
e.preventDefault();
if ($this.hasClass('focus')) {
return;
}
navHammer = $navList[0] ? new Hammer($navList[0]) : undefined;
if (navHammer) {
navHammer.on('tap', function(e) {
var $this = $(e.target).closest('li'),
$goods = $('.goods-list'),
$content;
e.preventDefault();
if ($this.hasClass('focus')) {
return;
}
index = $this.index();
index = $this.index();
$this.addClass('focus');
$curNav.removeClass('focus');
$this.addClass('focus');
$curNav.removeClass('focus');
$goods.not('.hide').addClass('hide');
$content = $goods.eq(index);
$content.removeClass('hide');
$goods.not('.hide').addClass('hide');
$content = $goods.eq(index);
$content.removeClass('hide');
$curNav = $this;
$curNav = $this;
$(document).trigger('scroll'); //Trigger lazyLoad
e.srcEvent.stopPropagation();
});
$(document).trigger('scroll'); //Trigger lazyLoad
e.srcEvent.stopPropagation();
});
}
}
loading.init($('.maybe-like'));
... ...
... ... @@ -5,7 +5,7 @@
*/
function getGender() {
return window.cookie('_Channel');
return window.cookie('_Channel') || 'boys';
}
require('../home/maybe-like')(getGender());
... ...
... ... @@ -202,8 +202,9 @@
li:before {
content: "";
display: inline-block;
width: 4px;
height: 4px;
margin-right: 10rem / $pxConvertRem;
width: 8rem / $pxConvertRem;
height: 8rem / $pxConvertRem;
background-color: #000;
border-radius: 50%;
position: relative;
... ...
... ... @@ -127,8 +127,9 @@
.cancel-btn {
display: inline;
font-size: 32rem / $pxConvertRem;
font-size: 28rem / $pxConvertRem;
vertical-align: middle;
color: #444;
}
.clear-text {
... ...
;(function() {
var yas_jssdk_1014_src_config_debug, yas_jssdk_1014_src_cross_debug, yas_jssdk_1014_src_event_debug, yohojson2_100_json2_debug, yas_jssdk_1014_src_util_debug, yas_jssdk_1014_src_cookie_debug, yas_jssdk_1014_src_ya_debug, yas_jssdk_1014_yas_debug;
yas_jssdk_1014_src_config_debug = function (exports) {
exports = {
version: '1.0',
yasPath: '/web/',
yasDomain: getDomain(),
yasImgDomain: 'http://analytics.yhurl.com/yas.gif'
};
function getDomain() {
var domainArr = document.domain.split('.');
var length = domainArr.length;
if (length > 1 && isNaN(domainArr[length - 1])) {
return '.' + domainArr[length - 2] + '.' + domainArr[length - 1];
} else {
return document.domain;
}
}
return exports;
}();
yas_jssdk_1014_src_cross_debug = function (exports) {
/**
* 跨域发送信息工具库
*/
var config = yas_jssdk_1014_src_config_debug;
var yasPath = config.yasPath;
var yasImgDomain = config.yasImgDomain;
//发送图片方式
exports.imgSend = function (param, callback) {
var image = new Image(1, 1);
image.src = yasImgDomain + yasPath + '?' + param;
image.onload = function () {
image.onload = null;
if (callback) {
callback();
}
};
};
return exports;
}({});
yas_jssdk_1014_src_event_debug = function (exports) {
exports.addEventHandler = function (target, type, func) {
if (target.addEventListener)
target.addEventListener(type, func, false);
else if (target.attachEvent)
target.attachEvent('on' + type, func);
else
target['on' + type] = func;
};
exports.removeEventHandler = function (target, type, func) {
if (target.removeEventListener)
target.removeEventListener(type, func, false);
else if (target.detachEvent)
target.detachEvent('on' + type, func);
else
delete target['on' + type];
};
return exports;
}({});
yohojson2_100_json2_debug = function () {
if (typeof JSON !== 'object') {
JSON = {};
}
(function () {
'use strict';
var rx_one = /^[\],:{}\s]*$/, rx_two = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, rx_three = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, rx_four = /(?:^|:|,)(?:\s*\[)+/g, rx_escapable = /[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g, rx_dangerous = /[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
function f(n) {
return n < 10 ? '0' + n : n;
}
function this_value() {
return this.valueOf();
}
if (typeof Date.prototype.toJSON !== 'function') {
Date.prototype.toJSON = function () {
return isFinite(this.valueOf()) ? this.getUTCFullYear() + '-' + f(this.getUTCMonth() + 1) + '-' + f(this.getUTCDate()) + 'T' + f(this.getUTCHours()) + ':' + f(this.getUTCMinutes()) + ':' + f(this.getUTCSeconds()) + 'Z' : null;
};
Boolean.prototype.toJSON = this_value;
Number.prototype.toJSON = this_value;
String.prototype.toJSON = this_value;
}
var gap, indent, meta, rep;
function quote(string) {
rx_escapable.lastIndex = 0;
return rx_escapable.test(string) ? '"' + string.replace(rx_escapable, function (a) {
var c = meta[a];
return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
}) + '"' : '"' + string + '"';
}
function str(key, holder) {
var i, k, v, length, mind = gap, partial, value = holder[key];
if (value && typeof value === 'object' && typeof value.toJSON === 'function') {
value = value.toJSON(key);
}
if (typeof rep === 'function') {
value = rep.call(holder, key, value);
}
switch (typeof value) {
case 'string':
return quote(value);
case 'number':
return isFinite(value) ? String(value) : 'null';
case 'boolean':
case 'null':
return String(value);
case 'object':
if (!value) {
return 'null';
}
gap += indent;
partial = [];
if (Object.prototype.toString.apply(value) === '[object Array]') {
length = value.length;
for (i = 0; i < length; i += 1) {
partial[i] = str(i, value) || 'null';
}
v = partial.length === 0 ? '[]' : gap ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']' : '[' + partial.join(',') + ']';
gap = mind;
return v;
}
if (rep && typeof rep === 'object') {
length = rep.length;
for (i = 0; i < length; i += 1) {
if (typeof rep[i] === 'string') {
k = rep[i];
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
} else {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = str(k, value);
if (v) {
partial.push(quote(k) + (gap ? ': ' : ':') + v);
}
}
}
}
v = partial.length === 0 ? '{}' : gap ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}' : '{' + partial.join(',') + '}';
gap = mind;
return v;
}
}
if (typeof JSON.stringify !== 'function') {
meta = {
'\b': '\\b',
'\t': '\\t',
'\n': '\\n',
'\f': '\\f',
'\r': '\\r',
'"': '\\"',
'\\': '\\\\'
};
JSON.stringify = function (value, replacer, space) {
var i;
gap = '';
indent = '';
if (typeof space === 'number') {
for (i = 0; i < space; i += 1) {
indent += ' ';
}
} else if (typeof space === 'string') {
indent = space;
}
rep = replacer;
if (replacer && typeof replacer !== 'function' && (typeof replacer !== 'object' || typeof replacer.length !== 'number')) {
throw new Error('JSON.stringify');
}
return str('', { '': value });
};
}
if (typeof JSON.parse !== 'function') {
JSON.parse = function (text, reviver) {
var j;
function walk(holder, key) {
var k, v, value = holder[key];
if (value && typeof value === 'object') {
for (k in value) {
if (Object.prototype.hasOwnProperty.call(value, k)) {
v = walk(value, k);
if (v !== undefined) {
value[k] = v;
} else {
delete value[k];
}
}
}
}
return reviver.call(holder, key, value);
}
text = String(text);
rx_dangerous.lastIndex = 0;
if (rx_dangerous.test(text)) {
text = text.replace(rx_dangerous, function (a) {
return '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4);
});
}
if (rx_one.test(text.replace(rx_two, '@').replace(rx_three, ']').replace(rx_four, ''))) {
j = eval('(' + text + ')');
return typeof reviver === 'function' ? walk({ '': j }, '') : j;
}
throw new SyntaxError('JSON.parse');
};
}
}());
}();
yas_jssdk_1014_src_util_debug = function (exports) {
var config = yas_jssdk_1014_src_config_debug;
var yasPath = config.yaPath;
var yasDomain = config.yasDomain;
exports.flashChecker = function () {
var hasFlash = 0;
var flashVersion = 0;
var isIE = 0;
var swf = null;
if (isIE) {
swf = new ActiveXObject('ShockwaveFlash.ShockwaveFlash');
if (swf) {
hasFlash = 1;
flashVersion = swf.GetVariable('$version');
}
} else {
if (navigator.plugins && navigator.plugins.length > 0) {
swf = navigator.plugins['Shockwave Flash'];
if (swf) {
hasFlash = 1;
flashVersion = swf.description.replace('Shockwave Flash', '');
}
}
}
return {
f: hasFlash,
v: flashVersion
};
};
exports.Hash = function (str) {
var hash = 1, charCode = 0, idx;
if (str) {
hash = 0;
for (idx = str.length - 1; idx >= 0; idx--) {
charCode = str.charCodeAt(idx);
hash = (hash << 6 & 268435455) + charCode + (charCode << 14);
charCode = hash & 266338304;
if (charCode !== 0) {
hash = hash ^ charCode >> 21;
}
}
}
return hash;
};
exports.Random = function () {
return Math.round(Math.random() * 2147483647);
};
exports.hashClientInfo = function () {
var navigator = window.navigator;
var history_length = window.history.length;
var arr = [
navigator.appName,
navigator.version,
navigator.language,
navigator.platform,
navigator.userAgent,
navigator.javaEnabled(),
window.screen,
window.screen.colorDepth,
window.document.cookie ? window.document.cookie : '',
window.document.referrer ? window.document.referrer : ''
];
navigator = arr.join('');
for (var len = navigator.length; history_length > 0;) {
navigator += history_length-- ^ len++;
}
return exports.Hash(navigator);
};
exports.merge = function (obj1, obj2) {
var ret = {};
for (var attr in obj1) {
ret[attr] = obj1[attr];
}
for (var attr2 in obj2) {
ret[attr2] = obj2[attr2];
}
return ret;
};
exports.genParam = function (obj) {
var arr = [];
for (var key in obj) {
arr.push(key + '=' + obj[key]);
}
return arr.join('&');
};
exports.trim = function (text) {
if (String.prototype.trim) {
return text === null ? '' : String.prototype.trim.call(text);
} else {
var trimLeft = /^\s+/;
var trimRight = /\s+$/;
var ret = '';
if (text) {
ret = text.toString().replace(trimLeft, '');
ret = ret.replace(trimRight, '');
return ret;
}
}
};
exports.getGeo = function (callback) {
if (window.navigator.geolocation) {
var options = { enableHighAccuracy: true };
window.navigator.geolocation.getCurrentPosition(handleSuccess, handleError, options);
} else {
callback(false);
}
function handleSuccess(position) {
var lng = position.coords.longitude;
var lat = position.coords.latitude;
callback(lat, lng);
}
function handleError(error) {
callback(false);
}
};
return exports;
}({});
yas_jssdk_1014_src_cookie_debug = function (exports) {
var util = yas_jssdk_1014_src_util_debug;
exports = function (name, value, options) {
if (typeof value != 'undefined') {
options = options || {};
if (value === null) {
value = '';
options.expires = -1;
}
var expires = '';
if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
var date;
if (typeof options.expires == 'number') {
date = new Date();
date.setTime(date.getTime() + options.expires * 24 * 60 * 60 * 1000);
} else {
date = options.expires;
}
expires = '; expires=' + date.toUTCString();
}
var path = options.path ? '; path=' + options.path : '';
var domain = options.domain ? '; domain=' + options.domain : '';
var secure = options.secure ? '; secure' : '';
document.cookie = [
name,
'=',
encodeURIComponent(value),
expires,
path,
domain,
secure
].join('');
} else {
var cookieValue = null;
if (document.cookie) {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
var cookie = util.trim(cookies[i]);
if (cookie.substring(0, name.length + 1) == name + '=') {
cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
break;
}
}
}
return cookieValue;
}
};
return exports;
}();
yas_jssdk_1014_src_ya_debug = function (exports) {
var util = yas_jssdk_1014_src_util_debug;
var cookies = yas_jssdk_1014_src_cookie_debug;
var cross = yas_jssdk_1014_src_cross_debug;
var ev = yas_jssdk_1014_src_event_debug;
var config = yas_jssdk_1014_src_config_debug;
yohojson2_100_json2_debug;
var version = config.version;
var yasPath = config.yaPath;
var yasDomain = config.yasDomain;
var appInfo = {
h: document.domain,
p: window.location.port,
u: window.location.pathname,
ft: 0,
fst: 0,
sv: '',
ab: cookies('ab_5') || ''
};
var VisitorId = getVisitorId();
var custInfo = {
ak: '',
cd: VisitorId.cid,
vd: new Date().getTime() + VisitorId.cid,
ud: '',
rf: document.referrer,
ckf: VisitorId.isNew
};
var custOpInfo = {
mp: '',
ev: '',
st: 0
};
var flash = util.flashChecker();
var browserInfo = {
sr: window.screen.width + 'x' + window.screen.height,
wr: window.screen.availWidth + 'x' + window.screen.availHeight,
sd: window.screen.colorDepth,
ln: window.navigator.language ? window.navigator.language : window.navigator.browserLanguage,
sy: window.navigator.platform,
ce: window.navigator.cookieEnabled,
fv: flash.f ? flash.v : 0
};
var _yas = function (initTime, version, tid, uid, geo, selector) {
custInfo.ak = tid;
appInfo.sv = version;
custInfo.ud = uid ? uid : '';
if (cookies('_yasgeo')) {
var geoInfo = cookies('_yasgeo').split(',');
custInfo.la = geoInfo[0];
custInfo.lo = geoInfo[1];
cookies('_yasgeo', null, {
path: '/',
domain: config.yasDomain,
expires: 365 * 200
});
}
var beginTime = new Date().getTime();
var sendFlag = null;
var isOver3sSend = false;
appInfo.ft = beginTime - initTime;
ev.addEventHandler(window, 'load', function (e) {
var endTime = new Date().getTime();
appInfo.fst = endTime - initTime;
ev.removeEventHandler(window, 'load', arguments.callee);
window.clearTimeout(sendFlag);
if (!isOver3sSend) {
send();
}
});
sendFlag = window.setTimeout(function () {
appInfo.fst = 0;
appInfo.fse = '>3s';
isOver3sSend = true;
send();
}, 3000);
if (geo) {
util.getGeo(function (lat, lng) {
if (lat) {
cookies('_yasgeo', lat + ',' + lng, {
path: '/',
domain: yasDomain,
expires: 365 * 200
});
}
});
}
if (selector[0]) {
for (var i = 0, length = selector.length; i < length; i++) {
selector[i].setAttribute('yoho_index', i + 1);
}
} else {
ev.addEventHandler(document, 'click', function (e) {
e = e || window.event;
var target = e.target || e.srcElement;
if (target && (target.nodeName === 'A' || target.nodeName === 'IMG' && target.parentNode.nodeName === 'A')) {
var pos = getMouseEventPosition(e);
var str = pos.x + ',' + pos.y + ',' + e.type;
var yoho_index = target.getAttribute('yoho_index') || target.parentNode.getAttribute('yoho_index');
if (yoho_index) {
str += ',' + yoho_index;
}
cookies('_yasmp', str, {
path: '/',
domain: yasDomain,
expires: 365 * 200
});
}
ix = 0;
});
}
};
function send(callback) {
var info = util.merge(appInfo, custInfo);
info = util.merge(info, browserInfo);
var mp = getMousePosition();
if (mp) {
info = util.merge(info, mp);
cookies('_yasmp', null, {
path: '/',
domain: config.yasDomain,
expires: 365 * 200
});
}
var _custjsonstr = cookies('_yascustjson');
if (_custjsonstr) {
var custjson = JSON.parse(_custjsonstr);
info = util.merge(info, custjson);
cookies('_yascustjson', null, {
path: '/',
domain: config.yasDomain,
expires: 365 * 200
});
}
var param = util.genParam(info);
callback = callback ? callback : function () {
};
cross.imgSend(param, callback);
var _yasev = cookies('_yasev');
if (_yasev) {
cross.imgSend(_yasev, function () {
cookies('_yasev', null, {
path: '/',
domain: config.yasDomain,
expires: 365 * 200
});
});
}
}
function getVisitorId() {
var cid = cookies('_yasvd');
if (cid) {
return {
cid: cid,
isNew: 'N'
};
}
cid = util.Random() ^ util.hashClientInfo() & 2147483647;
cookies('_yasvd', cid, {
path: '/',
domain: yasDomain,
expires: 365 * 200
});
return {
cid: cid,
isNew: 'Y'
};
}
function getMousePosition() {
var mp = cookies('_yasmp');
if (mp) {
var mpObject = mp.split(',');
if (mpObject.length === 3) {
return {
x: mpObject[0],
y: mpObject[1],
et: mpObject[2]
};
} else if (mpObject.length === 4) {
return {
x: mpObject[0],
y: mpObject[1],
et: mpObject[2],
ix: mpObject[3]
};
}
}
return null;
}
function getMouseEventPosition(e) {
var x = 0, y = 0;
if (e.pageX || e.pageY) {
x = e.pageX;
y = e.pageY;
} else if (e.clientX || e.clientY) {
x = e.clientX + document.body.scrollLeft + document.documentElement.scrollLeft;
y = e.clientY + document.body.scrollTop + document.documentElement.scrollTop;
}
x -= window.screen.width / 2;
y = window.screen.height / 2 - y;
return {
x: x,
y: y
};
}
var evTimes = 0;
_yas.add = function (trackType, input, action, label, value) {
if (evTimes > 3) {
cross.imgSend(cookies('_yasev'), function () {
cookies('_yasev', null, {
path: '/',
domain: config.yasDomain,
expires: 365 * 200
});
evTimes = 0;
_addEv2Cookies(trackType, input, action, label, value);
});
} else {
_addEv2Cookies(trackType, input, action, label, value);
}
};
function _addEv2Cookies(trackType, input, action, label, value) {
var ev = cookies('_yasev');
if (ev) {
ev += '&';
} else {
ev = '';
}
cookies('_yasev', ev + 'vd=' + custInfo.vd + '&t=' + trackType + '&i=' + input + '&l=' + label + '&v=' + value, {
path: '/',
domain: yasDomain,
expires: 365 * 200
});
evTimes++;
}
_yas.sendMouseEvent = function (e, flag) {
e = e || window.event;
var pos = getMouseEventPosition(e);
if (!flag) {
cookies('_yasmp', pos.x + ',' + pos.y + ',' + e.type, {
path: '/',
domain: yasDomain,
expires: 365 * 200
});
} else {
var mp = {
x: pos.x,
y: pos.y,
et: e.type
};
var info = util.merge(appInfo, custInfo);
info = util.merge(info, browserInfo);
info = util.merge(info, mp);
var param = util.genParam(info);
cross.imgSend(param, function () {
});
}
};
_yas.sendCustomInfo = function (json, flag) {
if (!flag) {
var string = JSON.stringify(json);
cookies('_yascustjson', string, {
path: '/',
domain: yasDomain,
expires: 365 * 200
});
} else {
var info = util.merge(appInfo, custInfo);
info = util.merge(info, browserInfo);
info = util.merge(info, json);
var param = util.genParam(info);
cross.imgSend(param, function () {
});
}
};
exports = _yas;
return exports;
}();
yas_jssdk_1014_yas_debug = function (exports) {
var yasJssdk = yas_jssdk_1014_src_ya_debug;
if (window.YohoAcquisitionObject) {
var yas = window.YohoAcquisitionObject;
if (window[yas].p) {
yasJssdk.apply(this, window[yas].p);
window[yas] = yasJssdk;
}
}
exports = yasJssdk;
return exports;
}();
}());
\ No newline at end of file
... ...
!function(){var yas_jssdk_1014_src_config,yas_jssdk_1014_src_cross,yas_jssdk_1014_src_event,yohojson2_100_json2,yas_jssdk_1014_src_util,yas_jssdk_1014_src_cookie,yas_jssdk_1014_src_ya,yas_jssdk_1014_yas;yas_jssdk_1014_src_config=function(e){function n(){var e=document.domain.split("."),n=e.length;return n>1&&isNaN(e[n-1])?"."+e[n-2]+"."+e[n-1]:document.domain}return e={version:"1.0",yasPath:"/web/",yasDomain:n(),yasImgDomain:"http://analytics.yhurl.com/yas.gif"}}(),yas_jssdk_1014_src_cross=function(e){var n=yas_jssdk_1014_src_config,t=n.yasPath,r=n.yasImgDomain;return e.imgSend=function(e,n){var o=new Image(1,1);o.src=r+t+"?"+e,o.onload=function(){o.onload=null,n&&n()}},e}({}),yas_jssdk_1014_src_event=function(e){return e.addEventHandler=function(e,n,t){e.addEventListener?e.addEventListener(n,t,!1):e.attachEvent?e.attachEvent("on"+n,t):e["on"+n]=t},e.removeEventHandler=function(e,n,t){e.removeEventListener?e.removeEventListener(n,t,!1):e.detachEvent?e.detachEvent("on"+n,t):delete e["on"+n]},e}({}),yohojson2_100_json2=function(){"object"!=typeof JSON&&(JSON={}),function(){"use strict";function f(e){return 10>e?"0"+e:e}function this_value(){return this.valueOf()}function quote(e){return rx_escapable.lastIndex=0,rx_escapable.test(e)?'"'+e.replace(rx_escapable,function(e){var n=meta[e];return"string"==typeof n?n:"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+e+'"'}function str(e,n){var t,r,o,a,i,s=gap,u=n[e];switch(u&&"object"==typeof u&&"function"==typeof u.toJSON&&(u=u.toJSON(e)),"function"==typeof rep&&(u=rep.call(n,e,u)),typeof u){case"string":return quote(u);case"number":return isFinite(u)?String(u):"null";case"boolean":case"null":return String(u);case"object":if(!u)return"null";if(gap+=indent,i=[],"[object Array]"===Object.prototype.toString.apply(u)){for(a=u.length,t=0;a>t;t+=1)i[t]=str(t,u)||"null";return o=0===i.length?"[]":gap?"[\n"+gap+i.join(",\n"+gap)+"\n"+s+"]":"["+i.join(",")+"]",gap=s,o}if(rep&&"object"==typeof rep)for(a=rep.length,t=0;a>t;t+=1)"string"==typeof rep[t]&&(r=rep[t],o=str(r,u),o&&i.push(quote(r)+(gap?": ":":")+o));else for(r in u)Object.prototype.hasOwnProperty.call(u,r)&&(o=str(r,u),o&&i.push(quote(r)+(gap?": ":":")+o));return o=0===i.length?"{}":gap?"{\n"+gap+i.join(",\n"+gap)+"\n"+s+"}":"{"+i.join(",")+"}",gap=s,o}}var rx_one=/^[\],:{}\s]*$/,rx_two=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,rx_three=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,rx_four=/(?:^|:|,)(?:\s*\[)+/g,rx_escapable=/[\\\"\u0000-\u001f\u007f-\u009f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,rx_dangerous=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;"function"!=typeof Date.prototype.toJSON&&(Date.prototype.toJSON=function(){return isFinite(this.valueOf())?this.getUTCFullYear()+"-"+f(this.getUTCMonth()+1)+"-"+f(this.getUTCDate())+"T"+f(this.getUTCHours())+":"+f(this.getUTCMinutes())+":"+f(this.getUTCSeconds())+"Z":null},Boolean.prototype.toJSON=this_value,Number.prototype.toJSON=this_value,String.prototype.toJSON=this_value);var gap,indent,meta,rep;"function"!=typeof JSON.stringify&&(meta={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},JSON.stringify=function(e,n,t){var r;if(gap="",indent="","number"==typeof t)for(r=0;t>r;r+=1)indent+=" ";else"string"==typeof t&&(indent=t);if(rep=n,n&&"function"!=typeof n&&("object"!=typeof n||"number"!=typeof n.length))throw new Error("JSON.stringify");return str("",{"":e})}),"function"!=typeof JSON.parse&&(JSON.parse=function(text,reviver){function walk(e,n){var t,r,o=e[n];if(o&&"object"==typeof o)for(t in o)Object.prototype.hasOwnProperty.call(o,t)&&(r=walk(o,t),void 0!==r?o[t]=r:delete o[t]);return reviver.call(e,n,o)}var j;if(text=String(text),rx_dangerous.lastIndex=0,rx_dangerous.test(text)&&(text=text.replace(rx_dangerous,function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)})),rx_one.test(text.replace(rx_two,"@").replace(rx_three,"]").replace(rx_four,"")))return j=eval("("+text+")"),"function"==typeof reviver?walk({"":j},""):j;throw new SyntaxError("JSON.parse")})}()}(),yas_jssdk_1014_src_util=function(e){{var n=yas_jssdk_1014_src_config;n.yaPath,n.yasDomain}return e.flashChecker=function(){var e=0,n=0,t=0,r=null;return t?(r=new ActiveXObject("ShockwaveFlash.ShockwaveFlash"),r&&(e=1,n=r.GetVariable("$version"))):navigator.plugins&&navigator.plugins.length>0&&(r=navigator.plugins["Shockwave Flash"],r&&(e=1,n=r.description.replace("Shockwave Flash",""))),{f:e,v:n}},e.Hash=function(e){var n,t=1,r=0;if(e)for(t=0,n=e.length-1;n>=0;n--)r=e.charCodeAt(n),t=(t<<6&268435455)+r+(r<<14),r=266338304&t,0!==r&&(t^=r>>21);return t},e.Random=function(){return Math.round(2147483647*Math.random())},e.hashClientInfo=function(){var n=window.navigator,t=window.history.length,r=[n.appName,n.version,n.language,n.platform,n.userAgent,n.javaEnabled(),window.screen,window.screen.colorDepth,window.document.cookie?window.document.cookie:"",window.document.referrer?window.document.referrer:""];n=r.join("");for(var o=n.length;t>0;)n+=t--^o++;return e.Hash(n)},e.merge=function(e,n){var t={};for(var r in e)t[r]=e[r];for(var o in n)t[o]=n[o];return t},e.genParam=function(e){var n=[];for(var t in e)n.push(t+"="+e[t]);return n.join("&")},e.trim=function(e){if(String.prototype.trim)return null===e?"":String.prototype.trim.call(e);var n=/^\s+/,t=/\s+$/,r="";return e?(r=e.toString().replace(n,""),r=r.replace(t,"")):void 0},e.getGeo=function(e){function n(n){var t=n.coords.longitude,r=n.coords.latitude;e(r,t)}function t(){e(!1)}if(window.navigator.geolocation){var r={enableHighAccuracy:!0};window.navigator.geolocation.getCurrentPosition(n,t,r)}else e(!1)},e}({}),yas_jssdk_1014_src_cookie=function(e){var n=yas_jssdk_1014_src_util;return e=function(e,t,r){if("undefined"==typeof t){var o=null;if(document.cookie)for(var a=document.cookie.split(";"),i=0;i<a.length;i++){var s=n.trim(a[i]);if(s.substring(0,e.length+1)==e+"="){o=decodeURIComponent(s.substring(e.length+1));break}}return o}r=r||{},null===t&&(t="",r.expires=-1);var u="";if(r.expires&&("number"==typeof r.expires||r.expires.toUTCString)){var c;"number"==typeof r.expires?(c=new Date,c.setTime(c.getTime()+24*r.expires*60*60*1e3)):c=r.expires,u="; expires="+c.toUTCString()}var f=r.path?"; path="+r.path:"",d=r.domain?"; domain="+r.domain:"",l=r.secure?"; secure":"";document.cookie=[e,"=",encodeURIComponent(t),u,f,d,l].join("")}}(),yas_jssdk_1014_src_ya=function(e){function n(e){var n=i.merge(l,g);n=i.merge(n,v);var t=r();t&&(n=i.merge(n,t),s("_yasmp",null,{path:"/",domain:f.yasDomain,expires:73e3}));var o=s("_yascustjson");if(o){var a=JSON.parse(o);n=i.merge(n,a),s("_yascustjson",null,{path:"/",domain:f.yasDomain,expires:73e3})}var c=i.genParam(n);e=e?e:function(){},u.imgSend(c,e);var d=s("_yasev");d&&u.imgSend(d,function(){s("_yasev",null,{path:"/",domain:f.yasDomain,expires:73e3})})}function t(){var e=s("_yasvd");return e?{cid:e,isNew:"N"}:(e=i.Random()^2147483647&i.hashClientInfo(),s("_yasvd",e,{path:"/",domain:d,expires:73e3}),{cid:e,isNew:"Y"})}function r(){var e=s("_yasmp");if(e){var n=e.split(",");if(3===n.length)return{x:n[0],y:n[1],et:n[2]};if(4===n.length)return{x:n[0],y:n[1],et:n[2],ix:n[3]}}return null}function o(e){var n=0,t=0;return e.pageX||e.pageY?(n=e.pageX,t=e.pageY):(e.clientX||e.clientY)&&(n=e.clientX+document.body.scrollLeft+document.documentElement.scrollLeft,t=e.clientY+document.body.scrollTop+document.documentElement.scrollTop),n-=window.screen.width/2,t=window.screen.height/2-t,{x:n,y:t}}function a(e,n,t,r,o){var a=s("_yasev");a?a+="&":a="",s("_yasev",a+"vd="+g.vd+"&t="+e+"&i="+n+"&l="+r+"&v="+o,{path:"/",domain:d,expires:73e3}),m++}var i=yas_jssdk_1014_src_util,s=yas_jssdk_1014_src_cookie,u=yas_jssdk_1014_src_cross,c=yas_jssdk_1014_src_event,f=yas_jssdk_1014_src_config,d=(f.version,f.yaPath,f.yasDomain),l={h:document.domain,p:window.location.port,u:window.location.pathname,ft:0,fst:0,sv:"",ab:s("ab_5")||""},p=t(),g={ak:"",cd:p.cid,vd:(new Date).getTime()+p.cid,ud:"",rf:document.referrer,ckf:p.isNew},_=i.flashChecker(),v={sr:window.screen.width+"x"+window.screen.height,wr:window.screen.availWidth+"x"+window.screen.availHeight,sd:window.screen.colorDepth,ln:window.navigator.language?window.navigator.language:window.navigator.browserLanguage,sy:window.navigator.platform,ce:window.navigator.cookieEnabled,fv:_.f?_.v:0},y=function(e,t,r,a,u,p){if(g.ak=r,l.sv=t,g.ud=a?a:"",s("_yasgeo")){var _=s("_yasgeo").split(",");g.la=_[0],g.lo=_[1],s("_yasgeo",null,{path:"/",domain:f.yasDomain,expires:73e3})}var v=(new Date).getTime(),y=null,m=!1;if(l.ft=v-e,c.addEventHandler(window,"load",function(){var t=(new Date).getTime();l.fst=t-e,c.removeEventHandler(window,"load",arguments.callee),window.clearTimeout(y),m||n()}),y=window.setTimeout(function(){l.fst=0,l.fse=">3s",m=!0,n()},3e3),u&&i.getGeo(function(e,n){e&&s("_yasgeo",e+","+n,{path:"/",domain:d,expires:73e3})}),p[0])for(var h=0,w=p.length;w>h;h++)p[h].setAttribute("yoho_index",h+1);else c.addEventHandler(document,"click",function(e){e=e||window.event;var n=e.target||e.srcElement;if(n&&("A"===n.nodeName||"IMG"===n.nodeName&&"A"===n.parentNode.nodeName)){var t=o(e),r=t.x+","+t.y+","+e.type,a=n.getAttribute("yoho_index")||n.parentNode.getAttribute("yoho_index");a&&(r+=","+a),s("_yasmp",r,{path:"/",domain:d,expires:73e3})}ix=0})},m=0;return y.add=function(e,n,t,r,o){m>3?u.imgSend(s("_yasev"),function(){s("_yasev",null,{path:"/",domain:f.yasDomain,expires:73e3}),m=0,a(e,n,t,r,o)}):a(e,n,t,r,o)},y.sendMouseEvent=function(e,n){e=e||window.event;var t=o(e);if(n){var r={x:t.x,y:t.y,et:e.type},a=i.merge(l,g);a=i.merge(a,v),a=i.merge(a,r);var c=i.genParam(a);u.imgSend(c,function(){})}else s("_yasmp",t.x+","+t.y+","+e.type,{path:"/",domain:d,expires:73e3})},y.sendCustomInfo=function(e,n){if(n){var t=i.merge(l,g);t=i.merge(t,v),t=i.merge(t,e);var r=i.genParam(t);u.imgSend(r,function(){})}else{var o=JSON.stringify(e);s("_yascustjson",o,{path:"/",domain:d,expires:73e3})}},e=y}(),yas_jssdk_1014_yas=function(e){var n=yas_jssdk_1014_src_ya;if(window.YohoAcquisitionObject){var t=window.YohoAcquisitionObject;window[t].p&&(n.apply(this,window[t].p),window[t]=n)}return e=n}()}();
\ No newline at end of file
... ...
... ... @@ -20,7 +20,7 @@
<div class="color-list block-list">
<span>颜色</span>
{{# colors}}
<ul id="{{sizeName}}" data-index="{{@index}}" class="size-row clearfix {{#unless @first}}hide{{/if}}">
<ul id="{{id}}" data-index="{{@index}}" class="size-row clearfix {{#unless @first}}hide{{/if}}">
{{# color}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless colorNum}}zero-stock{{/unless}}" data-num="{{colorNum}}">
{{name}}
... ... @@ -32,9 +32,9 @@
<div class="size-list block-list">
<span>尺码</span>
{{# sizes}}
<ul class="size-row clearfix {{#unless @first}}hide{{/if}}">
<ul id="{{sizeName}}" data-index="{{@index}}" class="size-row clearfix {{#unless @first}}hide{{/if}}">
{{# size}}
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-num="{{sizeNum}}" data-name="{{name}}" data-skuid="{{skuId}}">
<li class="block {{#if chosed}}chosed{{/if}} {{#unless sizeNum}}zero-stock{{/unless}}" data-num="{{sizeNum}}" data-id="{{id}}" data-skuid="{{skuId}}">
{{name}}
</li>
{{/ size}}
... ...
... ... @@ -6,5 +6,6 @@
{{> sale/activity-entry}}
{{> sale/brand-sale}}
{{> sale/sale-box}}
</div>
{{> layout/footer}}
... ...
... ... @@ -171,7 +171,7 @@
<span class="rgb9">08:00-22:30(周一至周日)</span>
&nbsp;&nbsp;
<span>
<a class="red" href="http://chat80.live800.com/live800/chatClient/chatbox.jsp?companyID=493979&amp;configID=123576&amp;jid=9277320930" target="_blank">在线客服</a>
<a class="red" href="http://chat8.live800.com/live800/chatClient/chatbox.jsp?companyID=620092&configID=149091&jid=8732423409" target="_blank">在线客服</a>
</span>
</div>
<div class="right subscribe footer-right">
... ...
... ... @@ -96,7 +96,7 @@
{{#branditems}}
<li class="category-
item thirdnavbar">
<a href="" hot={{hot}}>{{brandname}}</a>
<a href="{{link}}" hot={{hot}}>{{brandname}}</a>
</li>
{{/branditems}}
</ul>
... ...
<div class="activity-entry clearfix">
{{#activityEnter}}
<a class="entry-item pull-left {{#if @first}}first{{/if}} {{#if @last}}last{{/if}}" href="{{link}}">
<img class="icon pull-left" src="{{icon}}">
<span class="icon pull-left {{icon}}"></span>
<div class="entry-text">
<span class="title">{{title}}</span>
<p class="desc">{{desc}}</p>
... ...
... ... @@ -3,8 +3,8 @@
折扣专场 SALE
</div>
{{#brandSale}}
<div class="sale-group-big clearfix">
{{#brandSale}}
{{#big}}
<a class="item pull-left" href="{{link}}">
<div class="pic">
... ... @@ -35,11 +35,7 @@
</div>
</a>
{{/normal}}
{{/brandSale}}
</div>
<div class="sale-group">
</div>
{{/brandSale}}
</div>
... ...
<div class="home-page">
{{#sale-category}}
<div class="floor-header clearfix">
<h2 class="floor-title">{{title}}</h2>
</div>
<ul class="sale-nav">
{{#navItem}}
<li class="{{#vip}}green{{/vip}} {{#incompleteSize}}yellow{{/incompleteSize}} {{#newDiscount}}red{{/newDiscount}} {{#if @first}}active first{{/if}} {{#if @last}}last{{/if}}" data-url='{{url}}'>aa</li>
{{/navItem}}
</ul>
<div class="commodity-list">
<ul class="clearfix">
{{#each saleImage}}
<li class="commodity-item">
<a href="{{href}}" target= "_blank"><div class="commodity-img">
<img class="lazy" data-original="{{img}}"/></div>
<div class="commodity-content {{#if @last}}hide{{/if}}">
<p class="commodity-name">{{name}}</p>
<p class="commodity-price">
<span class="origin">¥{{originPrice}}</span>
<span>¥{{price}}</span>
{{#vip}}<span class="vip-tag">VIP</span><strong>更优惠</strong>{{/vip}}
</p>
</div>
</a>
</li>
{{/each}}
</ul>
</div>
{{/sale-category}}
</div>
... ...
... ... @@ -1080,6 +1080,73 @@ function actionTipPic() {
});
}
function closeCover(){
var $cover = $('#cover');
$cover.remove();
}
/**
* 首次进入有弹窗
* @return {[type]} [description]
*/
function actionCover() {
var gender = cookieMap._Gender;
setCookie('_Channel','boys',{path : '/',domain : '.yohobuy.com',expires : 7});
if(typeof gender == 'undefined' || gender == '' || gender == null){
$.get('http://www.yohobuy.com/index/guide', function(data){
var newMask = document.createElement("div");
newMask.id = 'cover';
newMask.innerHTML=data;
document.body.appendChild(newMask);
var window_height = $(window).height();
var self_height = $('.guide-box').height();
var container_top = window_height / 2 - self_height / 2;
var length=$('.guide-box .clear').find("li").length;
$('.guide-box').css({
width: (200 * length) + 'px',
top: container_top + 'px'
});
$('#cover').bind('click', function(event){
setCookie('_Gender','1,3',{path : '/',domain : '.yohobuy.com',expires : 90});
setCookie('_Channel','boys',{path : '/',domain : '.yohobuy.com',expires : 7});
closeCover();
});
$('#cover .guide-box .close').bind('click', function(event){
getSource('弹窗','CLOSE','homepage_man');
setCookie('_Gender','1,3',{path : '/',domain : '.yohobuy.com',expires : 90});
setCookie('_Channel','boys',{path : '/',domain : '.yohobuy.com',expires : 7});
analy('guide_close');
closeCover();
});
$('.boys img , .boys .go').bind('click', function(event){
getSource('弹窗','BOYS','homepage_man');
setCookie('_Gender','1,3',{path : '/',domain : '.yohobuy.com',expires : 90});
setCookie('_Channel','boys',{path : '/',domain : '.yohobuy.com',expires : 7});
analy( 'guide_boys');
closeCover();
});
$('.girls img, .girls .go').bind('click', function(event){
getSource('弹窗','GIRLS','homepage_woman');
setCookie('_Gender','2,3',{path : '/',domain : '.yohobuy.com',expires : 90});
setCookie('_Channel','girls',{path : '/',domain : '.yohobuy.com',expires : 7});
analy( 'guide_girls');
});
$('.lifestyle img, .lifestyle .go').bind('click', function(event){
setCookie('_Channel','lifestyle',{path : '/',domain : '.yohobuy.com',expires : 7});
getSource('弹窗','LIEFSTYLE','homepage_lifestyle');
analy( 'guide_lifestyle');
});
//防止冒泡事件
$('#cover .guide-box').bind('click', function(event){
event.stopPropagation();
});
});
}
}
/**
* 查询跳转后保留关键字
* @return {[type]} [description]
... ... @@ -1530,7 +1597,7 @@ function actionExeTemplate() {
* @return {[type]} [description]
*/
function actionSearch() {
var searchDomain = 'http://search.yohobuy.com/product/search/suggest';
var searchDomain = 'http://search.yohobuy.com/api/suggest';
$('#query_key').search(searchDomain);
}
... ... @@ -1704,11 +1771,13 @@ function init() {
actionListenDelCarGoods(); //监听购物车删除
actionListenCartMore(); //
actionLoginInfo(); //获取登录信息
actionCover(); //初次登录弹框
}
init();
init();
});
define("js/product/entry", ["jquery","lazyload","handlebars","source-map"], function(require, exports, module){
define("js/product/entry", ["jquery","handlebars","source-map","lazyload"], function(require, exports, module){
/**
* 商品页面打包入口文件
* @auhtor: xuqi<qi.xu@yoho.cn>
... ... @@ -1719,7 +1788,7 @@ require("js/product/list");
require("js/product/hotrank");
});
define("js/product/list", ["jquery","lazyload"], function(require, exports, module){
define("js/product/list", ["jquery","handlebars","source-map","lazyload"], function(require, exports, module){
/**
* 商品列表页
* @author: xuqi<qi.xu@yoho.cn>
... ... @@ -1732,14 +1801,15 @@ require("js/product/sort-pager");
require("js/product/product");
});
define("js/product/filter", ["jquery"], function(require, exports, module){
define("js/product/filter", ["jquery","handlebars","source-map"], function(require, exports, module){
/**
* 商品筛选逻辑
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/12/4
*/
var $ = require("jquery");
var $ = require("jquery"),
Handlebars = require("handlebars");
var checkUnicode = {
unchecked: '&#xe613;',
... ... @@ -1773,6 +1843,13 @@ var $seniorSubWrap = $('.senior-sub-wrap'),
var seniorHoverTime, hoveredIndex;
// 尺寸 handlebars 模板
var sizeTmpl = '{{# size}}<a class="attr {{#if checked}}checked{{/if}}" href="{{href}}">{{name}}</a>{{/ size}}',
sizeCache = {}, // 缓存一下尺寸信息
$sizeWrap = $('.filter-box .size');
sizeTmpl = Handlebars.compile(sizeTmpl);
//清除checkbox选中状态
function clearChecked($checkbox) {
$checkbox.removeClass('checked').html(checkUnicode.unchecked);
... ... @@ -1820,13 +1897,45 @@ $('.filter-box').on('selectstart', '.attr, .brands-index span', function() {
//【分类】
$('.sort-pre').on('click', 'li', function() {
var $this = $(this),
index = $this.index();
index = $this.index(),
id = $this.data('id');
if ($this.hasClass('active')) {
// 选中时,再次点击取消选中
$this.removeClass('active');
$sortSub.children(':eq(' + index + ')').addClass('hide');
$sizeWrap.addClass('hide');
return;
}
$this.siblings('.active').removeClass('active');
$this.addClass('active');
$sortSub.children(':not(.hide)').addClass('hide');
$sortSub.children(':eq(' + index + ')').removeClass('hide');
if (sizeCache[id]) {
$sizeWrap.find('.attr-content').html(sizeCache[id]);
$sizeWrap.removeClass('hide');
} else {
$.ajax({
url: '/product/search/sortSize',
data: {
msort: id
}
}).then(function(res) {
if ($.type(res) === 'array' && res.length) {
sizeCache[id] = sizeTmpl({
size: res
});
$sizeWrap.find('.attr-content').html(sizeCache[id]);
$sizeWrap.removeClass('hide');
} else {
$sizeWrap.addClass('hide');
}
});
}
});
//【品牌】
... ... @@ -1867,10 +1976,17 @@ $brandMore.click(function() {
});
//【品牌】索引
$('.brands-index').on('click', 'span', function() {
$('.brands-index').on('mouseenter', 'span', function() {
var $this = $(this),
index = $this.data('index');
if ($this.hasClass('hover')) {
return;
}
$this.siblings('span.hover').removeClass('hover');
$this.addClass('hover');
if ($this.index() === 0) {
//全部
... ... @@ -2397,7 +2513,7 @@ $('.logo-brand').logoBrand({
'<div class="good-info">' +
'<div class="item-img">' +
'<a class="good-thumb" target="_blank" href="\{{url}}">' +
'<img class="lazy" data-original="\{{img}}">' +
'<img class="lazy" data-original="\{{thumb}}">' +
'</a>' +
'</div>' +
'<div class="good-detail-text">' +
... ... @@ -2479,6 +2595,10 @@ $('.logo-brand').logoBrand({
var nowIndex = $(this).index(),
sid = $(this).data('sid');
if ($(this).hasClass('current')) {
return;
}
//处理current样式
$(this).addClass('current').siblings().removeClass('current');
$('.floatlayer').find('li').removeClass('current').eq(nowIndex).addClass('current');
... ... @@ -2497,7 +2617,11 @@ $('.logo-brand').logoBrand({
$('.floatlayer').on('click', 'li', function() {
var nowIndex = $(this).index();
$('.hot-cate').find('li').trigger('click');
if ($(this).hasClass('current')) {
return;
}
$('.hot-cate').find('li').eq(nowIndex).trigger('click');
//处理current样式
$(this).addClass('current').siblings().removeClass('current');
... ... @@ -4510,6 +4634,18 @@ function pwdFn($obj) {
// Tips: 不可以在获得焦点的时候验证,获得焦点和失去焦点的间隔太小,如果中间存在ajax校验的话会出现问题
// ( ▼-▼ )注册页和信息完善页面接口不同
exports.init = function(page) {
$('#agree-terms').click(function() {
if ($(this).attr('notchecked')) {
console.log(1);
$(this).removeAttr('notchecked');
} else {
console.log(2);
$(this).attr('notchecked', 'true');
}
});
$registerPage.find('.va').keyup(function() {
var j,
... ... @@ -4531,7 +4667,7 @@ exports.init = function(page) {
}
if (statusLen === 4 && $('#agree-terms').is(':checked')) {
if (statusLen === 4 && !$('#agree-terms').attr('notchecked')) {
$registerBtn.removeClass('disable').removeAttr('disabled');
} else {
$registerBtn.addClass('disable').attr('disabled', 'true');
... ... @@ -4608,18 +4744,6 @@ exports.init = function(page) {
});
// 防止粘贴密码
/*$('#pwd, #repwd').keydown(function (event) {
console.log(event.ctrlKey);
console.log(isPwd);
console.log(event.keyCode);
if (event.ctrlKey && isPwd && event.keyCode === 86) {
$(this).val(pwdVal);
}
});*/
$pwd[0].onpaste = function() {
return false;
};
... ... @@ -5288,13 +5412,17 @@ $account.on('keyup', function() {
//密码
$password.on('blur', function() {
validatePassword();
if ($capsLock.hasClass('hide')) {
return;
}
$capsLock.addClass('hide');
}).on('keypress', function(e) {
var code = e.which,
isShift = e.shiftKey || (code === 16) || false;
var code = e.which;
//CapsLock检测
if ((!isShift && (code >= 65 && code <= 90)) ||
(isShift && (code >= 97 && code <= 122))) {
if (code >= 65 && code <= 90) {
$capsLock.removeClass('hide');
return;
}
... ... @@ -5353,7 +5481,7 @@ $('#login-btn').on('click', function() {
if (data.data) {
//防止data.data为undefined时下行语句执行出错而导致脚本不能走到complete去处理authing
location.href = data.data.href;
location.href = data.data.session;
}
} else {
$passwordTip.removeClass('hide').children('em').text(data.message);
... ...
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.
/**
* sale页js打包入口文件
* @author: zhaobiao<bill.zhao@yoho.cn>
* @date: 2016/01/18
*/
require('./index');
... ...
... ... @@ -5,9 +5,15 @@
*/
var $ = require('yoho.jquery'),
$navItem = $('.sale-nav li'),
lazyLoad = require('yoho.lazyload');
require('../common/slider');
lazyLoad($('img.lazy'));
$('.slide-container').slider();
$navItem.on('click', function() {
$(this).siblings('.active').removeClass('active');
$(this).addClass('active');
});
... ...
... ... @@ -248,6 +248,12 @@
.slide-wrapper {
height: 100%;
li {
a {
width: 100%;
}
}
}
.slide-switch {
... ...
... ... @@ -33,9 +33,22 @@
}
.icon {
width: 72px;
height: 72px;
width: 70px;
height: 70px;
margin-left: 48px;
background-repeat: no-repeat;
&.vip {
background-image: image-url('sale/for-vip.png');
}
&.discount {
background-image: image-url('sale/discount.png');
}
&.off-price {
background-image: image-url('sale/off-price.png');
}
}
.title {
... ... @@ -137,4 +150,198 @@
}
}
}
.sale-nav li {
float: left;
width: 20%;
height: 40px;
line-height: 40px;
background-color: #e0e0e0;
text-align: center;
background-color: #f5f5f5;
color: #6d6d6d;
margin-bottom: 10px;
}
.sale-nav li.active {
color: #fff;
background-repeat: no-repeat;
background-size: 100% 100%;
}
.sale-nav li.green.active {
color: #fff;
background-image: image-url('sale/navactive-green-middle.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.sale-nav li.green.first.active {
background-image: image-url('sale/navactive-green-first.png');
}
.sale-nav li.green.last.active {
background-image: image-url('sale/navactive-green-last.png');
}
.sale-nav li.yellow.active {
color: #fff;
background-image: image-url('sale/navactive-yellow-middle.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.sale-nav li.yellow.first.active {
background-image: image-url('sale/navactive-yellow-first.png');
}
.sale-nav li.yellow.last.active {
background-image: image-url('sale/navactive-yellow-last.png');
}
.sale-nav li.red.active {
color: #fff;
background-image: image-url('sale/navactive-red-middle.png');
background-repeat: no-repeat;
background-size: 100% 100%;
}
.sale-nav li.red.first.active {
background-image: image-url('sale/navactive-red-first.png');
}
.sale-nav li.red.last.active {
background-image: image-url('sale/navactive-red-last.png');
}
@media screen and (min-width: 1150px) {
.floor-header {
margin:80px 0 40px
}
.floor-header .header-navs li {
padding: 1px 15px
}
}
.commodity-list ul {
width: 1004px
}
.commodity-item {
float: left;
width: 241px;
margin: 0 10px 0 0
}
.commodity-img {
position: relative;
height: 323px;
text-align: center
}
.commodity-img img {
width: 100%;
height: 100%;
vertical-align: middle
}
.commodity-img .top-tag {
position: absolute;
width: 60px;
height: 60px;
top: 10px;
right: 10px;
line-height: 60px;
background: url('../assets/images/furniture/top-tag-bg.png?1450667948');
font-size: 20px;
color: #fff
}
.commodity-img .few-tag {
position: absolute;
bottom: 0;
width: 100%;
height: 20px;
background: #ffac5b;
color: #fff;
line-height: 20px;
text-align: center;
font-size: 12px
}
.commodity-content {
padding: 10px 0 0 0;
height: 69px;
overflow: hidden
}
.commodity-content .commodity-name {
font-size: 12px;
color: #000;
line-height: 18px;
text-align: center
}
.commodity-content .commodity-price {
position: relative;
margin: 3px 0 0 0;
text-align: center;
line-height: 20px;
color: #000
}
.commodity-content .commodity-price span {
display: inline-block;
*display: inline;
*zoom: 1;
font-size: 12px;
padding: 0 15px;
}
.commodity-content .commodity-price span.origin {
text-decoration: line-through;
}
.commodity-content .commodity-price strong {
font-weight: normal;
color: #565656;
font-size: 13px;
}
.commodity-content .commodity-price span.vip-tag {
background-image: image-url('sale/vip.png');
background-repeat: no-repeat;
background-size: 100% 90%;
color: #fff;
font-style: italic;
margin-right: 5px;
}
.commodity-content .commodity-price .price-sale {
margin-left: 10px;
padding-left: 10px;
width: 36px;
height: 20px;
line-height: 20px;
background: url('../assets/images/furniture/sale-tag-bg.png?1450667948');
color: #fff
}
@media screen and (min-width: 1150px) {
.commodity-list ul {
width:1160px
}
.commodity-item {
width: 280px
}
.commodity-img {
height: 374px
}
.commodity-content {
padding: 14px 0 0 0;
height: 77px
}
}
}
... ...
... ... @@ -345,28 +345,28 @@ class HomeModel
$build = array();
switch (intval($value['channel_id'])) {
case 1:
$build['href'] = Helpers::getFilterUrl($value['url']);
$build['href'] = '/boys';
$build['title'] = '男生';
$build['entitle'] = 'BOYS';
break;
case 2:
$build['href'] = Helpers::getFilterUrl($value['url']);
$build['href'] = '/girls';
$build['title'] = '女生';
$build['entitle'] = 'GIRLS';
break;
case 3:
$build['href'] = Helpers::getFilterUrl($value['url']);
$build['href'] = '/kids';
$build['title'] = '潮童';
$build['entitle'] = 'KIDS';
break;
case 4:
$build['href'] = Helpers::getFilterUrl($value['url']);
$build['href'] = '/lifestyle';
$build['title'] = '创意生活';
$build['entitle'] = 'LIFESTYLE';
break;
case 5:
$result['showYohood'] = true;
$result['yohoodHref'] = Helpers::getFilterUrl($value['url']);
$result['yohoodHref'] = 'http://yohood.cn';
break;
default:
continue;
... ...
... ... @@ -167,6 +167,7 @@ class DetailModel
$colorGroup = array();
$sizeGroup = array();
$goodsGroup = array();
$sizeName = '';
$colorList = array();
$sizeList = array();
$allSizeList = array(); // 所有尺码列表
... ... @@ -195,6 +196,7 @@ class DetailModel
// 商品的尺码列表
$colorStorageGroup[ $value['productSkc'] ] = array();
if (isset($value['goodsSizeBoList'])) {
$sizeName = '';
foreach ($value['goodsSizeBoList'] as $size) {
$sizeList[ $value['productSkc'] ][] = array(
'id' => $size['id'],
... ... @@ -204,12 +206,14 @@ class DetailModel
'name' => $size['sizeName'],
'sizeNum' => $size['goodsSizeStorageNum'],
);
$sizeName = $size['sizeName'];
// 所有尺码列表,赋值用于前端展示默认尺码的时候 判断出没有库存则显示灰色
$allSizeList[ $size['sizeName'] ] = empty($allSizeList[ $size['sizeName'] ]) ? $size['goodsSizeStorageNum'] : $allSizeList[ $size['sizeName'] ];
$allSizeList[$sizeName] = empty($allSizeList[$sizeName]['storage'])
? array('storage' => $size['goodsSizeStorageNum'], 'id' => $size['id'])
: $allSizeList[$sizeName];
$colorStorageNum += intval($size['goodsSizeStorageNum']);
$colorStorageGroup[$value['productSkc']][$size['sizeName']] = $size['goodsSizeStorageNum'];
$colorStorageGroup[ $value['productSkc'] ][$sizeName] = $size['goodsSizeStorageNum'];
}
// 颜色分组
... ... @@ -235,7 +239,8 @@ class DetailModel
// 默认尺码
$sizeGroup[0]['size'][] = array(
'name' => $sizeName, // 尺码名称
'sizeNum' => empty($value) ? false : true, // 是否有库存 (false:表示没有库存,true:表示有库存)
'sizeNum' => empty($value['storage']) ? false : true, // 是否有库存 (false:表示没有库存,true:表示有库存)
'id' => $value['id'],
);
// 各个颜色的尺码, 每行显示一个尺码对应的颜色
... ... @@ -243,7 +248,7 @@ class DetailModel
$colorArr['colorNum'] = isset($colorStorageGroup[ $colorArr['skcId'] ][$sizeName]) ? $colorStorageGroup[ $colorArr['skcId'] ][$sizeName] : 0;
$colorGroup[$i]['color'][] = $colorArr;
}
$colorGroup[$i]['sizeName'] = $sizeName;
$colorGroup[$i]['id'] = $value['id'];
++ $i;
}
... ...
... ... @@ -139,4 +139,24 @@ class CommonController extends WebAction
return $this->helpJsonCallbackResult($callback, 403, '订阅失败', '');
}
}
/**
* 意见反馈
*
* @return jsonp
*/
public function suggestfeedbackAction()
{
$callback = $this->get('callback', '');
$feedback_id = intval($this->get('feedback_id', 0));
$question_id = intval($this->get('question_id', 0));
$answer = trim($this->get('answer'));
$solution = intval($this->get('solution', 0));
if(!empty($feedback_id) || !empty($question_id) || !empty($answer) || !empty($solution)) {
$data = IndexData::suggestFeedback($feedback_id, $question_id, $answer, $solution);
return $this->helpJsonCallbackResult($callback, $data['code'], $data['message'], $data['data']);
} else {
return $this->helpJsonCallbackResult($callback, 403, '意见反馈失败', '');
}
}
}
\ No newline at end of file
... ...
... ... @@ -72,12 +72,15 @@ class PassportModel
$resource = IndexData::getResourceData($code);
if(isset($resource['data'][0]))
{
$val = current($resource['data'][0]['data']);
if($resource['data'][0]['template_name'] == 'single_image') {
$val = current($resource['data'][0]['data']);
} else if($resource['data'][0]['template_name'] == 'single_name_image') {
$val = $resource['data'][0]['data'];
}
$ret['img'] = Images::getImageUrl($val['src'], 252, 190);
$ret['url'] = $val['url'];
}
else
{
else {
$ret['img'] = 'http://img12.static.yhbimg.com/yhb-img01/2015/12/01/07/020a0b6e7ff908d0c2bc4045b4fef42b9f.png?imageView/2/w/252/h/190';
$ret['url'] = '';
}
... ...
... ... @@ -3,8 +3,6 @@ namespace product;
use Plugin\Images;
use Api\Yohobuy;
//use Plugin\Helpers;
//use LibModels\Web\Home\IndexData;
use \LibModels\Web\Product\HotrankData;
use \LibModels\Web\Product\SearchData;
... ... @@ -15,16 +13,18 @@ class HotrankModel {
*/
static public function getSearchData($param,$page,$ajax)
{
// 调用接口查询商品数据
// 调用接口查询商品数据
$result = SearchData::searchElasticByCondition($param);
//print_r($result);
if(!empty($result)){
if(!empty($result))
{
$res = self::getProductList($result,$page,$ajax);
if(!empty($res['popular'])){
if(!empty($res['popular']))
{
$data['popular'] = $res['popular'];
}
if(!empty($res['hotWeek'])){
if(!empty($res['hotWeek']))
{
$data['hotWeek'] = $res['hotWeek'];
}
}
... ... @@ -40,8 +40,10 @@ class HotrankModel {
{
$list = \LibModels\Web\Product\HotrankData::getHotranktag($client_type,$channel,$is_concurrent);
$nav = array();
if(!empty($list['data']['list'])){
foreach($list['data']['list'] as $li=>$lt){
if(!empty($list['data']['list']))
{
foreach($list['data']['list'] as $li=>$lt)
{
$nav[$li]['sid'] = $lt['id'];
$nav[$li]['textCn'] = $lt['tag_name'];
}
... ... @@ -57,57 +59,58 @@ class HotrankModel {
{
// 调用发起请求
Yohobuy::yarConcurrentLoop();
/*----product start---------*/
if(empty($result) || empty($result['data']) || empty($result['data']['product_list'])){
return;
if(empty($result) || empty($result['data']) || empty($result['data']['product_list']))
{
return;
}
$data = $result['data']['product_list'];
$popular = array();
$hotWeek = array();
foreach($data as $key=>$val){
if(empty($val['goods_list'])){
foreach($data as $key=>$val)
{
if(empty($val['goods_list']))
{
continue;
}
$defaultGoodsId = 0;
foreach ($val['goods_list'] as $v){
if($v['is_default'] == 'Y'){
foreach ($val['goods_list'] as $v)
{
if($v['is_default'] == 'Y')
{
$defaultGoodsId = $v['goods_id'];
}
}
if(empty($defaultGoodsId)){
if(empty($defaultGoodsId))
{
$defaultGoodsId = $val['goods_list'][0]['goods_id'];
}
$product_id = empty($val['product_id']) ? '' : $val['product_id'];
$re['url'] = 'http://item.yohobuy.com/product/pro_'.$product_id.'_'.$defaultGoodsId.'.html';
$re['name'] = $val['product_name'];
if($key <= 9 && $page == 1 && $ajax == 0){
$re['rank'] = $key + 1;
if($key <= 5){
$re['price'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
$re['sPrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
$popular['list'][] = $re;
}else{
$re['price'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
$re['sPrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$popular['list'][] = $re;
}
}else if ($ajax == 1){
$re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
$re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
$re['rank'] = '';
if($key <= 9 && $page == 1 && $ajax == 0)
{
//人气单品
$re['rank'] = $key + 1;
$re['href'] = 'http://item.yohobuy.com/product/pro_'.$product_id.'_'.$defaultGoodsId.'.html';
$re['price'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : $val['market_price'];
$re['sPrice'] = empty($val['sales_price']) ? '' : $val['sales_price'];
if($key <= 5)
{
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 378, 504, 2);
$popular['list'][] = $re;
}else{
$re['img'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$hot[] = $re;
}else{
$re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : '¥'.$val['market_price'];
$re['salePrice'] = empty($val['sales_price']) ? '' : '¥'.$val['sales_price'];
$re['rank'] = '';
$re['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$hot[] = $re;
$popular['list'][] = $re;
}
}else{
//一周热卖
$re['url'] = 'http://item.yohobuy.com/product/pro_'.$product_id.'_'.$defaultGoodsId.'.html';
$re['marketPrice'] = (int)$val['market_price'] == (int)$val['sales_price'] ? '' : $val['market_price'];
$re['salePrice'] = empty($val['sales_price']) ? '' : $val['sales_price'];
$re['rank'] = '';
$re['thumb'] = empty($val['default_images']) ? '' : Images::getImageUrl($val['default_images'], 280, 373, 2);
$hot[] = $re;
}
}
$popular['name'] = '人气单品';
... ...
... ... @@ -17,10 +17,6 @@ class LoginController extends WebAction
// 设置登录有效时间30分钟, 防机器刷
$this->setSession('_LOGIN_EXPIRE', time() + 1800);
// 清除客户端
$this->setCookie('_UID', '');
$this->setCookie('_TOKEN', '');
//登录后跳转页面
$refer = empty($_SERVER["HTTP_REFERER"]) ? '' : $_SERVER["HTTP_REFERER"];
if (!empty($refer)) {
... ...
... ... @@ -56,241 +56,36 @@ class IndexController extends WebAction
$this->_view->display('list',$data);
}
public function hotrankAction() {
$data = array(
'hotrankPage' => true,
'hotrank' => array(
array(
'slide' => array(
'list' => array(
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img10.static.yhbimg.com/taobaocms/2015/11/26/12/01c3b99f554ad50d9e5a9900719715c94c.jpg'
),
array(
'href' => '/?gender=1,3',
'img' => 'http://img12.static.yhbimg.com/taobaocms/2015/11/27/09/02a4f1c10e1e81574520e5c0239741a076.jpg'
)
)
)
),
array(
'popular' => array(
'name' => '人气单品',
'list' => array(
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '1'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '2'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '3'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '4'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '5'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '6'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '7'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '8'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '9'
),
array(
'href' => '',
'img' => 'http://img13.static.yhbimg.com/goodsimg/2014/09/16/07/027e03e45e3e88db0adbf6255671546a0b.jpg?imageMogr2/thumbnail/378x504/extent/378x504/background/d2hpdGU=/position/center/quality/90',
'title' => 'YYYOHOOD 黄伟文Wyman X yohood联名商品 圆领卫衣',
'price' => '399',
'sPrice' => '199',
'rank' => '10'
)
)
)
),
array(
'hotBrands' => array(
'name' => '热门品牌',
)
),
array(
'hotWeek' => array(
'name' => '一周热卖',
'nav' => array(
array(
'textCn' => 'TOP100',
'url' => '',
'sid' => 1
),
array(
'textCn' => '上装',
'url' => '',
'sid' => 2
),
array(
'textCn' => '男生测试',
'url' => '',
'sid' => 3
),
array(
'textCn' => '配饰',
'url' => '',
'sid' => 4
)
),
'list' => array(
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
array(
'thumb' => 'http://img13.static.yhbimg.com/goodsimg/2015/11/24/10/020dce58a189f3fbfc071b3d5dc7ccc4e9.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90',
'url' => 'http://item.yohobuy.com/product/pro_294497_377385.html',
'name' => 'MARtube马克图布 暖手宝移动电源萌兔',
'marketPrice' => '109',
'salePrice' => '129'
),
)
)
)
)
);
/**
* 热销排行
*/
public function hotrankAction()
{
//获取频道
$cookie = $this->getCookie('_Channel');
$cookie = 'lifestyle';
$this->channel = isset($cookie) ? $cookie : 'boys';
switch ($this->channel){
case 'boys' :
$this->gender = '1,3';
$this->road = 1;
$this->code = '80d772d8dff25300a2a2e4c97165330c';
break;
case 'girls' :
$this->gender = '2,3';
$this->road = 2;
$this->code = '8df64e505e94edb9881fd1e7efb702e9';
break;
case 'lifestyle' :
$this->gender = '';
$this->road = 4;
$this->code = 'd131aba83a84a6977eee3a7403a713de';
break;
case 'kids' :
$this->gender = '';
$this->road = 3;
$this->code = 'bd6a06a08f8ca9b0db762f78e0bc5b68';
break;
switch ($this->channel)
{
case 'boys' :
$this->gender = '1,3';
$this->road = 1;
$this->code = '80d772d8dff25300a2a2e4c97165330c';
break;
case 'girls' :
$this->gender = '2,3';
$this->road = 2;
$this->code = '8df64e505e94edb9881fd1e7efb702e9';
break;
case 'lifestyle' :
$this->gender = '';
$this->road = 4;
$this->code = 'd131aba83a84a6977eee3a7403a713de';
break;
case 'kids' :
$this->gender = '';
$this->road = 3;
$this->code = 'bd6a06a08f8ca9b0db762f78e0bc5b68';
break;
}
$this->setWebNavHeader(\Index\HomeModel::$this->channel);
... ... @@ -298,6 +93,7 @@ class IndexController extends WebAction
'footerTop'=> true,
'hotrank' => array()
);
//焦点图 热门品牌
$focus = \Index\HomeModel::getChannelResource($this->channel, $this->code);
$data['hotrank']['slide'] = $focus[0]['slide'];
... ... @@ -308,13 +104,15 @@ class IndexController extends WebAction
$sort_id = $this->get('sid',0);
$viewNum = 60;
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'stocknumber'=>1,'status'=>1,'gender'=>$this->gender,'attribute_not'=>2);
if($sort_id != 0){
$param['sort'] = $sort_id;
if($sort_id != 0)
{
$param['sort'] = $sort_id;
}
if($this->road == 3){
$param['msort'] = 365;
if($this->road == 3)
{
$param['msort'] = 365;
}elseif($this->road == 4){
$param['msort'] = 10;
$param['msort'] = 10;
}else{
$param['not_maxSortId'] = '10,365';
}
... ... @@ -352,10 +150,9 @@ class IndexController extends WebAction
$sort = $info['data']['category_id'];
}
}
$viewNum = 60;
//过滤掉赠品
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1,'gender'=>$this->gender,
'attribute_not'=>2);
$viewNum = 60;
$param = array('order'=>'s_n_desc','viewNum'=>$viewNum,'page'=>$page,'sort'=>$sort,'stocknumber'=>1,'status'=>1,
'gender'=>$this->gender,'attribute_not'=>2);
if(empty($param['sort']))
{
if($this->road == 3)
... ... @@ -367,7 +164,7 @@ class IndexController extends WebAction
$param['not_maxSortId'] = '10,365';
}
}
//一周热卖
$list = \product\HotrankModel::getSearchData($param, $page, 1);
$lister = $list['hotWeek']['list'];
$lister = array_values($lister);
... ... @@ -377,12 +174,8 @@ class IndexController extends WebAction
}else{
$lister = array_slice($lister, 0, 50);
}
$data = array(
'code'=>200,
'data'=>$lister,
);
$data = array( 'code'=>200, 'data'=>$lister,);
echo json_encode($data);
exit;
}
}
?>
\ No newline at end of file
}
\ No newline at end of file
... ...
... ... @@ -33,19 +33,19 @@ class Sale1Controller extends WebAction
),
'activityEnter' => array(
array(
'icon' => '',
'icon' => 'vip',
'title' => 'VIP会员专享',
'desc' => 'Only for VIP',
'link' => 'http://www.yohobuy.com'
),
array(
'icon' => '',
'icon' => 'discount',
'title' => '断码区',
'desc' => 'Discount',
'link' => 'http://www.yohobuy.com'
),
array(
'icon' => '',
'icon' => 'off-price',
'title' => '最新降价',
'desc' => 'Off Price',
'link' => 'http://www.yohobuy.com'
... ... @@ -152,47 +152,269 @@ class Sale1Controller extends WebAction
'title' => '2015春夏海量大促!'
)
)
)
);
$this->setWebNavHeader();
$this->_view->display('index', $data);
}
),
'sale-category' => array(
array(
'title' => 'VIP会员专享 ',
'vip' => true,
'navItem' => array(
array(
'name' => '12',
'url' => 'xxx'
),
array(
'name' => '12',
'url' => 'xxx'
),
array(
'name' => '12',
'url' => 'xxx'
),
array(
'name' => '12',
'url' => 'xxx'
),
array(
'name' => '12',
'url' => 'xxx'
),
),
'saleImage'=> array(
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => '短发上课就犯困啦圣诞节',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => '短发上课就犯困啦圣诞节',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => '短发上课就犯困啦圣诞节',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'price' => '888',
'name' => '短发上课就犯困啦圣诞节',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
)
//列表页
public function saleListAction()
{
$data = array(
'saleListPage' => true,
'saleList' => array(
'saleBanner' => array(
'bannerHeight' => 350,
'list' => array(
)
),
array(
'title' => '断码区域',
'incompleteSize' => true,
'navItem' => array(
array(
'name' => '12',
),
array(
'name' => '12',
),
array(
'name' => '12',
),
array(
'name' => '12',
),
array(
'name' => '12',
),
),
'saleImage'=> array(
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'bannerHeight' => 350,
'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg'
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'bannerHeight' => 350,
'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/06/05/02062366574a01418596caa38a773f6beb.jpg?imageView/1/w/1150/h/450'
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'bannerHeight' => 350,
'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/01/06/05/013341a0632177cc3425c3c6082845be57.jpg?imageView/1/w/1150/h/450'
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'bannerHeight' => 350,
'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg'
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'bannerHeight' => 350,
'img' => 'http://img12.static.yhbimg.com/yhb-img01/2016/01/06/05/02062366574a01418596caa38a773f6beb.jpg?imageView/1/w/1150/h/450'
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'bannerHeight' => 350,
'img' => 'http://img11.static.yhbimg.com/yhb-img01/2016/01/06/05/013341a0632177cc3425c3c6082845be57.jpg?imageView/1/w/1150/h/450'
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
)
)
),
array(
'title' => '最新降价',
'newDiscount' => true,
'navItem' => array(
array(
'name' => '12',
),
array(
'name' => '12',
),
array(
'name' => '12',
),
array(
'name' => '12',
),
array(
'name' => '12',
),
),
'saleImage'=> array(
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
),
array(
'href' => 'http://www.yohobuy.com/product/pro_327765_421995/TUCTUC36205TaoZhuang.html?channel=kids',
'img' => "http://img13.static.yhbimg.com/goodsimg/2015/11/05/09/02eb88e527a57d0e26e13f2eb9cc35ad0e.jpg?imageMogr2/thumbnail/280x373/extent/280x373/background/d2hpdGU=/position/center/quality/90",
'name' => 'test',
'price' => '888',
'originPrice' => '1000'
)
)
)
)
);
$this->setWebNavHeader();
$this->_view->display('index', $data);
}
//列表页
public function saleListAction()
{
$data = array(
'saleListPage' => true,
'saleList' => array(
'saleBanner' => array(
'bannerHeight' => 350,
'img' => 'http://img12.static.yhbimg.com/couponImg/2015/12/10/08/02d4c26f19ca2e44359d69d5cff86167fb.jpg'
),
'saleTitle' => array(
'name' => '全部商品',
'count' => 540
... ...