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
b669e8db
Commit
b669e8db
authored
Oct 22, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 代码规范
parent
577fbddf
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
424 additions
and
648 deletions
+424
-648
icp-deliver/app/base/api/impl/meta/oss.js
+1
-3
icp-deliver/app/base/controller/impl/delivery/materialCtl.js
+13
-11
icp-deliver/app/base/db/dao.base.js
+2
-2
icp-deliver/app/base/db/impl/auth/roleDao.js
+2
-3
icp-deliver/app/base/db/impl/auth/userDao.js
+18
-18
icp-deliver/app/base/db/impl/delivery/deliverDao.js
+1
-1
icp-deliver/app/base/db/impl/msg/msgnoticeDao.js
+2
-2
icp-deliver/app/base/service/impl/auth/authSve.js
+6
-6
icp-deliver/app/base/service/impl/auth/orgSve.js
+1
-1
icp-deliver/app/base/service/impl/auth/userSve.js
+3
-3
icp-deliver/app/base/service/impl/bizchance/schemeSve.js
+4
-4
icp-deliver/app/base/service/impl/common/companySve.js
+3
-3
icp-deliver/app/base/service/impl/common/routeSve.js
+3
-2
icp-deliver/app/base/service/impl/delivery/deliverSve.js
+4
-4
icp-deliver/app/base/system.js
+321
-321
icp-deliver/app/base/utils/redisClient.js
+1
-1
icp-deliver/app/base/utils/totxClient.js
+1
-3
icp-deliver/app/config/routes/api.js
+3
-3
icp-deliver/app/config/routes/web.js
+3
-3
icp-deliver/dochelp/imghandle.js
+8
-8
icp-deliver/dowloaddemo.js
+18
-18
icp-deliver/gulpfile.js
+0
-222
icp-deliver/main.js
+6
-6
No files found.
icp-deliver/app/base/api/impl/meta/oss.js
View file @
b669e8db
...
@@ -42,9 +42,7 @@ class OSSAPI extends APIBase {
...
@@ -42,9 +42,7 @@ class OSSAPI extends APIBase {
}
}
async
downfile
(
srckey
)
{
async
downfile
(
srckey
)
{
const
oss
=
System
.
getObject
(
'util.ossClient'
);
const
oss
=
System
.
getObject
(
'util.ossClient'
);
const
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
{
const
downfile
=
await
oss
.
downfile
(
srckey
).
then
(()
=>
`/tmp/
${
srckey
}
`
);
return
`/tmp/
${
srckey
}
`
;
});
return
downfile
;
return
downfile
;
}
}
}
}
...
...
icp-deliver/app/base/controller/impl/delivery/materialCtl.js
View file @
b669e8db
...
@@ -30,7 +30,7 @@ class MaterialCtl extends CtlBase {
...
@@ -30,7 +30,7 @@ class MaterialCtl extends CtlBase {
profitableWay
,
profitableWay
,
specialApproval
,
specialApproval
,
serviceProjectEdi
,
serviceProjectEdi
,
serviceProjectIcp
serviceProjectIcp
,
}
=
implementationPlanInfo
;
}
=
implementationPlanInfo
;
// 1. id ,type
// 1. id ,type
...
@@ -122,20 +122,22 @@ class MaterialCtl extends CtlBase {
...
@@ -122,20 +122,22 @@ class MaterialCtl extends CtlBase {
};
};
// 专项审批项目 ICP
// 专项审批项目 ICP
if
(
type
===
'ICP'
)
{
if
(
type
===
'ICP'
)
{
implementationPlanData
.
files
.
push
(
implementationPlanData
.
files
.
push
(...
specialApproval
.
filter
(
item
=>
(
!!
(
...
specialApproval
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
item
.
file
file
:
item
.
file
,
&&
item
.
file
.
url
))).
map
(
item
=>
({
title
:
`专项审批项-
${
item
.
title
}
`
,
file
:
item
.
file
,
})));
title
:
`专项审批项-
${
item
.
title
}
`
,
})));
}
}
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
(
implementationPlanData
.
files
.
push
(...
serviceProjectEdi
.
filter
(
item
=>
(
!!
(
...
serviceProjectEdi
.
filter
(
item
=>
(
!!
(
item
.
file
&&
item
.
file
.
url
))).
map
(
item
=>
({
item
.
file
title
:
item
.
title
,
&&
item
.
file
.
url
))).
map
(
item
=>
({
file
:
item
.
file
,
title
:
item
.
title
,
})));
file
:
item
.
file
,
})));
}
}
// 4. 增值电信申请表
// 4. 增值电信申请表
...
...
icp-deliver/app/base/db/dao.base.js
View file @
b669e8db
...
@@ -49,10 +49,10 @@ class Dao {
...
@@ -49,10 +49,10 @@ class Dao {
if
(
t
!=
null
&&
t
!=
'undefined'
)
{
if
(
t
!=
null
&&
t
!=
'undefined'
)
{
whereParam
.
transaction
=
t
;
whereParam
.
transaction
=
t
;
const
result
=
await
this
.
model
.
destroy
(
whereParam
);
const
result
=
await
this
.
model
.
destroy
(
whereParam
);
return
result
return
result
;
}
}
const
result
=
await
this
.
model
.
destroy
(
whereParam
);
const
result
=
await
this
.
model
.
destroy
(
whereParam
);
return
result
return
result
;
}
}
async
delete
(
qobj
,
t
)
{
async
delete
(
qobj
,
t
)
{
let
en
=
null
;
let
en
=
null
;
...
...
icp-deliver/app/base/db/impl/auth/roleDao.js
View file @
b669e8db
...
@@ -40,10 +40,9 @@ class RoleDao extends Dao {
...
@@ -40,10 +40,9 @@ class RoleDao extends Dao {
if
(
t
)
{
if
(
t
)
{
const
role
=
await
this
.
model
.
create
(
u2
,
{
transaction
:
t
});
const
role
=
await
this
.
model
.
create
(
u2
,
{
transaction
:
t
});
return
role
;
return
role
;
}
else
{
const
role
=
await
this
.
model
.
create
(
u2
);
return
role
;
}
}
const
role
=
await
this
.
model
.
create
(
u2
);
return
role
;
}
}
}
}
module
.
exports
=
RoleDao
;
module
.
exports
=
RoleDao
;
icp-deliver/app/base/db/impl/auth/userDao.js
View file @
b669e8db
...
@@ -9,11 +9,11 @@ class UserDao extends Dao {
...
@@ -9,11 +9,11 @@ class UserDao extends Dao {
return
this
.
model
.
findOne
({
return
this
.
model
.
findOne
({
where
:
{
id
:
userid
},
where
:
{
id
:
userid
},
include
:
[{
model
:
self
.
db
.
models
.
account
,
attributes
:
[
'id'
,
'isSuper'
,
'referrerOnlyCode'
]
},
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
.
role
,
as
:
'Roles'
,
attributes
:
[
'id'
,
'code'
],
include
:
[
{
model
:
self
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
]
},
{
model
:
self
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
]
},
],
],
},
},
],
],
});
});
}
}
...
@@ -22,12 +22,12 @@ class UserDao extends Dao {
...
@@ -22,12 +22,12 @@ 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
.
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
:
[
{
model
:
this
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
],
raw
:
true
},
{
model
:
this
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
],
raw
:
true
},
],
],
},
},
],
],
},
{
transaction
:
t
});
},
{
transaction
:
t
});
// if(tUser!=null){
// if(tUser!=null){
...
@@ -41,12 +41,12 @@ class UserDao extends Dao {
...
@@ -41,12 +41,12 @@ 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
.
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
:
[
{
model
:
this
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
],
raw
:
true
},
{
model
:
this
.
db
.
models
.
product
,
as
:
'Products'
,
attributes
:
[
'id'
,
'code'
],
raw
:
true
},
],
],
},
},
],
],
},
{
transaction
:
t
});
},
{
transaction
:
t
});
if
(
tUser
!=
null
)
{
if
(
tUser
!=
null
)
{
...
@@ -123,7 +123,7 @@ class UserDao extends Dao {
...
@@ -123,7 +123,7 @@ class UserDao extends Dao {
// 修改用户(user表)公司的唯一码
// 修改用户(user表)公司的唯一码
async
putUserCompanyOnlyCode
(
userId
,
companyOnlyCode
,
result
)
{
async
putUserCompanyOnlyCode
(
userId
,
companyOnlyCode
,
result
)
{
const
customerObj
=
{
companyOnlyCode
:
companyOnlyCode
};
const
customerObj
=
{
companyOnlyCode
};
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 @
b669e8db
...
@@ -40,7 +40,7 @@ class DeliverDao extends Dao {
...
@@ -40,7 +40,7 @@ class DeliverDao extends Dao {
case
'/deliveryManagement/wait'
:
case
'/deliveryManagement/wait'
:
qc
.
where
.
delivery_status
=
qc
.
where
.
delivery_status
||
{
qc
.
where
.
delivery_status
=
qc
.
where
.
delivery_status
||
{
$in
:
[
system
.
SERVERSESTATUS
.
RECEIVED
,
system
.
SERVERSESTATUS
.
COLLECTING
,
$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
;
break
;
...
...
icp-deliver/app/base/db/impl/msg/msgnoticeDao.js
View file @
b669e8db
...
@@ -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
)
{
le
t
set
=
{
lastMsgId
:
msg
.
id
};
cons
t
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
)
{
le
t
set
=
{
lastMsgId
:
msg
.
id
};
cons
t
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 @
b669e8db
...
@@ -11,7 +11,7 @@ class AuthService extends ServiceBase {
...
@@ -11,7 +11,7 @@ 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
;
}
}
...
@@ -22,7 +22,7 @@ class AuthService extends ServiceBase {
...
@@ -22,7 +22,7 @@ class AuthService extends ServiceBase {
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
++
)
{
le
t
tmpAuth
=
auths
[
i
];
cons
t
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
({
...
@@ -38,18 +38,18 @@ class AuthService extends ServiceBase {
...
@@ -38,18 +38,18 @@ class AuthService extends ServiceBase {
where
:
where
:
{
{
role_id
:
tmpAuth
.
role_id
,
role_id
:
tmpAuth
.
role_id
,
bizcode
:
tmpAuth
.
bizcode
bizcode
:
tmpAuth
.
bizcode
,
},
},
transaction
:
t
transaction
:
t
,
});
});
}
}
}
}
const
aths
=
await
self
.
dao
.
model
.
findAll
({
const
aths
=
await
self
.
dao
.
model
.
findAll
({
where
:
{
where
:
{
role_id
:
tmpAuth
.
role_id
,
role_id
:
tmpAuth
.
role_id
,
app_id
:
tmpAuth
.
app_id
app_id
:
tmpAuth
.
app_id
,
},
},
transaction
:
t
transaction
:
t
,
});
});
return
aths
;
return
aths
;
});
});
...
...
icp-deliver/app/base/service/impl/auth/orgSve.js
View file @
b669e8db
...
@@ -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
(
le
t
ud
of
usersupdate
)
{
for
(
cons
t
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
;
...
...
icp-deliver/app/base/service/impl/auth/userSve.js
View file @
b669e8db
...
@@ -64,9 +64,9 @@ class UserService extends ServiceBase {
...
@@ -64,9 +64,9 @@ class UserService extends ServiceBase {
where
:
{
where
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
rolecodes
},
id
:
{
[
self
.
db
.
Op
.
in
]:
rolecodes
},
app_id
:
roleappid
,
app_id
:
roleappid
,
company_id
:
p
.
company_id
company_id
:
p
.
company_id
,
},
},
transaction
:
t
transaction
:
t
,
});
});
if
(
roles
&&
roles
.
length
>
0
)
{
if
(
roles
&&
roles
.
length
>
0
)
{
await
u
.
setRoles
(
roles
,
{
transaction
:
t
});
await
u
.
setRoles
(
roles
,
{
transaction
:
t
});
...
@@ -192,7 +192,7 @@ class UserService extends ServiceBase {
...
@@ -192,7 +192,7 @@ class UserService extends ServiceBase {
nickName
:
mobile
,
nickName
:
mobile
,
rolecodes
:
p
.
rolecodes
,
rolecodes
:
p
.
rolecodes
,
company_id
:
p
.
company_id
,
company_id
:
p
.
company_id
,
app_id
:
p
.
app_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;
...
...
icp-deliver/app/base/service/impl/bizchance/schemeSve.js
View file @
b669e8db
...
@@ -18,8 +18,8 @@ class SchemeService extends ServiceBase {
...
@@ -18,8 +18,8 @@ class SchemeService extends ServiceBase {
throw
new
Error
(
'查不到该商机'
);
throw
new
Error
(
'查不到该商机'
);
}
}
if
([
system
.
BUSSTATUS
.
CLOSED
,
if
([
system
.
BUSSTATUS
.
CLOSED
,
system
.
BUSSTATUS
.
SUCCESS
,
system
.
BUSSTATUS
.
SUCCESS
,
system
.
BUSSTATUS
.
WAITINGCONFIRM
].
includes
(
bizData
.
business_status
))
{
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
({
...
@@ -27,7 +27,7 @@ class SchemeService extends ServiceBase {
...
@@ -27,7 +27,7 @@ class SchemeService extends ServiceBase {
});
});
if
(
schemeData
if
(
schemeData
&&
[
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
&&
[
system
.
SCHEMESTATUS
.
WAITINGCONFIRM
,
system
.
SCHEMESTATUS
.
CLOSED
].
includes
(
schemeData
.
scheme_status
))
{
system
.
SCHEMESTATUS
.
CLOSED
].
includes
(
schemeData
.
scheme_status
))
{
throw
new
Error
(
'此方案状态下不可操作'
);
throw
new
Error
(
'此方案状态下不可操作'
);
}
}
...
@@ -35,7 +35,7 @@ class SchemeService extends ServiceBase {
...
@@ -35,7 +35,7 @@ class SchemeService extends ServiceBase {
data
.
scheme_number
=
await
pushTx
.
pushScheme
(
bizData
,
schemeData
data
.
scheme_number
=
await
pushTx
.
pushScheme
(
bizData
,
schemeData
?
{
?
{
...
data
,
...
data
,
scheme_number
:
schemeData
.
scheme_number
scheme_number
:
schemeData
.
scheme_number
,
}
:
data
);
}
:
data
);
...
...
icp-deliver/app/base/service/impl/common/companySve.js
View file @
b669e8db
...
@@ -25,12 +25,12 @@ class CompanyService extends ServiceBase {
...
@@ -25,12 +25,12 @@ class CompanyService extends ServiceBase {
where
:
where
:
{
{
id
:
{
id
:
{
[
self
.
db
.
Op
.
in
]:
roleids
[
self
.
db
.
Op
.
in
]:
roleids
,
},
},
app_id
:
p
.
app_id
,
app_id
:
p
.
app_id
,
company_id
:
p
.
company_id
company_id
:
p
.
company_id
,
},
},
transaction
:
t
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 @
b669e8db
...
@@ -22,8 +22,9 @@ class RouteService extends ServiceBase {
...
@@ -22,8 +22,9 @@ class RouteService extends ServiceBase {
name
:
routedata
.
name
,
name
:
routedata
.
name
,
hosts
:
routedata
.
hosts
,
hosts
:
routedata
.
hosts
,
paths
:
routedata
.
paths
,
paths
:
routedata
.
paths
,
strip_path
:
routedata
.
isstrip
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 @
b669e8db
...
@@ -188,8 +188,8 @@ class DeliverService extends ServiceBase {
...
@@ -188,8 +188,8 @@ class DeliverService extends ServiceBase {
}
}
if
(
if
(
!
[
system
.
SERVERSESTATUS
.
DISPOSEING
,
!
[
system
.
SERVERSESTATUS
.
DISPOSEING
,
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
deliverData
.
delivery_status
)
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
deliverData
.
delivery_status
)
)
{
)
{
throw
new
Error
(
'该交付单状态下不可提交'
);
throw
new
Error
(
'该交付单状态下不可提交'
);
}
}
...
@@ -352,8 +352,8 @@ class DeliverService extends ServiceBase {
...
@@ -352,8 +352,8 @@ class DeliverService extends ServiceBase {
}
}
if
(
if
(
!
[
system
.
SERVERSESTATUS
.
DISPOSEING
,
!
[
system
.
SERVERSESTATUS
.
DISPOSEING
,
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
SUCCESS
,
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
result
.
delivery_status
)
system
.
SERVERSESTATUS
.
POSTING
].
includes
(
result
.
delivery_status
)
)
{
)
{
throw
new
Error
(
'该状态下不可填写邮寄信息'
);
throw
new
Error
(
'该状态下不可填写邮寄信息'
);
}
}
...
...
icp-deliver/app/base/system.js
View file @
b669e8db
...
@@ -5,260 +5,260 @@ const request = require('request');
...
@@ -5,260 +5,260 @@ const request = require('request');
const
cryptoJS
=
require
(
'crypto-js'
);
const
cryptoJS
=
require
(
'crypto-js'
);
class
System
{
class
System
{
static
declare
(
ns
)
{
static
declare
(
ns
)
{
const
ar
=
ns
.
split
(
'.'
);
const
ar
=
ns
.
split
(
'.'
);
let
root
=
System
;
let
root
=
System
;
for
(
let
i
=
0
,
len
=
ar
.
length
;
i
<
len
;
++
i
)
{
for
(
let
i
=
0
,
len
=
ar
.
length
;
i
<
len
;
++
i
)
{
const
n
=
ar
[
i
];
const
n
=
ar
[
i
];
if
(
!
root
[
n
])
{
if
(
!
root
[
n
])
{
root
[
n
]
=
{};
root
[
n
]
=
{};
root
=
root
[
n
];
root
=
root
[
n
];
}
else
{
}
else
{
root
=
root
[
n
];
root
=
root
[
n
];
}
}
}
}
}
}
static
async
delReq
(
url
,
qdata
)
{
static
async
delReq
(
url
,
qdata
)
{
const
rtn
=
{};
const
rtn
=
{};
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
request
.
del
({
request
.
del
({
url
,
url
,
qs
:
qdata
,
qs
:
qdata
,
},
(
error
,
response
,
body
)
=>
{
},
(
error
,
response
,
body
)
=>
{
rtn
.
statusCode
=
response
.
statusCode
;
rtn
.
statusCode
=
response
.
statusCode
;
if
(
!
error
)
{
if
(
!
error
)
{
if
(
body
)
{
if
(
body
)
{
const
data
=
JSON
.
parse
(
body
);
const
data
=
JSON
.
parse
(
body
);
rtn
.
data
=
data
;
rtn
.
data
=
data
;
}
else
{
}
else
{
rtn
.
data
=
null
;
rtn
.
data
=
null
;
}
}
resv
(
rtn
);
resv
(
rtn
);
}
else
{
}
else
{
rej
(
error
);
rej
(
error
);
}
}
});
});
}));
}));
return
promise
;
return
promise
;
}
}
static
async
getReq
(
url
,
qdata
)
{
static
async
getReq
(
url
,
qdata
)
{
const
rtn
=
{};
const
rtn
=
{};
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
request
.
get
({
request
.
get
({
url
,
url
,
json
:
true
,
json
:
true
,
qs
:
qdata
,
qs
:
qdata
,
},
(
error
,
response
,
body
)
=>
{
},
(
error
,
response
,
body
)
=>
{
rtn
.
statusCode
=
response
.
statusCode
;
rtn
.
statusCode
=
response
.
statusCode
;
if
(
!
error
)
{
if
(
!
error
)
{
if
(
body
)
{
if
(
body
)
{
rtn
.
data
=
body
;
rtn
.
data
=
body
;
}
else
{
}
else
{
rtn
.
data
=
null
;
rtn
.
data
=
null
;
}
}
resv
(
rtn
);
resv
(
rtn
);
}
else
{
}
else
{
rej
(
error
);
rej
(
error
);
}
}
});
});
}));
}));
return
promise
;
return
promise
;
}
}
static
async
postJsonTypeReq
(
url
,
data
,
md
=
'POST'
)
{
static
async
postJsonTypeReq
(
url
,
data
,
md
=
'POST'
)
{
const
rtn
=
{};
const
rtn
=
{};
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
request
({
request
({
url
,
url
,
method
:
md
,
method
:
md
,
json
:
true
,
json
:
true
,
headers
:
{
headers
:
{
'Content-type'
:
'application/json'
,
'Content-type'
:
'application/json'
,
// 'Authorization': 'Basic YWRtaW5lczphZG1pbkdTQmVzLg=='
// 'Authorization': 'Basic YWRtaW5lczphZG1pbkdTQmVzLg=='
},
},
body
:
data
,
body
:
data
,
},
(
error
,
response
,
body
)
=>
{
},
(
error
,
response
,
body
)
=>
{
rtn
.
statusCode
=
response
.
statusCode
;
rtn
.
statusCode
=
response
.
statusCode
;
if
(
!
error
)
{
if
(
!
error
)
{
if
(
body
)
{
if
(
body
)
{
rtn
.
data
=
body
;
rtn
.
data
=
body
;
}
else
{
}
else
{
rtn
.
data
=
null
;
rtn
.
data
=
null
;
}
}
resv
(
rtn
);
resv
(
rtn
);
}
else
{
}
else
{
rej
(
error
);
rej
(
error
);
}
}
});
});
}));
}));
return
promise
;
return
promise
;
}
}
static
async
post3wFormTypeReq
(
url
,
data
)
{
static
async
post3wFormTypeReq
(
url
,
data
)
{
const
rtn
=
{};
const
rtn
=
{};
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
request
.
post
({
request
.
post
({
url
,
url
,
form
:
data
,
form
:
data
,
},
(
error
,
response
,
body
)
=>
{
},
(
error
,
response
,
body
)
=>
{
rtn
.
statusCode
=
response
.
statusCode
;
rtn
.
statusCode
=
response
.
statusCode
;
if
(
!
error
)
{
if
(
!
error
)
{
const
data
=
JSON
.
parse
(
body
);
const
data
=
JSON
.
parse
(
body
);
rtn
.
data
=
data
;
rtn
.
data
=
data
;
resv
(
rtn
);
resv
(
rtn
);
}
else
{
}
else
{
rej
(
error
);
rej
(
error
);
}
}
});
});
}));
}));
return
promise
;
return
promise
;
}
}
static
async
postMpFormTypeReq
(
url
,
formdata
)
{
static
async
postMpFormTypeReq
(
url
,
formdata
)
{
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
const
promise
=
new
Promise
(((
resv
,
rej
)
=>
{
request
.
post
({
request
.
post
({
url
,
url
,
formData
:
formdata
,
formData
:
formdata
,
},
(
error
,
response
,
body
)
=>
{
},
(
error
,
response
,
body
)
=>
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
if
(
!
error
&&
response
.
statusCode
==
200
)
{
resv
(
body
);
resv
(
body
);
}
else
{
}
else
{
rej
(
error
);
rej
(
error
);
}
}
});
});
}));
}));
return
promise
;
return
promise
;
}
}
/**
/**
* 请求返回成功
* 请求返回成功
* @param {*} data 操作成功返回的数据,有值为成功,无值为失败
* @param {*} data 操作成功返回的数据,有值为成功,无值为失败
* @param {*} okmsg 操作成功的描述
* @param {*} okmsg 操作成功的描述
* @param {*} req 请求头信息
* @param {*} req 请求头信息
*/
*/
static
getResult
(
data
,
opmsg
=
'操作成功'
,
req
)
{
static
getResult
(
data
,
opmsg
=
'操作成功'
,
req
)
{
return
{
return
{
status
:
!
data
?
-
1
:
0
,
status
:
!
data
?
-
1
:
0
,
msg
:
opmsg
,
msg
:
opmsg
,
data
,
data
,
bizmsg
:
req
&&
req
.
session
&&
req
.
session
.
bizmsg
?
req
.
session
.
bizmsg
:
'empty'
,
bizmsg
:
req
&&
req
.
session
&&
req
.
session
.
bizmsg
?
req
.
session
.
bizmsg
:
'empty'
,
};
};
}
}
/**
/**
* 请求返回成功
* 请求返回成功
* @param {*} data 操作成功返回的数据
* @param {*} data 操作成功返回的数据
* @param {*} okmsg 操作成功的描述
* @param {*} okmsg 操作成功的描述
*/
*/
static
getResultSuccess
(
data
,
okmsg
=
'success'
)
{
static
getResultSuccess
(
data
,
okmsg
=
'success'
)
{
return
{
return
{
status
:
0
,
status
:
0
,
msg
:
okmsg
,
msg
:
okmsg
,
data
,
data
,
};
};
}
}
/**
/**
* 请求返回失败
* 请求返回失败
* @param {*} status 操作失败状态,默认为-1
* @param {*} status 操作失败状态,默认为-1
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
* @param {*} data 操作失败返回的数据
*/
*/
static
getResultFail
(
status
=
-
1
,
errmsg
=
'fail'
,
data
=
null
)
{
static
getResultFail
(
status
=
-
1
,
errmsg
=
'fail'
,
data
=
null
)
{
return
{
return
{
status
,
status
,
msg
:
errmsg
,
msg
:
errmsg
,
data
,
data
,
};
};
}
}
/**
/**
* 请求处理异常
* 请求处理异常
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} errmsg 操作失败的描述,默认为fail
* @param {*} data 操作失败返回的数据
* @param {*} data 操作失败返回的数据
*/
*/
static
getResultError
(
errmsg
=
'fail'
,
data
=
null
)
{
static
getResultError
(
errmsg
=
'fail'
,
data
=
null
)
{
return
{
return
{
status
:
-
200
,
status
:
-
200
,
msg
:
errmsg
,
msg
:
errmsg
,
data
,
data
,
};
};
}
}
static
register
(
key
,
ClassObj
,
groupName
,
filename
)
{
static
register
(
key
,
ClassObj
,
groupName
,
filename
)
{
if
(
System
.
objTable
[
key
]
!=
null
)
{
if
(
System
.
objTable
[
key
]
!=
null
)
{
throw
new
Error
(
'相同key的对象已经存在'
);
throw
new
Error
(
'相同key的对象已经存在'
);
}
else
{
}
else
{
let
obj
;
let
obj
;
if
(
ClassObj
.
name
===
'ServiceBase'
)
{
if
(
ClassObj
.
name
===
'ServiceBase'
)
{
obj
=
new
ClassObj
(
groupName
,
filename
.
replace
(
'Sve'
,
'Dao'
));
obj
=
new
ClassObj
(
groupName
,
filename
.
replace
(
'Sve'
,
'Dao'
));
}
else
{
}
else
{
obj
=
new
ClassObj
(
groupName
,
filename
);
obj
=
new
ClassObj
(
groupName
,
filename
);
}
}
System
.
objTable
[
key
]
=
obj
;
System
.
objTable
[
key
]
=
obj
;
}
}
return
System
.
objTable
[
key
];
return
System
.
objTable
[
key
];
}
}
static
getObject
(
objpath
)
{
static
getObject
(
objpath
)
{
const
pathArray
=
objpath
.
split
(
'.'
);
const
pathArray
=
objpath
.
split
(
'.'
);
const
packageName
=
pathArray
[
0
];
const
packageName
=
pathArray
[
0
];
const
groupName
=
pathArray
[
1
];
const
groupName
=
pathArray
[
1
];
let
filename
=
pathArray
[
2
];
let
filename
=
pathArray
[
2
];
let
classpath
=
''
;
let
classpath
=
''
;
if
(
filename
)
{
if
(
filename
)
{
classpath
=
`
${
objsettings
[
packageName
]}
/
${
groupName
}
`
;
classpath
=
`
${
objsettings
[
packageName
]}
/
${
groupName
}
`
;
}
else
{
}
else
{
classpath
=
objsettings
[
packageName
];
classpath
=
objsettings
[
packageName
];
filename
=
groupName
;
filename
=
groupName
;
}
}
const
objabspath
=
`
${
classpath
}
/
${
filename
}
.js`
;
const
objabspath
=
`
${
classpath
}
/
${
filename
}
.js`
;
// 判断文件的存在性
// 判断文件的存在性
// 如果不存在,需要查看packageName
// 如果不存在,需要查看packageName
// 如果packageName=web.service,dao
// 如果packageName=web.service,dao
if
(
System
.
objTable
[
objabspath
]
!=
null
)
{
if
(
System
.
objTable
[
objabspath
]
!=
null
)
{
return
System
.
objTable
[
objabspath
];
return
System
.
objTable
[
objabspath
];
}
}
let
ClassObj
=
null
;
let
ClassObj
=
null
;
try
{
try
{
ClassObj
=
require
(
objabspath
);
ClassObj
=
require
(
objabspath
);
}
catch
(
e
)
{
}
catch
(
e
)
{
// console.log(e)
// console.log(e)
const
fname
=
objsettings
[
`
${
packageName
}
base`
];
const
fname
=
objsettings
[
`
${
packageName
}
base`
];
ClassObj
=
require
(
fname
);
ClassObj
=
require
(
fname
);
}
}
if
(
ClassObj
.
name
==
'Dao'
)
{
if
(
ClassObj
.
name
==
'Dao'
)
{
const
modelname
=
filename
.
substring
(
0
,
filename
.
lastIndexOf
(
'Dao'
));
const
modelname
=
filename
.
substring
(
0
,
filename
.
lastIndexOf
(
'Dao'
));
return
System
.
register
(
objabspath
,
ClassObj
,
modelname
);
return
System
.
register
(
objabspath
,
ClassObj
,
modelname
);
}
}
if
(
ClassObj
.
name
.
indexOf
(
'Ctl'
)
>=
0
)
{
if
(
ClassObj
.
name
.
indexOf
(
'Ctl'
)
>=
0
)
{
console
.
log
(
ClassObj
.
name
);
console
.
log
(
ClassObj
.
name
);
}
}
return
System
.
register
(
objabspath
,
ClassObj
,
groupName
,
filename
);
return
System
.
register
(
objabspath
,
ClassObj
,
groupName
,
filename
);
}
}
static
getSysConfig
()
{
static
getSysConfig
()
{
const
configPath
=
`
${
settings
.
basepath
}
/app/base/db/metadata/index.js`
;
const
configPath
=
`
${
settings
.
basepath
}
/app/base/db/metadata/index.js`
;
// if(settings.env=="dev"){
// if(settings.env=="dev"){
// console.log("delete "+configPath+"cache config");
// console.log("delete "+configPath+"cache config");
// delete require.cache[configPath];
// delete require.cache[configPath];
// }
// }
delete
require
.
cache
[
configPath
];
delete
require
.
cache
[
configPath
];
const
configValue
=
require
(
configPath
);
const
configValue
=
require
(
configPath
);
return
configValue
.
config
;
return
configValue
.
config
;
}
}
static
getClientIp
(
req
)
{
static
getClientIp
(
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
||
req
.
socket
.
remoteAddress
||
req
.
socket
.
remoteAddress
||
(
req
.
connection
.
socket
&&
req
.
connection
.
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
])
$/
);
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
)
{
if
(
x
)
{
return
x
[
0
];
return
x
[
0
];
}
}
return
'localhost'
;
return
'localhost'
;
}
}
/**
/**
* 记录日志信息
* 记录日志信息
* @param {*} opTitle 操作的标题
* @param {*} opTitle 操作的标题
* @param {*} params 参数
* @param {*} params 参数
...
@@ -266,85 +266,85 @@ class System {
...
@@ -266,85 +266,85 @@ class System {
* @param {*} resultInfo 返回结果
* @param {*} resultInfo 返回结果
* @param {*} errorInfo 错误信息
* @param {*} errorInfo 错误信息
*/
*/
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
static
execLogs
(
opTitle
,
params
,
identifyCode
,
resultInfo
,
errorInfo
)
{
const
reqUrl
=
settings
.
logUrl
();
const
reqUrl
=
settings
.
logUrl
();
let
isLogData
=
true
;
let
isLogData
=
true
;
if
(
params
.
method
&&
(
params
.
method
.
indexOf
(
'find'
)
>=
0
||
params
.
method
.
indexOf
(
'get'
)
>=
0
))
{
if
(
params
.
method
&&
(
params
.
method
.
indexOf
(
'find'
)
>=
0
||
params
.
method
.
indexOf
(
'get'
)
>=
0
))
{
isLogData
=
false
;
isLogData
=
false
;
}
}
const
param
=
{
const
param
=
{
actionType
:
'produceLogsData'
,
// Y 功能名称
actionType
:
'produceLogsData'
,
// Y 功能名称
actionBody
:
{
actionBody
:
{
opTitle
:
opTitle
||
''
,
// N 操作的业务标题
opTitle
:
opTitle
||
''
,
// N 操作的业务标题
identifyCode
:
identifyCode
||
'brg-center-manage'
,
// Y 操作的业务标识
identifyCode
:
identifyCode
||
'brg-center-manage'
,
// Y 操作的业务标识
indexName
:
settings
.
logindex
,
// Y es索引值,同一个项目用一个值
indexName
:
settings
.
logindex
,
// Y es索引值,同一个项目用一个值
messageBody
:
params
,
// 日志的描述信息
messageBody
:
params
,
// 日志的描述信息
resultInfo
:
isLogData
?
resultInfo
:
{
status
:
resultInfo
.
status
},
// 返回信息
resultInfo
:
isLogData
?
resultInfo
:
{
status
:
resultInfo
.
status
},
// 返回信息
errorInfo
,
// 错误信息
errorInfo
,
// 错误信息
requestId
:
resultInfo
.
requestId
||
''
,
requestId
:
resultInfo
.
requestId
||
''
,
},
},
};
};
console
.
log
(
JSON
.
stringify
(
param
));
console
.
log
(
JSON
.
stringify
(
param
));
const
P
=
new
Promise
((
resv
,
rej
)
=>
{
const
P
=
new
Promise
((
resv
,
rej
)
=>
{
this
.
postJsonTypeReq
(
reqUrl
,
param
).
then
((
res
)
=>
{
this
.
postJsonTypeReq
(
reqUrl
,
param
).
then
((
res
)
=>
{
if
(
res
.
statusCode
==
200
)
{
if
(
res
.
statusCode
==
200
)
{
resv
(
res
.
data
);
resv
(
res
.
data
);
}
else
{
}
else
{
rej
(
null
);
rej
(
null
);
}
}
});
});
});
});
return
P
;
return
P
;
}
}
/**
/**
* 加密信息
* 加密信息
* @param {*} opStr
* @param {*} opStr
*/
*/
static
encryptStr
(
opStr
)
{
static
encryptStr
(
opStr
)
{
if
(
!
opStr
)
{
if
(
!
opStr
)
{
return
opStr
;
return
opStr
;
}
}
const
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
const
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
const
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
const
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
const
cipherStr
=
cryptoJS
.
TripleDES
.
encrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
}).
toString
();
const
cipherStr
=
cryptoJS
.
TripleDES
.
encrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
}).
toString
();
return
cipherStr
;
return
cipherStr
;
}
}
/**
/**
* 解密信息
* 解密信息
* @param {*} opStr
* @param {*} opStr
*/
*/
static
decryptStr
(
opStr
)
{
static
decryptStr
(
opStr
)
{
if
(
!
opStr
)
{
if
(
!
opStr
)
{
return
opStr
;
return
opStr
;
}
}
try
{
try
{
const
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
const
keyHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_key
);
const
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
const
ivHex
=
cryptoJS
.
enc
.
Utf8
.
parse
(
settings
.
encrypt_secret
.
substring
(
0
,
8
));
const
bytes
=
cryptoJS
.
TripleDES
.
decrypt
(
opStr
,
keyHex
,
{
const
bytes
=
cryptoJS
.
TripleDES
.
decrypt
(
opStr
,
keyHex
,
{
iv
:
ivHex
,
iv
:
ivHex
,
});
});
const
plaintext
=
bytes
.
toString
(
cryptoJS
.
enc
.
Utf8
);
const
plaintext
=
bytes
.
toString
(
cryptoJS
.
enc
.
Utf8
);
return
plaintext
||
opStr
;
return
plaintext
||
opStr
;
}
catch
(
err
)
{
}
catch
(
err
)
{
return
opStr
;
return
opStr
;
}
}
}
}
}
}
Date
.
prototype
.
Format
=
function
(
fmt
)
{
// author: meizz
Date
.
prototype
.
Format
=
function
(
fmt
)
{
// author: meizz
const
o
=
{
const
o
=
{
'M+'
:
this
.
getMonth
()
+
1
,
// 月份
'M+'
:
this
.
getMonth
()
+
1
,
// 月份
'd+'
:
this
.
getDate
(),
// 日
'd+'
:
this
.
getDate
(),
// 日
'h+'
:
this
.
getHours
(),
// 小时
'h+'
:
this
.
getHours
(),
// 小时
'm+'
:
this
.
getMinutes
(),
// 分
'm+'
:
this
.
getMinutes
(),
// 分
's+'
:
this
.
getSeconds
(),
// 秒
's+'
:
this
.
getSeconds
(),
// 秒
'q+'
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
// 季度
'q+'
:
Math
.
floor
((
this
.
getMonth
()
+
3
)
/
3
),
// 季度
S
:
this
.
getMilliseconds
(),
// 毫秒
S
:
this
.
getMilliseconds
(),
// 毫秒
};
};
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
`
${
this
.
getFullYear
()}
`
).
substr
(
4
-
RegExp
.
$1
.
length
));
if
(
/
(
y+
)
/
.
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
`
${
this
.
getFullYear
()}
`
).
substr
(
4
-
RegExp
.
$1
.
length
));
for
(
const
k
in
o
)
if
(
new
RegExp
(
`(
${
k
}
)`
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
==
1
)
?
(
o
[
k
])
:
((
`00
${
o
[
k
]}
`
).
substr
((
`
${
o
[
k
]}
`
).
length
)));
for
(
const
k
in
o
)
if
(
new
RegExp
(
`(
${
k
}
)`
).
test
(
fmt
))
fmt
=
fmt
.
replace
(
RegExp
.
$1
,
(
RegExp
.
$1
.
length
==
1
)
?
(
o
[
k
])
:
((
`00
${
o
[
k
]}
`
).
substr
((
`
${
o
[
k
]}
`
).
length
)));
return
fmt
;
return
fmt
;
};
};
/**
/**
...
@@ -353,57 +353,57 @@ Date.prototype.Format = function (fmt) { // author: meizz
...
@@ -353,57 +353,57 @@ Date.prototype.Format = function (fmt) { // author: meizz
// 表分类
// 表分类
System
.
FLOWCODE
=
{
System
.
FLOWCODE
=
{
BIZ
:
'BIZ'
,
// 商机表
BIZ
:
'BIZ'
,
// 商机表
SCHEME
:
'SCHEME'
,
// 方案表
SCHEME
:
'SCHEME'
,
// 方案表
DELIVERY
:
'DELIVERY'
,
// 服务单表
DELIVERY
:
'DELIVERY'
,
// 服务单表
ANNUALREPORT
:
'ANNUALREPORT'
,
// 年报表
ANNUALREPORT
:
'ANNUALREPORT'
,
// 年报表
};
};
// 服务名称
// 服务名称
System
.
SERVICECODE
=
{
System
.
SERVICECODE
=
{
ICP
:
'ICP'
,
ICP
:
'ICP'
,
EDI
:
'EDI'
,
EDI
:
'EDI'
,
ICPANNUALREPORT
:
'ICPANNUALREPORT'
,
ICPANNUALREPORT
:
'ICPANNUALREPORT'
,
EDIANNUALREPORT
:
'EDIANNUALREPORT'
,
EDIANNUALREPORT
:
'EDIANNUALREPORT'
,
};
};
// 商机状态
// 商机状态
System
.
BUSSTATUS
=
{
System
.
BUSSTATUS
=
{
WAITINGSCHEME
:
'beforeSubmission'
,
// 待提交方案
WAITINGSCHEME
:
'beforeSubmission'
,
// 待提交方案
WAITINGCONFIRM
:
'beforeConfirmation'
,
// 待用户确认
WAITINGCONFIRM
:
'beforeConfirmation'
,
// 待用户确认
SUCCESS
:
'isFinished'
,
// 已成交
SUCCESS
:
'isFinished'
,
// 已成交
CLOSED
:
'isClosed'
,
// 需求关闭
CLOSED
:
'isClosed'
,
// 需求关闭
};
};
// 方案状态
// 方案状态
System
.
SCHEMESTATUS
=
{
System
.
SCHEMESTATUS
=
{
WAITINGCONFIRM
:
'beforeConfirmation'
,
// 待用户确认.
WAITINGCONFIRM
:
'beforeConfirmation'
,
// 待用户确认.
CLOSED
:
'isClosed'
,
// 方案关闭
CLOSED
:
'isClosed'
,
// 方案关闭
REJECT
:
'isReject'
,
// 方案被拒绝
REJECT
:
'isReject'
,
// 方案被拒绝
};
};
// 资质服务单状态
// 资质服务单状态
System
.
SERVERSESTATUS
=
{
System
.
SERVERSESTATUS
=
{
RECEIVED
:
'received'
,
// 已接单
RECEIVED
:
'received'
,
// 已接单
COLLECTING
:
'collecting'
,
// 收集材料中
COLLECTING
:
'collecting'
,
// 收集材料中
SUBMITING
:
'submiting'
,
// 递交材料中
SUBMITING
:
'submiting'
,
// 递交材料中
DISPOSEING
:
'disposeing'
,
// 工信部处理中
DISPOSEING
:
'disposeing'
,
// 工信部处理中
POSTING
:
'posting'
,
// 证书已邮寄
POSTING
:
'posting'
,
// 证书已邮寄
SUCCESS
:
'success'
,
// 服务已完成
SUCCESS
:
'success'
,
// 服务已完成
CLOSED
:
'closed'
,
// 已关闭
CLOSED
:
'closed'
,
// 已关闭
};
};
// 年报服务单状态
// 年报服务单状态
System
.
ANNUALREPORT
=
{
System
.
ANNUALREPORT
=
{
RECEIVED
:
'received'
,
// 已接单
RECEIVED
:
'received'
,
// 已接单
WAITDECLARE
:
'waitdeclare'
,
// 待申报
WAITDECLARE
:
'waitdeclare'
,
// 待申报
DECLARESUCCESS
:
'declaresuccess'
,
// 申报成功
DECLARESUCCESS
:
'declaresuccess'
,
// 申报成功
SUCCESS
:
'success'
,
// 服务已完成
SUCCESS
:
'success'
,
// 服务已完成
CLOSED
:
'closed'
,
// 已关闭
CLOSED
:
'closed'
,
// 已关闭
TAKEEFFECT
:
'takeeffect'
,
// 生效
TAKEEFFECT
:
'takeeffect'
,
// 生效
};
};
// 渠道名
// 渠道名
System
.
SOURCENAME
=
{
System
.
SOURCENAME
=
{
tencentCloud
:
'腾讯云'
,
tencentCloud
:
'腾讯云'
,
};
};
/*
/*
...
...
icp-deliver/app/base/utils/redisClient.js
View file @
b669e8db
...
@@ -249,7 +249,7 @@ module.exports = RedisClient;
...
@@ -249,7 +249,7 @@ module.exports = RedisClient;
// console.log(r);
// console.log(r);
// });
// });
// console.dir(client);ti.exec( callback )
// console.dir(client);ti.exec( callback )
//回调函数参数err:返回null或者Array,出错则返回对应命令序列链中发生错误的错误信息,这个数组中最后一个元素是源自exec本身的一个EXECABORT类型的错误
//
回调函数参数err:返回null或者Array,出错则返回对应命令序列链中发生错误的错误信息,这个数组中最后一个元素是源自exec本身的一个EXECABORT类型的错误
// r.set("hello","oooo").then(function(result){
// r.set("hello","oooo").then(function(result){
// console.log(result);
// console.log(result);
// });
// });
...
...
icp-deliver/app/base/utils/totxClient.js
View file @
b669e8db
...
@@ -228,9 +228,7 @@ function buildValue(value, cryptStr) {
...
@@ -228,9 +228,7 @@ function buildValue(value, cryptStr) {
}));
}));
}
}
if
(
newValue
.
proposerInfo
.
businessInformation
)
{
if
(
newValue
.
proposerInfo
.
businessInformation
)
{
newValue
.
proposerInfo
.
businessInformation
.
fixedTelephone
=
cryptStr
(
newValue
.
proposerInfo
.
businessInformation
.
fixedTelephone
=
cryptStr
(
newValue
.
proposerInfo
.
businessInformation
.
fixedTelephone
);
newValue
.
proposerInfo
.
businessInformation
.
fixedTelephone
);
}
}
}
}
if
(
newValue
.
shareholderData
)
{
if
(
newValue
.
shareholderData
)
{
...
...
icp-deliver/app/config/routes/api.js
View file @
b669e8db
...
@@ -48,9 +48,9 @@ module.exports = function (app) {
...
@@ -48,9 +48,9 @@ module.exports = function (app) {
const
invokeObj
=
System
.
getObject
(
`api.
${
classPath
}
`
);
const
invokeObj
=
System
.
getObject
(
`api.
${
classPath
}
`
);
if
(
invokeObj
.
doexec
)
{
if
(
invokeObj
.
doexec
)
{
p
=
invokeObj
.
doexec
.
apply
(
invokeObj
,
params
);
p
=
invokeObj
.
doexec
.
apply
(
invokeObj
,
params
);
p
.
then
((
r
)
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
});
}
}
p
.
then
((
r
)
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
};
};
icp-deliver/app/config/routes/web.js
View file @
b669e8db
...
@@ -16,10 +16,10 @@ module.exports = function (app) {
...
@@ -16,10 +16,10 @@ module.exports = function (app) {
const
invokeObj
=
system
.
getObject
(
`web.
${
classPath
}
`
);
const
invokeObj
=
system
.
getObject
(
`web.
${
classPath
}
`
);
if
(
invokeObj
.
doexec
)
{
if
(
invokeObj
.
doexec
)
{
p
=
invokeObj
.
doexec
.
apply
(
invokeObj
,
params
);
p
=
invokeObj
.
doexec
.
apply
(
invokeObj
,
params
);
p
.
then
((
r
)
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
});
}
}
p
.
then
((
r
)
=>
{
res
.
end
(
JSON
.
stringify
(
r
));
});
});
});
app
.
post
(
'/web/:gname/:qname/:method'
,
(
req
,
res
)
=>
{
app
.
post
(
'/web/:gname/:qname/:method'
,
(
req
,
res
)
=>
{
req
.
codepath
=
req
.
headers
.
codepath
;
req
.
codepath
=
req
.
headers
.
codepath
;
...
...
icp-deliver/dochelp/imghandle.js
View file @
b669e8db
...
@@ -3,7 +3,7 @@ const fs = require('fs');
...
@@ -3,7 +3,7 @@ const fs = require('fs');
// function to encode file data to base64 encoded string
// function to encode file data to base64 encoded string
function
base64Encode
(
file
)
{
function
base64Encode
(
file
)
{
// read binary data
// read binary data
const
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
const
bf
=
Buffer
.
alloc
(
bitmap
.
length
,
bitmap
);
const
bf
=
Buffer
.
alloc
(
bitmap
.
length
,
bitmap
);
return
bf
.
toString
(
'base64'
);
return
bf
.
toString
(
'base64'
);
...
@@ -19,15 +19,15 @@ function base64Decode(base64str, file) {
...
@@ -19,15 +19,15 @@ function base64Decode(base64str, file) {
function
getDataUrl
(
filepath
)
{
function
getDataUrl
(
filepath
)
{
const
str
=
base64Encode
(
filepath
);
const
str
=
base64Encode
(
filepath
);
let
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'
;
}
}
const
dataurl
=
`data:
${
mime
}
;base64,
${
str
}
`
;
const
dataurl
=
`data:
${
mime
}
;base64,
${
str
}
`
;
return
dataurl
;
return
dataurl
;
...
...
icp-deliver/dowloaddemo.js
View file @
b669e8db
data
:
function
()
{
data
:
function
()
{
return
{
return
{
downloadTimes
:
1
,
// 设置检查重试次数变量,
downloadTimes
:
1
,
// 设置检查重试次数变量,
code
:
''
,
// 下载文件的code值
code
:
''
,
// 下载文件的code值
}
}
},
},
methods
:
{
methods
:
{
// 创建下载文件方法
// 创建下载文件方法
exportFile
()
{
exportFile
()
{
var
self
=
this
;
var
self
=
this
;
var
datas
=
self
.
querydata
;
var
datas
=
self
.
querydata
;
if
(
!
datas
||
datas
.
length
==
0
)
{
if
(
!
datas
||
datas
.
length
==
0
)
{
that
.
$message
.
warning
(
`无查询结果`
);
that
.
$message
.
warning
(
`无查询结果`
);
return
;
return
;
}
}
/* [{},{},{}]转换成[[],[],[]] 格式 */
/* [{},{},{}]转换成[[],[],[]] 格式 */
var
rows
=
[];
var
rows
=
[];
for
(
var
dd
of
datas
)
{
for
(
var
dd
of
datas
)
{
var
arr
=
[];
var
arr
=
[];
for
(
var
_idx
in
dd
)
{
for
(
var
_idx
in
dd
)
{
arr
.
push
(
dd
[
_idx
]);
arr
.
push
(
dd
[
_idx
]);
}
}
rows
.
push
(
arr
);
rows
.
push
(
arr
);
}
}
this
.
code
=
""
;
this
.
code
=
""
;
/* 生成文件 */
/* 生成文件 */
self
.
$root
.
postReq
(
"/web/filedownloadCtl/download"
,
{
rows
:
rows
}).
then
(
function
(
d
)
{
self
.
$root
.
postReq
(
"/web/filedownloadCtl/download"
,
{
rows
:
rows
}).
then
(
function
(
d
)
{
if
(
d
.
status
==
0
)
{
if
(
d
.
status
==
0
)
{
setTimeout
((
function
()
{
setTimeout
((
function
()
{
/* d.data 返回文件标识 */
/* d.data 返回文件标识 */
self
.
code
=
d
.
data
;
self
.
code
=
d
.
data
;
self
.
downloadFile
();
self
.
downloadFile
();
...
@@ -38,21 +38,21 @@ methods : {
...
@@ -38,21 +38,21 @@ methods : {
/* 循环检查code, 并下载文件 */
/* 循环检查code, 并下载文件 */
downloadFile
()
{
downloadFile
()
{
var
self
=
this
;
var
self
=
this
;
self
.
$root
.
postReq
(
"/web/filedownloadCtl/findOne"
,
{
code
:
self
.
code
}).
then
(
function
(
d
)
{
self
.
$root
.
postReq
(
"/web/filedownloadCtl/findOne"
,
{
code
:
self
.
code
}).
then
(
function
(
d
)
{
if
(
d
.
status
==
0
)
{
if
(
d
.
status
==
0
)
{
if
(
d
.
data
&&
d
.
data
.
filePath
)
{
if
(
d
.
data
&&
d
.
data
.
filePath
)
{
downloadTimes
=
1
;
downloadTimes
=
1
;
/* 文件生成成功 */
/* 文件生成成功 */
window
.
open
(
d
.
data
.
filePath
,
"_blank"
);
window
.
open
(
d
.
data
.
filePath
,
"_blank"
);
}
else
{
}
else
{
/* 递归2秒一次,超过5次,下载失败 */
/* 递归2秒一次,超过5次,下载失败 */
if
(
downloadTimes
>
5
)
{
if
(
downloadTimes
>
5
)
{
downloadTimes
=
1
;
downloadTimes
=
1
;
/* 下载超时 */
/* 下载超时 */
return
;
return
;
}
}
downloadTimes
=
downloadTimes
+
1
;
downloadTimes
=
downloadTimes
+
1
;
setTimeout
((
function
()
{
setTimeout
((
function
()
{
self
.
downloadFile
();
self
.
downloadFile
();
}),
2000
);
}),
2000
);
}
}
...
...
icp-deliver/gulpfile.js
deleted
100644 → 0
View file @
577fbddf
const
gulp
=
require
(
'gulp'
);
const
fs
=
require
(
"fs"
);
const
tap
=
require
(
'gulp-tap'
);
const
minimist
=
require
(
'minimist'
);
const
merge
=
require
(
'merge-stream'
);
const
rename
=
require
(
'gulp-rename'
);
const
del
=
require
(
"del"
);
const
concat
=
require
(
'gulp-concat'
);
const
gulpif
=
require
(
"gulp-if"
);
const
knownOptions
=
{
string
:
'name'
,
string
:
'bizfile'
,
default
:
{
name
:
process
.
env
.
NODE_ENV
||
'Test'
}
};
const
options
=
minimist
(
process
.
argv
.
slice
(
2
),
knownOptions
);
const
name
=
options
.
name
;
const
bizfile
=
options
.
bizfile
;
const
BUILD_PATH
=
"./extra/build"
;
const
DEST_PATH
=
"./extra/dest"
;
const
CTL_PATH
=
"./app/base/controller/impl"
;
const
SERVICE_PATH
=
"./app/base/service/impl"
;
const
DAO_PATH
=
"./app/base/db/impl"
;
const
PAGE_PATH
=
"./app/front/vues/pages"
;
const
VUECOM_PATH
=
"./app/front/vues"
;
const
CSS_PATH
=
"./app/front/entry/public/css"
;
const
IMG_PATH
=
"./extra/imgs"
;
const
DEST_IMGPATH
=
"./app/front/entry/public/imgs"
;
const
METABIZ_PATH
=
"./app/base/db/metadata/bizs/wx76a324c5d201d1a4"
;
gulp
.
task
(
'makefile'
,
function
(
done
)
{
// 将你的默认的任务代码放在这
del
(
"./extra/dest/*"
);
const
tmpName
=
name
.
toLowerCase
();
const
fstream
=
gulp
.
src
(
"./extra/build/*.js"
)
.
pipe
(
tap
(
function
(
file
)
{
const
sfile
=
file
.
contents
.
toString
(
'utf-8'
);
const
rpstr
=
sfile
.
replace
(
/
\$\{
Name
\}
/g
,
name
);
file
.
contents
=
new
Buffer
(
rpstr
,
"utf-8"
);
})).
pipe
(
rename
(
function
(
path
)
{
path
.
basename
=
path
.
basename
.
replace
(
"templ"
,
tmpName
);
})
).
pipe
(
gulp
.
dest
(
"./extra/dest"
));
return
fstream
;
// const pageStream=gulp.src("./extra/build/page/**/*").pipe(
// gulp.dest("./extra/dest")
// );
// return merge(fstream, pageStream);
});
gulp
.
task
(
'page'
,
function
(
cbk
)
{
const
tmpName
=
name
.
toLowerCase
();
return
gulp
.
src
(
"./extra/build/page/templPage/*.*"
)
.
pipe
(
rename
(
function
(
path
)
{
path
.
basename
=
path
.
basename
.
replace
(
"templ"
,
tmpName
);
})
).
pipe
(
tap
(
function
(
file
)
{
const
sfile
=
file
.
contents
.
toString
();
const
rpstr
=
sfile
.
replace
(
/
\$\{
COMNAME
\}
/g
,
"gsb_"
+
tmpName
);
file
.
contents
=
new
Buffer
(
rpstr
,
"utf-8"
);
})).
pipe
(
gulp
.
dest
(
"./extra/dest/"
+
tmpName
+
"/"
)
);
});
gulp
.
task
(
"cpctl"
,
function
(
cbk
)
{
const
tmpName
=
name
.
toLowerCase
();
return
gulp
.
src
(
"./extra/dest/"
+
tmpName
+
"Ctl.js"
).
pipe
(
rename
(
function
(
path
)
{
path
.
basename
=
path
.
basename
.
substring
(
0
,
1
).
toLowerCase
()
+
path
.
basename
.
substring
(
1
);
})
).
pipe
(
gulp
.
dest
(
CTL_PATH
));
});
gulp
.
task
(
"cpsve"
,
function
(
cbk
)
{
const
tmpName
=
name
.
toLowerCase
();
return
gulp
.
src
(
"./extra/dest/"
+
tmpName
+
"Sve.js"
).
pipe
(
rename
(
function
(
path
)
{
path
.
basename
=
path
.
basename
.
substring
(
0
,
1
).
toLowerCase
()
+
path
.
basename
.
substring
(
1
);
})
).
pipe
(
gulp
.
dest
(
SERVICE_PATH
));
});
gulp
.
task
(
"cpdao"
,
function
(
cbk
)
{
const
tmpName
=
name
.
toLowerCase
();
return
gulp
.
src
(
"./extra/dest/"
+
tmpName
+
"Dao.js"
).
pipe
(
rename
(
function
(
path
)
{
path
.
basename
=
path
.
basename
.
substring
(
0
,
1
).
toLowerCase
()
+
path
.
basename
.
substring
(
1
);
})
).
pipe
(
gulp
.
dest
(
DAO_PATH
));
});
gulp
.
task
(
"cppage"
,
function
(
cbk
)
{
const
tmpName
=
name
.
toLowerCase
();
return
gulp
.
src
(
"./extra/dest/"
+
tmpName
+
"/*.*"
).
pipe
(
gulp
.
dest
(
PAGE_PATH
+
"/"
+
tmpName
+
"/"
));
});
gulp
.
task
(
"cpbizfile"
,
function
(
cbk
)
{
return
gulp
.
src
(
"./extra/build/page/meta.js"
).
pipe
(
rename
(
function
(
path
)
{
if
(
bizfile
)
{
path
.
basename
=
bizfile
;
}
else
{
path
.
basename
=
name
;
}
})
).
pipe
(
gulp
.
dest
(
METABIZ_PATH
+
"/"
));
});
gulp
.
task
(
"simple"
,
[
'page'
,
'cppage'
,
'cpbizfile'
],
function
(
done
)
{
done
();
});
gulp
.
task
(
'all'
,
[
'makefile'
,
'page'
,
'cpctl'
,
'cpsve'
,
'cpdao'
,
'cppage'
,
'cpbizfile'
],
function
(
done
)
{
done
();
});
const
minifycss
=
require
(
'gulp-minify-css'
)
gulp
.
task
(
"pagecss"
,
function
(
cbk
)
{
function
defaultcondition
(
file
)
{
if
(
file
.
path
.
indexOf
(
"spring"
)
>=
0
)
{
return
false
;
}
else
if
(
file
.
path
.
indexOf
(
"summer"
)
>=
0
)
{
return
false
;
}
else
if
(
file
.
path
.
indexOf
(
"autumn"
)
>=
0
)
{
return
false
;
}
else
if
(
file
.
path
.
indexOf
(
"winter"
)
>=
0
)
{
return
false
;
}
else
{
return
true
;
}
}
return
gulp
.
src
(
VUECOM_PATH
+
"/**/*/*.css"
).
pipe
(
gulpif
(
defaultcondition
,
concat
(
"pagecom.css"
))
).
pipe
(
minifycss
()).
pipe
(
gulp
.
dest
(
CSS_PATH
+
"/"
));
});
gulp
.
task
(
"springcss"
,
function
(
cbk
)
{
function
springcondition
(
file
)
{
if
(
file
.
path
.
indexOf
(
"spring"
)
>=
0
)
{
return
true
;
}
return
false
;
}
return
gulp
.
src
(
VUECOM_PATH
+
"/**/*/*.css"
).
pipe
(
gulpif
(
springcondition
,
concat
(
"spring.css"
))
).
pipe
(
minifycss
()).
pipe
(
gulp
.
dest
(
CSS_PATH
+
"/"
));
});
gulp
.
task
(
"summercss"
,
function
(
cbk
)
{
function
summercondition
(
file
)
{
if
(
file
.
path
.
indexOf
(
"summer"
)
>=
0
)
{
return
true
;
}
return
false
;
}
return
gulp
.
src
(
VUECOM_PATH
+
"/**/*/*.css"
).
pipe
(
gulpif
(
summercondition
,
concat
(
"summer.css"
))
).
pipe
(
minifycss
()).
pipe
(
gulp
.
dest
(
CSS_PATH
+
"/"
));
});
gulp
.
task
(
"autumncss"
,
function
(
cbk
)
{
function
autumncondition
(
file
)
{
if
(
file
.
path
.
indexOf
(
"autumn"
)
>=
0
)
{
return
true
;
}
return
false
;
}
return
gulp
.
src
(
VUECOM_PATH
+
"/**/*/*.css"
).
pipe
(
gulpif
(
autumncondition
,
concat
(
"autumn.css"
))
).
pipe
(
minifycss
()).
pipe
(
gulp
.
dest
(
CSS_PATH
+
"/"
));
});
gulp
.
task
(
"wintercss"
,
function
(
cbk
)
{
function
wintercondition
(
file
)
{
if
(
file
.
path
.
indexOf
(
"winter"
)
>=
0
)
{
return
true
;
}
return
false
;
}
return
gulp
.
src
(
VUECOM_PATH
+
"/**/*/*.css"
).
pipe
(
gulpif
(
wintercondition
,
concat
(
"winter.css"
))
).
pipe
(
minifycss
()).
pipe
(
gulp
.
dest
(
CSS_PATH
+
"/"
));
});
gulp
.
task
(
"1"
,
function
(
cbk
)
{
function
mobilecondition
(
file
)
{
if
(
file
.
path
.
indexOf
(
"mobile"
)
>=
0
)
{
return
true
;
}
return
false
;
}
return
gulp
.
src
(
VUECOM_PATH
+
"/**/*/*.css"
).
pipe
(
gulpif
(
mobilecondition
,
concat
(
"mobile.css"
))
).
pipe
(
minifycss
()).
pipe
(
gulp
.
dest
(
CSS_PATH
+
"/"
));
});
gulp
.
task
(
'allcss'
,
[
'pagecss'
,
'springcss'
,
'summercss'
,
'autumncss'
,
'wintercss'
],
function
(
done
)
{
done
();
});
gulp
.
task
(
'watch'
,
function
()
{
gulp
.
watch
(
VUECOM_PATH
+
"/**/*/*.css"
,
gulp
.
series
([
'allcss'
]));
});
gulp
.
task
(
"basehandle"
,
function
(
cbk
)
{
return
gulp
.
src
(
VUECOM_PATH
+
"/base/**/*.vue"
).
pipe
(
tap
(
function
(
file
)
{
file
.
contents
=
new
Buffer
(
require
(
file
.
path
).
replace
(
/
\n
/g
,
""
),
"utf-8"
);
})).
pipe
(
gulp
.
dest
(
VUECOM_PATH
+
"/allie/base/"
));
});
const
gulp
=
require
(
'gulp'
),
imagemin
=
require
(
'gulp-imagemin'
);
pngquant
=
require
(
'imagemin-pngquant'
),
gulp
.
task
(
'testimg'
,
function
()
{
del
(
"./extra/testimgs/*"
);
return
gulp
.
src
(
IMG_PATH
+
'/**/*.{png,jpg,gif,ico}'
)
.
pipe
(
imagemin
({
optimizationLevel
:
1
,
//类型:Number 默认:3 取值范围:0-7(优化等级)
progressive
:
true
,
//类型:Boolean 默认:false 无损压缩jpg图片
interlaced
:
true
,
//类型:Boolean 默认:false 隔行扫描gif进行渲染
multipass
:
true
,
//类型:Boolean 默认:false 多次优化svg直到完全优化
use
:
[
pngquant
({
quality
:
[
0.3
]
})]
}))
//.pipe(gulp.dest(DEST_IMGPATH));
.
pipe
(
gulp
.
dest
(
"./extra/testimgs/"
));
});
\ No newline at end of file
icp-deliver/main.js
View file @
b669e8db
const
http
=
require
(
'http'
);
const
http
=
require
(
'http'
);
const
express
=
require
(
'express'
);
const
express
=
require
(
'express'
);
const
app
=
express
();
const
app
=
express
();
const
setttings
=
require
(
"./app/config/settings"
);
const
setttings
=
require
(
'./app/config/settings'
);
const
environment
=
require
(
'./app/config/environment'
);
const
environment
=
require
(
'./app/config/environment'
);
// const 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
environment
(
app
);
//初始化环境
environment
(
app
);
//
初始化环境
// 错误处理中间件应当在路由加载之后才能加载
// 错误处理中间件应当在路由加载之后才能加载
// if (cluster.isMaster) {
// if (cluster.isMaster) {
// console.log(`Master ${process.pid} is running`);
// console.log(`Master ${process.pid} is running`);
...
@@ -27,8 +27,8 @@ environment(app);//初始化环境
...
@@ -27,8 +27,8 @@ environment(app);//初始化环境
// });
// });
// }
// }
const
server
=
http
.
createServer
(
app
);
const
server
=
http
.
createServer
(
app
);
//const socketServer = new SocketServer(server);
//
const socketServer = new SocketServer(server);
server
.
listen
(
setttings
.
port
,
function
()
{
server
.
listen
(
setttings
.
port
,
()
=>
{
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