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
3cd7eb53
Commit
3cd7eb53
authored
Jul 15, 2020
by
蒋勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
d
parent
b36c5fd2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
75 deletions
+53
-75
center-manage/app/base/controller/ctl.base.js
+50
-69
center-manage/app/base/service/impl/product/b.txt
+2
-6
center-manage/app/base/system.js
+1
-0
No files found.
center-manage/app/base/controller/ctl.base.js
View file @
3cd7eb53
...
...
@@ -7,7 +7,7 @@ class CtlBase {
this
.
service
=
system
.
getObject
(
"service."
+
gname
+
"."
+
sname
);
this
.
cacheManager
=
system
.
getObject
(
"db.common.cacheManager"
);
}
getUUID
()
{
getUUID
()
{
var
uuid
=
uuidv4
();
var
u
=
uuid
.
replace
(
/
\-
/g
,
""
);
return
u
;
...
...
@@ -36,35 +36,35 @@ class CtlBase {
}
async
refQuery
(
pobj
,
qobj
,
req
)
{
//pobj.refwhere.app_id=pobj.app_id;//角色过滤按照公司过滤
pobj
.
refwhere
.
company_id
=
pobj
.
company_id
;
let
rtn
=
await
this
.
service
.
refQuery
(
pobj
);
pobj
.
refwhere
.
company_id
=
pobj
.
company_id
;
let
rtn
=
await
this
.
service
.
refQuery
(
pobj
);
return
rtn
}
async
setContextParams
(
pobj
,
qobj
,
req
)
{
let
custtags
=
req
.
headers
[
"x-consumetag"
]
?
req
.
headers
[
"x-consumetag"
].
split
(
"|"
):
null
;
let
lastindex
=
custtags
?
custtags
.
length
-
1
:
0
;
let
custtags
=
req
.
headers
[
"x-consumetag"
]
?
req
.
headers
[
"x-consumetag"
].
split
(
"|"
)
:
null
;
let
lastindex
=
custtags
?
custtags
.
length
-
1
:
0
;
//当自由用户注册时,需要根据前端传来的companykey,查询出公司,给companyid赋值
req
.
xctx
=
{
appkey
:
req
.
headers
[
"xappkey"
],
//用于系统管理区分应用,比如角色
fromappkey
:
req
.
headers
[
"xfromappkey"
],
//来源APP,如果没有来源与appkey相同
companyid
:
custtags
?
custtags
[
0
].
split
(
"_"
)[
1
]:
null
,
fromcompanykey
:
req
.
headers
[
"xfromcompanykey"
],
//专用于自由用户注册,自由用户用于一定属于某个存在的公司
password
:
custtags
?
custtags
[
lastindex
].
split
(
"_"
)[
1
]:
null
,
fromappkey
:
req
.
headers
[
"xfromappkey"
],
//来源APP,如果没有来源与appkey相同
companyid
:
custtags
?
custtags
[
0
].
split
(
"_"
)[
1
]
:
null
,
fromcompanykey
:
req
.
headers
[
"xfromcompanykey"
],
//专用于自由用户注册,自由用户用于一定属于某个存在的公司
password
:
custtags
?
custtags
[
lastindex
].
split
(
"_"
)[
1
]
:
null
,
username
:
req
.
headers
[
"x-consumer-username"
],
userid
:
req
.
headers
[
"x-consumer-custom-id"
],
userid
:
req
.
headers
[
"x-consumer-custom-id"
],
credid
:
req
.
headers
[
"x-credential-identifier"
],
regrole
:
req
.
headers
[
"xregrole"
],
bizpath
:
req
.
headers
[
"xbizpath"
],
codename
:
req
.
headers
[
"xcodename"
],
codetitle
:
req
.
headers
[
"xcodetitle"
]?
decodeURI
(
req
.
headers
[
"xcodetitle"
]):
''
,
regrole
:
req
.
headers
[
"xregrole"
],
bizpath
:
req
.
headers
[
"xbizpath"
],
codename
:
req
.
headers
[
"xcodename"
],
codetitle
:
req
.
headers
[
"xcodetitle"
]
?
decodeURI
(
req
.
headers
[
"xcodetitle"
])
:
''
,
}
if
(
!
req
.
xctx
.
appkey
)
{
return
[
-
200
,
"请求头缺少应用x-app-key"
]
}
else
{
let
app
=
await
this
.
cacheManager
[
"AppCache"
].
cache
(
req
.
xctx
.
fromappkey
);
req
.
xctx
.
appid
=
app
.
id
;
if
(
!
pobj
.
app_id
)
{
pobj
.
app_id
=
app
.
id
;
//传递参数对象里注入app_id
if
(
!
req
.
xctx
.
appkey
)
{
return
[
-
200
,
"请求头缺少应用x-app-key"
]
}
else
{
let
app
=
await
this
.
cacheManager
[
"AppCache"
].
cache
(
req
.
xctx
.
fromappkey
);
req
.
xctx
.
appid
=
app
.
id
;
if
(
!
pobj
.
app_id
)
{
pobj
.
app_id
=
app
.
id
;
//传递参数对象里注入app_id
}
}
//平台注册时,companyid,companykey都为空
...
...
@@ -72,63 +72,44 @@ class CtlBase {
// if(!req.xctx.companyid && !req.xctx.companykey){
// return [-200,"请求头缺少应用x-app-key"]
// }
if
(
!
req
.
xctx
.
companyid
&&
req
.
xctx
.
fromcompanykey
&&
req
.
xctx
.
fromcompanykey
!=
"null"
&&
req
.
xctx
.
fromcompanykey
!=
"undefined"
)
{
let
comptmp
=
await
this
.
cacheManager
[
"CompanyCache"
].
cache
(
req
.
xctx
.
fromcompanykey
);
req
.
xctx
.
companyid
=
comptmp
.
id
;
if
(
!
req
.
xctx
.
companyid
&&
req
.
xctx
.
fromcompanykey
&&
req
.
xctx
.
fromcompanykey
!=
"null"
&&
req
.
xctx
.
fromcompanykey
!=
"undefined"
)
{
let
comptmp
=
await
this
.
cacheManager
[
"CompanyCache"
].
cache
(
req
.
xctx
.
fromcompanykey
);
req
.
xctx
.
companyid
=
comptmp
.
id
;
}
if
(
req
.
xctx
.
companyid
)
{
//在请求传递数据对象注入公司id
pobj
.
company_id
=
req
.
xctx
.
companyid
;
if
(
req
.
xctx
.
companyid
)
{
//在请求传递数据对象注入公司id
pobj
.
company_id
=
req
.
xctx
.
companyid
;
}
if
(
req
.
xctx
.
userid
)
{
//在请求传递数据对象注入公司id
pobj
.
userid
=
req
.
xctx
.
userid
;
pobj
.
username
=
req
.
xctx
.
username
;
if
(
req
.
xctx
.
userid
)
{
//在请求传递数据对象注入公司id
pobj
.
userid
=
req
.
xctx
.
userid
;
pobj
.
username
=
req
.
xctx
.
username
;
}
pobj
.
bizpath
=
req
.
xctx
.
bizpath
;
pobj
.
bizpath
=
req
.
xctx
.
bizpath
;
}
async
log
(
pobj
,
req
,
rtn
)
{
rtn
.
requestId
=
this
.
getUUID
()
req
.
params
.
param
=
pobj
//第三个字段应该存公司id
system
.
execLogs
(
req
.
xctx
.
codetitle
,
req
.
params
,
pobj
.
company_id
,
rtn
,
null
).
then
(
res
=>
{
if
(
res
&&
res
.
status
==
1
)
{
console
.
log
(
"log.....success"
)
}
else
{
console
.
log
(
"log.....fail"
)
}
}).
catch
(
e
=>
{
console
.
log
(
"log.....fail"
)
})
}
async
doexec
(
methodname
,
pobj
,
query
,
req
)
{
try
{
let
xarg
=
await
this
.
setContextParams
(
pobj
,
query
,
req
);
if
(
xarg
&&
xarg
[
0
]
<
0
)
{
return
system
.
getResultFail
(...
xarg
);
let
xarg
=
await
this
.
setContextParams
(
pobj
,
query
,
req
);
if
(
xarg
&&
xarg
[
0
]
<
0
)
{
return
system
.
getResultFail
(...
xarg
);
}
//从请求头里面取appkey_consumename
// var consumeName=req.headers[""]
// var appkey=
// if( this.session["appkey_consumename"]) {
// }else{
// //从头里取,从redis中取出缓存对象赋值到控制基类的session属性
// //appkey_consumename
// this.session={};
// }
//req.session=redis缓存的上下文对象
var
rtn
=
await
this
[
methodname
](
pobj
,
query
,
req
);
rtn
.
requestId
=
this
.
getUUID
()
req
.
params
.
param
=
pobj
//第三个字段应该存公司id
system
.
execLogs
(
req
.
xctx
.
codetitle
,
req
.
params
,
pobj
.
company_id
,
rtn
,
null
).
then
(
res
=>
{
if
(
res
&&
res
.
status
==
1
){
console
.
log
(
"log.....success"
)
}
else
{
console
.
log
(
"log.....fail"
)
}
}).
catch
(
e
=>
{
console
.
log
(
"log.....fail"
)
})
//this.log(pobj,req,rtn)
return
rtn
;
}
catch
(
e
)
{
let
rtn
=
{}
rtn
.
requestId
=
this
.
getUUID
()
req
.
params
.
param
=
pobj
system
.
execLogs
(
req
.
xctx
.
codetitle
,
req
.
params
,
pobj
.
company_id
,
rtn
,
e
).
then
(
res
=>
{
if
(
res
&&
res
.
status
==
1
){
console
.
log
(
"log.....success"
)
}
else
{
console
.
log
(
"log.....fail"
)
}
}).
catch
(
e
=>
{
console
.
log
(
"log.....fail"
)
})
//this.log(pobj,req,rtn)
console
.
log
(
e
.
stack
,
"出现异常,请联系管理员......."
);
return
system
.
getResultFail
(
-
200
,
"出现异常,请联系管理员"
);
}
...
...
@@ -136,7 +117,7 @@ class CtlBase {
}
module
.
exports
=
CtlBase
;
/*
地址:http://192.168.1.128:401/api/queueAction/producer/springBoard
地址:http://192.168.1.128:401/api/queueAction/producer/springBoard
请求方式:post
参数:
{
...
...
center-manage/app/base/service/impl/product/b.txt
View file @
3cd7eb53
[
{"id":41,"price_code":"sv_business_registration_category_indi7","product_name":"/ic/cpreg/","price_name":"个体工商","created_at":null,"updated_at":null,"deleted_at":null,"version":null},
{"id":42,"price_code":"sv_business_registration_category_lp7","product_name":"/ic/cpreg/","price_name":"有限公司","created_at":null,"updated_at":null,"deleted_at":null,"version":null},
{"id":43,"price_code":"sv_business_registration_category_sole7","product_name":"/ic/cpreg/","price_name":"个人独资","created_at":null,"updated_at":null,"deleted_at":null,"version":null}
]
\ No newline at end of file
[{"id":41,"price_code":"sv_business_registration_category_indi7","product_name":"/ic/cpreg/","price_name":"个体工商","created_at":null,"updated_at":null,"deleted_at":null,"version":null},{"id":42,"price_code":"sv_business_registration_category_lp7","product_name":"/ic/cpreg/","price_name":"有限公司","created_at":null,"updated_at":null,"deleted_at":null,"version":null},{"id":43,"price_code":"sv_business_registration_category_sole7","product_name":"/ic/cpreg/","price_name":"个人独资","created_at":null,"updated_at":null,"deleted_at":null,"version":null}]
\ No newline at end of file
center-manage/app/base/system.js
View file @
3cd7eb53
...
...
@@ -74,6 +74,7 @@ class System {
},
body
:
data
},
function
(
error
,
response
,
body
)
{
console
.
log
(
response
)
console
.
log
(
error
)
if
(
!
error
)
{
rtn
.
statusCode
=
response
.
statusCode
...
...
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