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
<?php
/**
* Created by PhpStorm.
* User: chouchou
* Date: 2020-6-21
* Time: 18:52
*/
namespace app\api\controller\v2\common;
use think\Controller;
use think\Db;
class Project extends Controller
{
public $jzdb;
public function initialize()
{
$this->jzdb = Db::connect([
'type' => config('jz.jztype'),
'hostname' => config('jz.jzhostname'),
'database' => config('jz.jzdatabase'),
'username' => config('jz.jzusername'),
'password' => config('jz.jzpassword'),
'hostport' => config('jz.jzhostport'),
'charset' => config('jz.jzcharset'),
]);
}
public function project_list()
{
$data = request()->get() ?: [];
if(empty($data)){
json([
'code' => 201,
'message' => 'request params not found!',
'data' => ''
]);
}
$res = (new Payment())->commonCheckKey($data['key']);
if ($res !== true) return json([
'code' => 201,
'message' => $res,
'data' => ''
]);
$project_code = $data['project_code'];
if (empty($project_code)) {
return json([
'code' => 202,
'message' => 'Not valid parameter',
]);
}
$map[] = ['project_code', '=', $project_code];
$datalist = $this->jzdb->table('jz_message')->field('project_code,jz_cur_dept')->where($map)->select();
return json([
'code' => 200,
'message' => 'SUCCESS',
'data' => $datalist,
]);
}
}