更新uniapp和platform
This commit is contained in:
1 parent
31ae07175d
commit
7f9a66da0f
47 files changed
+5207
-1974
No files matched your search
@@ -0,0 +1,32 @@
|
||||
package controllers
|
||||
|
||||
import (
|
||||
"server/services"
|
||||
|
||||
beego "github.com/beego/beego/v2/server/web"
|
||||
)
|
||||
|
||||
// StorageQuotaExceededBizCode 附件空间不足的业务码。
|
||||
// 前端据此弹「空间不足,去扩容」,而不是普通错误提示。
|
||||
const StorageQuotaExceededBizCode = 4032
|
||||
|
||||
// respondStorageQuotaError 输出「附件空间不足」响应。
|
||||
// 返回 true 表示已写入响应,调用方必须立即 return。
|
||||
func respondStorageQuotaError(c *beego.Controller, err error) bool {
|
||||
quotaErr, ok := err.(*services.StorageQuotaExceededError)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
c.Ctx.Output.SetStatus(403)
|
||||
c.Data["json"] = map[string]interface{}{
|
||||
"code": StorageQuotaExceededBizCode,
|
||||
"msg": quotaErr.Error(),
|
||||
"data": map[string]interface{}{
|
||||
"used_bytes": quotaErr.UsedBytes,
|
||||
"quota_bytes": quotaErr.QuotaBytes,
|
||||
"required_bytes": quotaErr.RequiredBytes,
|
||||
},
|
||||
}
|
||||
_ = c.ServeJSON()
|
||||
return true
|
||||
}
|
||||
Reference in new issue
Block a user