-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommon.php
More file actions
55 lines (48 loc) · 1.53 KB
/
Copy pathcommon.php
File metadata and controls
55 lines (48 loc) · 1.53 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
<?php
/**
处理接口公共业务
*/
require_once('./response.php');
require_once('./db.php');
class Common {
public $params;
public $app;
public function check(){
$this->params['app_id'] = $appId = isset($_POST['app_id']) ? $_POST['app_id'] : '';
$this->params['version_id'] = $versionId = isset($_POST['version_id']) ? $_POST['version_id'] : '';
$this->params['version_mini'] = $versionMini = isset($_POST['version_mini']) ? $_POST['version_mini'] : '';
$this->params['did'] = $did = isset($_POST['did']) ? $_POST['did'] : '';
$this->params['encrypt_did'] = $encryptDid = isset($_POST['encrypt_did']) ? $_POST['encrypt_did'] : '';
if(!is_numeric($appId) || !is_numeric($versionId)) {
return Response::show(401, '参数不合法');
}
//判断app是否需要加密
$this->app = $this->getApp($appId);
if(!$this->app){
return Response::show(402, 'app_id不存在');
}
if ($this->app['is_encryption'] && $encryptDid!=md5($did.$this->app['key'])) {
return Response::show(403, "没有该权限");
}
}
public function getApp($id) {
$sql = "SELECT *
FROM `app`
WHERE id=".$id."
AND status =1
LIMIT 1";
$connect = Db::getInstance()->connect();
$result = mysql_query($sql, $connect);
return mysql_fetch_assoc($result);
}
public function getversionUpgrade($appId) {
$sql = "SELECT *
FROM `version_upgrade`
WHERE app_id=".$appId."
AND status =1
LIMIT 1";
$connect = Db::getInstance()->connect();
$result = mysql_query($sql, $connect);
return mysql_fetch_assoc($result);
}
}