Merge remote-tracking branch 'origin/tuoyun' into tuoyun

pull/103/head
wenxu12345 3 years ago
commit a8575b4fc7

@ -127,7 +127,7 @@ func OpenIMRegister(account string) (*http.Response, error) {
params := make(map[string]interface{}) params := make(map[string]interface{})
params["secret"] = config.Config.Secret params["secret"] = config.Config.Secret
params["platform"] = 7 params["platform"] = 2
params["uid"] = account params["uid"] = account
params["name"] = account params["name"] = account
params["icon"] = "" params["icon"] = ""

@ -11,7 +11,7 @@ const (
appleDeviceToken = "DEVICE_TOKEN" appleDeviceToken = "DEVICE_TOKEN"
lastGetSeq = "LAST_GET_SEQ" lastGetSeq = "LAST_GET_SEQ"
userMinSeq = "REDIS_USER_MIN_SEQ:" userMinSeq = "REDIS_USER_MIN_SEQ:"
uidPidToken = "UID_PID_TOKEN:" uidPidToken = "UID_PID_TOKEN_STATUS:"
) )
func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) { func (d *DataBases) Exec(cmd string, key interface{}, args ...interface{}) (interface{}, error) {

@ -61,19 +61,18 @@ func newEsHook(moduleName string) *esHook {
return &esHook{client: es, moduleName: moduleName} return &esHook{client: es, moduleName: moduleName}
} }
//Fire log hook interface 方法 //Fire log hook interface
func (hook *esHook) Fire(entry *logrus.Entry) error { func (hook *esHook) Fire(entry *logrus.Entry) error {
doc := newEsLog(entry) doc := newEsLog(entry)
go hook.sendEs(doc) go hook.sendEs(doc)
return nil return nil
} }
//Levels log hook interface 方法,此hook影响的日志
func (hook *esHook) Levels() []logrus.Level { func (hook *esHook) Levels() []logrus.Level {
return logrus.AllLevels return logrus.AllLevels
} }
//sendEs 异步发送日志到es //sendEs
func (hook *esHook) sendEs(doc appLogDocModel) { func (hook *esHook) sendEs(doc appLogDocModel) {
defer func() { defer func() {
if r := recover(); r != nil { if r := recover(); r != nil {
@ -102,7 +101,7 @@ func newEsLog(e *logrus.Entry) appLogDocModel {
return ins return ins
} }
// indexName es index name 时间分割 // indexName es index name
func (m *appLogDocModel) indexName() string { func (m *appLogDocModel) indexName() string {
return time.Now().Format("2006-01-02") return time.Now().Format("2006-01-02")
} }

Loading…
Cancel
Save