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
f0ae8e22
Commit
f0ae8e22
authored
Dec 15, 2020
by
Sxy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 代码规范
parent
23ce138a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
149 deletions
+20
-149
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
+4
-5
ic-deliver/app/base/controller/impl/common/appCtl.js
+0
-122
ic-deliver/app/base/db/impl/bizchance/deliverybillDao.js
+10
-10
ic-deliver/app/base/db/impl/common/cacheManager.js
+4
-10
ic-deliver/app/config/routes/api.js
+2
-2
No files found.
ic-deliver/app/base/controller/impl/bizchance/deliverybillCtl.js
View file @
f0ae8e22
...
...
@@ -619,18 +619,17 @@ class DeliverybillCtl extends CtlBase {
let
result
=
[];
if
(
data
.
master_source_number
)
{
const
orders
=
await
this
.
service
.
findOrderByMasterNumber
(
data
.
master_source_number
);
if
(
orders
&&
orders
.
length
>
0
)
{
result
=
orders
.
map
(
item
=>
{
return
item
.
delivery_code
return
item
.
delivery_code
;
}).
filter
(
item
=>
{
return
item
!==
mobj
.
deliverNumber
})
return
item
!==
mobj
.
deliverNumber
;
})
;
}
}
return
system
.
getResult
(
result
);
}
else
{
throw
new
Error
(
`单号错误
${
mobj
.
deliverNumber
}
`
)
throw
new
Error
(
`单号错误
${
mobj
.
deliverNumber
}
`
)
;
}
}
catch
(
error
)
{
return
system
.
getResultError
(
error
.
message
);
...
...
ic-deliver/app/base/controller/impl/common/appCtl.js
deleted
100644 → 0
View file @
23ce138a
const
system
=
require
(
'../../../system'
);
const
http
=
require
(
'http'
);
const
querystring
=
require
(
'querystring'
);
const
settings
=
require
(
'../../../../config/settings'
);
const
CtlBase
=
require
(
'../../ctl.base'
);
const
cacheBaseComp
=
null
;
class
AppCtl
extends
CtlBase
{
constructor
()
{
super
(
'common'
,
CtlBase
.
getServiceName
(
AppCtl
));
this
.
userCtl
=
system
.
getObject
(
'service.auth.userSve'
);
}
async
findAllApps
(
p
,
q
,
req
)
{
const
rtns
=
await
this
.
service
.
findAllApps
(
p
.
userid
);
return
system
.
getResult
(
rtns
);
}
async
getApp
(
p
,
q
,
req
)
{
const
app
=
await
this
.
cacheManager
.
AppCache
.
cache
(
p
.
appkey
,
null
);
return
system
.
getResult
({
funcJson
:
JSON
.
parse
(
app
.
functionJSON
)
});
}
async
translateToRouter
(
funarray
,
results
,
parent
)
{
funarray
.
forEach
((
item
)
=>
{
const
result
=
{};
result
.
path
=
item
.
code
;
result
.
name
=
item
.
code
;
result
.
meta
=
{
hideInMenu
:
false
,
hideInBread
:
false
,
notCache
:
true
,
title
:
item
.
title
,
icon
:
'replaceIconName'
,
};
result
.
component
=
'replaceRightPath'
;
if
(
parent
)
{
parent
.
children
.
push
(
result
);
}
else
{
results
.
push
(
result
);
}
if
(
item
.
children
&&
item
.
children
.
length
>
0
)
{
result
.
children
=
[];
this
.
translateToRouter
(
item
.
children
,
results
,
result
);
}
});
}
async
buildFrontRouter
(
p
,
q
,
req
)
{
const
{
appkey
}
=
p
;
const
app
=
await
this
.
cacheManager
.
AppCache
.
cache
(
appkey
,
null
);
const
funobj
=
JSON
.
parse
(
app
.
functionJSON
);
const
results
=
[];
await
this
.
translateToRouter
(
funobj
,
results
,
null
);
const
rtns
=
await
this
.
service
.
upFrontRoute
(
results
,
app
.
id
);
await
this
.
cacheManager
.
AppCache
.
invalidate
(
appkey
,
null
);
return
system
.
getResult
({
url
:
rtns
.
url
});
}
async
getFuncs
(
p
,
q
,
req
)
{
const
{
appkey
}
=
p
;
const
app
=
await
this
.
cacheManager
.
AppCache
.
cache
(
appkey
,
null
);
return
system
.
getResult
({
funcJson
:
JSON
.
parse
(
app
.
functionJSON
)
});
// return system.getResult({funcJson:[]})
}
async
saveFuncTree
(
p
,
q
,
req
)
{
const
rtn
=
await
this
.
service
.
saveFuncTree
(
p
);
return
system
.
getResult
(
rtn
);
}
async
create
(
pobj
,
queryobj
,
req
)
{
pobj
.
creator_id
=
pobj
.
userid
;
// 设置创建者
return
super
.
create
(
pobj
,
queryobj
,
req
);
}
async
update
(
pobj
,
queryobj
,
req
)
{
return
super
.
update
(
pobj
,
queryobj
,
req
);
}
async
initNewInstance
(
pobj
,
queryobj
,
req
)
{
const
rtn
=
{};
rtn
.
appkey
=
this
.
getUUID
();
rtn
.
secret
=
this
.
getUUID
();
return
system
.
getResult
(
rtn
);
}
async
resetPass
(
pobj
,
queryobj
,
req
)
{
pobj
.
password
=
await
super
.
encryptPasswd
(
settings
.
defaultpwd
);
const
rtn
=
this
.
service
.
resetPass
(
pobj
);
return
system
.
getResult
(
rtn
);
}
async
createAdminUser
(
pobj
,
queryobj
,
req
)
{
pobj
.
password
=
settings
.
defaultpwd
;
const
rtn
=
this
.
service
.
createAdminUser
(
pobj
);
return
system
.
getResult
(
rtn
);
}
async
create
(
pobj
,
queryobj
,
req
)
{
// 设置创建者,需要同时创建app管理员、默认密码、电话
pobj
.
creator_id
=
pobj
.
userid
;
// pobj.password=super.encryptPasswd(settings.defaultpwd);
// 构造默认的应用相关的URL
pobj
.
authUrl
=
`
${
settings
.
protocalPrefix
+
pobj
.
domainName
}
/auth`
;
pobj
.
docUrl
=
`
${
settings
.
protocalPrefix
+
pobj
.
domainName
}
/web/common/metaCtl/getApiDoc`
;
pobj
.
uiconfigUrl
=
`
${
settings
.
protocalPrefix
+
pobj
.
domainName
}
/api/meta/config/fetchAppConfig`
;
pobj
.
opCacheUrl
=
`
${
settings
.
protocalPrefix
+
pobj
.
domainName
}
/api/meta/opCache/opCacheData`
;
pobj
.
notifyCacheCountUrl
=
`
${
settings
.
protocalPrefix
+
pobj
.
domainName
}
/api/meta/opCache/recvNotificationForCacheCount`
;
const
app
=
await
super
.
create
(
pobj
,
queryobj
,
req
);
return
system
.
getResult
(
app
);
}
async
fetchApiCallData
(
pobj
,
queryobj
,
req
)
{
const
{
curappkey
}
=
pobj
;
// 检索出作为访问时的app呼出调用数据
const
rtn
=
await
this
.
service
.
fetchApiCallData
(
curappkey
);
return
system
.
getResultSuccess
(
rtn
);
}
// 接受缓存计数通知接口
async
recvNotificationForCacheCount
(
p
,
q
,
req
)
{
return
this
.
service
.
recvNotificationForCacheCount
(
p
);
}
}
module
.
exports
=
AppCtl
;
const
p
=
{
appkey
:
'08cb8300-ef1e-4e35-ba49-3de36ba497d2'
};
const
acl
=
new
AppCtl
();
acl
.
buildFrontRouter
(
p
).
then
((
res
)
=>
{
console
.
log
(
res
.
data
);
});
ic-deliver/app/base/db/impl/bizchance/deliverybillDao.js
View file @
f0ae8e22
...
...
@@ -30,7 +30,7 @@ class DeliverybillDao extends Dao {
// 为空说明是管理员,不需设置组织结构过滤
if
(
qobj
.
opath
&&
qobj
.
opath
!=
''
)
{
if
(
!
qw
.
$and
)
{
qw
.
$and
=
[]
qw
.
$and
=
[]
;
}
qw
.
$and
.
push
([{
$or
:
[
...
...
@@ -41,7 +41,7 @@ class DeliverybillDao extends Dao {
salesman_opcode
:
{
[
this
.
db
.
Op
.
like
]:
`%
${
qobj
.
opath
}
%`
},
},
]
}])
}])
;
}
else
{
// 说明是租户管理员,给租户自己核销结算的功能,
if
(
qobj
.
bizpath
.
indexOf
(
'pmxdeliverrequest'
)
>
0
)
{
// 说明是结算核销路由过来的
qw
.
delivery_status
=
'success'
;
...
...
@@ -57,7 +57,7 @@ class DeliverybillDao extends Dao {
if
(
qobj
.
bizpath
.
indexOf
(
'myDeliver'
)
>
0
)
{
// 说明是从商机列表过来的
delete
qw
.
delivery_man_opcode
;
if
(
!
qw
.
$and
)
{
qw
.
$and
=
[]
qw
.
$and
=
[]
;
}
qw
.
$and
.
push
([{
$or
:
[{
...
...
@@ -65,12 +65,12 @@ class DeliverybillDao extends Dao {
},
{
salesman_id
:
qobj
.
userid
,
}]
}])
}])
;
}
if
(
qobj
.
bizpath
.
indexOf
(
'deliveryNoAllocate'
)
>
0
)
{
//未分配列表
if
(
qobj
.
bizpath
.
indexOf
(
'deliveryNoAllocate'
)
>
0
)
{
//
未分配列表
delete
qw
.
delivery_man_opcode
;
if
(
!
qw
.
$and
)
{
qw
.
$and
=
[]
qw
.
$and
=
[]
;
}
qw
.
$and
.
push
({
$or
:
[{
...
...
@@ -84,10 +84,10 @@ class DeliverybillDao extends Dao {
}]
});
}
if
(
qobj
.
bizpath
.
indexOf
(
'deliveryAllocated'
)
>
0
)
{
//已分配列表
if
(
qobj
.
bizpath
.
indexOf
(
'deliveryAllocated'
)
>
0
)
{
//
已分配列表
delete
qw
.
delivery_man_opcode
;
if
(
!
qw
.
$and
)
{
qw
.
$and
=
[]
qw
.
$and
=
[]
;
}
qw
.
$and
.
push
(...[{
delivery_man_id
:
{
...
...
@@ -170,11 +170,11 @@ class DeliverybillDao extends Dao {
if
(
qobj
.
facilitatorName
&&
qobj
.
facilitatorName
!=
'undefined'
)
{
setobj
.
facilitator_name
=
qobj
.
facilitatorName
;
};
let
whereobj
=
{
delivery_code
:
qobj
.
deliverNumber
}
let
whereobj
=
{
delivery_code
:
qobj
.
deliverNumber
}
;
if
(
qobj
.
masterSourceNumber
)
{
whereobj
=
{
master_source_number
:
qobj
.
masterSourceNumber
}
}
;
}
const
result
=
await
this
.
updateByWhere
(
setobj
,
whereobj
);
return
result
;
...
...
ic-deliver/app/base/db/impl/common/cacheManager.js
View file @
f0ae8e22
...
...
@@ -12,22 +12,16 @@ class CacheManager {
const
files
=
fs
.
readdirSync
(
cachePath
);
if
(
files
)
{
files
.
forEach
((
r
)
=>
{
const
c
lassObj
=
require
(
`
${
cachePath
}
/
${
r
}
`
);
self
[
classObj
.
name
]
=
new
c
lassObj
();
const
refTmp
=
self
[
c
lassObj
.
name
];
const
C
lassObj
=
require
(
`
${
cachePath
}
/
${
r
}
`
);
self
[
ClassObj
.
name
]
=
new
C
lassObj
();
const
refTmp
=
self
[
C
lassObj
.
name
];
if
(
refTmp
.
prefix
)
{
self
.
doc
[
refTmp
.
prefix
]
=
refTmp
.
desc
;
}
else
{
console
.
log
(
`请在
${
c
lassObj
.
name
}
缓存中定义prefix`
);
console
.
log
(
`请在
${
C
lassObj
.
name
}
缓存中定义prefix`
);
}
});
}
}
}
module
.
exports
=
CacheManager
;
// var cm= new CacheManager();
// cm["InitGiftCache"].cacheGlobalVal("hello").then(function(){
// cm["InitGiftCache"].cacheGlobalVal().then(x=>{
// console.log(x);
// });
// });
ic-deliver/app/config/routes/api.js
View file @
f0ae8e22
...
...
@@ -23,7 +23,7 @@ module.exports = function (app) {
p
=
invokeObj
.
doexec
.
apply
(
invokeObj
,
params
);
p
.
then
((
r
)
=>
{
// res.end(JSON.stringify(r));
res
.
json
(
r
)
res
.
json
(
r
)
;
});
}
});
...
...
@@ -51,7 +51,7 @@ module.exports = function (app) {
p
=
invokeObj
.
doexec
.
apply
(
invokeObj
,
params
);
p
.
then
((
r
)
=>
{
// res.end(JSON.stringify(r));
res
.
json
(
r
)
res
.
json
(
r
)
;
});
}
});
...
...
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