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

Method SetCloudStore

controllers/AdminControllers/SysController.go:210–244  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

208}
209
210func (this *SysController) SetCloudStore() {
211 storeType := helper.ConfigCate(this.GetString("tab", "cs-oss"))
212 if storeType == "" {
213 this.ResponseJson(false, "参数错误:存储类别不正确")
214 }
215 modelConfig := models.NewConfig()
216 config, err := modelConfig.ParseForm(storeType, this.Ctx.Request.Form)
217 if err != nil {
218 this.ResponseJson(false, err.Error(), config)
219 }
220
221 csPublic, err := models.NewCloudStoreWithConfig(config, storeType, false)
222 if err != nil {
223 this.ResponseJson(false, err.Error(), config)
224 }
225
226 if err = csPublic.PingTest(); err != nil {
227 this.ResponseJson(false, err.Error(), config)
228 }
229
230 csPrivate, err := models.NewCloudStoreWithConfig(config, storeType, true)
231 if err != nil {
232 this.ResponseJson(false, err.Error(), config)
233 }
234
235 if err = csPrivate.PingTest(); err != nil {
236 this.ResponseJson(false, err.Error(), config)
237 }
238
239 err = modelConfig.UpdateCloudStore(storeType, config)
240 if err != nil {
241 this.ResponseJson(false, err.Error(), config)
242 }
243 this.ResponseJson(true, "更新成功", config)
244}

Callers

nothing calls this directly

Calls 4

ParseFormMethod · 0.95
UpdateCloudStoreMethod · 0.95
PingTestMethod · 0.80
ResponseJsonMethod · 0.45

Tested by

no test coverage detected