()
| 208 | } |
| 209 | |
| 210 | func (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 | } |
nothing calls this directly
no test coverage detected