Complaint.go
1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package Api
import (
"encoding/json"
"github.com/aarongao/tools"
"github.com/gin-gonic/gin"
"letu/DB"
)
// @Title 增加投诉
// @Description 增加投诉
// @Accept json
// @Produce json
// @Param mobile 18616619599 string true "联系电话"
// @Param type 1 string true "类型"
// @Param content 卫生不干净 string true "投诉内容"
// @Param image ["http://www.xx.com/123.jpg","http://www.xx.com/123.jpg"] string true "照片数组"
// @Success 200 {object} tools.ResponseSeccess "{"errcode":0,"result":"ok"}"
// @Failure 500 {object} tools.ResponseError "{"errcode":1,"errmsg":"错误原因"}"
// @Router /CreateComplaint? [post]
func CreateComplaint(c *gin.Context) {
c.Header("Access-Control-Allow-Origin",c.Request.Header.Get("Origin"))
c.Header("Access-Control-Allow-Credentials","true")
var images []string
json.Unmarshal([]byte(c.PostForm("image")), &images)
DB.CComplaint.Insert(DB.SComplaint{
c.PostForm("type"),
c.PostForm("mobile"),
c.PostForm("content"),
images,
})
c.JSON(200, tools.ResponseSeccess{
0,
"ok",
})
}