mirror of
https://github.com/KaySar12/NextZen-UserService.git
synced 2025-10-06 19:59:42 +07:00
Send notification
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package v1
|
||||
|
||||
import (
|
||||
"context"
|
||||
"crypto/ecdsa"
|
||||
"encoding/base64"
|
||||
json2 "encoding/json"
|
||||
@@ -21,6 +22,7 @@ import (
|
||||
"github.com/IceWhaleTech/CasaOS-Common/utils/common_err"
|
||||
"github.com/IceWhaleTech/CasaOS-Common/utils/jwt"
|
||||
"github.com/IceWhaleTech/CasaOS-Common/utils/logger"
|
||||
"github.com/IceWhaleTech/CasaOS-UserService/common"
|
||||
"github.com/IceWhaleTech/CasaOS-UserService/model"
|
||||
"github.com/IceWhaleTech/CasaOS-UserService/model/system_model"
|
||||
"github.com/IceWhaleTech/CasaOS-UserService/pkg/config"
|
||||
@@ -508,6 +510,20 @@ func PostUserCustomConf(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
if name == "system" {
|
||||
dataMap := make(map[string]string, 1)
|
||||
dataMap["system"] = string(data)
|
||||
response, err := service.MyService.MessageBus().PublishEventWithResponse(context.Background(), common.SERVICENAME, "zimaos:user:save_config", dataMap)
|
||||
if err != nil {
|
||||
logger.Error("failed to publish event to message bus", zap.Error(err), zap.Any("event", string(data)))
|
||||
return
|
||||
}
|
||||
if response.StatusCode() != http.StatusOK {
|
||||
logger.Error("failed to publish event to message bus", zap.String("status", response.Status()), zap.Any("response", response))
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
c.JSON(common_err.SUCCESS, model.Result{Success: common_err.SUCCESS, Message: common_err.GetMsg(common_err.SUCCESS), Data: json2.RawMessage(string(data))})
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user