Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
doc-service
Project
Project
Details
Activity
Releases
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
eifel邓鹏飞
doc-service
Commits
ba7a077d
Commit
ba7a077d
authored
Sep 25, 2024
by
Bess严根旺
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
格式规定
parent
d3cdd203
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
4 deletions
+35
-4
convert_service.go
domain/service/convert_service.go
+35
-4
No files found.
domain/service/convert_service.go
View file @
ba7a077d
...
...
@@ -21,16 +21,39 @@ func recoverPanic() {
}
}
func
inFileType
(
fileType
string
)
bool
{
if
fileType
==
""
{
return
false
}
// 示例数组
sliceType
:=
[]
string
{
"apple"
,
"banana"
,
"cherry"
,
"date"
,
"doc"
,
"docx"
,
"wps"
,
"wpss"
,
"docm"
,
"dotm"
,
"dot"
,
"dotx"
,
"html"
,
"pptx"
,
"ppt"
,
"pot"
,
"potx"
,
"pps"
,
"ppsx"
,
"dps"
,
"dpt"
,
"pptm"
,
"potm"
,
"ppsm"
,
"dpss"
,
"xls"
,
"xlt"
,
"et"
,
"ett"
,
"xlsx"
,
"xltx"
,
"csv"
,
"xlsb"
,
"xlsm"
,
"xltm"
,
"ets"
,
}
for
_
,
v
:=
range
sliceType
{
if
v
==
fileType
{
return
true
}
}
return
false
}
/*
**
发起文件转换
格式:(source_type)
文字文档(Word):doc
、docx、wps、wpss、docm、dotm、dot、dotx、
html。
演示文档(PPT):pptx
、ppt、pot、potx、pps、ppsx、dps、dpt、pptm、potm、ppsm、
dpss。
表格文档(Excel):xls
、xlt、et、ett、xlsx、xltx、csv、xlsb、xlsm、xltm、
ets。
文字文档(Word):doc
","docx","wps","wpss","docm","dotm","dot","dotx","
html。
演示文档(PPT):pptx
","ppt","pot","potx","pps","ppsx","dps","dpt","pptm","potm","ppsm","
dpss。
表格文档(Excel):xls
","xlt","et","ett","xlsx","xltx","csv","xlsb","xlsm","xltm","
ets。
输出格式:(target_type)
图片:png
、
jpg。
图片:png
","
jpg。
文本:txt。
PDF:pdf。
*/
...
...
@@ -41,6 +64,14 @@ func (doc *DocServiceService) DoConversion(c context.Context, req *pb.DoConversi
Id
:
req
.
CallbackData
.
Id
,
}
//校验格式
if
!
inFileType
(
req
.
SourceType
)
{
resp
.
Msg
=
"source_type不合法"
resp
.
Code
=
100010
resp
.
Data
=
nil
return
resp
,
err
}
jsonCallBackData
,
_
:=
json
.
Marshal
(
CallBackData
)
request
:=
&
service
.
DoConversionRequest
{
ProjectName
:
req
.
ProjectName
,
...
...
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