Analysis of Program Design Principles of intra-group messaging

Source: Internet
Author: User
Analysis of Program Design Principles of intra-group messaging

  1. Php_user_info
  2. --------------------
  3. Uid username password
  4. User id, user name, and password
  5. --------------------

2. the table that saves the information sent to the user. For example:

  1. Php_user_message
  2. -------------------------------------------
  3. Id uid mid ifShow ifRead
  4. Whether the message id (and) of the auto-increment user shows whether the user has read the message

3. table for saving messages. For example:

  1. Php_message
  2. ----------------
  3. Mid title content
  4. Message id header content

When you want to send a message to a User: 1. retrieve all UIDs from php_user_info (assuming they are saved in the array $ array_uid), and then set the id of the message you want to send to the user to php_message to mid. Then, the insert operation is executed cyclically (insert uid and mid together into php_user_message. the default values of id, ifShow, and IfRead are null, 0, and 0, respectively ).

Notify users: the page calls ajax at regular intervals to check whether there is any data with ifShow 0 in the php_user_message of the user with the uid. if the value is 0, the page prompts the user to receive the message, and change to 1.

Enter Message Center: Check whether ifRead is 1. if not, it is displayed as Unread. when you click a message, change ifRead to 1.

The above introduces the design principle of implementing the message sending in the background administrator group, hoping to help you with some guidance and help in writing similar php programs.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.