func saveMessage(channel channelType.ChannelType, playerId, playerName, message string) { if configBLL.IfRecordMessage() == false { return } messageChan <- chatMessage.NewChatMessage(timeUtil.Format(time.Now(), "yyyy-MM-dd HH:mm:ss"), channel, playerId, playerName, message) }
func init() { if configBLL.IfRecordMessage() == false { return } // 判断文件夹是否存在,如果不存在则创建 if !fileUtil.IsDirExists(messageFolderPath) { os.MkdirAll(messageFolderPath, os.ModePerm|os.ModeTemporary) } // 启动新Gorountine来处理消息 go recordMessage() }