How to implement a function similar to gift reminder?
To make a similar function:
For example, set a date on the 20th of every month, and remind the user to give gifts a few days before this date.
The date can be set to the day of the month, the day of the month, etc. Can the reminder time be a reminder for the current day, a reminder for the previous week, etc.?
How to design the backend database with this kind of function? How many tables are needed? Now that the message push function is available, how to detect when it will be pushed? Write a scheduled task in the background to run continuously?
Reply content:
To make a similar function:
For example, set a date on the 20th of every month, and remind the user to give gifts a few days before this date.
The date can be set to the day of the month, the day of the month, etc. Can the reminder time be a reminder for the current day, a reminder for the previous week, etc.?
How to design the backend database for this kind of function? How many tables are needed? Now that the message push function is available, how to detect when it will be pushed? Write a scheduled task in the background to run continuously?
Two scheduled tasks, three tables
1. Gift table, which contains fields for when to send and whether to send. 2. Message table, whether to send, what is sent, and to whom
3. Message person table, each Extract personal messages
Task one, scan the task table, if it has not been sent and the time is up, insert a piece of data into the message table
Task two, scan the message table, if there is a message, send it according to the system,,,,, he is a A public watch is not necessarily used for giving out gifts
It is necessary to judge the application environment, during web access, and when users access it.
Several tables are needed to see your specific business needs. One information table with uncomplicated business needs is enough. If you set up timing, you definitely need to set up a script. Or you can use a third party to push Jiguang Push
Data Dictionary
1 The user information table uses the field is_accept to store whether the user has enabled message prompts
id primary key
task_obj extended field
title title
content content
on_time end time
status whether the platform enables message prompts
days reminder a few days in advance (this field can also be set for the user, user information exists Table, let the user decide when to prompt him)
tips how many times to push
interval_time push interval (how often does the same user push)
3 message push log table
id primary key id
uid user id
tid message configuration id
on_time send Push time
//Get all users whose user table is_accept is 1 loop
<code> foreach{ //获取推送配置信息表 //判断用户是否已推送, //判断 当前时间-用户上次推送时间>=配置间隔时间 //判断是否已达到最大推送次数 //写入推送记录表 }</code>
If it is a Linux system, it is recommended to use the system command curl
For a Windows system, it is recommended to write the process daemon yourself, or use urlcron

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

Validator can be created by adding the following two lines in the controller.
