mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-05-19 00:09:02 +08:00
merge code
This commit is contained in:
@@ -1 +1,17 @@
|
||||
package call_back_struct
|
||||
|
||||
type CommonCallbackReq struct {
|
||||
CallbackCommand string `json:"callbackCommand"`
|
||||
ServerMsgID string `json:"serverID"`
|
||||
ClientID string `json:"clientID"`
|
||||
OperationID string `json:"operationID"`
|
||||
}
|
||||
|
||||
type CommonCallbackResp struct {
|
||||
ActionCode int `json:"actionCode"`
|
||||
ErrCode int `json:"errCode"`
|
||||
ErrMsg string `json:"errMsg"`
|
||||
OperationID string `json:"operationID"`
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
package call_back_struct
|
||||
|
||||
type CallbackBeforeCreateGroupReq struct {
|
||||
CommonCallbackReq
|
||||
}
|
||||
|
||||
type CallbackAfterCreateGroupResp struct {
|
||||
CommonCallbackResp
|
||||
}
|
||||
@@ -1 +1,61 @@
|
||||
package call_back_struct
|
||||
|
||||
type singleMsg struct {
|
||||
SendID string `json:"sendID"`
|
||||
RecvID string `json:"recvID"`
|
||||
ClientMsgID string `json:"clientMsgID"`
|
||||
ServerMsgID string `json:"serverMsgId"`
|
||||
SendTime int64 `json:"sendTime"`
|
||||
CreateTime int64 `json:"createTime"`
|
||||
}
|
||||
|
||||
type CallbackBeforeSendSingleMsgReq struct {
|
||||
CommonCallbackReq
|
||||
singleMsg
|
||||
}
|
||||
|
||||
type CallbackBeforeSendSingleMsgResp struct {
|
||||
CommonCallbackResp
|
||||
}
|
||||
|
||||
type CallbackAfterSendSingleMsgReq struct {
|
||||
CommonCallbackReq
|
||||
singleMsg
|
||||
}
|
||||
|
||||
type CallbackAfterSendSingleMsgResp struct {
|
||||
CommonCallbackResp
|
||||
}
|
||||
|
||||
type groupMsg struct {
|
||||
|
||||
}
|
||||
|
||||
type CallbackBeforeSendGroupMsgReq struct {
|
||||
CommonCallbackReq
|
||||
}
|
||||
|
||||
type CallbackBeforeSendGroupMsgResp struct {
|
||||
CommonCallbackResp
|
||||
}
|
||||
|
||||
type CallbackAfterSendGroupMsgReq struct {
|
||||
CommonCallbackReq
|
||||
}
|
||||
|
||||
type CallbackAfterSendGroupMsgResp struct {
|
||||
CommonCallbackResp
|
||||
}
|
||||
|
||||
type CallBackWordFilterReq struct {
|
||||
CommonCallbackReq
|
||||
Content []byte `json:"content"`
|
||||
SendID string `json:"SendID"`
|
||||
RecvID string `json:"RecvID"`
|
||||
GroupID string `json:"GroupID"`
|
||||
}
|
||||
|
||||
type CallBackWordFilterResp struct {
|
||||
CommonCallbackResp
|
||||
Content []byte `json:"content"`
|
||||
}
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -338,6 +338,36 @@ message ConversationUpdateTips{
|
||||
|
||||
}
|
||||
|
||||
///callback
|
||||
message CommonCallbackURLReq {
|
||||
string CallbackCommand = 1 [json_name = "code"];
|
||||
string OpenIMServerID = 2;
|
||||
string OperationID = 3;
|
||||
}
|
||||
|
||||
message CommonCallbackURLResp {
|
||||
string Code = 1 [json_name = "code"];
|
||||
string Msg = 2 [json_name = "msg"];
|
||||
string OperationID = 3 [json_name = "operationID"];
|
||||
}
|
||||
|
||||
message CallbackBeforeSendMsgReq {
|
||||
commonReq CommonCallbackURLReq = 1;
|
||||
|
||||
}
|
||||
|
||||
message CallbackBeforeSendMsgResp {
|
||||
commonResp CommonCallbackURLResp = 1;
|
||||
string FromUserID = 2;
|
||||
}
|
||||
|
||||
message CallbackAfterAddFriendReq {
|
||||
commonReq CommonCallbackURLReq = 1;
|
||||
}
|
||||
|
||||
message CallbackAfterAddFriendResp {
|
||||
commonResp CommonCallbackURLResp = 1;
|
||||
}
|
||||
|
||||
|
||||
///cms
|
||||
|
||||
Reference in New Issue
Block a user