Sfoglia il codice sorgente

新增修改玩家信息

huangyuhao 1 anno fa
parent
commit
e33e041034
2 ha cambiato i file con 75 aggiunte e 9 eliminazioni
  1. 45 0
      dev/modules/user.lua
  2. 30 9
      nodes/game/interface/user.lua

+ 45 - 0
dev/modules/user.lua

@@ -108,4 +108,49 @@ function root:itf_update_steam_link(role, msg)
108 108
     return code.OK
109 109
 end
110 110
 
111
+-- 更新头像
112
+function root:itf_update_icon(role, msg)
113
+    local icon = msg.icon
114
+    if is_empty(icon) then
115
+        return code.PARAMTER_ERROR
116
+    end
117
+    self:redis_update_key_info("headUrl", icon)
118
+    return code.OK
119
+end
120
+
121
+-- 更新昵称
122
+function root:itf_update_nickname(role, msg)
123
+    local nickname = msg.nickname
124
+    if is_empty(nickname) then
125
+        return code.PARAMTER_ERROR
126
+    end
127
+    self:redis_update_key_info("nickname", nickname)
128
+    return code.OK
129
+end
130
+
131
+-- 更新密码
132
+function root:itf_update_password(role, msg)
133
+    local oldPassword = msg.oldPassword
134
+    local newPassword = msg.newPassword
135
+    if is_empty(oldPassword) or is_empty(newPassword) then
136
+        return code.PARAMTER_ERROR
137
+    end
138
+    local password = self:redis_get_key_info("password")
139
+    if oldPassword ~= password then
140
+        return code.USR.PASSWORD_NOT_MATCH
141
+    end
142
+    self:redis_update_key_info("password", newPassword)
143
+    return code.OK
144
+end
145
+
146
+-- 注销
147
+function root:itf_cancel_account(role, msg)
148
+    return code.OK
149
+end
150
+
151
+-- 实名认证 - 更新信息
152
+function root:itf_identity(role, msg)
153
+    return code.OK
154
+end
155
+
111 156
 return root

+ 30 - 9
nodes/game/interface/user.lua

@@ -1,18 +1,14 @@
1 1
 --[[
2
-Descripttion:接口 - 玩家
2
+Descripttion:玩家
3 3
 version:
4 4
 Author: Neo,Huang
5
-Date: 2022-07-05 17:32:01
5
+Date: 2023-11-15 22:34:35
6 6
 LastEditors: Neo,Huang
7
-LastEditTime: 2022-07-05 20:29:29
7
+LastEditTime: 2023-11-15 23:19:26
8 8
 --]]
9 9
 local code = require "code"
10 10
 local timeUtil = require("utils.timeUtil")
11 11
 local util_user = require("utils.util_user")
12
-local util_global = require("utils.util_global")
13
-
14
-local playerData = require("data.player")
15
-local userData = require("data.user")
16 12
 
17 13
 local root = {}
18 14
 
@@ -26,8 +22,8 @@ function root:user_self_info(role, msg)
26 22
 end
27 23
 -- 登录完成后
28 24
 function root:after_user_self_info(role, msg)
29
-    local msg = {}
30
-    util_user:user_proto_notify(role.uid, "on_user_system_info", msg)
25
+    local pack = {}
26
+    util_user:user_proto_notify(role.uid, "on_user_system_info", pack)
31 27
 end
32 28
 
33 29
 -- 获取验证码
@@ -50,4 +46,29 @@ function root:user_update_steam_link(role, msg)
50 46
     return role.user:itf_update_steam_link(role, msg)
51 47
 end
52 48
 
49
+-- 更新头像
50
+function root:user_update_icon(role, msg)
51
+    return role.user:itf_update_icon(role, msg)
52
+end
53
+
54
+-- 更新昵称
55
+function root:user_update_nickname(role, msg)
56
+    return role.user:itf_update_nickname(role, msg)
57
+end
58
+
59
+-- 更新密码
60
+function root:user_update_password(role, msg)
61
+    return role.user:itf_update_password(role, msg)
62
+end
63
+
64
+-- 注销
65
+function root:user_cancel_account(role, msg)
66
+    return role.user:itf_cancel_account(role, msg)
67
+end
68
+
69
+-- 实名认证 - 更新信息
70
+function root:user_identity_update_info(role, msg)
71
+    return role.user:itf_identity(role, msg)
72
+end
73
+
53 74
 return root