Skip to content

How to detect Web Weixin status when trying to remark a contact #113

@lijiarui

Description

@lijiarui

Run npm run doctor or wechaty run doctor(for docker user), paste output here

> wechaty@0.6.35 doctor /Users/lijiarui/Documents/git/wechaty
> ts-node bin/doctor


#### Wechaty Doctor

1. Wechaty version: #git[2834b0a 0.6.35]
2. Darwin x64 version 14.5.0 memory 6683/16384 MB
3. Docker: false
4. Node version: v7.0.0

Expected behavior

When trying to modify a contact's remark, sometimes it failed and sometimes it succeed.
I found it depends on web Wei Xin:

If failed,web Wei Xin reply two wxoplog with "Ret": 1205.
If success, web Wei Xin reply a webwxsync XHR and two webwxoplog XHR with "Ret": 0.

But now wechaty cannot detect the 2 different statuses, so could wechaty return a web Weixin status when trying to remark a contact, it will really help!

PS: the background as follows:
I'm using bot to modify all my contact's remark (2600 contacts), each operation interval of 15 seconds, after I modified 20 contacts, although log shows bot works well, but it failed to modify contact's remark.

Then I tried to modify my contact's remark manually on web Weixin, and I found an interesting situation:
I can modify the remark on web Weixin, it seems modified successfully, but the remark on my cell phone doesn't change, and when I log out web Weixin and log in again, I found the remark isn't modified.

So I guess maybe weixin block the API to remark the contact.

Steps to reproduce the behavior (and fixes, if any)

1.When fail...

When it failed to modify a contact's remark, client gets two same XHR as follows:

name:
wxoplog

Reponse:

{
    "BaseResponse": {
        "Ret": 1205, 
        "ErrMsg": ""
    }
}

2.When success...

When modify a contact's remark successfully, client get 3 XHR (2 of them are same) as follows:

First XHR

name:
webwxoplog?pass_ticket=Vz4luhOatJin0JGE1XS5k2GFUTY%252Fu%252F%252BsBCwyynIHXD1AvW2X2PvazgBTPV3jSIF1

Response :

{
    "BaseResponse": {
        "Ret": 1205, 
        "ErrMsg": ""
    }
}
Second XHR:

name:
webwxsync?sid=DCtzuSvdOMDv5Izt&skey=@crypt_ec621fb6_23b21f1e43a919944cb9fb974aa4992f&pass_ticket=Vz4luhOatJin0JGE1XS5k2GFUTY%252Fu%252F%252BsBCwyynIHXD1AvW2X2PvazgBTPV3jSIF1

Response :

{
    "BaseResponse": {
        "Ret": 0, 
        "ErrMsg": ""
    }, 
    "AddMsgCount": 0, 
    "AddMsgList": [ ], 
    "ModContactCount": 1, 
    "ModContactList": [
        {
            "UserName": "@75527d77fa288dbc6d4823250153d89f", 
            "NickName": "�佳芮", 
            "Sex": 2, 
            "HeadImgUpdateFlag": 1, 
            "ContactType": 0, 
            "Alias": "ruirui_0914", 
            "ChatRoomOwner": "", 
            "HeadImgUrl": "/cgi-bin/mmwebwx-bin/webwxgeticon?seq=631539765&username=@75527d77fa288dbc6d4823250153d89f&skey=@crypt_ec621fb6_23b21f1e43a919944cb9fb974aa4992f", 
            "ContactFlag": 1, 
            "MemberCount": 0, 
            "MemberList": [ ], 
            "HideInputBarFlag": 0, 
            "Signature": "回山洞里", 
            "VerifyFlag": 0, 
            "RemarkName": "", 
            "Statues": 0, 
            "AttrStatus": 2147584103, 
            "Province": "北京", 
            "City": "æµ·æ·€", 
            "SnsFlag": 1, 
            "KeyWord": "qq5"
        }
    ], 
    "DelContactCount": 0, 
    "DelContactList": [ ], 
    "ModChatRoomMemberCount": 0, 
    "ModChatRoomMemberList": [ ], 
    "Profile": {
        "BitFlag": 0, 
        "UserName": {
            "Buff": ""
        }, 
        "NickName": {
            "Buff": ""
        }, 
        "BindUin": 0, 
        "BindEmail": {
            "Buff": ""
        }, 
        "BindMobile": {
            "Buff": ""
        }, 
        "Status": 0, 
        "Sex": 0, 
        "PersonalCard": 0, 
        "Alias": "", 
        "HeadImgUpdateFlag": 0, 
        "HeadImgUrl": "", 
        "Signature": ""
    }, 
    "ContinueFlag": 0, 
    "SyncKey": {
        "Count": 9, 
        "List": [
            {
                "Key": 1, 
                "Val": 631544760
            }, 
            {
                "Key": 2, 
                "Val": 631546796
            }, 
            {
                "Key": 3, 
                "Val": 631546798
            }, 
            {
                "Key": 11, 
                "Val": 631546595
            }, 
            {
                "Key": 13, 
                "Val": 631532646
            }, 
            {
                "Key": 201, 
                "Val": 1480675292
            }, 
            {
                "Key": 1000, 
                "Val": 1480674062
            }, 
            {
                "Key": 1001, 
                "Val": 1480674092
            }, 
            {
                "Key": 1003, 
                "Val": 1480402493
            }
        ]
    }, 
    "SKey": "", 
    "SyncCheckKey": {
        "Count": 9, 
        "List": [
            {
                "Key": 1, 
                "Val": 631544760
            }, 
            {
                "Key": 2, 
                "Val": 631546796
            }, 
            {
                "Key": 3, 
                "Val": 631546798
            }, 
            {
                "Key": 11, 
                "Val": 631546595
            }, 
            {
                "Key": 13, 
                "Val": 631532646
            }, 
            {
                "Key": 201, 
                "Val": 1480675292
            }, 
            {
                "Key": 1000, 
                "Val": 1480674062
            }, 
            {
                "Key": 1001, 
                "Val": 1480674092
            }, 
            {
                "Key": 1003, 
                "Val": 1480402493
            }
        ]
    }
}
```

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions