WeixinBot icon indicating copy to clipboard operation
WeixinBot copied to clipboard

[BUG] selector 为 6 时死循环

Open Zcc opened this issue 9 years ago • 9 comments

我看你代码里还是todo,想问下6是代表什么。我运行的时候经常碰到6然后死循环了。

Zcc avatar Feb 24 '16 08:02 Zcc

目前观测到的主要是红包相关的数据。

sbilly avatar Feb 24 '16 09:02 sbilly

始终没发现什么情况下会触发 selector = 6 的情况。

sbilly avatar Feb 25 '16 23:02 sbilly

我前几天碰到过几次。。我观察看看是什么。

Zcc avatar Feb 29 '16 02:02 Zcc

#30 要不要把这不明不白的东西去掉2333

reverland avatar Feb 29 '16 02:02 reverland

@sbilly , 根据 @reverland 提到的webweixin的代码看,这里只需要在selector的出里面加上默认的处理就可以了吧

elif retcode == '0':
                if selector == '2':
                    r = self.webwxsync()
                    if r is not None:
                        self.handleMsg(r)
                elif selector == '6':
                    # TODO
                    redEnvelope += 1
                    print '[*] 收到疑似红包消息 %d 次' % redEnvelope
                    logging.debug('[*] 收到疑似红包消息 %d 次' % redEnvelope)
                elif selector == '7':
                    playWeChat += 1
                    print '[*] 你在手机上玩微信被我发现了 %d 次' % playWeChat
                    logging.debug('[*] 你在手机上玩微信被我发现了 %d 次' % playWeChat)
                    r = self.webwxsync()
                elif selector == '0':
                    time.sleep(1)
                else: 
                     r = self.webwxsync()
                    if r is not None:
                        self.handleMsg(r)

如果不需要特别的去处理其他selector,都可以考虑把他们都去掉应该reject的情况只处理:

            if retcode == '1100':
                print '[*] 你在手机上登出了微信,债见'
                logging.debug('[*] 你在手机上登出了微信,债见')
                break
            if retcode == '1101':
                print '[*] 你在其他地方登录了 WEB 版微信,债见'
                logging.debug('[*] 你在其他地方登录了 WEB 版微信,债见')
                break
            if retcode == '1102':
                print '[*] 你在手机上主动退出了,债见'
                logging.debug('[*] 你在手机上主动退出了,债见')
                break
            elif retcode == '0':
                if selector != '0':
                    r = self.webwxsync()
                    if r is not None:
                        self.handleMsg(r)
                else:
                    time.sleep(1)
            if (time.time() - self.lastCheckTs) <= 20:
                time.sleep(time.time() - self.lastCheckTs)

上面也加了1102的处理

JasLin avatar May 24 '16 06:05 JasLin

请问下为啥需要做sleep呢?在微信网页版里没有看到sleep相关的js调用

dereky7 avatar Jun 07 '16 13:06 dereky7

这个问题有解决吗?selector 为 6 时死循环

worldligang avatar Aug 07 '16 05:08 worldligang

解决了吗,我手机给文件助手发消息也出现了

af913337456 avatar Jul 31 '17 15:07 af913337456

@sbilly

af913337456 avatar Jul 31 '17 15:07 af913337456