49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package feedbackser
|
|
|
|
import (
|
|
"io"
|
|
"videoweb/app/service/upstream"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
const addPath = "/api/app/feedback/add"
|
|
|
|
const contactUsAddPath = "/api/app/contactus/add"
|
|
|
|
const uploadPath = "/api/app/upload/image"
|
|
|
|
// Add 调用上游提交意见反馈。
|
|
func Add(c *gin.Context, req FeedbackReq) (*APIEnvelope, error) {
|
|
var env APIEnvelope
|
|
if _, err := upstream.PostJSON(c, addPath, req, &env); err != nil {
|
|
return nil, err
|
|
}
|
|
return &env, nil
|
|
}
|
|
|
|
// AddContactUs 调用上游联系我们接口。
|
|
func AddContactUs(c *gin.Context, req ContactUsAddReq) (*APIEnvelope, error) {
|
|
var env APIEnvelope
|
|
if _, err := upstream.PostJSON(c, contactUsAddPath, req, &env); err != nil {
|
|
return nil, err
|
|
}
|
|
return &env, nil
|
|
}
|
|
|
|
// UploadImage 上传反馈截图;不加水印。
|
|
func UploadImage(c *gin.Context, fileName string, r io.Reader) (*ImageUploadResp, error) {
|
|
var resp ImageUploadResp
|
|
_, err := upstream.PostMultipart(c, uploadPath, map[string]string{
|
|
"watermark": "0",
|
|
}, &upstream.MultipartFile{
|
|
FieldName: "file",
|
|
FileName: fileName,
|
|
Reader: r,
|
|
}, &resp)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &resp, nil
|
|
}
|