+控制发送消息后是否反馈结果

This commit is contained in:
2018-12-15 23:51:07 +08:00
parent 7b06ef8dea
commit 98bed05764
4 changed files with 5128 additions and 168 deletions
+66
View File
@@ -0,0 +1,66 @@
##set starUML design file to binary
*.mdj binary
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
+5055 -161
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -222,7 +222,7 @@ func (session *Session) MessageHandler(headInfo map[string]string, msg []byte) {
result["Error"] = "The message doesn't has a valid receiver."
} //消息接收者不存在
}
if _, ok := headInfo["NeedResult"]; ok {
if needResult, ok := headInfo["NeedResult"]; ok && needResult != "0" {
session.SendData(result, nil)
} //返回执行结果
}
+4 -4
View File
@@ -8,7 +8,7 @@ import (
//用户信息
type UserInfo struct {
User string //用户名
Nickname string //昵称
NickName string //昵称
Motto string //签名
UGroup string //用户组。ugroup_*常量值
}
@@ -16,7 +16,7 @@ type UserInfo struct {
//根据用户名查询一个用户。如果用户不存在则返回nil
func QueryUserInfo(userName string) *UserInfo {
user := new(UserInfo)
err := server.db.QueryRow(str_sql_query_user, userName).Scan(&user.User, &user.Nickname, &user.Motto, &user.UGroup)
err := server.db.QueryRow(str_sql_query_user, userName).Scan(&user.User, &user.NickName, &user.Motto, &user.UGroup)
if err != nil {
return nil
} else {
@@ -41,7 +41,7 @@ func GetUserPhoto(userName string) []byte {
//登录,成功返回用户信息,失败返回nil
func Login(userName string, pwd string) *UserInfo {
user := new(UserInfo)
err := server.db.QueryRow(str_sql_login, userName, pwd).Scan(&user.User, &user.Nickname, &user.Motto, &user.UGroup)
err := server.db.QueryRow(str_sql_login, userName, pwd).Scan(&user.User, &user.NickName, &user.Motto, &user.UGroup)
if err != nil {
if err.Error() == "sql: no rows in result set" {
Debug(err.Error())
@@ -65,7 +65,7 @@ func GetUserList() []UserInfo {
}
for rows.Next() {
user := new(UserInfo)
scanErr := rows.Scan(&user.User, &user.Nickname, &user.Motto, &user.UGroup)
scanErr := rows.Scan(&user.User, &user.NickName, &user.Motto, &user.UGroup)
if scanErr != nil {
WriteLog("Database Error - Scan Error: " + scanErr.Error())
return nil