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

Function installPages

models/Install.go:132–193  ·  view source on GitHub ↗

安装单页初始数据 存在唯一索引Alias,已存在的数据不会继续写入

()

Source from the content-addressed store, hash-verified

130//安装单页初始数据
131//存在唯一索引Alias,已存在的数据不会继续写入
132func installPages() {
133 //存在单页了,则表明已经初始化过数据
134 var page = new(Pages)
135 if orm.NewOrm().QueryTable(page).Filter("id__gt", 0).One(page); page.Id > 0 {
136 return
137 }
138
139 now := int(time.Now().Unix())
140 var pages = []Pages{
141 Pages{
142 Name: "关于我们",
143 Alias: "about",
144 Title: "关于我们",
145 Keywords: "关于我们,about us,dochub",
146 Description: "这是关于我们的单页",
147 Content: "这是关于我们的单页内容",
148 TimeCreate: now,
149 Status: true,
150 },
151 Pages{
152 Name: "文库协议",
153 Alias: "agreement",
154 Title: "关于我们",
155 Keywords: "文库协议,agreement,dochub",
156 Description: "这是文库协议的单页",
157 Content: "这是文库协议的单页内容",
158 TimeCreate: now,
159 Status: true,
160 },
161 Pages{
162 Name: "意见反馈",
163 Alias: "feedback",
164 Title: "意见反馈",
165 Keywords: "意见反馈,feedback,dochub",
166 Description: "这是意见反馈的单页",
167 Content: "这是意见反馈的单页内容",
168 TimeCreate: now,
169 Status: true,
170 },
171 Pages{
172 Name: "免责声明",
173 Alias: "response",
174 Title: "免责声明",
175 Keywords: "免责声明,response,dochub",
176 Description: "这是免责声明的单页",
177 Content: "这是免责声明的单页内容",
178 TimeCreate: now,
179 Status: true,
180 },
181 Pages{
182 Name: "联系我们",
183 Alias: "contact",
184 Title: "意见反馈",
185 Keywords: "意见反馈,contact,dochub",
186 Description: "这是联系我们的单页",
187 Content: "这是联系我们的单页内容",
188 TimeCreate: now,
189 Status: true,

Callers 1

installFunction · 0.85

Calls 1

OneMethod · 0.80

Tested by

no test coverage detected