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

Method Get

controllers/AdminControllers/FriendController.go:17–36  ·  view source on GitHub ↗

添加以及查看友链列表

()

Source from the content-addressed store, hash-verified

15
16//添加以及查看友链列表
17func (this *FriendController) Get() {
18 if this.Ctx.Request.Method == "POST" {
19 var fr models.Friend
20 this.ParseForm(&fr)
21 fr.Status = true
22 fr.TimeCreate = int(time.Now().Unix())
23 if i, err := orm.NewOrm().Insert(&fr); i > 0 && err == nil {
24 this.ResponseJson(true, "友链添加成功")
25 } else {
26 if err != nil {
27 helper.Logger.Error(err.Error())
28 }
29 this.ResponseJson(false, "友链添加失败,可能您要添加的友链已存在")
30 }
31 } else {
32 this.Data["IsFriend"] = true
33 this.Data["Friends"], _, _ = models.NewFriend().GetListByStatus(-1)
34 this.TplName = "index.html"
35 }
36}

Callers

nothing calls this directly

Calls 4

ParseFormMethod · 0.80
InsertMethod · 0.80
GetListByStatusMethod · 0.80
ResponseJsonMethod · 0.45

Tested by

no test coverage detected