Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yafangsuo_applet
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
yafangsuo_applet
Commits
a12ef574
Commit
a12ef574
authored
Oct 15, 2023
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
26bdf550
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
74 additions
and
20 deletions
+74
-20
serverConfig.xml
serverConfig.xml
+2
-1
branchSystem.ts
src/biz/branchSystem.ts
+2
-1
memberLearning.ts
src/biz/memberLearning.ts
+41
-11
organizationalLife.ts
src/biz/organizationalLife.ts
+1
-1
partyBuildingDynamic.ts
src/biz/partyBuildingDynamic.ts
+2
-2
enum.ts
src/config/enum.ts
+8
-1
errorEnum.ts
src/config/errorEnum.ts
+2
-1
getUrl.ts
src/middleware/getUrl.ts
+2
-2
memberLearning.ts
src/routers/applet/memberLearning.ts
+14
-0
No files found.
serverConfig.xml
View file @
a12ef574
...
...
@@ -5,6 +5,6 @@
<sign>
xxx90909082fsdahfjosadjfpoiwausjorip2hjklrhn1ioud0u124rx0qwejfokasjfolksaujfoas
</sign>
</db>
<imgUrl>
http://123.207.147.179:40003/
</imgUrl>
<fileIP>
http://192.168.0.
71
:40004
</fileIP>
<fileIP>
http://192.168.0.
105
:40004
</fileIP>
</config>
\ No newline at end of file
src/biz/branchSystem.ts
View file @
a12ef574
...
...
@@ -3,6 +3,7 @@
*/
import
{
OPERATIONALDATATYPE
,
TABLENAME
}
from
"../config/dbEnum"
;
import
{
UPTYPE
}
from
"../config/enum"
;
import
{
ERRORENUM
}
from
"../config/errorEnum"
;
import
{
systemConfig
}
from
"../config/systemConfig"
;
import
{
selectData
}
from
"../middleware/databaseSuccess"
;
...
...
@@ -36,7 +37,7 @@ export async function branchSystemDetsils(bsId:number, token:string, userid:stri
let
clomun
=
[
"bsId"
,
"systemTitle"
,
"fileName"
];
let
branchSystemInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
支部制度表
,
{
bsId
},
clomun
);
if
(
!
branchSystemInfo
||
!
branchSystemInfo
.
bsId
)
throw
new
BizError
(
ERRORENUM
.
库中不存在对应数据
,
`制度细则中不存在id=
${
bsId
}
的数据`
);
let
fileNameList
=
getFileUrl
(
branchSystemInfo
.
fileName
,
token
,
userid
);
let
fileNameList
=
getFileUrl
(
branchSystemInfo
.
fileName
,
token
,
UPTYPE
.
支部制度
,
userid
);
branchSystemInfo
.
fileName
=
fileNameList
;
return
branchSystemInfo
;
}
...
...
src/biz/memberLearning.ts
View file @
a12ef574
...
...
@@ -11,6 +11,8 @@ import * as verificationEnumTools from "../util/verificationEnum";
import
*
as
configEnum
from
"../config/enum"
;
import
{
systemConfig
}
from
"../config/systemConfig"
;
import
{
getFileUrl
}
from
"../middleware/getUrl"
;
import
{
BizError
}
from
"../util/bizError"
;
import
{
ERRORENUM
}
from
"../config/errorEnum"
;
/**
...
...
@@ -22,20 +24,20 @@ import { getFileUrl } from "../middleware/getUrl";
* @returns rateLearningList:[{"contentTitle":"学习课题名称", "fileName":["视频地址", ......], "rateOfLearning":0, "learningCompleted":0}]
*/
export
async
function
memberLearningList
(
pmId
:
string
,
courseEntryType
:
number
,
courseTypeName
:
number
,
contentTitle
:
string
,
token
:
string
,
userid
:
string
)
{
let
rateColumn
=
[
"rlId"
,
"mlId"
,
"rateOfLearning"
,
"learningCompleted"
];
let
rateColumn
=
[
"rlId"
,
"mlId"
,
"rateOfLearning"
,
"learningCompleted"
,
"textSchedule"
];
let
rateLearningInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
学习进度表
,
{
pmId
},
rateColumn
);
let
rateLearningList
=
[];
let
rateLearningMap
=
{};
rateLearningInfo
.
forEach
(
info
=>
{
let
{
rlId
,
mlId
,
rateOfLearning
,
learningCompleted
}
=
info
;
rateLearningMap
[
mlId
]
=
{
rlId
,
rateOfLearning
,
learningCompleted
}
let
{
rlId
,
mlId
,
rateOfLearning
,
learningCompleted
,
textSchedule
}
=
info
;
rateLearningMap
[
mlId
]
=
{
rlId
,
rateOfLearning
,
learningCompleted
,
textSchedule
};
});
let
param
=
{
courseEntryType
};
if
(
courseTypeName
)
param
[
"courseTypeName"
]
=
courseTypeName
;
if
(
contentTitle
)
param
[
"contentTitle"
]
=
{
"%like%"
:
contentTitle
};
let
clomun
=
[
"mlId"
,
"contentTitle"
,
"fileName"
,
"coverImage"
,
"videoDuration"
];
let
clomun
=
[
"mlId"
,
"contentTitle"
,
"fileName"
,
"coverImage"
,
"videoDuration"
,
"courseEntryType"
];
let
memberLearningInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询多个
,
TABLENAME
.
党员学习表
,
param
,
clomun
);
for
(
let
i
=
0
;
i
<
memberLearningInfo
.
length
;
i
++
)
{
...
...
@@ -47,28 +49,32 @@ export async function memberLearningList(pmId:string, courseEntryType:number, co
pmId
,
mlId
,
rateOfLearning
:
0
,
learningCompleted
:
1
learningCompleted
:
1
,
courseEntryType
:
'[]'
}
await
operationalData
(
OPERATIONALDATATYPE
.
增加
,
TABLENAME
.
学习进度表
,
addInfo
,
{});
learningInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
学习进度表
,
{
pmId
,
mlId
},
rateColumn
);
console
.
log
(
learningInfo
);
}
let
filename
;
let
alanysisFileName
;
let
successFileList
=
[];
//已完成
if
(
courseEntryType
==
2
)
{
filename
=
getFileUrl
(
fileName
,
token
,
userid
);
alanysisFileName
=
getFileUrl
(
fileName
,
token
,
configEnum
.
UPTYPE
.
党员学习
,
userid
);
successFileList
=
learningInfo
.
textSchedule
?
JSON
.
parse
(
learningInfo
.
textSchedule
)
:
[];
}
else
{
filename
=
JSON
.
parse
(
filen
ame
);
alanysisFileName
=
JSON
.
parse
(
fileN
ame
);
}
//todo 这里 fileName不再是一个字符串 而是一个对象{}
rateLearningList
.
push
({
rlId
:
learningInfo
.
rlId
,
contentTitle
,
fileName
:
filen
ame
,
fileName
:
alanysisFileN
ame
,
rateOfLearning
:
learningInfo
.
rateOfLearning
,
learningCompleted
:
learningInfo
.
learningCompleted
,
coverImage
,
videoDuration
videoDuration
,
successFileList
})
}
...
...
@@ -152,6 +158,30 @@ export async function updateRateOfLearning(rlId:number, rateOfLearning:number) {
}
export
async
function
updateDocRateOfLearning
(
rlId
:
number
,
fileName
:
string
)
{
let
rateLearningInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
学习进度表
,
{
rlId
},
[
"pmId"
,
"rlId"
,
"textSchedule"
]);
if
(
!
rateLearningInfo
||
!
rateLearningInfo
.
rlId
)
throw
new
BizError
(
ERRORENUM
.
目标数据不存在
,
`更新学习进度:rlid:
${
rlId
}
`
);
let
{
pmId
}
=
rateLearningInfo
;
let
learningInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
学习进度表
,
{
pmId
},
[
"fileName"
,
"pmId"
,
"courseEntryType"
]);
if
(
!
learningInfo
||
!
learningInfo
.
pmId
)
throw
new
BizError
(
ERRORENUM
.
目标数据不存在
,
`更新学习进度:pmId:
${
pmId
}
`
);
if
(
learningInfo
.
courseEntryType
!=
2
)
throw
new
BizError
(
ERRORENUM
.
该进度不是文字学习
,
`
${
pmId
}
`
);
let
textSchedule
=
!
rateLearningInfo
.
textSchedule
?
[]
:
JSON
.
parse
(
rateLearningInfo
.
textSchedule
);
let
isUpdate
=
false
;
if
(
textSchedule
.
indexOf
(
fileName
)
==
-
1
)
{
isUpdate
=
true
;
textSchedule
.
push
(
fileName
);
}
if
(
isUpdate
)
{
await
operationalData
(
OPERATIONALDATATYPE
.
修改
,
TABLENAME
.
学习进度表
,
{
textSchedule
:
JSON
.
stringify
(
textSchedule
)},
{
rlId
});
}
return
{
isSuccess
:
true
};
}
...
...
src/biz/organizationalLife.ts
View file @
a12ef574
...
...
@@ -58,7 +58,7 @@ export async function organlzationalLifeListDetsils(oId:number, token:string, us
orgLifeInfo
.
themeType
=
verificationEnumTools
.
changeEnumValue
(
configEnum
.
THEMETYPE
,
orgLifeInfo
.
themeType
);
orgLifeInfo
.
dataMonth
=
moment
(
orgLifeInfo
.
dataMonth
).
format
(
"YYYY-MM-DD"
);
orgLifeInfo
.
fileName
=
getFileUrl
(
orgLifeInfo
.
fileName
,
token
,
userid
);
orgLifeInfo
.
fileName
=
getFileUrl
(
orgLifeInfo
.
fileName
,
token
,
configEnum
.
UPTYPE
.
组织生活
,
userid
);
return
orgLifeInfo
;
}
...
...
src/biz/partyBuildingDynamic.ts
View file @
a12ef574
...
...
@@ -7,7 +7,7 @@ import { selectData } from "../middleware/databaseSuccess";
import
{
extractData
}
from
"../util/piecemeal"
;
import
*
as
splitResultConfig
from
"../config/splitResultConfig"
;
import
moment
=
require
(
"moment"
);
import
{
PBTYPE
}
from
"../config/enum"
;
import
{
PBTYPE
,
UPTYPE
}
from
"../config/enum"
;
import
{
systemConfig
}
from
"../config/systemConfig"
;
import
{
getFileUrl
}
from
"../middleware/getUrl"
;
...
...
@@ -64,7 +64,7 @@ export async function partyBuildingDynamicDetsils(pbId:number, pbType:number, to
if
(
pbType
==
PBTYPE
.
党建动态
)
partyBuildingDynamicInfo
=
await
selectData
(
OPERATIONALDATATYPE
.
查询单个
,
TABLENAME
.
党建动态表
,
{
pbId
},
clomun
);
partyBuildingDynamicInfo
.
dataMonth
=
moment
(
partyBuildingDynamicInfo
.
dataMonth
).
format
(
"YYYY-MM-DD"
);
let
fileNameList
=
getFileUrl
(
partyBuildingDynamicInfo
.
fileName
,
token
,
userid
);
let
fileNameList
=
getFileUrl
(
partyBuildingDynamicInfo
.
fileName
,
token
,
UPTYPE
.
党建动态
,
userid
);
partyBuildingDynamicInfo
.
fileName
=
fileNameList
;
return
partyBuildingDynamicInfo
;
...
...
src/config/enum.ts
View file @
a12ef574
...
...
@@ -246,6 +246,13 @@ export enum PBTYPE {
export
enum
UPTYPE
{
支部制度
=
1
,
组织生活
=
2
,
专题活动
=
3
,
党建动态
=
4
,
党员学习
=
5
,
学习强国
=
6
}
src/config/errorEnum.ts
View file @
a12ef574
...
...
@@ -26,7 +26,8 @@ export enum ERRORENUM {
未找到数据
,
库中不存在对应数据
,
表单校验失败
,
暂无对应数据
暂无对应数据
,
该进度不是文字学习
}
export
enum
ERRORCODEENUM
{
...
...
src/middleware/getUrl.ts
View file @
a12ef574
/**
* 获取数据层接口地址
*/
import
{
FILETYPE
}
from
"../config/enum"
;
import
{
systemConfig
}
from
"../config/systemConfig"
;
export
enum
urlEnum
{
...
...
@@ -28,11 +29,10 @@ export function getUrl(url, urlName) {
* @param userid
* @returns
*/
export
function
getFileUrl
(
data
,
token
,
userid
)
{
export
function
getFileUrl
(
data
,
token
,
fileType
,
userid
)
{
let
fileNameInfo
=
JSON
.
parse
(
data
);
let
fileNameList
=
[];
for
(
let
i
=
0
;
i
<
fileNameInfo
.
length
;
i
++
)
{
let
fileType
=
fileNameInfo
[
i
].
slice
(
0
,
1
);
fileNameList
.
push
(
`
${
systemConfig
.
fileIP
}
/yfs/files/
${
fileType
}
/
${
fileNameInfo
[
i
]}
?token=
${
token
}
&userid=
${
userid
}
`
);
}
...
...
src/routers/applet/memberLearning.ts
View file @
a12ef574
...
...
@@ -12,6 +12,7 @@ export function setRouter(httpServer) {
httpServer
.
post
(
'/yfs/applet/memberlearning/branchranking'
,
checkAppletToken
,
asyncHandler
(
getBranchRanking
));
httpServer
.
post
(
'/yfs/applet/memberlearning/monthranking'
,
checkAppletToken
,
asyncHandler
(
getMonthRanking
));
httpServer
.
post
(
'/yfs/applet/memberlearning/updateschedule'
,
checkAppletToken
,
asyncHandler
(
updateRateLearning
));
httpServer
.
post
(
'/yfs/applet/memberlearning/updatefileschedule'
,
checkAppletToken
,
asyncHandler
(
updateFileRateLearning
));
}
...
...
@@ -73,6 +74,19 @@ async function updateRateLearning(req, res) {
}
/**
* 修改学习进度 文档学习
* @param req
* @param res
*/
async
function
updateFileRateLearning
(
req
,
res
)
{
let
reqConf
=
{
rlId
:
'Number'
,
fileName
:
'String'
};
let
{
rlId
,
fileName
}
=
eccReqParamater
(
reqConf
,
req
.
body
);
let
result
=
await
memberLearningBiz
.
updateDocRateOfLearning
(
rlId
,
fileName
);
res
.
success
(
result
);
}
...
...
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