PHP message reminder data table

Source: Internet
Author: User
Tags how to design database
How can I design the intra-site message prompting function, such as segmentfault? I am releasing a question. After someone answers the question, I will receive a reminder about the number of unread messages. How can I design a data table appropriately? How can I design the intra-site message prompting function, such as segmentfault? I am releasing a question. After someone answers the question, I will receive a reminder about the number of unread messages. How can I design a data table appropriately?

Reply content:

How can I design the intra-site message prompting function, such as segmentfault? I am releasing a question. After someone answers the question, I will receive a reminder about the number of unread messages. How can I design a data table appropriately?

Notice_code is defined in the Code, and a notification information template is also defined.

Public static $ notice_type = ['ancer' => ['is _ agreed '=> [500,' [who] liked your answer! '], 'Is _ modified' => [501,' [who] modified your answer! '], 'Is _ fold' => [502,' [who] fold your answer! '], 'Has _ new_comment' => [503, '[who] commented on your answer! '],],];

In the comparison, 503 indicates a comment notification. When someone comments an answer, the required parameter is: who

In the notification list, first determine the notification code, find the corresponding template, and convert the variable [who] based on the corresponding parameters.

We have a preliminary plan just now. Please try it out:
There are two main tables:
Question: Table of problem information
Id (autoincrement) user_id (User ID for posting the question) question_id (problem id (unique in the system) question_desc (Problem description) like_user_list (like user list, user_id uses ',)
Reply:
Id (autoincrement) user_id (User id for answering questions) question_id (with question_id as a foreign key in question) reply_content (comment content) like_user_list (like user list, user_id used ', 'split) unlike_user_list (ID list of the target user)
The procedure is as follows:
1. Insert a record to question when you publish a question;
2. When others comment on this issue, insert a record to reply
3. If someone else thinks this is a good question, like this question or reply and append the corresponding like_user_list
Areas to be further improved:
(1) Record of comments reply

I will not talk about how to design database tables. What I want to talk about is that the reminder class is not suitable for storing tables. Generally, it is impossible for me to cache data. Every time I refresh it, I go to the table and count it again. This data goes directly to the cache. more efficient

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.