资讯专栏INFORMATION COLUMN

积分商城简要设计

Jinkey / 1465人阅读

摘要:设计开始我们的表结构设计了分类表应该是最轻松的,一般结构是自增,名称,图片有图片的分类,显示顺序,状态这些。

为什么

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

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

但是得知今年(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: 傻逼网友发的什么几把

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

文章版权归作者所有,未经允许请勿转载,若此文章存在违规行为,您可以联系管理员删除。

转载请注明本文地址:https://www.ucloud.cn/yun/29317.html

相关文章

  • 金币(积分商城架构漫谈

    摘要:开篇金币积分商城下称商城是众多内的一个产品,随着使用的用户越来越多,商城对于用户留存的提升,扮演着重要的角色做为提高用户黏性的核心产品,在拥有很好用户体验的同时,也必须存在着一个高效稳定的系统。分析上述两点,得到结论按用户进行分库分表。 开篇 金币(积分)商城(下称商城)是众多App内的一个产品,随着App使用的用户越来越多,商城对于用户留存的提升,扮演着重要的角色;做为提高用户黏性的...

    Ethan815 评论0 收藏0

发表评论

0条评论

Jinkey

|高级讲师

TA的文章

阅读更多
最新活动
阅读需要支付1元查看
<