MCPcopy Index your code
hub / github.com/TruthHun/DocHub / Get

Method Get

controllers/HomeControllers/ReportController.go:16–38  ·  view source on GitHub ↗

举报

()

Source from the content-addressed store, hash-verified

14
15//举报
16func (this *ReportController) Get() {
17 if this.IsLogin == 0 {
18 this.ResponseJson(false, "您当前未登录,请先登录")
19 }
20
21 reason, _ := this.GetInt("Reason")
22 did, _ := this.GetInt("Did")
23
24 if reason == 0 || did == 0 {
25 this.ResponseJson(false, "举报失败,请选择举报原因")
26 }
27
28 t := int(time.Now().Unix())
29 report := models.Report{Status: false, Did: did, TimeCreate: t, TimeUpdate: t, Uid: this.IsLogin, Reason: reason}
30 rows, err := orm.NewOrm().Insert(&report)
31 if err != nil {
32 helper.Logger.Error("SQL执行失败:%v", err.Error())
33 }
34 if err != nil || rows == 0 {
35 this.ResponseJson(false, "举报失败:您已举报过该文档")
36 }
37 this.ResponseJson(true, "恭喜您,举报成功,我们将在24小时内对您举报的内容进行处理。")
38}

Callers

nothing calls this directly

Calls 2

InsertMethod · 0.80
ResponseJsonMethod · 0.45

Tested by

no test coverage detected