Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
ylc.llewan.com
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
llewan
ylc.llewan.com
Commits
0cbe5366
Commit
0cbe5366
authored
Oct 09, 2018
by
734642908@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加广告和游戏主题缓存
parent
b7225da1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
101 additions
and
19 deletions
+101
-19
AdController.class.php
Application/Home/Controller/AdController.class.php
+28
-8
FlushController.class.php
Application/Home/Controller/FlushController.class.php
+33
-0
GameController.class.php
Application/Home/Controller/GameController.class.php
+40
-11
No files found.
Application/Home/Controller/AdController.class.php
View file @
0cbe5366
...
...
@@ -19,15 +19,35 @@ class AdController extends BaseController
,
'msg'
=>
'type参数不存在'
);
}
else
{
$redis
=
S
(
C
(
'REDIS'
));
$id
=
$redis
->
ZREVRANGE
(
'ylc_ad_id'
,
0
,
-
1
);
foreach
(
$id
as
$key
=>
$val
)
{
$arr
=
json_decode
(
$redis
->
hget
(
'ylc_ad_list'
,
$val
),
true
);
$startTime
=
$arr
[
'start_time'
]
<
date
(
'Y-m-d H:i:s'
);
$endTime
=
$arr
[
'end_time'
]
==
null
||
$arr
[
'end_time'
]
>
date
(
'Y-m-d H:i:s'
);
$whereArr
=
array
(
'type'
=>
$type
,
'status'
=>
1
,
'start_time'
=>
array
(
'lt'
,
date
(
'Y-m-d H:i:s'
))
);
$whereArr
[
'_string'
]
=
'end_time is null or end_time > "'
.
date
(
'Y-m-d H:i:s'
)
.
'"'
;
$field
=
'sysid as id,platform,name,img,appid,gourl,position,type'
;
$adArr
=
M
(
"yl_ad"
,
""
,
C
(
"LEWAN_HEZI"
))
->
where
(
$whereArr
)
->
field
(
$field
)
->
order
(
'position'
)
->
select
();
if
(
$arr
[
'status'
]
==
1
&&
$arr
[
'type'
]
==
$type
&&
$startTime
&&
$endTime
)
{
$adArr
[]
=
array
(
'id'
=>
$arr
[
'sysid'
]
,
'platform'
=>
$arr
[
'platform'
]
,
'name'
=>
$arr
[
'name'
]
,
'img'
=>
$arr
[
'img'
]
,
'appid'
=>
$arr
[
'appid'
]
,
'gourl'
=>
$arr
[
'gourl'
]
,
'position'
=>
$arr
[
'position'
]
,
'type'
=>
$arr
[
'type'
]
);
}
}
// $whereArr = array(
// 'type'=>$type
// ,'status'=>1
// ,'start_time'=>array('lt',date('Y-m-d H:i:s'))
// );
// $whereArr['_string'] = 'end_time is null or end_time > "'.date('Y-m-d H:i:s').'"';
// $field = 'sysid as id,platform,name,img,appid,gourl,position,type';
// $adArr = M("yl_ad","",C("LEWAN_HEZI"))->where($whereArr)->field($field)->order('position')->select();
if
(
!
empty
(
$adArr
))
{
$result
=
array
(
'c'
=>
1
...
...
Application/Home/Controller/FlushController.class.php
0 → 100644
View file @
0cbe5366
<?php
namespace
Home\Controller
;
use
Think\Controller
;
/*
* 刷新redis数据控制器
*
*/
class
FlushController
extends
BaseController
{
//刷新广告数据
public
function
ad
()
{
$adArr
=
M
(
"yl_ad"
,
""
,
C
(
"LEWAN_HEZI"
))
->
order
(
'position'
)
->
select
();
if
(
!
empty
(
$adArr
))
{
$redis
=
S
(
C
(
'REDIS'
));
foreach
(
$adArr
as
$key
=>
$val
)
{
//保存广告id(用于排序分页)
$redis
->
zadd
(
'ylc_ad_id'
,
$val
[
'position'
],
$val
[
'sysid'
]);
//保存广告数据
$redis
->
hset
(
'ylc_ad_list'
,
$val
[
'sysid'
],
json_encode
(
$val
));
}
exit
(
'更新成功'
);
}
else
{
exit
(
'暂无数据'
);
}
}
}
?>
\ No newline at end of file
Application/Home/Controller/GameController.class.php
View file @
0cbe5366
...
...
@@ -162,19 +162,22 @@ class GameController extends BaseController
//主题列表
public
function
themeList
()
{
$gameTheme
=
M
(
"yl_game_theme"
,
""
,
C
(
"LEWAN_HEZI"
))
->
where
(
array
(
'status'
=>
1
))
->
field
(
'sysid as id,name,game_list'
)
->
order
(
'sort desc'
)
->
select
();
if
(
!
empty
(
$gameTheme
))
{
$gameField
=
'sysid as id,name,icon,appid,gourl'
;
foreach
(
$gameTheme
as
$key
=>
$val
)
{
$gameId
=
explode
(
','
,
$val
[
'game_list'
]);
if
(
!
empty
(
$gameId
))
{
$redis
=
S
(
C
(
'REDIS'
));
$id
=
$redis
->
ZREVRANGE
(
'ylc_gametheme_id'
,
0
,
-
1
);
$gameTheme
[
$key
][
'game_list'
]
=
M
(
"yl_game"
,
""
,
C
(
"LEWAN_HEZI"
))
->
where
(
array
(
'status'
=>
1
,
'sysid'
=>
array
(
'in'
,
$gameId
)))
->
field
(
$gameField
)
->
order
(
'field(sysid, '
.
$val
[
'game_list'
]
.
')'
)
->
select
();
}
else
{
$gameTheme
[
$key
][
'game_list'
]
=
array
();
}
foreach
(
$id
as
$key
=>
$val
)
{
$arr
=
json_decode
(
$redis
->
hget
(
'ylc_gametheme_list'
,
$val
),
true
);
if
(
$arr
[
'status'
]
==
1
)
{
$gameTheme
[]
=
array
(
'id'
=>
$arr
[
'sysid'
]
,
'name'
=>
$arr
[
'name'
]
,
'game_list'
=>
$arr
[
'gameList'
]
);
}
}
if
(
!
empty
(
$gameTheme
))
{
$result
=
array
(
'c'
=>
1
,
'msg'
=>
'获取成功'
...
...
@@ -189,6 +192,32 @@ class GameController extends BaseController
);
}
// $gameTheme = M("yl_game_theme","",C("LEWAN_HEZI"))->where(array('status'=>1))->field('sysid as id,name,game_list')->order('sort desc')->select();
// if(!empty($gameTheme)) {
// $gameField = 'sysid as id,name,icon,appid,gourl';
// foreach($gameTheme as $key=>$val) {
// $gameId = explode(',',$val['game_list']);
// if(!empty($gameId)) {
// $gameTheme[$key]['game_list'] = M("yl_game","",C("LEWAN_HEZI"))->where(array('status'=>1,'sysid'=>array('in',$gameId)))->field($gameField)->order('field(sysid, '.$val['game_list'].')')->select();
// } else {
// $gameTheme[$key]['game_list'] = array();
// }
// }
// $result = array(
// 'c'=>1
// ,'msg'=>'获取成功'
// ,'d'=>array(
// 'themeList'=>$gameTheme
// )
// );
// } else {
// $result = array(
// 'c'=>2
// ,'msg'=>'暂无数据'
// );
// }
echo
$this
->
formatRes
(
$result
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment