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
Hide whitespace changes
Inline
Side-by-side
Showing
35 changed files
with
265 additions
and
201 deletions
+265
-201
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
+18
-9
icp-deliver/app/base/db/cache/vcodeCache.js
+2
-1
icp-deliver/app/base/db/impl/auth/roleDao.js
+5
-4
icp-deliver/app/base/db/impl/auth/userDao.js
+21
-28
icp-deliver/app/base/db/impl/delivery/deliverDao.js
+13
-9
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
+33
-33
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
+23
-22
icp-deliver/gulpfile.js
+0
-0
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 {
};
return
system
.
getResult
(
data
);
}
;
}
async
upfile
(
srckey
,
dest
)
{
const
oss
=
System
.
getObject
(
'util.ossClient'
);
const
result
=
await
oss
.
upfile
(
srckey
,
`/tmp/
${
dest
}
`
);
return
result
;
}
;
}
async
downfile
(
srckey
)
{
const
oss
=
System
.
getObject
(
'util.ossClient'
);
var
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
{
downfile
=
`/tmp/
${
srckey
}
`
;
return
downfile
;
let
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
{
return
`/tmp/
${
srckey
}
`
;
});
return
downfile
;
}
;
}
}
module
.
exports
=
OSSAPI
;
icp-deliver/app/base/controller/ctl.base.js
View file @
4de7ea92
...
...
@@ -47,7 +47,6 @@ class CtlBase {
password
:
custtags
?
custtags
[
lastindex
].
split
(
'_'
)[
1
]
:
null
,
username
:
req
.
headers
[
'x-consumer-username'
],
userid
:
req
.
headers
[
'x-consumer-custom-id'
],
username
:
req
.
headers
[
'x-consumer-username'
],
credid
:
req
.
headers
[
'x-credential-identifier'
],
regrole
:
req
.
headers
.
xregrole
,
bizpath
:
req
.
headers
.
xbizpath
,
...
...
icp-deliver/app/base/controller/impl/auth/userCtl.js
View file @
4de7ea92
...
...
@@ -27,9 +27,6 @@ class UserCtl extends CtlBase {
// let v = await this.smsS.sendVCode(mobile);
// return system.getResult({ vcodestr: v });
// }
async
exit
(
pobj
,
qobj
,
req
)
{
}
// 应用的自由用户注册,无需验证,需要前端头设置公司KEY
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 {
async
findAndCountAll
(
pobj
,
gobj
,
req
)
{
pobj
.
opCacheUrl
=
req
.
session
.
app
.
opCacheUrl
;
pobj
.
appid
=
req
.
appid
;
return
await
this
.
service
.
findAndCountAllCache
(
pobj
);
let
result
=
await
this
.
service
.
findAndCountAllCache
(
pobj
);
return
result
;
}
async
delCache
(
queryobj
,
qobj
,
req
)
{
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
)
{
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
;
icp-deliver/app/base/controller/impl/common/oplogCtl.js
View file @
4de7ea92
...
...
@@ -40,7 +40,7 @@ class OplogCtl extends CtlBase {
返回20位业务订单号
prefix:业务前缀
*/
async
getBusUid_
Ctl
(
prefix
)
{
async
getBusUid
Ctl
(
prefix
)
{
prefix
=
(
prefix
||
''
);
if
(
prefix
)
{
prefix
=
prefix
.
toUpperCase
();
...
...
@@ -58,7 +58,7 @@ prefix:业务前缀
len:返回长度
radix:参与计算的长度,最大为62
*/
async
getUidInfo_
Ctl
(
len
,
radix
)
{
async
getUidInfo
Ctl
(
len
,
radix
)
{
const
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
// 长度62,到yz长度为长36
const
uuid
=
[];
let
i
;
radix
=
radix
||
chars
.
length
;
...
...
@@ -66,7 +66,10 @@ prefix:业务前缀
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
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'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
...
...
icp-deliver/app/base/controller/impl/common/socketNotifyCtl.js
View file @
4de7ea92
const
system
=
require
(
'../../../system'
);
const
settings
=
require
(
'../../../../config/settings'
);
class
SocketNotifyCtl
{
constructor
()
{
}
setSocketServer
(
s
)
{
this
.
socketServer
=
s
;
}
...
...
icp-deliver/app/base/controller/impl/common/uploadCtl.js
View file @
4de7ea92
...
...
@@ -38,12 +38,12 @@ class UploadCtl extends CtlBase {
};
return
data
;
}
;
}
async
upfile
(
srckey
,
dest
)
{
const
oss
=
system
.
getObject
(
'util.ossClient'
);
const
result
=
await
oss
.
upfile
(
srckey
,
`/tmp/
${
dest
}
`
);
return
result
;
}
;
}
async
downfile
(
srckey
)
{
const
oss
=
system
.
getObject
(
'util.ossClient'
);
var
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
{
...
...
@@ -51,7 +51,7 @@ class UploadCtl extends CtlBase {
return
downfile
;
});
return
downfile
;
}
;
}
async
pdf2html
(
obj
)
{
const
srckey
=
obj
.
key
;
const
downfile
=
await
this
.
downfile
(
srckey
);
...
...
@@ -62,10 +62,10 @@ class UploadCtl extends CtlBase {
fs
.
unlink
(
`/tmp/
${
srckey
}
`
);
const
result
=
await
this
.
upfile
(
`
${
srckey
.
split
(
'.pdf'
)[
0
]}
.html`
,
`
${
srckey
.
split
(
'.pdf'
)[
0
]}
.html`
);
return
result
.
url
;
}
;
}
async
insertToFile
(
path
)
{
const
cmd
=
`
${
this
.
cmdInsertToFilePattern
}
${
path
}
`
;
return
await
this
.
restS
.
exec
(
cmd
);
}
;
}
}
module
.
exports
=
UploadCtl
;
icp-deliver/app/base/controller/impl/delivery/materialCtl.js
View file @
4de7ea92
...
...
@@ -24,7 +24,14 @@ class MaterialCtl extends CtlBase {
const
type
=
item
.
deliver
.
product_code
;
const
{
proposerInfo
,
otherMaterialsInfo
,
implementationPlanInfo
,
safetyInfo
,
shareholderData
}
=
item
;
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
// 2.注册认证
...
...
@@ -115,18 +122,20 @@ class MaterialCtl extends CtlBase {
};
// 专项审批项目 ICP
if
(
type
===
'ICP'
)
{
implementationPlanData
.
files
.
push
(...
specialApproval
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
file
:
item
.
file
,
title
:
`专项审批项-
${
item
.
title
}
`
,
})));
implementationPlanData
.
files
.
push
(
...
specialApproval
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
file
:
item
.
file
,
title
:
`专项审批项-
${
item
.
title
}
`
,
})));
}
implementationPlanData
.
files
.
push
(...
otherMaterialsInfo
.
filter
(
item
=>
item
.
title
===
'域名证书'
));
if
(
type
===
'EDI'
)
{
implementationPlanData
.
files
.
push
(...
serviceProjectEdi
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
title
:
item
.
title
,
file
:
item
.
file
,
})));
implementationPlanData
.
files
.
push
(
...
serviceProjectEdi
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
title
:
item
.
title
,
file
:
item
.
file
,
})));
}
// 4. 增值电信申请表
...
...
icp-deliver/app/base/db/cache/vcodeCache.js
View file @
4de7ea92
...
...
@@ -24,7 +24,8 @@ class VCodeCache extends CacheBase {
const
vcode
=
await
this
.
smsUtil
.
getUidStr
(
6
,
10
);
if
(
!
tmplCode
&&
!
signName
)
{
this
.
smsUtil
.
sendMsg
(
mobile
,
vcode
);
}
// tmplCode为发送短信编码,需在阿里开通,signName为短信头描述信息,二者没有传递则用默认的发送验证码
}
// tmplCode为发送短信编码,需在阿里开通,signName为短信头描述信息,二者没有传递则用默认的发送验证码
else
{
this
.
smsUtil
.
aliSendMsg
(
mobile
,
tmplCode
,
signName
,
JSON
.
stringify
({
code
:
vcode
}));
}
...
...
icp-deliver/app/base/db/impl/auth/roleDao.js
View file @
4de7ea92
...
...
@@ -5,7 +5,7 @@ class RoleDao extends Dao {
super
(
Dao
.
getModelName
(
RoleDao
));
}
async
findOne
(
paramappid
,
t
)
{
const
app
=
await
this
.
model
.
findOne
({
where
:
{
appid
:
paramappid
}
},
{
transaction
:
t
});
const
app
=
await
this
.
model
.
findOne
({
where
:
{
appid
:
paramappid
}
},
{
transaction
:
t
});
return
app
;
}
extraWhere
(
obj
,
w
,
qc
,
linkAttrs
)
{
...
...
@@ -38,11 +38,12 @@ class RoleDao extends Dao {
const
self
=
this
;
const
u2
=
await
this
.
preCreate
(
u
);
if
(
t
)
{
var
role
=
await
this
.
model
.
create
(
u2
,
{
transaction
:
t
});
let
role
=
await
this
.
model
.
create
(
u2
,
{
transaction
:
t
});
return
role
;
}
else
{
let
role
=
await
this
.
model
.
create
(
u2
);
return
role
;
}
var
role
=
await
this
.
model
.
create
(
u2
);
return
role
;
}
}
module
.
exports
=
RoleDao
;
icp-deliver/app/base/db/impl/auth/userDao.js
View file @
4de7ea92
...
...
@@ -9,11 +9,11 @@ class UserDao extends Dao {
return
this
.
model
.
findOne
({
where
:
{
id
:
userid
},
include
:
[{
model
:
self
.
db
.
models
.
account
,
attributes
:
[
'id'
,
'isSuper'
,
'referrerOnlyCode'
]
},
{
model
:
self
.
db
.
models
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
{
model
:
self
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
]
},
],
},
{
model
:
self
.
db
.
models
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
{
model
:
self
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
]
},
],
},
],
});
}
...
...
@@ -22,14 +22,12 @@ class UserDao extends Dao {
const
tUser
=
await
this
.
model
.
findOne
({
where
:
{
userName
:
username
,
app_id
:
app
.
id
},
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
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
{
model
:
this
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
],
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
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
],
raw
:
true
},
],
},
],
},
{
transaction
:
t
});
// if(tUser!=null){
...
...
@@ -43,35 +41,30 @@ class UserDao extends Dao {
let
tUser
=
await
this
.
model
.
findOne
({
where
:
{
openId
:
popenid
},
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
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
{
model
:
this
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
],
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
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
],
raw
:
true
},
],
},
],
},
{
transaction
:
t
});
if
(
tUser
!=
null
)
{
tUser
=
tUser
.
get
({
plain
:
true
});
tUser
.
partnerinfo
=
await
this
.
partnerinfoDao
.
model
.
findOne
({
where
:
{
onlyCode
:
tUser
.
onlyCode
},
raw
:
true
});
}
// console.log("tUser.partnerinfo...................................>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>999sy");
// console.log(tUser);
return
tUser
;
}
async
setAccount
(
user
,
account
,
t
)
{
var
user
=
await
user
.
setAccount
(
account
,
{
transaction
:
t
});
user
=
await
user
.
setAccount
(
account
,
{
transaction
:
t
});
return
user
;
}
async
setApp
(
user
,
app
,
t
)
{
// 按照APPId,获取app对象
var
user
=
await
user
.
setApp
(
app
,
{
transaction
:
t
});
user
=
await
user
.
setApp
(
app
,
{
transaction
:
t
});
return
user
;
}
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'
]
}]
};
}
extraWhere
(
obj
,
w
,
qc
,
linkAttrs
)
{
...
...
@@ -129,8 +122,8 @@ class UserDao extends Dao {
}
// 修改用户(user表)公司的唯一码
async
putUserCompanyOnlyCode
(
userId
,
company
_only_c
ode
,
result
)
{
const
customerObj
=
{
companyOnlyCode
:
company
_only_c
ode
};
async
putUserCompanyOnlyCode
(
userId
,
company
OnlyC
ode
,
result
)
{
const
customerObj
=
{
companyOnlyCode
:
company
OnlyC
ode
};
const
putSqlWhere
=
{
where
:
{
id
:
userId
}
};
this
.
updateByWhere
(
customerObj
,
putSqlWhere
);
return
result
;
...
...
icp-deliver/app/base/db/impl/delivery/deliverDao.js
View file @
4de7ea92
...
...
@@ -28,16 +28,19 @@ class DeliverDao extends Dao {
qc
.
raw
=
true
;
const
type
=
qobj
.
bizpath
.
split
(
'/'
)[
1
];
if
(
type
===
'deliveryManagement'
)
{
qc
.
where
.
product_code
=
product_code
&&
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
].
includes
(
product_code
)
?
product_code
:
{
$in
:
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
],
};
qc
.
where
.
product_code
=
(
product_code
&&
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
].
includes
(
product_code
))
?
product_code
:
{
$in
:
[
system
.
SERVICECODE
.
EDI
,
system
.
SERVICECODE
.
ICP
],
};
switch
(
qobj
.
bizpath
)
{
case
'/deliveryManagement/wait'
:
qc
.
where
.
delivery_status
=
qc
.
where
.
delivery_status
||
{
$in
:
[
system
.
SERVERSESTATUS
.
RECEIVED
,
system
.
SERVERSESTATUS
.
COLLECTING
,
system
.
SERVERSESTATUS
.
SUBMITING
,
system
.
SERVERSESTATUS
.
DISPOSEING
,
system
.
SERVERSESTATUS
.
POSTING
,
system
.
SERVERSESTATUS
.
SUBMITING
,
system
.
SERVERSESTATUS
.
DISPOSEING
,
system
.
SERVERSESTATUS
.
POSTING
,
],
};
break
;
...
...
@@ -55,9 +58,12 @@ class DeliverDao extends Dao {
break
;
}
}
else
if
(
type
===
'annualReport'
)
{
qc
.
where
.
product_code
=
product_code
&&
[
system
.
SERVICECODE
.
ICPANNUALREPORT
,
system
.
SERVICECODE
.
EDIANNUALREPORT
].
includes
(
product_code
)
?
product_code
:
{
$in
:
[
system
.
SERVICECODE
.
EDIANNUALREPORT
,
system
.
SERVICECODE
.
ICPANNUALREPORT
],
};
qc
.
where
.
product_code
=
(
product_code
&&
[
system
.
SERVICECODE
.
ICPANNUALREPORT
,
system
.
SERVICECODE
.
EDIANNUALREPORT
].
includes
(
product_code
))
?
product_code
:
{
$in
:
[
system
.
SERVICECODE
.
EDIANNUALREPORT
,
system
.
SERVICECODE
.
ICPANNUALREPORT
],
};
// ---- 兼容 年报 状态 未申报、已申报 start
let
status
;
...
...
@@ -114,7 +120,6 @@ class DeliverDao extends Dao {
include
:
[
{
model
:
this
.
db
.
models
.
qualification
,
// attributes: ['id', 'certificateNumber', 'businessTypes', 'businessScope', 'serviceProject', 'startAt', 'endAt', 'file'],
raw
:
false
,
},
{
model
:
this
.
db
.
models
.
material
,
...
...
@@ -133,7 +138,6 @@ class DeliverDao extends Dao {
include
:
[
{
model
:
this
.
db
.
models
.
annualreport
,
// attributes: ['id', 'certificateNumber', 'businessTypes', 'businessScope', 'serviceProject', 'startAt', 'endAt', 'file'],
},
],
raw
:
false
,
...
...
icp-deliver/app/base/db/impl/msg/msgnoticeDao.js
View file @
4de7ea92
...
...
@@ -8,7 +8,7 @@ class MsgNoticeDao extends Dao {
async
saveNotice
(
msg
,
t
)
{
let
noticeFrom
=
await
super
.
findOne
({
fromId
:
msg
.
senderId
,
toId
:
msg
.
targetId
});
if
(
noticeFrom
)
{
var
set
=
{
lastMsgId
:
msg
.
id
};
let
set
=
{
lastMsgId
:
msg
.
id
};
if
(
msg
.
businessLicense_id
)
{
set
.
businessLicense_id
=
msg
.
businessLicense_id
;
}
...
...
@@ -28,7 +28,7 @@ class MsgNoticeDao extends Dao {
let
noticeTo
=
await
super
.
findOne
({
fromId
:
msg
.
targetId
,
toId
:
msg
.
senderId
});
if
(
noticeTo
)
{
var
set
=
{
lastMsgId
:
msg
.
id
};
let
set
=
{
lastMsgId
:
msg
.
id
};
if
(
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 {
// var newattrs=rolecodestr.split(",");
const
aths
=
await
this
.
dao
.
model
.
findAll
({
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
;
}
async
saveAuths
(
auths
,
appid
,
cmid
)
{
...
...
@@ -20,8 +21,8 @@ class AuthService extends ServiceBase {
console
.
log
(
'yyyyyyyyyvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv'
);
console
.
log
(
auths
);
return
self
.
db
.
transaction
(
async
(
t
)
=>
{
for
(
let
i
=
0
;
i
<
auths
.
length
;
i
++
)
{
var
tmpAuth
=
auths
[
i
];
for
(
let
i
=
0
;
i
<
auths
.
length
;
i
++
)
{
let
tmpAuth
=
auths
[
i
];
tmpAuth
.
app_id
=
appid
;
tmpAuth
.
company_id
=
cmid
;
const
objrtn
=
await
self
.
dao
.
model
.
findOrCreate
({
...
...
@@ -33,10 +34,23 @@ class AuthService extends ServiceBase {
console
.
log
(
objrtn
);
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
;
});
}
...
...
icp-deliver/app/base/service/impl/auth/orgSve.js
View file @
4de7ea92
...
...
@@ -44,7 +44,7 @@ class OrgService extends ServiceBase {
const
usersupdate
=
await
self
.
db
.
models
.
user
.
findAll
({
where
:
{
org_id
:
orgupdate
.
id
}
});
// 如果节点名称或岗位性质发生变化
// if(p.name!=orgupdate.name || p.isMain!=orgupdate.isMain){
for
(
var
ud
of
usersupdate
)
{
for
(
let
ud
of
usersupdate
)
{
ud
.
opath
=
p
.
orgpath
;
const
n
=
p
.
orgpath
.
lastIndexOf
(
'/'
);
ud
.
ppath
=
p
.
isMain
?
p
.
orgpath
.
substring
(
0
,
n
)
:
p
.
orgpath
;
...
...
@@ -55,7 +55,7 @@ class OrgService extends ServiceBase {
const
roles
=
await
self
.
db
.
models
.
role
.
findAll
({
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
p
.
Roles
}
}
});
await
orgupdate
.
setRoles
(
roles
,
{
transaction
:
t
});
// 同时要给这个岗位下的user,更新角色 todo
for
(
var
ud
of
usersupdate
)
{
for
(
let
ud
of
usersupdate
)
{
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 {
// 设置默认普通角色,由于有了租户概念,所以注册时,需要知道当前租户和应用的id 才可以设置默认角色 todo
// 如果是非租户,那么按照当前应用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
)
{
await
u
.
setRoles
(
roles
,
{
transaction
:
t
});
}
...
...
@@ -180,7 +187,13 @@ class UserService extends ServiceBase {
return
rtn
;
}
// 先按照用户名查续身份信息,获取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
);
// rtn.token = token;
// rtn.user = u;
...
...
@@ -274,16 +287,6 @@ class UserService extends ServiceBase {
}
}
// 登录统一账号
async
clogin
(
uname
)
{
// 检查是否存在重名
}
// 按用户名查询统一用户
async
findCUser
(
uname
)
{
}
async
resetPassword
(
uname
,
pwd
)
{
const
inpassword
=
this
.
getEncryptStr
(
pwd
);
const
self
=
this
;
...
...
icp-deliver/app/base/service/impl/bizchance/schemeSve.js
View file @
4de7ea92
...
...
@@ -17,18 +17,26 @@ class SchemeService extends ServiceBase {
if
(
!
bizData
)
{
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
(
'此商机状态下不可操作'
);
}
const
schemeData
=
await
this
.
dao
.
findOne
({
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
(
'此方案状态下不可操作'
);
}
// 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
)
=>
{
...
...
@@ -51,7 +59,7 @@ class SchemeService extends ServiceBase {
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
,
});
let
scheme
_i
d
=
null
;
let
scheme
I
d
=
null
;
if
(
schemeData
)
{
await
this
.
dao
.
updateByWhere
({
...
data
,
...
...
@@ -60,7 +68,7 @@ class SchemeService extends ServiceBase {
},
{
id
:
schemeData
.
id
,
},
t
);
scheme
_i
d
=
schemeData
.
id
;
scheme
I
d
=
schemeData
.
id
;
}
else
{
const
schemeResult
=
await
this
.
dao
.
create
({
...
data
,
...
...
@@ -68,11 +76,11 @@ class SchemeService extends ServiceBase {
scheme_status
:
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
bizopt_id
:
data
.
bizopt_id
,
},
t
);
scheme
_i
d
=
schemeResult
.
id
;
scheme
I
d
=
schemeResult
.
id
;
}
this
.
statuslogDao
.
create
({
flow_type
:
system
.
FLOWCODE
.
SCHEME
,
flow_id
:
scheme
_i
d
,
flow_id
:
scheme
I
d
,
status_code
:
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
salesman_id
:
data
.
userid
,
salesman_name
:
data
.
username
,
...
...
icp-deliver/app/base/service/impl/common/appSve.js
View file @
4de7ea92
...
...
@@ -14,7 +14,7 @@ class AppService extends ServiceBase {
const
app
=
this
.
cacheManager
.
AppCache
.
cache
(
p
.
appkey
,
null
);
return
app
;
}
async
upFrontRoute
(
jsonObject
,
app
_i
d
)
{
async
upFrontRoute
(
jsonObject
,
app
I
d
)
{
const
self
=
this
;
return
this
.
db
.
transaction
(
async
(
t
)
=>
{
const
keyfile
=
`
${
self
.
getUUID
()}
.json`
;
...
...
@@ -23,7 +23,7 @@ class AppService extends ServiceBase {
fs
.
writeFileSync
(
tmpdirfile
,
str
);
const
result
=
await
self
.
ossC
.
upfile
(
keyfile
,
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
;
});
}
...
...
icp-deliver/app/base/service/impl/common/cachsearchesSve.js
View file @
4de7ea92
...
...
@@ -27,24 +27,24 @@ class CachSearchesSve {
const
{
pageSize
}
=
obj
.
pageInfo
;
const
limit
=
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`
;
if
(
obj
.
appid
==
settings
.
platformid
)
{
let
cacheList
=
await
this
.
cacheManager
.
MagCache
.
getCacheSmembersByKey
(
cacheCacheKeyPrefix
);
if
(
search
_n
ame
)
{
cacheList
=
cacheList
.
filter
(
f
=>
f
.
indexOf
(
search
_n
ame
)
>=
0
);
if
(
search
N
ame
)
{
cacheList
=
cacheList
.
filter
(
f
=>
f
.
indexOf
(
search
N
ame
)
>=
0
);
}
const
pageValues
=
cacheList
.
slice
(
offset
,
offset
+
limit
);
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
);
}
const
body
=
{
pageInfo
:
obj
.
pageInfo
,
search
:
obj
.
search
,
};
var
tmpList
=
await
this
.
opOtherAppCache
(
'findAndCountAll'
,
body
,
obj
.
opCacheUrl
);
const
tmpList
=
await
this
.
opOtherAppCache
(
'findAndCountAll'
,
body
,
obj
.
opCacheUrl
);
return
tmpList
;
}
async
delCache
(
obj
)
{
...
...
@@ -60,7 +60,8 @@ class CachSearchesSve {
const
body
=
{
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
)
{
...
...
@@ -68,24 +69,25 @@ class CachSearchesSve {
await
this
.
cacheManager
.
MagCache
.
clearAll
();
return
{
status
:
0
};
}
return
await
this
.
opOtherAppCache
(
'clearAllCache'
,
{},
obj
.
opCacheUrl
);
const
result
=
await
this
.
opOtherAppCache
(
'clearAllCache'
,
{},
obj
.
opCacheUrl
);
return
result
;
}
// app调用次数
async
findAndCountAlldetail
(
obj
)
{
const
apicallAccu
=
await
this
.
cacheManager
.
ApiAccuCache
.
getApiCallAccu
(
obj
);
const
result
=
{
rows
:
[],
count
:
0
};
const
keys
=
await
this
.
cacheManager
.
MagCache
.
keys
(
`api_call_
${
appkey
}
*`
);
var
detail
=
null
;
let
detail
=
null
;
for
(
let
j
=
0
;
j
<
keys
.
length
;
j
++
)
{
const
d
=
keys
[
j
];
const
pathdetail
=
d
.
substr
(
d
.
lastIndexOf
(
'_'
)
+
1
,
d
.
length
);
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
;
}
// 操作别的应用的缓存
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
);
if
(
appData
.
status
!=
0
)
{
return
appData
;
...
...
@@ -94,7 +96,7 @@ class CachSearchesSve {
const
restS
=
await
system
.
getObject
(
'util.restClient'
);
const
restResult
=
await
restS
.
execPostWithAK
(
{
action
_t
ype
,
action
T
ype
,
body
,
},
opCacheUrl
,
appData
.
data
.
accessKey
,
...
...
icp-deliver/app/base/service/impl/common/companySve.js
View file @
4de7ea92
...
...
@@ -21,7 +21,17 @@ class CompanyService extends ServiceBase {
const
us
=
await
self
.
db
.
models
.
user
.
findAll
({
where
:
{
opath
:
opathstr
},
transaction
:
t
});
// 查询出角色
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
)
{
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 {
let
rtn
=
null
;
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
;
rtn
=
await
self
.
dao
.
create
(
routedata
,
t
);
}
catch
(
e
)
{
...
...
icp-deliver/app/base/service/impl/delivery/deliverSve.js
View file @
4de7ea92
...
...
@@ -186,7 +186,11 @@ class DeliverService extends ServiceBase {
if
(
!
deliverData
)
{
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
(
'该交付单状态下不可提交'
);
}
if
([
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
deliverData
.
delivery_status
))
{
...
...
@@ -346,7 +350,11 @@ class DeliverService extends ServiceBase {
if
(
!
result
.
qualification
)
{
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
(
'该状态下不可填写邮寄信息'
);
}
const
{
material
}
=
result
;
...
...
icp-deliver/app/base/service/sve.base.js
View file @
4de7ea92
...
...
@@ -108,7 +108,10 @@ class ServiceBase {
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
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'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
...
...
@@ -154,8 +157,6 @@ class ServiceBase {
return
rtn
.
data
;
}
throw
new
Error
(
rtn
.
data
);
return
null
;
}
catch
(
e
)
{
console
.
log
(
e
);
return
null
;
...
...
icp-deliver/app/base/system.js
View file @
4de7ea92
...
...
@@ -128,11 +128,11 @@ class System {
}
/**
* 请求返回成功
* @param {*} data 操作成功返回的数据,有值为成功,无值为失败
* @param {*} okmsg 操作成功的描述
* @param {*} req 请求头信息
*/
* 请求返回成功
* @param {*} data 操作成功返回的数据,有值为成功,无值为失败
* @param {*} okmsg 操作成功的描述
* @param {*} req 请求头信息
*/
static
getResult
(
data
,
opmsg
=
'操作成功'
,
req
)
{
return
{
status
:
!
data
?
-
1
:
0
,
...
...
@@ -142,10 +142,10 @@ class System {
};
}
/**
* 请求返回成功
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
* 请求返回成功
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
*/
static
getResultSuccess
(
data
,
okmsg
=
'success'
)
{
return
{
status
:
0
,
...
...
@@ -154,11 +154,11 @@ class System {
};
}
/**
* 请求返回失败
* @param {*} status 操作失败状态,默认为-1
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
* 请求返回失败
* @param {*} status 操作失败状态,默认为-1
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static
getResultFail
(
status
=
-
1
,
errmsg
=
'fail'
,
data
=
null
)
{
return
{
status
,
...
...
@@ -167,10 +167,10 @@ class System {
};
}
/**
* 请求处理异常
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
* 请求处理异常
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
*/
static
getResultError
(
errmsg
=
'fail'
,
data
=
null
)
{
return
{
status
:
-
200
,
...
...
@@ -244,12 +244,12 @@ class System {
const
configValue
=
require
(
configPath
);
return
configValue
.
config
;
}
static
get
_client_i
p
(
req
)
{
static
get
ClientI
p
(
req
)
{
const
ip
=
req
.
headers
[
'x-forwarded-for'
]
||
req
.
ip
||
req
.
connection
.
remoteAddress
||
req
.
socket
.
remoteAddress
||
(
req
.
connection
.
socket
&&
req
.
connection
.
socket
.
remoteAddress
)
||
''
;
||
req
.
ip
||
req
.
connection
.
remoteAddress
||
req
.
socket
.
remoteAddress
||
(
req
.
connection
.
socket
&&
req
.
connection
.
socket
.
remoteAddress
)
||
''
;
const
x
=
ip
.
match
(
/
(
25
[
0-5
]
|2
[
0-4
][
0-9
]
|
[
0-1
]{1}[
0-9
]{2}
|
[
1-9
]{1}[
0-9
]{1}
|
[
1-9
])\.(
25
[
0-5
]
|2
[
0-4
][
0-9
]
|
[
0-1
]{1}[
0-9
]{2}
|
[
1-9
]{1}[
0-9
]{1}
|
[
1-9
]
|0
)\.(
25
[
0-5
]
|2
[
0-4
][
0-9
]
|
[
0-1
]{1}[
0-9
]{2}
|
[
1-9
]{1}[
0-9
]{1}
|
[
1-9
]
|0
)\.(
25
[
0-5
]
|2
[
0-4
][
0-9
]
|
[
0-1
]{1}[
0-9
]{2}
|
[
1-9
]{1}[
0-9
]{1}
|
[
0-9
])
$/
);
if
(
x
)
{
return
x
[
0
];
...
...
@@ -259,13 +259,13 @@ class System {
/**
* 记录日志信息
* @param {*} opTitle 操作的标题
* @param {*} params 参数
* @param {*} identifyCode 业务标识
* @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息
*/
* 记录日志信息
* @param {*} opTitle 操作的标题
* @param {*} params 参数
* @param {*} identifyCode 业务标识
* @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息
*/
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
const
reqUrl
=
settings
.
logUrl
();
let
isLogData
=
true
;
...
...
@@ -312,9 +312,9 @@ class System {
return
cipherStr
;
}
/**
* 解密信息
* @param {*} opStr
*/
* 解密信息
* @param {*} opStr
*/
static
decryptStr
(
opStr
)
{
if
(
!
opStr
)
{
return
opStr
;
...
...
icp-deliver/app/base/utils/excelClient.js
View file @
4de7ea92
...
...
@@ -49,8 +49,8 @@ class ExcelClient {
wb
.
xlsx
.
writeFile
(
filePath
).
then
(
async
(
d
)
=>
{
const
rtn
=
await
self
.
ossClient
.
upfile
(
fileName
,
filePath
);
fs
.
unlink
(
filePath
,
(
err
)
=>
{});
var
obj
=
{
fs
.
unlink
(
filePath
,
(
err
)
=>
{
});
let
obj
=
{
user_id
:
user
.
id
||
0
,
userName
:
user
.
userName
||
''
,
code
,
...
...
@@ -58,7 +58,7 @@ class ExcelClient {
filePath
:
rtn
.
url
||
''
,
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');
const
uuidv4
=
require
(
'uuid/v4'
);
const
system
=
require
(
'../system'
);
class
LogClient
{
constructor
()
{
}
getUUID
()
{
const
uuid
=
uuidv4
();
const
u
=
uuid
.
replace
(
/
\-
/g
,
''
);
...
...
icp-deliver/app/base/utils/redisClient.js
View file @
4de7ea92
...
...
@@ -88,7 +88,7 @@ class RedisClient {
}
if
(
self
.
chatserver
)
{
if
(
channel
!=
'task'
)
{
var
message
=
JSON
.
parse
(
message
);
message
=
JSON
.
parse
(
message
);
console
.
log
(
message
,
'------------------------------------------ publish message'
);
if
(
channel
==
'brc'
)
{
// 如果是广播频道,则发送广播到客户端
self
.
chatserver
.
server
.
emit
(
'brc'
,
message
);
...
...
icp-deliver/app/base/utils/smsClient.js
View file @
4de7ea92
...
...
@@ -38,7 +38,7 @@ class SmsClient {
};
return
this
.
restClient
.
execPost
(
txtObj
,
this
.
smsTeml
);
}
async
getUidStr
(
len
,
radix
)
{
async
getUidStr
(
len
,
radix
)
{
const
chars
=
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
.
split
(
''
);
const
uuid
=
[];
let
i
;
radix
=
radix
||
chars
.
length
;
...
...
@@ -46,7 +46,10 @@ class SmsClient {
for
(
i
=
0
;
i
<
len
;
i
++
)
uuid
[
i
]
=
chars
[
0
|
Math
.
random
()
*
radix
];
}
else
{
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'
;
for
(
i
=
0
;
i
<
36
;
i
++
)
{
if
(
!
uuid
[
i
])
{
...
...
icp-deliver/app/base/utils/totxClient.js
View file @
4de7ea92
...
...
@@ -228,7 +228,9 @@ function buildValue(value, cryptStr) {
}));
}
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
)
{
...
...
icp-deliver/app/config/environment.js
View file @
4de7ea92
...
...
@@ -23,7 +23,7 @@ module.exports = function (app) {
routes
(
app
);
// 初始化路由
app
.
use
(
express
.
static
(
path
.
join
(
settings
.
basepath
,
'/app/front/entry/public'
)));
// development only
if
(
'development'
==
app
.
get
(
'env'
)
)
{
if
(
app
.
get
(
'env'
)
==
'development'
)
{
app
.
use
(
errorHandler
());
}
else
{
app
.
use
((
err
,
req
,
res
)
=>
{
...
...
icp-deliver/app/config/routes/api.js
View file @
4de7ea92
...
...
@@ -6,7 +6,7 @@ module.exports = function (app) {
const
methodName
=
req
.
params
.
method
;
const
{
gname
}
=
req
.
params
;
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
const
tClientIp
=
System
.
get
_client_i
p
(
req
);
const
tClientIp
=
System
.
get
ClientI
p
(
req
);
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
'user-agent'
];
// req.classname=classPath;
...
...
@@ -34,7 +34,7 @@ module.exports = function (app) {
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
console
.
log
(
'===================='
);
console
.
log
(
classPath
);
const
tClientIp
=
System
.
get
_client_i
p
(
req
);
const
tClientIp
=
System
.
get
ClientI
p
(
req
);
req
.
clientIp
=
tClientIp
;
req
.
uagent
=
req
.
headers
[
'user-agent'
];
// req.classname=classPath;
...
...
icp-deliver/app/config/routes/web.js
View file @
4de7ea92
...
...
@@ -28,7 +28,7 @@ module.exports = function (app) {
const
{
gname
}
=
req
.
params
;
const
params
=
[];
classPath
=
`
${
gname
}
.
${
classPath
}
`
;
const
tClientIp
=
system
.
get
_client_i
p
(
req
);
const
tClientIp
=
system
.
get
ClientI
p
(
req
);
req
.
body
.
clientIp
=
tClientIp
;
req
.
body
.
agent
=
req
.
headers
[
'user-agent'
];
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
base64_encode
(
file
)
{
// read binary data
var
bitmap
=
fs
.
readFileSync
(
"./imgs/sp.png"
);
// convert binary data to base64 encoded string
var
bf
=
Buffer
.
alloc
(
bitmap
.
length
,
bitmap
);
return
bf
.
toString
(
'base64'
);
// read binary data
const
bitmap
=
fs
.
readFileSync
(
"./imgs/sp.png"
);
// convert binary data to base64 encoded string
const
bf
=
Buffer
.
alloc
(
bitmap
.
length
,
bitmap
);
return
bf
.
toString
(
'base64'
);
}
// function to create file from base64 encoded string
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
var
bitmap
=
new
Buffer
(
base64str
,
'base64'
);
// write buffer to file
fs
.
writeFileSync
(
file
,
bitmap
);
console
.
log
(
'******** File created from base64 encoded string ********'
);
// create buffer object from base64 encoded string, it is important to tell the constructor that the string is base64 encoded
const
bitmap
=
new
Buffer
(
base64str
,
'base64'
);
// write buffer to file
fs
.
writeFileSync
(
file
,
bitmap
);
console
.
log
(
'******** File created from base64 encoded string ********'
);
}
function
getDataUrl
(
filepath
){
var
str
=
base64_encode
(
filepath
);
var
mime
=
""
;
if
(
filepath
.
indexOf
(
"png"
)
>=
0
)
{
mime
=
"image/png"
;
function
getDataUrl
(
filepath
)
{
const
str
=
base64_encode
(
filepath
);
let
mime
=
""
;
if
(
filepath
.
indexOf
(
"png"
)
>=
0
)
{
mime
=
"image/png"
;
}
if
(
filepath
.
indexOf
(
"jpg"
)
>=
0
||
filepath
.
indexOf
(
"jpeg"
)
>=
0
)
{
mime
=
"image/jpg"
;
if
(
filepath
.
indexOf
(
"jpg"
)
>=
0
||
filepath
.
indexOf
(
"jpeg"
)
>=
0
)
{
mime
=
"image/jpg"
;
}
if
(
filepath
.
indexOf
(
"gif"
)
>=
0
)
{
mime
=
"image/gif"
;
if
(
filepath
.
indexOf
(
"gif"
)
>=
0
)
{
mime
=
"image/gif"
;
}
var
dataurl
=
`data:
${
mime
}
;base64,`
+
str
;
const
dataurl
=
`data:
${
mime
}
;base64,`
+
str
;
return
dataurl
;
}
var
str
=
getDataUrl
(
"./imgs/sp.png"
);
const
str
=
getDataUrl
(
"./imgs/sp.png"
);
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'
);
var
express
=
require
(
'express'
);
var
app
=
express
();
var
setttings
=
require
(
"./app/config/settings"
);
var
environment
=
require
(
'./app/config/environment'
);
//
var
SocketServer=require("./app/config/socket.server");
const
http
=
require
(
'http'
);
const
express
=
require
(
'express'
);
const
app
=
express
();
const
setttings
=
require
(
"./app/config/settings"
);
const
environment
=
require
(
'./app/config/environment'
);
//
const
SocketServer=require("./app/config/socket.server");
//const cluster = require('cluster');
//const numCPUs = require('os').cpus().length;
// all environments
...
...
@@ -20,15 +20,15 @@ environment(app);//初始化环境
// console.log(`worker ${worker.process.pid} died`);
// });
// }else{
//
var
server = http.createServer(app);
//
var
socketServer = new SocketServer(server);
//
const
server = http.createServer(app);
//
const
socketServer = new SocketServer(server);
// server.listen(setttings.port, function(){
// console.log('Express server listening on port ' + app.get('port'));
// });
// }
var
server
=
http
.
createServer
(
app
);
//
var
socketServer = new SocketServer(server);
server
.
listen
(
setttings
.
port
,
function
()
{
const
server
=
http
.
createServer
(
app
);
//
const
socketServer = new SocketServer(server);
server
.
listen
(
setttings
.
port
,
function
()
{
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