Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zhichan
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
蒋勇
zhichan
Commits
5e1e00f2
Commit
5e1e00f2
authored
Feb 17, 2020
by
王昆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gsb
parent
73b49ae9
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
104 additions
and
8 deletions
+104
-8
laowubao/app/base/api/impl/operator/laoActionApi.js
+94
-0
laowubao/app/config/localsettings.js
+4
-8
laowubao/app/config/settings.js
+6
-0
No files found.
laowubao/app/base/api/impl/operator/laoActionApi.js
View file @
5e1e00f2
var
APIBase
=
require
(
"../../api.base"
);
var
system
=
require
(
"../../../system"
);
var
settings
=
require
(
"../../../../config/settings"
);
const
crypto
=
require
(
'crypto'
);
const
xlsx
=
require
(
'node-xlsx'
);
const
moment
=
require
(
"moment"
);
class
LaoActionApi
extends
APIBase
{
constructor
()
{
super
();
...
...
@@ -81,6 +84,97 @@ class LaoActionApi extends APIBase {
29
:
this
.
companyConfig
.
yd
,
30
:
this
.
companyConfig
.
tfb
}
}
async
testAES
(
pobj
)
{
let
str
=
"{a:1,b2:'2', c:333, d:
\"
北京公司宝
\"
}"
;
console
.
log
(
"str: "
+
str
);
let
encry
=
this
.
encryption
(
str
);
console
.
log
(
"encry: "
+
encry
);
let
decry
=
this
.
decryption
(
encry
);
console
.
log
(
"decry: "
+
decry
);
return
1
;
}
async
SmartLogin
(
obj
)
{
let
data
=
obj
.
data
||
""
;
if
(
!
data
)
{
return
system
.
getResult
(
-
1
,
`参数错误`
);
}
data
=
this
.
decryption
(
data
);
try
{
data
=
JSON
.
parse
(
data
);
if
(
!
data
.
mobile
)
{
return
system
.
getResult
(
-
1
,
`手机号码错误
${
data
.
mobile
}
`
);
}
if
(
!
data
.
companyName
)
{
return
system
.
getResult
(
-
1
,
`企业名称错误
${
data
.
companyName
}
`
);
}
var
parm
=
{
phone_no
:
data
.
mobile
}
var
result
=
await
this
.
usersSve
.
findUserInfoByPhone
(
parm
);
if
(
result
.
status
==
-
1
)
{
parm
=
{
phone_no
:
data
.
mobile
,
user_type
:
"招人方"
,
status_type
:
1
,
status_name
:
"正常"
,
reg_time
:
(
new
Date
()).
Format
(
"yyyy-MM-dd"
),
com_type
:
2
,
com_name
:
data
.
companyName
,
};
result
=
await
this
.
usersSve
.
SaveUserInfo
(
parm
);
}
var
user_id
=
result
.
data
.
id
;
//var user_id = 1;
parm
=
{
user_id
:
user_id
,
oper_type
:
0
,
oper_name
:
"发薪系统自动登录"
,
oper_date
:
(
new
Date
()).
Format
(
"yyyy-MM-dd hh:mm:ss"
)
};
await
this
.
logSve
.
SaveLogInfo
(
parm
);
return
result
;
}
catch
(
error
)
{
console
.
log
(
e
);
return
system
.
getResult
(
-
1
,
`a
${
data
}
解析错误`
);
}
}
encryption
(
data
)
{
if
(
!
data
)
{
return
""
;
}
let
AES_conf
=
settings
.
apiconfig
.
AES
;
let
key
=
AES_conf
.
key
;
let
iv
=
AES_conf
.
iv
;
// let padding = AES_conf.padding;
var
cipherChunks
=
[];
var
cipher
=
crypto
.
createCipheriv
(
'aes-128-cbc'
,
key
,
iv
);
cipher
.
setAutoPadding
(
true
);
cipherChunks
.
push
(
cipher
.
update
(
data
,
'utf8'
,
'base64'
));
cipherChunks
.
push
(
cipher
.
final
(
'base64'
));
return
cipherChunks
.
join
(
''
);
}
decryption
(
data
){
if
(
!
data
)
{
return
""
;
}
let
AES_conf
=
settings
.
apiconfig
.
AES
;
let
key
=
AES_conf
.
key
;
let
iv
=
AES_conf
.
iv
;
// let padding = AES_conf.padding;
var
cipherChunks
=
[];
var
decipher
=
crypto
.
createDecipheriv
(
'aes-128-cbc'
,
key
,
iv
);
decipher
.
setAutoPadding
(
true
);
cipherChunks
.
push
(
decipher
.
update
(
data
,
'base64'
,
'utf8'
));
cipherChunks
.
push
(
decipher
.
final
(
'utf8'
));
return
cipherChunks
.
join
(
''
);
}
async
test
(
pobj
,
query
)
{
...
...
laowubao/app/config/localsettings.js
View file @
5e1e00f2
...
...
@@ -9,19 +9,15 @@ var settings={
dbname
:
"laowubao"
,
// user : "root",
// password : "root",
// dbname : "laowubao",
user
:
"write"
,
password
:
"write"
,
config
:
{
host
:
'192.168.18.237'
,
// dbname : "laowubao",
// user: "write",
// password: "write",
// config: {
// host: '43.247.184.35',
port
:
3306
,
dialect
:
'mysql'
,
operatorsAliases
:
false
,
host
:
'43.247.184.35'
,
port
:
8899
,
// host: '192.168.18.237',
// port: 3306,
pool
:
{
max
:
5
,
min
:
0
,
...
...
laowubao/app/config/settings.js
View file @
5e1e00f2
...
...
@@ -235,6 +235,12 @@ var settings = {
bossWithdrawApplyingKey
:
function
()
{
//提现发放key
return
"3898EFhijklmCDEFGHIJKLMN"
;
},
AES
:
{
key
:
"qUPsMflPfgpPP1Ua"
,
//密钥
iv
:
'1012133205963708'
,
//偏移向量
padding
:
'PKCS7Padding'
//补全值
}
},
homePage
:
function
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment