This commit is contained in:
周中平 2020-04-25 22:20:29 +08:00
commit a7d0bdc3c0
1992 changed files with 270528 additions and 0 deletions

6
.gitignore vendored Normal file
View File

@ -0,0 +1,6 @@
.idea
composer.lock
*.log
*.css.map
.sass-cache

48
README.md Normal file
View File

@ -0,0 +1,48 @@
# 萤火小程序商城-商业版YoShop
#### 项目介绍
萤火小程序商城是一款开源的电商系统为中小企业提供最佳的新零售解决方案。采用稳定的MVC框架开发执行效率、扩展性、稳定性值得信赖。帮助商家高效快捷的打造一款功能完善的购物小程序速度快无需下载安装共享微信 8亿用户流量开启新零售
#### 项目官网
官网地址https://www.yiovo.com/
## 更新日志
### v1.1.38
修复:订单确认页收货地址提示
修复:后台拼团商品列表状态筛选
修复:秒杀订单并发库存问题
修复:后台编辑门店后坐标不准确
新增:后台分销中心编辑分销商用户
优化:删除分销商清空推荐关系
优化:删除用户时删除上级推荐关系
## 系统使用要求
## 小程序要求
```
申请微信小程序
通过微信认证
申请微信支付商户
```
## 服务器最低要求
```
1核CPU
2G内存
2M带宽
```
## 系统环境要求
```
PHP版本 >= 5.4 (推荐PHP7.1版本)
MySql版本 >= 5.5 (需支持innodb引擎)
Apache 或 Nginx
服务器支持https
```

