更新uniapp和platform
This commit is contained in:
1 parent
31ae07175d
commit
7f9a66da0f
47 files changed
+5207
-1974
No files matched your search
@@ -40,7 +40,9 @@ type tenantDTO struct {
|
||||
DaysRemaining int `json:"days_remaining"`
|
||||
UserQuota int `json:"user_quota"`
|
||||
UserUsed int `json:"user_used"`
|
||||
Remark string `json:"remark"`
|
||||
// StorageQuotaMB 附件空间基础额度(MB)
|
||||
StorageQuotaMB int `json:"storage_quota_mb"`
|
||||
Remark string `json:"remark"`
|
||||
CreateTime *time.Time `json:"create_time,omitempty"`
|
||||
UpdateTime *time.Time `json:"update_time,omitempty"`
|
||||
DeleteTime *time.Time `json:"delete_time,omitempty"`
|
||||
@@ -109,6 +111,7 @@ func toTenantDTO(t models.SystemTenant) tenantDTO {
|
||||
PackageExpireTime: t.PackageExpireTime,
|
||||
DaysRemaining: daysRemaining,
|
||||
UserQuota: t.UserQuota,
|
||||
StorageQuotaMB: t.StorageQuotaMB,
|
||||
Remark: stringValue(t.Remark),
|
||||
CreateTime: &ct,
|
||||
UpdateTime: &ut,
|
||||
@@ -235,7 +238,9 @@ type tenantPayload struct {
|
||||
// 套餐与用户数上限(可选)
|
||||
PackageID *uint64 `json:"package_id"`
|
||||
UserQuota *int `json:"user_quota"`
|
||||
Remark string `json:"remark"`
|
||||
// StorageQuotaMB 附件空间基础额度(MB,可选)
|
||||
StorageQuotaMB *int `json:"storage_quota_mb"`
|
||||
Remark string `json:"remark"`
|
||||
|
||||
// 指定租户管理员(可选):把已有认证身份绑定为该租户管理员。
|
||||
// AdminIdentityID 直接指定身份;也可只传 AdminAccount/AdminPhone/AdminEmail 按归并键定位。
|
||||
@@ -274,6 +279,11 @@ func (c *PlatformTenantController) parseTenantPayload() (tenantPayload, error) {
|
||||
p.UserQuota = &v
|
||||
}
|
||||
}
|
||||
if s := strings.TrimSpace(c.GetString("storage_quota_mb")); s != "" {
|
||||
if v, err := strconv.Atoi(s); err == nil {
|
||||
p.StorageQuotaMB = &v
|
||||
}
|
||||
}
|
||||
if s := strings.TrimSpace(c.GetString("admin_identity_id")); s != "" {
|
||||
if v, err := strconv.ParseUint(s, 10, 64); err == nil {
|
||||
p.AdminIdentityID = v
|
||||
@@ -430,6 +440,11 @@ func (c *PlatformTenantController) CreateTenant() {
|
||||
if userQuota <= 0 {
|
||||
userQuota = services.DefaultTenantUserQuota
|
||||
}
|
||||
// 附件空间基础额度:未显式指定时按 500MB
|
||||
storageQuota := services.DefaultTenantStorageMB
|
||||
if p.StorageQuotaMB != nil && *p.StorageQuotaMB > 0 {
|
||||
storageQuota = *p.StorageQuotaMB
|
||||
}
|
||||
|
||||
t := models.SystemTenant{
|
||||
TenantCode: p.TenantCode,
|
||||
@@ -443,6 +458,7 @@ func (c *PlatformTenantController) CreateTenant() {
|
||||
PackageID: packageID,
|
||||
PackageExpireTime: packageExpire,
|
||||
UserQuota: userQuota,
|
||||
StorageQuotaMB: storageQuota,
|
||||
Remark: stringPtr(p.Remark),
|
||||
}
|
||||
|
||||
@@ -536,6 +552,14 @@ func (c *PlatformTenantController) EditTenant() {
|
||||
update["user_quota"] = quota
|
||||
}
|
||||
}
|
||||
if p.StorageQuotaMB != nil {
|
||||
// 附件空间基础额度:允许平台赠送/降级;0 视为恢复默认 500MB
|
||||
storageQuota := *p.StorageQuotaMB
|
||||
if storageQuota <= 0 {
|
||||
storageQuota = services.DefaultTenantStorageMB
|
||||
}
|
||||
update["storage_quota_mb"] = storageQuota
|
||||
}
|
||||
|
||||
_, err = models.Orm.QueryTable(new(models.SystemTenant)).Filter("id", id).Update(update)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user