举报
()
| 14 | |
| 15 | //举报 |
| 16 | func (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 | } |
nothing calls this directly
no test coverage detected