/
test.php
82 lines (80 loc) · 1.97 KB
/
test.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
<?php
/*!
* qwp: https://github.com/steem/qwp
*
* Copyright (c) 2015 Steem
* Released under the MIT license
*/
define('QWP_ROOT', dirname(__FILE__));
require_once(QWP_ROOT . '/config.php');
require_once(QWP_ROUTER_ROOT . '/required.php');
//$_GET['m'] = 'sample';
$_GET['m'] = 'passport';
$_GET['op'] = 'logout';
//$_GET['p'] = 'form';
/*$_POST['f'] = array(
'user' => 'admin@qwp.com',
'pwd' => '111111',
);*/
$test = array(
array(
'table' => 'u',
array('account', 'Account', 100),
array('name', 'Name', 100),
'id,create_time',
'last_login_time',
),
array(
'table' => 'r',
array('name', 'Role', 100),
),
array(
'table' => 'u',
array('phone', 'Phone', 100),
array('age', 'Age', 60),
),
'alias' => array(
'r.name' => 'role_name',
)
);
qwp_db_get_fields_from_modal($test, $fields);
qwp_db_get_table_header_from_modal($test, $header);
$options = array(
'data modal' => $test,
'left join' => array(
array('qwp_role', 'r', 'r.id=u.role')
),
'default order' => array('id', array('role', 'desc')),
'search condition' => array(
'values' => array(
'role' => '1',
'account' => 'te',
'u.name' => 'Test',
'age' => array(18, 32),
'phone' => '111'
),
'condition' => array(
'fields' => array(
'role' => '<>',
'u.name' => 'like',
),
'condition' => array(
'op' => 'or',
'fields' => array(
'phone' => 'like',
'account' => 'like',
),
)
),
),
'fields alias' => array(
'r.name' => 'role_name',
),
);
qwp_db_retrieve_data(array('qwp_user', 'u'), $data, $options);
print_r($data);
$option = array(
'where' => 'id<>1'
);
qwp_db_get_data('qwp_role', $data, 'id,name', $option);
print_r($data);