php中的优惠券生成和兑换示例 [英] example of discount coupon generation and redemption in php

查看:599
本文介绍了php中的优惠券生成和兑换示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以在互联网上给我一个例子,说明如何在购买网站上实施折扣优惠券生成和兑换系统.基于php的编程.

can someone please give me an example on the internet of how the system of discount coupon generation and redemption is implemented for a website where a purchase is made. Programming based on php.

任何帮助表示赞赏.

致谢

SK

推荐答案

通常,折扣优惠券与用户名相关联.这意味着用户可以使用发行给他的优惠券.息票通常是适当长度的随机字母数字字符串.您可以具有以下形式的表:

Usually the discount coupons are associated with usename. That means a user can make use of coupons issued to him. The coupons are usually random alphanumeric string of suitable length. You can have a table of the form:

coupon#  user-id  expire-date  used  discount
---------------------------------------------
1jjkas2  abc123   01-05-20`0   false  0.05

  • coupon#-随机生成的优惠券 号码:varchar
  • user-id-此用户的用户名 优惠券已发出:varchar
  • expire-date-此优惠券何时提供 过期:日期/时间戳
  • used-已使用此优惠券: 布尔值
  • discount-折扣%:十进制
    • coupon# - Randomly generated coupon number : varchar
    • user-id - Username to whom this coupon has been issued : varchar
    • expire-date - when does this coupon expire :date/timestamp
    • used - has this coupon been used : boolean
    • discount - discount % : decimal
    • 为所有或部分用户生成优惠券,然后填充上表.

      Generate a coupon for all or some of your users and populate the above table.

      接下来,向您的用户发送一封电子邮件,其中包含优惠券编号和到期日期.

      Next send an email to your users which contains the coupon# and expire-date.

      为用户准备在结帐时输入优惠券号.当时检查优惠券是否可以使用(检查到期日期,使用字段).如果有效,则将折扣应用于最终金额.

      Make provision for user to enter the coupon# when the user is about to check out. At that time check if the coupon can be used( check expire date,used field). If its valid, apply the discount to the final amount.

      这篇关于php中的优惠券生成和兑换示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