“Charles application” analyzes the community message system through Charles

Time:2021-10-16

background

Refer to app products of the same dimension on the market,Wei Lai ideal, analyze the packet capture of its message system. Get something more suitable for ourselvesMessage system design

Ideal one

The ideal message system designer is a centralized design that centrally manages all messages,Comments, likes, notices, private messages, vehicles

Pull notification messages in the message center

The interface is captured as follows.

https://api-app.lixiang.com/mms-api/v1-0/message?status=3&pageNumber=0&appId=chj_app_m01&channelType=1&pageSize=20&category=notice

Interface design passedcategoryTo distinguish the message on which channel. Now we are requesting a message of notification type, so the category is notice.

InterfacedResponse parametersas follows

{
    "success": true,
    "code": 0,
    "msg": "SUCCESS",
    "data": {
        "pageSize": 20,
        "pageNumber": 0,
        "numberOfElements": 1,
        "totalPages": 1,
        "totalElements": 1,
        "elements": [{
            "requestId": "rC21P1A80H2DJJQIGR00",
            "messageId": "C21P1A80H2DJJQIGR0000000",
            "appId": "chj_app_m01",
            "recipient": "3250332467430584322",
            "sender": null,
            "Title": "ideal community user Convention (Trial)",
            "Summary": "Dear ideal users, in order to maintain the real and friendly atmosphere of the community, we have formulated ideal community norms.",
            "contentId": null,
            "action": "{\"accountId\":0,\"avatar\":\"\",\"comment\":\"\",\"commentId\":0,\"commentType\":1,\"createTime\":1598072448536,\"level\":1,\"messageType\":\"notice\",\"nickName\":\"\",\"productId\":754,\"surfacePlot\":\"https://p.ampmake.com/lixiangzhizao_app/pc_push_system/787334842102195.jpg\",\"type\":1}",
            "tag": ["[Ljava.lang.String;@474616fd"],
            "category": "notice",
            "status": 1,
            "encryption": null,
            "sendOn": 1598072449000,
            "receiveOn": 0,
            "createdOn": 1598072448000,
            "updatedOn": 1599009229000
        }]
    }
}

Let’s compare the return value with the interface

After comparison, the fields of interface elements are clear.actionObject to controlView detailsButton to control different behaviors according to different categories, because the current notification message is onearticle, soclickTo view the details, you can pull the information of the corresponding article in actionproductIdIs the primary key ID of the article pointed to

Click to jump toDetail page, shown above【Details page】 【Interface URL address】 【Interface details】。 You can see that the corresponding productid is 754

idealMessage classification

  • Comment

  • Like favorite

    <img />

  • Notification
  • Vehicle

Wei Lai NiO

Weilai’s message portal is a session placed in IM, which is different from the ideal design. After clicking on the message to enter, it is divided intointeractionandnotice, the packet capturing results of the interactive message list are as follows.

When capturing packets, it is found that each time the message list interface is requested, a message list is attachedhistory_readAn interface for

/api/1/message/history_read?app_id=10002&app_ver=4.4.0&device_id=2c0d36fa578c45c6819e0567399b8704&lang=zh-cn&region=cn&timestamp=1599026946&sign=4be15ff9fa6e02e2fe5b24bb06c74a03

Guess should be to control that the current user has read messages before the current time. The next time you enter the system, you won’t be prompted again.

Compare the message structure in the notification. The basic message structure is relatively clear.

The picture above is inWei LaiPublished an articlesay somethingAfter that, after getting 11 likes and 28 comments, it will be called on the main interface when logging in for the first timehistory_infoInterface, pull the message list. You can see innotificationThere is an unread message under the categorysocial_eventsThere are 28 unread messages under the category.

In the data.msg array, there is a message under each type. Combined with the interface, it can be found that this message is used to display on the outermost part of the interface.

The first picture isgive the thumbs-upThe message structure corresponding to the message. The second figure iscommentCorresponding message interface.

Basically OKWei Lai NiOThe message structure of mainly includes

  • readWhether it has been read.
  • dataContent information, blog information and like comment information.
  • descriptionMessage description, this field should be used forMessage pushThe content of the time.
  • titleThe title rendered in the app message list.
  • scenarioScene, the current scene is focus,give the thumbs-upCollection, it’s all in here. Like like, comment collection
  • categoryCategory, which should be used to distinguishInteractive notificationandSystem class notification.
  • msg_idMessage ID, because such an operation may trigger message push, you need to add a unique ID for each message.
  • link_valueYou need to jump to the corresponding address NiO: / / this form should be a way for the client.

This paper is based on the operation tool platform of blog group sending one article and multiple sendingOpenWriterelease

Recommended Today

Swift advanced (XV) extension

The extension in swift is somewhat similar to the category in OC Extension can beenumeration、structural morphology、class、agreementAdd new features□ you can add methods, calculation attributes, subscripts, (convenient) initializers, nested types, protocols, etc What extensions can’t do:□ original functions cannot be overwritten□ you cannot add storage attributes or add attribute observers to existing attributes□ cannot add parent […]