Authored by 梁志锋

Merge remote-tracking branch 'origin/master'

... ... @@ -22,21 +22,21 @@ class Yohobuy
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
//java API
const API_URL = 'http://api.yoho.yohoops.org/';//
const API_URL2 = 'http://api.yoho.yohoops.org/';//
const SERVICE_URL = 'http://service.yoho.yohoops.org/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://api2.open.yohobuy.com/';
// 支付回调地址
const SERVICE_NOTIFY = 'http://service.yoho.cn/';
const API_URL = 'http://api.yoho.yohoops.org/';//
const API_URL2 = 'http://api.yoho.yohoops.org/';//
const SERVICE_URL = 'http://service.yoho.yohoops.org/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://api2.open.yohobuy.com/';
// 支付回调地址
const SERVICE_NOTIFY = 'http://service.yoho.cn/';
// 测试环境 */
/*const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/'
const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
const YOHOBUY_URL = 'http://www.yohobuy.com/';
const API_OLD = 'http://test2.open.yohobuy.com/';
// 支付回调地址
const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/';*/
// const API_URL = 'http://testapi.yoho.cn:28078/'; // 'http://192.168.102.205:8080/gateway/'
// const SERVICE_URL = 'http://testservice.yoho.cn:28077/';
// const YOHOBUY_URL = 'http://www.yohobuy.com/';
// const API_OLD = 'http://test2.open.yohobuy.com/';
// // 支付回调地址
// const SERVICE_NOTIFY = 'http://testservice.yoho.cn:28077/';
/* 预览环境 */
// const API_URL = 'http://preapi.yoho.cn/';
... ...
... ... @@ -155,9 +155,10 @@ class RegData
* @param string $area 地区号 如"86"
* @param string $mobile 手机号
* @param string $password 登录密码
* @param string $shoppingKey 未登录用户唯一识别码, 默认为空
* @return array
*/
public static function regMobile($area, $mobile, $password)
public static function regMobile($area, $mobile, $password, $shoppingKey = '')
{
$clientType = 'web';
$param = Yohobuy::param();
... ... @@ -166,9 +167,12 @@ class RegData
$param['profile'] = $mobile;
$param['password'] = $password;
$param['client_type'] = $clientType;
if (!empty($shoppingKey)) {
$param['shopping_key'] = $shoppingKey;
}
$param['private_key'] = Yohobuy::$privateKeyList[$clientType];
$param['client_secret'] = Sign::getSign($param);
return Yohobuy::post(Yohobuy::API_URL, $param);
}
}
\ No newline at end of file
... ...
... ... @@ -106,8 +106,9 @@ class Images
/**
* 图片上传
* @param string $name 文件表单name, 即用于$_FILES[$name]
* @param string $path
*/
public static function saveImage($name)
public static function saveImage($name, $path = 'suggest')
{
if (empty($_FILES[$name])) {
return array();
... ... @@ -124,7 +125,7 @@ class Images
$images[$files['name']] = $files['tmp_name'];
}
return self::uploadStreamImage($images);
return self::uploadStreamImage($images, $path);
}
/**
... ... @@ -132,9 +133,10 @@ class Images
*
* @param string | array(filename => absolute file path) $file
* url:http://upload.static.yohobuy.com?project=sns&fileData=xxx
* @param string $path
* @return mixed
*/
public static function uploadStreamImage($file)
public static function uploadStreamImage($file, $path = 'suggest')
{
$end = "\r\n";
$twoHyphens = "--";
... ... @@ -158,7 +160,7 @@ class Images
$stream .= $twoHyphens . $boundary . $end;
$stream .="Content-Disposition: form-data; " . "name=\"project\"" . $end;
$stream .= $end;
$stream .= "suggest"; //project sns
$stream .= $path; //project sns
$stream .= $end;
$stream .= $twoHyphens . $boundary . $twoHyphens . $end;
$opts = array(
... ... @@ -177,14 +179,14 @@ class Images
if (count($file) == 1 || !is_array($file)) {
$imgRelUrl = current($result['data']['imagesList']);
$imgList['imgList'][] = array(
'imgUrl' => self::getSourceUrl($imgRelUrl, 'suggest') . $imgExtra,
'imgUrl' => self::getSourceUrl($imgRelUrl, $path) . $imgExtra,
'imgRelUrl' => $imgRelUrl
);
} else {
$img = array();
foreach ($result['data']['imagesList'] as $val) {
$img = array();
$img['imgUrl'] = self::getSourceUrl($val, 'suggest') . $imgExtra;
$img['imgUrl'] = self::getSourceUrl($val, $path) . $imgExtra;
$img['imgRelUrl'] = $val;
$imgList['imgList'][] = $img;
}
... ...
... ... @@ -173,7 +173,7 @@
{{/each}}
<div class="express-list express-tips">注:配送会由于天气,交通等不可抗拒的客观因素造成您收货时间延迟,请您知悉。
</div>
<div class="express-list hide is-sup"><span class="sf">您所选择的区域暂不在顺派送范围内,</span><a style="text-decoration: none;" target="_blank" href="{{sfUrl}}">点击查看详情</a></div>
<div class="express-list hide is-sup"><span class="sf">您所选择的区域暂不在顺派送范围内,</span><a style="text-decoration: none;" target="_blank" href="{{sfUrl}}">点击查看详情</a></div>
<div class="express-list sf hide">如您购买的商品为航空禁运品顺丰会用陆运的方式给你派送,预计3-5天送达,请您见谅</div>
</div>
</div>
... ...
... ... @@ -479,7 +479,7 @@ class ReturnsModel
// if (!in_array($_FILES['fileData']['type'],$type)) {
// return array('code'=>'400','message'=>'图片格式错误');
// }
$result = Images::saveImage($filename);
$result = Images::saveImage($filename, 'evidenceImages');
}
return $result;
... ...
... ... @@ -18,10 +18,10 @@ class ItemModel
* @var array
*/
private static $multiResources = array();
/**
* 获取商品信息
*
*
* @param string $productId
* @param string $goodsId
* @param string $uid
... ... @@ -29,7 +29,7 @@ class ItemModel
* @param string $productSkn
* @return array
*/
public static function getProductInfo($productId, $goodsId, $uid, $vipLevel = 0, $productSkn = null)
public static function getProductInfo($productId, $goodsId, $uid, $vipLevel = 0, $productSkn = null)
{
$goodsInfo = array();
$statGoodsInfo = array();
... ... @@ -58,12 +58,12 @@ class ItemModel
// 商品标签
$goodsInfo['tags'] = self::getTagsDataByProductInfo($baseInfo);
// 商品促销短语
if (!empty($baseInfo['salesPhrase'])) {
$goodsInfo['saleTip'] = $baseInfo['salesPhrase'];
}
// 商品价格
if (isset($baseInfo['productPriceBo'])) {
$goodsInfo['marketPrice'] = $baseInfo['productPriceBo']['formatMarketPrice'];
... ... @@ -74,12 +74,12 @@ class ItemModel
$goodsInfo['hasOtherPrice'] = false;
}
}
//VIP数据
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel, $uid);
//促销活动banner
$goodsInfo['activity'] = self::getActivityDataByProductBaseInfo($baseInfo);
if (isset($baseInfo['productPriceBo']['yohoCoinNum']) && $baseInfo['productPriceBo']['yohoCoinNum'] !== 0) {
array_push($goodsInfo['activity'],
array('type' => '返YOHO币', 'des' => '每件返 ' . $baseInfo['productPriceBo']['yohoCoinNum'] . '个 YOHO币')
... ... @@ -93,7 +93,7 @@ class ItemModel
unset($goodsInfo['salePrice']);
$goodsInfo['hasOtherPrice'] = false;
}
//商品咨询和评论数据
$consultComment = self::getConsultCommentDataByProductInfo($baseInfo);
// 品牌信息
... ... @@ -106,13 +106,13 @@ class ItemModel
$banner['isCollect'] = $favoriteData['brand'];
}
}
//sku商品信息
$skuData = self::getSkuDataByProductBaseInfo($baseInfo);
$goodsInfo['img'] = $skuData['defaultImage'];
$goodsInfo['colors'] = $skuData['skuGoods'];
$totalStorageNum = $skuData['totalStorageNum'];
// 是否收藏
$goodsInfo['isCollect'] = $favoriteData['product'];
// 限购商品
... ... @@ -124,7 +124,7 @@ class ItemModel
if (isset($baseInfo['showStatus'])) {
$showStatus = intval($baseInfo['showStatus']);
}
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
//潮流尖货状态
$goodsInfo['fashionTopGoods'] = array(
... ... @@ -142,7 +142,7 @@ class ItemModel
$goodsInfo['buyNow'] = $fashTopGoods['buyNow'];//是否立即购买
}
}
$soldOut = $baseInfo['status'] == 0 || $totalStorageNum === 0;
$notForSale = $baseInfo['attribute'] == 2;//非卖品
$virtualGoods = $baseInfo['attribute'] == 3;//虚拟商品
... ... @@ -177,13 +177,13 @@ class ItemModel
if(isset($goodsInfo['tags']['isFew'])) {
unset($goodsInfo['tags']['isFew']);//去掉即将售罄
}
}
}
//分享相关
$goodsInfo['weixinUrl'] = Helpers::url($_SERVER['REQUEST_URI'], array(),'item');
$goodsInfo['sharedTitle'] = $goodsInfo['name'];
$goodsInfo['shareImg'] = $goodsInfo['img'];
$goodsInfo['shareDesc'] = $baseInfo['phrase'];
//统计需要的商品信息
$statGoodsInfo['uid'] = $uid;
$statGoodsInfo['skn'] = $baseInfo['erpProductId'];
... ... @@ -201,11 +201,11 @@ class ItemModel
$domainBrand = BrandsModel::getBrandByDomain($banner['brandDomain']);
if (!empty($domainBrand['type'])) {
switch (intval($domainBrand['type'])) {
case 1:
case 1:
//多品店不显示
$banner = array();
break;
case 2:
case 2:
if (empty($domainBrand['shopId'])) {
break;
}
... ... @@ -224,22 +224,22 @@ class ItemModel
$statGoodsInfo['soldOut'] = intval($soldOut);
return array('goodsInfo'=> $goodsInfo,'consultComment' => $consultComment, 'banner'=> $banner,'statGoodsInfo' => $statGoodsInfo);
}
/**
* 商品尺码信息
*
*
* @param string $productSkn
* @param int $maxSortId
* @return array
*/
public static function getSizeInfo($productSkn, $maxSortId)
public static function getSizeInfo($productSkn, $maxSortId)
{
if (is_numeric($productSkn)) {
//并发资源中是否存在数据
$sizeInfo = self::getMultiDataByResourceName('ItemData::sizeInfo');
if(empty($sizeInfo)) {
//获取尺码
$sizeInfo = ItemData::sizeInfo($productSkn);
$sizeInfo = ItemData::sizeInfo($productSkn);
}
if(empty($sizeInfo)) {
return array();
... ... @@ -265,25 +265,25 @@ class ItemModel
//根据最大分类ID获取尺寸属性
$sizeAttr = self::getSizeAttrByMaxSortId($maxSortId, $sizeInfo['sizeInfoBo']);
}
return array('material'=> $material, 'size'=> $size, 'reference'=> $reference,
return array('material'=> $material, 'size'=> $size, 'reference'=> $reference,
'modelCards'=> $modelCards,'details'=> $details,'fittingReport' =>$fittingReport,
'description'=> $description,'sizeTitleJson' => json_encode($sizeAttr));
}
}
else {
return array();
}
}
/**
* 获取购物车商品信息
*
*
* @param int $productId
* @param int $uid
* @param int $vipLevel
* @return array
*/
public static function getCartProductInfo($productId, $uid, $vipLevel)
public static function getCartProductInfo($productId, $uid, $vipLevel)
{
$goodsInfo = array();
$size = array();
... ... @@ -299,7 +299,7 @@ class ItemModel
if (!empty($baseInfo['salesPhrase'])) {
$goodsInfo['saleTip'] = $baseInfo['salesPhrase'];
}
// 商品价格
if (isset($baseInfo['productPriceBo'])) {
$goodsInfo['marketPrice'] = Helpers::transPrice($baseInfo['productPriceBo']['marketPrice']);
... ... @@ -310,7 +310,7 @@ class ItemModel
$goodsInfo['hasOtherPrice'] = false;
}
}
// 上市期
if (isset($baseInfo['expectArrivalTime']) && !empty($baseInfo['expectArrivalTime'])) {
$goodsInfo['arrivalDate'] = $baseInfo['expectArrivalTime'] . '月';
... ... @@ -318,13 +318,13 @@ class ItemModel
unset($goodsInfo['salePrice']);
$goodsInfo['hasOtherPrice'] = false;
}
//VIP数据
$goodsInfo['vipPrice'] = self::getVipDataByProductBaseInfo($baseInfo, $vipLevel);
//sku商品信息
$skuData = self::getSkuDataByProductBaseInfo($baseInfo);
$totalStorageNum = $skuData['totalStorageNum'];
$goodsInfo['img'] = $skuData['defaultImage'];
$goodsInfo['colors'] = $skuData['skuGoods'];
$favoriteData = FavoriteData::getUidProductFav($uid, $productId);
... ... @@ -334,7 +334,7 @@ class ItemModel
$size = self::getSizeDataBySizeInfo($sizeInfo);
$goodsInfo['size'] = $size;
}
// 限购商品
if ($baseInfo['isLimitBuy'] === 'Y') {
// 是否开售
... ... @@ -344,7 +344,7 @@ class ItemModel
if (isset($baseInfo['showStatus'])) {
$showStatus = intval($baseInfo['showStatus']);
}
$fashTopGoods = self::getFashionTopGoodsStatus($uid, $showStatus, $isBeginSale);
//潮流尖货状态
$goodsInfo['fashionTopGoods'] = array(
... ... @@ -362,7 +362,7 @@ class ItemModel
$goodsInfo['buyNow'] = $fashTopGoods['buyNow'];//是否立即购买
}
}
//商品状态
$soldOut = $baseInfo['status'] == 0 || $totalStorageNum === 0;
$notForSale = $baseInfo['attribute'] == 2;//非卖品
... ... @@ -392,18 +392,18 @@ class ItemModel
unset($goodsInfo['salePrice']);
}
}
}
return $goodsInfo;
}
/**
* 获取分类导航列表
*
*
* @param string $smallSortId
* @return array
*/
public static function getSortNav($smallSortId)
public static function getSortNav($smallSortId)
{
$key = WebCacheConfig::KEY_WEB_ITEM_SORT_DATA.'_'.$smallSortId;
$navs = Cache::get($key);
... ... @@ -427,17 +427,17 @@ class ItemModel
}
return $navs;
}
/**
* 获取咨询列表
*
*
* @param int $uid
* @param int $productId
* @param int $pageNum
* @param int $pageSize
* @return array
*/
public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 30)
public static function getConsults($uid, $productId, $pageNum = 1, $pageSize = 30)
{
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
... ... @@ -461,16 +461,16 @@ class ItemModel
}
return $result;
}
/**
* 获取评论
*
*
* @param int $productId
* @param int $pageNum
* @param int $pageSize
* @return array
* @return array
*/
public static function getComments($productId, $pageNum = 1, $pageSize = 10)
public static function getComments($productId, $pageNum = 1, $pageSize = 10)
{
$result = array();
if (is_numeric($productId) && is_numeric($pageNum) && is_numeric($pageSize)) {
... ... @@ -498,10 +498,10 @@ class ItemModel
}
return $result;
}
/**
* 获取商品活动banner
*
*
* @param int $productId
* @return array
*/
... ... @@ -519,14 +519,14 @@ class ItemModel
}
return $result;
}
/**
* 获取商品热区
*
*
* @param string $productId
* @return array
*/
public static function getProductHotArea($productId)
public static function getProductHotArea($productId)
{
$result = array();
$data = ItemData::getProductHotArea($productId);
... ... @@ -555,6 +555,7 @@ class ItemModel
'href' => Helpers::getUrlBySkc($goods['goodsImagesList'][0]['productId'],
$goods['goodsImagesList'][0]['goodsId'], $val['product']['cnAlphabet']),
);
$point['href'] = $point['product']['href'];
}
}
if(!empty($point)) {
... ... @@ -562,17 +563,17 @@ class ItemModel
}
}
if(!empty($temp)) {
$result[] = $temp;
$result[] = $temp;
}
}
}
}
return $result;
}
/**
* 获取商品模特卡
*
*
* @param string $productId
* @return array
*/
... ... @@ -594,7 +595,7 @@ class ItemModel
}
return $result;
}
/**
* 添加咨询
*
... ... @@ -607,10 +608,10 @@ class ItemModel
{
return ItemData::addConsult($uid, $productId, $content);
}
/**
* 获取商品的舒适度
*
*
* @param int $productId
* @return array
*/
... ... @@ -646,7 +647,7 @@ class ItemModel
}
return $result;
}
/**
* 获取商品的喜欢
* @param int $uid
... ... @@ -672,10 +673,10 @@ class ItemModel
}
return $result;
}
/**
* 根据商品信息设置并发请求
*
*
* @param array $productInfo
*/
private static function setMultiResourceByProductBaseInfo(&$baseInfo)
... ... @@ -698,10 +699,10 @@ class ItemModel
}
self::$multiResources = Yohobuy::getMulti($multiResourcesUrl, array(), false, 5, true);
}
/**
* 根据资源名称获取并发数据
*
*
* @param string $resourceName
* @return array
*/
... ... @@ -713,13 +714,13 @@ class ItemModel
return false;
}
}
/**
* 根据最大分类ID获取尺寸属性
*
*
* @param string $maxSortId
* @param array $sizeList
* @return array
* @return array
*/
private static function getSizeAttrByMaxSortId($maxSortId, array $sizeList)
{
... ... @@ -741,7 +742,7 @@ class ItemModel
foreach($sizeList['sizeAttributeBos'] as $size) {
$attributeNames[$size['id']] = $size['attributeName'];
}
foreach($sizeList['sizeBoList'] as $size) {
$sizeValues = array();
foreach($size['sortAttributes'] as $sort) {
... ... @@ -758,14 +759,14 @@ class ItemModel
}
return $sizeInfos;
}
/**
* 获取尺寸信息
*
*
* @param array $sizeInfo
* @return array
* @return array
*/
private static function getSizeDataBySizeInfo(array &$sizeInfo)
private static function getSizeDataBySizeInfo(array &$sizeInfo)
{
$size = array();
// 尺码信息
... ... @@ -786,7 +787,7 @@ class ItemModel
// 判断是否显示参考尺码
$showReference = ($boyReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['boyReferSize'])) ||
($girlReference && !empty($sizeInfo['sizeInfoBo']['sizeBoList'][0]['girlReferSize']) );
if (!empty($sizeInfo['sizeInfoBo']['sizeAttributeBos'])) {
//尺码信息头部
$size['thead'] = array(0 => array('name' => '吊牌尺码', 'id' => ''));
... ... @@ -809,7 +810,7 @@ class ItemModel
} else {
if(isset($size['thead'][1]) && $showReference) {
$size['thead'][1] = array();
}
}
}
//其他尺码信息
foreach ($value['sortAttributes'] as $attr) {
... ... @@ -825,14 +826,14 @@ class ItemModel
}
}
}
// 测量方式
if (!empty($sizeInfo['sizeImage'])) {
$size['sizeImg'] = $sizeInfo['sizeImage'];
}
return $size;
}
/**
* 使sizeBoList id以 sizeAttributeBos id顺序一样
* @param type array $sizeInfoBo
... ... @@ -843,7 +844,7 @@ class ItemModel
if (empty($sizeInfoBo['sizeBoList']) || empty($sizeInfoBo['sizeAttributeBos'])) {
return array();
}
foreach ($sizeInfoBo['sizeBoList'] as $sizek => $sizeBoList) {
$sortArr = array();
foreach ($sizeBoList['sortAttributes'] as $sortAttributes) {
... ... @@ -851,7 +852,7 @@ class ItemModel
}
$sizeInfoBo['sizeBoList'][$sizek]['sortAttributes'] = $sortArr;
}
foreach ($sizeInfoBo['sizeBoList'] as $sizek => $sizeBoList) {
$sortArr = array();
foreach ($sizeInfoBo['sizeAttributeBos'] as $val) {
... ... @@ -859,17 +860,17 @@ class ItemModel
}
$sizeInfoBo['sizeBoList'][$sizek]['sortAttributes'] = $sortArr;
}
return $sizeInfoBo;
}
/**
* 获取模特数据
*
*
* @param array $sizeInfo
* @return array
* @return array
*/
private static function getReferenceDataBySizeInfo(array &$sizeInfo)
private static function getReferenceDataBySizeInfo(array &$sizeInfo)
{
$reference = array();
if (!empty($sizeInfo['modelBos'])) {
... ... @@ -898,14 +899,14 @@ class ItemModel
}
return $reference;
}
/**
* 获取洗涤材质
*
*
* @param array $sizeInfo
* @return array
*/
private static function getMaterialDataBySizeInfo(array &$sizeInfo)
private static function getMaterialDataBySizeInfo(array &$sizeInfo)
{
$material = array();
//洗涤提示
... ... @@ -915,7 +916,7 @@ class ItemModel
$material['wash'][] = array('name' => $value['caption'],'img' => $value['img']);
}
}
if (!empty($sizeInfo['productMaterialList'])) {
//商品材质[洗涤说明]
$material['materialDetail'] = array();
... ... @@ -930,14 +931,14 @@ class ItemModel
}
return $material;
}
/**
* 获取描述数据
*
*
* @param array $sizeInfo
* @return array
*/
private static function getDescriptionDataBySizeInfo(array &$sizeInfo)
private static function getDescriptionDataBySizeInfo(array &$sizeInfo)
{
$description = array();
// 商品信息
... ... @@ -963,14 +964,14 @@ class ItemModel
}
return $description;
}
/**
* 获取商品详情页介绍
*
*
* @param array $sizeInfo
* @return string
*/
private static function getDetailDataBySizeInfo(array &$sizeInfo)
private static function getDetailDataBySizeInfo(array &$sizeInfo)
{
$details = '';
// 详情配图
... ... @@ -987,14 +988,14 @@ class ItemModel
}
return $details;
}
/**
* 获取sku商品数据
*
*
* @param array $baseInfo
* @return array
* @return array
*/
private static function getSkuDataByProductBaseInfo(array &$baseInfo)
private static function getSkuDataByProductBaseInfo(array &$baseInfo)
{
$totalStorageNum = 0;
$skuGoods = array();//sku商品
... ... @@ -1003,8 +1004,8 @@ class ItemModel
if (!empty($baseInfo['goodsList'])) {
$goodsGroup = array();
foreach ($baseInfo['goodsList'] as $pos => $value) {
// 如果status为0,即skc下架时就跳过该商品$value['status'] === 0
// 如果status为0,即skc下架时就跳过该商品$value['status'] === 0
if (empty($value['colorImage']) ) {
continue;
}
... ... @@ -1020,7 +1021,7 @@ class ItemModel
'thumbs' => array(),
'size' => array(),
);
foreach ($value['goodsImagesList'] as $goods) {
if(!empty($goods['imageUrl'])) {
$goodsGroup['thumbs'][] = array(
... ... @@ -1029,17 +1030,17 @@ class ItemModel
);
}
}
//缩略图空,不显示
if(empty($goodsGroup['thumbs'])) {
continue;
}
//默认第一张图片
if($pos == 0) {
$defaultImage = Images::getImageUrl($value['colorImage'], 420, 560);
}
//商品的尺码列表
foreach ($value['goodsSizeBoList'] as $size) {
if($baseInfo['attribute'] == 3 ) { //虚拟商品,增加为一件
... ... @@ -1057,7 +1058,7 @@ class ItemModel
);
//单个sku商品的总数
$goodsGroup['total'] += intval($size['goodsSizeStorageNum']);
if($goodsGroup['total']> 0 && !$chooseSkuFlag) { //默认选中该sku商品
$goodsGroup['focus'] = true;
$chooseSkuFlag = true;//选中sku商品
... ... @@ -1074,14 +1075,14 @@ class ItemModel
return array('skuGoods' => $skuGoods,'totalStorageNum' => $totalStorageNum,
'defaultImage' => $defaultImage);
}
/**
* 获取品牌数据
*
*
* @param array $baseInfo
* @return array
*/
private static function getBrandDataByProductBaseInfo(array &$baseInfo)
private static function getBrandDataByProductBaseInfo(array &$baseInfo)
{
if(empty($baseInfo['brand'])) {
return array();
... ... @@ -1102,12 +1103,12 @@ class ItemModel
if(!empty($bannerInfo['bannerUrl'])) {
$bgImg = Images::getForceSourceUrl($bannerInfo['bannerUrl']);
}
}
}
//banner的logo
if(!empty($bannerInfo['logo']))
if(!empty($bannerInfo['logo']))
{
$logo = Images::getForceSourceUrl($bannerInfo['logo']);
}
}
$homeUrl = 'javascript:void(0)';
if(!empty($baseInfo['brand']['brandDomain'])){
$homeUrl = Helpers::url('', array(), $baseInfo['brand']['brandDomain']);
... ... @@ -1125,16 +1126,16 @@ class ItemModel
'isCollect'=> false
);
}
/**
* 获取vip数据
*
*
* @param array $baseInfo
* @param int $vipLevel
* @param int $uid
* @return array
*/
private static function getVipDataByProductBaseInfo(array &$baseInfo, $vipLevel = 0, $uid = 0)
private static function getVipDataByProductBaseInfo(array &$baseInfo, $vipLevel = 0, $uid = 0)
{
$vipData = array();
if (!empty($baseInfo['productPriceBo']['vipPrices'])) {
... ... @@ -1162,10 +1163,10 @@ class ItemModel
}
return $vipData;
}
/**
* 获取活动数据(促销相关活动)
*
*
* @param array $baseInfo
* @return array
*/
... ... @@ -1189,10 +1190,10 @@ class ItemModel
}
return $activity;
}
/**
* 获取标签相关数据
*
*
* @param array $baseInfo
* @return array
*/
... ... @@ -1231,12 +1232,12 @@ class ItemModel
}
return $tags;
}
/**
* 获取模特试穿
*
*
* @param string $productSkn
* @return array
* @return array
*/
public static function getProductModelTry($productSkn)
{
... ... @@ -1265,11 +1266,11 @@ class ItemModel
}
return $modelTry;
}
/**
* 处理限购商品的有关按钮状态(或取现购买以及底部商品购买按钮)
*
* @param int $uid
* @param int $uid
* @param int $showStatus 限购商品的关联状态
* @param boolean $isBeginSale 限购商品是否已开售
*/
... ... @@ -1282,8 +1283,8 @@ class ItemModel
//openSoon//即将开售
//dis //失效
//buyNow //是否立即购买
$result = array('getLimitedCode' => false, 'hasLimitedCode' => false,
'limitedCodeSoldOut' => false, 'openSoon' => false, 'dis' => false,
$result = array('getLimitedCode' => false, 'hasLimitedCode' => false,
'limitedCodeSoldOut' => false, 'openSoon' => false, 'dis' => false,
'buyNow' => false, 'soldOut'=> false, 'getLimitedCodeDis'=> false);
// 显示获取限购码按钮
$result['getLimitedCode'] = true;
... ... @@ -1321,14 +1322,14 @@ class ItemModel
$result['hasLimitedCode'] = true;
$result['limitedCodeSoldOut'] = true;
$result['getLimitedCode'] = false;
break;
case 6: // 开售前,即将开售(用户已领取限购码)
$result['openSoon'] = true;
$result['hasLimitedCode'] = true;
if(!empty($uid)) {//限购码失效
$result['getLimitedCodeDis'] = true;
}
}
break;
case 7: // 开售后,用户已经用获得的限购码购买过商品
$result['buyNow'] = true;
... ... @@ -1341,12 +1342,12 @@ class ItemModel
break;
}
return $result;
}
/**
* 获取商品咨询和评论数据
*
*
* @param array $baseInfo
* @return array
*/
... ... @@ -1368,5 +1369,5 @@ class ItemModel
}
return $consultComment;
}
}
\ No newline at end of file
}
... ...
... ... @@ -319,9 +319,9 @@ class RegisterController extends WebAction
$data['message'] = '验证码错误';
break;
}
$shoppingKey = Helpers::getShoppingKeyByCookie();
/* 手机注册: 调用注册接口,ip限制计数 */
$data = RegData::regMobile($area, $mobile, $password);
$data = RegData::regMobile($area, $mobile, $password, $shoppingKey);
Cache::set($ipKey, $ipTimes + 1, 3600);
if (!isset($data['code']) || $data['code'] != 200) {
break;
... ...
... ... @@ -9,7 +9,7 @@ class ItemController extends WebAction
public function indexAction()
{
$this->setWebNavHeader();
$productId = $this->param('productId','');
if (!is_numeric($productId)) {
$this->error();
... ... @@ -39,23 +39,23 @@ class ItemController extends WebAction
$this->setTitle($seo['title'], true, '|');
$this->setKeywords($seo['keywords']);
$this->setDescription($seo['description'], true);
// 除限量商品外, 其余的都往COOKIE里存
if (!isset($productInfo['goodsInfo']['fashionTopGoods'])) {
$this->saveCookie($goodsId, $productInfo['goodsInfo']['skn']);
}
//获取商品尺寸相关
$sizeInfo = ItemModel::getSizeInfo($productInfo['goodsInfo']['skn'], $productInfo['goodsInfo']['maxSortId']);
$data = array('productDetailPage' => true,
'detail'=> array(),
$data = array('productDetailPage' => true,
'detail'=> array(),
'statGoodsInfo'=> array_merge(
array('fullSortName'=> implode('-', $sortNames)),
array('fullSortName'=> implode('-', $sortNames)),
$productInfo['statGoodsInfo']),
);
//导航
$data['detail']['pathNav'] = array_merge(
array(HomeModel::getHomeChannelNav()),
array(HomeModel::getHomeChannelNav()),
$navs,
array(array('name' => $productInfo['goodsInfo']['name']))
);
... ... @@ -63,17 +63,17 @@ class ItemController extends WebAction
$data['detail'] += $productInfo + $sizeInfo;
$this->_view->display('index', $data);
}
/**
* 显示商品信息
*
*
* @param int productId 商品ID
* @param int productSkn 商品SKN
*/
public function showAction()
{
$this->setWebNavHeader();
$productSkn = $this->param('productSkn','');
if (!is_numeric($productSkn)) {
$this->error();
... ... @@ -101,14 +101,14 @@ class ItemController extends WebAction
$this->setDescription($seo['description'], true);
//获取商品尺寸相关
$sizeInfo = ItemModel::getSizeInfo($productInfo['goodsInfo']['skn'], $productInfo['goodsInfo']['maxSortId']);
$data = array('productDetailPage' => true,
$data = array('productDetailPage' => true,
'detail'=> array(),
'statGoodsInfo'=> array_merge(array('fullSortName'=> implode('-', $sortNames)),
'statGoodsInfo'=> array_merge(array('fullSortName'=> implode('-', $sortNames)),
$productInfo['statGoodsInfo']),
);
//导航
$data['detail']['pathNav'] = array_merge(
array(HomeModel::getHomeChannelNav()),
array(HomeModel::getHomeChannelNav()),
$navs,
array(array('name' => $productInfo['goodsInfo']['name']))
);
... ... @@ -121,7 +121,7 @@ class ItemController extends WebAction
/**
* 收藏商品
*
*
* return jsonp
*/
public function togglecollectAction()
... ... @@ -138,7 +138,7 @@ class ItemController extends WebAction
}
} else if($type == 'cancel') {
$result = FavoriteData::delUidProductFav($uid, $productId);
}
}
} else if(empty($uid)) {
$result['code'] = 403;
$result['message'] = '用户没有登录';
... ... @@ -146,7 +146,7 @@ class ItemController extends WebAction
}
$this->echoJson($result);
}
/**
* 获取评论
*/
... ... @@ -163,7 +163,7 @@ class ItemController extends WebAction
)
);
}
/**
* 获取咨询列表
*/
... ... @@ -181,7 +181,7 @@ class ItemController extends WebAction
)
);
}
/**
* 获取热区图
*/
... ... @@ -191,7 +191,7 @@ class ItemController extends WebAction
$data = ItemModel::getProductHotArea($productId);
$this->_view->display('hotarea', array('hotArea'=> $data));
}
/**
* 添加咨询操作
*
... ... @@ -209,7 +209,7 @@ class ItemController extends WebAction
} else if(empty($content)) {
$result['code'] = 400;
$result['message'] = '请输入咨询内容';
}
}
else if(empty($uid)) {
$result['code'] = 403;
$result['message'] = '用户没有登录';
... ... @@ -218,15 +218,15 @@ class ItemController extends WebAction
}
$this->echoJson($result);
}
/**
* 保存商品ID
*
*
* @param string $productId
* @param string $skn
* @param string $goodsId
*/
private function saveCookie($goodsId, $skn)
private function saveCookie($goodsId, $skn)
{
$browseList = $this->getCookie('_browse');
$browseSknList = $this->getCookie('_browseskn');
... ... @@ -261,10 +261,10 @@ class ItemController extends WebAction
$this->setCookie('_browse', $browse, 2000000000);
$this->setCookie('_browseskn', $browseSkn, 2000000000);
}
/**
* 获取seo信息
*
*
* @param array $goodsInfo
* @param array $navs
* @return array
... ... @@ -289,4 +289,4 @@ class ItemController extends WebAction
$description = empty($goodsInfo['shareDesc']) ? $goodsInfo['name'] : $goodsInfo['shareDesc'];
return array('title' => $title, 'keywords'=> $keywords, 'description' =>$description);
}
}
\ No newline at end of file
}
... ...