mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-16 14:59:01 +08:00
merge code
This commit is contained in:
@@ -19,6 +19,12 @@ var (
|
||||
|
||||
var Config config
|
||||
|
||||
type callBackConfig struct {
|
||||
Enable bool `yaml:"enable"`
|
||||
CallbackTimeOut int `yaml:"callbackTimeOut"`
|
||||
CallbackFailedContinue bool `CallbackFailedContinue`
|
||||
}
|
||||
|
||||
type config struct {
|
||||
ServerIP string `yaml:"serverip"`
|
||||
ServerVersion string `yaml:"serverversion"`
|
||||
@@ -167,11 +173,6 @@ type config struct {
|
||||
AccessSecret string `yaml:"accessSecret"`
|
||||
AccessExpire int64 `yaml:"accessExpire"`
|
||||
}
|
||||
MessageCallBack struct {
|
||||
CallbackSwitch bool `yaml:"callbackSwitch"`
|
||||
CallbackUrl string `yaml:"callbackUrl"`
|
||||
CallBackTimeOut int `yaml:"callbackTimeOut"`
|
||||
}
|
||||
MessageJudge struct {
|
||||
IsJudgeFriend bool `yaml:"isJudgeFriend"`
|
||||
}
|
||||
@@ -179,6 +180,15 @@ type config struct {
|
||||
PushSound string `yaml:"pushSound"`
|
||||
BadgeCount bool `yaml:"badgeCount"`
|
||||
}
|
||||
|
||||
Callback struct {
|
||||
CallbackUrl string `yaml:"callbackUrl"`
|
||||
CallbackbeforeSendSingleMsg callBackConfig `yaml:"callbackSendGroupMsg"`
|
||||
CallbackAfterSendSingleMsg callBackConfig `yaml:"callbackSendSingleMsg"`
|
||||
CallbackBeforeSendGroupMsg callBackConfig `yaml:"CallbackBeforeSendGroupMsg"`
|
||||
CallbackAfterSendGroupMsg callBackConfig `yaml:"callbackAfterSendGroupMsg"`
|
||||
CallbackWordFilter callBackConfig `yaml:"callbackWordFilter"`
|
||||
} `yaml:"callback"`
|
||||
Notification struct {
|
||||
///////////////////////group/////////////////////////////
|
||||
GroupCreated struct {
|
||||
|
||||
@@ -136,6 +136,16 @@ const (
|
||||
VerificationCodeForReset = 2
|
||||
VerificationCodeForRegisterSuffix = "_forRegister"
|
||||
VerificationCodeForResetSuffix = "_forReset"
|
||||
|
||||
//callbackCommand
|
||||
CallbackBeforeSendSingleMsgCommand = "callbackBeforeSendSingleMsg"
|
||||
CallbackAfterSendSingleMsgCommand = "callbackAfterSendSingleMsg"
|
||||
CallbackBeforeSendGroupMsgCommand = "callbackBeforeSendGroupMsg"
|
||||
CallbackAfterSendGroupMsgCommand = "callbackAfterSendGroupMsgCommand"
|
||||
CallbackWordFilterCommand = "callbackWordFilterCommand"
|
||||
//actionCode
|
||||
ActionAllow = 0
|
||||
ActionForbidden = 1
|
||||
)
|
||||
|
||||
var ContentType2PushContent = map[int64]string{
|
||||
|
||||
@@ -51,6 +51,7 @@ var (
|
||||
ErrAccess = ErrInfo{ErrCode: 801, ErrMsg: AccessMsg.Error()}
|
||||
ErrDB = ErrInfo{ErrCode: 802, ErrMsg: DBMsg.Error()}
|
||||
ErrArgs = ErrInfo{ErrCode: 8003, ErrMsg: ArgsMsg.Error()}
|
||||
ErrCallback = ErrInfo{ErrCode: 809, ErrMsg: CallBackMsg.Error()}
|
||||
)
|
||||
|
||||
var (
|
||||
@@ -64,6 +65,7 @@ var (
|
||||
AccessMsg = errors.New("no permission")
|
||||
DBMsg = errors.New("db failed")
|
||||
ArgsMsg = errors.New("args failed")
|
||||
CallBackMsg = errors.New("callback failed")
|
||||
|
||||
ThirdPartyMsg = errors.New("third party error")
|
||||
)
|
||||
|
||||
@@ -53,3 +53,13 @@ func Post(url string, data interface{}, timeOutSecond int) (content []byte, err
|
||||
}
|
||||
return result, nil
|
||||
}
|
||||
|
||||
func PostReturn(url string, input, output interface{}, timeOut int) error {
|
||||
b, err := Post(url, input, timeOut)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if err = json.Unmarshal(b, output); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package log
|
||||
|
||||
import (
|
||||
"Open_IM/pkg/common/config"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"os"
|
||||
"time"
|
||||
@@ -33,13 +32,13 @@ func loggerInit(moduleName string) *Logger {
|
||||
//All logs will be printed
|
||||
logger.SetLevel(logrus.Level(config.Config.Log.RemainLogLevel))
|
||||
//Close std console output
|
||||
src, err := os.OpenFile(os.DevNull, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
|
||||
if err != nil {
|
||||
panic(err.Error())
|
||||
}
|
||||
writer := bufio.NewWriter(src)
|
||||
logger.SetOutput(writer)
|
||||
//logger.SetOutput(os.Stdout)
|
||||
//src, err := os.OpenFile(os.DevNull, os.O_APPEND|os.O_WRONLY, os.ModeAppend)
|
||||
//if err != nil {
|
||||
// panic(err.Error())
|
||||
//}
|
||||
//writer := bufio.NewWriter(src)
|
||||
//logger.SetOutput(writer)
|
||||
logger.SetOutput(os.Stdout)
|
||||
//Log Console Print Style Setting
|
||||
logger.SetFormatter(&nested.Formatter{
|
||||
TimestampFormat: "2006-01-02 15:04:05.000",
|
||||
|
||||
Reference in New Issue
Block a user