-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfontlist.php
More file actions
74 lines (64 loc) · 1.58 KB
/
fontlist.php
File metadata and controls
74 lines (64 loc) · 1.58 KB
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
<?php
/*
* 查询字体列表:
* http: get协议
* page=0&reqNum=10
* reqNum为我这边一次请求的数量,page为请求页,reqTpye为请求类型,目前暂做两类,
* 一类为来电铃声reqType=0,一类为通知铃声reqType=1;
* 返回结果
* JSON示例
* {
* "total_number": 300
* "ret_number": 20
* "fonts":
* [
* {
* "id": 11488058246,
* “name” : “little”,
* “url”: ”../1.wp”,
* "size": 520,
* },
* ...
*],
*}
*/
session_start();
require_once 'configs/config.php';
require_once 'public/public.php';
try{
if(isset($_GET['page']) && isset($_GET['reqNum'])){
$page = 0;//$_GET['page'];
$limit = 100;//$_GET['reqNum'];
$start = $page + $limit * $page;
}else{
$page = (int)(isset($_POST['start'])?$_POST['start']:0);
$limit = (int)(isset($_POST['limit'])?$_POST['limit']:100);
$start = $page;
}
$language = isset($_GET['language'])?$_GET['language']:'ch';
if($limit == null || $page === null){
echo(getFaultResult(-1));
exit;
}
$result = is_numeric($limit);
if(!$result){
Log::write("font::limit is not numeral", "log");
echo(getFaultResult(-1));
exit;
}
$result = is_numeric($page);
if(!$result){
Log::write("font::page is not numeral", "log");
echo(getFaultResult(-1));
exit;
}
require_once 'tasks/Font/FontDb.class.php';
$font_db = new FontDb();
$json_result = $font_db->searchAllFont($start, $limit);
echo $json_result;
}catch(Exception $e){
Log::write("ring::Exception Error:".$e->getMessage(), "log");
echo(getFaultResult(-1));
exit;
}
?>