1 Star 0 Fork 720

兴博软件/DocHub

forked from 进击的皇虫/DocHub 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
ReportController.go 995 Bytes
一键复制 编辑 原始数据 按行查看 历史
TruthHun 提交于 2018-09-05 21:15 +08:00 . 代码优化
package HomeControllers
import (
"time"
"github.com/TruthHun/DocHub/helper"
"github.com/TruthHun/DocHub/models"
"github.com/astaxie/beego/orm"
)
type ReportController struct {
BaseController
}
//举报
func (this *ReportController) Get() {
if this.IsLogin == 0 {
this.ResponseJson(false, "您当前未登录,请先登录")
}
reason, _ := this.GetInt("Reason")
did, _ := this.GetInt("Did")
if reason == 0 || did == 0 {
this.ResponseJson(false, "举报失败,请选择举报原因")
}
t := int(time.Now().Unix())
report := models.Report{Status: false, Did: did, TimeCreate: t, TimeUpdate: t, Uid: this.IsLogin, Reason: reason}
rows, err := orm.NewOrm().Insert(&report)
if err != nil {
helper.Logger.Error("SQL执行失败:%v", err.Error())
}
if err != nil || rows == 0 {
this.ResponseJson(false, "举报失败:您已举报过该文档")
}
this.ResponseJson(true, "恭喜您,举报成功,我们将在24小时内对您举报的内容进行处理。")
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/lalbe/DocHub.git
git@gitee.com:lalbe/DocHub.git
lalbe
DocHub
DocHub
dd28a31bcdb3

搜索帮助