基于Ecshop/Ectouch微分销插件的开发(一):模型设计
更新时间:2015-10-20 点击量:1802

现在互联网+“横行天下”,电商平台作为互联网+中不可或缺的组成部分,越来越受到互联网相关企业的追捧。很多企业都在积极搭建自己的电商平台,有条件上必须上,没有条件上创造条件也要上。我的一个客户也要做商城,用的ecshop+Ectouch,都是买了正版授权的。不过在微分销这个问题上,遇到了麻烦——Ectouch的微分销不能开源(因为是需要二次开发),在网上找另外的微分销程序,要么不靠谱,要么要价太高(有人竟然开出了20万的价格——程序猿真的那么好赚钱吗?)。考虑良久之后,还是决定自己开发,所以我就接到这个活(压力山大)。
我在互联网这块是半路出家,不是科班出身,也就出于本身的爱好,跌跌撞撞还是干了这行。为了更好的学习及改进程序,我把这个程序开发的进程及一些想法发到博客,希望能得到大家的指点。
这两天刚弄完这个的模型设计。
ecs_ms_microshop 表
主要记录分销商店铺的基本信息,(命名不是很规范)
-- ----------------------------
-- Table structure for `ecs_ms_microshop`
-- ----------------------------
DROP TABLE IF EXISTS `ecs_ms_microshop`;
CREATE TABLE `ecs_ms_microshop` (
`shop_id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
`shop_name` varchar(255) NOT NULL,
`user_id` mediumint(8) unsigned NOT NULL DEFAULT '0',//店铺的所有者,外键 对于 ecs_users中的user_id
`real_name` varchar(255) NOT NULL,
`mobile` varchar(20) NOT NULL,
`category_list` text NOT NULL,// 店铺的商品信息,以分类为单位(因为设计的是不同的分类佣金不同)
`time` int(10) unsigned NOT NULL DEFAULT '0',
`parent_id` mediumint(8) unsigned NOT NULL DEFAULT '0',
`logo_image_url` varchar(255) NOT NULL,
`bank_info` text NOT NULL,//银行支付信息
`show_image_list` text NOT NULL,//展示图片列表
`remaining_amount` decimal(10,0) unsigned NOT NULL DEFAULT '0',//余额
`sale_amount` decimal(10,0) unsigned NOT NULL DEFAULT '0',//销售额
`commission_amount` decimal(10,0) unsigned NOT NULL DEFAULT '0',//佣金
`status` tinyint(4) NOT NULL DEFAULT '1',
PRIMARY KEY (`shop_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ecs_ms_commission_category 表
记录不同的分类对应不同的分佣比例(三级分佣)
DROP TABLE IF EXISTS `ecs_ms_commission_category`;
CREATE TABLE `ecs_ms_commission_category` (
`id` smallint(5) unsigned NOT NULL AUTO_INCREMENT,
`cat_id` smallint(5) unsigned NOT NULL DEFAULT '0',
`level0` decimal(10,0) NOT NULL DEFAULT '0',//本级分佣比例
`level1` decimal(10,0) NOT NULL DEFAULT '0',//上级分佣比例
`level2` decimal(10,0) NOT NULL DEFAULT '0',//上上级分佣比例
`status` tinyint(1) NOT NULL DEFAULT '1',
PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ecs_ms_commission表
分佣表,在订单创建时 插入各级的分佣信息
-- ----------------------------
-- Table structure for `ecs_ms_commission`
-- ----------------------------
DROP TABLE IF EXISTS `ecs_ms_commission`;
CREATE TABLE `ecs_ms_commission` (
`commission_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`order_id` int(10) unsigned NOT NULL,//外键,对应ecshop中order_info的order_id
`shop_id` mediumint(8) unsigned NOT NULL,
`level` tinyint(3) unsigned NOT NULL DEFAULT '0',//分佣等级 0、1、2 对应上表
`sale_amount` decimal(10,0) unsigned NOT NULL DEFAULT '0',//该订单的销售金额
`commission_amount` decimal(10,0) unsigned NOT NULL DEFAULT '0',//该订单的分成金额,按商品的分类、分佣等级进行分别计算
`time` int(10) unsigned NOT NULL DEFAULT '0',
`status` tinyint(3) unsigned NOT NULL DEFAULT '0',//0:等待分佣,1:已经分佣,2:取消分佣,
PRIMARY KEY (`commission_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ecs_ms_checkout 表
资金提现申请记录
-- ----------------------------
-- Table structure for `ecs_ms_checkout`
-- ----------------------------
DROP TABLE IF EXISTS `ecs_ms_checkout`;
CREATE TABLE `ecs_ms_checkout` (
`checkout_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`shop_id` mediumint(8) unsigned NOT NULL,
`bank_style` varchar(255) NOT NULL DEFAULT '0',
`apply_time` int(10) unsigned NOT NULL,
`allow_time` int(10) unsigned NOT NULL,
`amount` decimal(10,0) unsigned NOT NULL DEFAULT '0',
`status` tinyint(4) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`checkout_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ecs_ms_microshop_log 表
记录店铺的资金变动明细
-- ----------------------------
-- Table structure for `ecs_ms_microshop_log`
-- ----------------------------
DROP TABLE IF EXISTS `ecs_ms_microshop_log`;
CREATE TABLE `ecs_ms_microshop_log` (
`log_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`shop_id` mediumint(8) unsigned NOT NULL,
`user_id` mediumint(8) unsigned NOT NULL,
`remaining_amount` decimal(10,0) NOT NULL,
`sale_amount` decimal(10,0) NOT NULL,
`commission_amount` decimal(10,0) NOT NULL,
`change_type` tinyint(3) unsigned NOT NULL,
`change_time` int(10) unsigned NOT NULL,
`change_desc` varchar(255) NOT NULL,
PRIMARY KEY (`log_id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
以上就是全部的五张表,没有做过微分销系统,肯定会有所遗漏,如有建议欢迎留言,不甚感激!
如果文章对您有帮助,就打赏一个吧