Skip to content

Commit eef9f95

Browse files
committed
feat: format code
1 parent 4b751b4 commit eef9f95

File tree

8 files changed

+24
-29
lines changed

8 files changed

+24
-29
lines changed

api/v1/group_router.go

+2-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88

99
"github.com/gin-gonic/gin"
1010
)
11+
1112
// 获取分组列表
1213
func GetGroup(c *gin.Context) {
1314
uuid := c.Param("uuid")
@@ -47,4 +48,4 @@ func GetGroupUsers(c *gin.Context) {
4748
groupUuid := c.Param("uuid")
4849
users := service.GroupService.GetUserIdByGroupUuid(groupUuid)
4950
c.JSON(http.StatusOK, response.SuccessMsg(users))
50-
}
51+
}

api/v1/user_router.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ func ModifyUserInfo(c *gin.Context) {
5050
c.JSON(http.StatusOK, response.SuccessMsg(nil))
5151
}
5252

53-
5453
func GetUserDetails(c *gin.Context) {
5554
uuid := c.Param("uuid")
5655

@@ -73,4 +72,4 @@ func AddFriend(c *gin.Context) {
7372
}
7473

7574
c.JSON(http.StatusOK, response.SuccessMsg(nil))
76-
}
75+
}

cmd/main.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package main
22

33
import (
4-
"chat-room/global/log"
54
"chat-room/config"
5+
"chat-room/global/log"
66
"chat-room/router"
77
"chat-room/server"
88
"go.uber.org/zap"

common/constant/constant.go

+8-8
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,16 @@ package constant
22

33
const (
44
HEAT_BEAT = "heatbeat"
5-
PONG = "pong"
5+
PONG = "pong"
66

7-
MESSAGE_TYPE_USER = 1
7+
MESSAGE_TYPE_USER = 1
88
MESSAGE_TYPE_GROUP = 2
99

10-
TEXT = 1
11-
FILE = 2
12-
IMAGE = 3
13-
AUDIO = 4
14-
VIDEO = 5
10+
TEXT = 1
11+
FILE = 2
12+
IMAGE = 3
13+
AUDIO = 4
14+
VIDEO = 5
1515
AUDIO_ONLINE = 6
1616
VIDEO_ONLINE = 7
17-
)
17+
)

common/util/file-suffix.go

+9-10
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,12 @@ func init() {
3434
fileTypeMap.Store("5374616E64617264204A", "mdb") //MS Access (mdb)
3535
fileTypeMap.Store("252150532D41646F6265", "ps")
3636

37-
fileTypeMap.Store("255044462d312e350d0a", "pdf") //Adobe Acrobat (pdf)
38-
fileTypeMap.Store("D0CF11E0", "xls") //xls
39-
fileTypeMap.Store("504B030414000600080000002100", "xlsx") //xls
40-
fileTypeMap.Store("d0cf11e0a1b11ae10000", "doc") //MS Excel 注意:word、msi 和 excel的文件头一样
41-
fileTypeMap.Store("504b0304140006000800", "docx") //docx文件
42-
fileTypeMap.Store("d0cf11e0a1b11ae10000", "wps") //WPS文字wps、表格et、演示dps都是一样的
37+
fileTypeMap.Store("255044462d312e350d0a", "pdf") //Adobe Acrobat (pdf)
38+
fileTypeMap.Store("D0CF11E0", "xls") //xls
39+
fileTypeMap.Store("504B030414000600080000002100", "xlsx") //xls
40+
fileTypeMap.Store("d0cf11e0a1b11ae10000", "doc") //MS Excel 注意:word、msi 和 excel的文件头一样
41+
fileTypeMap.Store("504b0304140006000800", "docx") //docx文件
42+
fileTypeMap.Store("d0cf11e0a1b11ae10000", "wps") //WPS文字wps、表格et、演示dps都是一样的
4343

4444
fileTypeMap.Store("2e524d46000000120001", "rmvb") //rmvb/rm相同
4545
fileTypeMap.Store("464c5601050000000900", "flv") //flv与f4v相同
@@ -49,12 +49,11 @@ func init() {
4949
fileTypeMap.Store("3026b2758e66cf11a6d9", "wmv") //wmv与asf相同
5050
fileTypeMap.Store("52494646e27807005741", "wav") //Wave (wav)
5151
fileTypeMap.Store("52494646246009005741", "wav") //Wave (wav)
52-
fileTypeMap.Store("52494646", "wav") //Wave (wav)
53-
54-
52+
fileTypeMap.Store("52494646", "wav") //Wave (wav)
53+
5554
fileTypeMap.Store("52494646d07d60074156", "avi")
5655
fileTypeMap.Store("1a45dfa3a34286810142", "webm")
57-
56+
5857
fileTypeMap.Store("4d546864000000060001", "mid") //MIDI (mid)
5958
fileTypeMap.Store("504b0304140000000800", "zip")
6059
fileTypeMap.Store("526172211a0700cf9073", "rar")

server/client.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ func (c *Client) Read() {
3333

3434
msg := &protocol.Message{}
3535
proto.Unmarshal(message, msg)
36-
36+
3737
// pong
3838
if msg.Type == constant.HEAT_BEAT {
3939
pong := &protocol.Message{
4040
Content: constant.PONG,
4141
Type: constant.HEAT_BEAT,
4242
}
43-
pongByte, err2 :=proto.Marshal(pong)
43+
pongByte, err2 := proto.Marshal(pong)
4444
if nil != err2 {
4545
log.Error("client marshal message error", log.Any("client marshal message error", err2.Error()))
4646
}

server/server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ func (s *Server) Start() {
8484
client.Send <- message
8585
}
8686
}
87-
87+
8888
} else {
8989
// 无对应接受人员进行广播
9090
for id, conn := range s.Clients {

test/proto_test.go

-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1 @@
11
package test
2-
3-
import (
4-
)
5-

0 commit comments

Comments
 (0)