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
4de7ea92
Commit
4de7ea92
authored
Oct 19, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 代码规范
parent
386e8673
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
277 additions
and
213 deletions
+277
-213
icp-deliver/app/base/api/impl/meta/oss.js
+5
-6
icp-deliver/app/base/controller/ctl.base.js
+0
-1
icp-deliver/app/base/controller/impl/auth/userCtl.js
+0
-3
icp-deliver/app/base/controller/impl/common/cachsearchesCtl.js
+6
-3
icp-deliver/app/base/controller/impl/common/oplogCtl.js
+6
-3
icp-deliver/app/base/controller/impl/common/socketNotifyCtl.js
+0
-2
icp-deliver/app/base/controller/impl/common/uploadCtl.js
+5
-5
icp-deliver/app/base/controller/impl/delivery/materialCtl.js
+12
-3
icp-deliver/app/base/db/cache/vcodeCache.js
+2
-1
icp-deliver/app/base/db/impl/auth/roleDao.js
+4
-3
icp-deliver/app/base/db/impl/auth/userDao.js
+4
-11
icp-deliver/app/base/db/impl/delivery/deliverDao.js
+8
-4
icp-deliver/app/base/db/impl/msg/msgnoticeDao.js
+2
-2
icp-deliver/app/base/service/impl/auth/authSve.js
+19
-5
icp-deliver/app/base/service/impl/auth/orgSve.js
+2
-2
icp-deliver/app/base/service/impl/auth/userSve.js
+15
-12
icp-deliver/app/base/service/impl/bizchance/schemeSve.js
+15
-7
icp-deliver/app/base/service/impl/common/appSve.js
+2
-2
icp-deliver/app/base/service/impl/common/cachsearchesSve.js
+13
-11
icp-deliver/app/base/service/impl/common/companySve.js
+11
-1
icp-deliver/app/base/service/impl/common/routeSve.js
+8
-1
icp-deliver/app/base/service/impl/delivery/deliverSve.js
+10
-2
icp-deliver/app/base/service/sve.base.js
+4
-3
icp-deliver/app/base/system.js
+1
-1
icp-deliver/app/base/utils/excelClient.js
+3
-3
icp-deliver/app/base/utils/logClient.js
+0
-2
icp-deliver/app/base/utils/redisClient.js
+1
-1
icp-deliver/app/base/utils/smsClient.js
+5
-2
icp-deliver/app/base/utils/totxClient.js
+3
-1
icp-deliver/app/config/environment.js
+1
-1
icp-deliver/app/config/routes/api.js
+2
-2
icp-deliver/app/config/routes/web.js
+1
-1
icp-deliver/dochelp/imghandle.js
+16
-15
icp-deliver/gulpfile.js
+80
-80
icp-deliver/main.js
+11
-11
No files found.
icp-deliver/app/base/api/impl/meta/oss.js
View file @
4de7ea92
...
@@ -34,19 +34,18 @@ class OSSAPI extends APIBase {
...
@@ -34,19 +34,18 @@ class OSSAPI extends APIBase {
};
};
return
system
.
getResult
(
data
);
return
system
.
getResult
(
data
);
}
;
}
async
upfile
(
srckey
,
dest
)
{
async
upfile
(
srckey
,
dest
)
{
const
oss
=
System
.
getObject
(
'util.ossClient'
);
const
oss
=
System
.
getObject
(
'util.ossClient'
);
const
result
=
await
oss
.
upfile
(
srckey
,
`/tmp/
${
dest
}
`
);
const
result
=
await
oss
.
upfile
(
srckey
,
`/tmp/
${
dest
}
`
);
return
result
;
return
result
;
}
;
}
async
downfile
(
srckey
)
{
async
downfile
(
srckey
)
{
const
oss
=
System
.
getObject
(
'util.ossClient'
);
const
oss
=
System
.
getObject
(
'util.ossClient'
);
var
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
{
let
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
{
downfile
=
`/tmp/
${
srckey
}
`
;
return
`/tmp/
${
srckey
}
`
;
return
downfile
;
});
});
return
downfile
;
return
downfile
;
}
;
}
}
}
module
.
exports
=
OSSAPI
;
module
.
exports
=
OSSAPI
;
icp-deliver/app/base/controller/ctl.base.js
View file @
4de7ea92
...
@@ -47,7 +47,6 @@ class CtlBase {
...
@@ -47,7 +47,6 @@ class CtlBase {
password
:
custtags
?
custtags
[
lastindex
].
split
(
'_'
)[
1
]
:
null
,
password
:
custtags
?
custtags
[
lastindex
].
split
(
'_'
)[
1
]
:
null
,
username
:
req
.
headers
[
'x-consumer-username'
],
username
:
req
.
headers
[
'x-consumer-username'
],
userid
:
req
.
headers
[
'x-consumer-custom-id'
],
userid
:
req
.
headers
[
'x-consumer-custom-id'
],
username
:
req
.
headers
[
'x-consumer-username'
],
credid
:
req
.
headers
[
'x-credential-identifier'
],
credid
:
req
.
headers
[
'x-credential-identifier'
],
regrole
:
req
.
headers
.
xregrole
,
regrole
:
req
.
headers
.
xregrole
,
bizpath
:
req
.
headers
.
xbizpath
,
bizpath
:
req
.
headers
.
xbizpath
,
...
...
icp-deliver/app/base/controller/impl/auth/userCtl.js
View file @
4de7ea92
...
@@ -27,9 +27,6 @@ class UserCtl extends CtlBase {
...
@@ -27,9 +27,6 @@ class UserCtl extends CtlBase {
// let v = await this.smsS.sendVCode(mobile);
// let v = await this.smsS.sendVCode(mobile);
// return system.getResult({ vcodestr: v });
// return system.getResult({ vcodestr: v });
// }
// }
async
exit
(
pobj
,
qobj
,
req
)
{
}
// 应用的自由用户注册,无需验证,需要前端头设置公司KEY
// 应用的自由用户注册,无需验证,需要前端头设置公司KEY
async
pmregisterByFreeUser
(
p
,
q
,
req
)
{
async
pmregisterByFreeUser
(
p
,
q
,
req
)
{
// 检查是否有用户名和密码
// 检查是否有用户名和密码
...
...
icp-deliver/app/base/controller/impl/common/cachsearchesCtl.js
View file @
4de7ea92
...
@@ -12,15 +12,18 @@ class CachSearchesCtl extends CtlBase {
...
@@ -12,15 +12,18 @@ class CachSearchesCtl extends CtlBase {
async
findAndCountAll
(
pobj
,
gobj
,
req
)
{
async
findAndCountAll
(
pobj
,
gobj
,
req
)
{
pobj
.
opCacheUrl
=
req
.
session
.
app
.
opCacheUrl
;
pobj
.
opCacheUrl
=
req
.
session
.
app
.
opCacheUrl
;
pobj
.
appid
=
req
.
appid
;
pobj
.
appid
=
req
.
appid
;
return
await
this
.
service
.
findAndCountAllCache
(
pobj
);
let
result
=
await
this
.
service
.
findAndCountAllCache
(
pobj
);
return
result
;
}
}
async
delCache
(
queryobj
,
qobj
,
req
)
{
async
delCache
(
queryobj
,
qobj
,
req
)
{
const
param
=
{
key
:
queryobj
.
key
,
appid
:
req
.
appid
,
opCacheUrl
:
req
.
session
.
app
.
opCacheUrl
};
const
param
=
{
key
:
queryobj
.
key
,
appid
:
req
.
appid
,
opCacheUrl
:
req
.
session
.
app
.
opCacheUrl
};
return
await
this
.
service
.
delCache
(
param
);
let
result
=
await
this
.
service
.
delCache
(
param
);
return
result
;
}
}
async
clearAllCache
(
queryobj
,
qobj
,
req
)
{
async
clearAllCache
(
queryobj
,
qobj
,
req
)
{
const
param
=
{
appid
:
req
.
appid
,
opCacheUrl
:
req
.
session
.
app
.
opCacheUrl
};
const
param
=
{
appid
:
req
.
appid
,
opCacheUrl
:
req
.
session
.
app
.
opCacheUrl
};
return
await
this
.
service
.
clearAllCache
(
param
);
let
result
=
await
this
.
service
.
clearAllCache
(
param
);
return
result
;
}
}
}
}
module
.
exports
=
CachSearchesCtl
;
module
.
exports
=
CachSearchesCtl
;
icp-deliver/app/base/controller/impl/common/oplogCtl.js
View file @
4de7ea92
...
@@ -40,7 +40,7 @@ class OplogCtl extends CtlBase {
...
@@ -40,7 +40,7 @@ class OplogCtl extends CtlBase {
返回20位业务订单号
返回20位业务订单号
prefix:业务前缀
prefix:业务前缀
*/
*/
async
getBusUid_
Ctl
(
prefix
)
{
async
getBusUid
Ctl
(
prefix
)
{
prefix
=
(
prefix
||
''
);
prefix
=
(
prefix
||
''
);
if
(
prefix
)
{
if
(
prefix
)
{
prefix
=
prefix
.
toUpperCase
();
prefix
=
prefix
.
toUpperCase
();
...
@@ -58,7 +58,7 @@ prefix:业务前缀
...
@@ -58,7 +58,7 @@ prefix:业务前缀
len:返回长度
len:返回长度
radix:参与计算的长度,最大为62
radix:参与计算的长度,最大为62
*/
*/
async
getUidInfo_
Ctl
(
len
,
radix
)
{
async
getUidInfo
Ctl
(
len
,
radix
)
{
const
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
// 长度62,到yz长度为长36
const
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
// 长度62,到yz长度为长36
const
uuid
=
[];
let
i
;
const
uuid
=
[];
let
i
;
radix
=
radix
||
chars
.
length
;
radix
=
radix
||
chars
.
length
;
...
@@ -66,7 +66,10 @@ prefix:业务前缀
...
@@ -66,7 +66,10 @@ prefix:业务前缀
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
}
else
{
let
r
;
let
r
;
uuid
[
8
]
=
uuid
[
13
]
=
uuid
[
18
]
=
uuid
[
23
]
=
'-'
;
uuid
[
23
]
=
'-'
;
uuid
[
18
]
=
uuid
[
23
];
uuid
[
13
]
=
uuid
[
18
];
uuid
[
8
]
=
uuid
[
13
];
uuid
[
14
]
=
'4'
;
uuid
[
14
]
=
'4'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
if
(
!
uuid
[
i
])
{
...
...
icp-deliver/app/base/controller/impl/common/socketNotifyCtl.js
View file @
4de7ea92
const
system
=
require
(
'../../../system'
);
const
system
=
require
(
'../../../system'
);
const
settings
=
require
(
'../../../../config/settings'
);
const
settings
=
require
(
'../../../../config/settings'
);
class
SocketNotifyCtl
{
class
SocketNotifyCtl
{
constructor
()
{
}
setSocketServer
(
s
)
{
setSocketServer
(
s
)
{
this
.
socketServer
=
s
;
this
.
socketServer
=
s
;
}
}
...
...
icp-deliver/app/base/controller/impl/common/uploadCtl.js
View file @
4de7ea92
...
@@ -38,12 +38,12 @@ class UploadCtl extends CtlBase {
...
@@ -38,12 +38,12 @@ class UploadCtl extends CtlBase {
};
};
return
data
;
return
data
;
}
;
}
async
upfile
(
srckey
,
dest
)
{
async
upfile
(
srckey
,
dest
)
{
const
oss
=
system
.
getObject
(
'util.ossClient'
);
const
oss
=
system
.
getObject
(
'util.ossClient'
);
const
result
=
await
oss
.
upfile
(
srckey
,
`/tmp/
${
dest
}
`
);
const
result
=
await
oss
.
upfile
(
srckey
,
`/tmp/
${
dest
}
`
);
return
result
;
return
result
;
}
;
}
async
downfile
(
srckey
)
{
async
downfile
(
srckey
)
{
const
oss
=
system
.
getObject
(
'util.ossClient'
);
const
oss
=
system
.
getObject
(
'util.ossClient'
);
var
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
{
var
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
{
...
@@ -51,7 +51,7 @@ class UploadCtl extends CtlBase {
...
@@ -51,7 +51,7 @@ class UploadCtl extends CtlBase {
return
downfile
;
return
downfile
;
});
});
return
downfile
;
return
downfile
;
}
;
}
async
pdf2html
(
obj
)
{
async
pdf2html
(
obj
)
{
const
srckey
=
obj
.
key
;
const
srckey
=
obj
.
key
;
const
downfile
=
await
this
.
downfile
(
srckey
);
const
downfile
=
await
this
.
downfile
(
srckey
);
...
@@ -62,10 +62,10 @@ class UploadCtl extends CtlBase {
...
@@ -62,10 +62,10 @@ class UploadCtl extends CtlBase {
fs
.
unlink
(
`/tmp/
${
srckey
}
`
);
fs
.
unlink
(
`/tmp/
${
srckey
}
`
);
const
result
=
await
this
.
upfile
(
`
${
srckey
.
split
(
'.pdf'
)[
0
]}
.html`
,
`
${
srckey
.
split
(
'.pdf'
)[
0
]}
.html`
);
const
result
=
await
this
.
upfile
(
`
${
srckey
.
split
(
'.pdf'
)[
0
]}
.html`
,
`
${
srckey
.
split
(
'.pdf'
)[
0
]}
.html`
);
return
result
.
url
;
return
result
.
url
;
}
;
}
async
insertToFile
(
path
)
{
async
insertToFile
(
path
)
{
const
cmd
=
`
${
this
.
cmdInsertToFilePattern
}
${
path
}
`
;
const
cmd
=
`
${
this
.
cmdInsertToFilePattern
}
${
path
}
`
;
return
await
this
.
restS
.
exec
(
cmd
);
return
await
this
.
restS
.
exec
(
cmd
);
}
;
}
}
}
module
.
exports
=
UploadCtl
;
module
.
exports
=
UploadCtl
;
icp-deliver/app/base/controller/impl/delivery/materialCtl.js
View file @
4de7ea92
...
@@ -24,7 +24,14 @@ class MaterialCtl extends CtlBase {
...
@@ -24,7 +24,14 @@ class MaterialCtl extends CtlBase {
const
type
=
item
.
deliver
.
product_code
;
const
type
=
item
.
deliver
.
product_code
;
const
{
proposerInfo
,
otherMaterialsInfo
,
implementationPlanInfo
,
safetyInfo
,
shareholderData
}
=
item
;
const
{
proposerInfo
,
otherMaterialsInfo
,
implementationPlanInfo
,
safetyInfo
,
shareholderData
}
=
item
;
const
{
businessLicense
,
businessInformation
,
principalInfo
,
contactInfo
}
=
proposerInfo
;
const
{
businessLicense
,
businessInformation
,
principalInfo
,
contactInfo
}
=
proposerInfo
;
const
{
webApp
,
targetUser
,
profitableWay
,
specialApproval
,
serviceProjectEdi
,
serviceProjectIcp
}
=
implementationPlanInfo
;
const
{
webApp
,
targetUser
,
profitableWay
,
specialApproval
,
serviceProjectEdi
,
serviceProjectIcp
}
=
implementationPlanInfo
;
// 1. id ,type
// 1. id ,type
// 2.注册认证
// 2.注册认证
...
@@ -115,7 +122,8 @@ class MaterialCtl extends CtlBase {
...
@@ -115,7 +122,8 @@ class MaterialCtl extends CtlBase {
};
};
// 专项审批项目 ICP
// 专项审批项目 ICP
if
(
type
===
'ICP'
)
{
if
(
type
===
'ICP'
)
{
implementationPlanData
.
files
.
push
(...
specialApproval
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
implementationPlanData
.
files
.
push
(
...
specialApproval
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
file
:
item
.
file
,
file
:
item
.
file
,
title
:
`专项审批项-
${
item
.
title
}
`
,
title
:
`专项审批项-
${
item
.
title
}
`
,
})));
})));
...
@@ -123,7 +131,8 @@ class MaterialCtl extends CtlBase {
...
@@ -123,7 +131,8 @@ class MaterialCtl extends CtlBase {
implementationPlanData
.
files
.
push
(...
otherMaterialsInfo
.
filter
(
item
=>
item
.
title
===
'域名证书'
));
implementationPlanData
.
files
.
push
(...
otherMaterialsInfo
.
filter
(
item
=>
item
.
title
===
'域名证书'
));
if
(
type
===
'EDI'
)
{
if
(
type
===
'EDI'
)
{
implementationPlanData
.
files
.
push
(...
serviceProjectEdi
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
implementationPlanData
.
files
.
push
(
...
serviceProjectEdi
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
title
:
item
.
title
,
title
:
item
.
title
,
file
:
item
.
file
,
file
:
item
.
file
,
})));
})));
...
...
icp-deliver/app/base/db/cache/vcodeCache.js
View file @
4de7ea92
...
@@ -24,7 +24,8 @@ class VCodeCache extends CacheBase {
...
@@ -24,7 +24,8 @@ class VCodeCache extends CacheBase {
const
vcode
=
await
this
.
smsUtil
.
getUidStr
(
6
,
10
);
const
vcode
=
await
this
.
smsUtil
.
getUidStr
(
6
,
10
);
if
(
!
tmplCode
&&
!
signName
)
{
if
(
!
tmplCode
&&
!
signName
)
{
this
.
smsUtil
.
sendMsg
(
mobile
,
vcode
);
this
.
smsUtil
.
sendMsg
(
mobile
,
vcode
);
}
// tmplCode为发送短信编码,需在阿里开通,signName为短信头描述信息,二者没有传递则用默认的发送验证码
}
// tmplCode为发送短信编码,需在阿里开通,signName为短信头描述信息,二者没有传递则用默认的发送验证码
else
{
else
{
this
.
smsUtil
.
aliSendMsg
(
mobile
,
tmplCode
,
signName
,
JSON
.
stringify
({
code
:
vcode
}));
this
.
smsUtil
.
aliSendMsg
(
mobile
,
tmplCode
,
signName
,
JSON
.
stringify
({
code
:
vcode
}));
}
}
...
...
icp-deliver/app/base/db/impl/auth/roleDao.js
View file @
4de7ea92
...
@@ -38,11 +38,12 @@ class RoleDao extends Dao {
...
@@ -38,11 +38,12 @@ class RoleDao extends Dao {
const
self
=
this
;
const
self
=
this
;
const
u2
=
await
this
.
preCreate
(
u
);
const
u2
=
await
this
.
preCreate
(
u
);
if
(
t
)
{
if
(
t
)
{
var
role
=
await
this
.
model
.
create
(
u2
,
{
transaction
:
t
});
let
role
=
await
this
.
model
.
create
(
u2
,
{
transaction
:
t
});
return
role
;
return
role
;
}
}
else
{
var
role
=
await
this
.
model
.
create
(
u2
);
let
role
=
await
this
.
model
.
create
(
u2
);
return
role
;
return
role
;
}
}
}
}
}
module
.
exports
=
RoleDao
;
module
.
exports
=
RoleDao
;
icp-deliver/app/base/db/impl/auth/userDao.js
View file @
4de7ea92
...
@@ -22,8 +22,6 @@ class UserDao extends Dao {
...
@@ -22,8 +22,6 @@ class UserDao extends Dao {
const
tUser
=
await
this
.
model
.
findOne
({
const
tUser
=
await
this
.
model
.
findOne
({
where
:
{
userName
:
username
,
app_id
:
app
.
id
},
where
:
{
userName
:
username
,
app_id
:
app
.
id
},
include
:
[{
model
:
this
.
db
.
models
.
app
,
raw
:
true
},
include
:
[{
model
:
this
.
db
.
models
.
app
,
raw
:
true
},
// {model:this.db.models.partnerinfo,attributes:["id","user_id","app_id","userName","applyType","applyName","workPic","tagInfo","mobile","tel","applyProvince","applyCity",
// "applyArea","applyAddr","identityCardPic","identityCard","businessLicensePic","businessLicenseNum","entName","cardNo","realName"]},
{
model
:
this
.
db
.
models
.
account
,
attributes
:
[
'id'
,
'isSuper'
,
'referrerOnlyCode'
],
raw
:
true
},
{
model
:
this
.
db
.
models
.
account
,
attributes
:
[
'id'
,
'isSuper'
,
'referrerOnlyCode'
],
raw
:
true
},
{
{
model
:
this
.
db
.
models
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
model
:
this
.
db
.
models
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
...
@@ -43,8 +41,6 @@ class UserDao extends Dao {
...
@@ -43,8 +41,6 @@ class UserDao extends Dao {
let
tUser
=
await
this
.
model
.
findOne
({
let
tUser
=
await
this
.
model
.
findOne
({
where
:
{
openId
:
popenid
},
where
:
{
openId
:
popenid
},
include
:
[{
model
:
this
.
db
.
models
.
app
,
raw
:
true
},
include
:
[{
model
:
this
.
db
.
models
.
app
,
raw
:
true
},
// {model:this.db.models.partnerinfo,attributes:["id","user_id","app_id","userName","applyType","applyName","workPic","tagInfo","mobile","tel","applyProvince","applyCity",
// "applyArea","applyAddr","identityCardPic","identityCard","businessLicensePic","businessLicenseNum","entName","cardNo","realName"]},
{
model
:
this
.
db
.
models
.
account
,
attributes
:
[
'id'
,
'isSuper'
,
'referrerOnlyCode'
],
raw
:
true
},
{
model
:
this
.
db
.
models
.
account
,
attributes
:
[
'id'
,
'isSuper'
,
'referrerOnlyCode'
],
raw
:
true
},
{
{
model
:
this
.
db
.
models
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
model
:
this
.
db
.
models
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
...
@@ -57,21 +53,18 @@ class UserDao extends Dao {
...
@@ -57,21 +53,18 @@ class UserDao extends Dao {
tUser
=
tUser
.
get
({
plain
:
true
});
tUser
=
tUser
.
get
({
plain
:
true
});
tUser
.
partnerinfo
=
await
this
.
partnerinfoDao
.
model
.
findOne
({
where
:
{
onlyCode
:
tUser
.
onlyCode
},
raw
:
true
});
tUser
.
partnerinfo
=
await
this
.
partnerinfoDao
.
model
.
findOne
({
where
:
{
onlyCode
:
tUser
.
onlyCode
},
raw
:
true
});
}
}
// console.log("tUser.partnerinfo...................................>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>999sy");
// console.log(tUser);
return
tUser
;
return
tUser
;
}
}
async
setAccount
(
user
,
account
,
t
)
{
async
setAccount
(
user
,
account
,
t
)
{
var
user
=
await
user
.
setAccount
(
account
,
{
transaction
:
t
});
user
=
await
user
.
setAccount
(
account
,
{
transaction
:
t
});
return
user
;
return
user
;
}
}
async
setApp
(
user
,
app
,
t
)
{
async
setApp
(
user
,
app
,
t
)
{
// 按照APPId,获取app对象
// 按照APPId,获取app对象
var
user
=
await
user
.
setApp
(
app
,
{
transaction
:
t
});
user
=
await
user
.
setApp
(
app
,
{
transaction
:
t
});
return
user
;
return
user
;
}
}
extraModelFilter
()
{
extraModelFilter
()
{
// return {"key":"include","value":[{model:this.db.models.app,},{model:this.db.models.role,as:"Roles",attributes:["id","name"],joinTableAttributes:['created_at']}]};
return
{
key
:
'include'
,
value
:
[{
model
:
this
.
db
.
models
.
app
},
{
model
:
this
.
db
.
models
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'name'
]
}]
};
return
{
key
:
'include'
,
value
:
[{
model
:
this
.
db
.
models
.
app
},
{
model
:
this
.
db
.
models
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'name'
]
}]
};
}
}
extraWhere
(
obj
,
w
,
qc
,
linkAttrs
)
{
extraWhere
(
obj
,
w
,
qc
,
linkAttrs
)
{
...
@@ -129,8 +122,8 @@ class UserDao extends Dao {
...
@@ -129,8 +122,8 @@ class UserDao extends Dao {
}
}
// 修改用户(user表)公司的唯一码
// 修改用户(user表)公司的唯一码
async
putUserCompanyOnlyCode
(
userId
,
company
_only_c
ode
,
result
)
{
async
putUserCompanyOnlyCode
(
userId
,
company
OnlyC
ode
,
result
)
{
const
customerObj
=
{
companyOnlyCode
:
company
_only_c
ode
};
const
customerObj
=
{
companyOnlyCode
:
company
OnlyC
ode
};
const
putSqlWhere
=
{
where
:
{
id
:
userId
}
};
const
putSqlWhere
=
{
where
:
{
id
:
userId
}
};
this
.
updateByWhere
(
customerObj
,
putSqlWhere
);
this
.
updateByWhere
(
customerObj
,
putSqlWhere
);
return
result
;
return
result
;
...
...
icp-deliver/app/base/db/impl/delivery/deliverDao.js
View file @
4de7ea92
...
@@ -28,7 +28,10 @@ class DeliverDao extends Dao {
...
@@ -28,7 +28,10 @@ class DeliverDao extends Dao {
qc
.
raw
=
true
;
qc
.
raw
=
true
;
const
type
=
qobj
.
bizpath
.
split
(
'/'
)[
1
];
const
type
=
qobj
.
bizpath
.
split
(
'/'
)[
1
];
if
(
type
===
'deliveryManagement'
)
{
if
(
type
===
'deliveryManagement'
)
{
qc
.
where
.
product_code
=
product_code
&&
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
].
includes
(
product_code
)
?
product_code
:
{
qc
.
where
.
product_code
=
(
product_code
&&
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
].
includes
(
product_code
))
?
product_code
:
{
$in
:
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
],
$in
:
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
],
};
};
...
@@ -55,7 +58,10 @@ class DeliverDao extends Dao {
...
@@ -55,7 +58,10 @@ class DeliverDao extends Dao {
break
;
break
;
}
}
}
else
if
(
type
===
'annualReport'
)
{
}
else
if
(
type
===
'annualReport'
)
{
qc
.
where
.
product_code
=
product_code
&&
[
system
.
SERVICECODE
.
ICPANNUALREPORT
,
system
.
SERVICECODE
.
EDIANNUALREPORT
].
includes
(
product_code
)
?
product_code
:
{
qc
.
where
.
product_code
=
(
product_code
&&
[
system
.
SERVICECODE
.
ICPANNUALREPORT
,
system
.
SERVICECODE
.
EDIANNUALREPORT
].
includes
(
product_code
))
?
product_code
:
{
$in
:
[
system
.
SERVICECODE
.
EDIANNUALREPORT
,
system
.
SERVICECODE
.
ICPANNUALREPORT
],
$in
:
[
system
.
SERVICECODE
.
EDIANNUALREPORT
,
system
.
SERVICECODE
.
ICPANNUALREPORT
],
};
};
...
@@ -114,7 +120,6 @@ class DeliverDao extends Dao {
...
@@ -114,7 +120,6 @@ class DeliverDao extends Dao {
include
:
[
include
:
[
{
{
model
:
this
.
db
.
models
.
qualification
,
model
:
this
.
db
.
models
.
qualification
,
// attributes: ['id', 'certificateNumber', 'businessTypes', 'businessScope', 'serviceProject', 'startAt', 'endAt', 'file'],
raw
:
false
,
raw
:
false
,
},
{
},
{
model
:
this
.
db
.
models
.
material
,
model
:
this
.
db
.
models
.
material
,
...
@@ -133,7 +138,6 @@ class DeliverDao extends Dao {
...
@@ -133,7 +138,6 @@ class DeliverDao extends Dao {
include
:
[
include
:
[
{
{
model
:
this
.
db
.
models
.
annualreport
,
model
:
this
.
db
.
models
.
annualreport
,
// attributes: ['id', 'certificateNumber', 'businessTypes', 'businessScope', 'serviceProject', 'startAt', 'endAt', 'file'],
},
},
],
],
raw
:
false
,
raw
:
false
,
...
...
icp-deliver/app/base/db/impl/msg/msgnoticeDao.js
View file @
4de7ea92
...
@@ -8,7 +8,7 @@ class MsgNoticeDao extends Dao {
...
@@ -8,7 +8,7 @@ class MsgNoticeDao extends Dao {
async
saveNotice
(
msg
,
t
)
{
async
saveNotice
(
msg
,
t
)
{
let
noticeFrom
=
await
super
.
findOne
({
fromId
:
msg
.
senderId
,
toId
:
msg
.
targetId
});
let
noticeFrom
=
await
super
.
findOne
({
fromId
:
msg
.
senderId
,
toId
:
msg
.
targetId
});
if
(
noticeFrom
)
{
if
(
noticeFrom
)
{
var
set
=
{
lastMsgId
:
msg
.
id
};
let
set
=
{
lastMsgId
:
msg
.
id
};
if
(
msg
.
businessLicense_id
)
{
if
(
msg
.
businessLicense_id
)
{
set
.
businessLicense_id
=
msg
.
businessLicense_id
;
set
.
businessLicense_id
=
msg
.
businessLicense_id
;
}
}
...
@@ -28,7 +28,7 @@ class MsgNoticeDao extends Dao {
...
@@ -28,7 +28,7 @@ class MsgNoticeDao extends Dao {
let
noticeTo
=
await
super
.
findOne
({
fromId
:
msg
.
targetId
,
toId
:
msg
.
senderId
});
let
noticeTo
=
await
super
.
findOne
({
fromId
:
msg
.
targetId
,
toId
:
msg
.
senderId
});
if
(
noticeTo
)
{
if
(
noticeTo
)
{
var
set
=
{
lastMsgId
:
msg
.
id
};
let
set
=
{
lastMsgId
:
msg
.
id
};
if
(
msg
.
businessLicense_id
)
{
if
(
msg
.
businessLicense_id
)
{
set
.
businessLicense_id
=
msg
.
businessLicense_id
;
set
.
businessLicense_id
=
msg
.
businessLicense_id
;
}
}
...
...
icp-deliver/app/base/service/impl/auth/authSve.js
View file @
4de7ea92
...
@@ -11,7 +11,8 @@ class AuthService extends ServiceBase {
...
@@ -11,7 +11,8 @@ class AuthService extends ServiceBase {
// var newattrs=rolecodestr.split(",");
// var newattrs=rolecodestr.split(",");
const
aths
=
await
this
.
dao
.
model
.
findAll
({
const
aths
=
await
this
.
dao
.
model
.
findAll
({
attributes
:
[
'bizcode'
,
'authstrs'
,
'codepath'
],
attributes
:
[
'bizcode'
,
'authstrs'
,
'codepath'
],
where
:
{
role_id
:
{
[
this
.
db
.
Op
.
in
]:
roleids
},
app_id
:
appid
,
company_id
:
comid
}
});
where
:
{
role_id
:
{
[
this
.
db
.
Op
.
in
]:
roleids
},
app_id
:
appid
,
company_id
:
comid
}
});
return
aths
;
return
aths
;
}
}
async
saveAuths
(
auths
,
appid
,
cmid
)
{
async
saveAuths
(
auths
,
appid
,
cmid
)
{
...
@@ -20,8 +21,8 @@ class AuthService extends ServiceBase {
...
@@ -20,8 +21,8 @@ class AuthService extends ServiceBase {
console
.
log
(
'yyyyyyyyyvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv'
);
console
.
log
(
'yyyyyyyyyvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv'
);
console
.
log
(
auths
);
console
.
log
(
auths
);
return
self
.
db
.
transaction
(
async
(
t
)
=>
{
return
self
.
db
.
transaction
(
async
(
t
)
=>
{
for
(
let
i
=
0
;
i
<
auths
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
auths
.
length
;
i
++
)
{
var
tmpAuth
=
auths
[
i
];
let
tmpAuth
=
auths
[
i
];
tmpAuth
.
app_id
=
appid
;
tmpAuth
.
app_id
=
appid
;
tmpAuth
.
company_id
=
cmid
;
tmpAuth
.
company_id
=
cmid
;
const
objrtn
=
await
self
.
dao
.
model
.
findOrCreate
({
const
objrtn
=
await
self
.
dao
.
model
.
findOrCreate
({
...
@@ -33,10 +34,23 @@ class AuthService extends ServiceBase {
...
@@ -33,10 +34,23 @@ class AuthService extends ServiceBase {
console
.
log
(
objrtn
);
console
.
log
(
objrtn
);
if
(
!
objrtn
[
1
].
created
)
{
if
(
!
objrtn
[
1
].
created
)
{
// 就执行更新操作
// 就执行更新操作
await
objrtn
[
0
].
update
(
tmpAuth
,
{
where
:
{
role_id
:
tmpAuth
.
role_id
,
bizcode
:
tmpAuth
.
bizcode
},
transaction
:
t
});
await
objrtn
[
0
].
update
(
tmpAuth
,
{
where
:
{
role_id
:
tmpAuth
.
role_id
,
bizcode
:
tmpAuth
.
bizcode
},
transaction
:
t
});
}
}
}
}
const
aths
=
await
self
.
dao
.
model
.
findAll
({
where
:
{
role_id
:
tmpAuth
.
role_id
,
app_id
:
tmpAuth
.
app_id
},
transaction
:
t
});
const
aths
=
await
self
.
dao
.
model
.
findAll
({
where
:
{
role_id
:
tmpAuth
.
role_id
,
app_id
:
tmpAuth
.
app_id
},
transaction
:
t
});
return
aths
;
return
aths
;
});
});
}
}
...
...
icp-deliver/app/base/service/impl/auth/orgSve.js
View file @
4de7ea92
...
@@ -44,7 +44,7 @@ class OrgService extends ServiceBase {
...
@@ -44,7 +44,7 @@ class OrgService extends ServiceBase {
const
usersupdate
=
await
self
.
db
.
models
.
user
.
findAll
({
where
:
{
org_id
:
orgupdate
.
id
}
});
const
usersupdate
=
await
self
.
db
.
models
.
user
.
findAll
({
where
:
{
org_id
:
orgupdate
.
id
}
});
// 如果节点名称或岗位性质发生变化
// 如果节点名称或岗位性质发生变化
// if(p.name!=orgupdate.name || p.isMain!=orgupdate.isMain){
// if(p.name!=orgupdate.name || p.isMain!=orgupdate.isMain){
for
(
var
ud
of
usersupdate
)
{
for
(
let
ud
of
usersupdate
)
{
ud
.
opath
=
p
.
orgpath
;
ud
.
opath
=
p
.
orgpath
;
const
n
=
p
.
orgpath
.
lastIndexOf
(
'/'
);
const
n
=
p
.
orgpath
.
lastIndexOf
(
'/'
);
ud
.
ppath
=
p
.
isMain
?
p
.
orgpath
.
substring
(
0
,
n
)
:
p
.
orgpath
;
ud
.
ppath
=
p
.
isMain
?
p
.
orgpath
.
substring
(
0
,
n
)
:
p
.
orgpath
;
...
@@ -55,7 +55,7 @@ class OrgService extends ServiceBase {
...
@@ -55,7 +55,7 @@ class OrgService extends ServiceBase {
const
roles
=
await
self
.
db
.
models
.
role
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
p
.
Roles
}
}
});
const
roles
=
await
self
.
db
.
models
.
role
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
p
.
Roles
}
}
});
await
orgupdate
.
setRoles
(
roles
,
{
transaction
:
t
});
await
orgupdate
.
setRoles
(
roles
,
{
transaction
:
t
});
// 同时要给这个岗位下的user,更新角色 todo
// 同时要给这个岗位下的user,更新角色 todo
for
(
var
ud
of
usersupdate
)
{
for
(
let
ud
of
usersupdate
)
{
await
ud
.
setRoles
(
roles
,
{
transaction
:
t
});
await
ud
.
setRoles
(
roles
,
{
transaction
:
t
});
}
}
}
}
...
...
icp-deliver/app/base/service/impl/auth/userSve.js
View file @
4de7ea92
...
@@ -60,7 +60,14 @@ class UserService extends ServiceBase {
...
@@ -60,7 +60,14 @@ class UserService extends ServiceBase {
// 设置默认普通角色,由于有了租户概念,所以注册时,需要知道当前租户和应用的id 才可以设置默认角色 todo
// 设置默认普通角色,由于有了租户概念,所以注册时,需要知道当前租户和应用的id 才可以设置默认角色 todo
// 如果是非租户,那么按照当前应用ID是找不到指定的角色,所以是空的
// 如果是非租户,那么按照当前应用ID是找不到指定的角色,所以是空的
const
roles
=
await
self
.
roleDao
.
model
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
rolecodes
},
app_id
:
roleappid
,
company_id
:
p
.
company_id
},
transaction
:
t
});
const
roles
=
await
self
.
roleDao
.
model
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
rolecodes
},
app_id
:
roleappid
,
company_id
:
p
.
company_id
},
transaction
:
t
});
if
(
roles
&&
roles
.
length
>
0
)
{
if
(
roles
&&
roles
.
length
>
0
)
{
await
u
.
setRoles
(
roles
,
{
transaction
:
t
});
await
u
.
setRoles
(
roles
,
{
transaction
:
t
});
}
}
...
@@ -180,7 +187,13 @@ class UserService extends ServiceBase {
...
@@ -180,7 +187,13 @@ class UserService extends ServiceBase {
return
rtn
;
return
rtn
;
}
}
// 先按照用户名查续身份信息,获取key,secret,
// 先按照用户名查续身份信息,获取key,secret,
const
regrtn
=
await
this
.
pmregister
({
userName
:
mobile
,
nickName
:
mobile
,
rolecodes
:
p
.
rolecodes
,
company_id
:
p
.
company_id
,
app_id
:
p
.
app_id
});
const
regrtn
=
await
this
.
pmregister
({
userName
:
mobile
,
nickName
:
mobile
,
rolecodes
:
p
.
rolecodes
,
company_id
:
p
.
company_id
,
app_id
:
p
.
app_id
});
const
token
=
await
this
.
cmakejwt
(
regrtn
.
user
.
jwtkey
,
regrtn
.
user
.
jwtsecret
,
null
);
const
token
=
await
this
.
cmakejwt
(
regrtn
.
user
.
jwtkey
,
regrtn
.
user
.
jwtsecret
,
null
);
// rtn.token = token;
// rtn.token = token;
// rtn.user = u;
// rtn.user = u;
...
@@ -274,16 +287,6 @@ class UserService extends ServiceBase {
...
@@ -274,16 +287,6 @@ class UserService extends ServiceBase {
}
}
}
}
// 登录统一账号
async
clogin
(
uname
)
{
// 检查是否存在重名
}
// 按用户名查询统一用户
async
findCUser
(
uname
)
{
}
async
resetPassword
(
uname
,
pwd
)
{
async
resetPassword
(
uname
,
pwd
)
{
const
inpassword
=
this
.
getEncryptStr
(
pwd
);
const
inpassword
=
this
.
getEncryptStr
(
pwd
);
const
self
=
this
;
const
self
=
this
;
...
...
icp-deliver/app/base/service/impl/bizchance/schemeSve.js
View file @
4de7ea92
...
@@ -17,18 +17,26 @@ class SchemeService extends ServiceBase {
...
@@ -17,18 +17,26 @@ class SchemeService extends ServiceBase {
if
(
!
bizData
)
{
if
(
!
bizData
)
{
throw
new
Error
(
'查不到该商机'
);
throw
new
Error
(
'查不到该商机'
);
}
}
if
([
system
.
BUSSTATUS
.
CLOSED
,
system
.
BUSSTATUS
.
SUCCESS
,
system
.
BUSSTATUS
.
WAITINGCONFIRM
].
includes
(
bizData
.
business_status
))
{
if
([
system
.
BUSSTATUS
.
CLOSED
,
system
.
BUSSTATUS
.
SUCCESS
,
system
.
BUSSTATUS
.
WAITINGCONFIRM
].
includes
(
bizData
.
business_status
))
{
throw
new
Error
(
'此商机状态下不可操作'
);
throw
new
Error
(
'此商机状态下不可操作'
);
}
}
const
schemeData
=
await
this
.
dao
.
findOne
({
const
schemeData
=
await
this
.
dao
.
findOne
({
bizopt_id
:
data
.
bizopt_id
,
bizopt_id
:
data
.
bizopt_id
,
});
});
if
(
schemeData
&&
[
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
system
.
SCHEMESTATUS
.
CLOSED
].
includes
(
schemeData
.
scheme_status
))
{
if
(
schemeData
&&
[
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
system
.
SCHEMESTATUS
.
CLOSED
].
includes
(
schemeData
.
scheme_status
))
{
throw
new
Error
(
'此方案状态下不可操作'
);
throw
new
Error
(
'此方案状态下不可操作'
);
}
}
// scheme_number 提交到腾讯 获取更新 方案编号
// scheme_number 提交到腾讯 获取更新 方案编号
data
.
scheme_number
=
await
pushTx
.
pushScheme
(
bizData
,
schemeData
?
{
...
data
,
scheme_number
:
schemeData
.
scheme_number
}
:
data
);
data
.
scheme_number
=
await
pushTx
.
pushScheme
(
bizData
,
schemeData
?
{
...
data
,
scheme_number
:
schemeData
.
scheme_number
}
:
data
);
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
...
@@ -51,7 +59,7 @@ class SchemeService extends ServiceBase {
...
@@ -51,7 +59,7 @@ class SchemeService extends ServiceBase {
salesman_id
:
data
.
userid
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
,
salesman_name
:
data
.
username
,
});
});
let
scheme
_i
d
=
null
;
let
scheme
I
d
=
null
;
if
(
schemeData
)
{
if
(
schemeData
)
{
await
this
.
dao
.
updateByWhere
({
await
this
.
dao
.
updateByWhere
({
...
data
,
...
data
,
...
@@ -60,7 +68,7 @@ class SchemeService extends ServiceBase {
...
@@ -60,7 +68,7 @@ class SchemeService extends ServiceBase {
},
{
},
{
id
:
schemeData
.
id
,
id
:
schemeData
.
id
,
},
t
);
},
t
);
scheme
_i
d
=
schemeData
.
id
;
scheme
I
d
=
schemeData
.
id
;
}
else
{
}
else
{
const
schemeResult
=
await
this
.
dao
.
create
({
const
schemeResult
=
await
this
.
dao
.
create
({
...
data
,
...
data
,
...
@@ -68,11 +76,11 @@ class SchemeService extends ServiceBase {
...
@@ -68,11 +76,11 @@ class SchemeService extends ServiceBase {
scheme_status
:
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
scheme_status
:
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
bizopt_id
:
data
.
bizopt_id
,
bizopt_id
:
data
.
bizopt_id
,
},
t
);
},
t
);
scheme
_i
d
=
schemeResult
.
id
;
scheme
I
d
=
schemeResult
.
id
;
}
}
this
.
statuslogDao
.
create
({
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_id
:
scheme
_i
d
,
flow_id
:
scheme
I
d
,
status_code
:
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
status_code
:
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
salesman_id
:
data
.
userid
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
,
salesman_name
:
data
.
username
,
...
...
icp-deliver/app/base/service/impl/common/appSve.js
View file @
4de7ea92
...
@@ -14,7 +14,7 @@ class AppService extends ServiceBase {
...
@@ -14,7 +14,7 @@ class AppService extends ServiceBase {
const
app
=
this
.
cacheManager
.
AppCache
.
cache
(
p
.
appkey
,
null
);
const
app
=
this
.
cacheManager
.
AppCache
.
cache
(
p
.
appkey
,
null
);
return
app
;
return
app
;
}
}
async
upFrontRoute
(
jsonObject
,
app
_i
d
)
{
async
upFrontRoute
(
jsonObject
,
app
I
d
)
{
const
self
=
this
;
const
self
=
this
;
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
const
keyfile
=
`
${
self
.
getUUID
()}
.json`
;
const
keyfile
=
`
${
self
.
getUUID
()}
.json`
;
...
@@ -23,7 +23,7 @@ class AppService extends ServiceBase {
...
@@ -23,7 +23,7 @@ class AppService extends ServiceBase {
fs
.
writeFileSync
(
tmpdirfile
,
str
);
fs
.
writeFileSync
(
tmpdirfile
,
str
);
const
result
=
await
self
.
ossC
.
upfile
(
keyfile
,
tmpdirfile
);
const
result
=
await
self
.
ossC
.
upfile
(
keyfile
,
tmpdirfile
);
fs
.
unlinkSync
(
tmpdirfile
);
fs
.
unlinkSync
(
tmpdirfile
);
await
self
.
db
.
models
.
app
.
update
({
docUrl
:
result
.
url
,
id
:
app_id
},
{
where
:
{
id
:
app_i
d
},
transaction
:
t
});
await
self
.
db
.
models
.
app
.
update
({
docUrl
:
result
.
url
,
id
:
appId
},
{
where
:
{
id
:
appI
d
},
transaction
:
t
});
return
result
;
return
result
;
});
});
}
}
...
...
icp-deliver/app/base/service/impl/common/cachsearchesSve.js
View file @
4de7ea92
...
@@ -27,24 +27,24 @@ class CachSearchesSve {
...
@@ -27,24 +27,24 @@ class CachSearchesSve {
const
{
pageSize
}
=
obj
.
pageInfo
;
const
{
pageSize
}
=
obj
.
pageInfo
;
const
limit
=
pageSize
;
const
limit
=
pageSize
;
const
offset
=
(
pageNo
-
1
)
*
pageSize
;
const
offset
=
(
pageNo
-
1
)
*
pageSize
;
const
search
_n
ame
=
obj
.
search
&&
obj
.
search
.
name
?
obj
.
search
.
name
:
''
;
const
search
N
ame
=
obj
.
search
&&
obj
.
search
.
name
?
obj
.
search
.
name
:
''
;
const
cacheCacheKeyPrefix
=
`sadd_base_appkeys:
${
settings
.
appKey
}
_cachekey`
;
const
cacheCacheKeyPrefix
=
`sadd_base_appkeys:
${
settings
.
appKey
}
_cachekey`
;
if
(
obj
.
appid
==
settings
.
platformid
)
{
if
(
obj
.
appid
==
settings
.
platformid
)
{
let
cacheList
=
await
this
.
cacheManager
.
MagCache
.
getCacheSmembersByKey
(
cacheCacheKeyPrefix
);
let
cacheList
=
await
this
.
cacheManager
.
MagCache
.
getCacheSmembersByKey
(
cacheCacheKeyPrefix
);
if
(
search
_n
ame
)
{
if
(
search
N
ame
)
{
cacheList
=
cacheList
.
filter
(
f
=>
f
.
indexOf
(
search
_n
ame
)
>=
0
);
cacheList
=
cacheList
.
filter
(
f
=>
f
.
indexOf
(
search
N
ame
)
>=
0
);
}
}
const
pageValues
=
cacheList
.
slice
(
offset
,
offset
+
limit
);
const
pageValues
=
cacheList
.
slice
(
offset
,
offset
+
limit
);
const
kobjs
=
await
this
.
buildCacheRtn
(
pageValues
);
const
kobjs
=
await
this
.
buildCacheRtn
(
pageValues
);
var
tmpList
=
{
results
:
{
rows
:
kobjs
,
count
:
cacheList
.
length
}
};
const
tmpList
=
{
results
:
{
rows
:
kobjs
,
count
:
cacheList
.
length
}
};
return
system
.
getResult
(
tmpList
);
return
system
.
getResult
(
tmpList
);
}
}
const
body
=
{
const
body
=
{
pageInfo
:
obj
.
pageInfo
,
pageInfo
:
obj
.
pageInfo
,
search
:
obj
.
search
,
search
:
obj
.
search
,
};
};
var
tmpList
=
await
this
.
opOtherAppCache
(
'findAndCountAll'
,
body
,
obj
.
opCacheUrl
);
const
tmpList
=
await
this
.
opOtherAppCache
(
'findAndCountAll'
,
body
,
obj
.
opCacheUrl
);
return
tmpList
;
return
tmpList
;
}
}
async
delCache
(
obj
)
{
async
delCache
(
obj
)
{
...
@@ -60,7 +60,8 @@ class CachSearchesSve {
...
@@ -60,7 +60,8 @@ class CachSearchesSve {
const
body
=
{
const
body
=
{
del_cachekey
:
obj
.
key
,
del_cachekey
:
obj
.
key
,
};
};
return
await
this
.
opOtherAppCache
(
'delCache'
,
body
,
obj
.
opCacheUrl
);
const
result
=
await
this
.
opOtherAppCache
(
'delCache'
,
body
,
obj
.
opCacheUrl
);
return
result
;
}
}
}
}
async
clearAllCache
(
obj
)
{
async
clearAllCache
(
obj
)
{
...
@@ -68,24 +69,25 @@ class CachSearchesSve {
...
@@ -68,24 +69,25 @@ class CachSearchesSve {
await
this
.
cacheManager
.
MagCache
.
clearAll
();
await
this
.
cacheManager
.
MagCache
.
clearAll
();
return
{
status
:
0
};
return
{
status
:
0
};
}
}
return
await
this
.
opOtherAppCache
(
'clearAllCache'
,
{},
obj
.
opCacheUrl
);
const
result
=
await
this
.
opOtherAppCache
(
'clearAllCache'
,
{},
obj
.
opCacheUrl
);
return
result
;
}
}
// app调用次数
// app调用次数
async
findAndCountAlldetail
(
obj
)
{
async
findAndCountAlldetail
(
obj
)
{
const
apicallAccu
=
await
this
.
cacheManager
.
ApiAccuCache
.
getApiCallAccu
(
obj
);
const
apicallAccu
=
await
this
.
cacheManager
.
ApiAccuCache
.
getApiCallAccu
(
obj
);
const
result
=
{
rows
:
[],
count
:
0
};
const
result
=
{
rows
:
[],
count
:
0
};
const
keys
=
await
this
.
cacheManager
.
MagCache
.
keys
(
`api_call_
${
appkey
}
*`
);
const
keys
=
await
this
.
cacheManager
.
MagCache
.
keys
(
`api_call_
${
appkey
}
*`
);
var
detail
=
null
;
let
detail
=
null
;
for
(
let
j
=
0
;
j
<
keys
.
length
;
j
++
)
{
for
(
let
j
=
0
;
j
<
keys
.
length
;
j
++
)
{
const
d
=
keys
[
j
];
const
d
=
keys
[
j
];
const
pathdetail
=
d
.
substr
(
d
.
lastIndexOf
(
'_'
)
+
1
,
d
.
length
);
const
pathdetail
=
d
.
substr
(
d
.
lastIndexOf
(
'_'
)
+
1
,
d
.
length
);
const
apicalldetailAccu
=
await
this
.
cacheManager
.
ApiCallCountCache
.
getApiCallCount
(
appkey
,
pathdetail
);
const
apicalldetailAccu
=
await
this
.
cacheManager
.
ApiCallCountCache
.
getApiCallCount
(
appkey
,
pathdetail
);
var
detail
=
{
detailPath
:
d
,
detailCount
:
apicalldetailAccu
.
callcount
};
detail
=
{
detailPath
:
d
,
detailCount
:
apicalldetailAccu
.
callcount
};
}
}
result
.
rows
=
detail
;
result
.
rows
=
detail
;
}
}
// 操作别的应用的缓存
// 操作别的应用的缓存
async
opOtherAppCache
(
action
_t
ype
,
body
=
null
,
opCacheUrl
)
{
async
opOtherAppCache
(
action
T
ype
,
body
=
null
,
opCacheUrl
)
{
const
appData
=
await
this
.
authUtils
.
getTokenInfo
(
settings
.
appKey
,
settings
.
secret
);
const
appData
=
await
this
.
authUtils
.
getTokenInfo
(
settings
.
appKey
,
settings
.
secret
);
if
(
appData
.
status
!=
0
)
{
if
(
appData
.
status
!=
0
)
{
return
appData
;
return
appData
;
...
@@ -94,7 +96,7 @@ class CachSearchesSve {
...
@@ -94,7 +96,7 @@ class CachSearchesSve {
const
restS
=
await
system
.
getObject
(
'util.restClient'
);
const
restS
=
await
system
.
getObject
(
'util.restClient'
);
const
restResult
=
await
restS
.
execPostWithAK
(
const
restResult
=
await
restS
.
execPostWithAK
(
{
{
action
_t
ype
,
action
T
ype
,
body
,
body
,
},
},
opCacheUrl
,
appData
.
data
.
accessKey
,
opCacheUrl
,
appData
.
data
.
accessKey
,
...
...
icp-deliver/app/base/service/impl/common/companySve.js
View file @
4de7ea92
...
@@ -21,7 +21,17 @@ class CompanyService extends ServiceBase {
...
@@ -21,7 +21,17 @@ class CompanyService extends ServiceBase {
const
us
=
await
self
.
db
.
models
.
user
.
findAll
({
where
:
{
opath
:
opathstr
},
transaction
:
t
});
const
us
=
await
self
.
db
.
models
.
user
.
findAll
({
where
:
{
opath
:
opathstr
},
transaction
:
t
});
// 查询出角色
// 查询出角色
const
roleids
=
curNodeData
.
roles
;
const
roleids
=
curNodeData
.
roles
;
const
rs
=
await
self
.
db
.
models
.
role
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
roleids
},
app_id
:
p
.
app_id
,
company_id
:
p
.
company_id
},
transaction
:
t
});
const
rs
=
await
self
.
db
.
models
.
role
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
roleids
},
app_id
:
p
.
app_id
,
company_id
:
p
.
company_id
},
transaction
:
t
});
for
(
const
u
of
us
)
{
for
(
const
u
of
us
)
{
await
u
.
setRoles
(
rs
,
{
transaction
:
t
});
await
u
.
setRoles
(
rs
,
{
transaction
:
t
});
}
}
...
...
icp-deliver/app/base/service/impl/common/routeSve.js
View file @
4de7ea92
...
@@ -16,7 +16,14 @@ class RouteService extends ServiceBase {
...
@@ -16,7 +16,14 @@ class RouteService extends ServiceBase {
let
rtn
=
null
;
let
rtn
=
null
;
try
{
try
{
// 添加路由
// 添加路由
const
routeobj
=
await
self
.
cjsonregister
(
RouteService
.
newRouteUrl
(
serviceName
),
{
name
:
routedata
.
name
,
hosts
:
routedata
.
hosts
,
paths
:
routedata
.
paths
,
strip_path
:
routedata
.
isstrip
});
const
routeobj
=
await
self
.
cjsonregister
(
RouteService
.
newRouteUrl
(
serviceName
),
{
name
:
routedata
.
name
,
hosts
:
routedata
.
hosts
,
paths
:
routedata
.
paths
,
strip_path
:
routedata
.
isstrip
});
routedata
.
center_id
=
routeobj
.
id
;
routedata
.
center_id
=
routeobj
.
id
;
rtn
=
await
self
.
dao
.
create
(
routedata
,
t
);
rtn
=
await
self
.
dao
.
create
(
routedata
,
t
);
}
catch
(
e
)
{
}
catch
(
e
)
{
...
...
icp-deliver/app/base/service/impl/delivery/deliverSve.js
View file @
4de7ea92
...
@@ -186,7 +186,11 @@ class DeliverService extends ServiceBase {
...
@@ -186,7 +186,11 @@ class DeliverService extends ServiceBase {
if
(
!
deliverData
)
{
if
(
!
deliverData
)
{
throw
new
Error
(
'查不到交付单'
);
throw
new
Error
(
'查不到交付单'
);
}
}
if
(
!
[
system
.
SERVERSESTATUS
.
DISPOSEING
,
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
deliverData
.
delivery_status
))
{
if
(
!
[
system
.
SERVERSESTATUS
.
DISPOSEING
,
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
deliverData
.
delivery_status
)
)
{
throw
new
Error
(
'该交付单状态下不可提交'
);
throw
new
Error
(
'该交付单状态下不可提交'
);
}
}
if
([
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
deliverData
.
delivery_status
))
{
if
([
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
deliverData
.
delivery_status
))
{
...
@@ -346,7 +350,11 @@ class DeliverService extends ServiceBase {
...
@@ -346,7 +350,11 @@ class DeliverService extends ServiceBase {
if
(
!
result
.
qualification
)
{
if
(
!
result
.
qualification
)
{
throw
new
Error
(
'请先上传资质信息'
);
throw
new
Error
(
'请先上传资质信息'
);
}
}
if
(
!
[
system
.
SERVERSESTATUS
.
DISPOSEING
,
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
result
.
delivery_status
))
{
if
(
!
[
system
.
SERVERSESTATUS
.
DISPOSEING
,
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
result
.
delivery_status
)
)
{
throw
new
Error
(
'该状态下不可填写邮寄信息'
);
throw
new
Error
(
'该状态下不可填写邮寄信息'
);
}
}
const
{
material
}
=
result
;
const
{
material
}
=
result
;
...
...
icp-deliver/app/base/service/sve.base.js
View file @
4de7ea92
...
@@ -108,7 +108,10 @@ class ServiceBase {
...
@@ -108,7 +108,10 @@ class ServiceBase {
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
}
else
{
let
r
;
let
r
;
uuid
[
8
]
=
uuid
[
13
]
=
uuid
[
18
]
=
uuid
[
23
]
=
'-'
;
uuid
[
23
]
=
'-'
;
uuid
[
18
]
=
uuid
[
23
];
uuid
[
13
]
=
uuid
[
18
];
uuid
[
8
]
=
uuid
[
13
];
uuid
[
14
]
=
'4'
;
uuid
[
14
]
=
'4'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
if
(
!
uuid
[
i
])
{
...
@@ -154,8 +157,6 @@ class ServiceBase {
...
@@ -154,8 +157,6 @@ class ServiceBase {
return
rtn
.
data
;
return
rtn
.
data
;
}
}
throw
new
Error
(
rtn
.
data
);
throw
new
Error
(
rtn
.
data
);
return
null
;
}
catch
(
e
)
{
}
catch
(
e
)
{
console
.
log
(
e
);
console
.
log
(
e
);
return
null
;
return
null
;
...
...
icp-deliver/app/base/system.js
View file @
4de7ea92
...
@@ -244,7 +244,7 @@ class System {
...
@@ -244,7 +244,7 @@ class System {
const
configValue
=
require
(
configPath
);
const
configValue
=
require
(
configPath
);
return
configValue
.
config
;
return
configValue
.
config
;
}
}
static
get
_client_i
p
(
req
)
{
static
get
ClientI
p
(
req
)
{
const
ip
=
req
.
headers
[
'x-forwarded-for'
]
const
ip
=
req
.
headers
[
'x-forwarded-for'
]
||
req
.
ip
||
req
.
ip
||
req
.
connection
.
remoteAddress
||
req
.
connection
.
remoteAddress
...
...
icp-deliver/app/base/utils/excelClient.js
View file @
4de7ea92
...
@@ -49,8 +49,8 @@ class ExcelClient {
...
@@ -49,8 +49,8 @@ class ExcelClient {
wb
.
xlsx
.
writeFile
(
filePath
).
then
(
async
(
d
)
=>
{
wb
.
xlsx
.
writeFile
(
filePath
).
then
(
async
(
d
)
=>
{
const
rtn
=
await
self
.
ossClient
.
upfile
(
fileName
,
filePath
);
const
rtn
=
await
self
.
ossClient
.
upfile
(
fileName
,
filePath
);
fs
.
unlink
(
filePath
,
(
err
)
=>
{});
fs
.
unlink
(
filePath
,
(
err
)
=>
{
});
var
obj
=
{
let
obj
=
{
user_id
:
user
.
id
||
0
,
user_id
:
user
.
id
||
0
,
userName
:
user
.
userName
||
''
,
userName
:
user
.
userName
||
''
,
code
,
code
,
...
@@ -58,7 +58,7 @@ class ExcelClient {
...
@@ -58,7 +58,7 @@ class ExcelClient {
filePath
:
rtn
.
url
||
''
,
filePath
:
rtn
.
url
||
''
,
isDownload
:
false
,
isDownload
:
false
,
};
};
var
obj
=
await
self
.
filedownloadDao
.
create
(
obj
);
obj
=
await
self
.
filedownloadDao
.
create
(
obj
);
});
});
}
}
}
}
...
...
icp-deliver/app/base/utils/logClient.js
View file @
4de7ea92
...
@@ -3,8 +3,6 @@ const settings = require('../../config/settings');
...
@@ -3,8 +3,6 @@ const settings = require('../../config/settings');
const
uuidv4
=
require
(
'uuid/v4'
);
const
uuidv4
=
require
(
'uuid/v4'
);
const
system
=
require
(
'../system'
);
const
system
=
require
(
'../system'
);
class
LogClient
{
class
LogClient
{
constructor
()
{
}
getUUID
()
{
getUUID
()
{
const
uuid
=
uuidv4
();
const
uuid
=
uuidv4
();
const
u
=
uuid
.
replace
(
/
\-
/g
,
''
);
const
u
=
uuid
.
replace
(
/
\-
/g
,
''
);
...
...
icp-deliver/app/base/utils/redisClient.js
View file @
4de7ea92
...
@@ -88,7 +88,7 @@ class RedisClient {
...
@@ -88,7 +88,7 @@ class RedisClient {
}
}
if
(
self
.
chatserver
)
{
if
(
self
.
chatserver
)
{
if
(
channel
!=
'task'
)
{
if
(
channel
!=
'task'
)
{
var
message
=
JSON
.
parse
(
message
);
message
=
JSON
.
parse
(
message
);
console
.
log
(
message
,
'------------------------------------------ publish message'
);
console
.
log
(
message
,
'------------------------------------------ publish message'
);
if
(
channel
==
'brc'
)
{
// 如果是广播频道,则发送广播到客户端
if
(
channel
==
'brc'
)
{
// 如果是广播频道,则发送广播到客户端
self
.
chatserver
.
server
.
emit
(
'brc'
,
message
);
self
.
chatserver
.
server
.
emit
(
'brc'
,
message
);
...
...
icp-deliver/app/base/utils/smsClient.js
View file @
4de7ea92
...
@@ -38,7 +38,7 @@ class SmsClient {
...
@@ -38,7 +38,7 @@ class SmsClient {
};
};
return
this
.
restClient
.
execPost
(
txtObj
,
this
.
smsTeml
);
return
this
.
restClient
.
execPost
(
txtObj
,
this
.
smsTeml
);
}
}
async
getUidStr
(
len
,
radix
)
{
async
getUidStr
(
len
,
radix
)
{
const
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
const
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
const
uuid
=
[];
let
i
;
const
uuid
=
[];
let
i
;
radix
=
radix
||
chars
.
length
;
radix
=
radix
||
chars
.
length
;
...
@@ -46,7 +46,10 @@ class SmsClient {
...
@@ -46,7 +46,10 @@ class SmsClient {
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
}
else
{
let
r
;
let
r
;
uuid
[
8
]
=
uuid
[
13
]
=
uuid
[
18
]
=
uuid
[
23
]
=
'-'
;
uuid
[
23
]
=
'-'
;
uuid
[
18
]
=
uuid
[
23
];
uuid
[
13
]
=
uuid
[
18
];
uuid
[
8
]
=
uuid
[
13
];
uuid
[
14
]
=
'4'
;
uuid
[
14
]
=
'4'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
if
(
!
uuid
[
i
])
{
...
...
icp-deliver/app/base/utils/totxClient.js
View file @
4de7ea92
...
@@ -228,7 +228,9 @@ function buildValue(value, cryptStr) {
...
@@ -228,7 +228,9 @@ function buildValue(value, cryptStr) {
}));
}));
}
}
if
(
newValue
.
proposerInfo
.
businessInformation
)
{
if
(
newValue
.
proposerInfo
.
businessInformation
)
{
newValue
.
proposerInfo
.
businessInformation
.
fixedTelephone
=
cryptStr
(
newValue
.
proposerInfo
.
businessInformation
.
fixedTelephone
);
newValue
.
proposerInfo
.
businessInformation
.
fixedTelephone
=
cryptStr
(
newValue
.
proposerInfo
.
businessInformation
.
fixedTelephone
);
}
}
}
}
if
(
newValue
.
shareholderData
)
{
if
(
newValue
.
shareholderData
)
{
...
...
icp-deliver/app/config/environment.js
View file @
4de7ea92
...
@@ -23,7 +23,7 @@ module.exports = function (app) {
...
@@ -23,7 +23,7 @@ module.exports = function (app) {
routes
(
app
);
// 初始化路由
routes
(
app
);
// 初始化路由
app
.
use
(
express
.
static
(
path
.
join
(
settings
.
basepath
,
'/app/front/entry/public'
)));
app
.
use
(
express
.
static
(
path
.
join
(
settings
.
basepath
,
'/app/front/entry/public'
)));
// development only
// development only
if
(
'development'
==
app
.
get
(
'env'
)
)
{
if
(
app
.
get
(
'env'
)
==
'development'
)
{
app
.
use
(
errorHandler
());
app
.
use
(
errorHandler
());
}
else
{
}
else
{
app
.
use
((
err
,
req
,
res
)
=>
{
app
.
use
((
err
,
req
,
res
)
=>
{
...
...
icp-deliver/app/config/routes/api.js
View file @
4de7ea92
...
@@ -6,7 +6,7 @@ module.exports = function (app) {
...
@@ -6,7 +6,7 @@ module.exports = function (app) {
const
methodName
=
req
.
params
.
method
;
const
methodName
=
req
.
params
.
method
;
const
{
gname
}
=
req
.
params
;
const
{
gname
}
=
req
.
params
;
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
const
tClientIp
=
System
.
get
_client_i
p
(
req
);
const
tClientIp
=
System
.
get
ClientI
p
(
req
);
req
.
clientIp
=
tClientIp
;
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
'user-agent'
];
req
.
uagent
=
req
.
headers
[
'user-agent'
];
// req.classname=classPath;
// req.classname=classPath;
...
@@ -34,7 +34,7 @@ module.exports = function (app) {
...
@@ -34,7 +34,7 @@ module.exports = function (app) {
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
console
.
log
(
'===================='
);
console
.
log
(
'===================='
);
console
.
log
(
classPath
);
console
.
log
(
classPath
);
const
tClientIp
=
System
.
get
_client_i
p
(
req
);
const
tClientIp
=
System
.
get
ClientI
p
(
req
);
req
.
clientIp
=
tClientIp
;
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
'user-agent'
];
req
.
uagent
=
req
.
headers
[
'user-agent'
];
// req.classname=classPath;
// req.classname=classPath;
...
...
icp-deliver/app/config/routes/web.js
View file @
4de7ea92
...
@@ -28,7 +28,7 @@ module.exports = function (app) {
...
@@ -28,7 +28,7 @@ module.exports = function (app) {
const
{
gname
}
=
req
.
params
;
const
{
gname
}
=
req
.
params
;
const
params
=
[];
const
params
=
[];
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
const
tClientIp
=
system
.
get
_client_i
p
(
req
);
const
tClientIp
=
system
.
get
ClientI
p
(
req
);
req
.
body
.
clientIp
=
tClientIp
;
req
.
body
.
clientIp
=
tClientIp
;
req
.
body
.
agent
=
req
.
headers
[
'user-agent'
];
req
.
body
.
agent
=
req
.
headers
[
'user-agent'
];
req
.
body
.
classname
=
classPath
;
req
.
body
.
classname
=
classPath
;
...
...
icp-deliver/dochelp/imghandle.js
View file @
4de7ea92
var
fs
=
require
(
'fs'
);
const
fs
=
require
(
'fs'
);
// function to encode file data to base64 encoded string
// function to encode file data to base64 encoded string
function
base64_encode
(
file
)
{
function
base64_encode
(
file
)
{
// read binary data
// read binary data
var
bitmap
=
fs
.
readFileSync
(
"./imgs/sp.png"
);
const
bitmap
=
fs
.
readFileSync
(
"./imgs/sp.png"
);
// convert binary data to base64 encoded string
// convert binary data to base64 encoded string
var
bf
=
Buffer
.
alloc
(
bitmap
.
length
,
bitmap
);
const
bf
=
Buffer
.
alloc
(
bitmap
.
length
,
bitmap
);
return
bf
.
toString
(
'base64'
);
return
bf
.
toString
(
'base64'
);
}
}
// function to create file from base64 encoded string
// function to create file from base64 encoded string
function
base64_decode
(
base64str
,
file
)
{
function
base64_decode
(
base64str
,
file
)
{
// create buffer object from base64 encoded string, it is important to tell the constructor that the string is base64 encoded
// create buffer object from base64 encoded string, it is important to tell the constructor that the string is base64 encoded
var
bitmap
=
new
Buffer
(
base64str
,
'base64'
);
const
bitmap
=
new
Buffer
(
base64str
,
'base64'
);
// write buffer to file
// write buffer to file
fs
.
writeFileSync
(
file
,
bitmap
);
fs
.
writeFileSync
(
file
,
bitmap
);
console
.
log
(
'******** File created from base64 encoded string ********'
);
console
.
log
(
'******** File created from base64 encoded string ********'
);
}
}
function
getDataUrl
(
filepath
){
function
getDataUrl
(
filepath
)
{
var
str
=
base64_encode
(
filepath
);
const
str
=
base64_encode
(
filepath
);
var
mime
=
""
;
let
mime
=
""
;
if
(
filepath
.
indexOf
(
"png"
)
>=
0
)
{
if
(
filepath
.
indexOf
(
"png"
)
>=
0
)
{
mime
=
"image/png"
;
mime
=
"image/png"
;
}
}
if
(
filepath
.
indexOf
(
"jpg"
)
>=
0
||
filepath
.
indexOf
(
"jpeg"
)
>=
0
)
{
if
(
filepath
.
indexOf
(
"jpg"
)
>=
0
||
filepath
.
indexOf
(
"jpeg"
)
>=
0
)
{
mime
=
"image/jpg"
;
mime
=
"image/jpg"
;
}
}
if
(
filepath
.
indexOf
(
"gif"
)
>=
0
)
{
if
(
filepath
.
indexOf
(
"gif"
)
>=
0
)
{
mime
=
"image/gif"
;
mime
=
"image/gif"
;
}
}
var
dataurl
=
`data:
${
mime
}
;base64,`
+
str
;
const
dataurl
=
`data:
${
mime
}
;base64,`
+
str
;
return
dataurl
;
return
dataurl
;
}
}
var
str
=
getDataUrl
(
"./imgs/sp.png"
);
const
str
=
getDataUrl
(
"./imgs/sp.png"
);
console
.
log
(
str
);
console
.
log
(
str
);
\ No newline at end of file
icp-deliver/gulpfile.js
View file @
4de7ea92
This diff is collapsed.
Click to expand it.
icp-deliver/main.js
View file @
4de7ea92
var
http
=
require
(
'http'
);
const
http
=
require
(
'http'
);
var
express
=
require
(
'express'
);
const
express
=
require
(
'express'
);
var
app
=
express
();
const
app
=
express
();
var
setttings
=
require
(
"./app/config/settings"
);
const
setttings
=
require
(
"./app/config/settings"
);
var
environment
=
require
(
'./app/config/environment'
);
const
environment
=
require
(
'./app/config/environment'
);
//
var
SocketServer=require("./app/config/socket.server");
//
const
SocketServer=require("./app/config/socket.server");
//const cluster = require('cluster');
//const cluster = require('cluster');
//const numCPUs = require('os').cpus().length;
//const numCPUs = require('os').cpus().length;
// all environments
// all environments
...
@@ -20,15 +20,15 @@ environment(app);//初始化环境
...
@@ -20,15 +20,15 @@ environment(app);//初始化环境
// console.log(`worker ${worker.process.pid} died`);
// console.log(`worker ${worker.process.pid} died`);
// });
// });
// }else{
// }else{
//
var
server = http.createServer(app);
//
const
server = http.createServer(app);
//
var
socketServer = new SocketServer(server);
//
const
socketServer = new SocketServer(server);
// server.listen(setttings.port, function(){
// server.listen(setttings.port, function(){
// console.log('Express server listening on port ' + app.get('port'));
// console.log('Express server listening on port ' + app.get('port'));
// });
// });
// }
// }
var
server
=
http
.
createServer
(
app
);
const
server
=
http
.
createServer
(
app
);
//
var
socketServer = new SocketServer(server);
//
const
socketServer = new SocketServer(server);
server
.
listen
(
setttings
.
port
,
function
()
{
server
.
listen
(
setttings
.
port
,
function
()
{
console
.
log
(
'Express server listening on port '
+
app
.
get
(
'port'
));
console
.
log
(
'Express server listening on port '
+
app
.
get
(
'port'
));
});
});
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