MCPcopy Create free account
hub / github.com/TruthHun/DocHub / installFriendlinks

Function installFriendlinks

models/Install.go:84–128  ·  view source on GitHub ↗

安装友链初始数据

()

Source from the content-addressed store, hash-verified

82
83//安装友链初始数据
84func installFriendlinks() {
85 var friend = new(Friend)
86 if orm.NewOrm().QueryTable(friend).Filter("id__gt", 0).One(friend); friend.Id > 0 {
87 return
88 }
89
90 now := int(time.Now().Unix())
91 var friends = []Friend{
92 Friend{
93 Id: 1,
94 Title: "书栈网",
95 Link: "https://www.bookstack.cn",
96 Status: true,
97 Sort: 1,
98 TimeCreate: now,
99 },
100 Friend{
101 Id: 2,
102 Title: "掘金量化",
103 Link: "https://www.myquant.cn",
104 Status: true,
105 Sort: 2,
106 TimeCreate: now,
107 },
108 Friend{
109 Id: 4,
110 Title: "南宁引力互动科技",
111 Link: "http://www.gxyinli.com",
112 Status: true,
113 Sort: 3,
114 TimeCreate: now,
115 },
116 Friend{
117 Id: 3,
118 Title: "HC-CMS",
119 Link: "http://www.hc-cms.com",
120 Status: true,
121 Sort: 4,
122 TimeCreate: now,
123 },
124 }
125 if _, err := orm.NewOrm().InsertMulti(len(friends), friends); err != nil {
126 helper.Logger.Error("初始化友链数据失败:" + err.Error())
127 }
128}
129
130//安装单页初始数据
131//存在唯一索引Alias,已存在的数据不会继续写入

Callers 1

installFunction · 0.85

Calls 1

OneMethod · 0.80

Tested by

no test coverage detected