| 12345678910111213141516171819202122232425262728293031323334 |
- package application
- import (
- "time"
- "udeServer/internal/model"
- "udeServer/internal/types"
- )
- // toApplicationCredentials 将模型行转换为响应结构;ApiSecret 做掩码,原文只经下发接口输出。
- func toApplicationCredentials(row *model.TApplicationCredentials) types.ApplicationCredentials {
- return types.ApplicationCredentials{
- Id: row.Id,
- CredIden: row.CredIden,
- Name: row.Name,
- ApiKey: row.ApiKey,
- ApiSecret: maskSensitive(row.ApiSecret),
- Status: int(row.Status),
- Description: row.Description.String,
- CreatedBy: row.CreatedBy,
- CreatedAt: formatCredentialTime(row.CreatedAt),
- UpdatedBy: row.UpdatedBy,
- UpdatedAt: formatCredentialTime(row.UpdatedAt),
- }
- }
- // formatCredentialTime 时间展示格式与 sdf-serve 保持一致。
- func formatCredentialTime(t time.Time) string {
- if t.IsZero() {
- return ""
- }
- return t.Format("2006-01-02 15:04:05")
- }
|