重新初始化仓库
This commit is contained in:
68
manager/base.go
Normal file
68
manager/base.go
Normal file
@ -0,0 +1,68 @@
|
||||
// Package manager...
|
||||
//
|
||||
// Description : manager...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2021-08-09 2:24 下午
|
||||
package manager
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"git.zhangdeman.cn/zhangdeman/center-config/define/model"
|
||||
"github.com/gin-gonic/gin"
|
||||
)
|
||||
|
||||
// base 基础结构,均为通用方法
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2:25 下午 2021/8/9
|
||||
type base struct {
|
||||
}
|
||||
|
||||
// ParsePostForm 解析post表单
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2:25 下午 2021/8/9
|
||||
func (b *base) ParsePostForm(ctx *gin.Context, form interface{}) error {
|
||||
var err error
|
||||
if err = ctx.ShouldBindJSON(form); nil != err {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetLogData 获取记录日志的数据
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 6:02 下午 2021/8/9
|
||||
func (b *base) GetLogData(namespaceID int64, configID int64, userID string, logType string, description string) *model.Log {
|
||||
return &model.Log{
|
||||
NamespaceID: namespaceID,
|
||||
ConfigID: configID,
|
||||
BeforeValue: "",
|
||||
AfterValue: "",
|
||||
Description: description,
|
||||
LogType: logType,
|
||||
CreateUserID: userID,
|
||||
CreateTime: time.Now().Format("2006-01-02 15:04:05"),
|
||||
ModifyTime: time.Now().Format("2006-01-02 15:04:05"),
|
||||
}
|
||||
}
|
||||
|
||||
// GetNamespaceIDByNamespace ...
|
||||
//
|
||||
// Author : go_developer@163.com<白茶清欢>
|
||||
//
|
||||
// Date : 2:13 下午 2021/11/30
|
||||
func (b *base) GetNamespaceIDByNamespace(np string) int64 {
|
||||
namespaceInfo, _ := Storage.GetNamespace(np)
|
||||
if nil == namespaceInfo {
|
||||
return 0
|
||||
}
|
||||
return namespaceInfo.ID
|
||||
}
|
Reference in New Issue
Block a user