Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ppt_server
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
Li Feifei
ppt_server
Commits
a52f7150
Commit
a52f7150
authored
Jan 27, 2021
by
Li Feifei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
da2bbceb
Pipeline
#13601
passed with stages
in 28 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
mq.go
upload/mq.go
+13
-4
ppt.go
upload/ppt.go
+2
-1
No files found.
upload/mq.go
View file @
a52f7150
...
@@ -7,11 +7,14 @@ package upload
...
@@ -7,11 +7,14 @@ package upload
import
(
import
(
"encoding/json"
"encoding/json"
"fmt"
"fmt"
"sync"
beeLogger
"github.com/beego/bee/logger"
beeLogger
"github.com/beego/bee/logger"
"github.com/streadway/amqp"
"github.com/streadway/amqp"
)
)
var
once
sync
.
Once
var
RM
*
RabbitMQ
type
RabbitMQ
struct
{
type
RabbitMQ
struct
{
connection
*
amqp
.
Connection
connection
*
amqp
.
Connection
channel
*
amqp
.
Channel
channel
*
amqp
.
Channel
...
@@ -60,7 +63,7 @@ func (r *RabbitMQ) mqClose() {
...
@@ -60,7 +63,7 @@ func (r *RabbitMQ) mqClose() {
}
}
func
(
r
*
RabbitMQ
)
Send
(
req
map
[
string
]
interface
{})
error
{
func
(
r
*
RabbitMQ
)
Send
(
req
map
[
string
]
interface
{})
error
{
defer
r
.
mqClose
()
//
defer r.mqClose()
bytes
,
err
:=
json
.
Marshal
(
req
)
bytes
,
err
:=
json
.
Marshal
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
...
@@ -73,7 +76,13 @@ func (r *RabbitMQ) Send(req map[string]interface{}) error {
...
@@ -73,7 +76,13 @@ func (r *RabbitMQ) Send(req map[string]interface{}) error {
}
}
func
Send
(
r
map
[
string
]
interface
{})
error
{
func
init
()
{
s
:=
&
RabbitMQ
{}
once
.
Do
(
func
()
{
return
s
.
Send
(
r
)
RM
=
NewRabbitmq
()
})
}
}
func
NewRabbitmq
()
*
RabbitMQ
{
return
&
RabbitMQ
{}
}
upload/ppt.go
View file @
a52f7150
...
@@ -68,7 +68,8 @@ func (p *PPT) Transform() (err error) {
...
@@ -68,7 +68,8 @@ func (p *PPT) Transform() (err error) {
_
=
mime
.
AddExtensionType
(
".pptx"
,
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
)
_
=
mime
.
AddExtensionType
(
".pptx"
,
"application/vnd.openxmlformats-officedocument.presentationml.presentation"
)
maps
[
"type"
]
=
mime
.
TypeByExtension
(
ext
)
maps
[
"type"
]
=
mime
.
TypeByExtension
(
ext
)
maps
[
"path"
]
=
objectName
maps
[
"path"
]
=
objectName
if
err
=
Send
(
maps
);
err
!=
nil
{
if
err
=
RM
.
Send
(
maps
);
err
!=
nil
{
beeLogger
.
Log
.
Errorf
(
"Send Error: %s"
,
err
)
beeLogger
.
Log
.
Errorf
(
"Send Error: %s"
,
err
)
_
=
UpdateFileError
(
"6"
,
maps
[
"uuid"
]
.
(
string
),
maps
[
"roomNum"
]
.
(
string
),
objectName
)
_
=
UpdateFileError
(
"6"
,
maps
[
"uuid"
]
.
(
string
),
maps
[
"roomNum"
]
.
(
string
),
objectName
)
return
return
...
...
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