lalalagq

为什么

为什么要开发积分商城呢?

因为我们之前使用的是兑吧的服务,还不错

但是得知今年(2018)下半年关闭免费版的服务,需要付费购买专业版或旗舰版使用

当然兑吧的工作人员也联系过我们,可以给予优惠价格,商业互吹肯定要说“好的,我们会讨论考虑一下”

如果我们用了兑吧,那你也不会看到这个文章了23333

开始

我整体的浏览了他们的商品管理,减去了一些与我们业务无关的功能

主要功能为兑换方式了,他们采用的是纯积分,积分+人民币的策略,我也就加了一个人民币支付方式(也不麻烦),包邮与运费功能均减去(因为我们就是包邮的)

差不多需要开发的主要功能项就是分类管理商品管理支付

这里的支付我相信大家去学习一下支付宝和微信的文档,应该都会的。

设计

开始我们的表结构设计了

分类表应该是最轻松的,一般结构是自增id,名称,图片(有图片的分类),显示顺序,状态这些。

表应该就是下面这样子了

``` create table if not exists `score_shop_classify` ( `id` int(11) unsigned AUTO_INCREMENT, `name` varchar(191) not null DEFAULT \'\' comment \'菜单名称\', `img` text comment \'菜单图片\', `show_order` int(11) not null DEFAULT 0 comment \'显示顺序0最大\', PRIMARY KEY (`id`) ) engine=InnoDB DEFAULT CHARSET=utf8mb4; ```

再就是商品表了,分析一下操作界面上的展示信息,大致可以了解到商品名称,价值,描述信息,图片,库存数量,可兑换次数。

分析出的表结构是这样的

``` create table if not exists `score_shop_goods` ( `id` int(11) unsigned AUTO_INCREMENT, `menuid` int(11) not null DEFAULT 0 comment \'所属分类\', `good_type` varchar(32) not null DEFAULT \'object\' comment \'区分实体商品与虚拟商品 object实体商品 virtual虚拟商品 coupon优惠卷\', `good_name` varchar(100) not null DEFAULT \'\' comment \'商品名称\', `good_icon` text not null comment \'商品icon\', `good_pic` text not null comment \'商品图片\', `good_desc` text comment \'商品描述\', `good_stock` int(11) not null DEFAULT 0 comment \'商品库存\', `exchange_type` tinyint(4) not null DEFAULT 0 comment \'商品种类 0积分 1人民币 2积分+人民币\', `exchange_info` text not null comment \'关于商品价格的信息\', `exchange_num` int(11) unsigned not null DEFAULT 1 comment \'用户最多兑换次数 0无限制 默认1次\', `created_time` int(11) unsigned not null DEFAULT 0 comment \'创建时间\', `updated_time` int(11) unsigned not null DEFAULT 0 comment \'更新时间\', PRIMARY KEY (`id`) ) engine=InnoDB DEFAULT CHARSET=utf8mb4; ```

这套积分商城结构应该是需要把支付表另外独立出来一个,不与之前已有的支付表冲突,但是需要存在关联点,我这个仅供参考

``` create table if not exists `score_shop_pay_record` ( `id` int(11) unsigned AUTO_INCREMENT, `user_id` int(11) unsigned not null DEFAULT 0 comment \'用户ID\', `pay_id` int(11) unsigned not null DEFAULT 0 comment \'购买的商品ID\', `oid` varchar(50) not null DEFAULT 0 comment \'订单ID\', `pay_type` tinyint(4) not null DEFAULT 0 comment \'支付类型,1微信支付 2支付宝支付\', `money` int(11) unsigned not null DEFAULT 0 comment \'支付金额,单位分\', `score` int(11) unsigned not null DEFAULT 0 comment \'支付积分\', `log` varchar(255) not null DEFAULT \'\' comment \'备注信息\', `pay_time` int(10) unsigned not null DEFAULT 0 comment \'支付时间\', `created_time` int(10) unsigned not null DEFAULT 0 comment \'创建订单时间\', `updated_time` int(10) unsigned not null DEFAULT 0 comment \'更新订单时间\', `status` tinyint(4) not null DEFAULT 0 comment \'支付状态,0充值失败 1充值成功未发货 2已发货 3客户端支付成功 4客户端取消支付\', PRIMARY KEY (`id`) ) engine=InnoDB DEFAULT CHARSET=utf8; ```
这里的status是为了兼容app支付,这套体系是web端的h5支付

准备写bug前的小问答

Q: 傻逼网友发的什么几把

我: 看不懂不要紧,学习之后就能看懂,努力

分类:

技术点:

相关文章:

  • 2021-05-08
  • 2021-04-17
  • 2021-11-20
  • 2021-11-18
  • 2021-11-27
  • 2021-12-28
  • 2021-10-01
  • 2021-10-18
猜你喜欢
  • 2021-12-28
  • 2021-06-07
  • 2021-09-18
  • 2021-12-20
  • 2021-08-19
  • 2021-06-29
相关资源
相似解决方案