Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHOBUYWAP
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
郭成尧
9 years ago
Commit
4465dcc77b1cac266c4488f224cc97c53b3f5a15
1 parent
33aa7864
店铺简介图片获取
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
23 deletions
yohobuy/m.yohobuy.com/application/models/Product/List.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
yohobuy/m.yohobuy.com/application/models/Product/List.php
View file @
4465dcc
...
...
@@ -15,7 +15,7 @@ use Plugin\Images;
/**
* 商品列表相关的模板数据模型
*
*
* @name ListModel
* @package models/Product
* @copyright yoho.inc
...
...
@@ -27,7 +27,7 @@ class ListModel
/**
* 获取品类商品列表数据
*
*
* @param array $condition 条件
* @return array | false
*
...
...
@@ -60,8 +60,7 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
1800
);
// 缓存30分钟
}
...
...
@@ -72,7 +71,7 @@ class ListModel
/**
* 获取品牌信息
*
*
* @param int $id 唯一的ID
* @param int $uid 用户ID
* @param string $title 网站标题
...
...
@@ -103,7 +102,7 @@ class ListModel
/**
* 获取品牌商品列表数据
*
*
* @param array $condition 条件参数
* @param string $title 网站标题
* @return array
...
...
@@ -143,8 +142,7 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
1800
);
// 缓存30分钟
}
...
...
@@ -155,7 +153,7 @@ class ListModel
/**
* 根据品牌ID获取品牌LOGO
*
*
* @param int $id 品牌ID
* @param string $title 品牌标题
* @return array | false
...
...
@@ -189,8 +187,7 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
);
// 缓存1小时
}
...
...
@@ -201,7 +198,7 @@ class ListModel
/**
* 根据品牌ID获取品牌LOGO
*
*
* @param int $id 品牌ID
* @param string $title 品牌标题
* @return array | false
...
...
@@ -236,8 +233,7 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
);
// 缓存1小时
}
...
...
@@ -248,7 +244,7 @@ class ListModel
/**
* 获取所有的品牌名称列表
*
*
* @return array(
* 品牌ID => 品牌域名(domain)
* )
...
...
@@ -287,8 +283,7 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
);
}
...
...
@@ -299,7 +294,7 @@ class ListModel
/**
* 获取所有的品牌名称列表
*
*
* @return array(
* 品牌域名(domain) => 品牌名称(name)
* )
...
...
@@ -338,8 +333,7 @@ class ListModel
// 接口调用异常时, 不害怕,从我们的二级缓存(slave)里再取数据.
if
(
empty
(
$result
))
{
$result
=
Cache
::
get
(
$key
,
'slave'
);
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
);
}
...
...
@@ -354,7 +348,7 @@ class ListModel
* @return array 返回的处理好的数据
* @author chengyao.guo
*/
public
static
function
categoryData
(
$data
,
$shop_id
)
public
static
function
categoryData
(
$data
,
$shop_id
)
{
$result
=
array
();
$result
[
'class'
]
=
array
();
...
...
@@ -372,9 +366,18 @@ class ListModel
}
array_push
(
$result
[
'category'
],
array
(
'subcategory'
=>
$item
[
'sub'
]));
}
$result
[
'allproduct'
]
=
Helpers
::
url
(
'/search/list'
,
array
(
'shop'
=>
$shop_id
,
));
return
$result
;
}
public
static
function
introData
(
&
$data
)
{
$data
[
'shop_logo'
]
=
Images
::
getImageUrl
(
$data
[
'shop_logo'
],
640
,
480
);
return
$data
;
}
/**
* 店铺所有品牌信息处理
* @author chengyao.guo
...
...
@@ -382,7 +385,7 @@ class ListModel
* @param $shop_id
* @return mixed
*/
public
static
function
brandData
(
$data
,
$shop_id
)
public
static
function
brandData
(
$data
,
$shop_id
)
{
// 处理图片链接
foreach
(
$data
as
&
$item
)
{
...
...
@@ -395,6 +398,7 @@ class ListModel
}
return
$data
;
}
/**
* 新店铺首页
* @param int $shopId 店铺id
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Index.php
View file @
4465dcc
...
...
@@ -432,7 +432,7 @@ class IndexController extends AbstractAction
$result
=
array
();
$resource
=
ShopData
::
getShopIntro
(
$requestData
[
'shop_id'
]);
if
(
$resource
[
'code'
]
===
200
)
{
$result
=
$resource
[
'data'
]
;
$result
=
ListModel
::
introData
(
$resource
[
'data'
])
;
}
if
(
Mobile
::
isMobile
()){
$this
->
setTitle
(
'店铺简介'
);
...
...
Please
register
or
login
to post a comment