-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paththdownload.php
More file actions
71 lines (61 loc) · 2.22 KB
/
thdownload.php
File metadata and controls
71 lines (61 loc) · 2.22 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
<?php
try{
require_once 'lib/WriteLog.lib.php';
require_once 'public/public.php';
require_once 'configs/config.php';
$id = isset($_GET['id'])?$_GET['id']:'';
$cpid = isset($_GET['cpid'])?$_GET['cpid']:'';
if(empty($id)){
Log::write('thdownload:ID is empty', 'log');
exit;
}
$strProduct = '';
$strImsi = '';
$strMeid = '';
$protocolCode = 0;
if(isset($_POST['statis'])){
$json_param = isset($_POST['statis'])?$_POST['statis']:'';
$json_param = stripslashes($json_param);
$arr_param = json_decode($json_param, true);
$strProduct = isset($arr_param['product'])?$arr_param['product']:'';
$strImsi = isset($arr_param['imsi'])?$arr_param['imsi']:'';
$strMeid = isset($arr_param['meid'])?$arr_param['meid']:'';
$strCyid = isset($arr_param['cyid'])?$arr_param['cyid']:'';
$protocolCode = (int)(isset($arr_param['protocolCode'])?$arr_param['protocolCode']:0);
}
require_once("tasks/CoolShow/CoolShowSearch.class.php");
//下面两个数据库操作可以合并优化
$coolshow = new CoolShowSearch();
$bIsCharge = $coolshow->checkIscharge(COOLXIU_TYPE_THEMES, $id);
if($bIsCharge){
require_once 'tasks/Exorder/ExorderRecordDb.class.php';
$erDb = new ExorderRecordDb();
$bResult = $erDb->checkMobileCharged($strProduct, COOLXIU_TYPE_THEMES, $id, $cpid, $strMeid, $strImsi, $strCyid);
if(!$bResult){
$result = get_rsp_result(false, 'the resource is not paid');
exit($result);
}
}
$url = $coolshow->getUrl(COOLXIU_TYPE_THEMES, $id);
if($url === false){
Log::write('CoolShowSearch::getUrl(COOLXIU_TYPE_THEMES) id:'.$id, 'log');
exit;
}
url_skip_download($url);
if($protocolCode >= 1){
Log::write('thdownload protocolcode = '.$protocolCode, 'debug');
exit;
}
// require_once 'tasks/statis/ReqStatis.class.php';
// $reqStatis = new ReqStatis();
// $type = (int)(isset($_GET['type'])?$_GET['type']:0);
// $channel = (int)(isset($_GET['channel'])?$_GET['channel']:0);
//
// $reqStatis->recordDownloadRequest($id, COOLXIU_TYPE_THEMES, 0, 0, $cpid, $url, $type, $channel);
require_once 'tasks/Records/RecordTask.class.php';
$rt = new RecordTask();
$rt->saveDownload(COOLXIU_TYPE_THEMES);
}catch(Exception $e){
Log::write('thdownload:: exception error:'.$e->getMessage(), 'log');
exit;
}