Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zjxcxServer
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
node_server
zjxcxServer
Commits
989ff822
Commit
989ff822
authored
Feb 24, 2023
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化请求参数校验
parent
f527f0f8
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
252 additions
and
107 deletions
+252
-107
enum.ts
src/config/enum.ts
+48
-0
grade.ts
src/data/fuHuaQi/grade.ts
+34
-0
enterprise.ts
src/routers/admin/enterprise.ts
+10
-5
fuHuaQi.ts
src/routers/admin/fuHuaQi.ts
+13
-8
user.ts
src/routers/admin/user.ts
+2
-2
enterprise.ts
src/routers/mobileClient/enterprise.ts
+41
-7
financing.ts
src/routers/mobileClient/financing.ts
+5
-5
fuHuaQi.ts
src/routers/mobileClient/fuHuaQi.ts
+59
-9
month.ts
src/routers/mobileClient/month.ts
+3
-3
user.ts
src/routers/mobileClient/user.ts
+3
-3
verificationParam.ts
src/util/verificationParam.ts
+34
-65
No files found.
src/config/enum.ts
View file @
989ff822
...
...
@@ -149,3 +149,51 @@ export enum FINANCINGROUNDS {
C
轮
,
C
轮以上
,
}
/**
* 孵化状态
*/
export
enum
FUHUASTATE
{
实体孵化
=
1
,
虚拟孵化
,
迁出
}
/**
* 虚拟孵化原因
*/
export
enum
VIRTUALCAUSE
{
政策服务
=
1
,
融资服务
,
研发服务
,
市场对接
,
技术对接
,
其他
,
}
/**
* 迁出类型
*/
export
enum
MOVEOUTTYPE
{
企业注销
=
1
,
迁出孵化器
_
仍在张江
,
迁出张江
_
仍在浦东
,
迁出浦东
_
仍在上海
,
迁出上海
,
}
/**
* 迁出原因
*/
export
enum
MOVEOUTCAUSE
{
政策不给力
=
1
,
人才需求不足
,
经营成本过高
_
场地成本或人员成本
_
,
办公空间拓展
_
无合适办公空间
_
,
产业环境不足
,
其他
}
src/data/fuHuaQi/grade.ts
0 → 100644
View file @
989ff822
/**
* 评分表
* 用于存储评分规则
*
*/
import
{
Schema
}
from
'mongoose'
;
import
{
baseDB
}
from
'../../db/mongo/dbInit'
;
const
gradeSchema
=
new
Schema
({
});
var
gradeModel
;
export
function
initModel
(){
gradeModel
=
baseDB
.
model
(
'grade'
,
gradeSchema
);
gradeModel
.
selectOnceData
=
async
function
(
paramater
:
object
)
{
let
selectInfo
=
await
gradeModel
.
findOne
(
paramater
).
exec
();
if
(
selectInfo
)
{
if
(
!
selectInfo
.
runSave
)
{
selectInfo
.
runSave
=
selectInfo
.
save
;
selectInfo
.
save
=
save
.
bind
(
selectInfo
)
}
}
return
selectInfo
;
}
}
export
async
function
save
(
throwError
=
false
)
{
if
(
!
this
.
isModified
())
return
;
await
this
.
runSave
({
validateBeforeSave
:
false
}).
catch
(
err
=>
{
console
.
log
(
err
);
});
}
\ No newline at end of file
src/routers/admin/enterprise.ts
View file @
989ff822
...
...
@@ -9,7 +9,7 @@ import * as enterpriseBiz from '../../biz/enterprise/enterprise';
import
*
as
financingBiz
from
'../../biz/enterprise/financing'
;
import
{
getTimeKey
}
from
'../../tools/system'
;
import
{
checkGuanWeiHuiToken
}
from
'../../middleware/user'
;
import
{
eccReq
NotMustHaveParam
}
from
'../../util/verificationParam'
;
import
{
eccReq
Paramater
}
from
'../../util/verificationParam'
;
export
function
setRouter
(
httpServer
)
{
...
...
@@ -28,7 +28,8 @@ export function setRouter(httpServer) {
*/
async
function
getEnterpriseList
(
req
,
res
)
{
let
reqConf
=
{
createType
:
'Number'
,
fuHuaQiUscc
:
'String'
,
industry
:
'[Number]'
,
isNaturalPersonHolding
:
'Number'
,
page
:
'Number'
};
let
{
createType
,
fuHuaQiUscc
,
industry
,
isNaturalPersonHolding
,
page
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"createType"
,
"fuHuaQiUscc"
,
"industry"
,
"isNaturalPersonHolding"
];
let
{
createType
,
fuHuaQiUscc
,
industry
,
isNaturalPersonHolding
,
page
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
result
=
await
enterpriseBiz
.
enterpriseList
(
createType
,
fuHuaQiUscc
,
industry
,
isNaturalPersonHolding
,
page
);
res
.
success
(
result
);
...
...
@@ -42,7 +43,8 @@ async function getEnterpriseList(req, res) {
*/
async
function
getFinancingList
(
req
,
res
)
{
let
reqConf
=
{
monthData
:
'String'
,
fuHuaQiName
:
'String'
,
fuHuaQiInvestment
:
'Number'
,
industry
:
'[Number]'
,
page
:
'Number'
};
let
{
monthData
,
fuHuaQiName
,
industry
,
fuHuaQiInvestment
,
page
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"monthData"
,
"fuHuaQiName"
,
"fuHuaQiInvestment"
,
"industry"
];
let
{
monthData
,
fuHuaQiName
,
industry
,
fuHuaQiInvestment
,
page
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
result
=
await
financingBiz
.
financingList
(
monthData
,
fuHuaQiName
,
industry
,
fuHuaQiInvestment
,
page
);
res
.
success
(
result
);
...
...
@@ -68,7 +70,9 @@ async function affiliationFuHuaQi(req, res) {
*/
async
function
outPutEnterpriseData
(
req
,
res
)
{
let
reqConf
=
{
createType
:
'Number'
,
fuHuaQiUscc
:
'String'
,
industry
:
'[Number]'
,
isNaturalPersonHolding
:
'Number'
,
type
:
'Number'
};
let
{
createType
,
fuHuaQiUscc
,
industry
,
isNaturalPersonHolding
,
type
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"createType"
,
"fuHuaQiUscc"
,
"industry"
,
"isNaturalPersonHolding"
];
let
{
createType
,
fuHuaQiUscc
,
industry
,
isNaturalPersonHolding
,
type
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
dataList
=
await
enterpriseBiz
.
outPutEnterpriseData
(
createType
,
fuHuaQiUscc
,
industry
,
isNaturalPersonHolding
,
type
);
...
...
@@ -85,7 +89,8 @@ async function outPutEnterpriseData(req, res) {
*/
async
function
outPutFinancingData
(
req
,
res
)
{
let
reqConf
=
{
monthData
:
'String'
,
fuHuaQiName
:
'String'
,
fuHuaQiInvestment
:
'Number'
,
industry
:
'[Number]'
,
type
:
'Number'
};
let
{
monthData
,
fuHuaQiName
,
industry
,
fuHuaQiInvestment
,
type
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"monthData"
,
"fuHuaQiName"
,
"fuHuaQiInvestment"
,
"industry"
];
let
{
monthData
,
fuHuaQiName
,
industry
,
fuHuaQiInvestment
,
type
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
dataList
=
await
financingBiz
.
outPutFinancingList
(
monthData
,
fuHuaQiName
,
industry
,
fuHuaQiInvestment
,
type
);
...
...
src/routers/admin/fuHuaQi.ts
View file @
989ff822
...
...
@@ -9,7 +9,7 @@ import { getTimeKey } from '../../tools/system';
import
{
monthTableList
}
from
'../../biz/fuHuqQi/month'
;
import
{
checkGuanWeiHuiToken
}
from
'../../middleware/user'
;
import
*
as
monthBiz
from
'../../biz/fuHuqQi/month'
;
import
{
eccReq
NotMustHaveParam
,
eccReqMustHaveParam
}
from
'../../util/verificationParam'
;
import
{
eccReq
Paramater
}
from
'../../util/verificationParam'
;
export
function
setRouter
(
httpServer
)
{
...
...
@@ -37,7 +37,8 @@ async function fuHuaQiBaseList(req, res) {
industry
:
'Number'
,
page
:
'Number'
};
let
{
lv
,
institutionalNature
,
industry
,
operationModel
,
foundingTeam
,
page
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"lv"
,
"institutionalNature"
,
"operationModel"
,
"foundingTeam"
,
"industry"
];
let
{
lv
,
institutionalNature
,
industry
,
operationModel
,
foundingTeam
,
page
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
result
=
await
baseBiz
.
fuHuaQiBaseList
(
lv
,
institutionalNature
,
industry
,
operationModel
,
foundingTeam
,
page
);
...
...
@@ -52,7 +53,8 @@ async function fuHuaQiBaseList(req, res) {
*/
async
function
getMonthList
(
req
,
res
)
{
let
reqConf
=
{
state
:
'Number'
,
year
:
'Number'
,
month
:
'Number'
,
page
:
'Number'
};
let
{
state
,
year
,
month
,
page
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"state"
,
"year"
,
"month"
];
let
{
state
,
year
,
month
,
page
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
result
=
await
monthTableList
(
state
,
year
,
month
,
page
);
res
.
success
(
result
);
...
...
@@ -66,7 +68,8 @@ async function getMonthList(req, res) {
*/
async
function
getFuHuaQiUserList
(
req
,
res
)
{
let
reqConf
=
{
operationName
:
'String'
,
page
:
'Number'
};
let
{
operationName
,
page
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"operationName"
];
let
{
operationName
,
page
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
result
=
await
userBiz
.
fuHuaQiUserList
(
operationName
,
page
);
res
.
success
(
result
);
...
...
@@ -80,7 +83,7 @@ async function getMonthList(req, res) {
*/
async
function
updateState
(
req
,
res
)
{
let
reqConf
=
{
userState
:
'Boolean'
,
uscc
:
'String'
};
let
{
userState
,
uscc
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
userState
,
uscc
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
let
result
=
await
userBiz
.
updateState
(
uscc
,
userState
);
res
.
success
(
result
);
...
...
@@ -94,7 +97,7 @@ async function getMonthList(req, res) {
*/
async
function
addUser
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
let
result
=
await
userBiz
.
addUser
(
form
);
res
.
success
(
result
);
...
...
@@ -104,7 +107,8 @@ async function addUser(req, res) {
async
function
outPutFuHuaQiData
(
req
,
res
)
{
let
reqConf
=
{
lv
:
'Number'
,
institutionalNature
:
'Number'
,
industry
:
'Number'
,
type
:
'Number'
,
operationModel
:
"Number"
,
foundingTeam
:
"Number"
};
let
{
lv
,
institutionalNature
,
industry
,
type
,
operationModel
,
foundingTeam
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"lv"
,
"institutionalNature"
,
"industry"
,
"operationModel"
,
"foundingTeam"
];
let
{
lv
,
institutionalNature
,
industry
,
type
,
operationModel
,
foundingTeam
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
dataList
=
await
baseBiz
.
outPutFuHuaQiBaseData
(
lv
,
institutionalNature
,
industry
,
operationModel
,
foundingTeam
,
type
);
...
...
@@ -118,7 +122,8 @@ async function outPutFuHuaQiData(req, res) {
async
function
outPutMonthData
(
req
,
res
)
{
let
reqConf
=
{
state
:
'Number'
,
year
:
'Number'
,
month
:
'Number'
,
type
:
'Number'
};
let
{
state
,
year
,
month
,
type
}
=
eccReqNotMustHaveParam
(
reqConf
,
req
.
body
);
const
NotMustHaveKeys
=
[
"state"
,
"year"
,
"month"
];
let
{
state
,
year
,
month
,
type
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
let
dataList
=
await
monthBiz
.
outPutMonthTableList
(
state
,
year
,
month
,
type
);
...
...
src/routers/admin/user.ts
View file @
989ff822
...
...
@@ -4,7 +4,7 @@
import
*
as
guanWeiHuiBiz
from
'../../biz/guanWeiHui/user'
;
import
*
as
asyncHandler
from
'express-async-handler'
;
import
{
eccReq
MustHaveParam
}
from
'../../util/verificationParam'
;
import
{
eccReq
Paramater
}
from
'../../util/verificationParam'
;
export
function
setRouter
(
httpServer
)
{
httpServer
.
post
(
'/admin/login'
,
asyncHandler
(
login
));
...
...
@@ -18,7 +18,7 @@ export function setRouter(httpServer) {
*/
async
function
login
(
req
,
res
)
{
let
reqConf
=
{
loginId
:
'String'
,
pwd
:
'String'
};
let
{
loginId
,
pwd
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
loginId
,
pwd
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
let
userInfo
=
await
guanWeiHuiBiz
.
login
(
loginId
,
pwd
);
res
.
success
(
userInfo
);
...
...
src/routers/mobileClient/enterprise.ts
View file @
989ff822
...
...
@@ -5,26 +5,32 @@
import
*
as
asyncHandler
from
'express-async-handler'
;
import
*
as
enterpriseBiz
from
'../../biz/enterprise/enterprise'
;
import
{
checkFuHuaQiToken
}
from
'../../middleware/user'
;
import
{
eccReq
MustHaveParam
}
from
'../../util/verificationParam'
;
import
{
eccReq
Paramater
}
from
'../../util/verificationParam'
;
export
function
setRouter
(
httpServer
)
{
/**新注册企业 或 新迁入企业 */
httpServer
.
post
(
'/fuhuaqi/enterprise/register'
,
checkFuHuaQiToken
,
asyncHandler
(
registerEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/updateregister'
,
checkFuHuaQiToken
,
asyncHandler
(
updateRegisterEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/move'
,
checkFuHuaQiToken
,
asyncHandler
(
moveInEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/updatemove'
,
checkFuHuaQiToken
,
asyncHandler
(
updateMoveInEnterprise
));
httpServer
.
post
(
'/fuhuaqi/enterprise/select'
,
checkFuHuaQiToken
,
asyncHandler
(
selectEnterpriseInfo
));
httpServer
.
post
(
'/fuhuaqi/enterprise/delete'
,
checkFuHuaQiToken
,
asyncHandler
(
delEnterpriseInfo
));
/**我的企业 */
httpServer
.
post
(
'/fuhuaqi/myenterprise/list'
,
checkFuHuaQiToken
,
asyncHandler
(
myEnterpriseList
));
//todo 新加
httpServer
.
post
(
'/fuhuaqi/myenterprise/info'
,
checkFuHuaQiToken
,
asyncHandler
(
myEnterpriseInfo
));
//todo 新加
httpServer
.
post
(
'/fuhuaqi/myenterprise/info'
,
checkFuHuaQiToken
,
asyncHandler
(
myEnterpriseInfo
));
//todo 新加
}
/**
* 添加新注册的企业信息
* 1.0
* @param req
* @param res
*/
async
function
registerEnterprise
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
enterpriseBiz
.
registerEnterprise
(
Uscc
,
form
);
...
...
@@ -34,12 +40,13 @@ async function registerEnterprise(req, res) {
/**
* 修改新注册的企业信息
* 1.0
* @param req
* @param res
*/
async
function
updateRegisterEnterprise
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
enterpriseBiz
.
updateRegisterEnterprise
(
Uscc
,
form
);
...
...
@@ -49,12 +56,13 @@ async function updateRegisterEnterprise(req, res) {
/**
* 添加迁入的企业信息
* 1.0
* @param req
* @param res
*/
async
function
moveInEnterprise
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
enterpriseBiz
.
moveInEnterprise
(
Uscc
,
form
);
...
...
@@ -64,12 +72,13 @@ async function updateRegisterEnterprise(req, res) {
/**
* 修改迁入企业登记信息
* 1.0
* @param req
* @param res
*/
async
function
updateMoveInEnterprise
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
enterpriseBiz
.
updateMoveInEnterprise
(
Uscc
,
form
);
...
...
@@ -79,6 +88,7 @@ async function updateMoveInEnterprise(req, res) {
/**
* 查询迁入企业登记信息或新建企业登录信息
* 1.0
* 回显
* @param req
* @param res
...
...
@@ -86,7 +96,7 @@ async function updateMoveInEnterprise(req, res) {
async
function
selectEnterpriseInfo
(
req
,
res
)
{
/*这里改成了用DraftId,为了不改前端 依然使用uscc这个参数名称*/
let
reqConf
=
{
uscc
:
'String'
};
let
{
uscc
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
uscc
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
let
result
=
await
enterpriseBiz
.
getEnterpriseByDraftId
(
uscc
);
res
.
success
(
result
);
...
...
@@ -95,14 +105,37 @@ async function updateMoveInEnterprise(req, res) {
/**
* 删除迁入企业登记信息或新建企业登录信息
* 1.0
* @param req
* @param res
*/
async
function
delEnterpriseInfo
(
req
,
res
)
{
/*这里改成了用DraftId,为了不改前端 依然使用uscc这个参数名称*/
let
reqConf
=
{
uscc
:
'String'
};
let
{
uscc
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
uscc
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
let
result
=
await
enterpriseBiz
.
deleteEnterpriseByDraftId
(
uscc
);
res
.
success
(
result
);
}
/**
* 我的企业列表
* 2.0
* @param req
* @param res
*/
async
function
myEnterpriseList
(
req
,
res
)
{
}
/**
* 企业基本信息 我的企业列表中按钮点开
* 2.0
* @param req
* @param res
*/
async
function
myEnterpriseInfo
(
req
,
res
)
{
}
\ No newline at end of file
src/routers/mobileClient/financing.ts
View file @
989ff822
...
...
@@ -5,7 +5,7 @@
import
*
as
asyncHandler
from
'express-async-handler'
;
import
*
as
financingBiz
from
'../../biz/enterprise/financing'
;
import
{
checkFuHuaQiToken
}
from
'../../middleware/user'
;
import
{
eccReq
MustHaveParam
}
from
'../../util/verificationParam'
;
import
{
eccReq
Paramater
}
from
'../../util/verificationParam'
;
export
function
setRouter
(
httpServer
)
{
httpServer
.
post
(
'/fuhuaqi/financing/create'
,
checkFuHuaQiToken
,
asyncHandler
(
createFinancingInfo
));
...
...
@@ -23,7 +23,7 @@ export function setRouter(httpServer) {
*/
async
function
createFinancingInfo
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
financingBiz
.
createFinancingInfo
(
Uscc
,
form
);
...
...
@@ -38,7 +38,7 @@ async function createFinancingInfo(req, res) {
*/
async
function
updateFinancingInfo
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
financingBiz
.
updateFinancingInfo
(
Uscc
,
form
);
...
...
@@ -54,7 +54,7 @@ async function createFinancingInfo(req, res) {
*/
async
function
selectEnterpriseFinancingInfo
(
req
,
res
)
{
let
reqConf
=
{
uscc
:
'String'
};
let
{
uscc
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
uscc
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
FHQUscc
=
req
.
headers
.
uscc
;
let
result
=
await
financingBiz
.
getEnterpriseFinancingByUscc
(
FHQUscc
,
uscc
);
...
...
@@ -69,7 +69,7 @@ async function selectEnterpriseFinancingInfo(req, res) {
*/
async
function
delEnterpriseFinancingInfo
(
req
,
res
)
{
let
reqConf
=
{
uscc
:
'String'
};
let
{
uscc
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
uscc
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
FHQUscc
=
req
.
headers
.
uscc
;
let
result
=
await
financingBiz
.
deleteEnterpriseFinancingByUscc
(
FHQUscc
,
uscc
);
...
...
src/routers/mobileClient/fuHuaQi.ts
View file @
989ff822
...
...
@@ -7,24 +7,30 @@
import
*
as
asyncHandler
from
'express-async-handler'
;
import
*
as
baseBiz
from
'../../biz/fuHuqQi/base'
;
import
*
as
taskBiz
from
'../../biz/fuHuqQi/task'
;
import
{
eccReq
MustHaveParam
}
from
'../../util/verificationParam'
;
import
{
eccReq
Paramater
}
from
'../../util/verificationParam'
;
import
{
checkFuHuaQiToken
}
from
'../../middleware/user'
;
export
function
setRouter
(
httpServer
)
{
httpServer
.
post
(
'/fuhuaqi/base'
,
checkFuHuaQiToken
,
asyncHandler
(
baseInfo
));
httpServer
.
post
(
'/fuhuaqi/mydata'
,
checkFuHuaQiToken
,
asyncHandler
(
myDataInfo
));
/**我的数据 */
httpServer
.
post
(
'/fuhuaqi/mydata'
,
checkFuHuaQiToken
,
asyncHandler
(
myDataInfo
));
//todo 后续这里的路由要改成 /fuhuaqi/base/mydata 改了要通知前端更改
httpServer
.
post
(
'/fuhuaqi/base/update'
,
checkFuHuaQiToken
,
asyncHandler
(
updateMyDataInfo
));
/**机构信息(我的信息) */
httpServer
.
post
(
'/fuhuaqi/organization/info'
,
checkFuHuaQiToken
,
asyncHandler
(
organizationInfo
));
httpServer
.
post
(
'/fuhuaqi/organization/update'
,
checkFuHuaQiToken
,
asyncHandler
(
updateOrganizationInfo
));
/** 任务 */
httpServer
.
post
(
'/fuhuaqi/task/list'
,
checkFuHuaQiToken
,
asyncHandler
(
taskList
));
httpServer
.
post
(
'/fuhuaqi/task/submit'
,
checkFuHuaQiToken
,
asyncHandler
(
submitTask
));
httpServer
.
post
(
'/fuhuaqi/task/list'
,
checkFuHuaQiToken
,
asyncHandler
(
taskList
));
//待办任务
httpServer
.
post
(
'/fuhuaqi/task/submit'
,
checkFuHuaQiToken
,
asyncHandler
(
submitTask
));
//提交待办任务
httpServer
.
post
(
'/fuhuaqi/task/completedlist'
,
checkFuHuaQiToken
,
asyncHandler
(
completedList
));
//todo 已办任务
httpServer
.
post
(
'/fuhuaqi/task/pastduelist'
,
checkFuHuaQiToken
,
asyncHandler
(
pastDueList
));
//todo 已办任务
}
/**
* 主界面信息
* 包括首页的 我的数据 评分明细
* 首页的几个孵化器数据和评分明细
* 登录进来会调用
* 1.0
* @param req
* @param res
*/
...
...
@@ -37,7 +43,8 @@ async function baseInfo(req, res) {
/**
* 我的数据
* 小程序点击 详细数据
* 小程序点击 我的数据
* 1.0
* @param req
* @param res
*/
...
...
@@ -50,12 +57,13 @@ async function myDataInfo(req, res) {
/**
* 更新基础数据
* 1.0
* @param req
* @param res
*/
async
function
updateMyDataInfo
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
baseBiz
.
updateFuHuaQiBaseData
(
Uscc
,
form
);
...
...
@@ -65,6 +73,10 @@ async function updateMyDataInfo(req, res) {
/**
* 机构信息
* 改成了我的信息(2.23日修改)
* 1.0
* @param req
* @param res
*/
async
function
organizationInfo
(
req
,
res
)
{
const
Uscc
=
req
.
headers
.
uscc
;
...
...
@@ -75,10 +87,13 @@ async function organizationInfo(req, res) {
/**
* 修改机构信息
* 1.0
* @param req
* @param res
*/
async
function
updateOrganizationInfo
(
req
,
res
)
{
let
reqConf
=
{
form
:
'Object'
};
let
{
form
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
form
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
baseBiz
.
updateOrganizationData
(
Uscc
,
form
);
...
...
@@ -88,6 +103,7 @@ async function updateOrganizationInfo(req, res) {
/**
* 任务列表
* 1.0
* @param req
* @param res
*/
...
...
@@ -100,14 +116,47 @@ async function taskList(req, res) {
/**
* 提交任务
* 1.0
* @param req
* @param res
*/
async
function
submitTask
(
req
,
res
)
{
let
reqConf
=
{
taskType
:
'Number'
};
let
{
taskType
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
taskType
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
result
=
await
taskBiz
.
checkTask
(
Uscc
,
taskType
);
res
.
success
(
result
);
}
/**
* 已办任务
* 2.0
* @param req
* @param res
*/
async
function
completedList
(
req
,
res
)
{
let
reqConf
=
{
selectTime
:
'Number'
};
const
NotMustHaveKeys
=
[
"selectTime"
];
let
{
selectTime
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
const
Uscc
=
req
.
headers
.
uscc
;
res
.
success
({});
}
/**
* 过期任务
* 2.0
* @param req
* @param res
*/
async
function
pastDueList
(
req
,
res
)
{
let
reqConf
=
{
taskType
:
'Number'
};
const
NotMustHaveKeys
=
[
"selectTime"
];
let
{
selectTime
}
=
eccReqParamater
(
reqConf
,
req
.
body
,
NotMustHaveKeys
);
const
Uscc
=
req
.
headers
.
uscc
;
res
.
success
({});
}
\ No newline at end of file
src/routers/mobileClient/month.ts
View file @
989ff822
...
...
@@ -4,7 +4,7 @@
import
*
as
asyncHandler
from
'express-async-handler'
;
import
*
as
monthBiz
from
'../../biz/fuHuqQi/month'
;
import
{
eccReq
MustHaveParam
}
from
'../../util/verificationParam'
;
import
{
eccReq
Paramater
}
from
'../../util/verificationParam'
;
import
{
checkFuHuaQiToken
}
from
'../../middleware/user'
;
export
function
setRouter
(
httpServer
)
{
...
...
@@ -22,7 +22,7 @@ export function setRouter(httpServer) {
*/
async
function
addReport
(
req
,
res
)
{
let
reqConf
=
{
occupancyRate
:
'Number'
};
let
{
occupancyRate
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
occupancyRate
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
monthInfo
=
monthBiz
.
createReport
(
Uscc
,
occupancyRate
);
...
...
@@ -63,7 +63,7 @@ async function deleteReport(req, res) {
*/
async
function
updateReport
(
req
,
res
)
{
let
reqConf
=
{
occupancyRate
:
'Number'
};
let
{
occupancyRate
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
occupancyRate
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
let
monthInfo
=
monthBiz
.
updateReport
(
Uscc
,
occupancyRate
);
...
...
src/routers/mobileClient/user.ts
View file @
989ff822
...
...
@@ -4,7 +4,7 @@
import
*
as
asyncHandler
from
'express-async-handler'
;
import
*
as
userBiz
from
'../../biz/fuHuqQi/user'
;
import
{
eccReq
MustHaveParam
}
from
'../../util/verificationParam'
;
import
{
eccReq
Paramater
}
from
'../../util/verificationParam'
;
import
{
checkFuHuaQiToken
}
from
'../../middleware/user'
;
export
function
setRouter
(
httpServer
)
{
...
...
@@ -21,7 +21,7 @@ export function setRouter(httpServer) {
*/
async
function
login
(
req
,
res
)
{
let
reqConf
=
{
uscc
:
'String'
,
pwd
:
'String'
};
let
{
uscc
,
pwd
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
uscc
,
pwd
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
let
result
=
await
userBiz
.
login
(
uscc
,
pwd
);
...
...
@@ -48,7 +48,7 @@ async function logout(req, res) {
*/
async
function
firstUpdatePwd
(
req
,
res
)
{
let
reqConf
=
{
confirmPwd
:
'String'
,
pwd
:
'String'
,
};
let
{
confirmPwd
,
pwd
}
=
eccReq
MustHaveParam
(
reqConf
,
req
.
body
);
let
{
confirmPwd
,
pwd
}
=
eccReq
Paramater
(
reqConf
,
req
.
body
);
const
Uscc
=
req
.
headers
.
uscc
;
...
...
src/util/verificationParam.ts
View file @
989ff822
...
...
@@ -78,96 +78,65 @@ export function eccFormParam(name:string, keyTypeConf:object, param:object) {
/**
* 根据conf配置校验请求参数
* 参数为必填
* @param conf 配置
* @param param
待校验对象
* @
returns 原有表单数据
* @param param
表单
* @
param skipKeys []不必填的字段
*/
export
function
eccReqMustHaveParam
(
conf
:
object
,
param
)
{
for
(
let
key
in
conf
)
{
if
(
typeof
param
[
key
]
!=
'boolean'
&&
!
param
[
key
]
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`缺失
${
key
}
字段`
);
let
type
=
typeof
param
[
key
];
export
function
eccReqParamater
(
conf
:
object
,
param
,
skipKeys
?)
{
skipKeys
=
skipKeys
||
[];
for
(
let
key
in
conf
)
{
let
type
=
conf
[
key
];
let
value
=
param
[
type
];
let
isError
=
false
;
//校验是否异常
let
errorStr
=
""
;
//异常说明
if
(
(
typeof
value
!=
'boolean'
)
&&
!
value
)
{
if
(
skipKeys
.
indexOf
(
key
)
<
0
)
{
isError
=
true
;
errorStr
=
`缺少
${
key
}
字段`
;
}
}
else
if
(
param
[
key
])
{
let
paramType
=
typeof
param
[
key
];
switch
(
conf
[
key
])
{
case
'Number'
:
if
(
type
!=
'number'
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是number型 而不是
${
type
}
`
)
;
if
(
paramType
!=
'number'
)
isError
=
true
;
break
;
case
'String'
:
if
(
type
!=
'string'
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是string型 而不是
${
type
}
`
)
;
if
(
paramType
!=
'string'
)
isError
=
true
;
break
;
case
'Boolean'
:
if
(
type
!=
'boolean'
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是boolean型 而不是
${
type
}
`
);
if
(
paramType
!=
'boolean'
)
isError
=
true
;
break
;
case
'[Number]'
:
if
(
!
Array
.
isArray
(
param
[
key
])
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是数组型 而不是
${
type
}
`
)
;
if
(
!
Array
.
isArray
(
param
[
key
])
)
isError
=
true
;
for
(
let
i
=
0
;
i
<
param
[
key
].
length
;
i
++
)
{
let
item
=
param
[
key
][
i
];
if
(
typeof
item
!=
'number'
)
{
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是number型数组其中下标
${
i
}
是
${
typeof
item
}
`
)
;
}
isError
=
true
;
errorStr
=
`
${
key
}
应是number型数组其中下标
${
i
}
是
${
typeof
item
}
`
;
}
break
;
case
'Object'
:
if
(
type
!=
'object'
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是Object型 而不是
${
type
}
`
);
if
(
Array
.
isArray
(
param
[
key
])
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是Object型 而不是array`
);
try
{
JSON
.
stringify
(
param
[
key
]);
}
catch
(
err
)
{
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是Object型 转换JSON时失败`
);
}
break
;
}
}
for
(
let
key
in
param
)
{
if
(
!
conf
[
key
])
throw
new
BizError
(
ERRORENUM
.
表单校验失败
,
`多余
${
key
}
字段`
);
}
return
param
;
}
/**
* 校验请求参数
* 参数为非必填
* @param conf 配置
* @param param 待校验对象
* @returns 原有表单数据
*/
export
function
eccReqNotMustHaveParam
(
conf
,
param
)
{
for
(
let
key
in
conf
)
{
if
(
!
param
[
key
])
continue
;
let
type
=
typeof
param
[
key
];
switch
(
conf
[
key
])
{
case
'Number'
:
if
(
type
!=
'number'
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是number型 而不是
${
type
}
`
);
break
;
case
'String'
:
if
(
type
!=
'string'
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是string型 而不是
${
type
}
`
);
break
;
case
'Boolean'
:
if
(
type
!=
'boolean'
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是boolean型 而不是
${
type
}
`
);
break
;
case
'[Number]'
:
if
(
!
Array
.
isArray
(
param
[
key
])
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是数组型 而不是
${
type
}
`
);
case
'[Object]'
:
if
(
!
Array
.
isArray
(
param
[
key
])
)
isError
=
true
;
for
(
let
i
=
0
;
i
<
param
[
key
].
length
;
i
++
)
{
let
item
=
param
[
key
][
i
];
if
(
typeof
item
!=
'number'
)
{
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是number型数组其中下标
${
i
}
是
${
typeof
item
}
`
);
if
(
typeof
item
!=
'object'
)
{
isError
=
true
;
errorStr
=
`
${
key
}
应是object型数组其中下标
${
i
}
是
${
typeof
item
}
`
;
}
}
break
;
case
'Object'
:
if
(
type
!=
'object'
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是Object型 而不是
${
type
}
`
);
if
(
Array
.
isArray
(
param
[
key
])
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是Object型 而不是array`
);
try
{
JSON
.
stringify
(
param
[
key
]);
}
catch
(
err
)
{
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`
${
key
}
应是Object型 转换JSON时失败`
);
}
break
;
errorStr
=
isError
&&
errorStr
==
""
?
`
${
key
}
应该是
${
type
}
型 而不是
${
paramType
}
`
:
errorStr
;
}
if
(
isError
)
throw
new
BizError
(
ERRORENUM
.
参数错误
,
errorStr
);
}
for
(
let
key
in
param
)
{
if
(
!
conf
[
key
])
throw
new
BizError
(
ERRORENUM
.
表单校验失败
,
`多余
${
key
}
字段`
);
if
(
!
conf
[
key
])
throw
new
BizError
(
ERRORENUM
.
参数错误
,
`多余
${
key
}
字段`
);
}
return
param
;
}
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