|
|
@@ -59,24 +59,26 @@ type infoResponse struct {
|
|
|
}
|
|
|
|
|
|
type updateRequest struct {
|
|
|
- ID string `json:"id"`
|
|
|
- ConfigKey string `json:"configKey"`
|
|
|
- ConfigValue string `json:"configValue"`
|
|
|
- ValueType string `json:"valueType"`
|
|
|
- ConfigGroup string `json:"configGroup"`
|
|
|
- Service string `json:"service"`
|
|
|
- Description string `json:"description"`
|
|
|
- UpdateUserID string `json:"updateUserId"`
|
|
|
+ ID string `json:"id"`
|
|
|
+ ConfigKey string `json:"configKey"`
|
|
|
+ ConfigValue string `json:"configValue"`
|
|
|
+ ValueType string `json:"valueType"`
|
|
|
+ ConfigGroup string `json:"configGroup"`
|
|
|
+ Service string `json:"service"`
|
|
|
+ Description string `json:"description"`
|
|
|
+ UpdateUserID string `json:"updateUserId"`
|
|
|
+ OperatorUserName string `json:"operatorUserName"`
|
|
|
}
|
|
|
|
|
|
type createRequest struct {
|
|
|
- ConfigKey string `json:"configKey"`
|
|
|
- ConfigValue string `json:"configValue"`
|
|
|
- ValueType string `json:"valueType"`
|
|
|
- ConfigGroup string `json:"configGroup"`
|
|
|
- Service string `json:"service"`
|
|
|
- Description string `json:"description"`
|
|
|
- CreateUserID string `json:"createUserId"`
|
|
|
+ ConfigKey string `json:"configKey"`
|
|
|
+ ConfigValue string `json:"configValue"`
|
|
|
+ ValueType string `json:"valueType"`
|
|
|
+ ConfigGroup string `json:"configGroup"`
|
|
|
+ Service string `json:"service"`
|
|
|
+ Description string `json:"description"`
|
|
|
+ CreateUserID string `json:"createUserId"`
|
|
|
+ OperatorUserName string `json:"operatorUserName"`
|
|
|
}
|
|
|
|
|
|
var (
|
|
|
@@ -300,23 +302,27 @@ func GetBool(key string, defaultValue bool) bool {
|
|
|
}
|
|
|
|
|
|
// Update 更新已有配置项(需带 ID)。
|
|
|
-func Update(info ConfigInfo, updateUserID string) error {
|
|
|
+func Update(info ConfigInfo, updateUserID, operatorUserName string) error {
|
|
|
if invokeAPI == nil {
|
|
|
return errors.New("mbsdsdk not initialized")
|
|
|
}
|
|
|
if info.ID == "" {
|
|
|
return errors.New("config id is required")
|
|
|
}
|
|
|
+ if operatorUserName == "" {
|
|
|
+ operatorUserName = updateUserID
|
|
|
+ }
|
|
|
|
|
|
body, err := json.Marshal(&updateRequest{
|
|
|
- ID: info.ID,
|
|
|
- ConfigKey: info.ConfigKey,
|
|
|
- ConfigValue: info.ConfigValue,
|
|
|
- ValueType: info.ValueType,
|
|
|
- ConfigGroup: info.ConfigGroup,
|
|
|
- Service: info.Service,
|
|
|
- Description: info.Description,
|
|
|
- UpdateUserID: updateUserID,
|
|
|
+ ID: info.ID,
|
|
|
+ ConfigKey: info.ConfigKey,
|
|
|
+ ConfigValue: info.ConfigValue,
|
|
|
+ ValueType: info.ValueType,
|
|
|
+ ConfigGroup: info.ConfigGroup,
|
|
|
+ Service: info.Service,
|
|
|
+ Description: info.Description,
|
|
|
+ UpdateUserID: updateUserID,
|
|
|
+ OperatorUserName: operatorUserName,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return err
|
|
|
@@ -345,19 +351,23 @@ func Update(info ConfigInfo, updateUserID string) error {
|
|
|
}
|
|
|
|
|
|
// Create 新建配置项。
|
|
|
-func Create(info ConfigInfo, createUserID string) error {
|
|
|
+func Create(info ConfigInfo, createUserID, operatorUserName string) error {
|
|
|
if invokeAPI == nil {
|
|
|
return errors.New("mbsdsdk not initialized")
|
|
|
}
|
|
|
+ if operatorUserName == "" {
|
|
|
+ operatorUserName = createUserID
|
|
|
+ }
|
|
|
|
|
|
body, err := json.Marshal(&createRequest{
|
|
|
- ConfigKey: info.ConfigKey,
|
|
|
- ConfigValue: info.ConfigValue,
|
|
|
- ValueType: info.ValueType,
|
|
|
- ConfigGroup: info.ConfigGroup,
|
|
|
- Service: info.Service,
|
|
|
- Description: info.Description,
|
|
|
- CreateUserID: createUserID,
|
|
|
+ ConfigKey: info.ConfigKey,
|
|
|
+ ConfigValue: info.ConfigValue,
|
|
|
+ ValueType: info.ValueType,
|
|
|
+ ConfigGroup: info.ConfigGroup,
|
|
|
+ Service: info.Service,
|
|
|
+ Description: info.Description,
|
|
|
+ CreateUserID: createUserID,
|
|
|
+ OperatorUserName: operatorUserName,
|
|
|
})
|
|
|
if err != nil {
|
|
|
return err
|