Home Backend Development PHP Tutorial 电子商务网站优惠券有关问题

电子商务网站优惠券有关问题

Jun 13, 2016 am 10:16 AM
price start time

电子商务网站优惠券问题
现在有个网站会员有个优惠券功能
注册送优惠券(有效期一年)
够买东西返还优惠券(有效期不限)
节假日送优惠券(具体时间金额啥的后台人员定义)

我的做法是这样的

member 表名
userid 会员ID字段
yhq 是优惠券字段(存放优惠券金额总和)

把优惠券曾送时间,到期时间,说明单独放到一个表里,
表名是yhq
id 优惠券ID字段
userid 会员ID字段
title 优惠券标题
start_time 曾送时间
end_time 到期时间
price 金额

但是现在有个问题就是到期问题
假如现在有个会员今天注册了,送个20元优惠券,明天买东西花掉10元,还剩10元
过几天会员没有事发发帖子又赚了20元优惠券

一年后按要求应该要扣掉10元的,但是程序不知道啊。

求高手帮忙解决一下

或者你们做优惠券有没有碰到这样的问题。是怎么解决的谢谢。

------解决方案--------------------
那你到底是原来的1年后过期呢还是后来赠送的都一起过期?还是原来的10元过期,后来的也需要累计到一年的时间后过期?

如果是后面的 我觉得你就应该要分开来设计表 将优惠卷单独用个表来记录 就简单解决了
------解决方案--------------------
好像没有问题啊,另外从应用上来讲,每张优惠劵不能拆开使用的吧,只能一次性使用的好像
------解决方案--------------------
一张优惠券应该只能使用一次做限制。

比如你去商场购物 有100优惠券,应该不存在用了50 还剩下50的情况。

------解决方案--------------------
1. 优惠券不应该有总和的概念,专门做个表存用户的所有优惠券吧。
2. 优惠券都是一次性消费的
3. 然后。。。就没有然后了

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Fujifilm X-M5 price expectations rise as leaked selfie display adds complexity to the formerly affordable camera line Sep 07, 2024 am 09:34 AM

Fujifilm fans were recently very excited at the prospect of the X-T50, since it presented a relaunch of the budget-oriented Fujifilm X-T30 II that had become quite popular in the sub-$1,000 APS-C category. Unfortunately, as the Fujifilm X-T50's launc

FiiO CP13 cassette player launches with transparent retro look FiiO CP13 cassette player launches with transparent retro look Jun 16, 2024 am 09:52 AM

TheFiiOCP13cassetteplayerwasannouncedinJanuary.Now,FiiOisexpandingitsportfoliowithtwonewmodels-onewitharedfrontandonewithatransparentfront.Thelatternotonlyperfectlymatchestheretrocharmoftheangulardesign,butalso

What should I do if docker start cannot start? What should I do if docker start cannot start? Oct 21, 2022 pm 03:43 PM

Solution to docker start failure: 1. Check the running status, and then release the occupied memory through the "echo 3 > /proc/sys/vm/drop_caches" command; 2. Use "$netstat -nltp|grep .. ." command to check whether the port has been occupied. If it is found to be occupied after going online, change it to an available port and restart.

Klipsch unveils Flexus Core 300 flagship soundbar with 8K support, 12 speakers and room correction Klipsch unveils Flexus Core 300 flagship soundbar with 8K support, 12 speakers and room correction Sep 05, 2024 am 10:16 AM

The Klipsch Flexus Core 300 is the top model in the series and is positioned above the already available Flexus Core 200 in the company's soundbar line-up. According to Klipsch, this is the first soundbar in the world whose sound can be adapted to th

Monotonic clock processing of time package Monotonic clock processing of time package Aug 04, 2023 pm 05:45 PM

Today we are mainly going to take a look at the time application method of golang time package. The general rule between the two is that "wall time" is used to tell time, and "monotonic clock" is used to measure time; there are other clock processing methods.

Light Phone 3 launches with 50% discount, monochrome OLED and minimalist design Light Phone 3 launches with 50% discount, monochrome OLED and minimalist design Jun 13, 2024 pm 10:18 PM

WhiletheLightPhone2from2018wasstillequippedwithaneconomicale-inkdisplay,theLightPhone3usesanOLEDdisplaythatcanonlydisplaygrayscale.Thereasonfortheswitchtothe3.92-inchOLEDpanelwithitsresolutionof1,240x1,080isth

Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000 Deal | Tesla Model 3 Long Range AWD regains full $7,500 tax incentive, drops to below $40,000 Jun 19, 2024 am 09:55 AM

Shortly after Tesla launched the Model 3 Highland refresh towards the end of last year, the US federal EV tax incentive rules changed, cutting the potential discount in half for eligible buyers because of Tesla's use of Chinese LFP cells in the new M

Tipster claims Snapdragon 8 Gen 4 costs nearly 21% more than its predecessor Tipster claims Snapdragon 8 Gen 4 costs nearly 21% more than its predecessor Sep 09, 2024 am 06:35 AM

There have been multiple reports about Qualcomm increasing the price of Snapdragon 8 Gen 4 compared to its current-gen flagship SoC. Digital Chat Station, a notable leakster, reported about it back in May, which was later reinforced with a separate r

See all articles