@@ -69,7 +69,7 @@ func CreateBot(c *gin.Context) {
6969 return
7070 }
7171 go func () {
72- CreateBotImpl (req .BotId , req .Password , req .DeviceSeed )
72+ CreateBotImpl (req .BotId , req .Password , req .DeviceSeed , req . ClientProtocol )
7373 }()
7474 resp := & dto.CreateBotResp {}
7575 Return (c , resp )
@@ -105,7 +105,7 @@ func ListBot(c *gin.Context) {
105105 bot .Clients .Range (func (_ int64 , cli * client.QQClient ) bool {
106106 resp .BotList = append (resp .BotList , & dto.Bot {
107107 BotId : cli .Uin ,
108- IsOnline : cli .Online ,
108+ IsOnline : cli .Online . Load () ,
109109 Captcha : func () * dto.Bot_Captcha {
110110 if waitingCaptcha , ok := bot .WaitingCaptchas .Load (cli .Uin ); ok {
111111 return waitingCaptcha .Captcha
@@ -152,7 +152,7 @@ func FetchQrCode(c *gin.Context) {
152152 qrCodeBot .Release ()
153153 }
154154 qrCodeBot = client .NewClientEmpty ()
155- deviceInfo := device .GetDevice (req .DeviceSeed )
155+ deviceInfo := device .GetDevice (req .DeviceSeed , req . ClientProtocol )
156156 qrCodeBot .UseDevice (deviceInfo )
157157
158158 log .Infof ("初始化日志" )
@@ -185,7 +185,7 @@ func QueryQRCodeStatus(c *gin.Context) {
185185 return
186186 }
187187
188- if qrCodeBot .Online {
188+ if qrCodeBot .Online . Load () {
189189 c .String (http .StatusBadRequest , "already online" )
190190 return
191191 }
@@ -247,15 +247,15 @@ func Return(c *gin.Context, resp proto.Message) {
247247 c .Data (http .StatusOK , c .ContentType (), data )
248248}
249249
250- func CreateBotImpl (uin int64 , password string , deviceRandSeed int64 ) {
251- CreateBotImplMd5 (uin , md5 .Sum ([]byte (password )), deviceRandSeed )
250+ func CreateBotImpl (uin int64 , password string , deviceRandSeed int64 , clientProtocol int32 ) {
251+ CreateBotImplMd5 (uin , md5 .Sum ([]byte (password )), deviceRandSeed , clientProtocol )
252252}
253253
254- func CreateBotImplMd5 (uin int64 , passwordMd5 [16 ]byte , deviceRandSeed int64 ) {
254+ func CreateBotImplMd5 (uin int64 , passwordMd5 [16 ]byte , deviceRandSeed int64 , clientProtocol int32 ) {
255255 log .Infof ("开始初始化设备信息" )
256- deviceInfo := device .GetDevice (uin )
256+ deviceInfo := device .GetDevice (uin , clientProtocol )
257257 if deviceRandSeed != 0 {
258- deviceInfo = device .GetDevice (deviceRandSeed )
258+ deviceInfo = device .GetDevice (deviceRandSeed , clientProtocol )
259259 }
260260 log .Infof ("设备信息 %+v" , string (deviceInfo .ToJson ()))
261261
@@ -286,7 +286,7 @@ func CreateBotImplMd5(uin int64, passwordMd5 [16]byte, deviceRandSeed int64) {
286286func AfterLogin (cli * client.QQClient ) {
287287 for {
288288 time .Sleep (5 * time .Second )
289- if cli .Online {
289+ if cli .Online . Load () {
290290 break
291291 }
292292 log .Warnf ("机器人不在线,可能在等待输入验证码,或出错了。如果出错请重启。" )
0 commit comments