Skip to content

Commit

Permalink
first
Browse files Browse the repository at this point in the history
  • Loading branch information
ngocanh1909 committed Apr 5, 2021
1 parent 62c26be commit 8a7f063
Show file tree
Hide file tree
Showing 33 changed files with 7,129 additions and 5,983 deletions.
62 changes: 30 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,7 @@ make

#### Build

- Get source code

- Get source code 
```
mkdir -p $GOPATH/src/github.com/nebula-chat/
cd $GOPATH/src/github.com/nebula-chat/
Expand All @@ -55,66 +54,65 @@ git clone https://github.com/nebula-chat/chatengine.git

- Build
```
# build frontend
build frontend
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/frontend
go build
# build auth_key
build auth_key
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/auth_key
go build
# build auth_session
build auth_session
cd $GOPATH/src/github.com/nebula-chat/chatengine/service/auth_session
go build
# build sync
build sync
cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/sync
go build
# build upload
build upload
cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/upload
go build
# build document
build document
cd $GOPATH/src/github.com/nebula-chat/chatengine/service/document
go build
# build biz_server
build biz_server
cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/biz_server
go build
# build session
build session
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/session
go build
```
- Run
```
cd $GOPATH/src/github.com/nebula-chat/chatengine/service/auth_session
./auth_session
cd $GOPATH/src/github.com/nebula-chat/chatengine/service/document
./document
```
cd $GOPATH/src/github.com/nebula-chat/chatengine/service/auth_session
./auth_session

cd $GOPATH/src/github.com/nebula-chat/chatengine/service/document
./document

cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/sync
./sync

cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/upload
./upload

cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/biz_server
./biz_server
cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/sync
./sync
cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/upload
./upload
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/auth_key
./auth_key
cd $GOPATH/src/github.com/nebula-chat/chatengine/messenger/biz_server
./biz_server
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/session
./session
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/auth_key
./auth_key
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/frontend
./frontend
```
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/session
./session
cd $GOPATH/src/github.com/nebula-chat/chatengine/access/frontend
./frontend
```
#### More
[Build document](doc/build.md)
Expand Down
2 changes: 1 addition & 1 deletion access/auth_key/auth_key.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
ver = "0.0.1"
serverId = 1
keyFile = "server_pkcs1.key"
KeyFingerprint = "12240908862933197005"
KeyFingerprint = "2066079364791309323"

[server.server]
name = "handshake"
Expand Down
52 changes: 26 additions & 26 deletions access/auth_key/server_pkcs1.key
Original file line number Diff line number Diff line change
@@ -1,27 +1,27 @@
-----BEGIN RSA PRIVATE KEY-----
MIIEpAIBAAKCAQEAvKLEOWTzt9Hn3/9Kdp/RdHcEhzmd8xXeLSpHIIzaXTLJDw8B
hJy1jR/iqeG8Je5yrtVabqMSkA6ltIpgylH///FojMsX1BHu4EPYOXQgB0qOi6kr
08iXZIH9/iOPQOWDsL+Lt8gDG0xBy+sPe/2ZHdzKMjX6O9B4sOsxjFrk5qDoWDri
oJorAJ7eFAfPpOBf2w73ohXudSrJE0lbQ8pCWNpMY8cB9i8r+WBitcvouLDAvmtn
TX7akhoDzmKgpJBYliAY4qA73v7u5UIepE8QgV0jCOhxJCPubP8dg+/PlLLVKyxU
5CdiQtZj2EMy4s9xlNKzX8XezE0MHEa6bQpnFwIDAQABAoIBACd+SGjfyursZoiO
MW/ejAK/PFJ3bKtNI8P++v9Enh8vF8swUBgMmzIdv93jZfnnD1mtT46kU6mXd3fy
FMunGVrjlwkLKET9MC8B5U46Es6T/H4fAA8KCzA+ywefOEn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BDRvxgulDUPA
U+kS0MR/m5/m0yiFAPCzwCuf3j214nhmsqQ7mI4XAoGARlgzentSsix9HL0ph6/o
HD3cpH+o61pw72xYbHVOS01cg1ayNntGYjF1Vz20jBpzAKGBISupvwL0ml9lYbkT
983VTPtSXkp2SxNjqgN67jr3RMhNGeY7KZmucbj1D5s9BMN/dD33cYvNj0Evjm/r
oTZRUfzl9tj/BrmRPjwNX4ECgYEArT7obBTUbH1B2BK5Sxhfq9fmGarulVrqeE4k
D1b3do6ds/L5vQUdHulMUlnCGgMoQbAsGeqCtwO1y219mhAvVS+NcBBCAOL+IJWe
Ug2FwYVU6yVCfaUIWPfvj2JJyzeHz6swjZ3hltZTksD1WdJV87Sm6GpkoCzrJm1X
TYDDqpkCgYEAxewaYoHHQOGuRldgB4QEtABjea+lu574LXPnLBhI0VolfuFKDt0e
1m+vmgXJHiNmjxuk1NSsAebHm7xBUDmqRciwdJk1+MQfC3DpCew0FjRSaynN7UQQ
gpXOd8NcWUd+xayNq5K/u/AnSCktMAQA+kPdUzaOJj5vIWJSEj5gFo8=
-----END RSA PRIVATE KEY-----
1 change: 1 addition & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
41 changes: 37 additions & 4 deletions messenger/biz_server/biz/core/message/message_helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -367,24 +367,57 @@ func (m *MessageModel) GetMessageBox2(peerType, ownerId, messageId int32) (*Mess
var (
mBox *MessageBox2
)

glog.Infoln(ownerId)
glog.Infoln(messageId)
switch peerType {
case base.PEER_USER, base.PEER_CHAT:
boxDO := m.dao.MessageBoxesDAO.SelectByMessageId(ownerId, messageId)
if boxDO == nil {
return nil, fmt.Errorf("")
return nil, fmt.Errorf("2222222")
fmt.Errorf( string(ownerId), string(messageId))
glog.Infoln(ownerId, messageId)
}

dataDO := m.dao.MessageDatasDAO.SelectMessage(boxDO.DialogId, boxDO.DialogMessageId)
if dataDO == nil {
return nil, fmt.Errorf("33333333")
}

mBox = m.makeMessageBoxByDO(boxDO, dataDO)
case base.PEER_CHANNEL:
glog.Warning("blocked, License key from https://nebula.chat required to unlock enterprise features.")
default:
return nil, fmt.Errorf("11111111")
}

return mBox, nil
}

func (m *MessageModel) GetMessageBox3(peerType int32, messageId int64) (*MessageBox2, error) {
var (
mBox *MessageBox2
)

glog.Infoln(messageId)
switch peerType {
case base.PEER_USER, base.PEER_CHAT:
boxDO := m.dao.MessageBoxesDAO.SelectByMessageDataId(messageId)
if boxDO == nil {
return nil, fmt.Errorf("2222222")
fmt.Errorf(string(messageId))
glog.Infoln(messageId)
}

dataDO := m.dao.MessageDatasDAO.SelectMessage(boxDO.DialogId, boxDO.DialogMessageId)
if dataDO == nil {
return nil, fmt.Errorf("")
return nil, fmt.Errorf("33333333")
}

mBox = m.makeMessageBoxByDO(boxDO, dataDO)
case base.PEER_CHANNEL:
glog.Warning("blocked, License key from https://nebula.chat required to unlock enterprise features.")
default:
return nil, fmt.Errorf("")
return nil, fmt.Errorf("11111111")
}

return mBox, nil
Expand Down
21 changes: 21 additions & 0 deletions messenger/biz_server/biz/core/message/messsage_react.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package message

import (
"github.com/golang/glog"
"github.com/nebula-chat/chatengine/messenger/biz_server/biz/dal/dataobject"
"time"
)

func (m *MessageModel) PushReaction(messageId int64, reactId, senderUserId int32) (bool, error) {
glog.Infoln("Push reaction")
mReact := &dataobject.MessageReactDataDO{
ReactDataId: 0,
ReactId: reactId,
MessageDataID: messageId,
SenderUserId: senderUserId,
Date3: int32(time.Now().Unix()),
Deleted: 0,
}
m.dao.MessageReactDataDAO.Insert(mReact)
return true, nil
}
6 changes: 5 additions & 1 deletion messenger/biz_server/biz/core/message/model.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
package message

import (
"github.com/golang/glog"
"github.com/nebula-chat/chatengine/messenger/biz_server/biz/core"
"github.com/nebula-chat/chatengine/messenger/biz_server/biz/dal/dao"
"github.com/nebula-chat/chatengine/messenger/biz_server/biz/dal/dao/mysql_dao"
"github.com/golang/glog"
"github.com/nebula-chat/chatengine/pkg/redis_client"
)

Expand All @@ -36,6 +36,8 @@ type messagesDAO struct {
*mysql_dao.UnreadMentionsDAO
*mysql_dao.CommonDAO
*mysql_dao.UserDialogsDAO
*mysql_dao.MessageReactDAO
*mysql_dao.MessageReactDataDAO
}

type MessageModel struct {
Expand All @@ -52,6 +54,8 @@ func (m *MessageModel) InstallModel() {
// m.dao.ChannelMediaUnreadDAO = dao.GetChannelMediaUnreadDAO(dao.DB_MASTER)
// m.dao.ChannelMessagesDAO = dao.GetChannelMessagesDAO(dao.DB_MASTER)
m.dao.UsernameDAO = dao.GetUsernameDAO(dao.DB_MASTER)
m.dao.MessageReactDataDAO = dao.GetMessageReactDataDAO(dao.DB_MASTER)

m.dao.UnreadMentionsDAO = dao.GetUnreadMentionsDAO(dao.DB_MASTER)
m.dao.CommonDAO = dao.GetCommonDAO(dao.DB_MASTER)
m.dao.UserDialogsDAO = dao.GetUserDialogsDAO(dao.DB_MASTER)
Expand Down
27 changes: 22 additions & 5 deletions messenger/biz_server/biz/dal/dao/dao_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ type MysqlDAOList struct {
UserPasswordsDAO *mysql_dao.UserPasswordsDAO
WallPapersDAO *mysql_dao.WallPapersDAO
PhoneCallSessionsDAO *mysql_dao.PhoneCallSessionsDAO

StickerSetsDAO *mysql_dao.StickerSetsDAO
StickerPacksDAO *mysql_dao.StickerPacksDAO
MessageReactDAO *mysql_dao.MessageReactDAO
MessageReactDataDAO *mysql_dao.MessageReactDataDAO
StickerSetsDAO *mysql_dao.StickerSetsDAO
StickerPacksDAO *mysql_dao.StickerPacksDAO

MessageDatasDAO *mysql_dao.MessageDatasDAO

Expand Down Expand Up @@ -129,7 +130,8 @@ func InstallMysqlDAOManager(clients sync.Map /*map[string]*sqlx.DB*/) {
daoList.PhoneCallSessionsDAO = mysql_dao.NewPhoneCallSessionsDAO(v)
daoList.StickerSetsDAO = mysql_dao.NewStickerSetsDAO(v)
daoList.StickerPacksDAO = mysql_dao.NewStickerPacksDAO(v)

daoList.MessageReactDAO = mysql_dao.NewMessageReactDAO(v)
daoList.MessageReactDataDAO = mysql_dao.NewMessageReactDataDAO(v)
daoList.MessageDatasDAO = mysql_dao.NewMessageDatasDAO(v)

daoList.UnregisteredContactsDAO = mysql_dao.NewUnregisteredContactsDAO(v)
Expand Down Expand Up @@ -173,7 +175,22 @@ func GetCommonDAO(dbName string) (dao *mysql_dao.CommonDAO) {
}
return
}

func GetMessageReactDataDAO(dbName string) (dao *mysql_dao.MessageReactDataDAO) {
daoList := GetMysqlDAOList(dbName)
// err := mysqlDAOManager.daoListMap[dbName]
if daoList != nil {
dao = daoList.MessageReactDataDAO
}
return
}
func GetMessageReactDAO(dbName string) (dao *mysql_dao.MessageReactDAO) {
daoList := GetMysqlDAOList(dbName)
// err := mysqlDAOManager.daoListMap[dbName]
if daoList != nil {
dao = daoList.MessageReactDAO
}
return
}
func GetAuthKeysDAO(dbName string) (dao *mysql_dao.AuthKeysDAO) {
daoList := GetMysqlDAOList(dbName)
// err := mysqlDAOManager.daoListMap[dbName]
Expand Down
Loading

0 comments on commit 8a7f063

Please sign in to comment.