-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththemesrequest.php
93 lines (81 loc) · 2.72 KB
/
themesrequest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/*
* 查询主题列表:
* http: get协议
* ?type=theme&reqNum=20&page=0
* 返回结果
* JSON示例
* {
* "total_number": 300
* "ret_number": 20
* "themes":
* [
* {
* "id": 11488058246,
* “author” : “little”,
* “name”: “圆圆”
* “description”:”这是一个团团圆圆的主题”,
* “them_file_url”: ”../1.theme”,
* "created_at": "20110406174655",
* “main_prev_url”: “http://www.coolshow.com/1.jpg“,
* “prev_img_num”:3,
* “prev_imgs”:
* [
* {“img_url”: “http://www.coolshow.com/1.jpg”},
* {“img_url”:” http://www.coolshow.com/2.jpg”},
* {“img_url”:” http://www.coolshow.com/3.jpg”}
* ]
* },
* ...
*],
*}
*/
//以下部分测试通过
//
require_once 'public/public.php';
if(isset($_GET['page']) && isset($_GET['reqNum'])){
$req_page = (int)(isset($_GET['page'])?$_GET['page']:0);
$req_num = (int)(isset($_GET['reqNum'])?$_GET['reqNum']:10);
$start = $req_num * $req_page;
}else{
$req_page = (int)(isset($_POST['start'])?$_POST['start']:0);
$req_num = (int)(isset($_POST['limit'])?$_POST['limit']:10);
$start = $req_page;
}
if($req_num === null || $req_page === null){
// echo($themesList->getFaultResult(-1));
exit; //错误请求
}
$result = is_numeric($req_num);
if(!$result){
// echo($themesList->getFaultResult(-1));
exit; //错误请求
}
$result = is_numeric($req_page);
if(!$result){
// echo($themesList->getFaultResult(-1));
exit; //错误请求
}
require_once 'configs/config.php';
require_once("tasks/CoolShow/CoolShowSearch.class.php");
$type = (int)(isset($_GET['moduletype'])?$_GET['moduletype']:COOLXIU_TYPE_THEMES);
$coolshow = new CoolShowSearch();
$json_result = $coolshow->getCoolShow($type, $start, $req_num);
echo $json_result;
// require_once 'tasks/statis/ReqStatis.class.php';
// $reqStatis = new ReqStatis();
// $kernel = (int)(isset($_GET['kernelCode']))?$_GET['kernelCode']:1;
// $width = (int)(isset($_GET['width']))?$_GET['width']:480;
// $height = (int)(isset($_GET['height']))?$_GET['height']:800;
// $req_type = (int)(isset($_GET['type'])?$_GET['type']:0);
// $channel = (int)(isset($_GET['chanel'])?$_GET['chanel']:0);
// $vercode = (int)(isset($_GET['versionCode'])?$_GET['versionCode']:0);
// $id = '';
// $cpid = '';
// $url = '';
// $reqStatis->recordRequest($req_type, COOLXIU_TYPE_THEMES, $height, $width, $kernel,
// $id, $cpid, $url, $channel, $vercode);
require_once 'tasks/Records/RecordTask.class.php';
$rt = new RecordTask();
$rt->saveRequest(COOLXIU_TYPE_THEMES);
?>