Ai
423 Star 2K Fork 719

进击的皇虫/DocHub

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
FriendController.go 843 Bytes
一键复制 编辑 原始数据 按行查看 历史
TruthHun 提交于 2018-08-11 17:01 +08:00 . 代码优化
package AdminControllers
import (
"time"
"github.com/TruthHun/DocHub/helper"
"github.com/TruthHun/DocHub/models"
"github.com/astaxie/beego/orm"
)
type FriendController struct {
BaseController
}
//添加以及查看友链列表
func (this *FriendController) Get() {
if this.Ctx.Request.Method == "POST" {
var fr models.Friend
this.ParseForm(&fr)
fr.Status = true
fr.TimeCreate = int(time.Now().Unix())
if i, err := orm.NewOrm().Insert(&fr); i > 0 && err == nil {
this.ResponseJson(true, "友链添加成功")
} else {
if err != nil {
helper.Logger.Error(err.Error())
}
this.ResponseJson(false, "友链添加失败,可能您要添加的友链已存在")
}
} else {
this.Data["IsFriend"] = true
this.Data["Friends"], _, _ = models.NewFriend().GetListByStatus(-1)
this.TplName = "index.html"
}
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Go
1
https://gitee.com/truthhun/DocHub.git
git@gitee.com:truthhun/DocHub.git
truthhun
DocHub
DocHub
01033d1926ec

搜索帮助