Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
YOHO-ACTIVITY-PHP
·
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
hf
9 years ago
Commit
f1813c1df8122b016c9b6904b4da2f1c9c31b3a5
1 parent
9e0e3c4b
fixes bug refs YW-982 YW-976 YW-958
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
48 additions
and
27 deletions
library/Action/AbstractAction.php
library/LibModels/Wap/Category/FocusData.php
library/LibModels/Wap/Guang/PlusstarData.php
library/LibModels/Wap/Product/BrandData.php
library/Plugin/Helpers.php
yohobuy/m.yohobuy.com/application/models/Index/Home.php
yohobuy/m.yohobuy.com/application/models/Index/Side.php
yohobuy/m.yohobuy.com/application/models/Product/List.php
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Opt.php
library/Action/AbstractAction.php
View file @
f1813c1
...
...
@@ -100,6 +100,18 @@ class AbstractAction extends Controller_Abstract
{
return
$this
->
_request
->
getParam
(
$key
,
$default
);
}
/**
* 封装一下获取服务器的参数
*
* @param String $key
* @param mixed $default
* @return mixed
*/
protected
function
server
(
$key
,
$default
=
null
)
{
return
$this
->
_request
->
getServer
(
$key
,
$default
);
}
/**
* 关闭模板自动渲染
...
...
library/LibModels/Wap/Category/FocusData.php
View file @
f1813c1
<?php
namespace
LibModels\Wap\Category
;
use
Api\Yohobuy
;
...
...
@@ -15,26 +16,28 @@ use Api\Sign;
*/
class
FocusData
{
/**
* 获取关注数据
*
* @param integ $uid 用户ID
* @param string $gender 性别
* @param integer $limit 读取数目限制,默认为10
* @param integer $page 读取分页限制,默认为1
* @return array 关注数据
*/
/**
* 获取关注数据
*
* @param integ $uid 用户ID
* @param string $gender 性别
* @param integer $limit 读取数目限制,默认为10
* @param integer $page 读取分页限制,默认为1
* @return array 关注数据
*/
public
static
function
getFocusData
(
$uid
,
$gender
,
$limit
=
10
,
$page
=
1
)
{
// 构建必传参数
$param
=
Yohobuy
::
param
();
$param
[
'uid'
]
=
$uid
;
$param
[
'gender'
]
=
$gender
;
$param
[
'limit'
]
=
$limit
;
$param
[
'page'
]
=
$page
;
// 构建必传参数
$param
=
Yohobuy
::
param
();
$param
[
'uid'
]
=
$uid
;
$param
[
'gender'
]
=
$gender
;
$param
[
'limit'
]
=
$limit
;
$param
[
'page'
]
=
$page
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
'guang/api/v1/attention/getlist'
,
$param
);
return
Yohobuy
::
get
(
Yohobuy
::
SERVICE_URL
.
'guang/api/v1/attention/getlist'
,
$param
);
}
}
...
...
library/LibModels/Wap/Guang/PlusstarData.php
View file @
f1813c1
...
...
@@ -58,7 +58,7 @@ class PlusstarData
$build
[
'client_secret'
]
=
Sign
::
getSign
(
$build
);
$urlList
[
'all'
]
=
Yohobuy
::
httpBuildQuery
(
$url
,
$build
);
return
Yohobuy
::
getMulti
(
$urlList
);
return
Yohobuy
::
getMulti
(
$urlList
,
array
(),
1800
);
// 缓存30分钟
}
/**
...
...
@@ -96,7 +96,7 @@ class PlusstarData
$original
[
'client_secret'
]
=
Sign
::
getSign
(
$original
);
$urlList
[
'original'
]
=
Yohobuy
::
httpBuildQuery
(
$url
,
$original
);
return
Yohobuy
::
getMulti
(
$urlList
);
return
Yohobuy
::
getMulti
(
$urlList
,
array
(),
1800
);
// 缓存30分钟
}
/**
...
...
library/LibModels/Wap/Product/BrandData.php
View file @
f1813c1
...
...
@@ -33,7 +33,7 @@ class BrandData
$param
[
'type'
]
=
'brand'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
,
true
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
);
}
/**
...
...
@@ -52,7 +52,7 @@ class BrandData
$param
[
'type'
]
=
'brand'
;
$param
[
'client_secret'
]
=
Sign
::
getSign
(
$param
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
,
true
);
return
Yohobuy
::
post
(
Yohobuy
::
API_URL
,
$param
);
}
}
...
...
library/Plugin/Helpers.php
View file @
f1813c1
...
...
@@ -33,7 +33,7 @@ class Helpers
$url
=
'http://search'
.
SUB_DOMAIN
;
break
;
case
'index'
:
// 默认
$url
=
''
;
$url
=
SITE_MAIN
;
break
;
default
:
// 其它子域名
$url
=
'http://'
.
$module
.
SUB_DOMAIN
;
...
...
yohobuy/m.yohobuy.com/application/models/Index/Home.php
View file @
f1813c1
...
...
@@ -160,7 +160,7 @@ class HomeModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$cache
,
$result
);
Cache
::
set
(
$cache
,
$result
);
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Index/Side.php
View file @
f1813c1
...
...
@@ -59,7 +59,7 @@ class SideModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
CacheConfig
::
KEY_COMMON_SIDE_NAV
,
$result
,
3600
);
// 缓存1小时
Cache
::
set
(
CacheConfig
::
KEY_COMMON_SIDE_NAV
,
$result
);
}
}
...
...
yohobuy/m.yohobuy.com/application/models/Product/List.php
View file @
f1813c1
...
...
@@ -57,7 +57,7 @@ class ListModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
600
);
// 缓存1
0分钟
Cache
::
set
(
$key
,
$result
,
1800
);
// 缓存3
0分钟
}
}
...
...
@@ -140,7 +140,7 @@ class ListModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
600
);
// 缓存1
0分钟
Cache
::
set
(
$key
,
$result
,
1800
);
// 缓存3
0分钟
}
}
...
...
@@ -186,7 +186,7 @@ class ListModel
}
// 接口调用正常,数据封装完成, 则设置一级(master)和二级(slave)数据缓存
else
{
Cache
::
set
(
$key
,
$result
,
10800
);
// 缓存3
小时
Cache
::
set
(
$key
,
$result
);
// 缓存1
小时
}
}
...
...
yohobuy/m.yohobuy.com/application/modules/Product/controllers/Opt.php
View file @
f1813c1
...
...
@@ -2,6 +2,7 @@
use
Action\AbstractAction
;
use
LibModels\Wap\Product\BrandData
;
use
Plugin\Helpers
;
/**
* 商品操作相关的控制器
...
...
@@ -56,6 +57,11 @@ class OptController extends AbstractAction
}
while
(
false
);
if
(
isset
(
$result
[
'code'
])
&&
$result
[
'code'
]
==
412
)
{
$referer
=
$this
->
server
(
'HTTP_REFERER'
,
SITE_MAIN
);
$result
[
'data'
]
=
Helpers
::
url
(
'/signin.html'
,
array
(
'refer'
=>
$referer
));
}
$this
->
echoJson
(
$result
);
}
...
...
Please
register
or
login
to post a comment