5598
doc/database/install.sql Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,31 @@
# 微信小程序diy页面表页面标题改为页面名称
ALTER TABLE `yoshop_wxapp_page`
CHANGE COLUMN `page_title` `page_name` varchar(255) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '页面名称' AFTER `page_type`;
# 微信小程序diy页面表新增字段 软删除
ALTER TABLE `yoshop_wxapp_page`
ADD COLUMN `is_delete` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '软删除' AFTER `wxapp_id`;
# 微信小程序diy页面表添加页面名称
UPDATE `yoshop_wxapp_page` SET `page_name` = '小程序首页' WHERE page_id = 10001;
# 订单记录表:新增字段 后台修改的订单金额(差价)
ALTER TABLE `yoshop_order`
ADD COLUMN `update_price` decimal(10,2) NOT NULL DEFAULT 0.00 COMMENT '后台修改的订单金额(差价)' AFTER `pay_price`;
# 微信小程序分类页模板表
CREATE TABLE `yoshop_wxapp_category` (
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`category_style` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '分类页样式(10一级分类[大图] 11一级分类[小图] 20二级分类)',
`share_title` varchar(10) NOT NULL DEFAULT '' COMMENT '分享标题',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`wxapp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='微信小程序分类页模板';
INSERT INTO `yoshop_wxapp_category` (`wxapp_id`, `category_style`, `share_title`, `create_time`, `update_time`) VALUES ('10001', '10', '', '1536373988', '1536375112');

View File

@ -0,0 +1,22 @@
# 订单记录表:买家留言
ALTER TABLE `yoshop_order`
ADD COLUMN `buyer_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '买家留言' AFTER `update_price`;
# 小程序prepay_id记录表
CREATE TABLE `yoshop_wxapp_prepay_id` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
`prepay_id` varchar(50) NOT NULL DEFAULT '' COMMENT '微信支付prepay_id',
`can_use_times` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '可使用次数',
`used_times` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '已使用次数',
`pay_status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '支付状态(1已支付)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`expiry_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COMMENT='小程序prepay_id记录';

View File

@ -0,0 +1,43 @@
# 新增权限url分销中心下级用户列表
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10336', '下级用户列表', 'apps.dealer.user/fans', '10079', '100', '1545189676', '1545189676');
# 微信小程序分类页模板:分享标题字段增加 varchar长度
ALTER TABLE `yoshop_wxapp_category`
MODIFY COLUMN `share_title` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL DEFAULT '' COMMENT '分享标题' AFTER `category_style`;
-- 主商品 --
ALTER TABLE `yoshop_goods` ADD COLUMN `is_ind_dealer` TINYINT (3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启单独分销(0关闭 1开启)' AFTER `delivery_id`,
ADD COLUMN `dealer_money_type` TINYINT (3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '分销佣金类型(10百分比 20固定金额)' AFTER `is_ind_dealer`,
ADD COLUMN `first_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(一级)' AFTER `dealer_money_type`,
ADD COLUMN `second_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(二级)' AFTER `first_money`,
ADD COLUMN `third_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(三级)' AFTER `second_money`;
ALTER TABLE `yoshop_order_goods` ADD COLUMN `is_ind_dealer` TINYINT (3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启单独分销(0关闭 1开启)' AFTER `total_pay_price`,
ADD COLUMN `dealer_money_type` TINYINT (3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '分销佣金类型(10百分比 20固定金额)' AFTER `is_ind_dealer`,
ADD COLUMN `first_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(一级)' AFTER `dealer_money_type`,
ADD COLUMN `second_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(二级)' AFTER `first_money`,
ADD COLUMN `third_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(三级)' AFTER `second_money`;
-- 拼团 --
ALTER TABLE `yoshop_sharing_goods` ADD COLUMN `is_ind_dealer` TINYINT (3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启单独分销(0关闭 1开启)' AFTER `delivery_id`,
ADD COLUMN `dealer_money_type` TINYINT (3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '分销佣金类型(10百分比 20固定金额)' AFTER `is_ind_dealer`,
ADD COLUMN `first_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(一级)' AFTER `dealer_money_type`,
ADD COLUMN `second_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(二级)' AFTER `first_money`,
ADD COLUMN `third_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(三级)' AFTER `second_money`;
ALTER TABLE `yoshop_sharing_order_goods` ADD COLUMN `is_ind_dealer` TINYINT (3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否开启单独分销(0关闭 1开启)' AFTER `total_pay_price`,
ADD COLUMN `dealer_money_type` TINYINT (3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '分销佣金类型(10百分比 20固定金额)' AFTER `is_ind_dealer`,
ADD COLUMN `first_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(一级)' AFTER `dealer_money_type`,
ADD COLUMN `second_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(二级)' AFTER `first_money`,
ADD COLUMN `third_money` DECIMAL (10, 2) UNSIGNED NOT NULL DEFAULT '0.00' COMMENT '分销佣金(三级)' AFTER `second_money`;

View File

@ -0,0 +1,48 @@
# 新增文章记录表
CREATE TABLE `yoshop_article` (
`article_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '文章id',
`article_title` varchar(300) NOT NULL DEFAULT '' COMMENT '文章标题',
`show_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '列表显示方式(10小图展示 20大图展示)',
`category_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文章分类id',
`image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '封面图id',
`article_content` longtext NOT NULL COMMENT '文章内容',
`article_sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '文章排序(数字越小越靠前)',
`article_status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '文章状态(0隐藏 1显示)',
`virtual_views` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '虚拟阅读量(仅用作展示)',
`actual_views` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '实际阅读量',
`is_delete` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`article_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='文章记录表';
# 新增文章分类表
CREATE TABLE `yoshop_article_category` (
`category_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品分类id',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '分类名称',
`sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序方式(数字越小越靠前)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='文章分类表';
# 新增权限url后台文章管理
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10337', '内容管理', 'content', '0', '100', '1547018818', '1547018818');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10338', '文章管理', 'content.article', '10337', '100', '1547018849', '1547018869');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10339', '文章列表', 'content.article/index', '10338', '100', '1547018885', '1547018885');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10340', '添加文章', 'content.article/add', '10338', '100', '1547018901', '1547018901');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10341', '编辑文章', 'content.article/edit', '10338', '100', '1547018922', '1547018922');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10342', '删除文章', 'content.article/delete', '10338', '100', '1547018937', '1547018937');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10343', '文章分类', 'content.article.category', '10337', '100', '1547018972', '1547018972');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10344', '分类列表', 'content.article.category/index', '10343', '100', '1547018992', '1547018992');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10345', '添加分类', 'content.article.category/add', '10343', '100', '1547019008', '1547019017');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10346', '编辑分类', 'content.article.category/edit', '10343', '100', '1547019008', '1547019017');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10347', '删除分类', 'content.article.category/delete', '10343', '100', '1547019008', '1547019017');

View File

@ -0,0 +1,33 @@
# 小票打印机记录表
CREATE TABLE `yoshop_printer` (
`printer_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '打印机id',
`printer_name` varchar(255) NOT NULL DEFAULT '' COMMENT '打印机名称',
`printer_type` varchar(255) NOT NULL DEFAULT '' COMMENT '打印机类型',
`printer_config` text NOT NULL COMMENT '打印机配置',
`print_times` smallint(6) unsigned NOT NULL DEFAULT '0' COMMENT '打印联数(次数)',
`sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序 (数字越小越靠前)',
`is_delete` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`printer_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='小票打印机记录表';
# 新增权限url分销商提现微信付款
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10348', '微信付款', 'apps.dealer.withdraw/wechat_pay', '10084', '100', '1548232045', '1548232045');
# 新增权限url小票打印机管理
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10349', '小票打印机', 'setting.printer', '10090', '100', '1548738285', '1548738285');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10350', '打印机管理', 'setting.printer', '10349', '100', '1548738718', '1548738718');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10351', '小票打印设置', 'setting/printer', '10349', '100', '1548738720', '1548738720');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10352', '小票打印机列表', 'setting.printer/index', '10350', '100', '1548738420', '1548738420');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10353', '新增小票打印机', 'setting.printer/add', '10350', '100', '1548738443', '1548738443');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10354', '编辑小票打印机', 'setting.printer/edit', '10350', '100', '1548738443', '1548738443');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10355', '删除小票打印机', 'setting.printer/delete', '10350', '100', '1548738443', '1548738443');

View File

@ -0,0 +1,87 @@
ALTER TABLE `yoshop_order` ADD COLUMN `delivery_type` tinyint(3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '配送方式(10快递配送 20上门自提)' AFTER `pay_time`;
ALTER TABLE `yoshop_order` ADD COLUMN `extract_shop_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '自提门店id' AFTER `delivery_type`;
ALTER TABLE `yoshop_order` ADD COLUMN `extract_clerk_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '核销店员id' AFTER `extract_shop_id`;
ALTER TABLE `yoshop_sharing_order` ADD COLUMN `delivery_type` tinyint(3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '配送方式(10快递配送 20上门自提)' AFTER `pay_time`;
ALTER TABLE `yoshop_sharing_order` ADD COLUMN `extract_shop_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '自提门店id' AFTER `delivery_type`;
ALTER TABLE `yoshop_sharing_order` ADD COLUMN `extract_clerk_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '核销店员id' AFTER `extract_shop_id`;
# 商家门店记录表
CREATE TABLE `yoshop_store_shop` (
`shop_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '门店id',
`shop_name` varchar(255) NOT NULL DEFAULT '' COMMENT '门店名称',
`logo_image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '门店logo图片id',
`linkman` varchar(20) NOT NULL DEFAULT '' COMMENT '联系人',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
`shop_hours` varchar(255) NOT NULL DEFAULT '' COMMENT '营业时间',
`province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在省份id',
`city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在城市id',
`region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在辖区id',
`address` varchar(100) NOT NULL DEFAULT '' COMMENT '详细地址',
`longitude` varchar(50) NOT NULL DEFAULT '' COMMENT '门店坐标经度',
`latitude` varchar(50) NOT NULL DEFAULT '' COMMENT '门店坐标纬度',
`geohash` varchar(50) NOT NULL DEFAULT '' COMMENT 'geohash',
`summary` varchar(1000) NOT NULL DEFAULT '0' COMMENT '门店简介',
`is_check` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '是否支持自提核销(0否 1支持)',
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '门店状态(0禁用 1启用)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`shop_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家门店记录表';
# 商家门店店员表
CREATE TABLE `yoshop_store_shop_clerk` (
`clerk_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '店员id',
`shop_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所属门店id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`real_name` varchar(30) NOT NULL DEFAULT '' COMMENT '店员姓名',
`mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '状态(0禁用 1启用)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`clerk_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家门店店员表';
#商家门店核销订单记录表
CREATE TABLE `yoshop_store_shop_order` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
`order_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单类型(10商城订单 20拼团订单)',
`shop_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '门店id',
`clerk_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '核销员id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家门店核销订单记录表';
# 新增权限url门店管理
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10356', '门店管理', 'shop', '0', '100', '1551504862', '1551504862');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10357', '门店管理', 'shop', '10356', '105', '1551505016', '1551505016');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10358', '门店列表', 'shop/index', '10357', '100', '1551505032', '1551505048');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10359', '添加门店', 'shop/add', '10357', '100', '1551505032', '1551505048');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10360', '编辑门店', 'shop/edit', '10357', '100', '1551505032', '1551505048');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10361', '删除门店', 'shop/delete', '10357', '100', '1551505032', '1551505048');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10362', '店员管理', 'shop.clerk', '10356', '110', '1551505016', '1551505016');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10363', '店员列表', 'shop.clerk/index', '10362', '100', '1551505032', '1551505048');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10364', '添加店员', 'shop.clerk/add', '10362', '100', '1551505032', '1551505048');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10365', '编辑店员', 'shop.clerk/edit', '10362', '100', '1551505032', '1551505048');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10366', '删除店员', 'shop.clerk/delete', '10362', '100', '1551505032', '1551505048');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10367', '订单核销记录', 'shop.order/index', '10356', '115', '1551505016', '1551505016');
# 新增权限url订单核销
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10368', '门店自提核销', 'order.operate/extract', '10043', '100', '1551505016', '1551505016');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10369', '门店自提核销', 'apps.sharing.order.operate/extract', '10318', '100', '1551505016', '1551505016');
# 新增权限url满额包邮
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10370', '满额包邮', 'market.basic/full_free', '10052', '100', '1551505016', '1551505016');

View File

@ -0,0 +1,11 @@
# 分销商订单记录表:新增 "订单是否失效" 字段
ALTER TABLE `yoshop_dealer_order`
ADD COLUMN `is_invalid` tinyint(3) NOT NULL DEFAULT 0 COMMENT '订单是否失效 (0未失效 1已失效)' AFTER `third_money`;
# 门店记录表:新增 "排序" 字段
ALTER TABLE `yoshop_store_shop`
ADD COLUMN `sort` tinyint(3) NOT NULL DEFAULT 0 COMMENT '门店排序(数字越小越靠前)' AFTER `summary`;

View File

@ -0,0 +1,29 @@
# 文件库记录表:新增 "是否已回收" 字段
ALTER TABLE `yoshop_upload_file`
ADD COLUMN `is_recycle` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否已回收' AFTER `is_user`;
# 文件库分组记录表:新增 "是否删除" 字段
ALTER TABLE `yoshop_upload_group`
ADD COLUMN `is_delete` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除' AFTER `sort`;
# 新增权限url后台文件库管理
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10375', '文件库管理', 'content.files.group', '10337', '105', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10376', '文件分组', 'content.files.group', '10375', '100', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10377', '分组列表', 'content.files.group/index', '10376', '100', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10378', '添加分组', 'content.files.group/add', '10376', '100', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10379', '编辑分组', 'content.files.group/edit', '10376', '100', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10380', '删除分组', 'content.files.group/delete', '10376', '100', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10381', '文件管理', 'content.files.group', '10375', '100', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10382', '文件列表', 'content.files.group/index', '10381', '105', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10383', '回收站列表', 'content.files.group/recycle', '10381', '110', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10384', '移入回收站', 'content.files.group/add', '10381', '115', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10385', '回收站还原', 'content.files.group/edit', '10381', '120', '1552634170', '1552634170');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10386', '删除文件', 'content.files.group/delete', '10381', '125', '1552634170', '1552634170');

View File

@ -0,0 +1,79 @@
ALTER TABLE `yoshop_user` ADD COLUMN `balance` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '用户可用余额' AFTER `address_id`;
ALTER TABLE `yoshop_order` ADD COLUMN `pay_type` tinyint(3) UNSIGNED NOT NULL DEFAULT 20 COMMENT '支付方式(10余额支付 20微信支付)' AFTER `buyer_remark`;
ALTER TABLE `yoshop_sharing_order` ADD COLUMN `pay_type` tinyint(3) UNSIGNED NOT NULL DEFAULT 20 COMMENT '支付方式(10余额支付 20微信支付)' AFTER `buyer_remark`;
CREATE TABLE `yoshop_recharge_order` (
`order_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单id',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单号',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`recharge_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '充值方式(10自定义金额 20套餐充值)',
`plan_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '充值套餐id',
`pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '用户支付金额',
`gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
`actual_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际到账金额',
`pay_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '支付状态(10待支付 20已支付)',
`pay_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '付款时间',
`transaction_id` varchar(30) NOT NULL DEFAULT '' COMMENT '微信支付交易号',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户充值订单表';
CREATE TABLE `yoshop_recharge_order_plan` (
`order_plan_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
`plan_id` int(11) unsigned NOT NULL COMMENT '主键id',
`plan_name` varchar(255) NOT NULL DEFAULT '' COMMENT '方案名称',
`money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '充值金额',
`gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`order_plan_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户充值订单套餐快照表';
CREATE TABLE `yoshop_recharge_plan` (
`plan_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`plan_name` varchar(255) NOT NULL DEFAULT '' COMMENT '套餐名称',
`money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '充值金额',
`gift_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '赠送金额',
`sort` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`plan_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='余额充值套餐表';
CREATE TABLE `yoshop_user_balance_log` (
`log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`scene` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)',
`money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '变动金额',
`describe` varchar(500) NOT NULL DEFAULT '' COMMENT '描述/说明',
`remark` varchar(500) NOT NULL DEFAULT '' COMMENT '管理员备注',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户余额变动明细表';
UPDATE `yoshop_store_access` SET `sort`='120' WHERE (`access_id` = '10370');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10387', '余额记录', 'user.balance', '10049', '105', '1554685953', '1554685965');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10388', '充值记录', 'user.recharge/order', '10387', '100', '1554686010', '1554686010');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10389', '余额明细', 'user.balance/log', '10387', '105', '1554686031', '1554686031');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10390', '用户充值', 'market.recharge', '10052', '110', '1554686283', '1554686339');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10391', '充值套餐', 'market.recharge.plan', '10390', '100', '1554686316', '1554686316');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10392', '套餐列表', 'market.recharge.plan/index', '10391', '100', '1554686316', '1554686316');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10393', '添加套餐', 'market.recharge.plan/add', '10391', '105', '1554686316', '1554686316');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10394', '编辑套餐', 'market.recharge.plan/edit', '10391', '110', '1554686316', '1554686316');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10395', '删除套餐', 'market.recharge.plan/delete', '10391', '115', '1554686316', '1554686316');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10396', '充值设置', 'market.recharge/setting', '10390', '105', '1554686647', '1554686647');

View File

@ -0,0 +1,27 @@
UPDATE `yoshop_store_access` SET `name`='运费模板' WHERE (`access_id`='10093');
CREATE TABLE `yoshop_order_extract` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
`linkman` varchar(30) NOT NULL DEFAULT '' COMMENT '联系人姓名',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10003 DEFAULT CHARSET=utf8 COMMENT='自提订单联系方式记录表';
CREATE TABLE `yoshop_sharing_order_extract` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
`linkman` varchar(30) NOT NULL DEFAULT '' COMMENT '联系人姓名',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='自提订单联系方式记录表';

View File

@ -0,0 +1,9 @@
UPDATE `yoshop_store_access` SET `name`='营销管理' WHERE (`access_id`='10052')
ALTER TABLE `yoshop_order`
ADD COLUMN `is_delete` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除' AFTER `user_id`;
ALTER TABLE `yoshop_sharing_order`
ADD COLUMN `is_delete` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除' AFTER `user_id`;

View File

@ -0,0 +1,100 @@
START TRANSACTION;
# 好物圈设置表
CREATE TABLE `yoshop_wow_setting` (
`key` varchar(30) NOT NULL DEFAULT '' COMMENT '设置项标示',
`describe` varchar(255) NOT NULL DEFAULT '' COMMENT '设置项描述',
`values` mediumtext NOT NULL COMMENT '设置内容(json格式)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
UNIQUE KEY `unique_key` (`key`,`wxapp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='好物圈设置表';
# 好物圈商品收藏记录表
CREATE TABLE `yoshop_wow_shoping` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='好物圈商品收藏记录表';
# 好物圈订单同步记录表
CREATE TABLE `yoshop_wow_order` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
`order_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单类型(10商城订单 20拼团订单)',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '订单状态(3支付完成 4已发货 5已退款 100已完成)',
`last_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '最后更新时间',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='好物圈订单同步记录表';
# 更新权限排序
UPDATE `yoshop_store_access` SET `sort`='105' WHERE (`access_id`='10335');
UPDATE `yoshop_store_access` SET `sort`='105' WHERE (`access_id`='10051');
UPDATE `yoshop_store_access` SET `sort`='115' WHERE (`access_id`='10387');
# 新增好物圈管理管理
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10400', '好物圈', 'apps.wow', '10074', '110', '1557037952', '1557037952');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10401', '商品收藏', 'apps.wow.shoping', '10400', '100', '1557037952', '1557037952');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10402', '订单信息', 'apps.wow.order', '10400', '105', '1557037952', '1557037952');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10403', '基础设置', 'apps.wow.setting/index', '10400', '110', '1557037952', '1557037952');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10404', '商品收藏记录', 'apps.wow.shoping/index', '10401', '100', '1557037952', '1557037952');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10405', '取消同步', 'apps.wow.shoping/delete', '10401', '105', '1557037952', '1557037952');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10406', '订单同步记录', 'apps.wow.order/index', '10402', '100', '1557037952', '1557037952');
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10407', '取消同步', 'apps.wow.order/delete', '10402', '105', '1557037952', '1557037952');
# 新增用户充值权限
INSERT INTO `yoshop_store_access` (`access_id`, `name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('10408', '用户充值', 'user/recharge', '10049', '110', '1557037952', '1557037952');
# 删除冗余的权限
DELETE FROM `yoshop_store_access` WHERE (`access_id`='10013');
DELETE FROM `yoshop_store_access` WHERE (`access_id`='10014');
DELETE FROM `yoshop_store_access` WHERE (`access_id`='10015');
DELETE FROM `yoshop_store_access` WHERE (`access_id`='10016');
DELETE FROM `yoshop_store_access` WHERE (`access_id`='10017');
# 整理地区表
UPDATE `yoshop_region` SET `name`='香港岛(废弃)' WHERE (`id`='3717');
UPDATE `yoshop_region` SET `name`='九龙(废弃)' WHERE (`id`='3722');
UPDATE `yoshop_region` SET `name`='新界(废弃)' WHERE (`id`='3728');
INSERT INTO `yoshop_region` VALUES ('3999', '3716', '香港', '香港特别行政区', '中国,香港特别行政区', '2', 'hongkong', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4000', '3999', '中西区', '中西区', '中国,香港特别行政区,中西区', '3', 'zhongxin', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4001', '3999', '东区', '东区', '中国,香港特别行政区,东区', '3', 'dong', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4002', '3999', '九龙城区', '九龙城区', '中国,香港特别行政区,九龙城区', '3', 'jiulong', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4003', '3999', '观塘区', '观塘区', '中国,香港特别行政区,观塘区', '3', 'guantang', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4004', '3999', '南区', '南区', '中国,香港特别行政区,南区', '3', 'nan', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4005', '3999', '深水埗区', '深水埗区', '中国,香港特别行政区,深水埗区', '3', 'shenshuibu', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4006', '3999', '湾仔区', '湾仔区', '中国,香港特别行政区,湾仔区', '3', 'wanzi', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4007', '3999', '黄大仙区', '黄大仙区', '中国,香港特别行政区,黄大仙区', '3', 'huangdaxian', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4008', '3999', '油尖旺区', '油尖旺区', '中国,香港特别行政区,油尖旺区', '3', 'youjianwang', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4009', '3999', '离岛区', '离岛区', '中国,香港特别行政区,离岛区', '3', 'lidao', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4010', '3999', '葵青区', '葵青区', '中国,香港特别行政区,葵青区', '3', 'kuiqing', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4011', '3999', '北区', '北区', '中国,香港特别行政区,北区', '3', 'bei', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4012', '3999', '西贡区', '西贡区', '中国,香港特别行政区,西贡区', '3', 'xigong', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4013', '3999', '沙田区', '沙田区', '中国,香港特别行政区,沙田区', '3', 'shatian', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4014', '3999', '屯门区', '屯门区', '中国,香港特别行政区,屯门区', '3', 'tunmen', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4015', '3999', '大埔区', '大埔区', '中国,香港特别行政区,大埔区', '3', 'dapu', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4016', '3999', '荃湾区', '荃湾区', '中国,香港特别行政区,荃湾区', '3', 'quanwan', null, null, null, null, null);
INSERT INTO `yoshop_region` VALUES ('4017', '3999', '元朗区', '元朗区', '中国,香港特别行政区,元朗区', '3', 'yuanlang', null, null, null, null, null);
ALTER TABLE `yoshop_region` AUTO_INCREMENT=50001;
COMMIT;

View File

@ -0,0 +1,168 @@
START TRANSACTION;
# 修改字段:用户表 - 用户总支付的金额
ALTER TABLE `yoshop_user`
CHANGE COLUMN `money` `pay_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '用户总支付的金额' AFTER `balance`;
# 新增字段:用户表 - 实际消费的金额
ALTER TABLE `yoshop_user`
ADD COLUMN `expend_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '实际消费的金额(不含退款)' AFTER `pay_money`;
# 新增字段:用户表 - 会员等级id
ALTER TABLE `yoshop_user`
ADD COLUMN `grade_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员等级id' AFTER `expend_money`;
# 新增字段:商品表 - 是否开启会员折扣
ALTER TABLE `yoshop_goods`
ADD COLUMN `is_enable_grade` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否开启会员折扣(1开启 0关闭)' AFTER `delivery_id`;
# 新增字段:商品表 - 会员折扣设置
ALTER TABLE `yoshop_goods`
ADD COLUMN `is_alone_grade` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员折扣设置(0默认等级折扣 1单独设置折扣)' AFTER `is_enable_grade`;
# 新增字段:商品表 - 单独设置折扣的配置
ALTER TABLE `yoshop_goods`
ADD COLUMN `alone_grade_equity` text NULL COMMENT '单独设置折扣的配置' AFTER `is_alone_grade`;
# 新增字段:商品表 - 是否开启会员折扣
ALTER TABLE `yoshop_sharing_goods`
ADD COLUMN `is_enable_grade` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否开启会员折扣(1开启 0关闭)' AFTER `delivery_id`;
# 新增字段:商品表 - 会员折扣设置
ALTER TABLE `yoshop_sharing_goods`
ADD COLUMN `is_alone_grade` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员折扣设置(0默认等级折扣 1单独设置折扣)' AFTER `is_enable_grade`;
# 新增字段:商品表 - 单独设置折扣的配置
ALTER TABLE `yoshop_sharing_goods`
ADD COLUMN `alone_grade_equity` text NULL COMMENT '单独设置折扣的配置' AFTER `is_alone_grade`;
# 新增字段:订单表 - 标识:累积用户实际消费金额
ALTER TABLE `yoshop_order`
ADD COLUMN `is_user_expend` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '标识:累积用户实际消费金额' AFTER `user_id`;
# 修改字段:订单表 - 优惠券抵扣金额
ALTER TABLE `yoshop_order`
CHANGE COLUMN `coupon_price` `coupon_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '优惠券抵扣金额' AFTER `coupon_id`;
# 新增字段:拼团订单表 - 标识:累积用户实际消费金额
ALTER TABLE `yoshop_sharing_order`
ADD COLUMN `is_user_expend` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '标识:累积用户实际消费金额' AFTER `user_id`;
# 修改字段:拼团订单表 - 优惠券抵扣金额
ALTER TABLE `yoshop_sharing_order`
CHANGE COLUMN `coupon_price` `coupon_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '优惠券抵扣金额' AFTER `coupon_id`;
# 新增字段:订单商品记录表 - 会员等级折扣金额 + 优惠券折扣金额
ALTER TABLE `yoshop_order`
MODIFY COLUMN `total_price` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '商品总金额(不含优惠折扣)' AFTER `order_no`,
ADD COLUMN `order_price` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '订单金额(含优惠折扣)' AFTER `total_price`;
ALTER TABLE `yoshop_order_goods`
ADD COLUMN `grade_total_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员等级折扣金额' AFTER `goods_weight`,
ADD COLUMN `coupon_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券折扣金额' AFTER `grade_total_money`;
# 新增字段:订单商品记录表 - 是否存在会员等级折扣
ALTER TABLE `yoshop_order_goods`
ADD COLUMN `is_user_grade` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否存在会员等级折扣' AFTER `goods_weight`;
# 新增字段:订单商品记录表 - 会员折扣比例(0-10)
ALTER TABLE `yoshop_order_goods`
MODIFY COLUMN `grade_total_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '会员等级折扣金额(总)' AFTER `is_user_grade`,
ADD COLUMN `grade_ratio` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员折扣比例(0-10)' AFTER `is_user_grade`;
ALTER TABLE `yoshop_order_goods`
MODIFY COLUMN `goods_price` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '商品价格(单价)' AFTER `goods_no`,
MODIFY COLUMN `grade_total_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '会员折扣总金额' AFTER `grade_ratio`,
ADD COLUMN `grade_goods_price` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员折扣的商品单价' AFTER `grade_ratio`;
ALTER TABLE `yoshop_order_goods`
MODIFY COLUMN `grade_total_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '会员折扣的总额差' AFTER `grade_goods_price`;
# 新增字段:订单商品记录表 - 会员等级折扣金额 + 优惠券折扣金额
ALTER TABLE `yoshop_sharing_order`
MODIFY COLUMN `total_price` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '商品总金额(不含优惠折扣)' AFTER `order_no`,
ADD COLUMN `order_price` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '订单金额(含优惠折扣)' AFTER `total_price`;
ALTER TABLE `yoshop_sharing_order_goods`
ADD COLUMN `grade_total_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员等级折扣金额' AFTER `goods_weight`,
ADD COLUMN `coupon_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '优惠券折扣金额' AFTER `grade_total_money`;
# 新增字段:订单商品记录表 - 是否存在会员等级折扣
ALTER TABLE `yoshop_sharing_order_goods`
ADD COLUMN `is_user_grade` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否存在会员等级折扣' AFTER `goods_weight`;
# 新增字段:订单商品记录表 - 会员折扣比例(0-10)
ALTER TABLE `yoshop_sharing_order_goods`
MODIFY COLUMN `grade_total_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '会员等级折扣金额(总)' AFTER `is_user_grade`,
ADD COLUMN `grade_ratio` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员折扣比例(0-10)' AFTER `is_user_grade`;
ALTER TABLE `yoshop_sharing_order_goods`
MODIFY COLUMN `goods_price` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '商品价格(单价)' AFTER `goods_no`,
MODIFY COLUMN `grade_total_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '会员折扣总金额' AFTER `grade_ratio`,
ADD COLUMN `grade_goods_price` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '会员折扣的商品单价' AFTER `grade_ratio`;
ALTER TABLE `yoshop_sharing_order_goods`
MODIFY COLUMN `grade_total_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '会员折扣的总额差' AFTER `grade_goods_price`;
# 新增表:用户会员等级表
CREATE TABLE `yoshop_user_grade` (
`grade_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '等级ID',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '等级名称',
`weight` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '等级权重(1-9999)',
`upgrade` text NOT NULL COMMENT '升级条件',
`equity` text NOT NULL COMMENT '等级权益(折扣率0-100)',
`status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(1启用 0禁用)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`grade_id`),
KEY `wxapp_id` (`wxapp_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户会员等级表';
# 新增表:用户会员等级变更记录表
CREATE TABLE `yoshop_user_grade_log` (
`log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`old_grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '变更前的等级id',
`new_grade_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '变更后的等级id',
`change_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '变更类型(10后台管理员设置 20自动升级)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户会员等级变更记录表';
UPDATE `yoshop_store_access` SET `sort`='125' WHERE (`access_id`='10387');
INSERT INTO `yoshop_store_access` VALUES ('10411', '修改会员等级', 'user/grade', '10049', '115', '1558317213', '1558317226');
INSERT INTO `yoshop_store_access` VALUES ('10412', '会员等级管理', 'user.grade', '10049', '120', '1558317440', '1558317440');
INSERT INTO `yoshop_store_access` VALUES ('10413', '会员等级列表', 'user.grade/index', '10412', '100', '1558317464', '1558317464');
INSERT INTO `yoshop_store_access` VALUES ('10414', '新增等级', 'user.grade/add', '10412', '105', '1558317464', '1558317464');
INSERT INTO `yoshop_store_access` VALUES ('10415', '编辑等级', 'user.grade/edit', '10412', '110', '1558317464', '1558317464');
INSERT INTO `yoshop_store_access` VALUES ('10416', '删除等级', 'user.grade/delete', '10412', '115', '1558317464', '1558317464');
COMMIT;

View File

@ -0,0 +1,6 @@
START TRANSACTION;
ALTER TABLE `yoshop_user_grade_log` ADD COLUMN `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '管理员备注' AFTER `change_type`;
COMMIT;

View File

@ -0,0 +1,117 @@
START TRANSACTION;
CREATE TABLE `yoshop_bargain_active` (
`active_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '砍价活动id',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',
`start_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动开始时间',
`end_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动结束时间',
`expiryt_time` int(11) unsigned NOT NULL DEFAULT '1' COMMENT '砍价有效期(单位:小时)',
`floor_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '砍价底价',
`peoples` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '帮砍人数',
`is_self_cut` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '可自砍一刀(0禁止 1允许)',
`is_floor_buy` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '必须底价购买(0否 1是)',
`share_title` varchar(500) NOT NULL DEFAULT '' COMMENT '分享标题',
`prompt_words` varchar(500) NOT NULL DEFAULT '' COMMENT '砍价助力语',
`actual_sales` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动销量(实际的)',
`initial_sales` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '虚拟销量',
`sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序(数字越小越靠前)',
`status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '活动状态(1启用 0禁用)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`active_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='砍价活动表';
CREATE TABLE `yoshop_bargain_setting` (
`key` varchar(30) NOT NULL DEFAULT '' COMMENT '设置项标示',
`describe` varchar(255) NOT NULL DEFAULT '' COMMENT '设置项描述',
`values` mediumtext NOT NULL COMMENT '设置内容(json格式)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
UNIQUE KEY `unique_key` (`key`,`wxapp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='砍价活动设置表';
CREATE TABLE `yoshop_bargain_task` (
`task_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '砍价任务id',
`active_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '砍价活动id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id(发起人)',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',
`spec_sku_id` varchar(255) NOT NULL DEFAULT '' COMMENT '商品sku标识',
`goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品原价',
`floor_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '砍价底价',
`peoples` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '帮砍人数',
`cut_people` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '已砍人数',
`section` text NOT NULL COMMENT '砍价金额区间',
`cut_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '已砍金额',
`actual_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际购买金额',
`is_floor` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否已砍到底价(0否 1是)',
`end_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '任务截止时间',
`is_buy` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否购买(0未购买 1已购买)',
`status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '任务状态 (0已结束 1砍价中)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`task_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='砍价任务表';
CREATE TABLE `yoshop_bargain_task_help` (
`help_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`active_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '砍价活动id',
`task_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '砍价任务id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`is_creater` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否为发起人(0否 1是)',
`cut_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '砍掉的金额',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`help_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='砍价任务助力记录表';
ALTER TABLE `yoshop_order`
ADD COLUMN `order_source` tinyint(3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '订单来源(10普通订单 20砍价订单)' AFTER `is_comment`;
ALTER TABLE `yoshop_order`
ADD COLUMN `order_source_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '来源记录id' AFTER `order_source`;
INSERT INTO `yoshop_store_access` VALUES ('10426', '砍价活动', 'apps.bargain', '10074', '100', '1559615418', '1559615441');
INSERT INTO `yoshop_store_access` VALUES ('10427', '砍价活动管理', 'apps.bargain.active', '10426', '100', '1559615566', '1559615566');
INSERT INTO `yoshop_store_access` VALUES ('10428', '砍价活动列表', 'apps.bargain.active/index', '10427', '100', '1559615601', '1559615601');
INSERT INTO `yoshop_store_access` VALUES ('10429', '新增砍价活动', 'apps.bargain.active/add', '10427', '105', '1559615601', '1559615601');
INSERT INTO `yoshop_store_access` VALUES ('10430', '编辑砍价活动', 'apps.bargain.active/edit', '10427', '110', '1559615601', '1559615601');
INSERT INTO `yoshop_store_access` VALUES ('10431', '删除砍价活动', 'apps.bargain.active/delete', '10427', '115', '1559615601', '1559615601');
INSERT INTO `yoshop_store_access` VALUES ('10432', '砍价记录', 'apps.bargain.task', '10426', '105', '1559615788', '1559615788');
INSERT INTO `yoshop_store_access` VALUES ('10433', '砍价记录列表', 'apps.bargain.task/index', '10432', '100', '1559615815', '1559615815');
INSERT INTO `yoshop_store_access` VALUES ('10434', '砍价助力榜', 'apps.bargain.task/help', '10432', '105', '1559615850', '1559615850');
INSERT INTO `yoshop_store_access` VALUES ('10435', '删除砍价记录', 'apps.bargain.task/delete', '10432', '110', '1559615878', '1559615878');
INSERT INTO `yoshop_store_access` VALUES ('10436', '砍价设置', 'apps.bargain.setting/index', '10426', '110', '1559615946', '1559615979');
INSERT INTO `yoshop_store_access` VALUES ('10437', '复制主商城商品', 'apps.sharing.goods/copy_master', '10306', '112', '1559615946', '1559615979');
UPDATE `yoshop_store_access` SET `sort`='105' WHERE (`access_id`='10021');
UPDATE `yoshop_store_access` SET `sort`='110' WHERE (`access_id`='10022');
UPDATE `yoshop_store_access` SET `sort`='115' WHERE (`access_id`='10023');
UPDATE `yoshop_store_access` SET `sort`='120' WHERE (`access_id`='10024');
UPDATE `yoshop_store_access` SET `sort`='125' WHERE (`access_id`='10025');
UPDATE `yoshop_store_access` SET `sort`='105' WHERE (`access_id`='10307');
UPDATE `yoshop_store_access` SET `sort`='110' WHERE (`access_id`='10308');
UPDATE `yoshop_store_access` SET `sort`='115' WHERE (`access_id`='10309');
UPDATE `yoshop_store_access` SET `sort`='120' WHERE (`access_id`='10310');
UPDATE `yoshop_store_access` SET `sort`='125' WHERE (`access_id`='10311');
COMMIT;

View File

@ -0,0 +1,83 @@
ALTER TABLE `yoshop_user`
ADD COLUMN `points` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '用户可用积分' AFTER `balance`;
CREATE TABLE `yoshop_user_points_log` (
`log_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`value` int(11) NOT NULL DEFAULT '0.00' COMMENT '变动数量',
`describe` varchar(500) NOT NULL DEFAULT '' COMMENT '描述/说明',
`remark` varchar(500) NOT NULL DEFAULT '' COMMENT '管理员备注',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序商城id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`log_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='用户积分变动明细表';
ALTER TABLE `yoshop_order`
ADD COLUMN `points_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分抵扣金额' AFTER `coupon_money`;
ALTER TABLE `yoshop_order`
ADD COLUMN `points_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分抵扣数量' AFTER `points_money`;
ALTER TABLE `yoshop_order`
ADD COLUMN `points_bonus` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '赠送的积分数量' AFTER `order_status`;
ALTER TABLE `yoshop_order`
CHANGE COLUMN `is_user_expend` `is_settled` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单是否已结算(0未结算 1已结算)' AFTER `points_bonus`;
ALTER TABLE `yoshop_sharing_order`
ADD COLUMN `points_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分抵扣金额' AFTER `coupon_money`;
ALTER TABLE `yoshop_sharing_order`
ADD COLUMN `points_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分抵扣数量' AFTER `points_money`;
ALTER TABLE `yoshop_sharing_order`
ADD COLUMN `points_bonus` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '赠送的积分数量' AFTER `order_status`;
ALTER TABLE `yoshop_sharing_order`
CHANGE COLUMN `is_user_expend` `is_settled` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '订单是否已结算(0未结算 1已结算)' AFTER `points_bonus`;
ALTER TABLE `yoshop_goods`
ADD COLUMN `is_points_gift` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否开启积分赠送(1开启 0关闭)' AFTER `delivery_id`;
ALTER TABLE `yoshop_goods`
ADD COLUMN `is_points_discount` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否允许使用积分抵扣(1允许 0不允许)' AFTER `is_points_gift`;
ALTER TABLE `yoshop_order_goods`
ADD COLUMN `points_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '积分金额' AFTER `coupon_money`,
ADD COLUMN `points_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分抵扣数量' AFTER `points_money`,
ADD COLUMN `points_bonus` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '赠送的积分数量' AFTER `points_num`;
ALTER TABLE `yoshop_sharing_goods`
ADD COLUMN `is_points_gift` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否开启积分赠送(1开启 0关闭)' AFTER `delivery_id`;
ALTER TABLE `yoshop_sharing_goods`
ADD COLUMN `is_points_discount` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否允许使用积分抵扣(1允许 0不允许)' AFTER `is_points_gift`;
ALTER TABLE `yoshop_sharing_order_goods`
ADD COLUMN `points_money` decimal(10,2) UNSIGNED NOT NULL DEFAULT 0.00 COMMENT '积分金额' AFTER `coupon_money`,
ADD COLUMN `points_num` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '积分抵扣数量' AFTER `points_money`,
ADD COLUMN `points_bonus` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '赠送的积分数量' AFTER `points_num`;
UPDATE `yoshop_store_access` SET `sort`='125' WHERE (`access_id`='10370');
INSERT INTO `yoshop_store_access` VALUES ('10443', '活跃用户', 'market.push/user', '10441', '105', '1561080384', '1561080384');
INSERT INTO `yoshop_store_access` VALUES ('10442', '发送消息', 'market.push/send', '10441', '100', '1561080384', '1561080384');
INSERT INTO `yoshop_store_access` VALUES ('10441', '消息推送', 'market.push', '10052', '120', '1561080292', '1561080292');
INSERT INTO `yoshop_store_access` VALUES ('10440', '积分明细', 'market.points/log', '10438', '105', '1561080384', '1561080384');
INSERT INTO `yoshop_store_access` VALUES ('10439', '积分设置', 'market.points/setting', '10438', '100', '1561080384', '1561080384');
INSERT INTO `yoshop_store_access` VALUES ('10438', '积分管理', 'market.points', '10052', '115', '1561080292', '1561080292');

View File

@ -0,0 +1,148 @@
# 用户记录表:新增用户总消费金额
ALTER TABLE `yoshop_user`
ADD COLUMN `money` decimal(10,2) unsigned NOT NULL DEFAULT 0 COMMENT '用户总消费金额' AFTER `address_id`;
# 订单商品记录表:新增实际付款价
ALTER TABLE `yoshop_order_goods`
MODIFY COLUMN `total_price` decimal(10,2) unsigned NOT NULL DEFAULT 0.00 COMMENT '商品总价(数量×单价)' AFTER `total_num`,
ADD COLUMN `total_pay_price` decimal(10,2) unsigned NOT NULL DEFAULT 0.00 COMMENT '实际付款价(折扣和优惠后)' AFTER `total_price`;
# 分销商申请记录表
CREATE TABLE `yoshop_dealer_apply` (
`apply_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`real_name` varchar(30) NOT NULL DEFAULT '' COMMENT '姓名',
`mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
`referee_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '推荐人用户id',
`apply_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '申请方式(10需后台审核 20无需审核)',
`apply_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '申请时间',
`apply_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '审核状态 (10待审核 20审核通过 30驳回)',
`audit_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '审核时间',
`reject_reason` varchar(500) NOT NULL DEFAULT '' COMMENT '驳回原因',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`apply_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='分销商申请记录表';
# 分销商资金明细表
CREATE TABLE `yoshop_dealer_capital` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分销商用户id',
`flow_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '资金流动类型 (10佣金收入 20提现支出)',
`money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '金额',
`describe` varchar(500) NOT NULL DEFAULT '' COMMENT '描述',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='分销商资金明细表';
# 销商订单记录表
CREATE TABLE `yoshop_dealer_order` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id (买家)',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单号(废弃,勿用)',
`order_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '订单总金额(不含运费)',
`first_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分销商用户id(一级)',
`second_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分销商用户id(二级)',
`third_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分销商用户id(三级)',
`first_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '分销佣金(一级)',
`second_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '分销佣金(二级)',
`third_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '分销佣金(三级)',
`is_settled` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否已结算佣金 (0未结算 1已结算)',
`settle_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '结算时间',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='分销商订单记录表';
# 分销商推荐关系表
CREATE TABLE `yoshop_dealer_referee` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`dealer_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分销商用户id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id(被推荐人)',
`level` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '推荐关系层级(1,2,3)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`),
KEY `dealer_id` (`dealer_id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='分销商推荐关系表';
# 分销商设置表
CREATE TABLE `yoshop_dealer_setting` (
`key` varchar(30) NOT NULL DEFAULT '' COMMENT '设置项标示',
`describe` varchar(255) NOT NULL DEFAULT '' COMMENT '设置项描述',
`values` mediumtext NOT NULL COMMENT '设置内容(json格式)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
UNIQUE KEY `unique_key` (`key`,`wxapp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分销商设置表';
# 分销商用户记录表
CREATE TABLE `yoshop_dealer_user` (
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分销商用户id',
`real_name` varchar(30) NOT NULL DEFAULT '' COMMENT '姓名',
`mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号',
`money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '当前可提现佣金',
`freeze_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '已冻结佣金',
`total_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '累积提现佣金',
`referee_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '推荐人用户id',
`first_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '成员数量(一级)',
`second_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '成员数量(二级)',
`third_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '成员数量(三级)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`user_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='分销商用户记录表';
# 分销商提现明细表
CREATE TABLE `yoshop_dealer_withdraw` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分销商用户id',
`money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '提现金额',
`pay_type` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '打款方式 (10微信 20支付宝 30银行卡)',
`alipay_name` varchar(30) NOT NULL DEFAULT '' COMMENT '支付宝姓名',
`alipay_account` varchar(30) NOT NULL DEFAULT '' COMMENT '支付宝账号',
`bank_name` varchar(30) NOT NULL DEFAULT '' COMMENT '开户行名称',
`bank_account` varchar(30) NOT NULL DEFAULT '' COMMENT '银行开户名',
`bank_card` varchar(30) NOT NULL DEFAULT '' COMMENT '银行卡号',
`apply_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '申请状态 (10待审核 20审核通过 30驳回 40已打款)',
`audit_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '审核时间',
`reject_reason` varchar(500) NOT NULL DEFAULT '' COMMENT '驳回原因',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='分销商提现明细表';
# 小程序form_id记录表
CREATE TABLE `yoshop_wxapp_formid` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`form_id` varchar(50) NOT NULL DEFAULT '' COMMENT '小程序form_id',
`expiry_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '过期时间',
`is_used` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否已使用',
`used_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '使用时间',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `user_id` (`user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='小程序form_id记录表';

View File

@ -0,0 +1,119 @@
ALTER TABLE `yoshop_order_goods`
ADD COLUMN `goods_source_id` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '来源记录id' AFTER `user_id`;
ALTER TABLE `yoshop_order`
MODIFY COLUMN `order_source` tinyint(3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '订单来源(10普通订单 20砍价订单 30秒杀订单)' AFTER `is_comment`;
UPDATE `yoshop_store_access` SET `sort`='105' WHERE (`access_id`='10300');
UPDATE `yoshop_store_access` SET `sort`='110' WHERE (`access_id`='10426');
UPDATE `yoshop_store_access` SET `sort`='120' WHERE (`access_id`='10400');
INSERT INTO `yoshop_store_access` VALUES ('10444', '整点秒杀', 'apps.sharp', '10074', '115', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10445', '秒杀商品', 'apps.sharp.goods', '10444', '100', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10446', '商品列表', 'apps.sharp.goods/index', '10445', '100', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10447', '新增商品', 'apps.sharp.goods/add', '10445', '105', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10448', '编辑商品', 'apps.sharp.goods/edit', '10445', '110', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10449', '删除商品', 'apps.sharp.goods/delete', '10445', '115', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10450', '活动会场', 'apps.sharp.active', '10444', '105', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10451', '会场列表', 'apps.sharp.active/index', '10450', '100', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10452', '新增会场', 'apps.sharp.active/add', '10450', '105', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10453', '修改活动状态', 'apps.sharp.active/state', '10450', '110', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10454', '删除会场', 'apps.sharp.active/delete', '10450', '115', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10455', '场次管理', 'apps.sharp.active_time', '10450', '120', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10456', '场次列表', 'apps.sharp.active_time/index', '10455', '100', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10457', '新增场次', 'apps.sharp.active_time/add', '10455', '105', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10458', '编辑场次', 'apps.sharp.active_time/edit', '10455', '110', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10459', '修改活动状态', 'apps.sharp.active_time/state', '10455', '115', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10460', '删除场次', 'apps.sharp.active_time/delete', '10455', '120', '1564449650', '1564449650');
INSERT INTO `yoshop_store_access` VALUES ('10461', '基础设置', 'apps.sharp.setting/index', '10444', '125', '1564449650', '1564449650');
CREATE TABLE `yoshop_sharp_active` (
`active_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '活动会场ID',
`active_date` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动日期',
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '活动状态(0禁用 1启用)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`active_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='整点秒杀-活动会场表';
CREATE TABLE `yoshop_sharp_active_goods` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`active_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动会场ID',
`active_time_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动场次ID',
`sharp_goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '秒杀商品ID',
`sales_actual` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '实际销量',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='整点秒杀-活动会场与商品关联表';
CREATE TABLE `yoshop_sharp_active_time` (
`active_time_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '场次ID',
`active_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '活动会场ID',
`active_time` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '场次时间(0点-23点)',
`status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '活动状态(0禁用 1启用)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`active_time_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='整点秒杀-活动会场场次表';
CREATE TABLE `yoshop_sharp_goods` (
`sharp_goods_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '秒杀商品ID',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品ID',
`deduct_stock_type` tinyint(3) unsigned DEFAULT '10' COMMENT '库存计算方式(10下单减库存 20付款减库存)',
`limit_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '限购数量',
`seckill_stock` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品库存总量',
`total_sales` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '累积销量',
`sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品排序(数字越小越靠前)',
`status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '商品状态(0下架 1上架)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`sharp_goods_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='整点秒杀-商品表';
CREATE TABLE `yoshop_sharp_goods_sku` (
`goods_sku_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品规格id',
`spec_sku_id` varchar(255) NOT NULL DEFAULT '0' COMMENT '商品sku记录索引 (由规格id组成)',
`sharp_goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '秒杀商品id',
`seckill_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格',
`seckill_stock` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '秒杀库存数量',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`goods_sku_id`),
UNIQUE KEY `sku_idx` (`sharp_goods_id`,`spec_sku_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='整点秒杀-秒杀商品sku信息表';
CREATE TABLE `yoshop_sharp_setting` (
`key` varchar(30) NOT NULL DEFAULT '' COMMENT '设置项标示',
`describe` varchar(255) NOT NULL DEFAULT '' COMMENT '设置项描述',
`values` mediumtext NOT NULL COMMENT '设置内容(json格式)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
UNIQUE KEY `unique_key` (`key`,`wxapp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='整点秒杀设置表';

View File

@ -0,0 +1,66 @@
UPDATE `yoshop_region` SET `name`='省直辖县级行政区划',`merger_name`='中国,湖北省,省直辖县级行政区划' WHERE (`id`='1822');
UPDATE `yoshop_region` SET `merger_name`='中国,湖北省,省直辖县级行政区划,仙桃市' WHERE (`id`='1823');
UPDATE `yoshop_region` SET `merger_name`='中国,湖北省,省直辖县级行政区划,潜江市' WHERE (`id`='1824');
UPDATE `yoshop_region` SET `merger_name`='中国,湖北省,省直辖县级行政区划,天门市' WHERE (`id`='1825');
UPDATE `yoshop_region` SET `merger_name`='中国,湖北省,省直辖县级行政区划,神农架林区' WHERE (`id`='1826');
UPDATE `yoshop_region` SET `shortname`='', `name`='', `merger_name`='中国,重庆,县', `pinyin`='xian' WHERE (`id`='2363');
UPDATE `yoshop_region` SET `id`='2325', `pid`='2324', `shortname`='万州', `name`='万州区', `merger_name`='中国,重庆,重庆市,万州区', `level`='3', `pinyin`='wanzhou', `code`='023', `zip_code`='404000', `first`='W', `lng`='108.40869', `lat`='30.80788' WHERE (`id`='2325');
UPDATE `yoshop_region` SET `id`='2326', `pid`='2324', `shortname`='涪陵', `name`='涪陵区', `merger_name`='中国,重庆,重庆市,涪陵区', `level`='3', `pinyin`='fuling', `code`='023', `zip_code`='408000', `first`='F', `lng`='107.39007', `lat`='29.70292' WHERE (`id`='2326');
UPDATE `yoshop_region` SET `id`='2327', `pid`='2324', `shortname`='渝中', `name`='渝中区', `merger_name`='中国,重庆,重庆市,渝中区', `level`='3', `pinyin`='yuzhong', `code`='023', `zip_code`='400010', `first`='Y', `lng`='106.56901', `lat`='29.55279' WHERE (`id`='2327');
UPDATE `yoshop_region` SET `id`='2328', `pid`='2324', `shortname`='大渡口', `name`='大渡口区', `merger_name`='中国,重庆,重庆市,大渡口区', `level`='3', `pinyin`='dadukou', `code`='023', `zip_code`='400080', `first`='D', `lng`='106.48262', `lat`='29.48447' WHERE (`id`='2328');
UPDATE `yoshop_region` SET `id`='2329', `pid`='2324', `shortname`='江北', `name`='江北区', `merger_name`='中国,重庆,重庆市,江北区', `level`='3', `pinyin`='jiangbei', `code`='023', `zip_code`='400020', `first`='J', `lng`='106.57434', `lat`='29.60658' WHERE (`id`='2329');
UPDATE `yoshop_region` SET `id`='2330', `pid`='2324', `shortname`='沙坪坝', `name`='沙坪坝区', `merger_name`='中国,重庆,重庆市,沙坪坝区', `level`='3', `pinyin`='shapingba', `code`='023', `zip_code`='400030', `first`='S', `lng`='106.45752', `lat`='29.54113' WHERE (`id`='2330');
UPDATE `yoshop_region` SET `id`='2331', `pid`='2324', `shortname`='九龙坡', `name`='九龙坡区', `merger_name`='中国,重庆,重庆市,九龙坡区', `level`='3', `pinyin`='jiulongpo', `code`='023', `zip_code`='400050', `first`='J', `lng`='106.51107', `lat`='29.50197' WHERE (`id`='2331');
UPDATE `yoshop_region` SET `id`='2332', `pid`='2324', `shortname`='南岸', `name`='南岸区', `merger_name`='中国,重庆,重庆市,南岸区', `level`='3', `pinyin`='nan\'an', `code`='023', `zip_code`='400064', `first`='N', `lng`='106.56347', `lat`='29.52311' WHERE (`id`='2332');
UPDATE `yoshop_region` SET `id`='2333', `pid`='2324', `shortname`='北碚', `name`='北碚区', `merger_name`='中国,重庆,重庆市,北碚区', `level`='3', `pinyin`='beibei', `code`='023', `zip_code`='400700', `first`='B', `lng`='106.39614', `lat`='29.80574' WHERE (`id`='2333');
UPDATE `yoshop_region` SET `id`='2334', `pid`='2324', `shortname`='綦江', `name`='綦江区', `merger_name`='中国,重庆,重庆市,綦江区', `level`='3', `pinyin`='qijiang', `code`='023', `zip_code`='400800', `first`=NULL, `lng`='106.926779', `lat`='28.960656' WHERE (`id`='2334');
UPDATE `yoshop_region` SET `id`='2335', `pid`='2324', `shortname`='大足', `name`='大足区', `merger_name`='中国,重庆,重庆市,大足区', `level`='3', `pinyin`='dazu', `code`='023', `zip_code`='400900', `first`='D', `lng`='105.768121', `lat`='29.484025' WHERE (`id`='2335');
UPDATE `yoshop_region` SET `id`='2336', `pid`='2324', `shortname`='渝北', `name`='渝北区', `merger_name`='中国,重庆,重庆市,渝北区', `level`='3', `pinyin`='yubei', `code`='023', `zip_code`='401120', `first`='Y', `lng`='106.6307', `lat`='29.7182' WHERE (`id`='2336');
UPDATE `yoshop_region` SET `id`='2337', `pid`='2324', `shortname`='巴南', `name`='巴南区', `merger_name`='中国,重庆,重庆市,巴南区', `level`='3', `pinyin`='banan', `code`='023', `zip_code`='401320', `first`='B', `lng`='106.52365', `lat`='29.38311' WHERE (`id`='2337');
UPDATE `yoshop_region` SET `id`='2338', `pid`='2324', `shortname`='黔江', `name`='黔江区', `merger_name`='中国,重庆,重庆市,黔江区', `level`='3', `pinyin`='qianjiang', `code`='023', `zip_code`='409700', `first`='Q', `lng`='108.7709', `lat`='29.5332' WHERE (`id`='2338');
UPDATE `yoshop_region` SET `id`='2339', `pid`='2324', `shortname`='长寿', `name`='长寿区', `merger_name`='中国,重庆,重庆市,长寿区', `level`='3', `pinyin`='changshou', `code`='023', `zip_code`='401220', `first`='C', `lng`='107.08166', `lat`='29.85359' WHERE (`id`='2339');
UPDATE `yoshop_region` SET `id`='2340', `pid`='2324', `shortname`='江津', `name`='江津区', `merger_name`='中国,重庆,重庆市,江津区', `level`='3', `pinyin`='jiangjin', `code`='023', `zip_code`='402260', `first`='J', `lng`='106.25912', `lat`='29.29008' WHERE (`id`='2340');
UPDATE `yoshop_region` SET `id`='2341', `pid`='2324', `shortname`='合川', `name`='合川区', `merger_name`='中国,重庆,重庆市,合川区', `level`='3', `pinyin`='hechuan', `code`='023', `zip_code`='401520', `first`='H', `lng`='106.27633', `lat`='29.97227' WHERE (`id`='2341');
UPDATE `yoshop_region` SET `id`='2342', `pid`='2324', `shortname`='永川', `name`='永川区', `merger_name`='中国,重庆,重庆市,永川区', `level`='3', `pinyin`='yongchuan', `code`='023', `zip_code`='402160', `first`='Y', `lng`='105.927', `lat`='29.35593' WHERE (`id`='2342');
UPDATE `yoshop_region` SET `id`='2343', `pid`='2324', `shortname`='南川', `name`='南川区', `merger_name`='中国,重庆,重庆市,南川区', `level`='3', `pinyin`='nanchuan', `code`='023', `zip_code`='408400', `first`='N', `lng`='107.09936', `lat`='29.15751' WHERE (`id`='2343');
UPDATE `yoshop_region` SET `id`='2344', `pid`='2324', `shortname`='璧山', `name`='璧山区', `merger_name`='中国,重庆,重庆市,璧山区', `level`='3', `pinyin`='bishan', `code`='023', `zip_code`='402760', `first`=NULL, `lng`='106.231126', `lat`='29.593581' WHERE (`id`='2344');
UPDATE `yoshop_region` SET `id`='2345', `pid`='2324', `shortname`='铜梁', `name`='铜梁区', `merger_name`='中国,重庆,重庆市,铜梁区', `level`='3', `pinyin`='tongliang', `code`='023', `zip_code`='402560', `first`='T', `lng`='106.054948', `lat`='29.839944' WHERE (`id`='2345');
UPDATE `yoshop_region` SET `id`='2346', `pid`='2324', `shortname`='潼南', `name`='潼南区', `merger_name`='中国,重庆,重庆市,潼南区', `level`='3', `pinyin`='tongnan', `code`='023', `zip_code`='402660', `first`=NULL, `lng`='105.84005', `lat`='30.1912' WHERE (`id`='2346');
UPDATE `yoshop_region` SET `id`='2347', `pid`='2324', `shortname`='荣昌', `name`='荣昌区', `merger_name`='中国,重庆,重庆市,荣昌区', `level`='3', `pinyin`='rongchang', `code`='023', `zip_code`='402460', `first`='R', `lng`='105.59442', `lat`='29.40488' WHERE (`id`='2347');
UPDATE `yoshop_region` SET `id`='2348', `pid`='2324', `shortname`='梁平', `name`='梁平区', `merger_name`='中国,重庆,重庆市,梁平区', `level`='3', `pinyin`='liangping', `code`='023', `zip_code`='405200', `first`='L', `lng`='107.79998', `lat`='30.67545' WHERE (`id`='2348');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='城口', `name`='城口县', `merger_name`='中国,重庆,重庆市,城口县', `level`='3', `pinyin`='chengkou', `code`='023', `zip_code`='405900', `first`='C', `lng`='108.66513', `lat`='31.94801' WHERE (`id`='2349');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='丰都', `name`='丰都县', `merger_name`='中国,重庆,重庆市,丰都县', `level`='3', `pinyin`='fengdu', `code`='023', `zip_code`='408200', `first`='F', `lng`='107.73098', `lat`='29.86348' WHERE (`id`='2350');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='垫江', `name`='垫江县', `merger_name`='中国,重庆,重庆市,垫江县', `level`='3', `pinyin`='dianjiang', `code`='023', `zip_code`='408300', `first`='D', `lng`='107.35446', `lat`='30.33359' WHERE (`id`='2351');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='武隆', `name`='武隆县', `merger_name`='中国,重庆,重庆市,武隆县', `level`='3', `pinyin`='wulong', `code`='023', `zip_code`='408500', `first`='W', `lng`='107.7601', `lat`='29.32548' WHERE (`id`='2352');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='忠县', `name`='忠县', `merger_name`='中国,重庆,重庆市,忠县', `level`='3', `pinyin`='zhongxian', `code`='023', `zip_code`='404300', `first`='Z', `lng`='108.03689', `lat`='30.28898' WHERE (`id`='2353');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='开县', `name`='开县', `merger_name`='中国,重庆,重庆市,开县', `level`='3', `pinyin`='kaixian', `code`='023', `zip_code`='405400', `first`='K', `lng`='108.39306', `lat`='31.16095' WHERE (`id`='2354');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='云阳', `name`='云阳县', `merger_name`='中国,重庆,重庆市,云阳县', `level`='3', `pinyin`='yunyang', `code`='023', `zip_code`='404500', `first`='Y', `lng`='108.69726', `lat`='30.93062' WHERE (`id`='2355');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='奉节', `name`='奉节县', `merger_name`='中国,重庆,重庆市,奉节县', `level`='3', `pinyin`='fengjie', `code`='023', `zip_code`='404600', `first`='F', `lng`='109.46478', `lat`='31.01825' WHERE (`id`='2356');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='巫山', `name`='巫山县', `merger_name`='中国,重庆,重庆市,巫山县', `level`='3', `pinyin`='wushan', `code`='023', `zip_code`='404700', `first`='W', `lng`='109.87814', `lat`='31.07458' WHERE (`id`='2357');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='巫溪', `name`='巫溪县', `merger_name`='中国,重庆,重庆市,巫溪县', `level`='3', `pinyin`='wuxi', `code`='023', `zip_code`='405800', `first`='W', `lng`='109.63128', `lat`='31.39756' WHERE (`id`='2358');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='石柱', `name`='石柱土家族自治县', `merger_name`='中国,重庆,重庆市,石柱土家族自治县', `level`='3', `pinyin`='shizhu', `code`='023', `zip_code`='409100', `first`='S', `lng`='108.11389', `lat`='30.00054' WHERE (`id`='2359');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='秀山', `name`='秀山土家族苗族自治县', `merger_name`='中国,重庆,重庆市,秀山土家族苗族自治县', `level`='3', `pinyin`='xiushan', `code`='023', `zip_code`='409900', `first`='X', `lng`='108.98861', `lat`='28.45062' WHERE (`id`='2360');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='酉阳', `name`='酉阳土家族苗族自治县', `merger_name`='中国,重庆,重庆市,酉阳土家族苗族自治县', `level`='3', `pinyin`='youyang', `code`='023', `zip_code`='409800', `first`='Y', `lng`='108.77212', `lat`='28.8446' WHERE (`id`='2361');
UPDATE `yoshop_region` SET `pid`='2363', `shortname`='彭水', `name`='彭水苗族土家族自治县', `merger_name`='中国,重庆,重庆市,彭水苗族土家族自治县', `level`='3', `pinyin`='pengshui', `code`='023', `zip_code`='409600', `first`='P', `lng`='108.16638', `lat`='29.29516' WHERE (`id`='2362');
DELETE FROM `yoshop_region` WHERE (`id`='2364');
DELETE FROM `yoshop_region` WHERE (`id`='2365');
DELETE FROM `yoshop_region` WHERE (`id`='2366');
ALTER TABLE `yoshop_goods_sku`
MODIFY COLUMN `goods_sales` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品销量(废弃)' AFTER `stock_num`;
ALTER TABLE `yoshop_sharing_goods_sku`
MODIFY COLUMN `goods_sales` int(11) UNSIGNED NOT NULL DEFAULT 0 COMMENT '商品销量(废弃)' AFTER `stock_num`;

View File

@ -0,0 +1,15 @@
UPDATE `yoshop_region` SET `name`='直辖县级',`merger_name`='中国,湖北省,直辖县级' WHERE (`id`='1822');
UPDATE `yoshop_region` SET `merger_name`='中国,湖北省,直辖县级,仙桃市' WHERE (`id`='1823');
UPDATE `yoshop_region` SET `merger_name`='中国,湖北省,直辖县级,潜江市' WHERE (`id`='1824');
UPDATE `yoshop_region` SET `merger_name`='中国,湖北省,直辖县级,天门市' WHERE (`id`='1825');
UPDATE `yoshop_region` SET `merger_name`='中国,湖北省,直辖县级,神农架林区' WHERE (`id`='1826');
UPDATE `yoshop_region` SET `name`='吐鲁番市', `merger_name`='中国,新疆维吾尔自治区,吐鲁番市' WHERE (`id`='3221');
UPDATE `yoshop_region` SET `name`='哈密市', `merger_name`='中国,新疆维吾尔自治区,哈密市' WHERE (`id`='3225');

View File

@ -0,0 +1,4 @@
INSERT INTO `yoshop_store_access` VALUES ('11003', '数据统计', 'statistics.data/index', '0', '138', '1572507520', '1572507520');

View File

@ -0,0 +1,5 @@
# 用户记录表:新增伪删除字段
ALTER TABLE `yoshop_user`
ADD COLUMN `is_delete` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除' AFTER `money`;

View File

@ -0,0 +1,219 @@
# 微信小程序记录表:删除冗余字段
ALTER TABLE `yoshop_wxapp`
DROP COLUMN `app_name`,
DROP COLUMN `is_service`,
DROP COLUMN `service_image_id`,
DROP COLUMN `is_phone`,
DROP COLUMN `phone_no`,
DROP COLUMN `phone_image_id`;
# 微信小程序记录表:新增是否回收字段
ALTER TABLE `yoshop_wxapp`
ADD COLUMN `is_recycle` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否回收' AFTER `apikey`;
# 微信小程序记录表:新增伪删除字段
ALTER TABLE `yoshop_wxapp`
ADD COLUMN `is_delete` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除' AFTER `is_recycle`;
# 超管用户记录表
DROP TABLE IF EXISTS `yoshop_admin_user`;
CREATE TABLE `yoshop_admin_user` (
`admin_user_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`user_name` varchar(255) NOT NULL DEFAULT '' COMMENT '用户名',
`password` varchar(255) NOT NULL DEFAULT '' COMMENT '登录密码',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) NOT NULL COMMENT '更新时间',
PRIMARY KEY (`admin_user_id`),
KEY `user_name` (`user_name`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='超管用户记录表';
INSERT INTO `yoshop_admin_user` (`user_name`, `password`, `create_time`, `update_time`) VALUES ('admin', '9ae7b2e6f25c907a1fc81b503b16e25f', '1529926348', '1540194026');
# 商家用户记录表:新增是否为超级管理员字段
ALTER TABLE `yoshop_store_user`
ADD COLUMN `is_super` tinyint(3) UNSIGNED NOT NULL DEFAULT 1 COMMENT '是否为超级管理员' AFTER `password`;
# 商家用户记录表:新增伪删除字段
ALTER TABLE `yoshop_store_user`
ADD COLUMN `is_delete` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 COMMENT '是否删除' AFTER `is_super`;
# 商家用户记录表:新增姓名字段
ALTER TABLE `yoshop_store_user`
ADD COLUMN `real_name` varchar(255) NOT NULL DEFAULT '' COMMENT '姓名' AFTER `password`;
# 商家用户记录表:设置默认姓名
UPDATE `yoshop_store_user` SET `real_name` = '管理员' WHERE 1;
# 商家用户记录表:删除用户名唯一索引
ALTER TABLE `yoshop_store_user`
DROP INDEX `user_name` ,
ADD INDEX `user_name` (`user_name`);
# 商家用户权限表
CREATE TABLE `yoshop_store_access` (
`access_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`name` varchar(255) NOT NULL DEFAULT '' COMMENT '权限名称',
`url` varchar(255) NOT NULL DEFAULT '' COMMENT '权限url',
`parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级id',
`sort` tinyint(3) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`access_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10108 DEFAULT CHARSET=utf8 COMMENT='商家用户权限表';
INSERT INTO `yoshop_store_access` VALUES ('10001', '首页', 'index/index', '0', '100', '1540628721', '1540781975');
INSERT INTO `yoshop_store_access` VALUES ('10002', '管理员', 'store', '0', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10003', '管理员管理', 'store.user', '10002', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10004', '管理员列表', 'store.user/index', '10003', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10005', '添加管理员', 'store.user/add', '10003', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10006', '编辑管理员', 'store.user/edit', '10003', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10007', '删除管理员', 'store.user/delete', '10003', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10008', '角色管理', 'store.role', '10002', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10009', '角色列表', 'store.role/index', '10008', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10010', '添加角色', 'store.role/add', '10008', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10011', '编辑角色', 'store.role/edit', '10008', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10012', '删除角色', 'store.role/delete', '10008', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10013', '权限管理', 'store.access', '10002', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10014', '权限列表', 'store.access/index', '10013', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10015', '添加权限', 'store.access/add', '10013', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10016', '编辑权限', 'store.access/edit', '10013', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10017', '删除权限', 'store.access/delete', '10013', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10018', '商品管理', 'goods', '0', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10019', '商品管理', 'goods', '10018', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10020', '商品列表', 'goods/index', '10019', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10021', '添加商品', 'goods/add', '10019', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10022', '编辑商品', 'goods/edit', '10019', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10023', '复制商品', 'goods/copy', '10019', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10024', '删除商品', 'goods/delete', '10019', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10025', '商品上下架', 'goods/state', '10019', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10026', '商品分类', 'goods.category', '10018', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10027', '分类列表', 'goods.category/index', '10026', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10028', '添加分类', 'goods.category/add', '10026', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10029', '编辑分类', 'goods.category/edit', '10026', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10030', '删除分类', 'goods.category/delete', '10026', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10031', '商品评价', 'goods.comment', '10018', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10032', '评价列表', 'goods.comment/index', '10031', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10033', '评价详情', 'goods.comment/detail', '10031', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10034', '删除评价', 'goods.comment/delete', '10031', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10035', '订单管理', 'order', '0', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10036', '订单列表', '', '10035', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10037', '待发货', 'order/delivery_list', '10036', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10038', '待收货', 'order/receipt_list', '10036', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10039', '待付款', 'order/pay_list', '10036', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10040', '已完成', 'order/complete_list', '10036', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10041', '已取消', 'order/cancel_list', '10036', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10042', '全部订单', 'order/all_list', '10036', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10043', '订单详情', '', '10035', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10044', '详情信息', 'order/detail', '10043', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10045', '确认发货', 'order/delivery', '10043', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10046', '修改订单价格', 'order/updateprice', '10043', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10047', '订单导出', 'order.operate/export', '10035', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10048', '批量发货', 'order.operate/batchdelivery', '10035', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10049', '用户管理', 'user', '0', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10050', '用户列表', 'user/index', '10049', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10051', '删除用户', 'user/delete', '10049', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10052', '营销设置', 'market', '0', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10053', '优惠券', 'coupon', '10052', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10054', '优惠券列表', 'market.coupon/index', '10053', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10055', '新增优惠券', 'market.coupon/add', '10053', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10056', '编辑优惠券', 'market.coupon/edit', '10053', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10057', '删除优惠券', 'market.coupon/delete', '10053', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10058', '领取记录', 'market.coupon/receive', '10053', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10059', '小程序', 'wxapp', '0', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10060', '小程序设置', 'wxapp/setting', '10059', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10061', '页面管理', 'wxapp.page', '10059', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10062', '页面设计', '', '10061', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10063', '页面列表', 'wxapp.page/index', '10062', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10064', '新增页面', 'wxapp.page/add', '10062', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10065', '编辑页面', 'wxapp.page/edit', '10062', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10066', '设为首页', 'wxapp.page/sethome', '10062', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10067', '分类页模板', 'wxapp.page/category', '10061', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10068', '页面链接', 'wxapp.page/links', '10061', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10069', '帮助中心', 'wxapp.help', '10059', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10070', '帮助列表', 'wxapp.help/index', '10069', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10071', '新增帮助', 'wxapp.help/add', '10069', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10072', '编辑帮助', 'wxapp.help/edit', '10069', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10073', '删除帮助', 'wxapp.help/delete', '10069', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10074', '应用中心', 'apps', '0', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10075', '分销中心', 'apps.dealer', '10074', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10076', '入驻申请', 'apps.dealer.apply', '10075', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10077', '申请列表', 'apps.dealer.apply/index', '10076', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10078', '分销商审核', 'apps.dealer.apply/submit', '10076', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10079', '分销商用户', 'apps.dealer.user', '10075', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10080', '分销商列表', 'apps.dealer.user/index', '10079', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10081', '删除分销商', 'apps.dealer.user/delete', '10079', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10082', '分销商二维码', 'apps.dealer.user/qrcode', '10079', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10083', '分销订单', 'apps.dealer.order/index', '10075', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10084', '提现申请', 'apps.dealer.withdraw', '10075', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10085', '申请列表', 'apps.dealer.withdraw/index', '10084', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10086', '提现审核', 'apps.dealer.withdraw/submit', '10084', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10087', '确认打款', 'apps.dealer.withdraw/money', '10084', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10088', '分销设置', 'apps.dealer.setting/index', '10075', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10089', '分销海报', 'apps.dealer.setting/qrcode', '10075', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10090', '设置', 'setting', '0', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10091', '商城设置', 'setting/store', '10090', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10092', '交易设置', 'setting/trade', '10090', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10093', '配送设置', 'setting.delivery', '10090', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10094', '运费模板列表', 'setting.delivery/index', '10093', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10095', '新增运费模板', 'setting.delivery/add', '10093', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10096', '编辑运费模板', 'setting.delivery/edit', '10093', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10097', '删除运费模板', 'setting.delivery/delete', '10093', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10098', '物流公司', 'setting.express', '10090', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10099', '物流公司列表', 'setting.express/index', '10098', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10100', '新增物流公司', 'setting.express/add', '10098', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10101', '编辑物流公司', 'setting.express/edit', '10098', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10102', '删除物流公司', 'setting.express/delete', '10098', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10103', '短信通知', 'setting/sms', '10090', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10104', '模板消息', 'setting/tplmsg', '10090', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10105', '上传设置', 'setting/storage', '10090', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10106', '其他', '', '10090', '100', '1540628721', '1540628721');
INSERT INTO `yoshop_store_access` VALUES ('10107', '清理缓存', 'setting.cache/clear', '10106', '100', '1540628721', '1540628721');
# 商家用户角色表
CREATE TABLE `yoshop_store_role` (
`role_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '角色id',
`role_name` varchar(50) NOT NULL DEFAULT '' COMMENT '角色名称',
`parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '父级角色id',
`sort` tinyint(3) unsigned NOT NULL DEFAULT '100' COMMENT '排序(数字越小越靠前)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家用户角色表';
# 商家用户角色权限关系表
CREATE TABLE `yoshop_store_role_access` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`role_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '角色id',
`access_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '权限id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`),
KEY `role_id` (`role_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家用户角色权限关系表';
# 商家用户角色记录表
CREATE TABLE `yoshop_store_user_role` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`store_user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '超管用户id',
`role_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '角色id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`),
KEY `admin_user_id` (`store_user_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商家用户角色记录表';

View File

@ -0,0 +1,83 @@
# 微信小程序记录表:新增证书文件字段
ALTER TABLE `yoshop_wxapp`
ADD COLUMN `cert_pem` longtext COMMENT '证书文件cert' AFTER `apikey`,
ADD COLUMN `key_pem` longtext COMMENT '证书文件key' AFTER `cert_pem`;
# 订单记录表:订单状态 新增21待取消状态
ALTER TABLE `yoshop_order`
MODIFY COLUMN `order_status` tinyint(3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '订单状态(10进行中 20取消 21待取消 30已完成)' AFTER `receipt_time`;
# 退货地址记录表
CREATE TABLE `yoshop_return_address` (
`address_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '退货地址id',
`name` varchar(30) NOT NULL DEFAULT '' COMMENT '收货人姓名',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
`detail` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
`sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序 (数字越小越靠前)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`address_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='退货地址记录表';
# 售后单记录表
CREATE TABLE `yoshop_order_refund` (
`order_refund_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '售后单id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单id',
`order_goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单商品id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '售后类型(10退货退款 20换货)',
`apply_desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '用户申请原因(说明)',
`is_agree` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商家审核状态(0待审核 10已同意 20已拒绝)',
`refuse_desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '商家拒绝原因(说明)',
`refund_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际退款金额',
`is_user_send` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '用户是否发货(0未发货 1已发货)',
`send_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户发货时间',
`express_id` varchar(32) NOT NULL DEFAULT '' COMMENT '用户发货物流公司id',
`express_no` varchar(32) NOT NULL DEFAULT '' COMMENT '用户发货物流单号',
`is_receipt` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商家收货状态(0未收货 1已收货)',
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '售后单状态(0进行中 10已拒绝 20已完成 30已取消)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`order_refund_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='售后单记录表';
# 售后单退货地址记录表
CREATE TABLE `yoshop_order_refund_address` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_refund_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '售后单id',
`name` varchar(30) NOT NULL DEFAULT '' COMMENT '收货人姓名',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
`detail` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='售后单退货地址记录表';
# 售后单图片记录表
CREATE TABLE `yoshop_order_refund_image` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_refund_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '售后单id',
`image_id` int(11) NOT NULL DEFAULT '0' COMMENT '图片id(关联文件记录表)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='售后单图片记录表';
# 新增权限记录
INSERT INTO `yoshop_store_access` (`name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('审核用户取消申请', 'order.operate/confirmcancel', '10043', '100', '1542163260', '1542163260');
INSERT INTO `yoshop_store_access` (`name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('售后管理', 'order.refund', '10035', '100', '1542161684', '1542161684');
INSERT INTO `yoshop_store_access` (`name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('售后列表', 'order.refund/index', '10108', '100', '1542161714', '1542161714');
INSERT INTO `yoshop_store_access` (`name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('售后详情', 'order.refund/detail', '10108', '100', '1542161736', '1542161736');
INSERT INTO `yoshop_store_access` (`name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('审核售后单', 'order.refund/audit', '10108', '100', '1542162196', '1542162196');
INSERT INTO `yoshop_store_access` (`name`, `url`, `parent_id`, `sort`, `create_time`, `update_time`) VALUES ('确认收货并退款', 'order.refund/receipt', '10108', '100', '1542162231', '1542162231');

View File

@ -0,0 +1,11 @@
# 商品规格表:规格图片
ALTER TABLE `yoshop_goods_sku`
ADD COLUMN `image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格图片id' AFTER `spec_sku_id`;
# 用户收货地址表:新市辖区
ALTER TABLE `yoshop_user_address`
ADD COLUMN `district` varchar(255) NULL DEFAULT '' COMMENT '新市辖区(该字段用于记录region表中没有的市辖区)' AFTER `region_id`;

View File

@ -0,0 +1,370 @@
#商品记录表:新增商品卖点字段
ALTER TABLE `yoshop_goods`
ADD COLUMN `selling_point` varchar(500) NOT NULL DEFAULT '' COMMENT '商品卖点' AFTER `category_id`;
# 小程序prepay_id记录表新增订单类型
ALTER TABLE `yoshop_wxapp_prepay_id`
ADD COLUMN `order_type` tinyint(3) UNSIGNED NOT NULL DEFAULT 10 COMMENT '订单类型(10商城订单 20拼团订单)' AFTER `order_id`;
# 分销商订单记录表:新增订单类型
ALTER TABLE `yoshop_dealer_order`
ADD COLUMN `order_type` TINYINT (3) UNSIGNED NOT NULL DEFAULT '10' COMMENT '订单类型(10商城订单 20拼团订单)' AFTER `order_id`;
# 新增:拼团拼单记录表
CREATE TABLE `yoshop_sharing_active` (
`active_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '拼单id',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼团商品id',
`people` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '成团人数',
`actual_people` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前已拼人数',
`creator_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '团长用户id',
`end_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼单结束时间',
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '拼单状态(0未拼单 10拼单中 20拼单成功 30拼单失败)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`active_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团拼单记录表';
# 新增:拼团拼单成员记录表
CREATE TABLE `yoshop_sharing_active_users` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`active_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼单id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼团订单id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`is_creator` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否为创建者',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团拼单成员记录表';
# 新增:拼团商品分类表
CREATE TABLE `yoshop_sharing_category` (
`category_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品分类id',
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '分类名称',
`parent_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '上级分类id',
`image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '分类图片id',
`sort` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '排序方式(数字越小越靠前)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团商品分类表';
# 新增:拼团商品评价表
CREATE TABLE `yoshop_sharing_comment` (
`comment_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '评价id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼团订单id',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼团商品id',
`order_goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单商品id',
`score` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '评分(10好评 20中评 30差评)',
`content` text NOT NULL COMMENT '评价内容',
`is_picture` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否为图片评价',
`sort` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '评价排序',
`status` tinyint(3) unsigned NOT NULL DEFAULT '1' COMMENT '状态(0隐藏 1显示)',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`is_delete` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '软删除',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`comment_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团商品评价表';
# 新增:拼团评价图片记录表
CREATE TABLE `yoshop_sharing_comment_image` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`comment_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '评价id',
`image_id` int(11) NOT NULL DEFAULT '0' COMMENT '图片id(关联文件记录表)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团评价图片记录表';
# 新增:拼团商品记录表
CREATE TABLE `yoshop_sharing_goods` (
`goods_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '拼团商品id',
`goods_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称',
`category_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品分类id',
`selling_point` varchar(500) NOT NULL DEFAULT '' COMMENT '商品卖点',
`people` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '成团人数',
`group_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '成团有效时间(单位:小时)',
`is_alone` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否允许单买(0不允许 1允许)',
`spec_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商品规格(10单规格 20多规格)',
`deduct_stock_type` tinyint(3) unsigned NOT NULL DEFAULT '20' COMMENT '库存计算方式(10下单减库存 20付款减库存)',
`content` longtext NOT NULL COMMENT '商品详情',
`sales_initial` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '初始销量',
`sales_actual` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '实际销量',
`goods_sort` int(11) unsigned NOT NULL DEFAULT '100' COMMENT '商品排序(数字越小越靠前)',
`delivery_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '配送模板id',
`goods_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '商品状态(10上架 20下架)',
`is_delete` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否删除',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`goods_id`),
KEY `category_id` (`category_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团商品记录表';
# 新增:商品图片记录表
CREATE TABLE `yoshop_sharing_goods_image` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',
`image_id` int(11) NOT NULL COMMENT '图片id(关联文件记录表)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='商品图片记录表';
# 新增:拼团商品规格表
CREATE TABLE `yoshop_sharing_goods_sku` (
`goods_sku_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '商品规格id',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',
`spec_sku_id` varchar(255) NOT NULL DEFAULT '0' COMMENT '商品sku记录索引(由规格id组成)',
`image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格图片id',
`goods_no` varchar(100) NOT NULL DEFAULT '' COMMENT '商品编码',
`sharing_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '拼团价格',
`goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格(单买价)',
`line_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品划线价',
`stock_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '当前库存数量',
`goods_sales` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品销量',
`goods_weight` double unsigned NOT NULL DEFAULT '0' COMMENT '商品重量(Kg)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`goods_sku_id`),
UNIQUE KEY `sku_idx` (`goods_id`,`spec_sku_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团商品规格表';
# 新增:拼团商品与规格值关系记录表
CREATE TABLE `yoshop_sharing_goods_spec_rel` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品id',
`spec_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格组id',
`spec_value_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '规格值id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团商品与规格值关系记录表';
# 新增:拼团订单记录表
CREATE TABLE `yoshop_sharing_order` (
`order_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '订单id',
`order_no` varchar(20) NOT NULL DEFAULT '' COMMENT '订单号',
`order_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '订单类型(10单独购买 20拼团)',
`active_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼单id',
`total_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '订单金额(不含运费)',
`coupon_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '优惠券id',
`coupon_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '优惠券抵扣金额',
`pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际付款金额(包含运费、优惠)',
`update_price` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '后台修改的订单金额(差价)',
`buyer_remark` varchar(255) NOT NULL DEFAULT '' COMMENT '买家留言',
`pay_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '付款状态(10未付款 20已付款)',
`pay_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '付款时间',
`express_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '运费金额',
`express_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '物流公司id',
`express_company` varchar(50) NOT NULL DEFAULT '' COMMENT '物流公司',
`express_no` varchar(50) NOT NULL DEFAULT '' COMMENT '物流单号',
`delivery_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '发货状态(10未发货 20已发货)',
`delivery_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '发货时间',
`receipt_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '收货状态(10未收货 20已收货)',
`receipt_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '收货时间',
`order_status` tinyint(3) unsigned NOT NULL DEFAULT '10' COMMENT '订单状态(10进行中 20已取消 21待取消 30已完成)',
`is_refund` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '拼团未成功退款(0未退款 1已退款)',
`transaction_id` varchar(30) NOT NULL DEFAULT '' COMMENT '微信支付交易号',
`is_comment` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否已评价(0否 1是)',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`order_id`),
UNIQUE KEY `order_no` (`order_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团订单记录表';
# 新增:拼团订单收货地址记录表
CREATE TABLE `yoshop_sharing_order_address` (
`order_address_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '地址id',
`name` varchar(30) NOT NULL DEFAULT '' COMMENT '收货人姓名',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
`province_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在省份id',
`city_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在城市id',
`region_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '所在区id',
`detail` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼团订单id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`order_address_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团订单收货地址记录表';
# 新增:拼团订单商品记录表
CREATE TABLE `yoshop_sharing_order_goods` (
`order_goods_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼团商品id',
`goods_name` varchar(255) NOT NULL DEFAULT '' COMMENT '商品名称',
`image_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品封面图id',
`selling_point` varchar(500) NOT NULL DEFAULT '' COMMENT '商品卖点',
`people` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '成团人数',
`group_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '成团有效时间(单位:小时)',
`is_alone` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '是否允许单买(0不允许 1允许)',
`deduct_stock_type` tinyint(3) unsigned NOT NULL DEFAULT '20' COMMENT '库存计算方式(10下单减库存 20付款减库存)',
`spec_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '规格类型(10单规格 20多规格)',
`spec_sku_id` varchar(255) NOT NULL DEFAULT '' COMMENT '商品sku标识',
`goods_sku_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '商品规格id',
`goods_attr` varchar(500) NOT NULL DEFAULT '' COMMENT '商品规格信息',
`content` longtext NOT NULL COMMENT '商品详情',
`goods_no` varchar(100) NOT NULL DEFAULT '' COMMENT '商品编码',
`goods_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品价格',
`line_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品划线价',
`goods_weight` double unsigned NOT NULL DEFAULT '0' COMMENT '商品重量(Kg)',
`total_num` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '购买数量',
`total_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '商品总价(数量×单价)',
`total_pay_price` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际付款价(包含优惠、折扣)',
`is_comment` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '是否已评价(0否 1是)',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼团订单id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`order_goods_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团订单商品记录表';
# 新增:拼团售后单记录表
CREATE TABLE `yoshop_sharing_order_refund` (
`order_refund_id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '售后单id',
`order_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '拼团订单id',
`order_goods_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '订单商品id',
`user_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户id',
`type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '售后类型(10退货退款 20换货)',
`apply_desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '用户申请原因(说明)',
`is_agree` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商家审核状态(0待审核 10已同意 20已拒绝)',
`refuse_desc` varchar(1000) NOT NULL DEFAULT '' COMMENT '商家拒绝原因(说明)',
`refund_money` decimal(10,2) unsigned NOT NULL DEFAULT '0.00' COMMENT '实际退款金额',
`is_user_send` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '用户是否发货(0未发货 1已发货)',
`send_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '用户发货时间',
`express_id` varchar(32) NOT NULL DEFAULT '' COMMENT '用户发货物流公司id',
`express_no` varchar(32) NOT NULL DEFAULT '' COMMENT '用户发货物流单号',
`is_receipt` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '商家收货状态(0未收货 1已收货)',
`status` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT '售后单状态(0进行中 10已拒绝 20已完成 30已取消)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
PRIMARY KEY (`order_refund_id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团售后单记录表';
# 新增:拼团售后单退货地址记录表
CREATE TABLE `yoshop_sharing_order_refund_address` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_refund_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '售后单id',
`name` varchar(30) NOT NULL DEFAULT '' COMMENT '收货人姓名',
`phone` varchar(20) NOT NULL DEFAULT '' COMMENT '联系电话',
`detail` varchar(255) NOT NULL DEFAULT '' COMMENT '详细地址',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团售后单退货地址记录表';
# 新增:拼团售后单图片记录表
CREATE TABLE `yoshop_sharing_order_refund_image` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT '主键id',
`order_refund_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '售后单id',
`image_id` int(11) NOT NULL DEFAULT '0' COMMENT '图片id(关联文件记录表)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`create_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '创建时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=10001 DEFAULT CHARSET=utf8 COMMENT='拼团售后单图片记录表';
# 新增:拼团设置表
CREATE TABLE `yoshop_sharing_setting` (
`key` varchar(30) NOT NULL DEFAULT '' COMMENT '设置项标示',
`describe` varchar(255) NOT NULL DEFAULT '' COMMENT '设置项描述',
`values` mediumtext NOT NULL COMMENT '设置内容(json格式)',
`wxapp_id` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '小程序id',
`update_time` int(11) unsigned NOT NULL DEFAULT '0' COMMENT '更新时间',
UNIQUE KEY `unique_key` (`key`,`wxapp_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='拼团设置表';
# 拼团管理
INSERT INTO `yoshop_store_access` VALUES ('10300', '拼团管理', 'apps.sharing', '10074', '100', '1544601161', '1544601161');
# 商品分类
INSERT INTO `yoshop_store_access` VALUES ('10301', '商品分类', 'apps.sharing.category', '10300', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10302', '分类列表', 'apps.sharing.category/index', '10301', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10303', '添加分类', 'apps.sharing.category/add', '10301', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10304', '编辑分类', 'apps.sharing.category/edit', '10301', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10305', '删除分类', 'apps.sharing.category/delete', '10301', '100', '1544601378', '1544601378');
# 拼团商品管理
INSERT INTO `yoshop_store_access` VALUES ('10306', '商品管理', 'apps.sharing.goods', '10300', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10307', '商品列表', 'apps.sharing.goods/index', '10306', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10308', '添加商品', 'apps.sharing.goods/add', '10306', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10309', '编辑商品', 'apps.sharing.goods/edit', '10306', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10310', '复制商品', 'apps.sharing.goods/copy', '10306', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10311', '删除商品', 'apps.sharing.goods/delete', '10306', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10312', '商品上下架', 'apps.sharing.goods/state', '10306', '100', '1544601378', '1544601378');
# 拼单管理
INSERT INTO `yoshop_store_access` VALUES ('10313', '拼单管理', 'apps.sharing.active', '10300', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10314', '拼单列表', 'apps.sharing.active/index', '10313', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10315', '拼单成员列表', 'apps.sharing.active/users', '10313', '100', '1544601378', '1544601378');
# 拼团订单
INSERT INTO `yoshop_store_access` VALUES ('10316', '订单管理', 'apps.sharing.order', '10300', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10317', '订单列表', 'apps.sharing.order/index', '10316', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10318', '订单详情', '', '10316', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10319', '详情信息', 'apps.sharing.order/detail', '10318', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10320', '确认发货', 'apps.sharing.order/delivery', '10318', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10321', '修改订单价格', 'apps.sharing.order/updateprice', '10318', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10322', '审核用户取消订单', 'apps.sharing.order/confirmcancel', '10318', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10323', '拼团失败手动退款', 'apps.sharing.order/refund', '10318', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10324', '订单导出', 'apps.sharing.order.operate/export', '10316', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10325', '批量发货', 'apps.sharing.order.operate/batchdelivery', '10316', '100', '1544601378', '1544601378');
# 售后管理
INSERT INTO `yoshop_store_access` VALUES ('10326', '售后管理', 'apps.sharing.order.refund', '10300', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10327', '售后列表', 'apps.sharing.order.refund/index', '10326', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10328', '售后详情', 'apps.sharing.order.refund/detail', '10326', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10329', '审核售后单', 'apps.sharing.order.refund/audit', '10326', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10330', '确认收货并退款', 'apps.sharing.order.refund/receipt', '10326', '100', '1544601378', '1544601378');
# 商品评价
INSERT INTO `yoshop_store_access` VALUES ('10331', '商品评价', 'apps.sharing.comment', '10300', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10332', '评价列表', 'apps.sharing.comment/index', '10331', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10333', '评价详情', 'apps.sharing.comment/detail', '10331', '100', '1544601378', '1544601378');
INSERT INTO `yoshop_store_access` VALUES ('10334', '删除评价', 'apps.sharing.comment/delete', '10331', '100', '1544601378', '1544601378');
# 拼团设置
INSERT INTO `yoshop_store_access` VALUES ('10335', '拼团设置', 'apps.sharing.setting/index', '10300', '100', '1544601378', '1544601378');

598
doc/更新日志.txt Normal file
View File

@ -0,0 +1,598 @@

### v1.1.38 更新日志 ###
修复:订单确认页收货地址提示
修复:后台拼团商品列表状态筛选
修复:秒杀订单并发库存问题
修复:后台编辑门店后坐标不准确
新增:后台分销中心编辑分销商用户
优化:删除分销商清空推荐关系
优化:删除用户时删除上级推荐关系
--------------------------------
注:本次更新须重新发布小程序
### v1.1.37 更新日志 ###
优化:下单运费模板计算方式
优化:已付款拼团订单不允许取消
优化:后台砍价活动时间选择
优化:权限管理新增数据统计项
新增首页DIY公众号关注组件
修复:用户充值自动匹配套餐
修复:后台新增管理员提示已存在
修复:图片库列表不显示回收站的文件
修复:订单详情页不显示详细地址
修复:秒杀会场页进入商品报错
--------------------------------
注:本次更新须重新发布小程序
### v1.1.36 更新日志 ###
优化:订单发货后即可申请售后
优化:图片库删除图片进入回收站
新增:后台数据统计模块
修复:删除会员等级提示存在会员
修复:小程序端 下单提示收货地址不存在
修复:小程序端 秒杀商品详情页价格联动
修复:小程序端 订单确认页has_error问题
修复:小程序端 拼团拼单页暂无现货按钮样式
--------------------------------
注:本次更新须重新发布小程序
### v1.1.35 更新日志 ###
优化:调整新授权登录方式
修复:后台门店坐标无法选择
修复:砍价会场页面报错(个别环境)
修复:不存在的收货城市不允许下单
修复:验证运费模板是否被商品使用
修复:复制参与活动的商品规格问题
修复:小程序端 文章详情页空格不解析
修复:小程序端 diy秒杀组件报错
修复:小程序端 秒杀商品页倒计时错误
--------------------------------
注:本次更新须重新发布小程序
### v1.1.34 更新日志 ###
优化:后台订单导出显示自提联系人
修复:后台门店坐标地图加载无效
修复:拼团订单结算错误
修复:秒杀进度数字精确度问题
修复:砍价商品正在砍价人数不正确
修复:砍价任务并发问题
修复:小程序端图片橱窗组样式错误
修复:小程序端富文本空格不生效
--------------------------------
注:本次更新须重新发布小程序
### v1.1.33 更新日志 ###
修复:砍价主商品下架详情页错误
修复php7环境秒杀首页报错
修复:秒杀商品商品海报错误
优化:余额支付订单支持小程序模板消息
修复:购买产品成为分销商报错
新增diy组件-秒杀商品组
--------------------------------
注:本次更新须重新发布小程序
### v1.1.32 更新日志 ###
优化:实际消费金额规则判断存在售后
优化:订单存在退款的商品不赠送积分
新增:新增营销模块整点秒杀
修复:超管后台商城列表不显示分页
修复:后台会员管理操作权限不正确
修复:收货地址不在配送区报错
修复取消订单恢复sku库存的bug
修复:后台更新管理员时检测用户名重复
修复:小程序端 更新收货地址时提示失败
修复:小程序端 砍价商品详情页商品评价数量不正确
修复:小程序端 门店详情页转发链接错误
--------------------------------
注:本次更新须重新发布小程序
### v1.1.31 更新日志 ###
修复:用户可用积分不足无法抵扣问题
修复后台编辑商品compact方法报错
修复:拼团订单新增分销记录类型错误
新增:订单导出显示优惠抵扣后台改价等信息
新增:小票打印显示上门自提点及联系信息
优化:小程序端 砍价按钮重复点击问题
优化:小程序端 商品详情页规格过多时支持滚动
--------------------------------
注:本次更新须重新发布小程序
### v1.1.30 更新日志 ###
新增:小程序端积分明细页
新增:页面设计砍价商品组件
修复购物车同商品多sku数据错误
修复:默认购买商品积分赠送数量
--------------------------------
注:本次更新须重新发布小程序
### v1.1.29 更新日志 ###
优化:小程序端 商品列表api
优化:小程序端 记忆购物车选择的商品
新增:用户积分功能(支持积分赠送、积分抵扣)
新增:后台设置是否允许用户充值(隐藏充值入口)
修复:砍价商品海报二维码链接
--------------------------------
注:本次更新须重新发布小程序
### v1.1.28 更新日志 ###
优化:监听砍价任务结束
修复:订单结算优惠券价格计算问题
修复:后台砍价活动状态设置
修复:砍价页面分享链接不正确
修复订单确认页delivery报错
修复:后台编辑运费模版报错
新增:小程序端个人中心我的砍价
--------------------------------
注:本次更新须重新发布小程序
### v1.1.27 更新日志 ###
优化:后台优惠券管理折扣率精确度
优化会员折扣比例精确小数点2位数
优化:小程序端验证输入的商品购买数量
优化:用户首次进入充值中心提示授权
新增:新增营销模块砍价活动
修复:后台拼团复制主商城商品提示无权限
修复:后台导出订单收货地址地级市错误
修复未付款订单商品SKU不存在时提示
修复:小程序端在线客服图标显示
修复:记忆用户自提订单联系方式
--------------------------------
注:本次更新须重新发布小程序
### v1.1.26 更新日志 ###
修复后台修改会员等级bug
修复:拼团商品生成海报图片错误
修复:订单自动关闭时回退商品库存、用户优惠券
修复:拼团商品下单减库存无效
优化:记忆用户自提订单联系方式
--------------------------------
注:本次更新须重新发布小程序
### v1.1.25 更新日志 ###
优化:用户取消订单时回退优惠券
优化:小程序端 订单详情页快捷导航组件
优化:后台选择用户添加筛选条件
优化:后台选择商品添加筛选条件
新增:会员等级功能
修复后台编辑一级分类bug
修复:拼团商品无法使用优惠券
修复:运费金额过大时计算错误
--------------------------------
注:本次更新须重新发布小程序
### v1.1.24 更新日志 ###
优化:小程序端授权登录错误提示
优化收货地址的电话支持17x手机号
新增:微信好物圈同步功能
修复:后台会员管理充值权限记录
修复:小程序端余额充值状态提示
修复:小程序端商品列表单行隐藏问题
修复:后台文件库列表不显示所属分组
修复:下单收货地址选择香港出错
--------------------------------
注:本次更新须重新发布小程序
### v1.1.23 更新日志 ###
修复:订单管理查询条件情况下导出报错
新增diy商品组件支持列表显示
新增:后台营销管理活跃用户列表
新增:后台营销管理发送推送消息
优化:超管后台环境监测临时文件目录
优化订单表增加is_delete条件
优化:小程序端 商品列表显示卖点和销量
优化:小程序端 商品列表页记忆显示方式
优化:小程序端 商品购买数量支持自定义输入
优化:小程序端 拼单详情页面添加快捷导航组件
--------------------------------
注:本次更新须重新发布小程序
### v1.1.22 更新日志 ###
修复:拼团订单退款到用户余额
修复:充值自定义金额时报错
修复:拼团订单余额支付失败
新增:后台订单导出显示支付方式
新增:后台商城设置支持的配送方式
新增:自提订单需填写联系信息
--------------------------------
注:本次更新须重新发布小程序
### v1.1.21 更新日志 ###
修复:后台拼团订单管理搜索查询失效
修复:后台订单管理按时间筛选报错
修复:后台设置角色权限不显示菜单问题
新增:用户余额管理(充值套餐、余额支付)
新增:后台查看指定用户的订单记录
--------------------------------
注:本次更新须重新发布小程序
### v1.1.20 更新日志 ###
优化阿里云OSS支持https域名
修复:取消订单时回退商品库存
修复:分销商下级团队列表已删除的用户
修复:图片上传到本地服务器时报错
新增:订单管理筛选条件配送方式、自提门店、用户昵称
新增:订单导出显示商品规格、配送方式、自提门店
优化:小程序端选择门店时无自提门店提示
优化:小程序端收货地址手机号验证规则
--------------------------------
注:本次更新须重新发布小程序
### v1.1.19 更新日志 ###
修复:小程序端 购物车添加不同规格的商品
修复:后台拼团订单导出时报错
新增:后台文件库管理
修复:后台首页统计已取消订单
优化:图片库弹窗显示完整的缩略图
优化:页面设计商品组件支持单列显示
--------------------------------
注:本次更新须重新发布小程序
### v1.1.18 更新日志 ###
优化:门店列表支持排序设置
优化:分销订单自动结算标记是否失效
优化:分销商订单列表数据获取方式
优化token令牌的生成规则
优化:小程序端导航条加载动画
优化:订单售后页面显示实付款金额
优化:查看门店位置显示名称和地址
新增DIY页面线下门店列表组件
修复:小程序端购物车报错(计算运费)
修复:保存小程序码文件报错
修复:后台文章列表分页
修复:小程序端商品详情购物车数量
修复:后台门店店员列表报错
修复:拼团商品无法选择收货地址
--------------------------------
注:本次更新须重新发布小程序
### v1.1.17 更新日志 ###
修复服务端php7.3环境下报错问题
修复新增商城时默认diy页面数据
修复后台运费模版页选择区域bug
新增:订单满额包邮功能
新增:门店自提核销功能
修复:小程序端 分享自定义专题页打开后是首页
优化:小程序端 分销商协议过长滚动
--------------------------------
注:本次更新须重新发布小程序
### v1.1.16 更新日志 ###
修复:后台页面设计无法删除默认数据
修复:页面设计图片橱窗组件报错
修复:拼团订单发放分销佣金出错
修复:后台编辑分类无法删除图片
修复:拼团商品列表价格排序问题
修复:后台配送模板设置错误
新增:分销商提现支持微信支付企业付款
新增:小票打印机管理
优化:小程序端文章详情页样式
注:本次更新须重新发布小程序
--------------------------------
### v1.1.15 更新日志 ###
修复:后台页面设计旧数据兼容性问题
修复:小程序端文章页分享错误
修复:小程序端文章列表标题超出未隐藏
修复:小程序端商品标题超出隐藏兼容性
新增:页面设计头条快报组件
优化升级thinkphp版本5.0.24
优化:轮播图组件支持设置切换时间
优化:商品组件支持显示划线价格
优化:富文本文字默认边距
优化:小程序端富文本图片加载时尺寸
注:本次更新须重新发布小程序
--------------------------------
### v1.1.14 更新日志 ###
修复:后台编辑小程序页面报错
修复:文章板块设置虚拟阅读量无效
修复自定义页面api数据格式不正确
新增:页面设计在线客服组件
修复:小程序端 个人中心菜单formid收集
优化:小程序端 快捷导航组件样式
注:本次更新须重新发布小程序
--------------------------------
### v1.1.13 更新日志 ###
优化小程序DIY视频组件支持自动播放
优化:小程序端购物车商品总数量显示
优化:重构后台小程序页面设计
新增:后台富文本编辑器支持文件库图片
新增:后台富文本编辑器支持添加视频
新增:文章资讯板块
修复:多规格商品默认价格不正确问题
修复拼团商品与商城商品id一致生成海报错误
修复:获取拼团失败的订单过滤未付款订单
注:本次更新须重新发布小程序
--------------------------------
### v1.1.12 更新日志 ###
修复小程序端购物车is_delete报错问题
修复拼团DIY组件商品分类数据不正确
修复:分类页模板分享标题长度
修复:购物车结算商品数量问题
修复超管后台删除权限url报错
修复:小程序端客服图标不能点击问题
修复:小程序端拼单详情更多拼团跳转
优化:小程序端商品详情增加快捷导航
优化小程序端个人中心页面UI改版
优化:后台登录页面兼容适配
优化:待付款订单中不显示已取消订单
新增:商品管理支持单独分销设置
新增:支持分销商内购返一级佣金
新增:后台分销商列表查看下级用户
新增:支持购买指定商品成为分销商
注:本次更新须重新发布小程序
--------------------------------
### v1.1.11 更新日志 ###
修复DIY商品组件手动选择排序问题
修复:待付款订单不显示订单状态
修复:订单退款失败问题
修复:小程序端 更多拼团商品价格不正确
新增:拼团设置支持开启分销
新增:拼团拼单状态模板消息通知
优化:小程序端 订单列表分页加载
优化:小程序端 拼团首页分页加载
优化:小程序端 拼单详情页支持跳转更多拼团
优化:小程序端 拼团商品页面收集formId
注:本次更新须重新发布小程序
--------------------------------
### v1.1.10 更新日志 ###
优化:小程序端立即购买时关闭确认弹框
优化:小程序端拼团首页支持转发
优化:小程序端拼单详情页标签样式
修复:编辑微信支付证书文件缓存问题
修复:小程序端拼团商品分享链接错误
新增:后台小程序页面链接拼团页面
新增:小程序端拼团商品页显示进行中的拼团
新增:后台拼团管理支持复制主商城商品
修复:拼团订单列表发起支付错误
修复:小程序端领劵中心文字样式
修复IOS手机倒计时兼容性问题
注:本次更新须重新发布小程序
--------------------------------
### v1.1.9 更新日志 ###
修复thinkphp路由getshell漏洞重要
修复:后台首页统计中包含已删除的会员
修复:用户申请退货时未填写运单信息可提交
修复:小程序端生成二维码海报图缓存问题
修复:已领取的优惠券不自动过期问题
新增:商品管理商品卖点简述
新增:后台商品评价管理查看订单详情
新增:应用中心拼团管理模块
优化:后台列表页面兼容性问题
优化:小程序端显示用户已取消的订单
优化:环境检测中新增微信支付证书目录
注:本次更新须重新发布小程序
--------------------------------
### v1.1.8 更新日志 ###
修复:取消已付款订单时更改订单状态
修复:申请售后不上传图片时凭证报错
修复:后台售后单列表筛选错误
优化:发放分销订单佣金时重新计算佣金
优化:订单商品存在售后退款则不计算分销佣金
优化删除umeditor清空文档按钮
优化:收货地址兼容最新的市辖区
优化:小程序端售后详情显示已退款金额
新增:后台分销设置佣金结算天数
新增:用户售后单状态通知模板消息
新增:多规格商品支持单独封面图片
新增后台设置已完成订单n天内允许申请售后
注:本次更新须重新发布小程序
--------------------------------
### v1.1.7 更新日志 ###
新增:商户后台退货地址管理
新增:后台设置微信支付双向认证文件
新增:已付款订单用户申请取消并原路退回
新增:售后订单管理模块(退货退款、换货)
优化兼容非mysqlnd环境全等改为等于
优化:小程序端 改版商品详情页面SKU选择
优化:小程序端 操作按钮样式
优化:小程序端 删除保存图片分享朋友圈提示语
修复:多商家后台图片库文件未分离
修复:新增商城创建默认分类页模板记录
修复富文本编辑器p标签间距
修复:订单批量发货报错问题
修复:商户后台添加管理员用户名重复问题
修复:小程序端 富文本域名中带code解析异常
修复:小程序端 订单列表不显示评论按钮(个别环境)
注:本次更新须重新发布小程序
--------------------------------
### v1.1.6 更新日志 ###
新增:超管后台模块 (支持多开小程序商城)
新增:商家后台管理员模板 (支持角色管理和权限管理)
优化:商家后台订单列表添加时间筛选
优化:商家后台小程序设置敏感项星号隐藏
优化:自动删除购物车中失效的商品
修复:小程序端商品列表价格排序箭头顺序
注:本次更新无须重新发布小程序
--------------------------------
### v1.1.5 更新日志 ###
优化:小程序端富文本内容兼容性
优化:小程序端商品海报图默认高度
优化保存商品海报图显示loading
修复:小程序端扫码进入获取不到场景值
修复小程序端DIY富文本组件样式不生效问题
修复小程序端loading窗口不关闭的问题
注:本次更新须重新发布小程序
--------------------------------
### v1.1.4 更新日志 ###
新增:后台小程序分销中心链接
新增:后台订单导出功能
新增:后台订单批量发货功能
新增小程序页面DIY公告组
新增小程序页面DIY富文本组
新增:后台删除会员功能
新增:小程序端商品分享(海报二维码+转发)
优化:后台分销海报设置页面兼容性
优化:小程序端最近搜索不记录重复值
优化:小程序端商品列表价格筛选箭头
优化:小程序端商品详情富文本兼容性
修复小程序端banner组件图片高度兼容
修复:小程序端视频组件底部空白
修复:小程序端操作成功提示框失效问题
注:本次更新须重新发布小程序
--------------------------------
### v1.1.3 更新日志 ###
修复:删除分类时提示存在商品
修复:后台订单管理不显示改价按钮
修复后台编辑DIY页面名称不生效
优化后台订单改价不能为0元
优化:后台商品详情编辑器尺寸
新增:分销商中心功能
新增:后台商品列表一键上下架
新增:后台一键复制商品
新增:后台用户列表显示累积消费金额
修复:小程序端商品评价页错乱问题
注:本次更新须重新发布小程序
--------------------------------
### v1.1.2 更新日志 ###
修复:订单发货模板消息不显示物流公司
修复:后台首页统计下单用户数不正确
修复:后台首页商城统计遮挡左侧菜单
修复:小程序端 二级分类排版错乱问题
优化:兼容系统中不存在的地区
优化:发送消息通知时记录日志
优化:小程序端 编辑收货地址默认地区选择
优化:小程序端 图片轮播高度自适应
优化:小程序端 支持链接跳转tabBar页面
新增:后台会员列表页条件查询
新增:后台商品列表页条件查询
注:本次更新须重新发布小程序
--------------------------------
### v1.1.1 更新日志 ###
修复优惠券最多优惠到0.01元
修复:优惠券有效期日期格式
修复小程序端图片橱窗DIY组件链接
新增:订单提交买家留言
新增:新版后台首页
新增:小程序主动更新机制
新增:小程序模板消息通知功能
新增:小程序端购物车页可多选
优化:删除商品改为软删除
注:本次更新须重新发布小程序
--------------------------------
### v1.1.0 更新日志 ###
新增:小程序分类页面模板
新增:后台小程序页面设计-自定义页
新增:后台修改订单价格功能
新增:小程序端一键获取微信地址
修复后台操作成功url跳转问题
修复:优惠券抵扣金额计算问题
修复:后台商品评论管理隐藏状态
修复小程序端DIY商品组件控制显示内容
修复:小程序端分类页无数据时错误提示
优化:后台操作提示等待时间
优化:后台页面设计兼容性问题
优化:商品分类排序问题
优化:小程序端二级分类图片大小
优化:商品详情页支持点击主图预览
优化:商品详情页支持右上角分享
注:本次更新须重新发布小程序
--------------------------------

BIN
icon.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

View File

@ -0,0 +1,28 @@
<?php
return [
// 默认输出类型
'default_return_type' => 'html',
'template' => [
// layout布局
'layout_on' => true,
'layout_name' => 'layouts/layout',
// 模板引擎类型 支持 php think 支持扩展
'type' => 'think',
// 模板路径
'view_path' => '',
// 模板后缀
'view_suffix' => 'php',
// 模板文件名分隔符
'view_depr' => DS,
// 模板引擎普通标签开始标记
'tpl_begin' => '{{',
// 模板引擎普通标签结束标记
'tpl_end' => '}}',
// 标签库标签开始标记
'taglib_begin' => '{{',
// 标签库标签结束标记
'taglib_end' => '}}',
],
];

View File

@ -0,0 +1,187 @@
<?php
namespace app\admin\controller;
use think\Config;
use think\Request;
use think\Session;
// use app\store\model\Setting;
/**
* 超管后台控制器基类
* Class Controller
* @package app\admin\controller
*/
class Controller extends \think\Controller
{
/* @var array $admin 商家登录信息 */
protected $admin;
/* @var string $route 当前控制器名称 */
protected $controller = '';
/* @var string $route 当前方法名称 */
protected $action = '';
/* @var string $route 当前路由uri */
protected $routeUri = '';
/* @var string $route 当前路由:分组名称 */
protected $group = '';
/* @var array $allowAllAction 登录验证白名单 */
protected $allowAllAction = [
// 登录页面
'passport/login',
];
/* @var array $notLayoutAction 无需全局layout */
protected $notLayoutAction = [
// 登录页面
'passport/login',
];
/**
* 后台初始化
* @throws \Exception
*/
public function _initialize()
{
// 商家登录信息
$this->admin = Session::get('yoshop_admin');
// 当前路由信息
$this->getRouteinfo();
// 验证登录
$this->checkLogin();
// 全局layout
$this->layout();
}
/**
* 全局layout模板输出
* @throws \Exception
*/
private function layout()
{
// 验证当前请求是否在白名单
if (!in_array($this->routeUri, $this->notLayoutAction)) {
// 输出到view
$this->assign([
'base_url' => base_url(), // 当前域名
'admin_url' => url('/admin'), // 后台模块url
'group' => $this->group,
'menus' => $this->menus(), // 后台菜单
'admin' => $this->admin, // 商家登录信息
'version' => get_version(), // 当前系统版本号
'request' => Request::instance() // Request对象
]);
}
}
/**
* 解析当前路由参数 (分组名称、控制器名称、方法名)
*/
protected function getRouteinfo()
{
// 控制器名称
$this->controller = toUnderScore($this->request->controller());
// 方法名称
$this->action = $this->request->action();
// 控制器分组 (用于定义所属模块)
$groupstr = strstr($this->controller, '.', true);
$this->group = $groupstr !== false ? $groupstr : $this->controller;
// 当前uri
$this->routeUri = $this->controller . '/' . $this->action;
}
/**
* 后台菜单配置
* @return array
*/
private function menus()
{
foreach ($data = Config::get('menus') as $group => $first) {
$data[$group]['active'] = $group === $this->group;
// 遍历:二级菜单
if (isset($first['submenu'])) {
foreach ($first['submenu'] as $secondKey => $second) {
// 二级菜单所有uri
$secondUris = isset($second['uris']) ? $second['uris'] : [$second['index']];
// 二级菜单active
!isset($data[$group]['submenu'][$secondKey]['active'])
&& $data[$group]['submenu'][$secondKey]['active'] = in_array($this->routeUri, $secondUris);
}
}
}
return $data;
}
/**
* 验证登录状态
* @return bool
*/
private function checkLogin()
{
// 验证当前请求是否在白名单
if (in_array($this->routeUri, $this->allowAllAction)) {
return true;
}
// 验证登录状态
if (empty($this->admin)
|| (int)$this->admin['is_login'] !== 1
) {
$this->redirect('passport/login');
return false;
}
return true;
}
/**
* 返回封装后的 API 数据到客户端
* @param int $code
* @param string $msg
* @param string $url
* @param array $data
* @return array
*/
protected function renderJson($code = 1, $msg = '', $url = '', $data = [])
{
return compact('code', 'msg', 'url', 'data');
}
/**
* 返回操作成功json
* @param string $msg
* @param string $url
* @param array $data
* @return array
*/
protected function renderSuccess($msg = 'success', $url = '', $data = [])
{
return $this->renderJson(1, $msg, $url, $data);
}
/**
* 返回操作失败json
* @param string $msg
* @param string $url
* @param array $data
* @return array
*/
protected function renderError($msg = 'error', $url = '', $data = [])
{
return $this->renderJson(0, $msg, $url, $data);
}
/**
* 获取post数据 (数组)
* @param $key
* @return mixed
*/
protected function postData($key)
{
return $this->request->post($key . '/a');
}
}

View File

@ -0,0 +1,22 @@
<?php
namespace app\admin\controller;
/**
* 后台首页
* Class Index
* @package app\admin\controller
*/
class Index extends Controller
{
/**
* 后台首页
* @return mixed
*/
public function index()
{
return $this->fetch('index');
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace app\admin\controller;
use app\admin\model\admin\User as UserModel;
use think\Session;
/**
* 超管后台认证
* Class Passport
* @package app\store\controller
*/
class Passport extends Controller
{
/**
* 超管后台登录
* @return array|mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function login()
{
if ($this->request->isAjax()) {
$model = new UserModel;
if ($model->login($this->postData('User'))) {
return $this->renderSuccess('登录成功', url('index/index'));
}
return $this->renderError($model->getError() ?: '登录失败');
}
$this->view->engine->layout(false);
return $this->fetch('login');
}
/**
* 退出登录
*/
public function logout()
{
Session::clear('yoshop_admin');
$this->redirect('passport/login');
}
}

View File

@ -0,0 +1,122 @@
<?php
namespace app\admin\controller;
use app\admin\model\Wxapp as WxappModel;
use app\admin\model\store\User as StoreUser;
/**
* 小程序商城管理
* Class Store
* @package app\admin\controller
*/
class Store extends Controller
{
/**
* 小程序列表
* @return mixed
* @throws \think\exception\DbException
*/
public function index()
{
$model = new WxappModel;
return $this->fetch('index', [
'list' => $list = $model->getList(),
'names' => $model->getStoreName($list)
]);
}
/**
* 进入商城
* @param $wxapp_id
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function enter($wxapp_id)
{
$model = new StoreUser;
$model->login($wxapp_id);
$this->redirect('store/index/index');
}
/**
* 回收站列表
* @return mixed
* @throws \think\exception\DbException
*/
public function recycle()
{
$model = new WxappModel;
return $this->fetch('recycle', [
'list' => $list = $model->getList(true),
'names' => $model->getStoreName($list)
]);
}
/**
* 添加小程序
* @return array|mixed
* @throws \think\exception\PDOException
*/
public function add()
{
$model = new WxappModel;
if (!$this->request->isAjax()) {
return $this->fetch('add');
}
// 新增记录
if ($model->add($this->postData('store'))) {
return $this->renderSuccess('添加成功', url('store/index'));
}
return $this->renderError($model->getError() ?: '添加失败');
}
/**
* 回收小程序
* @param $wxapp_id
* @return array
* @throws \think\exception\DbException
*/
public function recovery($wxapp_id)
{
// 小程序详情
$model = WxappModel::detail($wxapp_id);
if (!$model->recycle()) {
return $this->renderError('操作失败');
}
return $this->renderSuccess('操作成功');
}
/**
* 移出回收站
* @param $wxapp_id
* @return array
* @throws \think\exception\DbException
*/
public function move($wxapp_id)
{
// 小程序详情
$model = WxappModel::detail($wxapp_id);
if (!$model->recycle(false)) {
return $this->renderError('操作失败');
}
return $this->renderSuccess('操作成功');
}
/**
* 删除小程序
* @param $wxapp_id
* @return array
* @throws \think\exception\DbException
*/
public function delete($wxapp_id)
{
// 小程序详情
$model = WxappModel::detail($wxapp_id);
if (!$model->setDelete()) {
return $this->renderError('操作失败');
}
return $this->renderSuccess('操作成功');
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace app\admin\controller\admin;
use app\admin\controller\Controller;
use app\admin\model\admin\User as AdminUserModel;
/**
* 超管后台管理员控制器
* Class User
* @package app\store\controller
*/
class User extends Controller
{
/**
* 更新当前管理员信息
* @return array|mixed
* @throws \think\exception\DbException
*/
public function renew()
{
$model = AdminUserModel::detail($this->admin['user']['admin_user_id']);
if ($this->request->isAjax()) {
if ($model->renew($this->postData('user'))) {
return $this->renderSuccess('更新成功');
}
return $this->renderError($model->getError() ?: '更新失败');
}
return $this->fetch('renew', compact('model'));
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace app\admin\controller\setting;
use app\admin\controller\Controller;
use think\Cache as CacheDriver;
/**
* 清理缓存
* Class Index
* @package app\admin\controller
*/
class Cache extends Controller
{
/**
* 清理缓存
* @param bool $isForce
* @return mixed
*/
public function clear($isForce = false)
{
if ($this->request->isAjax()) {
$this->rmCache($this->postData('cache'));
return $this->renderSuccess('操作成功');
}
return $this->fetch('clear', [
'isForce' => !!$isForce ?: config('app_debug'),
]);
}
/**
* 删除缓存
* @param $data
*/
private function rmCache($data)
{
// 数据缓存
if (in_array('data', $data['item'])) {
// 强制模式
$isForce = isset($data['isForce']) ? !!$data['isForce'] : false;
// 清除缓存
CacheDriver::clear($isForce ? null : 'cache');
}
// 临时文件
if (in_array('temp', $data['item'])) {
$paths = [
'temp' => WEB_PATH . 'temp/',
'runtime' => RUNTIME_PATH . 'image/'
];
foreach ($paths as $path) {
$this->deleteFolder($path);
}
}
}
/**
* 递归删除指定目录下所有文件
* @param $path
* @return bool
*/
private function deleteFolder($path)
{
if (!is_dir($path))
return false;
// 扫描一个文件夹内的所有文件夹和文件
foreach (scandir($path) as $val) {
// 排除目录中的.和..
if (!in_array($val, ['.', '..', '.gitignore'])) {
// 如果是目录则递归子目录,继续操作
if (is_dir($path . $val)) {
// 子目录中操作删除文件夹和文件
$this->deleteFolder($path . $val . '/');
// 目录清空后删除空文件夹
rmdir($path . $val . '/');
} else {
// 如果是文件直接删除
unlink($path . $val);
}
}
}
return true;
}
}

View File

@ -0,0 +1,204 @@
<?php
namespace app\admin\controller\setting;
use app\admin\controller\Controller;
/**
* 环境检测
* Class Science
* @package app\admin\controller\setting
*/
class Science extends Controller
{
/**
* 状态class
* @var array
*/
private $statusClass = [
'normal' => '',
'warning' => 'am-active',
'danger' => 'am-danger'
];
/**
* 环境检测
*/
public function index()
{
return $this->fetch('index', [
'statusClass' => $this->statusClass,
'phpinfo' => $this->phpinfo(), // PHP环境要求
'server' => $this->server(), // 服务器信息
'writeable' => $this->writeable(), // 目录权限监测
]);
}
/**
* 服务器信息
* @return array
*/
private function server()
{
return [
'system' => [
'name' => '服务器操作系统',
'value' => PHP_OS,
'status' => PHP_SHLIB_SUFFIX === 'dll' ? 'warning' : 'normal',
'remark' => '建议使用 Linux 系统以提升程序性能'
],
'webserver' => [
'name' => 'Web服务器环境',
'value' => $this->request->server('SERVER_SOFTWARE'),
'status' => PHP_SAPI === 'isapi' ? 'warning' : 'normal',
'remark' => '建议使用 Apache 或 Nginx 以提升程序性能'
],
'php' => [
'name' => 'PHP版本',
'value' => PHP_VERSION,
'status' => version_compare(PHP_VERSION, '5.4.0') === -1 ? 'danger' : 'normal',
'remark' => 'PHP版本必须为 5.4.0 以上'
],
'upload_max' => [
'name' => '文件上传限制',
'value' => @ini_get('file_uploads') ? ini_get('upload_max_filesize') : 'unknow',
'status' => 'normal',
'remark' => ''
],
'web_path' => [
'name' => '程序运行目录',
'value' => str_replace('\\', '/', WEB_PATH),
'status' => 'normal',
'remark' => ''
],
];
}
/**
* PHP环境要求
* @return array
*/
private function phpinfo()
{
// pre( get_loaded_extensions() );
return [
'php_version' => [
'name' => 'PHP版本',
'value' => '5.4.0及以上',
'status' => version_compare(PHP_VERSION, '5.4.0') === -1 ? 'danger' : 'normal',
'remark' => 'PHP版本必须为 5.4.0及以上'
],
'curl' => [
'name' => 'CURL',
'value' => '支持',
'status' => extension_loaded('curl') && function_exists('curl_init') ? 'normal' : 'danger',
'remark' => '您的PHP环境不支持CURL, 系统无法正常运行'
],
'openssl' => [
'name' => 'OpenSSL',
'value' => '支持',
'status' => extension_loaded('openssl') ? 'normal' : 'danger',
'remark' => '没有启用OpenSSL, 将无法访问微信平台的接口'
],
'pdo' => [
'name' => 'PDO',
'value' => '支持',
'status' => extension_loaded('PDO') && extension_loaded('pdo_mysql') ? 'normal' : 'danger',
'remark' => '您的PHP环境不支持PDO, 系统无法正常运行'
],
'gd' => [
'name' => 'GD',
'value' => '支持',
'status' => extension_loaded('gd') ? 'normal' : 'danger',
'remark' => '您的PHP环境不支持GD, 系统无法正常生成图片'
],
'bcmath' => [
'name' => 'BCMath',
'value' => '支持',
'status' => extension_loaded('bcmath') ? 'normal' : 'danger',
'remark' => '您的PHP环境不支持BCMath, 系统无法正常运行'
],
'mbstring' => [
'name' => 'mbstring',
'value' => '支持',
'status' => extension_loaded('mbstring') ? 'normal' : 'danger',
'remark' => '您的PHP环境不支持mbstring, 系统无法正常运行'
],
'SimpleXML' => [
'name' => 'SimpleXML',
'value' => '支持',
'status' => extension_loaded('SimpleXML') ? 'normal' : 'danger',
'remark' => '您的PHP环境不支持SimpleXML, 系统无法解析xml 无法使用微信支付'
],
];
}
/**
* 目录权限监测
*/
private function writeable()
{
$paths = [
'uploads' => realpath(WEB_PATH) . '/uploads/',
'temp' => realpath(WEB_PATH) . '/temp/',
'wxpay_log' => realpath(APP_PATH) . '/common/library/wechat/logs/',
'wxpay_cert' => realpath(APP_PATH) . '/common/library/wechat/cert/',
'behavior_log' => realpath(APP_PATH) . '/task/behavior/logs/',
];
return [
'uploads' => [
'name' => '文件上传目录',
'value' => str_replace('\\', '/', $paths['uploads']),
'status' => $this->checkWriteable($paths['uploads']) ? 'normal' : 'danger',
'remark' => '目录不可写,系统将无法正常上传文件'
],
'temp' => [
'name' => '临时文件目录',
'value' => str_replace('\\', '/', $paths['temp']),
'status' => $this->checkWriteable($paths['temp']) ? 'normal' : 'danger',
'remark' => '目录不可写,系统将无法正常写入文件'
],
'wxpay_log' => [
'name' => '微信支付日志目录',
'value' => str_replace('\\', '/', $paths['wxpay_log']),
'status' => $this->checkWriteable($paths['wxpay_log']) ? 'normal' : 'danger',
'remark' => '目录不可写,系统将无法正常写入文件'
],
'wxpay_cert' => [
'name' => '微信支付证书目录',
'value' => str_replace('\\', '/', $paths['wxpay_cert']),
'status' => $this->checkWriteable($paths['wxpay_cert']) ? 'normal' : 'danger',
'remark' => '目录不可写,系统将无法正常写入文件'
],
// 'behavior_log' => [
// 'name' => '自动任务日志目录',
// 'value' => str_replace('\\', '/', $paths['behavior_log']),
// 'status' => $this->checkWriteable($paths['behavior_log']) ? 'normal' : 'danger',
// 'remark' => '目录不可写,系统将无法正常上传文件'
// ],
];
}
/**
* 检查目录是否可写
* @param $path
* @return bool
*/
private function checkWriteable($path)
{
try {
!is_dir($path) && mkdir($path, 0755);
if (!is_dir($path))
return false;
$fileName = $path . '/_test_write.txt';
if ($fp = fopen($fileName, 'w')) {
return fclose($fp) && unlink($fileName);
}
} catch (\Exception $e) {
}
return false;
}
}

View File

@ -0,0 +1,94 @@
<?php
namespace app\admin\controller\store;
use app\admin\controller\Controller;
use app\admin\model\store\Access as AccesscModel;
/**
* 商家用户权限控制器
* Class StoreUser
* @package app\store\controller
*/
class Access extends Controller
{
/**
* 权限列表
* @return mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
$model = new AccesscModel;
$list = $model->getList();
return $this->fetch('index', compact('list'));
}
/**
* 添加权限
* @return array|mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function add()
{
$model = new AccesscModel;
if (!$this->request->isAjax()) {
// 权限列表
$accessList = $model->getList();
return $this->fetch('add', compact('accessList'));
}
// 新增记录
if ($model->add($this->postData('access'))) {
return $this->renderSuccess('添加成功', url('store.access/index'));
}
return $this->renderError($model->getError() ?: '添加失败');
}
/**
* 更新权限
* @param $access_id
* @return array|mixed
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit($access_id)
{
// 权限详情
$model = AccesscModel::detail($access_id);
if (!$this->request->isAjax()) {
// 权限列表
$accessList = $model->getList();
return $this->fetch('edit', compact('model', 'accessList'));
}
// 更新记录
if ($model->edit($this->postData('access'))) {
return $this->renderSuccess('更新成功', url('store.access/index'));
}
return $this->renderError($model->getError() ?: '更新失败');
}
/**
* 删除权限
* @param $access_id
* @return array
* @throws \think\exception\DbException
*/
public function delete($access_id)
{
// 权限详情
$model = AccesscModel::detail($access_id);
if (!$model->remove()) {
return $this->renderError($model->getError() ?: '删除失败');
}
return $this->renderSuccess('删除成功');
}
}

View File

@ -0,0 +1,47 @@
<?php
/**
* 后台菜单配置
* 'home' => [
* 'name' => '首页', // 菜单名称
* 'icon' => 'icon-home', // 图标 (class)
* 'index' => 'index/index', // 链接
* ],
*/
return [
'store' => [
'name' => '小程序商城',
'icon' => 'icon-shangcheng',
'submenu' => [
[
'name' => '商城列表',
'index' => 'store/index',
'uris' => [
'store/index',
'store/add',
]
],
[
'name' => '回收站',
'index' => 'store/recycle'
],
[
'name' => '权限管理',
'index' => 'store.access/index'
]
],
],
'setting' => [
'name' => '系统设置',
'icon' => 'icon-shezhi',
'submenu' => [
[
'name' => '清理缓存',
'index' => 'setting.cache/clear'
],
[
'name' => '环境检测',
'index' => 'setting.science/index'
],
],
],
];

View File

@ -0,0 +1,31 @@
<?php
namespace app\admin\model;
use app\common\model\Setting as SettingModel;
/**
* 商城设置模型
* Class Setting
* @package app\admin\model
*/
class Setting extends SettingModel
{
/**
* 新增默认配置
* @param $wxapp_id
* @param $store_name
* @return array|false
* @throws \Exception
*/
public function insertDefault($wxapp_id, $store_name)
{
// 添加商城默认设置记录
$data = [];
foreach ($this->defaultData($store_name) as $key => $item) {
$data[] = array_merge($item, ['wxapp_id' => $wxapp_id]);
}
return $this->saveAll($data);
}
}

View File

@ -0,0 +1,103 @@
<?php
namespace app\admin\model;
use app\common\model\Wxapp as WxappModel;
use app\admin\model\store\User as StoreUser;
/**
* 微信小程序模型
* Class Wxapp
* @package app\admin\model
*/
class Wxapp extends WxappModel
{
/**
* 获取小程序列表
* @param boolean $is_recycle
* @return \think\Paginator
* @throws \think\exception\DbException
*/
public function getList($is_recycle = false)
{
return $this->where('is_recycle', '=', (int)$is_recycle)
->where('is_delete', '=', 0)
->order(['create_time' => 'desc'])
->paginate(15, false, [
'query' => request()->request()
]);
}
/**
* 从缓存中获取商城名称
* @param $data
* @return array
*/
public function getStoreName($data)
{
$names = [];
foreach ($data as $wxapp) {
$names[$wxapp['wxapp_id']] = Setting::getItem('store', $wxapp['wxapp_id'])['name'];
}
return $names;
}
/**
* 新增记录
* @param $data
* @return bool
* @throws \think\exception\PDOException
*/
public function add($data)
{
if ($data['password'] !== $data['password_confirm']) {
$this->error = '确认密码不正确';
return false;
}
$this->startTrans();
try {
// 添加小程序记录
$this->allowField(true)->save($data);
// 商城默认设置
(new Setting)->insertDefault($this['wxapp_id'], $data['store_name']);
// 新增商家用户信息
$StoreUser = new StoreUser;
if (!$StoreUser->add($this['wxapp_id'], $data)) {
$this->error = $StoreUser->error;
return false;
}
// 新增小程序默认帮助
(new WxappHelp)->insertDefault($this['wxapp_id']);
// 新增小程序diy配置
(new WxappPage)->insertDefault($this['wxapp_id']);
// 新增小程序分类页模板
(new WxappCategory)->insertDefault($this['wxapp_id']);
$this->commit();
return true;
} catch (\Exception $e) {
$this->error = $e->getMessage();
$this->rollback();
return false;
}
}
/**
* 移入移出回收站
* @param bool $is_recycle
* @return false|int
*/
public function recycle($is_recycle = true)
{
return $this->save(['is_recycle' => (int)$is_recycle]);
}
/**
* 软删除
* @return false|int
*/
public function setDelete()
{
return $this->save(['is_delete' => 1]);
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace app\admin\model;
use app\common\model\WxappCategory as WxappCategoryModel;
/**
* 微信小程序分类页模板
* Class WxappCategory
* @package app\store\model
*/
class WxappCategory extends WxappCategoryModel
{
/**
* 新增分类页模板
* @param $wxapp_id
* @return false|int
*/
public function insertDefault($wxapp_id)
{
return $this->save([
'wxapp_id' => $wxapp_id,
'category_style' => '11',
'share_title' => '',
]);
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace app\admin\model;
use app\common\model\WxappHelp as WxappHelpModel;
/**
* 小程序帮助中心
* Class WxappHelp
* @package app\admin\model
*/
class WxappHelp extends WxappHelpModel
{
/**
* 新增默认帮助
* @param $wxapp_id
* @return false|int
*/
public function insertDefault($wxapp_id)
{
return $this->save([
'title' => '关于小程序',
'content' => '小程序本身无需下载无需注册不占用手机内存可以跨平台使用响应迅速体验接近原生APP。',
'sort' => 100,
'wxapp_id' => $wxapp_id
]);
}
}

View File

@ -0,0 +1,75 @@
<?php
namespace app\admin\model;
use app\common\model\WxappPage as WxappPageModel;
/**
* 微信小程序diy页面模型
* Class WxappPage
* @package app\admin\model
*/
class WxappPage extends WxappPageModel
{
/**
* 新增小程序首页diy默认设置
* @param $wxapp_id
* @return false|int
*/
public function insertDefault($wxapp_id)
{
return $this->save([
'page_type' => 10,
'page_name' => '小程序首页',
'page_data' => [
'page' => [
'type' => 'page',
'name' => '页面设置',
'params' => [
'name' => '页面标题',
'title' => '页面标题',
'share_title' => '分享标题'
],
'style' => [
'titleTextColor' => 'black',
'titleBackgroundColor' => '#ffffff',
]
],
'items' => [
[
'type' => 'search',
'name' => '搜索框',
'params' => ['placeholder' => '搜索商品'],
'style' => [
'textAlign' => 'center',
'searchStyle' => 'radius',
],
],
[
'type' => 'banner',
'name' => '图片轮播',
'style' => [
'btnColor' => '#ffffff',
'btnShape' => 'round',
],
'params' => [
'interval' => '2800'
],
'data' => [
[
'imgUrl' => self::$base_url . 'assets/store/img/diy/banner/01.png',
'linkUrl' => '',
],
[
'imgUrl' => self::$base_url . 'assets/store/img/diy/banner/01.png',
'linkUrl' => '',
],
],
]
],
],
'wxapp_id' => $wxapp_id
]);
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace app\admin\model\admin;
use think\Session;
use app\common\model\admin\User as UserModel;
/**
* 超管后台用户模型
* Class User
* @package app\admin\model\admin
*/
class User extends UserModel
{
/**
* 超管后台用户登录
* @param $data
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function login($data)
{
// 验证用户名密码是否正确
if (!$user = self::useGlobalScope(false)->where([
'user_name' => $data['user_name'],
'password' => yoshop_hash($data['password'])
])->find()) {
$this->error = '登录失败, 用户名或密码错误';
return false;
}
// 保存登录状态
Session::set('yoshop_admin', [
'user' => [
'admin_user_id' => $user['admin_user_id'],
'user_name' => $user['user_name'],
],
'is_login' => true,
]);
return true;
}
/**
* 超管用户信息
* @param $admin_user_id
* @return null|static
* @throws \think\exception\DbException
*/
public static function detail($admin_user_id)
{
return self::get($admin_user_id);
}
/**
* 更新当前管理员信息
* @param $data
* @return bool
*/
public function renew($data)
{
if ($data['password'] !== $data['password_confirm']) {
$this->error = '确认密码不正确';
return false;
}
// 更新管理员信息
if ($this->save([
'user_name' => $data['user_name'],
'password' => yoshop_hash($data['password']),
]) === false) {
return false;
}
// 更新session
Session::set('yoshop_admin.user', [
'admin_user_id' => $this['admin_user_id'],
'user_name' => $data['user_name'],
]);
return true;
}
}

View File

@ -0,0 +1,656 @@
<?php
namespace app\admin\model\store;
use app\common\model\store\Access as AccessModel;
/**
* 商家用户权限模型
* Class Access
* @package app\admin\model\store
*/
class Access extends AccessModel
{
/**
* 获取权限列表
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function getList()
{
$all = static::getAll();
return $this->formatTreeData($all);
}
/**
* 新增记录
* @param $data
* @return false|int
*/
public function add($data)
{
$data['wxapp_id'] = self::$wxapp_id;
return $this->allowField(true)->save($data);
}
/**
* 更新记录
* @param $data
* @return bool
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function edit($data)
{
// 判断上级角色是否为当前子级
if ($data['parent_id'] > 0) {
// 获取所有上级id集
$parentIds = $this->getTopAccessIds($data['parent_id']);
if (in_array($this['access_id'], $parentIds)) {
$this->error = '上级权限不允许设置为当前子权限';
return false;
}
}
return $this->allowField(true)->save($data) !== false;
}
/**
* 删除权限
* @return bool|int
* @throws \think\exception\DbException
*/
public function remove()
{
// 判断是否存在下级权限
if (self::detail(['parent_id' => $this['access_id']])) {
$this->error = '当前权限下存在子权限,请先删除';
return false;
}
return $this->delete();
}
/**
* 获取所有上级id集
* @param $access_id
* @param null $all
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
private function getTopAccessIds($access_id, &$all = null)
{
static $ids = [];
is_null($all) && $all = $this->getAll();
foreach ($all as $item) {
if ($item['access_id'] == $access_id && $item['parent_id'] > 0) {
$ids[] = $item['parent_id'];
$this->getTopAccessIds($item['parent_id'], $all);
}
}
return $ids;
}
/**
* 获取权限列表
* @param $all
* @param int $parent_id
* @param int $deep
* @return array
*/
private function formatTreeData(&$all, $parent_id = 0, $deep = 1)
{
static $tempTreeArr = [];
foreach ($all as $key => $val) {
if ($val['parent_id'] == $parent_id) {
// 记录深度
$val['deep'] = $deep;
// 根据角色深度处理名称前缀
$val['name_h1'] = $this->htmlPrefix($deep) . $val['name'];
$tempTreeArr[] = $val;
$this->formatTreeData($all, $val['access_id'], $deep + 1);
}
}
return $tempTreeArr;
}
private function htmlPrefix($deep)
{
// 根据角色深度处理名称前缀
$prefix = '';
if ($deep > 1) {
for ($i = 1; $i <= $deep - 1; $i++) {
$prefix .= '&nbsp;&nbsp;&nbsp;├ ';
}
$prefix .= '&nbsp;';
}
return $prefix;
}
/**
* 新增默认权限
*/
public function insertDefault()
{
$defaultData = $this->defaultData();
$this->buildData($defaultData);
}
/**
* 生成并写入默认数据
* @param $defaultData
* @param int $parent_id
*/
private function buildData(&$defaultData, $parent_id = 0)
{
foreach ($defaultData as $key => $item) {
// 保存数据
$model = new static;
$model->save([
'name' => $item['name'],
'url' => $item['url'],
'parent_id' => $parent_id,
'sort' => 100,
]);
if (isset($item['subset']) && !empty($item['subset'])) {
$this->buildData($item['subset'], $model['access_id']);
}
}
}
/**
* 默认权限数据
* @return array
*/
private function defaultData()
{
return [
[
'name' => '首页',
'url' => 'index/index'
],
[
'name' => '管理员',
'url' => 'store',
'subset' => [
[
'name' => '管理员管理',
'url' => 'store.user',
'subset' => [
[
'name' => '管理员列表',
'url' => 'store.user/index'
],
[
'name' => '添加管理员',
'url' => 'store.user/add'
],
[
'name' => '编辑管理员',
'url' => 'store.user/edit'
],
[
'name' => '删除管理员',
'url' => 'store.user/delete'
],
]
],
[
'name' => '角色管理',
'url' => 'store.role',
'subset' => [
[
'name' => '角色列表',
'url' => 'store.role/index'
],
[
'name' => '添加角色',
'url' => 'store.role/add'
],
[
'name' => '编辑角色',
'url' => 'store.role/edit'
],
[
'name' => '删除角色',
'url' => 'store.role/delete'
],
]
],
[
'name' => '权限管理',
'url' => 'store.access',
'subset' => [
[
'name' => '权限列表',
'url' => 'store.access/index'
],
[
'name' => '添加权限',
'url' => 'store.access/add'
],
[
'name' => '编辑权限',
'url' => 'store.access/edit'
],
[
'name' => '删除权限',
'url' => 'store.access/delete'
],
]
],
]
],
[
'name' => '商品管理',
'url' => 'goods',
'subset' => [
[
'name' => '商品管理',
'url' => 'goods',
'subset' => [
[
'name' => '商品列表',
'url' => 'goods/index',
],
[
'name' => '添加商品',
'url' => 'goods/add',
],
[
'name' => '编辑商品',
'url' => 'goods/edit',
],
[
'name' => '复制商品',
'url' => 'goods/copy',
],
[
'name' => '删除商品',
'url' => 'goods/delete',
],
[
'name' => '商品上下架',
'url' => 'goods/state',
],
]
],
[
'name' => '商品分类',
'url' => 'goods.category',
'subset' => [
[
'name' => '分类列表',
'url' => 'goods.category/index',
],
[
'name' => '添加分类',
'url' => 'goods.category/add',
],
[
'name' => '编辑分类',
'url' => 'goods.category/edit',
],
[
'name' => '删除分类',
'url' => 'goods.category/delete',
],
],
],
[
'name' => '商品评价',
'url' => 'goods.comment',
'subset' => [
[
'name' => '评价列表',
'url' => 'goods.comment/index',
],
[
'name' => '评价详情',
'url' => 'goods.comment/detail',
],
[
'name' => '删除评价',
'url' => 'goods.comment/delete',
],
],
],
]
],
[
'name' => '订单管理',
'url' => 'order',
'subset' => [
[
'name' => '订单列表',
'url' => '',
'subset' => [
[
'name' => '待发货',
'url' => 'order/delivery_list'
],
[
'name' => '待收货',
'url' => 'order/receipt_list'
],
[
'name' => '待付款',
'url' => 'order/pay_list'
],
[
'name' => '已完成',
'url' => 'order/complete_list'
],
[
'name' => '已取消',
'url' => 'order/cancel_list'
],
[
'name' => '全部订单',
'url' => 'order/all_list',
],
]
],
[
'name' => '订单详情',
'url' => '',
'subset' => [
[
'name' => '详情信息',
'url' => 'order/detail',
],
[
'name' => '确认发货',
'url' => 'order/delivery',
],
[
'name' => '修改订单价格',
'url' => 'order/updateprice',
],
]
],
[
'name' => '订单导出',
'url' => 'order.operate/export',
],
[
'name' => '批量发货',
'url' => 'order.operate/batchdelivery',
],
]
],
[
'name' => '用户管理',
'url' => 'user',
'subset' => [
[
'name' => '用户列表',
'url' => 'user/index'
],
[
'name' => '删除用户',
'url' => 'user/delete'
],
]
],
[
'name' => '营销设置',
'url' => 'market',
'subset' => [
[
'name' => '优惠券',
'url' => 'coupon',
'subset' => [
[
'name' => '优惠券列表',
'url' => 'market.coupon/index',
],
[
'name' => '新增优惠券',
'url' => 'market.coupon/add',
],
[
'name' => '编辑优惠券',
'url' => 'market.coupon/edit',
],
[
'name' => '删除优惠券',
'url' => 'market.coupon/delete',
],
[
'name' => '领取记录',
'url' => 'market.coupon/receive',
]
]
]
]
],
[
'name' => '小程序',
'url' => 'wxapp',
'subset' => [
[
'name' => '小程序设置',
'url' => 'wxapp/setting',
],
[
'name' => '页面管理',
'url' => 'wxapp.page',
'subset' => [
[
'name' => '页面设计',
'url' => '',
'subset' => [
[
'name' => '页面列表',
'url' => 'wxapp.page/index',
],
[
'name' => '新增页面',
'url' => 'wxapp.page/add',
],
[
'name' => '编辑页面',
'url' => 'wxapp.page/edit',
],
[
'name' => '设为首页',
'url' => 'wxapp.page/sethome',
],
]
],
[
'name' => '分类页模板',
'url' => 'wxapp.page/category',
],
[
'name' => '页面链接',
'url' => 'wxapp.page/links',
],
]
],
[
'name' => '帮助中心',
'url' => 'wxapp.help',
'subset' => [
[
'name' => '帮助列表',
'url' => 'wxapp.help/index',
],
[
'name' => '新增帮助',
'url' => 'wxapp.help/add',
],
[
'name' => '编辑帮助',
'url' => 'wxapp.help/edit',
],
[
'name' => '删除帮助',
'url' => 'wxapp.help/delete',
],
]
],
]
],
[
'name' => '应用中心',
'url' => 'apps',
'subset' => [
[
'name' => '分销中心',
'url' => 'apps.dealer',
'subset' => [
[
'name' => '入驻申请',
'url' => 'apps.dealer.apply',
'subset' => [
[
'name' => '申请列表',
'url' => 'apps.dealer.apply/index'
],
[
'name' => '分销商审核',
'url' => 'apps.dealer.apply/submit'
]
]
],
[
'name' => '分销商用户',
'url' => 'apps.dealer.user',
'subset' => [
[
'name' => '分销商列表',
'url' => 'apps.dealer.user/index',
],
[
'name' => '删除分销商',
'url' => 'apps.dealer.user/delete'
],
[
'name' => '分销商二维码',
'url' => 'apps.dealer.user/qrcode'
]
]
],
[
'name' => '分销订单',
'url' => 'apps.dealer.order/index',
],
[
'name' => '提现申请',
'url' => 'apps.dealer.withdraw',
'subset' => [
[
'name' => '申请列表',
'url' => 'apps.dealer.withdraw/index',
],
[
'name' => '提现审核',
'url' => 'apps.dealer.withdraw/submit'
],
[
'name' => '确认打款',
'url' => 'apps.dealer.withdraw/money'
]
]
],
[
'name' => '分销设置',
'url' => 'apps.dealer.setting/index',
],
[
'name' => '分销海报',
'url' => 'apps.dealer.setting/qrcode',
],
]
],
]
],
[
'name' => '设置',
'url' => 'setting',
'subset' => [
[
'name' => '商城设置',
'url' => 'setting/store',
],
[
'name' => '交易设置',
'url' => 'setting/trade',
],
[
'name' => '配送设置',
'url' => 'setting.delivery',
'subset' => [
[
'name' => '运费模板列表',
'url' => 'setting.delivery/index'
],
[
'name' => '新增运费模板',
'url' => 'setting.delivery/add'
],
[
'name' => '编辑运费模板',
'url' => 'setting.delivery/edit'
],
[
'name' => '删除运费模板',
'url' => 'setting.delivery/delete'
],
]
],
[
'name' => '物流公司',
'url' => 'setting.express',
'subset' => [
[
'name' => '物流公司列表',
'url' => 'setting.express/index'
],
[
'name' => '新增物流公司',
'url' => 'setting.express/add'
],
[
'name' => '编辑物流公司',
'url' => 'setting.express/edit'
],
[
'name' => '删除物流公司',
'url' => 'setting.express/delete'
],
]
],
[
'name' => '短信通知',
'url' => 'setting/sms',
],
[
'name' => '模板消息',
'url' => 'setting/tplmsg',
],
[
'name' => '上传设置',
'url' => 'setting/storage',
],
[
'name' => '其他',
'url' => '',
'subset' => [
[
'name' => '清理缓存',
'url' => 'setting.cache/clear',
],
]
]
]
],
];
}
}

View File

@ -0,0 +1,46 @@
<?php
namespace app\admin\model\store;
use app\common\model\store\User as StoreUserModel;
/**
* 商家用户模型
* Class StoreUser
* @package app\admin\model
*/
class User extends StoreUserModel
{
/**
* 新增商家用户记录
* @param $wxapp_id
* @param $data
* @return bool|false|int
*/
public function add($wxapp_id, $data)
{
if (self::checkExist($data['user_name'])) {
$this->error = '商家用户名已存在';
return false;
}
return $this->save([
'user_name' => $data['user_name'],
'password' => yoshop_hash($data['password']),
'wxapp_id' => $wxapp_id,
]);
}
/**
* 商家用户登录
* @param $wxapp_id
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function login($wxapp_id)
{
// 验证用户名密码是否正确
$user = self::detail(['wxapp_id' => $wxapp_id], ['wxapp']);
$this->loginState($user);
}
}

View File

@ -0,0 +1,55 @@
<div class="row-content am-cf">
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post">
<div class="widget-body">
<fieldset>
<div class="widget-head am-cf">
<div class="widget-title am-fl">管理员设置</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-form-label form-require"> 用户名 </label>
<div class="am-u-sm-9">
<input type="text" class="tpl-form-input" name="user[user_name]"
value="<?= $model['user_name'] ?>" required>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-form-label form-require"> 登录密码 </label>
<div class="am-u-sm-9">
<input type="password" class="tpl-form-input" name="user[password]"
value="" required>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-form-label form-require"> 确认密码 </label>
<div class="am-u-sm-9">
<input type="password" class="tpl-form-input" name="user[password_confirm]"
value="" required>
</div>
</div>
<div class="am-form-group">
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
<button type="submit" class="j-submit am-btn am-btn-secondary">提交
</button>
</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
$(function () {
/**
* 表单验证提交
* @type {*}
*/
$('#my-form').superForm();
});
</script>

View File

@ -0,0 +1,13 @@
<div class="widget am-cf">
<div class="widget-body">
<div class="tpl-page-state am-margin-top-xl">
<div class="tpl-page-state-title am-text-center">小程序运营管理系统</div>
<div class="tpl-error-title-info">Welcome To YoShop System</div>
<div class="tpl-page-state-content tpl-error-content">
<p>平台运营管理后台</p>
</div>
</div>
</div>
</div>

View File

@ -0,0 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge"/>
<title>运营管理系统</title>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<meta name="renderer" content="webkit"/>
<meta http-equiv="Cache-Control" content="no-siteapp"/>
<link rel="icon" type="image/png" href="assets/common/i/favicon.ico"/>
<meta name="apple-mobile-web-app-title" content="运营管理系统"/>
<link rel="stylesheet" href="assets/common/css/amazeui.min.css"/>
<link rel="stylesheet" href="assets/admin/css/app.css"/>
<link rel="stylesheet" href="//at.alicdn.com/t/font_783249_c9du3u6ahxp.css">
<script src="assets/common/js/jquery.min.js"></script>
<script>
BASE_URL = '<?= isset($base_url) ? $base_url : '' ?>';
ADMIN_URL = '<?= isset($admin_url) ? $admin_url : '' ?>';
</script>
</head>
<body data-type="">
<div class="am-g tpl-g">
<!-- 头部 -->
<header class="tpl-header">
<!-- 右侧内容 -->
<div class="tpl-header-fluid">
<!-- 其它功能-->
<div class="am-fr tpl-header-navbar">
<ul>
<!-- 欢迎语 -->
<li class="am-text-sm tpl-header-navbar-welcome">
<a href="<?= url('admin.user/renew') ?>">欢迎你,<span><?= $admin['user']['user_name'] ?></span>
</a>
</li>
<!-- 退出 -->
<li class="am-text-sm">
<a href="<?= url('passport/logout') ?>">
<i class="iconfont icon-tuichu"></i> 退出
</a>
</li>
</ul>
</div>
</div>
</header>
<!-- 内容区域 start -->
<div class="tpl-content-wrapper dis-flex">
<!-- 左侧菜单 -->
<?php $menus = $menus ?: []; ?>
<?php $group = $group ?: 0; ?>
<div class="left-sidebar">
<ul class="sidebar-nav">
<?php foreach ($menus as $key => $item): ?>
<li class="sidebar-nav-link">
<a href="<?= isset($item['index']) ? url($item['index']) : 'javascript:void(0);' ?>"
class="sidebar-nav-link-disabled">
<?php if (isset($item['is_svg']) && $item['is_svg'] == true): ?>
<svg class="icon sidebar-nav-link-logo" aria-hidden="true">
<use xlink:href="#<?= $item['icon'] ?>"></use>
</svg>
<?php else: ?>
<i class="iconfont sidebar-nav-link-logo <?= $item['icon'] ?>"
style="<?= isset($item['color']) ? "color:{$item['color']};" : '' ?>"></i>
<?php endif; ?>
<?= $item['name'] ?>
</a>
<!-- 子级菜单-->
<?php if (isset($item['submenu']) && !empty($item['submenu'])) : ?>
<ul class="sidebar-third-nav-sub">
<?php foreach ($item['submenu'] as $second) : ?>
<li class="sidebar-nav-link <?= $second['active'] ? 'active' : '' ?>">
<a class="" href="<?= url($second['index']) ?>">
<?= $second['name'] ?></a>
</li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</li>
<?php endforeach; ?>
</ul>
</div>
<!-- 内容区域 -->
<div class="row-content am-cf">
{__CONTENT__}
</div>
</div>
<!-- 内容区域 end -->
<div class="help-block am-text-center am-padding-sm">
<small>当前系统版本号v<?= $version ?></small>
</div>
</div>
<script src="assets/common/plugins/layer/layer.js"></script>
<script src="assets/common/js/jquery.form.min.js"></script>
<script src="assets/common/js/amazeui.min.js"></script>
<script src="assets/common/js/webuploader.html5only.js"></script>
<script src="assets/common/js/art-template.js"></script>
<script src="assets/admin/js/app.js"></script>
</body>
</html>

View File

@ -0,0 +1,63 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="IE=edge" http-equiv="X-UA-Compatible">
<title>商城系统登录</title>
<link rel="icon" type="image/png" href="assets/common/i/favicon.ico"/>
<link rel="stylesheet" href="assets/admin/css/login/style.css"/>
</head>
<body class="page-login-v3">
<div class="container">
<div id="wrapper" class="login-body">
<div class="login-content">
<div class="brand">
<h2 class="brand-text">小程序运营管理系统</h2>
</div>
<form id="login-form" class="login-form">
<div class="form-group">
<input class="" name="User[user_name]" placeholder="请输入用户名" type="text" required>
</div>
<div class="form-group">
<input class="" name="User[password]" placeholder="请输入密码" type="password" required>
</div>
<div class="form-group">
<button id="btn-submit" type="submit">
登录
</button>
</div>
</form>
</div>
</div>
</div>
</body>
<script src="assets/common/js/jquery.min.js"></script>
<script src="assets/common/plugins/layer/layer.js"></script>
<script src="assets/common/js/jquery.form.min.js"></script>
<script>
$(function () {
// 表单提交
var $form = $('#login-form');
$form.submit(function () {
var $btn_submit = $('#btn-submit');
$btn_submit.attr("disabled", true);
$form.ajaxSubmit({
type: "post",
dataType: "json",
// url: '',
success: function (result) {
$btn_submit.attr('disabled', false);
if (result.code === 1) {
layer.msg(result.msg, {time: 1500, anim: 1}, function () {
window.location = result.url;
});
return true;
}
layer.msg(result.msg, {time: 1500, anim: 6});
}
});
return false;
});
});
</script>
</html>

View File

@ -0,0 +1,78 @@
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post">
<div class="widget-body">
<fieldset>
<div class="widget-head am-cf">
<div class="widget-title am-fl">清理缓存</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-form-label form-require">
缓存项
</label>
<div class="am-u-sm-9">
<label class="am-checkbox-inline">
<input type="checkbox" name="cache[item][]" value="data"
data-am-ucheck checked required>
数据缓存
</label>
<label class="am-checkbox-inline">
<input type="checkbox" name="cache[item][]" value="temp"
data-am-ucheck checked required>
临时图片
</label>
</div>
</div>
<?php if (isset($isForce) && $isForce === true): ?>
<div class="am-form-group">
<label class="am-u-sm-3 am-form-label form-require"> 强制模式 </label>
<div class="am-u-sm-9">
<label class="am-radio-inline">
<input type="radio" name="cache[isForce]" value="0" checked
data-am-ucheck>
</label>
<label class="am-radio-inline">
<input type="radio" name="cache[isForce]" value="1" data-am-ucheck>
</label>
<div class="help-block">
<small class="x-color-red">此操作将会强制清空所有缓存文件,包含用户授权登录状态、用户购物车数据,仅允许在开发环境中使用
</small>
</div>
</div>
</div>
<?php else: ?>
<div class="am-form-group">
<div class="am-u-sm-9 am-u-sm-push-3">
<small>
<a href="<?= url('', ['isForce' => true]) ?>">
进入强制模式</a>
</small>
</div>
</div>
<?php endif; ?>
<div class="am-form-group">
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
<button type="submit" class="j-submit am-btn am-btn-secondary">提交
</button>
</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
</div>
<script>
$(function () {
/**
* 表单验证提交
* @type {*}
*/
$('#my-form').superForm();
});
</script>

View File

@ -0,0 +1,100 @@
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<form class="am-form tpl-form-line-form">
<div class="widget-body">
<fieldset>
<div class="widget-head am-cf">
<div class="widget-title am-fl">服务器信息</div>
</div>
<div class="am-form-group">
<div class="am-scrollable-horizontal">
<table class="am-table am-table-centered">
<tbody>
<tr>
<th width="30%">参数</th>
<th></th>
<th></th>
</tr>
<?php if (isset($server)): foreach ($server as $item): ?>
<tr class="<?= isset($statusClass) ? $statusClass[$item['status']] : '' ?>">
<td><?= $item['name'] ?></td>
<td><?= $item['value'] ?> </td>
<td><?= $item['status'] !== 'normal' ? $item['remark'] : '' ?> </td>
</tr>
<?php endforeach; endif; ?>
</tbody>
</table>
</div>
</div>
<div class="widget-head am-cf">
<div class="widget-title am-fl">PHP环境要求</div>
</div>
<div class="am-form-group">
<div class="am-scrollable-horizontal">
<table class="am-table am-table-centered">
<tbody>
<tr>
<th width="30%">选项</th>
<th>要求</th>
<th>状态</th>
<th></th>
</tr>
<?php if (isset($phpinfo)): foreach ($phpinfo as $item): ?>
<tr class="<?= isset($statusClass) ? $statusClass[$item['status']] : '' ?>">
<td><?= $item['name'] ?></td>
<td><?= $item['value'] ?> </td>
<td>
<?php if ($item['status'] !== 'danger'): ?>
<i class="am-icon-check x-color-green"></i>
<?php else: ?>
<i class="am-icon-times x-color-red"></i>
<?php endif; ?>
</td>
<td><?= $item['status'] !== 'normal' ? $item['remark'] : '' ?> </td>
</tr>
<?php endforeach; endif; ?>
</tbody>
</table>
</div>
</div>
<div class="widget-head am-cf">
<div class="widget-title am-fl">目录权限监测</div>
</div>
<div class="am-form-group">
<div class="am-scrollable-horizontal">
<table class="am-table am-table-centered">
<tbody>
<tr>
<th width="30%">名称</th>
<th class="am-text-left">路径</th>
<th>状态</th>
<th></th>
</tr>
<?php if (isset($writeable)): foreach ($writeable as $item): ?>
<tr class="<?= isset($statusClass) ? $statusClass[$item['status']] : '' ?>">
<td><?= $item['name'] ?></td>
<td class="am-text-left"><?= $item['value'] ?> </td>
<td>
<?php if ($item['status'] !== 'danger'): ?>
<i class="am-icon-check x-color-green"></i>
<?php else: ?>
<i class="am-icon-times x-color-red"></i>
<?php endif; ?>
</td>
<td><?= $item['status'] !== 'normal' ? $item['remark'] : '' ?> </td>
</tr>
<?php endforeach; endif; ?>
</tbody>
</table>
</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
</div>

View File

@ -0,0 +1,67 @@
<div class="row-content am-cf">
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<form id="my-form" class="am-form tpl-form-line-form" method="post">
<div class="widget-body">
<fieldset>
<div class="widget-head am-cf">
<div class="widget-title am-fl">添加权限</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权限名称 </label>
<div class="am-u-sm-9 am-u-end">
<input type="text" class="tpl-form-input" name="access[name]"
value="" placeholder="请输入权限名称" required>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">上级权限 </label>
<div class="am-u-sm-9 am-u-end">
<select name="access[parent_id]" data-am-selected="{searchBox: 1, btnSize: 'sm', maxHeight: 420}">
<option value="0"> 顶级权限 </option>
<?php if (isset($accessList)): foreach ($accessList as $access): ?>
<option value="<?= $access['access_id'] ?>"> <?= $access['name_h1'] ?></option>
<?php endforeach; endif; ?>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权限url </label>
<div class="am-u-sm-9 am-u-end">
<input type="text" class="tpl-form-input" name="access[url]"
value="" placeholder="请输入权限url" required>
<small>例如index/index</small>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label">排序 </label>
<div class="am-u-sm-9 am-u-end">
<input type="number" min="0" class="tpl-form-input" name="access[sort]"
value="100">
</div>
</div>
<div class="am-form-group">
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
<button type="submit" class="j-submit am-btn am-btn-secondary">提交
</button>
</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
$(function () {
/**
* 表单验证提交
* @type {*}
*/
$('#my-form').superForm();
});
</script>

View File

@ -0,0 +1,69 @@
<div class="row-content am-cf">
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<form id="my-form" class="am-form tpl-form-line-form" method="post">
<div class="widget-body">
<fieldset>
<div class="widget-head am-cf">
<div class="widget-title am-fl">编辑权限</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权限名称 </label>
<div class="am-u-sm-9 am-u-end">
<input type="text" class="tpl-form-input" name="access[name]"
value="<?= $model['name'] ?>" placeholder="请输入权限名称" required>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">上级权限 </label>
<div class="am-u-sm-9 am-u-end">
<select name="access[parent_id]" data-am-selected="{searchBox: 1, btnSize: 'sm', maxHeight: 420}">
<option value="0"> 顶级权限</option>
<?php if (isset($accessList)): foreach ($accessList as $access): ?>
<option value="<?= $access['access_id'] ?>"
<?= $model['parent_id'] == $access['access_id'] ? 'selected' : '' ?>
<?= $model['access_id'] == $access['access_id'] ? 'disabled' : '' ?>>
<?= $access['name_h1'] ?></option>
<?php endforeach; endif; ?>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权限url </label>
<div class="am-u-sm-9 am-u-end">
<input type="text" class="tpl-form-input" name="access[url]"
value="<?= $model['url'] ?>" placeholder="请输入权限url" required>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label">排序 </label>
<div class="am-u-sm-9 am-u-end">
<input type="number" min="0" class="tpl-form-input" name="access[sort]"
value="<?= $model['sort'] ?>">
</div>
</div>
<div class="am-form-group">
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
<button type="submit" class="j-submit am-btn am-btn-secondary">提交
</button>
</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
</div>
</div>
<script>
$(function () {
/**
* 表单验证提交
* @type {*}
*/
$('#my-form').superForm();
});
</script>

View File

@ -0,0 +1,83 @@
<div class="row-content am-cf">
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<div class="widget-head am-cf">
<div class="widget-title a m-cf">权限列表</div>
</div>
<div class="widget-body am-fr">
<div class="tips am-margin-bottom-sm am-u-sm-12">
<div class="pre">
<p> 1此处数据为商城商户后台的页面url用于给管理员角色设置操作权限</p>
<p> 2:如非二次开发需求,本页面数据无需更改</p>
<p> 3商户后台菜单配置文件source/application/store/extra/menus.php</p>
</div>
</div>
<!-- 工具栏 -->
<div class="page_toolbar am-margin-bottom-xs am-cf">
<div class="am-form-group">
<div class="am-btn-group am-btn-group-xs">
<a class="am-btn am-btn-default am-btn-success"
href="<?= url('store.access/add') ?>">
<span class="am-icon-plus"></span> 新增
</a>
</div>
</div>
</div>
<div class="am-scrollable-horizontal am-u-sm-12">
<table width="100%" class="am-table am-table-compact am-table-striped
tpl-table-black am-text-nowrap">
<thead>
<tr>
<th>权限ID</th>
<th>权限名称</th>
<th>权限url</th>
<th>排序</th>
<th>添加时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php if (!empty($list)): foreach ($list as $item): ?>
<tr>
<td class="am-text-middle"><?= $item['access_id'] ?></td>
<td class="am-text-middle"><?= $item['name_h1'] ?></td>
<td class="am-text-middle"><?= $item['url'] ?></td>
<td class="am-text-middle"><?= $item['sort'] ?></td>
<td class="am-text-middle"><?= $item['create_time'] ?></td>
<td class="am-text-middle">
<div class="tpl-table-black-operation">
<a href="<?= url('store.access/edit', ['access_id' => $item['access_id']]) ?>">
<i class="am-icon-pencil"></i> 编辑
</a>
<a href="javascript:void(0);"
class="item-delete tpl-table-black-operation-del"
data-id="<?= $item['access_id'] ?>">
<i class="am-icon-trash"></i> 删除
</a>
</div>
</td>
</tr>
<?php endforeach; else: ?>
<tr>
<td colspan="6" class="am-text-center">暂无记录</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
// 删除元素
var url = "<?= url('store.access/delete') ?>";
$('.item-delete').delete('access_id', url, '删除后不可恢复,确定要删除吗?');
});
</script>

View File

@ -0,0 +1,70 @@
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<form id="my-form" class="am-form tpl-form-line-form" method="post">
<div class="widget-body">
<fieldset>
<div class="widget-head am-cf">
<div class="widget-title am-fl">新增小程序商城</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 商城名称 </label>
<div class="am-u-sm-9 am-u-end">
<input type="text" class="tpl-form-input" name="store[store_name]" value=""
required>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">排序 </label>
<div class="am-u-sm-9 am-u-end">
<input type="number" min="0" class="tpl-form-input" name="store[sort]" value="100"
required>
<small>数字越小越靠前</small>
</div>
</div>
<div class="am-form-group am-padding-top-sm">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 商家账户名 </label>
<div class="am-u-sm-9 am-u-end">
<input type="text" class="tpl-form-input" name="store[user_name]" value=""
required>
<small>商家后台用户名</small>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 商家账户密码 </label>
<div class="am-u-sm-9 am-u-end">
<input type="password" class="tpl-form-input" name="store[password]" value=""
required>
<small>商家后台用户密码</small>
</div>
</div>
<div class="am-form-group">
<label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 确认密码 </label>
<div class="am-u-sm-9 am-u-end">
<input type="password" class="tpl-form-input" name="store[password_confirm]" value=""
required>
</div>
</div>
<div class="am-form-group">
<div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
<button type="submit" class="j-submit am-btn am-btn-secondary">提交
</button>
</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>
</div>
<script>
$(function () {
/**
* 表单验证提交
* @type {*}
*/
$('#my-form').superForm();
});
</script>

View File

@ -0,0 +1,80 @@
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<div class="widget-head am-cf">
<div class="widget-title am-cf">商城列表</div>
</div>
<div class="widget-body am-fr">
<div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
<div class="am-form-group">
<div class="am-btn-toolbar">
<div class="am-btn-group am-btn-group-xs">
<a class="am-btn am-btn-default am-btn-success am-radius"
href="<?= url('store/add') ?>">
<span class="am-icon-plus"></span> 新增
</a>
</div>
</div>
</div>
</div>
<div class="am-u-sm-12">
<table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
<thead>
<tr>
<th>商城ID</th>
<th>商城名称</th>
<th>添加时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php if (!$list->isEmpty()): foreach ($list as $item): ?>
<tr>
<td class="am-text-middle">
<p class="item-title"><?= $item['wxapp_id'] ?></p>
</td>
<td class="am-text-middle">
<p class="item-title"><?= $names[$item['wxapp_id']] ?></p>
</td>
<td class="am-text-middle"><?= $item['create_time'] ?></td>
<td class="am-text-middle">
<div class="tpl-table-black-operation">
<a href="<?= url('store/enter', ['wxapp_id' => $item['wxapp_id']]) ?>"
class="j-move" data-id="<?= $item['wxapp_id'] ?>" target="_blank">
<i class="am-icon-arrow-right"></i> 进入商城
</a>
<a href="javascript:void(0);" class="j-delete tpl-table-black-operation-del"
data-id="<?= $item['wxapp_id'] ?>">
<i class="am-icon-trash"></i> 删除
</a>
</div>
</td>
</tr>
<?php endforeach; else: ?>
<tr>
<td colspan="4" class="am-text-center">暂无记录</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="am-u-lg-12 am-cf">
<div class="am-fr"><?= $list->render() ?> </div>
<div class="am-fr pagination-total am-margin-right">
<div class="am-vertical-align-middle">总记录:<?= $list->total() ?></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
// 删除元素
var url = "<?= url('store/recovery') ?>";
$('.j-delete').delete('wxapp_id', url, '确定要删除吗?可在回收站中恢复');
});
</script>

View File

@ -0,0 +1,75 @@
<div class="row">
<div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
<div class="widget am-cf">
<div class="widget-head am-cf">
<div class="widget-title am-cf">回收站列表</div>
</div>
<div class="widget-body am-fr">
<div class="am-u-sm-12 am-u-md-6 am-u-lg-6">
<div class="am-form-group">
<div class="am-btn-toolbar">
</div>
</div>
</div>
<div class="am-u-sm-12">
<table width="100%" class="am-table am-table-compact am-table-striped tpl-table-black ">
<thead>
<tr>
<th>商城ID</th>
<th>商城名称</th>
<th>添加时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php if (!$list->isEmpty()): foreach ($list as $item): ?>
<tr>
<td class="am-text-middle">
<p class="item-title"><?= $item['wxapp_id'] ?></p>
</td>
<td class="am-text-middle">
<p class="item-title"><?= $names[$item['wxapp_id']] ?></p>
</td>
<td class="am-text-middle"><?= $item['create_time'] ?></td>
<td class="am-text-middle">
<div class="tpl-table-black-operation">
<a href="javascript:void(0);" class="j-move"
data-id="<?= $item['wxapp_id'] ?>">
<i class="am-icon-undo"></i> 还原
</a>
<a href="javascript:void(0);" class="j-delete tpl-table-black-operation-del"
data-id="<?= $item['wxapp_id'] ?>">
<i class="am-icon-trash"></i> 删除
</a>
</div>
</td>
</tr>
<?php endforeach; else: ?>
<tr>
<td colspan="4" class="am-text-center">暂无记录</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
<div class="am-u-lg-12 am-cf">
<div class="am-fr"><?= $list->render() ?> </div>
<div class="am-fr pagination-total am-margin-right">
<div class="am-vertical-align-middle">总记录:<?= $list->total() ?></div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
$(function () {
// 移出回收站
$('.j-move').delete('wxapp_id', "<?= url('store/move') ?>", '确定要还原吗?');
// 删除小程序
$('.j-delete').delete('wxapp_id', "<?= url('store/delete') ?>", '确定要删除吗?删除后无法恢复');
});
</script>

View File

@ -0,0 +1,114 @@
<?php
namespace app\api\behavior\order;
use app\common\service\Message as MessageService;
use app\common\service\order\Printer as PrinterService;
use app\common\service\wechat\wow\Order as WowOrder;
use app\common\enum\OrderType as OrderTypeEnum;
use app\common\enum\OrderStatus as OrderStatusEnum;
use app\common\enum\order\OrderSource as OrderSourceEnum;
/**
* 订单支付成功后扩展类
* Class PaySuccess
* @package app\api\behavior\order
*/
class PaySuccess
{
// 订单信息
private $order;
// 订单类型
private $orderType;
private $wxappId;
/**
* 订单来源回调业务映射类
* @var array
*/
protected $sourceCallbackClass = [
OrderSourceEnum::MASTER => 'app\api\service\master\order\PaySuccess',
OrderSourceEnum::BARGAIN => 'app\api\service\bargain\order\PaySuccess',
OrderSourceEnum::SHARP => 'app\api\service\sharp\order\PaySuccess',
];
/**
* 执行入口
* @param $order
* @param int $orderType
* @return bool
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function run($order, $orderType = OrderTypeEnum::MASTER)
{
// 设置当前类的属性
$this->setAttribute($order, $orderType);
// 订单公共业务
$this->onCommonEvent();
// 普通订单业务
if ($orderType == OrderTypeEnum::MASTER) {
$this->onMasterEvent();
}
// 订单来源回调业务
$this->onSourceCallback();
return true;
}
/**
* 设置当前类的属性
* @param $order
* @param int $orderType
*/
private function setAttribute($order, $orderType = OrderTypeEnum::MASTER)
{
$this->order = $order;
$this->wxappId = $this->order['wxapp_id'];
$this->orderType = $orderType;
}
/**
* 订单公共业务
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\exception\DbException
*/
private function onCommonEvent()
{
// 发送消息通知
(new MessageService)->payment($this->order, $this->orderType);
// 小票打印
(new PrinterService)->printTicket($this->order, OrderStatusEnum::ORDER_PAYMENT);
}
/**
* 普通订单业务
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
private function onMasterEvent()
{
// 同步好物圈
(new WowOrder($this->wxappId))->import([$this->order], true);
}
/**
* 订单来源回调业务
* @return bool
*/
private function onSourceCallback()
{
if (!isset($this->order['order_source'])) {
return false;
}
if (!isset($this->sourceCallbackClass[$this->order['order_source']])) {
return false;
}
$class = $this->sourceCallbackClass[$this->order['order_source']];
return !is_null($class) ? (new $class)->onPaySuccess($this->order) : false;
}
}

View File

@ -0,0 +1,8 @@
<?php
return [
// 默认输出类型
'default_return_type' => 'json',
// 默认全局过滤方法 用逗号分隔多个
'default_filter' => 'trim,htmlspecialchars,filter_emoji',
];

View File

@ -0,0 +1,112 @@
<?php
namespace app\api\controller;
use app\api\model\UserAddress;
/**
* 收货地址管理
* Class Address
* @package app\api\controller
*/
class Address extends Controller
{
/**
* 收货地址列表
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function lists()
{
$user = $this->getUser();
$model = new UserAddress;
$list = $model->getList($user['user_id']);
return $this->renderSuccess([
'list' => $list,
'default_id' => $user['address_id'],
]);
}
/**
* 添加收货地址
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function add()
{
$model = new UserAddress;
if ($model->add($this->getUser(), $this->request->post())) {
return $this->renderSuccess([], '添加成功');
}
return $this->renderError($model->getError() ?: '添加失败');
}
/**
* 收货地址详情
* @param $address_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function detail($address_id)
{
$user = $this->getUser();
$detail = UserAddress::detail($user['user_id'], $address_id);
$region = array_values($detail['region']);
return $this->renderSuccess(compact('detail', 'region'));
}
/**
* 编辑收货地址
* @param $address_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function edit($address_id)
{
$user = $this->getUser();
$model = UserAddress::detail($user['user_id'], $address_id);
if ($model->edit($this->request->post())) {
return $this->renderSuccess([], '更新成功');
}
return $this->renderError($model->getError() ?: '更新失败');
}
/**
* 设为默认地址
* @param $address_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function setDefault($address_id)
{
$user = $this->getUser();
$model = UserAddress::detail($user['user_id'], $address_id);
if ($model->setDefault($user)) {
return $this->renderSuccess([], '设置成功');
}
return $this->renderError($model->getError() ?: '设置失败');
}
/**
* 删除收货地址
* @param $address_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function delete($address_id)
{
$user = $this->getUser();
$model = UserAddress::detail($user['user_id'], $address_id);
if ($model->remove($user)) {
return $this->renderSuccess([], '删除成功');
}
return $this->renderError($model->getError() ?: '删除失败');
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace app\api\controller;
use app\api\model\Article as ArticleModel;
use app\api\model\article\Category as CategoryModel;
/**
* 文章控制器
* Class Article
* @package app\api\controller
*/
class Article extends Controller
{
/**
* 文章首页
* @return array
*/
public function index()
{
// 文章分类列表
$categoryList = CategoryModel::getAll();
return $this->renderSuccess(compact('categoryList'));
}
/**
* 文章列表
* @param int $category_id
* @return array
* @throws \think\exception\DbException
*/
public function lists($category_id = 0)
{
$model = new ArticleModel;
$list = $model->getList($category_id);
return $this->renderSuccess(compact('list'));
}
/**
* 文章详情
* @param $article_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function detail($article_id)
{
$detail = ArticleModel::detail($article_id);
return $this->renderSuccess(compact('detail'));
}
}

View File

@ -0,0 +1,96 @@
<?php
namespace app\api\controller;
use app\api\model\Cart as CartModel;
use app\api\service\order\Checkout as CheckoutModel;
/**
* 购物车管理
* Class Cart
* @package app\api\controller
*/
class Cart extends Controller
{
/* @var \app\api\model\User $user */
private $user;
/* @var \app\api\model\Cart $model */
private $model;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
$this->user = $this->getUser();
$this->model = new CartModel($this->user);
}
/**
* 购物车列表
* @return array
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists()
{
// 请求参数
$param = $this->request->param();
$cartIds = isset($param['cart_ids']) ? $param['cart_ids'] : '';
// 购物车商品列表
$goodsList = $this->model->getList($cartIds);
// 获取订单结算信息
$Checkout = new CheckoutModel;
$orderInfo = $Checkout->onCheckout($this->user, $goodsList);
return $this->renderSuccess($orderInfo);
}
/**
* 加入购物车
* @param int $goods_id 商品id
* @param int $goods_num 商品数量
* @param string $goods_sku_id 商品sku索引
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function add($goods_id, $goods_num, $goods_sku_id)
{
if (!$this->model->add($goods_id, $goods_num, $goods_sku_id)) {
return $this->renderError($this->model->getError() ?: '加入购物车失败');
}
// 购物车商品总数量
$totalNum = $this->model->getGoodsNum();
return $this->renderSuccess(['cart_total_num' => $totalNum], '加入购物车成功');
}
/**
* 减少购物车商品数量
* @param $goods_id
* @param $goods_sku_id
* @return array
*/
public function sub($goods_id, $goods_sku_id)
{
$this->model->sub($goods_id, $goods_sku_id);
return $this->renderSuccess();
}
/**
* 删除购物车中指定商品
* @param $goods_sku_id (支持字符串ID集)
* @return array
*/
public function delete($goods_sku_id)
{
$this->model->delete($goods_sku_id);
return $this->renderSuccess();
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace app\api\controller;
use app\api\model\Category as CategoryModel;
use app\api\model\WxappCategory as WxappCategoryModel;
/**
* 商品分类控制器
* Class Goods
* @package app\api\controller
*/
class Category extends Controller
{
/**
* 分类页面
* @return array
* @throws \think\exception\DbException
*/
public function index()
{
// 分类模板
$templet = WxappCategoryModel::detail();
// 商品分类列表
$list = array_values(CategoryModel::getCacheTree());
return $this->renderSuccess(compact('templet', 'list'));
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace app\api\controller;
use app\api\model\Comment as CommentModel;
/**
* 商品评价控制器
* Class Comment
* @package app\api\controller
*/
class Comment extends Controller
{
/**
* 商品评价列表
* @param $goods_id
* @param int $scoreType
* @return array
* @throws \think\exception\DbException
*/
public function lists($goods_id, $scoreType = -1)
{
$model = new CommentModel;
$list = $model->getGoodsCommentList($goods_id, $scoreType);
$total = $model->getTotal($goods_id);
return $this->renderSuccess(compact('list', 'total'));
}
}

View File

@ -0,0 +1,139 @@
<?php
namespace app\api\controller;
use app\api\model\User as UserModel;
use app\api\model\Wxapp as WxappModel;
use app\common\exception\BaseException;
/**
* API控制器基类
* Class BaseController
* @package app\store\controller
*/
class Controller extends \think\Controller
{
const JSON_SUCCESS_STATUS = 1;
const JSON_ERROR_STATUS = 0;
/* @ver $wxapp_id 小程序id */
protected $wxapp_id;
/**
* API基类初始化
* @throws BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
// 当前小程序id
$this->wxapp_id = $this->getWxappId();
// 验证当前小程序状态
$this->checkWxapp();
}
/**
* 获取当前小程序ID
* @return mixed
* @throws BaseException
*/
private function getWxappId()
{
if (!$wxapp_id = $this->request->param('wxapp_id')) {
throw new BaseException(['msg' => '缺少必要的参数wxapp_id']);
}
return $wxapp_id;
}
/**
* 验证当前小程序状态
* @throws BaseException
* @throws \think\exception\DbException
*/
private function checkWxapp()
{
$wxapp = WxappModel::detail($this->wxapp_id);
if (empty($wxapp)) {
throw new BaseException(['msg' => '当前小程序信息不存在']);
}
if ($wxapp['is_recycle'] || $wxapp['is_delete']) {
throw new BaseException(['msg' => '当前小程序已删除']);
}
}
/**
* 获取当前用户信息
* @param bool $is_force
* @return UserModel|bool|null
* @throws BaseException
* @throws \think\exception\DbException
*/
protected function getUser($is_force = true)
{
if (!$token = $this->request->param('token')) {
$is_force && $this->throwError('缺少必要的参数token', -1);
return false;
}
if (!$user = UserModel::getUser($token)) {
$is_force && $this->throwError('没有找到用户信息', -1);
return false;
}
return $user;
}
/**
* 输出错误信息
* @param int $code
* @param $msg
* @throws BaseException
*/
protected function throwError($msg, $code = 0)
{
throw new BaseException(['code' => $code, 'msg' => $msg]);
}
/**
* 返回封装后的 API 数据到客户端
* @param int $code
* @param string $msg
* @param array $data
* @return array
*/
protected function renderJson($code = self::JSON_SUCCESS_STATUS, $msg = '', $data = [])
{
return compact('code', 'msg', 'data');
}
/**
* 返回操作成功json
* @param array $data
* @param string|array $msg
* @return array
*/
protected function renderSuccess($data = [], $msg = 'success')
{
return $this->renderJson(self::JSON_SUCCESS_STATUS, $msg, $data);
}
/**
* 返回操作失败json
* @param string $msg
* @param array $data
* @return array
*/
protected function renderError($msg = 'error', $data = [])
{
return $this->renderJson(self::JSON_ERROR_STATUS, $msg, $data);
}
/**
* 获取post数据 (数组)
* @param $key
* @return mixed
*/
protected function postData($key = null)
{
return $this->request->post(is_null($key) ? '' : $key . '/a');
}
}

View File

@ -0,0 +1,29 @@
<?php
namespace app\api\controller;
use app\api\model\Coupon as CouponModel;
/**
* 优惠券中心
* Class Coupon
* @package app\api\controller
*/
class Coupon extends Controller
{
/**
* 优惠券列表
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists()
{
$model = new CouponModel;
$list = $model->getList($this->getUser(false));
return $this->renderSuccess(compact('list'));
}
}

View File

@ -0,0 +1,81 @@
<?php
namespace app\api\controller;
use app\api\model\Goods as GoodsModel;
use app\api\model\Cart as CartModel;
use app\common\service\qrcode\Goods as GoodsPoster;
/**
* 商品控制器
* Class Goods
* @package app\api\controller
*/
class Goods extends Controller
{
/**
* 商品列表
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function lists()
{
// 整理请求的参数
$param = array_merge($this->request->param(), [
'status' => 10
]);
// 获取列表数据
$model = new GoodsModel;
$list = $model->getList($param, $this->getUser(false));
return $this->renderSuccess(compact('list'));
}
/**
* 获取商品详情
* @param $goods_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function detail($goods_id)
{
// 用户信息
$user = $this->getUser(false);
// 商品详情
$model = new GoodsModel;
$goods = $model->getDetails($goods_id, $this->getUser(false));
if ($goods === false) {
return $this->renderError($model->getError() ?: '商品信息不存在');
}
// 多规格商品sku信息, todo: 已废弃 v1.1.25
$specData = $goods['spec_type'] == 20 ? $model->getManySpecData($goods['spec_rel'], $goods['sku']) : null;
return $this->renderSuccess([
// 商品详情
'detail' => $goods,
// 购物车商品总数量
'cart_total_num' => $user ? (new CartModel($user))->getGoodsNum() : 0,
// 多规格商品sku信息
'specData' => $specData,
]);
}
/**
* 生成商品海报
* @param $goods_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function poster($goods_id)
{
// 商品详情
$detail = GoodsModel::detail($goods_id);
$Qrcode = new GoodsPoster($detail, $this->getUser(false));
return $this->renderSuccess([
'qrcode' => $Qrcode->getImage(),
]);
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace app\api\controller;
use app\common\library\wechat\WxPay;
/**
* 支付成功异步通知接口
* Class Notify
* @package app\api\controller
*/
class Notify
{
/**
* 支付成功异步通知
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function order()
{
// 微信支付组件:验证异步通知
$WxPay = new WxPay();
$WxPay->notify();
}
}

View File

@ -0,0 +1,141 @@
<?php
namespace app\api\controller;
use app\api\model\Cart as CartModel;
use app\api\model\Order as OrderModel;
use app\api\service\order\Checkout as CheckoutModel;
use app\api\validate\order\Checkout as CheckoutValidate;
/**
* 订单控制器
* Class Order
* @package app\api\controller
*/
class Order extends Controller
{
/* @var \app\api\model\User $user */
private $user;
/* @var CheckoutValidate $validate */
private $validate;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
// 用户信息
$this->user = $this->getUser();
// 验证类
$this->validate = new CheckoutValidate;
}
/**
* 订单确认-立即购买
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function buyNow()
{
// 实例化结算台服务
$Checkout = new CheckoutModel;
// 订单结算api参数
$params = $Checkout->setParam($this->getParam([
'goods_id' => 0,
'goods_num' => 0,
'goods_sku_id' => '',
]));
// 表单验证
if (!$this->validate->scene('buyNow')->check($params)) {
return $this->renderError($this->validate->getError());
}
// 立即购买:获取订单商品列表
$model = new OrderModel;
$goodsList = $model->getOrderGoodsListByNow(
$params['goods_id'],
$params['goods_sku_id'],
$params['goods_num']
);
// 获取订单确认信息
$orderInfo = $Checkout->onCheckout($this->user, $goodsList);
if ($this->request->isGet()) {
return $this->renderSuccess($orderInfo);
}
// 订单结算提交
if ($Checkout->hasError()) {
return $this->renderError($Checkout->getError());
}
// 创建订单
if (!$Checkout->createOrder($orderInfo)) {
return $this->renderError($Checkout->getError() ?: '订单创建失败');
}
// 构建微信支付请求
$payment = $model->onOrderPayment($this->user, $Checkout->model, $params['pay_type']);
// 返回结算信息
return $this->renderSuccess([
'order_id' => $Checkout->model['order_id'], // 订单id
'pay_type' => $params['pay_type'], // 支付方式
'payment' => $payment // 微信支付参数
], ['success' => '支付成功', 'error' => '订单未支付']);
}
/**
* 订单确认-购物车结算
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function cart()
{
// 实例化结算台服务
$Checkout = new CheckoutModel;
// 订单结算api参数
$params = $Checkout->setParam($this->getParam([
'cart_ids' => '',
]));
// 商品结算信息
$CartModel = new CartModel($this->user);
// 购物车商品列表
$goodsList = $CartModel->getList($params['cart_ids']);
// 获取订单结算信息
$orderInfo = $Checkout->onCheckout($this->user, $goodsList);
if ($this->request->isGet()) {
return $this->renderSuccess($orderInfo);
}
// 创建订单
if (!$Checkout->createOrder($orderInfo)) {
return $this->renderError($Checkout->getError() ?: '订单创建失败');
}
// 移出购物车中已下单的商品
$CartModel->clearAll($params['cart_ids']);
// 构建微信支付请求
$payment = $Checkout->onOrderPayment();
// 返回状态
return $this->renderSuccess([
'order_id' => $Checkout->model['order_id'], // 订单id
'pay_type' => $params['pay_type'], // 支付方式
'payment' => $payment // 微信支付参数
], ['success' => '支付成功', 'error' => '订单未支付']);
}
/**
* 订单结算提交的参数
* @param array $define
* @return array
*/
private function getParam($define = [])
{
return array_merge($define, $this->request->param());
}
}

View File

@ -0,0 +1,31 @@
<?php
namespace app\api\controller;
use app\api\model\WxappPage;
/**
* 页面控制器
* Class Index
* @package app\api\controller
*/
class Page extends Controller
{
/**
* 页面数据
* @param null $page_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index($page_id = null)
{
// 页面元素
$data = WxappPage::getPageData($this->getUser(false), $page_id);
return $this->renderSuccess($data);
}
}

View File

@ -0,0 +1,67 @@
<?php
namespace app\api\controller;
use app\api\model\Setting as SettingModel;
use app\api\model\recharge\Plan as PlanModel;
use app\api\model\recharge\Order as OrderModel;
use app\api\service\Payment as PaymentService;
use app\common\enum\OrderType as OrderTypeEnum;
/**
* 用户充值管理
* Class Recharge
* @package app\api\controller
*/
class Recharge extends Controller
{
/**
* 充值中心
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
// 用户信息
$userInfo = $this->getUser();
// 充值套餐列表
$planList = (new PlanModel)->getList();
// 充值设置
$setting = SettingModel::getItem('recharge');
return $this->renderSuccess(compact('userInfo', 'planList', 'setting'));
}
/**
* 确认充值
* @param null $planId
* @param int $customMoney
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function submit($planId = null, $customMoney = 0)
{
// 用户信息
$userInfo = $this->getUser();
// 生成充值订单
$model = new OrderModel;
if (!$model->createOrder($userInfo, $planId, $customMoney)) {
return $this->renderError($model->getError() ?: '充值失败');
}
// 构建微信支付
$payment = PaymentService::wechat(
$userInfo,
$model['order_id'],
$model['order_no'],
$model['pay_price'],
OrderTypeEnum::RECHARGE
);
// 充值状态提醒
$message = ['success' => '充值成功', 'error' => '订单未支付'];
return $this->renderSuccess(compact('payment', 'message'), $message);
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace app\api\controller;
use app\api\model\store\Shop as ShopModel;
/**
* 门店列表
* Class Shop
* @package app\api\controller
*/
class Shop extends Controller
{
/**
* 门店列表
* @param string $longitude
* @param string $latitude
* @return array
* @throws \think\exception\DbException
*/
public function lists($longitude = '', $latitude = '')
{
$model = new ShopModel;
$list = $model->getList(true, $longitude, $latitude);
return $this->renderSuccess(compact('list'));
}
/**
* 门店详情
* @param $shop_id
* @return array
* @throws \think\exception\DbException
*/
public function detail($shop_id)
{
$detail = ShopModel::detail($shop_id);
return $this->renderSuccess(compact('detail'));
}
}

View File

@ -0,0 +1,86 @@
<?php
namespace app\api\controller;
use app\api\model\UploadFile;
use app\api\model\Setting as SettingModel;
use app\common\library\storage\Driver as StorageDriver;
/**
* 文件库管理
* Class Upload
* @package app\api\controller
*/
class Upload extends Controller
{
private $config;
private $user;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
// 存储配置信息
$this->config = SettingModel::getItem('storage');
// 验证用户
$this->user = $this->getUser();
}
/**
* 图片上传接口
* @return array
* @throws \think\Exception
*/
public function image()
{
// 实例化存储驱动
$StorageDriver = new StorageDriver($this->config);
// 设置上传文件的信息
$StorageDriver->setUploadFile('iFile');
// 上传图片
if (!$StorageDriver->upload()) {
return json(['code' => 0, 'msg' => '图片上传失败' . $StorageDriver->getError()]);
}
// 图片上传路径
$fileName = $StorageDriver->getFileName();
// 图片信息
$fileInfo = $StorageDriver->getFileInfo();
// 添加文件库记录
$uploadFile = $this->addUploadFile($fileName, $fileInfo, 'image');
// 图片上传成功
return json(['code' => 1, 'msg' => '图片上传成功', 'data' => $uploadFile->visible(['file_id'])]);
}
/**
* 添加文件库上传记录
* @param $fileName
* @param $fileInfo
* @param $fileType
* @return UploadFile
*/
private function addUploadFile($fileName, $fileInfo, $fileType)
{
// 存储引擎
$storage = $this->config['default'];
// 存储域名
$fileUrl = isset($this->config['engine'][$storage]['domain'])
? $this->config['engine'][$storage]['domain'] : '';
// 添加文件库记录
$model = new UploadFile;
$model->add([
'storage' => $storage,
'file_url' => $fileUrl,
'file_name' => $fileName,
'file_size' => $fileInfo['size'],
'file_type' => $fileType,
'extension' => pathinfo($fileInfo['name'], PATHINFO_EXTENSION),
'is_user' => 1
]);
return $model;
}
}

View File

@ -0,0 +1,43 @@
<?php
namespace app\api\controller;
use app\api\model\User as UserModel;
/**
* 用户管理
* Class User
* @package app\api
*/
class User extends Controller
{
/**
* 用户自动登录
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function login()
{
$model = new UserModel;
return $this->renderSuccess([
'user_id' => $model->login($this->request->post()),
'token' => $model->getToken()
]);
}
/**
* 当前用户详情
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function detail()
{
// 当前用户信息
$userInfo = $this->getUser();
return $this->renderSuccess(compact('userInfo'));
}
}

View File

@ -0,0 +1,39 @@
<?php
namespace app\api\controller;
use app\api\model\Wxapp as WxappModel;
use app\api\model\WxappHelp;
/**
* 微信小程序
* Class Wxapp
* @package app\api\controller
*/
class Wxapp extends Controller
{
/**
* 小程序基础信息
* @return array
*/
public function base()
{
// $wxapp = WxappModel::getWxappCache();
return $this->renderSuccess([]);
}
/**
* 帮助中心
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function help()
{
$model = new WxappHelp;
$list = $model->getList();
return $this->renderSuccess(compact('list'));
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace app\api\controller\balance;
use app\api\controller\Controller;
use app\api\model\user\BalanceLog as BalanceLogModel;
/**
* 余额账单明细
* Class Log
* @package app\api\controller\balance
*/
class Log extends Controller
{
/**
* 余额账单明细列表
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function lists()
{
$user = $this->getUser();
$list = (new BalanceLogModel)->getList($user['user_id']);
return $this->renderSuccess(compact('list'));
}
}

View File

@ -0,0 +1,84 @@
<?php
namespace app\api\controller\bargain;
use app\api\controller\Controller;
use app\api\model\Goods as GoodsModel;
use app\api\model\bargain\Active as ActiveModel;
use app\api\model\bargain\Setting as SettingModel;
use app\common\service\qrcode\bargain\Goods as GoodsPoster;
/**
* 砍价活动管理
* Class Active
* @package app\api\controller\bargain
*/
class Active extends Controller
{
/**
* 砍价活动会场列表
* @return array
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists()
{
// 获取砍价活动会场列表
$model = new ActiveModel;
$activeList = $model->getHallList();
return $this->renderSuccess(compact('activeList'));
}
/**
* 砍价活动详情
* @param $active_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function detail($active_id)
{
// 获取砍价活动详情
$model = new ActiveModel;
$active = $model->getDetail($active_id);
if ($active === false) {
return $this->renderError($model->getError());
}
// 标记当前用户是否正在参与
$task_id = $model->getWhetherPartake($active_id, $this->getUser(false));
$is_partake = $task_id > 0;
// 获取商品详情
$goods = GoodsModel::detail($active['goods_id']);
// 砍价规则
$setting = SettingModel::getBasic();
return $this->renderSuccess(compact('active', 'goods', 'setting', 'is_partake', 'task_id'));
}
/**
* 生成商品海报
* @param $active_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function poster($active_id)
{
// 获取砍价活动详情
$model = new ActiveModel;
$active = $model->getDetail($active_id);
if ($active === false) {
return $this->renderError($model->getError());
}
// 获取商品详情
$goods = GoodsModel::detail($active['goods_id']);
// 生成商品海报图
$Qrcode = new GoodsPoster($active, $goods, $this->getUser(false));
return $this->renderSuccess([
'qrcode' => $Qrcode->getImage(),
]);
}
}

View File

@ -0,0 +1,101 @@
<?php
namespace app\api\controller\bargain;
use app\api\controller\Controller;
use app\api\model\bargain\Task as TaskModel;
use app\api\model\bargain\Setting as SettingModel;
use app\api\service\order\Checkout as CheckoutModel;
use app\common\enum\order\OrderSource as OrderSourceEnum;
class Order extends Controller
{
/* @var \app\api\model\User $user */
private $user;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
// 用户信息
$this->user = $this->getUser();
}
/**
* 砍价订单结算
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function checkout()
{
// 实例化结算台服务
$Checkout = new CheckoutModel;
// 订单结算api参数
$params = $Checkout->setParam($this->getParam([
'task_id' => 0
]));
// 获取砍价任务详情
$task = TaskModel::detail($params['task_id']);
// 获取砍价商品信息
$goodsList = $task->getTaskGoods($params['task_id']);
if ($goodsList === false) {
return $this->renderError($task->getError());
}
// 设置订单来源
$Checkout->setOrderSource([
'source' => OrderSourceEnum::BARGAIN,
'source_id' => $params['task_id'],
]);
// 砍价商品不参与 等级折扣和优惠券折扣
$Checkout->setCheckoutRule([
'is_user_grade' => false,
'is_coupon' => false,
'is_use_points' => false,
'is_dealer' => SettingModel::getIsDealer(),
]);
// 获取订单结算信息
$orderInfo = $Checkout->onCheckout($this->user, $goodsList);
if ($this->request->isGet()) {
return $this->renderSuccess($orderInfo);
}
// submit订单结算提交
if ($Checkout->hasError()) {
return $this->renderError($Checkout->getError());
}
// 创建订单
if (!$Checkout->createOrder($orderInfo)) {
return $this->renderError($Checkout->getError() ?: '订单创建失败');
}
// 订单创建后将砍价任务结束
$task->setTaskEnd();
// 构建微信支付请求
$payment = $Checkout->onOrderPayment();
// 支付状态提醒
$message = ['success' => '支付成功', 'error' => '订单未支付'];
return $this->renderSuccess([
'order_id' => $Checkout->model['order_id'], // 订单id
'pay_type' => $params['pay_type'], // 支付方式
'payment' => $payment // 微信支付参数
], $message);
}
/**
* 订单结算提交的参数
* @param array $define
* @return array
*/
private function getParam($define = [])
{
return array_merge($define, $this->request->param());
}
}

View File

@ -0,0 +1,91 @@
<?php
namespace app\api\controller\bargain;
use app\api\controller\Controller;
use app\api\model\bargain\Task as TaskModel;
use app\api\model\bargain\Setting as SettingModel;
use app\common\library\Lock;
class Task extends Controller
{
/**
* 我的砍价列表
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function lists()
{
$model = new TaskModel;
$myList = $model->getMyList($this->getUser()['user_id']);
return $this->renderSuccess(compact('myList'));
}
/**
* 创建砍价任务
* @param $active_id
* @param $goods_sku_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function partake($active_id, $goods_sku_id)
{
// 用户信息
$user = $this->getUser();
// 创建砍价任务
$model = new TaskModel;
if (!$model->partake($user['user_id'], $active_id, $goods_sku_id)) {
return $this->renderError($model->getError() ?: '砍价任务创建失败');
}
return $this->renderSuccess([
'task_id' => $model['task_id']
]);
}
/**
* 获取砍价任务详情
* @param $task_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function detail($task_id)
{
$model = new TaskModel;
$detail = $model->getTaskDetail($task_id, $this->getUser(false));
if ($detail === false) {
return $this->renderError($model->getError());
}
// 砍价规则
$setting = SettingModel::getBasic();
return $this->renderSuccess(array_merge($detail, ['setting' => $setting]));
}
/**
* 帮砍一刀
* @param $task_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function help_cut($task_id)
{
// 加阻塞锁, 防止并发
Lock::lockUp("bargain_help_cut_{$task_id}");
// 砍价任务详情
$model = TaskModel::detail($task_id);
// 砍一刀的金额
$cut_money = $model->getCutMoney();
// 帮砍一刀事件
$status = $model->helpCut($this->getUser());
// 解除并发锁
Lock::unLock("bargain_help_cut_{$task_id}");
if ($status == true) {
return $this->renderSuccess(compact('cut_money'), '砍价成功');
}
return $this->renderError($model->getError() ?: '砍价失败');
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace app\api\controller\points;
use app\api\controller\Controller;
use app\api\model\user\PointsLog as PointsLogModel;
/**
* 余额账单明细
* Class Log
* @package app\api\controller\balance
*/
class Log extends Controller
{
/**
* 积分明细列表
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function index()
{
$user = $this->getUser();
$list = (new PointsLogModel)->getList($user['user_id']);
return $this->renderSuccess(compact('list'));
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace app\api\controller\recharge;
use app\api\controller\Controller;
use app\api\model\recharge\Order as OrderModel;
/**
* 充值记录
* Class Order
* @package app\api\controller\user\balance
*/
class Order extends Controller
{
/**
* 我的充值记录列表
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function lists()
{
$user = $this->getUser();
$list = (new OrderModel)->getList($user['user_id']);
return $this->renderSuccess(compact('list'));
}
}

View File

@ -0,0 +1,38 @@
<?php
namespace app\api\controller\sharing;
use app\api\controller\Controller;
use app\api\model\sharing\Active as ActiveModel;
use app\api\model\sharing\Goods as GoodsModel;
/**
* 拼团拼单控制器
* Class Active
* @package app\api\controller\sharing
*/
class Active extends Controller
{
/**
* 拼单详情
* @param $active_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function detail($active_id)
{
// 拼单详情
$detail = ActiveModel::detail($active_id);
if (!$detail) {
return $this->renderError('很抱歉,拼单不存在');
}
// 拼团商品详情
$model = new GoodsModel;
$goods = $model->getDetails($detail['goods_id'], $this->getUser(false));
// 更多拼团商品
$goodsList = $model->getList([], $this->getUser(false));
return $this->renderSuccess(compact('detail', 'goods', 'goodsList'));
}
}

View File

@ -0,0 +1,68 @@
<?php
namespace app\api\controller\sharing;
use app\api\controller\Controller;
use app\api\model\sharing\Order as OrderModel;
use app\api\model\sharing\OrderGoods as OrderGoodsModel;
use app\api\model\sharing\Comment as CommentModel;
/**
* 拼团订单评价管理
* Class Comment
* @package app\api\controller\sharing
*/
class Comment extends Controller
{
/**
* 待评价订单商品列表
* @param $order_id
* @return array
* @throws \Exception
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function order($order_id)
{
// 用户信息
$user = $this->getUser();
// 订单信息
$order = OrderModel::getUserOrderDetail($order_id, $user['user_id']);
// 验证订单是否已完成
$model = new CommentModel;
if (!$model->checkOrderAllowComment($order)) {
return $this->renderError($model->getError());
}
// 待评价商品列表
/* @var \think\Collection $goodsList */
$goodsList = OrderGoodsModel::getNotCommentGoodsList($order_id);
if ($goodsList->isEmpty()) {
return $this->renderError('该订单没有可评价的商品');
}
// 提交商品评价
if ($this->request->isPost()) {
$formData = $this->request->post('formData', '', null);
if ($model->addForOrder($order, $goodsList, $formData)) {
return $this->renderSuccess([], '评价发表成功');
}
return $this->renderError($model->getError() ?: '评价发表失败');
}
return $this->renderSuccess(compact('goodsList'));
}
/**
* 商品评价列表
* @param $goods_id
* @param int $scoreType
* @return array
* @throws \think\exception\DbException
*/
public function lists($goods_id, $scoreType = -1)
{
$model = new CommentModel;
$list = $model->getGoodsCommentList($goods_id, $scoreType);
$total = $model->getTotal($goods_id);
return $this->renderSuccess(compact('list', 'total'));
}
}

View File

@ -0,0 +1,83 @@
<?php
namespace app\api\controller\sharing;
use app\api\controller\Controller;
use app\api\model\sharing\Goods as GoodsModel;
use app\common\service\qrcode\Goods as GoodsPoster;
use app\api\model\sharing\Active as ActiveModel;
/**
* 商品控制器
* Class Goods
* @package app\api\controller
*/
class Goods extends Controller
{
/**
* 商品列表
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function lists()
{
// 整理请求的参数
$param = array_merge($this->request->param(), [
'status' => 10
]);
// 获取列表数据
$model = new GoodsModel;
$list = $model->getList($param, $this->getUser(false));
return $this->renderSuccess(compact('list'));
}
/**
* 获取商品详情
* @param $goods_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function detail($goods_id)
{
// 商品详情
$model = new GoodsModel;
$goods = $model->getDetails($goods_id, $this->getUser(false));
if ($goods === false) {
return $this->renderError($model->getError() ?: '商品信息不存在');
}
// 多规格商品sku信息, todo: 已废弃 v1.1.25
$specData = $goods['spec_type'] == 20 ? $model->getManySpecData($goods['spec_rel'], $goods['sku']) : null;
// 当前进行中的拼单
$activeList = ActiveModel::getActivityListByGoods($goods_id, 2);
return $this->renderSuccess([
// 商品详情
'detail' => $goods,
// 当前进行中的拼单
'activeList' => $activeList,
// 多规格商品sku信息
'specData' => $specData,
]);
}
/**
* 生成商品海报
* @param $goods_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function poster($goods_id)
{
// 商品详情
$detail = GoodsModel::detail($goods_id);
// 生成推广二维码
$Qrcode = new GoodsPoster($detail, $this->getUser(false), 20);
return $this->renderSuccess([
'qrcode' => $Qrcode->getImage(),
]);
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace app\api\controller\sharing;
use app\api\controller\Controller;
use app\api\model\sharing\Category as CategoryModel;
/**
* 拼团首页控制器
* Class Active
* @package app\api\controller\sharing
*/
class Index extends Controller
{
/**
* 拼团首页
* @return array
*/
public function index()
{
// 拼团分类列表
$categoryList = CategoryModel::getCacheAll();
return $this->renderSuccess(compact('categoryList'));
}
}

View File

@ -0,0 +1,242 @@
<?php
namespace app\api\controller\sharing;
use app\api\controller\Controller;
use app\api\model\Setting as SettingModel;
use app\api\model\sharing\Order as OrderModel;
use app\api\service\sharing\order\Checkout as CheckoutModel;
use app\api\validate\sharing\order\Checkout as CheckoutValidate;
use app\common\enum\OrderType as OrderTypeEnum;
use app\common\enum\order\PayType as PayTypeEnum;
use app\common\service\qrcode\Extract as ExtractQRcode;
/**
* 拼团订单控制器
* Class Order
* @package app\api\controller
*/
class Order extends Controller
{
/* @var \app\api\model\User $user */
private $user;
/* @var CheckoutValidate $validate */
private $validate;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
// 用户信息
$this->user = $this->getUser();
// 验证类
$this->validate = new CheckoutValidate;
}
/**
* 订单结算台
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function checkout()
{
// 实例化结算台服务
$Checkout = new CheckoutModel;
// 订单结算api参数
$params = $Checkout->setParam($this->getParam([
'goods_id' => 0,
'goods_num' => 0,
'goods_sku_id' => '',
]));
// 表单验证
if (!$this->validate->scene('buyNow')->check($params)) {
return $this->renderError($this->validate->getError());
}
// 立即购买:获取订单商品列表
$model = new OrderModel;
$goodsList = $model->getOrderGoodsListByNow($params);
// 获取订单确认信息
$orderInfo = $Checkout->onCheckout($this->user, $goodsList);
if ($this->request->isGet()) {
return $this->renderSuccess($orderInfo);
}
// 订单结算提交
if ($Checkout->hasError()) {
return $this->renderError($Checkout->getError());
}
// 创建订单
if (!$Checkout->createOrder($orderInfo)) {
return $this->renderError($Checkout->getError() ?: '订单创建失败');
}
// 构建微信支付请求
$payment = $model->onOrderPayment($this->user, $Checkout->model, $params['pay_type']);
// 返回结算信息
return $this->renderSuccess([
'order_id' => $Checkout->model['order_id'], // 订单id
'pay_type' => $params['pay_type'], // 支付方式
'payment' => $payment // 微信支付参数
], ['success' => '支付成功', 'error' => '订单未支付']);
}
/**
* 订单结算提交的参数
* @param array $define
* @return array
*/
private function getParam($define = [])
{
return array_merge($define, $this->request->param());
}
/**
* 我的拼团订单列表
* @param $dataType
* @return array
* @throws \think\exception\DbException
*/
public function lists($dataType)
{
$model = new OrderModel;
$list = $model->getList($this->user['user_id'], $dataType);
return $this->renderSuccess(compact('list'));
}
/**
* 拼团订单详情信息
* @param $order_id
* @return array
* @throws \app\common\exception\BaseException
*/
public function detail($order_id)
{
// 订单详情
$model = OrderModel::getUserOrderDetail($order_id, $this->user['user_id']);
// 该订单是否允许申请售后
$model['isAllowRefund'] = $model->isAllowRefund();
return $this->renderSuccess([
'order' => $model, // 订单详情
'setting' => [
// 积分名称
'points_name' => SettingModel::getPointsName(),
],
]);
}
/**
* 获取物流信息
* @param $order_id
* @return array
* @throws \app\common\exception\BaseException
*/
public function express($order_id)
{
// 订单信息
$order = OrderModel::getUserOrderDetail($order_id, $this->user['user_id']);
if (!$order['express_no']) {
return $this->renderError('没有物流信息');
}
// 获取物流信息
/* @var \app\store\model\Express $model */
$model = $order['express'];
$express = $model->dynamic($model['express_name'], $model['express_code'], $order['express_no']);
if ($express === false) {
return $this->renderError($model->getError());
}
return $this->renderSuccess(compact('express'));
}
/**
* 取消订单
* @param $order_id
* @return array
* @throws \app\common\exception\BaseException
*/
public function cancel($order_id)
{
$model = OrderModel::getUserOrderDetail($order_id, $this->user['user_id']);
if ($model->cancel($this->user)) {
return $this->renderSuccess($model->getError() ?: '订单取消成功');
}
return $this->renderError($model->getError() ?: '订单取消失败');
}
/**
* 确认收货
* @param $order_id
* @return array
* @throws \app\common\exception\BaseException
*/
public function receipt($order_id)
{
$model = OrderModel::getUserOrderDetail($order_id, $this->user['user_id']);
if ($model->receipt()) {
return $this->renderSuccess();
}
return $this->renderError($model->getError());
}
/**
* 立即支付
* @param int $order_id 订单id
* @param int $payType 支付方式
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function pay($order_id, $payType = PayTypeEnum::WECHAT)
{
// 订单详情
$model = OrderModel::getUserOrderDetail($order_id, $this->user['user_id']);
// 订单支付事件
if (!$model->onPay($payType)) {
return $this->renderError($model->getError() ?: '订单支付失败');
}
// 构建微信支付请求
$payment = $model->onOrderPayment($this->user, $model, $payType);
// 支付状态提醒
return $this->renderSuccess([
'order_id' => $model['order_id'], // 订单id
'pay_type' => $payType, // 支付方式
'payment' => $payment // 微信支付参数
], ['success' => '支付成功', 'error' => '订单未支付']);
}
/**
* 获取订单核销二维码
* @param $order_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function extractQrcode($order_id)
{
// 订单详情
$order = OrderModel::getUserOrderDetail($order_id, $this->user['user_id']);
// 判断是否为待核销订单
if (!$order->checkExtractOrder($order)) {
return $this->renderError($order->getError());
}
$Qrcode = new ExtractQRcode(
$this->wxapp_id,
$this->user,
$order_id,
OrderTypeEnum::SHARING
);
return $this->renderSuccess([
'qrcode' => $Qrcode->getImage(),
]);
}
}

View File

@ -0,0 +1,109 @@
<?php
namespace app\api\controller\sharing;
use app\api\controller\Controller;
use app\api\model\Express as ExpressModel;
use app\api\model\sharing\OrderGoods as OrderGoodsModel;
use app\api\model\sharing\OrderRefund as OrderRefundModel;
/**
* 拼团订单售后服务
* Class Refund
* @package app\api\controller\user\order
*/
class Refund extends Controller
{
/* @var \app\api\model\User $user */
private $user;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
$this->user = $this->getUser(); // 用户信息
}
/**
* 用户售后单列表
* @param int $state
* @return array
* @throws \think\exception\DbException
*/
public function lists($state = -1)
{
$model = new OrderRefundModel;
$list = $model->getList($this->user['user_id'], (int)$state);
return $this->renderSuccess(compact('list'));
}
/**
* 申请售后
* @param $order_goods_id
* @return array
* @throws \think\exception\DbException
* @throws \Exception
*/
public function apply($order_goods_id)
{
// 订单商品详情
$goods = OrderGoodsModel::detail($order_goods_id);
if (isset($goods['refund']) && !empty($goods['refund'])) {
return $this->renderError('当前商品已申请售后');
}
if (!$this->request->isPost()) {
return $this->renderSuccess(['detail' => $goods]);
}
// 新增售后单记录
$model = new OrderRefundModel;
if ($model->apply($this->user, $goods, $this->request->post())) {
return $this->renderSuccess([], '提交成功');
}
return $this->renderError($model->getError() ?: '提交失败');
}
/**
* 售后单详情
* @param $order_refund_id
* @return array
* @throws \think\exception\DbException
*/
public function detail($order_refund_id)
{
// 售后单详情
$detail = OrderRefundModel::detail([
'user_id' => $this->user['user_id'],
'order_refund_id' => $order_refund_id
]);
if (empty($detail)) {
return $this->renderError('售后单不存在');
}
// 物流公司列表
$expressList = ExpressModel::getAll();
return $this->renderSuccess(compact('detail', 'expressList'));
}
/**
* 用户发货
* @param $order_refund_id
* @return array
* @throws \think\exception\DbException
*/
public function delivery($order_refund_id)
{
// 售后单详情
$model = OrderRefundModel::detail([
'user_id' => $this->user['user_id'],
'order_refund_id' => $order_refund_id
]);
if ($model->delivery($this->postData())) {
return $this->renderSuccess([], '操作成功');
}
return $this->renderError($model->getError() ?: '提交失败');
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace app\api\controller\sharing;
use app\api\controller\Controller;
use app\api\model\sharing\Setting as SettingModel;
/**
* 拼团设置控制器
* Class Setting
* @package app\api\controller\sharing
*/
class Setting extends Controller
{
/**
* 获取所有设置
* @return array
*/
public function getAll()
{
$basic = SettingModel::getItem('basic');
return $this->renderSuccess(['setting' => compact('basic')]);
}
}

View File

@ -0,0 +1,70 @@
<?php
namespace app\api\controller\sharp;
use app\api\controller\Controller;
use app\api\service\sharp\Active as ActiveService;
use app\common\service\qrcode\sharp\Goods as GoodsPoster;
/**
* 整点秒杀-商品管理
* Class Goods
* @package app\api\controller\sharp
*/
class Goods extends Controller
{
/**
* 秒杀活动商品列表
* @param $active_time_id
* @return array
*/
public function lists($active_time_id)
{
// 获取秒杀活动会场首页数据
$service = new ActiveService;
$list = $service->getGoodsListByActiveTimeId($active_time_id);
return $this->renderSuccess(compact('list'));
}
/**
* 获取活动商品详情
* @param $active_time_id
* @param $sharp_goods_id
* @return array
* @throws \think\exception\DbException
*/
public function detail($active_time_id, $sharp_goods_id)
{
// 获取秒杀活动商品详情
$service = new ActiveService;
$data = $service->getyActiveGoodsDetail($active_time_id, $sharp_goods_id);
if ($data === false) {
return $this->renderError($service->getError());
}
return $this->renderSuccess($data);
}
/**
* 生成商品海报
* @param $active_time_id
* @param $sharp_goods_id
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function poster($active_time_id, $sharp_goods_id)
{
// 获取秒杀活动商品详情
$service = new ActiveService;
$data = $service->getyActiveGoodsDetail($active_time_id, $sharp_goods_id);
if ($data === false) {
return $this->renderError($service->getError());
}
// 生成商品海报图
$Qrcode = new GoodsPoster($data['active'], $data['goods'], $this->getUser(false));
return $this->renderSuccess([
'qrcode' => $Qrcode->getImage(),
]);
}
}

View File

@ -0,0 +1,32 @@
<?php
namespace app\api\controller\sharp;
use app\api\controller\Controller;
use app\api\service\sharp\Active as ActiveService;
/**
* 整点秒杀-秒杀首页
* Class index
* @package app\api\controller\sharp
*/
class Index extends Controller
{
/**
* 秒杀活动首页
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function index()
{
// 获取秒杀活动会场首页数据
$service = new ActiveService;
$data = $service->getHallIndex();
if (empty($data['tabbar'])) {
return $this->renderError('很抱歉,暂无秒杀活动');
}
return $this->renderSuccess($data);
}
}

View File

@ -0,0 +1,114 @@
<?php
namespace app\api\controller\sharp;
use app\api\controller\Controller;
use app\api\model\sharp\Setting as SettingModel;
use app\api\service\order\Checkout as CheckoutModel;
use app\api\service\sharp\Active as ActiveService;
use app\common\enum\order\OrderSource as OrderSourceEnum;
use app\common\library\Lock;
class Order extends Controller
{
/* @var \app\api\model\User $user */
private $user;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
// 用户信息
$this->user = $this->getUser();
}
/**
* 秒杀订单结算
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \Exception
*/
public function checkout()
{
// 实例化结算台服务
$Checkout = new CheckoutModel;
// 订单结算api参数
$params = $Checkout->setParam($this->getParam([
'active_time_id' => 0,
'sharp_goods_id' => 0,
'goods_sku_id' => '',
'goods_num' => 0,
]));
// 设置并发锁
$lockId = "sharp_order_{$params['active_time_id']}_{$params['sharp_goods_id']}";
Lock::lockUp($lockId);
// 获取秒杀商品信息
$service = new ActiveService;
$goodsList = $service->getCheckoutGoodsList(
$params['active_time_id'],
$params['sharp_goods_id'],
$params['goods_sku_id'],
$params['goods_num']
);
if ($goodsList === false) {
Lock::unLock($lockId);
return $this->renderError($service->getError());
}
// 设置订单来源
$Checkout->setOrderSource([
'source' => OrderSourceEnum::SHARP,
'source_id' => $params['active_time_id'],
])
// 秒杀商品不参与 等级折扣和优惠券折扣
->setCheckoutRule([
'is_user_grade' => false,
'is_coupon' => false,
'is_use_points' => false,
'is_dealer' => SettingModel::getIsDealer(),
]);
// 获取订单结算信息
$orderInfo = $Checkout->onCheckout($this->user, $goodsList);
if ($this->request->isGet()) {
Lock::unLock($lockId);
return $this->renderSuccess($orderInfo);
}
// submit订单结算提交
if ($Checkout->hasError()) {
Lock::unLock($lockId);
return $this->renderError($Checkout->getError());
}
// 创建订单
if (!$Checkout->createOrder($orderInfo)) {
Lock::unLock($lockId);
return $this->renderError($Checkout->getError() ?: '订单创建失败');
}
Lock::unLock($lockId);
// 构建微信支付请求
$payment = $Checkout->onOrderPayment();
// 支付状态提醒
return $this->renderSuccess([
'order_id' => $Checkout->model['order_id'], // 订单id
'pay_type' => $params['pay_type'], // 支付方式
'payment' => $payment // 微信支付参数
], ['success' => '支付成功', 'error' => '订单未支付']);
}
/**
* 订单结算提交的参数
* @param array $define
* @return array
*/
private function getParam($define = [])
{
return array_merge($define, $this->request->param());
}
}

View File

@ -0,0 +1,80 @@
<?php
namespace app\api\controller\shop;
use app\api\controller\Controller;
use app\api\model\Setting as SettingModel;
use app\common\service\Order as OrderService;
use app\common\enum\OrderType as OrderTypeEnum;
use app\api\model\store\shop\Clerk as ClerkModel;
/**
* 自提订单管理
* Class Order
* @package app\api\controller\shop
*/
class Order extends Controller
{
/* @var \app\api\model\User $user */
private $user;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
$this->user = $this->getUser(); // 用户信息
}
/**
* 核销订单详情
* @param $order_id
* @param int $order_type
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function detail($order_id, $order_type = OrderTypeEnum::MASTER)
{
// 订单详情
$model = OrderService::getOrderDetail($order_id, $order_type);
// 验证是否为该门店的核销员
$clerkModel = ClerkModel::detail(['user_id' => $this->user['user_id']]);
return $this->renderSuccess([
'order' => $model, // 订单详情
'clerkModel' => $clerkModel,
'setting' => [
// 积分名称
'points_name' => SettingModel::getPointsName(),
],
]);
}
/**
* 确认核销
* @param $order_id
* @param int $order_type
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function extract($order_id, $order_type = OrderTypeEnum::MASTER)
{
// 订单详情
$order = OrderService::getOrderDetail($order_id, $order_type);
// 验证是否为该门店的核销员
$ClerkModel = ClerkModel::detail(['user_id' => $this->user['user_id']]);
if (!$ClerkModel->checkUser($order['extract_shop_id'])) {
return $this->renderError($ClerkModel->getError());
}
// 确认核销
if ($order->verificationOrder($ClerkModel['clerk_id'])) {
return $this->renderSuccess([], '订单核销成功');
}
return $this->renderError($order->getError() ?: '核销失败');
}
}

View File

@ -0,0 +1,53 @@
<?php
namespace app\api\controller\user;
use app\api\controller\Controller;
use app\api\model\Order as OrderModel;
use app\api\model\OrderGoods as OrderGoodsModel;
use app\api\model\Comment as CommentModel;
/**
* 订单评价管理
* Class Comment
* @package app\api\controller\user
*/
class Comment extends Controller
{
/**
* 待评价订单商品列表
* @param $order_id
* @return array
* @throws \Exception
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function order($order_id)
{
// 用户信息
$user = $this->getUser();
// 订单信息
$order = OrderModel::getUserOrderDetail($order_id, $user['user_id']);
// 验证订单是否已完成
$model = new CommentModel;
if (!$model->checkOrderAllowComment($order)) {
return $this->renderError($model->getError());
}
// 待评价商品列表
/* @var \think\Collection $goodsList */
$goodsList = OrderGoodsModel::getNotCommentGoodsList($order_id);
if ($goodsList->isEmpty()) {
return $this->renderError('该订单没有可评价的商品');
}
// 提交商品评价
if ($this->request->isPost()) {
$formData = $this->request->post('formData', '', null);
if ($model->addForOrder($order, $goodsList, $formData)) {
return $this->renderSuccess([], '评价发表成功');
}
return $this->renderError($model->getError() ?: '评价发表失败');
}
return $this->renderSuccess(compact('goodsList'));
}
}

View File

@ -0,0 +1,74 @@
<?php
namespace app\api\controller\user;
use app\api\controller\Controller;
use app\api\model\UserCoupon as UserCouponModel;
/**
* 用户优惠券
* Class Coupon
* @package app\api\controller
*/
class Coupon extends Controller
{
/* @var UserCouponModel $model */
private $model;
/* @var \app\api\model\User $model */
private $user;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
$this->model = new UserCouponModel;
$this->user = $this->getUser();
}
/**
* 优惠券列表
* @param string $data_type
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function lists($data_type = 'all')
{
$is_use = false;
$is_expire = false;
switch ($data_type) {
case 'not_use':
$is_use = false;
break;
case 'is_use':
$is_use = true;
break;
case 'is_expire':
$is_expire = true;
break;
}
$list = $this->model->getList($this->user['user_id'], $is_use, $is_expire);
return $this->renderSuccess(compact('list'));
}
/**
* 领取优惠券
* @param $coupon_id
* @return array
* @throws \think\exception\DbException
*/
public function receive($coupon_id)
{
if ($this->model->receive($this->user, $coupon_id)) {
return $this->renderSuccess([], '领取成功');
}
return $this->renderError($this->model->getError() ?: '添加失败');
}
}

View File

@ -0,0 +1,115 @@
<?php
namespace app\api\controller\user;
use app\api\controller\Controller;
use app\api\model\dealer\Setting;
use app\api\model\dealer\User as DealerUserModel;
use app\api\model\dealer\Apply as DealerApplyModel;
/**
* 分销中心
* Class Dealer
* @package app\api\controller\user
*/
class Dealer extends Controller
{
/* @var \app\api\model\User $user */
private $user;
private $dealer;
private $setting;
/**
* 构造方法
* @throws \app\common\exception\BaseException
* @throws \think\exception\DbException
*/
public function _initialize()
{
parent::_initialize();
// 用户信息
$this->user = $this->getUser();
// 分销商用户信息
$this->dealer = DealerUserModel::detail($this->user['user_id']);
// 分销商设置
$this->setting = Setting::getAll();
}
/**
* 分销商中心
* @return array
*/
public function center()
{
return $this->renderSuccess([
// 当前是否为分销商
'is_dealer' => $this->isDealerUser(),
// 当前用户信息
'user' => $this->user,
// 分销商用户信息
'dealer' => $this->dealer,
// 背景图
'background' => $this->setting['background']['values']['index'],
// 页面文字
'words' => $this->setting['words']['values'],
]);
}
/**
* 分销商申请状态
* @param null $referee_id
* @return array
* @throws \think\exception\DbException
*/
public function apply($referee_id = null)
{
// 推荐人昵称
$referee_name = '平台';
if ($referee_id > 0 && ($referee = DealerUserModel::detail($referee_id))) {
$referee_name = $referee['user']['nickName'];
}
return $this->renderSuccess([
// 当前是否为分销商
'is_dealer' => $this->isDealerUser(),
// 当前是否在申请中
'is_applying' => DealerApplyModel::isApplying($this->user['user_id']),
// 推荐人昵称
'referee_name' => $referee_name,
// 背景图
'background' => $this->setting['background']['values']['apply'],
// 页面文字
'words' => $this->setting['words']['values'],
// 申请协议
'license' => $this->setting['license']['values']['license'],
]);
}
/**
* 分销商提现信息
* @return array
*/
public function withdraw()
{
return $this->renderSuccess([
// 分销商用户信息
'dealer' => $this->dealer,
// 结算设置
'settlement' => $this->setting['settlement']['values'],
// 背景图
'background' => $this->setting['background']['values']['withdraw_apply'],
// 页面文字
'words' => $this->setting['words']['values'],
]);
}
/**
* 当前用户是否为分销商
* @return bool
*/
private function isDealerUser()
{
return !!$this->dealer && !$this->dealer['is_delete'];
}
}

View File

@ -0,0 +1,44 @@
<?php
namespace app\api\controller\user;
use app\api\controller\Controller;
use app\api\model\User as UserModel;
use app\api\model\Order as OrderModel;
use app\api\model\Setting as SettingModel;
/**
* 个人中心主页
* Class Index
* @package app\api\controller\user
*/
class Index extends Controller
{
/**
* 获取当前用户信息
* @return array
* @throws \app\common\exception\BaseException
* @throws \think\Exception
* @throws \think\exception\DbException
*/
public function detail()
{
// 当前用户信息
$user = $this->getUser(false);
// 订单总数
$model = new OrderModel;
return $this->renderSuccess([
'userInfo' => $user,
'orderCount' => [
'payment' => $model->getCount($user, 'payment'),
'received' => $model->getCount($user, 'received'),
'comment' => $model->getCount($user, 'comment'),
],
'setting' => [
'points_name' => SettingModel::getPointsName(),
],
'menus' => (new UserModel)->getMenus() // 个人中心菜单列表
]);
}
}

Some files were not shown because too many files have changed in this diff Show More