@oxiaom/adoremix-linux-arm 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/native/etc/docroot/bangzhu/css/app.css +5 -5
- package/native/etc/docroot/bangzhu/css/feedback.css +7 -7
- package/native/etc/docroot/bangzhu/css/mui.dtpicker.css +1 -1
- package/native/etc/docroot/bangzhu/css/mui.picker.all.css +4 -4
- package/native/etc/docroot/bangzhu/css/mui.picker.min.css +6 -6
- package/native/etc/docroot/bangzhu/css/mui.poppicker.css +3 -3
- package/native/etc/docroot/bangzhu/examples/actionsheet-plus.html +20 -20
- package/native/etc/docroot/bangzhu/examples/actionsheet.html +6 -6
- package/native/etc/docroot/bangzhu/examples/best-practices/list-to-detail/detail.html +3 -3
- package/native/etc/docroot/bangzhu/examples/card.html +24 -24
- package/native/etc/docroot/bangzhu/examples/im-chat.html +5 -5
- package/native/etc/docroot/bangzhu/examples/media-list.html +49 -49
- package/native/etc/docroot/bangzhu/examples/message-bottom.html +2 -2
- package/native/etc/docroot/bangzhu/examples/offcanvas-drag-left-plus-main.html +13 -13
- package/native/etc/docroot/bangzhu/examples/picker.html +2 -2
- package/native/etc/docroot/bangzhu/examples/popovers.html +12 -12
- package/native/etc/docroot/bangzhu/examples/pullrefresh_sub.html +11 -11
- package/native/etc/docroot/bangzhu/examples/slider-default.html +18 -18
- package/native/etc/docroot/bangzhu/examples/tab-webview-subpage-setting.html +3 -3
- package/native/etc/docroot/bangzhu/index.html +413 -413
- package/native/etc/docroot/bangzhu/js/mui.picker.min.js +6 -6
- package/native/etc/docroot/bangzhu/manifest.json +993 -993
- package/native/etc/docroot/luyin2/index.html +144 -144
- package/native/etc/docroot/luyin2/js/jquery-1.10.1.min.js +5 -5
- package/native/etc/docroot/luyin2/js/lame.min.js +307 -307
- package/native/etc/docroot/luyin2/js/recordmp3.js +239 -239
- package/native/etc/docroot/luyin2/js/worker-realtime.js +105 -105
- package/native/etc/docroot/luyin2//346/223/215/344/275/234/346/214/207/345/215/227.txt +2 -2
- package/native/etc/docroot/static/css/app.8421a6d597ba48619941ccd4e386fbb2.css +332 -332
- package/native/etc/docroot/tts.js +150 -150
- package/native/etc/docroot/xcx/devicelist.html +658 -658
- package/native/etc/docroot/xcx/index.html +74 -74
- package/native/etc/docroot/xcx/main.html +84 -84
- package/native/etc/ttys/adore03.sql +426 -426
- package/native/etc/ttys/adore04.sql +426 -426
- package/native/etc/ttys/adore1.sql +859 -859
- package/native/etc/ttys/adore_mix22.sql +806 -806
- package/native/etc/ttys/sqlite.sql +1140 -1140
- package/native/etc/ttys/sqlite3main.sql +434 -434
- package/native/etc/ttys/sqltest.sql +279 -279
- package/native/etc/ttys/tp3sql.sql +1412 -1412
- package/native/find.js +523 -523
- package/native/findsc.js +695 -695
- package/native/tts.js +150 -150
- package/package.json +1 -1
package/native/find.js
CHANGED
|
@@ -1,529 +1,529 @@
|
|
|
1
|
-
var mysql = require('mysql');
|
|
2
|
-
var connection =null;
|
|
3
|
-
var jsres={"res":false,"info":"ubs"};
|
|
4
|
-
var stdin = process.openStdin();
|
|
5
|
-
var request=null;
|
|
6
|
-
var countnow = 0;
|
|
7
|
-
stdin.on('data', function(chunk){
|
|
8
|
-
var jsonstr = JSON.parse(chunk);
|
|
9
|
-
var actionar = jsonstr.__path.split("/");
|
|
10
|
-
var action = actionar[actionar.length-1];
|
|
11
|
-
request = jsonstr;
|
|
12
|
-
if(jsonstr.sqlme.sqlmedbk == 1){
|
|
13
|
-
connection = mysql.createConnection({
|
|
14
|
-
host : jsonstr.sqlme.sqlmeip,
|
|
15
|
-
user : jsonstr.sqlme.sqlmeusername,
|
|
16
|
-
port : jsonstr.sqlme.sqlmeport,
|
|
17
|
-
password : jsonstr.sqlme.sqlmepasswd,
|
|
18
|
-
database : jsonstr.sqlme.sqlmebasename
|
|
19
|
-
});
|
|
20
|
-
connection.connect();
|
|
21
|
-
}else if(jsonstr.sqlme.sqlmedbk == 0){
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if(action == "getfinder"){
|
|
25
|
-
endexit();
|
|
26
|
-
console.log(JSON.stringify(jsres));
|
|
27
|
-
}else if(action == "getusersinfo"){
|
|
28
|
-
getusersinfo();
|
|
29
|
-
}else if(action == "getusersdevice"){
|
|
30
|
-
getusersdevice();
|
|
31
|
-
}else if(action == "changeuserdevicemode"){
|
|
32
|
-
changeuserdevicemode();
|
|
33
|
-
}else if(action == "getwplantlist"){
|
|
34
|
-
getwplantlist();
|
|
35
|
-
}else if(action == "rmwplant"){
|
|
36
|
-
rmwplant();
|
|
37
|
-
}else if(action == "wplantadd"){ //wpdevicehistory
|
|
38
|
-
wplantadd();
|
|
39
|
-
}else if(action == "wpdevicehistory"){ //wpdevicehistory
|
|
40
|
-
wpdevicehistory();
|
|
41
|
-
}else if(action == "wfilelistrg"){ //wpdevicehistory
|
|
42
|
-
wfilelistrg();
|
|
43
|
-
}else if(action == "addziuser"){ //wpdevicehistory //listziuser
|
|
44
|
-
addziuser();
|
|
45
|
-
}else if(action == "listziuser"){ //listzrdevs
|
|
46
|
-
listziuser();
|
|
47
|
-
}else if(action == "listzrdevs"){ //getusersdevice
|
|
48
|
-
listzrdevs();
|
|
49
|
-
}else if(action == "listmydevice"){ //getusersdevice
|
|
50
|
-
listmydevice();
|
|
51
|
-
}else if(action == "changezidevices"){ //getusersdevice
|
|
52
|
-
changezidevices();
|
|
53
|
-
}else if(action == "changezimask"){ //getusersdevice
|
|
54
|
-
changezimask();
|
|
55
|
-
}else if(action == "gtoken"){ //getusersdevice
|
|
56
|
-
gtoken();
|
|
57
|
-
}else if(action == "getswapinfo"){ //getusersdevice
|
|
58
|
-
getswapinfo();
|
|
59
|
-
}else if(action == "ffffmyinfo"){ //newnickname
|
|
60
|
-
myinfo();
|
|
61
|
-
}else if(action == "newnickname"){ //newnickname
|
|
62
|
-
newnickname();
|
|
63
|
-
}else if(action == "newpasswdnick"){ //save_user_yinsixieyi
|
|
64
|
-
newpasswdnick();
|
|
65
|
-
}else if(action == "newpasswdnick"){ //save_user_yinsixieyi
|
|
66
|
-
newpasswdnick();
|
|
67
|
-
}else{
|
|
68
|
-
endexit();
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
function newpasswdnick(){
|
|
72
|
-
var sqline = "UPDATE `sbox_users` SET `user_pass` = '@user_pass' WHERE ( `id` = '@userid' and `token` = '@token' );";
|
|
73
|
-
sqline = sqline.replace("@userid",request.id);
|
|
74
|
-
sqline = sqline.replace("@token",request.token);
|
|
75
|
-
sqline = sqline.replace("@user_pass",request.newpass);
|
|
76
|
-
connection.query(sqline,function(error, results, fields){
|
|
77
|
-
if(error != null ){
|
|
78
|
-
jsres['res'] = false;
|
|
79
|
-
jsres['info'] = error;
|
|
80
|
-
}else{
|
|
81
|
-
jsres['res'] = true;
|
|
82
|
-
jsres['info'] = error;
|
|
83
|
-
}
|
|
84
|
-
console.log( JSON.stringify(jsres) );
|
|
85
|
-
endexit();
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
function newnickname(){
|
|
90
|
-
var sqline = "UPDATE `sbox_users` SET `nickname` = '@nickname' WHERE ( `id` = '@userid' and `token` = '@token' );";
|
|
91
|
-
sqline = sqline.replace("@userid",request.id);
|
|
92
|
-
sqline = sqline.replace("@token",request.token);
|
|
93
|
-
sqline = sqline.replace("@nickname",request.nickname);
|
|
94
|
-
connection.query(sqline,function(error, results, fields){
|
|
95
|
-
if(error != null ){
|
|
96
|
-
jsres['res'] = false;
|
|
97
|
-
jsres['info'] = error;
|
|
98
|
-
|
|
99
|
-
}else{
|
|
100
|
-
jsres['res'] = true;
|
|
101
|
-
jsres['info'] = error;
|
|
102
|
-
jsres['nickname'] = request.nickname;
|
|
103
|
-
}
|
|
104
|
-
console.log( JSON.stringify(jsres) );
|
|
105
|
-
endexit();
|
|
106
|
-
});
|
|
107
|
-
|
|
1
|
+
var mysql = require('mysql');
|
|
2
|
+
var connection =null;
|
|
3
|
+
var jsres={"res":false,"info":"ubs"};
|
|
4
|
+
var stdin = process.openStdin();
|
|
5
|
+
var request=null;
|
|
6
|
+
var countnow = 0;
|
|
7
|
+
stdin.on('data', function(chunk){
|
|
8
|
+
var jsonstr = JSON.parse(chunk);
|
|
9
|
+
var actionar = jsonstr.__path.split("/");
|
|
10
|
+
var action = actionar[actionar.length-1];
|
|
11
|
+
request = jsonstr;
|
|
12
|
+
if(jsonstr.sqlme.sqlmedbk == 1){
|
|
13
|
+
connection = mysql.createConnection({
|
|
14
|
+
host : jsonstr.sqlme.sqlmeip,
|
|
15
|
+
user : jsonstr.sqlme.sqlmeusername,
|
|
16
|
+
port : jsonstr.sqlme.sqlmeport,
|
|
17
|
+
password : jsonstr.sqlme.sqlmepasswd,
|
|
18
|
+
database : jsonstr.sqlme.sqlmebasename
|
|
19
|
+
});
|
|
20
|
+
connection.connect();
|
|
21
|
+
}else if(jsonstr.sqlme.sqlmedbk == 0){
|
|
22
|
+
|
|
23
|
+
}
|
|
24
|
+
if(action == "getfinder"){
|
|
25
|
+
endexit();
|
|
26
|
+
console.log(JSON.stringify(jsres));
|
|
27
|
+
}else if(action == "getusersinfo"){
|
|
28
|
+
getusersinfo();
|
|
29
|
+
}else if(action == "getusersdevice"){
|
|
30
|
+
getusersdevice();
|
|
31
|
+
}else if(action == "changeuserdevicemode"){
|
|
32
|
+
changeuserdevicemode();
|
|
33
|
+
}else if(action == "getwplantlist"){
|
|
34
|
+
getwplantlist();
|
|
35
|
+
}else if(action == "rmwplant"){
|
|
36
|
+
rmwplant();
|
|
37
|
+
}else if(action == "wplantadd"){ //wpdevicehistory
|
|
38
|
+
wplantadd();
|
|
39
|
+
}else if(action == "wpdevicehistory"){ //wpdevicehistory
|
|
40
|
+
wpdevicehistory();
|
|
41
|
+
}else if(action == "wfilelistrg"){ //wpdevicehistory
|
|
42
|
+
wfilelistrg();
|
|
43
|
+
}else if(action == "addziuser"){ //wpdevicehistory //listziuser
|
|
44
|
+
addziuser();
|
|
45
|
+
}else if(action == "listziuser"){ //listzrdevs
|
|
46
|
+
listziuser();
|
|
47
|
+
}else if(action == "listzrdevs"){ //getusersdevice
|
|
48
|
+
listzrdevs();
|
|
49
|
+
}else if(action == "listmydevice"){ //getusersdevice
|
|
50
|
+
listmydevice();
|
|
51
|
+
}else if(action == "changezidevices"){ //getusersdevice
|
|
52
|
+
changezidevices();
|
|
53
|
+
}else if(action == "changezimask"){ //getusersdevice
|
|
54
|
+
changezimask();
|
|
55
|
+
}else if(action == "gtoken"){ //getusersdevice
|
|
56
|
+
gtoken();
|
|
57
|
+
}else if(action == "getswapinfo"){ //getusersdevice
|
|
58
|
+
getswapinfo();
|
|
59
|
+
}else if(action == "ffffmyinfo"){ //newnickname
|
|
60
|
+
myinfo();
|
|
61
|
+
}else if(action == "newnickname"){ //newnickname
|
|
62
|
+
newnickname();
|
|
63
|
+
}else if(action == "newpasswdnick"){ //save_user_yinsixieyi
|
|
64
|
+
newpasswdnick();
|
|
65
|
+
}else if(action == "newpasswdnick"){ //save_user_yinsixieyi
|
|
66
|
+
newpasswdnick();
|
|
67
|
+
}else{
|
|
68
|
+
endexit();
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
function newpasswdnick(){
|
|
72
|
+
var sqline = "UPDATE `sbox_users` SET `user_pass` = '@user_pass' WHERE ( `id` = '@userid' and `token` = '@token' );";
|
|
73
|
+
sqline = sqline.replace("@userid",request.id);
|
|
74
|
+
sqline = sqline.replace("@token",request.token);
|
|
75
|
+
sqline = sqline.replace("@user_pass",request.newpass);
|
|
76
|
+
connection.query(sqline,function(error, results, fields){
|
|
77
|
+
if(error != null ){
|
|
78
|
+
jsres['res'] = false;
|
|
79
|
+
jsres['info'] = error;
|
|
80
|
+
}else{
|
|
81
|
+
jsres['res'] = true;
|
|
82
|
+
jsres['info'] = error;
|
|
83
|
+
}
|
|
84
|
+
console.log( JSON.stringify(jsres) );
|
|
85
|
+
endexit();
|
|
86
|
+
});
|
|
108
87
|
}
|
|
109
|
-
|
|
110
|
-
|
|
88
|
+
|
|
89
|
+
function newnickname(){
|
|
90
|
+
var sqline = "UPDATE `sbox_users` SET `nickname` = '@nickname' WHERE ( `id` = '@userid' and `token` = '@token' );";
|
|
91
|
+
sqline = sqline.replace("@userid",request.id);
|
|
92
|
+
sqline = sqline.replace("@token",request.token);
|
|
93
|
+
sqline = sqline.replace("@nickname",request.nickname);
|
|
94
|
+
connection.query(sqline,function(error, results, fields){
|
|
95
|
+
if(error != null ){
|
|
96
|
+
jsres['res'] = false;
|
|
97
|
+
jsres['info'] = error;
|
|
98
|
+
|
|
99
|
+
}else{
|
|
100
|
+
jsres['res'] = true;
|
|
101
|
+
jsres['info'] = error;
|
|
102
|
+
jsres['nickname'] = request.nickname;
|
|
103
|
+
}
|
|
104
|
+
console.log( JSON.stringify(jsres) );
|
|
105
|
+
endexit();
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
function myinfo(){
|
|
110
|
+
var sqline = "SELECT * FROM sbox_users where ( `id` = '@userid' and `token` = '@token' );";
|
|
111
111
|
|
|
112
|
-
sqline = sqline.replace("@userid",request.id);
|
|
113
|
-
sqline = sqline.replace("@token",request.token);
|
|
114
|
-
connection.query(sqline,function(error, results, fields){
|
|
115
|
-
if(error != null ){
|
|
116
|
-
jsres['res'] = false;
|
|
117
|
-
jsres['info'] = error;
|
|
118
|
-
|
|
119
|
-
}else{
|
|
120
|
-
jsres['res'] = true;
|
|
121
|
-
jsres['info'] = error;
|
|
122
|
-
jsres['data'] = results[0];
|
|
123
|
-
}
|
|
124
|
-
console.log( JSON.stringify(jsres) );
|
|
125
|
-
endexit();
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
function getswapinfo(){
|
|
129
|
-
var sqline = "SELECT * FROM swap_info;";
|
|
130
|
-
connection.query(sqline,function(error, results, fields){
|
|
131
|
-
if(error != null ){
|
|
132
|
-
jsres['res'] = false;
|
|
133
|
-
jsres['info'] = error;
|
|
134
|
-
|
|
135
|
-
}else{
|
|
136
|
-
jsres['res'] = true;
|
|
137
|
-
jsres['info'] = error;
|
|
138
|
-
jsres['data'] = results;
|
|
139
|
-
}
|
|
140
|
-
console.log( JSON.stringify(jsres) );
|
|
141
|
-
endexit();
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
function gtoken(){
|
|
145
|
-
var sqline = "SELECT * FROM sbox_users where ( `user_name` = '@user_name' and `user_pass` = '@user_pass' );";
|
|
146
|
-
sqline = sqline.replace("@user_name",request.username);
|
|
147
|
-
sqline = sqline.replace("@user_pass",request.passwd);
|
|
148
|
-
connection.query(sqline,function(error, results, fields){
|
|
149
|
-
if(error != null ){
|
|
150
|
-
jsres['res'] = false;
|
|
151
|
-
jsres['info'] = error;
|
|
152
|
-
|
|
153
|
-
}else if(results.length == 1){
|
|
154
|
-
jsres['res'] = true;
|
|
155
|
-
jsres['info'] = error;
|
|
156
|
-
jsres['data'] = results[0];
|
|
157
|
-
}else{
|
|
158
|
-
jsres['res'] = false;
|
|
159
|
-
jsres['info'] = error;
|
|
160
|
-
}
|
|
161
|
-
console.log( JSON.stringify(jsres) );
|
|
162
|
-
endexit();
|
|
163
|
-
});
|
|
112
|
+
sqline = sqline.replace("@userid",request.id);
|
|
113
|
+
sqline = sqline.replace("@token",request.token);
|
|
114
|
+
connection.query(sqline,function(error, results, fields){
|
|
115
|
+
if(error != null ){
|
|
116
|
+
jsres['res'] = false;
|
|
117
|
+
jsres['info'] = error;
|
|
118
|
+
|
|
119
|
+
}else{
|
|
120
|
+
jsres['res'] = true;
|
|
121
|
+
jsres['info'] = error;
|
|
122
|
+
jsres['data'] = results[0];
|
|
123
|
+
}
|
|
124
|
+
console.log( JSON.stringify(jsres) );
|
|
125
|
+
endexit();
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
function getswapinfo(){
|
|
129
|
+
var sqline = "SELECT * FROM swap_info;";
|
|
130
|
+
connection.query(sqline,function(error, results, fields){
|
|
131
|
+
if(error != null ){
|
|
132
|
+
jsres['res'] = false;
|
|
133
|
+
jsres['info'] = error;
|
|
134
|
+
|
|
135
|
+
}else{
|
|
136
|
+
jsres['res'] = true;
|
|
137
|
+
jsres['info'] = error;
|
|
138
|
+
jsres['data'] = results;
|
|
139
|
+
}
|
|
140
|
+
console.log( JSON.stringify(jsres) );
|
|
141
|
+
endexit();
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
function gtoken(){
|
|
145
|
+
var sqline = "SELECT * FROM sbox_users where ( `user_name` = '@user_name' and `user_pass` = '@user_pass' );";
|
|
146
|
+
sqline = sqline.replace("@user_name",request.username);
|
|
147
|
+
sqline = sqline.replace("@user_pass",request.passwd);
|
|
148
|
+
connection.query(sqline,function(error, results, fields){
|
|
149
|
+
if(error != null ){
|
|
150
|
+
jsres['res'] = false;
|
|
151
|
+
jsres['info'] = error;
|
|
152
|
+
|
|
153
|
+
}else if(results.length == 1){
|
|
154
|
+
jsres['res'] = true;
|
|
155
|
+
jsres['info'] = error;
|
|
156
|
+
jsres['data'] = results[0];
|
|
157
|
+
}else{
|
|
158
|
+
jsres['res'] = false;
|
|
159
|
+
jsres['info'] = error;
|
|
160
|
+
}
|
|
161
|
+
console.log( JSON.stringify(jsres) );
|
|
162
|
+
endexit();
|
|
163
|
+
});
|
|
164
164
|
}
|
|
165
165
|
function insertStr(source, start, newStr) {
|
|
166
166
|
return source.slice(0, start) + newStr + source.slice(start+1)
|
|
167
|
-
}
|
|
168
|
-
function changezimask(){
|
|
169
|
-
var zuserid = request.userid;
|
|
170
|
-
var zdex = request.zdex;
|
|
171
|
-
var zcase = request.zcase;
|
|
172
|
-
jsres['zcase'] = zcase ;
|
|
173
|
-
jsres['zdex'] = zdex ;
|
|
174
|
-
var sqline = "SELECT * FROM sbox_users where id = '@zuserid';";
|
|
175
|
-
sqline = sqline.replace("@zuserid",zuserid);
|
|
176
|
-
connection.query(sqline,function(error, results, fields){
|
|
177
|
-
if(error != null ){
|
|
178
|
-
jsres['res'] = false;
|
|
179
|
-
jsres['res1'] = false;
|
|
180
|
-
jsres['info'] = error;
|
|
181
|
-
}else{
|
|
182
|
-
jsres['res'] = true;
|
|
183
|
-
jsres['results'] = results;
|
|
184
|
-
if(results.length == 1){
|
|
185
|
-
var endmask = "";
|
|
186
|
-
jsres['endmask'] = results[0].mask;
|
|
187
|
-
if(zcase == "false"){
|
|
188
|
-
endmask= insertStr(results[0].mask,parseInt(zdex),"0");
|
|
189
|
-
}else{
|
|
190
|
-
endmask= insertStr(results[0].mask,parseInt(zdex),"1");
|
|
191
|
-
|
|
192
|
-
}
|
|
193
|
-
sqline = "UPDATE `sbox_users` SET `mask` = '@mask' WHERE (`id` = '@zuserid');";
|
|
194
|
-
sqline = sqline.replace("@zuserid",zuserid);
|
|
195
|
-
sqline = sqline.replace("@mask",endmask);
|
|
196
|
-
jsres['endmask'] = endmask;
|
|
197
|
-
connection.query(sqline,function(error, results, fields){
|
|
198
|
-
if(error != null ){
|
|
199
|
-
jsres['res1'] = false;
|
|
200
|
-
jsres['info'] = error;
|
|
201
|
-
|
|
202
|
-
}else{
|
|
203
|
-
jsres['res1'] = true;
|
|
204
|
-
jsres['info'] = error;
|
|
205
|
-
jsres['endmask'] = endmask;
|
|
206
|
-
}
|
|
207
|
-
console.log( JSON.stringify(jsres) );
|
|
208
|
-
endexit();
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
}else{
|
|
212
|
-
jsres['info'] = error;
|
|
213
|
-
console.log( JSON.stringify(jsres) );
|
|
214
|
-
endexit();
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
console.log( JSON.stringify(jsres) );
|
|
218
|
-
endexit();
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
}
|
|
223
|
-
function changezidevices(){
|
|
224
|
-
//console.log(request);
|
|
225
|
-
if(request.pus_idstr != "null"){
|
|
226
|
-
var sqline = "call pus_str( '@idS' , @masterid, @zid );";
|
|
227
|
-
sqline = sqline.replace("@idS" ,request.pus_idstr);
|
|
228
|
-
sqline = sqline.replace("@masterid" ,request.id);
|
|
229
|
-
sqline = sqline.replace("@zid" ,request.gid);
|
|
230
|
-
connection.query(sqline,function(error, results, fields){
|
|
231
|
-
if(error != null ){
|
|
232
|
-
jsres['res'] = false;
|
|
233
|
-
jsres['sqline'] = sqline;
|
|
234
|
-
jsres['info'] = error;
|
|
235
|
-
//changezidevices();
|
|
236
|
-
}else{
|
|
237
|
-
jsres['res'] = true;
|
|
238
|
-
jsres['info'] = error;
|
|
239
|
-
}
|
|
240
|
-
if(request.dis_idstr != "null" ){
|
|
241
|
-
sqline = "call dis_str('@idS',@zid);";
|
|
242
|
-
sqline = sqline.replace("@idS" ,request.dis_idstr);
|
|
243
|
-
sqline = sqline.replace("@zid" ,request.gid);
|
|
244
|
-
connection.query(sqline,function(error, results, fields){
|
|
245
|
-
if(error != null ){
|
|
246
|
-
jsres['res'] = false;
|
|
247
|
-
jsres['info'] = error;
|
|
248
|
-
}else{
|
|
249
|
-
jsres['res'] = true;
|
|
250
|
-
jsres['info'] = error;
|
|
251
|
-
}
|
|
252
|
-
console.log( JSON.stringify(jsres) );
|
|
253
|
-
endexit();
|
|
254
|
-
});
|
|
255
|
-
}else{
|
|
256
|
-
console.log( JSON.stringify(jsres) );
|
|
257
|
-
endexit();
|
|
258
|
-
}
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
}else if(request.dis_idstr != "null" ){
|
|
262
|
-
jsres['pus_idstr'] = "null";
|
|
263
|
-
var sqline = "call dis_str('@idS',@zid);";
|
|
264
|
-
sqline = sqline.replace("@idS" ,request.dis_idstr);
|
|
265
|
-
sqline = sqline.replace("@zid" ,request.gid);
|
|
266
|
-
//console.log(sqline);
|
|
267
|
-
connection.query(sqline,function(error, results, fields){
|
|
268
|
-
if(error != null ){
|
|
269
|
-
jsres['res'] = false;
|
|
270
|
-
jsres['info'] = error;
|
|
271
|
-
}else{
|
|
272
|
-
jsres['res'] = true;
|
|
273
|
-
jsres['info'] = error;
|
|
274
|
-
}
|
|
275
|
-
console.log( JSON.stringify(jsres) );
|
|
276
|
-
endexit();
|
|
277
|
-
});
|
|
278
|
-
|
|
279
|
-
}else{
|
|
280
|
-
jsres['pus_idstr'] = "null";
|
|
281
|
-
jsres['dis_idstr'] = "null";
|
|
282
|
-
console.log( JSON.stringify(jsres) );
|
|
283
|
-
endexit();
|
|
284
|
-
}
|
|
285
|
-
|
|
286
|
-
}
|
|
287
|
-
function listmydevice(){
|
|
288
|
-
var sqline = "SELECT * FROM sbox_device_info where (`user_id` = '@user_id');";
|
|
289
|
-
sqline = sqline.replace("@user_id",request.id);
|
|
290
|
-
connection.query(sqline,function(error, results, fields){
|
|
291
|
-
if(error != null ){
|
|
292
|
-
jsres['res'] = false;
|
|
293
|
-
jsres['info'] = error;
|
|
294
|
-
console.log( JSON.stringify(jsres) );
|
|
295
|
-
endexit();
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
jsres['res']=true;
|
|
299
|
-
jsres['results']=results;
|
|
300
|
-
for(var line in results){
|
|
301
|
-
jsres['results'][line].devname = new Buffer( results[line].device_name , 'base64').toString();
|
|
302
|
-
};
|
|
303
|
-
//jsres['sqline']=sqline;
|
|
304
|
-
console.log( JSON.stringify(jsres) );
|
|
305
|
-
endexit();
|
|
306
|
-
});
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
function listzrdevs(){
|
|
310
|
-
var sqline = "SELECT * FROM sbox_device_info where (`user_id` = '@user_id');";
|
|
311
|
-
sqline = sqline.replace("@user_id",request.ziid);
|
|
312
|
-
connection.query(sqline,function(error, results, fields){
|
|
313
|
-
if(error != null ){
|
|
314
|
-
jsres['res'] = false;
|
|
315
|
-
jsres['info'] = error;
|
|
316
|
-
console.log( JSON.stringify(jsres) );
|
|
317
|
-
endexit();
|
|
318
|
-
}
|
|
319
|
-
jsres['res']=true;
|
|
320
|
-
jsres['sqline']=sqline;
|
|
321
|
-
jsres['results']=results;
|
|
322
|
-
console.log( JSON.stringify(jsres) );
|
|
323
|
-
endexit();
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function listziuser(){
|
|
328
|
-
var sqline = "select * from `sbox_users` where `master_id` = '@master_id' ;";
|
|
329
|
-
sqline = sqline.replace("@master_id",request.id);
|
|
330
|
-
connection.query(sqline,function(error, results, fields){
|
|
331
|
-
if(error != null ){
|
|
332
|
-
jsres['res'] = false;
|
|
333
|
-
jsres['info'] = error;
|
|
334
|
-
console.log( JSON.stringify(jsres) );
|
|
335
|
-
endexit();
|
|
336
|
-
}
|
|
337
|
-
jsres['res']=true;
|
|
338
|
-
jsres['results']=results;
|
|
339
|
-
console.log( JSON.stringify(jsres) );
|
|
340
|
-
endexit();
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
|
|
344
|
-
function addziuser(){
|
|
345
|
-
var sqline = "INSERT INTO `sbox_users` (`user_name`, `user_pass`, `master_id`, `mask`, `beizhu` , `token`, `nickname`) VALUES ('@user_name', '@user_pass', '@master_id', '@mask', '@beizhu' , '@token', '@nickname');";
|
|
346
|
-
sqline = sqline.replace("@user_name",request.ziusername);
|
|
347
|
-
sqline = sqline.replace("@user_pass",request.zipasswd);
|
|
348
|
-
sqline = sqline.replace("@master_id",request.id);
|
|
349
|
-
sqline = sqline.replace("@mask",request.mask);
|
|
350
|
-
sqline = sqline.replace("@beizhu",request.beizhu );
|
|
351
|
-
sqline = sqline.replace("@token",request.token );
|
|
352
|
-
sqline = sqline.replace("@nickname",request.nickname );
|
|
353
|
-
connection.query(sqline,function(error, results, fields){
|
|
354
|
-
if(error != null ){
|
|
355
|
-
jsres['res'] = false;
|
|
356
|
-
jsres['info'] = error;
|
|
357
|
-
console.log( JSON.stringify(jsres) );
|
|
358
|
-
endexit();
|
|
359
|
-
}
|
|
360
|
-
jsres['res']=true;
|
|
361
|
-
jsres['results']=results;
|
|
362
|
-
console.log( JSON.stringify(jsres) );
|
|
363
|
-
endexit();
|
|
364
|
-
});
|
|
365
|
-
}
|
|
366
|
-
|
|
367
|
-
function wfilelistrg(){
|
|
368
|
-
var sqline = "select * from `warregister` where `userid` = '@userid' ;";
|
|
369
|
-
sqline = sqline.replace("@userid",request.id);
|
|
370
|
-
connection.query(sqline,function(error, results, fields){
|
|
371
|
-
if(error != null ){
|
|
372
|
-
jsres['res'] = false;
|
|
373
|
-
jsres['info'] = error;
|
|
374
|
-
console.log( JSON.stringify(jsres) );
|
|
375
|
-
endexit();
|
|
376
|
-
}
|
|
377
|
-
jsres['res']=true;
|
|
378
|
-
jsres['results']=results;
|
|
379
|
-
console.log( JSON.stringify(jsres) );
|
|
380
|
-
endexit();
|
|
381
|
-
});
|
|
382
|
-
};
|
|
383
|
-
function wpdevicehistory(){
|
|
384
|
-
var sqline = "SELECT * FROM sbox_device_info where (`user_id` = '@user_id' and `iswarning` = '99');";
|
|
385
|
-
sqline = sqline.replace("@user_id",request.id);
|
|
386
|
-
connection.query(sqline,function(error, results, fields){
|
|
387
|
-
if(error != null ){
|
|
388
|
-
jsres['res'] = false;
|
|
389
|
-
jsres['info'] = error;
|
|
390
|
-
console.log( JSON.stringify(jsres) );
|
|
391
|
-
endexit();
|
|
392
|
-
}
|
|
393
|
-
jsres['res'] = true;
|
|
394
|
-
jsres['results'] = results;
|
|
395
|
-
for(var line in results){
|
|
396
|
-
jsres['results'][line].devname = new Buffer( results[line].device_name , 'base64').toString();
|
|
397
|
-
};
|
|
398
|
-
console.log( JSON.stringify(jsres) );
|
|
399
|
-
endexit();
|
|
400
|
-
});
|
|
401
|
-
};
|
|
402
|
-
function wplantadd(){
|
|
403
|
-
var sqline = "INSERT INTO `warningplant` (`snids`,`url`, `name`, `userid`) VALUES ('@snids','@url','@name','@userid')";
|
|
404
|
-
sqline = sqline.replace("@snids",request.snlist);
|
|
405
|
-
sqline = sqline.replace("@url",request.url);
|
|
406
|
-
sqline = sqline.replace("@name",request.plantname);
|
|
407
|
-
sqline = sqline.replace("@userid",request.id);
|
|
408
|
-
connection.query(sqline,function(error, results, fields){
|
|
409
|
-
if(error != null ){
|
|
410
|
-
jsres['res'] = false;
|
|
411
|
-
jsres['info'] = error;
|
|
412
|
-
console.log( JSON.stringify(jsres) );
|
|
413
|
-
endexit();
|
|
414
|
-
}
|
|
415
|
-
|
|
416
|
-
jsres['res'] = true;
|
|
417
|
-
console.log( JSON.stringify(jsres) );
|
|
418
|
-
endexit();
|
|
419
|
-
});
|
|
420
|
-
};
|
|
421
|
-
function rmwplant(){
|
|
422
|
-
var sqline = "DELETE FROM `warningplant` WHERE (`id` = '@id' and userid = '@userid') ;";
|
|
423
|
-
sqline = sqline.replace("@userid",request.id);
|
|
424
|
-
sqline = sqline.replace("@id",request.pltid);
|
|
425
|
-
connection.query(sqline,function(error, results, fields){
|
|
426
|
-
if(error != null ){
|
|
427
|
-
jsres['res'] = false;
|
|
428
|
-
jsres['info'] = error;
|
|
429
|
-
console.log( JSON.stringify(jsres) );
|
|
430
|
-
endexit();
|
|
431
|
-
}
|
|
432
|
-
jsres['res'] = true;
|
|
433
|
-
console.log( JSON.stringify(jsres) );
|
|
434
|
-
endexit();
|
|
435
|
-
});
|
|
436
|
-
};
|
|
437
|
-
function getwplantlist(){
|
|
438
|
-
var sqline = " SELECT * FROM warningplant WHERE (`userid` = '@userid' );";
|
|
439
|
-
sqline = sqline.replace("@userid",request.id);
|
|
440
|
-
connection.query(sqline,function(error, results, fields){
|
|
441
|
-
if(error != null ){
|
|
442
|
-
jsres['res'] = false;
|
|
443
|
-
jsres['info'] = error;
|
|
444
|
-
console.log( JSON.stringify(jsres) );
|
|
445
|
-
endexit();
|
|
446
|
-
}
|
|
447
|
-
jsres['res'] = true;
|
|
448
|
-
jsres['results'] = results;
|
|
449
|
-
|
|
450
|
-
for(var line in results){
|
|
451
|
-
var snids = results[line].snids;
|
|
452
|
-
var snidlist = snids.split("|");
|
|
453
|
-
jsres['results'][line].sncount = snidlist.length;
|
|
454
|
-
};
|
|
455
|
-
|
|
456
|
-
console.log( JSON.stringify(jsres) );
|
|
457
|
-
endexit();
|
|
458
|
-
});
|
|
459
|
-
};
|
|
460
|
-
function changeuserdevicemode(){
|
|
461
|
-
var sqline = "UPDATE `sbox_device_info` SET `iswarning` = '@iswarning' ,`kind` = '@kind' ,`device_type` = '@device_type' \
|
|
462
|
-
WHERE (`user_id` = '@userid' and `id` = '@deviceid' );";
|
|
463
|
-
sqline = sqline.replace("@userid",request.userid);
|
|
464
|
-
sqline = sqline.replace("@iswarning",request.iswarning);
|
|
465
|
-
sqline = sqline.replace("@device_type",request.device_type);
|
|
466
|
-
sqline = sqline.replace("@kind",request.kind);
|
|
467
|
-
sqline = sqline.replace("@deviceid",request.deviceid);
|
|
468
|
-
connection.query(sqline,function(error, results, fields){
|
|
469
|
-
if(error != null ){
|
|
470
|
-
jsres['res'] = false;
|
|
471
|
-
jsres['info'] = error;
|
|
472
|
-
console.log( JSON.stringify(jsres) );
|
|
473
|
-
endexit();
|
|
474
|
-
}
|
|
475
|
-
jsres['res'] = true;
|
|
476
|
-
jsres['efrow'] = results.affectedRows;
|
|
477
|
-
console.log( JSON.stringify(jsres) );
|
|
478
|
-
endexit();
|
|
479
|
-
});
|
|
480
|
-
};
|
|
481
|
-
function getusersdevice(){
|
|
482
|
-
var sqline = 'SELECT * FROM sbox_device_info where user_id = \'@userid\';';
|
|
483
|
-
sqline = sqline.replace("@userid",request.userid);
|
|
484
|
-
connection.query(sqline,function(error, results, fields){
|
|
485
|
-
if(error != null ){
|
|
486
|
-
endexit();
|
|
487
|
-
}
|
|
488
|
-
jsres['data'] = results;
|
|
489
|
-
jsres['res'] = true;
|
|
490
|
-
console.log(JSON.stringify(jsres));
|
|
491
|
-
endexit();
|
|
492
|
-
});
|
|
493
|
-
};
|
|
494
|
-
function getusersinfo(){
|
|
495
|
-
connection.query("SELECT * FROM sbox_users;",function(error, results, fields){
|
|
496
|
-
|
|
497
|
-
if(error != null ){
|
|
498
|
-
endexit();
|
|
499
|
-
}
|
|
500
|
-
var obary = [];
|
|
501
|
-
for(var line in results){
|
|
502
|
-
var obj = {};
|
|
503
|
-
obj.id = results[line].id;
|
|
504
|
-
obj.user_name = results[line].user_name;
|
|
505
|
-
obj.master_id = results[line].master_id;
|
|
506
|
-
obj.ctime = results[line].ctime;
|
|
507
|
-
obj.nickname = results[line].nickname;
|
|
508
|
-
obj.user_level = results[line].user_level;
|
|
509
|
-
obj.user_type = results[line].user_type;
|
|
510
|
-
obj.status = results[line].status;
|
|
511
|
-
obj.token = results[line].token;
|
|
512
|
-
obj.qianfei = results[line].qianfei;
|
|
513
|
-
obj.cdnpath = results[line].cdnpath;
|
|
514
|
-
obj.jiankong = results[line].jiankong;
|
|
515
|
-
obj.mask = results[line].mask;
|
|
516
|
-
obary.push(obj);
|
|
517
|
-
};
|
|
518
|
-
jsres['data'] = obary;
|
|
519
|
-
jsres['res'] = true;
|
|
520
|
-
console.log(JSON.stringify(jsres));
|
|
521
|
-
endexit();
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
function endexit(){
|
|
525
|
-
if(jsonstr.sqlme.sqlmedbk == 1){
|
|
526
|
-
connection.end();
|
|
527
|
-
}
|
|
528
|
-
process.exit();
|
|
167
|
+
}
|
|
168
|
+
function changezimask(){
|
|
169
|
+
var zuserid = request.userid;
|
|
170
|
+
var zdex = request.zdex;
|
|
171
|
+
var zcase = request.zcase;
|
|
172
|
+
jsres['zcase'] = zcase ;
|
|
173
|
+
jsres['zdex'] = zdex ;
|
|
174
|
+
var sqline = "SELECT * FROM sbox_users where id = '@zuserid';";
|
|
175
|
+
sqline = sqline.replace("@zuserid",zuserid);
|
|
176
|
+
connection.query(sqline,function(error, results, fields){
|
|
177
|
+
if(error != null ){
|
|
178
|
+
jsres['res'] = false;
|
|
179
|
+
jsres['res1'] = false;
|
|
180
|
+
jsres['info'] = error;
|
|
181
|
+
}else{
|
|
182
|
+
jsres['res'] = true;
|
|
183
|
+
jsres['results'] = results;
|
|
184
|
+
if(results.length == 1){
|
|
185
|
+
var endmask = "";
|
|
186
|
+
jsres['endmask'] = results[0].mask;
|
|
187
|
+
if(zcase == "false"){
|
|
188
|
+
endmask= insertStr(results[0].mask,parseInt(zdex),"0");
|
|
189
|
+
}else{
|
|
190
|
+
endmask= insertStr(results[0].mask,parseInt(zdex),"1");
|
|
191
|
+
|
|
192
|
+
}
|
|
193
|
+
sqline = "UPDATE `sbox_users` SET `mask` = '@mask' WHERE (`id` = '@zuserid');";
|
|
194
|
+
sqline = sqline.replace("@zuserid",zuserid);
|
|
195
|
+
sqline = sqline.replace("@mask",endmask);
|
|
196
|
+
jsres['endmask'] = endmask;
|
|
197
|
+
connection.query(sqline,function(error, results, fields){
|
|
198
|
+
if(error != null ){
|
|
199
|
+
jsres['res1'] = false;
|
|
200
|
+
jsres['info'] = error;
|
|
201
|
+
|
|
202
|
+
}else{
|
|
203
|
+
jsres['res1'] = true;
|
|
204
|
+
jsres['info'] = error;
|
|
205
|
+
jsres['endmask'] = endmask;
|
|
206
|
+
}
|
|
207
|
+
console.log( JSON.stringify(jsres) );
|
|
208
|
+
endexit();
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
}else{
|
|
212
|
+
jsres['info'] = error;
|
|
213
|
+
console.log( JSON.stringify(jsres) );
|
|
214
|
+
endexit();
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
console.log( JSON.stringify(jsres) );
|
|
218
|
+
endexit();
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
}
|
|
223
|
+
function changezidevices(){
|
|
224
|
+
//console.log(request);
|
|
225
|
+
if(request.pus_idstr != "null"){
|
|
226
|
+
var sqline = "call pus_str( '@idS' , @masterid, @zid );";
|
|
227
|
+
sqline = sqline.replace("@idS" ,request.pus_idstr);
|
|
228
|
+
sqline = sqline.replace("@masterid" ,request.id);
|
|
229
|
+
sqline = sqline.replace("@zid" ,request.gid);
|
|
230
|
+
connection.query(sqline,function(error, results, fields){
|
|
231
|
+
if(error != null ){
|
|
232
|
+
jsres['res'] = false;
|
|
233
|
+
jsres['sqline'] = sqline;
|
|
234
|
+
jsres['info'] = error;
|
|
235
|
+
//changezidevices();
|
|
236
|
+
}else{
|
|
237
|
+
jsres['res'] = true;
|
|
238
|
+
jsres['info'] = error;
|
|
239
|
+
}
|
|
240
|
+
if(request.dis_idstr != "null" ){
|
|
241
|
+
sqline = "call dis_str('@idS',@zid);";
|
|
242
|
+
sqline = sqline.replace("@idS" ,request.dis_idstr);
|
|
243
|
+
sqline = sqline.replace("@zid" ,request.gid);
|
|
244
|
+
connection.query(sqline,function(error, results, fields){
|
|
245
|
+
if(error != null ){
|
|
246
|
+
jsres['res'] = false;
|
|
247
|
+
jsres['info'] = error;
|
|
248
|
+
}else{
|
|
249
|
+
jsres['res'] = true;
|
|
250
|
+
jsres['info'] = error;
|
|
251
|
+
}
|
|
252
|
+
console.log( JSON.stringify(jsres) );
|
|
253
|
+
endexit();
|
|
254
|
+
});
|
|
255
|
+
}else{
|
|
256
|
+
console.log( JSON.stringify(jsres) );
|
|
257
|
+
endexit();
|
|
258
|
+
}
|
|
259
|
+
});
|
|
260
|
+
|
|
261
|
+
}else if(request.dis_idstr != "null" ){
|
|
262
|
+
jsres['pus_idstr'] = "null";
|
|
263
|
+
var sqline = "call dis_str('@idS',@zid);";
|
|
264
|
+
sqline = sqline.replace("@idS" ,request.dis_idstr);
|
|
265
|
+
sqline = sqline.replace("@zid" ,request.gid);
|
|
266
|
+
//console.log(sqline);
|
|
267
|
+
connection.query(sqline,function(error, results, fields){
|
|
268
|
+
if(error != null ){
|
|
269
|
+
jsres['res'] = false;
|
|
270
|
+
jsres['info'] = error;
|
|
271
|
+
}else{
|
|
272
|
+
jsres['res'] = true;
|
|
273
|
+
jsres['info'] = error;
|
|
274
|
+
}
|
|
275
|
+
console.log( JSON.stringify(jsres) );
|
|
276
|
+
endexit();
|
|
277
|
+
});
|
|
278
|
+
|
|
279
|
+
}else{
|
|
280
|
+
jsres['pus_idstr'] = "null";
|
|
281
|
+
jsres['dis_idstr'] = "null";
|
|
282
|
+
console.log( JSON.stringify(jsres) );
|
|
283
|
+
endexit();
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
}
|
|
287
|
+
function listmydevice(){
|
|
288
|
+
var sqline = "SELECT * FROM sbox_device_info where (`user_id` = '@user_id');";
|
|
289
|
+
sqline = sqline.replace("@user_id",request.id);
|
|
290
|
+
connection.query(sqline,function(error, results, fields){
|
|
291
|
+
if(error != null ){
|
|
292
|
+
jsres['res'] = false;
|
|
293
|
+
jsres['info'] = error;
|
|
294
|
+
console.log( JSON.stringify(jsres) );
|
|
295
|
+
endexit();
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
jsres['res']=true;
|
|
299
|
+
jsres['results']=results;
|
|
300
|
+
for(var line in results){
|
|
301
|
+
jsres['results'][line].devname = new Buffer( results[line].device_name , 'base64').toString();
|
|
302
|
+
};
|
|
303
|
+
//jsres['sqline']=sqline;
|
|
304
|
+
console.log( JSON.stringify(jsres) );
|
|
305
|
+
endexit();
|
|
306
|
+
});
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
function listzrdevs(){
|
|
310
|
+
var sqline = "SELECT * FROM sbox_device_info where (`user_id` = '@user_id');";
|
|
311
|
+
sqline = sqline.replace("@user_id",request.ziid);
|
|
312
|
+
connection.query(sqline,function(error, results, fields){
|
|
313
|
+
if(error != null ){
|
|
314
|
+
jsres['res'] = false;
|
|
315
|
+
jsres['info'] = error;
|
|
316
|
+
console.log( JSON.stringify(jsres) );
|
|
317
|
+
endexit();
|
|
318
|
+
}
|
|
319
|
+
jsres['res']=true;
|
|
320
|
+
jsres['sqline']=sqline;
|
|
321
|
+
jsres['results']=results;
|
|
322
|
+
console.log( JSON.stringify(jsres) );
|
|
323
|
+
endexit();
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
function listziuser(){
|
|
328
|
+
var sqline = "select * from `sbox_users` where `master_id` = '@master_id' ;";
|
|
329
|
+
sqline = sqline.replace("@master_id",request.id);
|
|
330
|
+
connection.query(sqline,function(error, results, fields){
|
|
331
|
+
if(error != null ){
|
|
332
|
+
jsres['res'] = false;
|
|
333
|
+
jsres['info'] = error;
|
|
334
|
+
console.log( JSON.stringify(jsres) );
|
|
335
|
+
endexit();
|
|
336
|
+
}
|
|
337
|
+
jsres['res']=true;
|
|
338
|
+
jsres['results']=results;
|
|
339
|
+
console.log( JSON.stringify(jsres) );
|
|
340
|
+
endexit();
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
function addziuser(){
|
|
345
|
+
var sqline = "INSERT INTO `sbox_users` (`user_name`, `user_pass`, `master_id`, `mask`, `beizhu` , `token`, `nickname`) VALUES ('@user_name', '@user_pass', '@master_id', '@mask', '@beizhu' , '@token', '@nickname');";
|
|
346
|
+
sqline = sqline.replace("@user_name",request.ziusername);
|
|
347
|
+
sqline = sqline.replace("@user_pass",request.zipasswd);
|
|
348
|
+
sqline = sqline.replace("@master_id",request.id);
|
|
349
|
+
sqline = sqline.replace("@mask",request.mask);
|
|
350
|
+
sqline = sqline.replace("@beizhu",request.beizhu );
|
|
351
|
+
sqline = sqline.replace("@token",request.token );
|
|
352
|
+
sqline = sqline.replace("@nickname",request.nickname );
|
|
353
|
+
connection.query(sqline,function(error, results, fields){
|
|
354
|
+
if(error != null ){
|
|
355
|
+
jsres['res'] = false;
|
|
356
|
+
jsres['info'] = error;
|
|
357
|
+
console.log( JSON.stringify(jsres) );
|
|
358
|
+
endexit();
|
|
359
|
+
}
|
|
360
|
+
jsres['res']=true;
|
|
361
|
+
jsres['results']=results;
|
|
362
|
+
console.log( JSON.stringify(jsres) );
|
|
363
|
+
endexit();
|
|
364
|
+
});
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function wfilelistrg(){
|
|
368
|
+
var sqline = "select * from `warregister` where `userid` = '@userid' ;";
|
|
369
|
+
sqline = sqline.replace("@userid",request.id);
|
|
370
|
+
connection.query(sqline,function(error, results, fields){
|
|
371
|
+
if(error != null ){
|
|
372
|
+
jsres['res'] = false;
|
|
373
|
+
jsres['info'] = error;
|
|
374
|
+
console.log( JSON.stringify(jsres) );
|
|
375
|
+
endexit();
|
|
376
|
+
}
|
|
377
|
+
jsres['res']=true;
|
|
378
|
+
jsres['results']=results;
|
|
379
|
+
console.log( JSON.stringify(jsres) );
|
|
380
|
+
endexit();
|
|
381
|
+
});
|
|
382
|
+
};
|
|
383
|
+
function wpdevicehistory(){
|
|
384
|
+
var sqline = "SELECT * FROM sbox_device_info where (`user_id` = '@user_id' and `iswarning` = '99');";
|
|
385
|
+
sqline = sqline.replace("@user_id",request.id);
|
|
386
|
+
connection.query(sqline,function(error, results, fields){
|
|
387
|
+
if(error != null ){
|
|
388
|
+
jsres['res'] = false;
|
|
389
|
+
jsres['info'] = error;
|
|
390
|
+
console.log( JSON.stringify(jsres) );
|
|
391
|
+
endexit();
|
|
392
|
+
}
|
|
393
|
+
jsres['res'] = true;
|
|
394
|
+
jsres['results'] = results;
|
|
395
|
+
for(var line in results){
|
|
396
|
+
jsres['results'][line].devname = new Buffer( results[line].device_name , 'base64').toString();
|
|
397
|
+
};
|
|
398
|
+
console.log( JSON.stringify(jsres) );
|
|
399
|
+
endexit();
|
|
400
|
+
});
|
|
401
|
+
};
|
|
402
|
+
function wplantadd(){
|
|
403
|
+
var sqline = "INSERT INTO `warningplant` (`snids`,`url`, `name`, `userid`) VALUES ('@snids','@url','@name','@userid')";
|
|
404
|
+
sqline = sqline.replace("@snids",request.snlist);
|
|
405
|
+
sqline = sqline.replace("@url",request.url);
|
|
406
|
+
sqline = sqline.replace("@name",request.plantname);
|
|
407
|
+
sqline = sqline.replace("@userid",request.id);
|
|
408
|
+
connection.query(sqline,function(error, results, fields){
|
|
409
|
+
if(error != null ){
|
|
410
|
+
jsres['res'] = false;
|
|
411
|
+
jsres['info'] = error;
|
|
412
|
+
console.log( JSON.stringify(jsres) );
|
|
413
|
+
endexit();
|
|
414
|
+
}
|
|
415
|
+
|
|
416
|
+
jsres['res'] = true;
|
|
417
|
+
console.log( JSON.stringify(jsres) );
|
|
418
|
+
endexit();
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
function rmwplant(){
|
|
422
|
+
var sqline = "DELETE FROM `warningplant` WHERE (`id` = '@id' and userid = '@userid') ;";
|
|
423
|
+
sqline = sqline.replace("@userid",request.id);
|
|
424
|
+
sqline = sqline.replace("@id",request.pltid);
|
|
425
|
+
connection.query(sqline,function(error, results, fields){
|
|
426
|
+
if(error != null ){
|
|
427
|
+
jsres['res'] = false;
|
|
428
|
+
jsres['info'] = error;
|
|
429
|
+
console.log( JSON.stringify(jsres) );
|
|
430
|
+
endexit();
|
|
431
|
+
}
|
|
432
|
+
jsres['res'] = true;
|
|
433
|
+
console.log( JSON.stringify(jsres) );
|
|
434
|
+
endexit();
|
|
435
|
+
});
|
|
436
|
+
};
|
|
437
|
+
function getwplantlist(){
|
|
438
|
+
var sqline = " SELECT * FROM warningplant WHERE (`userid` = '@userid' );";
|
|
439
|
+
sqline = sqline.replace("@userid",request.id);
|
|
440
|
+
connection.query(sqline,function(error, results, fields){
|
|
441
|
+
if(error != null ){
|
|
442
|
+
jsres['res'] = false;
|
|
443
|
+
jsres['info'] = error;
|
|
444
|
+
console.log( JSON.stringify(jsres) );
|
|
445
|
+
endexit();
|
|
446
|
+
}
|
|
447
|
+
jsres['res'] = true;
|
|
448
|
+
jsres['results'] = results;
|
|
449
|
+
|
|
450
|
+
for(var line in results){
|
|
451
|
+
var snids = results[line].snids;
|
|
452
|
+
var snidlist = snids.split("|");
|
|
453
|
+
jsres['results'][line].sncount = snidlist.length;
|
|
454
|
+
};
|
|
455
|
+
|
|
456
|
+
console.log( JSON.stringify(jsres) );
|
|
457
|
+
endexit();
|
|
458
|
+
});
|
|
459
|
+
};
|
|
460
|
+
function changeuserdevicemode(){
|
|
461
|
+
var sqline = "UPDATE `sbox_device_info` SET `iswarning` = '@iswarning' ,`kind` = '@kind' ,`device_type` = '@device_type' \
|
|
462
|
+
WHERE (`user_id` = '@userid' and `id` = '@deviceid' );";
|
|
463
|
+
sqline = sqline.replace("@userid",request.userid);
|
|
464
|
+
sqline = sqline.replace("@iswarning",request.iswarning);
|
|
465
|
+
sqline = sqline.replace("@device_type",request.device_type);
|
|
466
|
+
sqline = sqline.replace("@kind",request.kind);
|
|
467
|
+
sqline = sqline.replace("@deviceid",request.deviceid);
|
|
468
|
+
connection.query(sqline,function(error, results, fields){
|
|
469
|
+
if(error != null ){
|
|
470
|
+
jsres['res'] = false;
|
|
471
|
+
jsres['info'] = error;
|
|
472
|
+
console.log( JSON.stringify(jsres) );
|
|
473
|
+
endexit();
|
|
474
|
+
}
|
|
475
|
+
jsres['res'] = true;
|
|
476
|
+
jsres['efrow'] = results.affectedRows;
|
|
477
|
+
console.log( JSON.stringify(jsres) );
|
|
478
|
+
endexit();
|
|
479
|
+
});
|
|
480
|
+
};
|
|
481
|
+
function getusersdevice(){
|
|
482
|
+
var sqline = 'SELECT * FROM sbox_device_info where user_id = \'@userid\';';
|
|
483
|
+
sqline = sqline.replace("@userid",request.userid);
|
|
484
|
+
connection.query(sqline,function(error, results, fields){
|
|
485
|
+
if(error != null ){
|
|
486
|
+
endexit();
|
|
487
|
+
}
|
|
488
|
+
jsres['data'] = results;
|
|
489
|
+
jsres['res'] = true;
|
|
490
|
+
console.log(JSON.stringify(jsres));
|
|
491
|
+
endexit();
|
|
492
|
+
});
|
|
493
|
+
};
|
|
494
|
+
function getusersinfo(){
|
|
495
|
+
connection.query("SELECT * FROM sbox_users;",function(error, results, fields){
|
|
496
|
+
|
|
497
|
+
if(error != null ){
|
|
498
|
+
endexit();
|
|
499
|
+
}
|
|
500
|
+
var obary = [];
|
|
501
|
+
for(var line in results){
|
|
502
|
+
var obj = {};
|
|
503
|
+
obj.id = results[line].id;
|
|
504
|
+
obj.user_name = results[line].user_name;
|
|
505
|
+
obj.master_id = results[line].master_id;
|
|
506
|
+
obj.ctime = results[line].ctime;
|
|
507
|
+
obj.nickname = results[line].nickname;
|
|
508
|
+
obj.user_level = results[line].user_level;
|
|
509
|
+
obj.user_type = results[line].user_type;
|
|
510
|
+
obj.status = results[line].status;
|
|
511
|
+
obj.token = results[line].token;
|
|
512
|
+
obj.qianfei = results[line].qianfei;
|
|
513
|
+
obj.cdnpath = results[line].cdnpath;
|
|
514
|
+
obj.jiankong = results[line].jiankong;
|
|
515
|
+
obj.mask = results[line].mask;
|
|
516
|
+
obary.push(obj);
|
|
517
|
+
};
|
|
518
|
+
jsres['data'] = obary;
|
|
519
|
+
jsres['res'] = true;
|
|
520
|
+
console.log(JSON.stringify(jsres));
|
|
521
|
+
endexit();
|
|
522
|
+
});
|
|
523
|
+
}
|
|
524
|
+
function endexit(){
|
|
525
|
+
if(jsonstr.sqlme.sqlmedbk == 1){
|
|
526
|
+
connection.end();
|
|
527
|
+
}
|
|
528
|
+
process.exit();
|
|
529
529
|
}
|