python学习

This commit is contained in:
2019-08-09 14:18:51 +08:00
parent 8a1f75de2c
commit bbd8580d53
7 changed files with 471 additions and 355 deletions

View File

@@ -1,12 +1,12 @@
CREATE DATABASE `food_db` DEFAULT CHARACTER SET = `utf8mb4`;
create DATABASE `food_db` DEFAULT CHARACTER SET = `utf8mb4`;
DROP TABLE IF EXISTS `user`;
drop table IF EXISTS `user`;
CREATE TABLE `user` (
create TABLE `user` (
`uid` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '用户uid',
`nickname` varchar(100) NOT NULL DEFAULT '' COMMENT '用户名',
`mobile` varchar(20) NOT NULL DEFAULT '' COMMENT '手机号码',
@@ -24,9 +24,9 @@ CREATE TABLE `user` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户表(管理员)';
DROP TABLE IF EXISTS `app_access_log`;
drop table IF EXISTS `app_access_log`;
CREATE TABLE `app_access_log` (
create TABLE `app_access_log` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`uid` bigint(20) NOT NULL DEFAULT '0' COMMENT 'uid',
`referer_url` varchar(255) NOT NULL DEFAULT '' COMMENT '当前访问的refer',
@@ -41,8 +41,8 @@ CREATE TABLE `app_access_log` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='用户访问记录表';
DROP TABLE IF EXISTS `app_error_log`;
CREATE TABLE `app_error_log` (
drop table IF EXISTS `app_error_log`;
create TABLE `app_error_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`referer_url` varchar(255) NOT NULL DEFAULT '' COMMENT '当前访问的refer',
`target_url` varchar(255) NOT NULL DEFAULT '' COMMENT '访问的url',
@@ -55,9 +55,9 @@ CREATE TABLE `app_error_log` (
DROP TABLE IF EXISTS `member`;
drop table IF EXISTS `member`;
CREATE TABLE `member` (
create TABLE `member` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`nickname` varchar(100) NOT NULL DEFAULT '' COMMENT '会员名',
`mobile` varchar(11) NOT NULL DEFAULT '' COMMENT '会员手机号码',
@@ -73,9 +73,9 @@ CREATE TABLE `member` (
DROP TABLE IF EXISTS `oauth_member_bind`;
drop table IF EXISTS `oauth_member_bind`;
CREATE TABLE `oauth_member_bind` (
create TABLE `oauth_member_bind` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
`client_type` varchar(20) NOT NULL DEFAULT '' COMMENT '客户端来源类型。qq,weibo,weixin',
@@ -91,9 +91,9 @@ CREATE TABLE `oauth_member_bind` (
DROP TABLE IF EXISTS `food`;
drop table IF EXISTS `food`;
CREATE TABLE `food` (
create TABLE `food` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`cat_id` int(11) NOT NULL DEFAULT '0' COMMENT '分类id',
`name` varchar(100) NOT NULL DEFAULT '' COMMENT '书籍名称',
@@ -115,9 +115,9 @@ CREATE TABLE `food` (
DROP TABLE IF EXISTS `food_cat`;
drop table IF EXISTS `food_cat`;
CREATE TABLE `food_cat` (
create TABLE `food_cat` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT '' COMMENT '类别名称',
`weight` tinyint(4) NOT NULL DEFAULT '1' COMMENT '权重',
@@ -129,9 +129,9 @@ CREATE TABLE `food_cat` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='食品分类';
DROP TABLE IF EXISTS `food_sale_change_log`;
drop table IF EXISTS `food_sale_change_log`;
CREATE TABLE `food_sale_change_log` (
create TABLE `food_sale_change_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`food_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品id',
`quantity` int(11) NOT NULL DEFAULT '0' COMMENT '售卖数量',
@@ -146,9 +146,9 @@ CREATE TABLE `food_sale_change_log` (
DROP TABLE IF EXISTS `food_stock_change_log`;
drop table IF EXISTS `food_stock_change_log`;
CREATE TABLE `food_stock_change_log` (
create TABLE `food_stock_change_log` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`food_id` int(11) NOT NULL COMMENT '商品id',
`unit` int(11) NOT NULL DEFAULT '0' COMMENT '变更多少',
@@ -161,9 +161,9 @@ CREATE TABLE `food_stock_change_log` (
DROP TABLE IF EXISTS `images`;
drop table IF EXISTS `images`;
CREATE TABLE `images` (
create TABLE `images` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`file_key` varchar(60) NOT NULL DEFAULT '' COMMENT '文件名',
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '插入时间',
@@ -171,8 +171,8 @@ CREATE TABLE `images` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
DROP TABLE IF EXISTS `member_address`;
CREATE TABLE `member_address` (
drop table IF EXISTS `member_address`;
create TABLE `member_address` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
`nickname` varchar(20) NOT NULL DEFAULT '' COMMENT '收货人姓名',
@@ -195,9 +195,9 @@ CREATE TABLE `member_address` (
DROP TABLE IF EXISTS `member_cart`;
drop table IF EXISTS `member_cart`;
CREATE TABLE `member_cart` (
create TABLE `member_cart` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`member_id` bigint(20) NOT NULL DEFAULT '0' COMMENT '会员id',
`food_id` int(11) NOT NULL DEFAULT '0' COMMENT '商品id',
@@ -210,9 +210,9 @@ CREATE TABLE `member_cart` (
DROP TABLE IF EXISTS `wx_share_history`;
drop table IF EXISTS `wx_share_history`;
CREATE TABLE `wx_share_history` (
create TABLE `wx_share_history` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
`share_url` varchar(200) NOT NULL DEFAULT '' COMMENT '分享的页面url',
@@ -222,16 +222,16 @@ CREATE TABLE `wx_share_history` (
DROP TABLE IF EXISTS `member_comments`;
drop table IF EXISTS `member_comments`;
CREATE TABLE `member_comments` (
create TABLE `member_comments` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`member_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
`food_ids` varchar(200) NOT NULL DEFAULT '' COMMENT '商品ids',
`pay_order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id',
`score` tinyint(4) NOT NULL DEFAULT '0' COMMENT '评分',
`content` varchar(200) NOT NULL DEFAULT '' COMMENT '评论内容',
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '插入时间',
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON update CURRENT_TIMESTAMP COMMENT '插入时间',
PRIMARY KEY (`id`),
KEY `idx_member_id` (`member_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='会员评论表';
@@ -246,9 +246,9 @@ CREATE TABLE `member_comments` (
DROP TABLE IF EXISTS `pay_order`;
drop table IF EXISTS `pay_order`;
CREATE TABLE `pay_order` (
create TABLE `pay_order` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`order_sn` varchar(40) NOT NULL DEFAULT '' COMMENT '随机订单号',
`member_id` bigint(11) NOT NULL DEFAULT '0' COMMENT '会员id',
@@ -272,9 +272,9 @@ CREATE TABLE `pay_order` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='在线购买订单表';
DROP TABLE IF EXISTS `pay_order_item`;
drop table IF EXISTS `pay_order_item`;
CREATE TABLE `pay_order_item` (
create TABLE `pay_order_item` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`pay_order_id` int(11) NOT NULL DEFAULT '0' COMMENT '订单id',
`member_id` bigint(11) NOT NULL DEFAULT '0' COMMENT '会员id',
@@ -292,9 +292,9 @@ CREATE TABLE `pay_order_item` (
DROP TABLE IF EXISTS `pay_order_callback_data`;
drop table IF EXISTS `pay_order_callback_data`;
CREATE TABLE `pay_order_callback_data` (
create TABLE `pay_order_callback_data` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pay_order_id` int(11) NOT NULL DEFAULT '0' COMMENT '支付订单id',
`pay_data` text NOT NULL COMMENT '支付回调信息',
@@ -308,9 +308,9 @@ CREATE TABLE `pay_order_callback_data` (
DROP TABLE IF EXISTS `queue_list`;
drop table IF EXISTS `queue_list`;
CREATE TABLE `queue_list` (
create TABLE `queue_list` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`queue_name` varchar(30) NOT NULL DEFAULT '' COMMENT '队列名字',
`data` varchar(500) NOT NULL DEFAULT '' COMMENT '队列数据',
@@ -321,9 +321,9 @@ CREATE TABLE `queue_list` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='事件队列表';
DROP TABLE IF EXISTS `oauth_access_token`;
drop table IF EXISTS `oauth_access_token`;
CREATE TABLE `oauth_access_token` (
create TABLE `oauth_access_token` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`access_token` varchar(600) NOT NULL DEFAULT '',
`expired_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '过期时间',
@@ -334,9 +334,9 @@ CREATE TABLE `oauth_access_token` (
DROP TABLE IF EXISTS `stat_daily_food`;
drop table IF EXISTS `stat_daily_food`;
CREATE TABLE `stat_daily_food` (
create TABLE `stat_daily_food` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`date` date NOT NULL,
`food_id` int(11) NOT NULL DEFAULT '0' COMMENT '菜品id',
@@ -352,9 +352,9 @@ CREATE TABLE `stat_daily_food` (
DROP TABLE IF EXISTS `stat_daily_member`;
drop table IF EXISTS `stat_daily_member`;
CREATE TABLE `stat_daily_member` (
create TABLE `stat_daily_member` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`date` date NOT NULL COMMENT '日期',
`member_id` int(11) NOT NULL DEFAULT '0' COMMENT '会员id',
@@ -370,9 +370,9 @@ CREATE TABLE `stat_daily_member` (
DROP TABLE IF EXISTS `stat_daily_site`;
drop table IF EXISTS `stat_daily_site`;
CREATE TABLE `stat_daily_site` (
create TABLE `stat_daily_site` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`date` date NOT NULL COMMENT '日期',
`total_pay_money` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '当日应收总金额',
@@ -410,36 +410,27 @@ CREATE TABLE `stat_daily_site` (
coverImg: "http://y.gtimg.cn/music/photo_new/T002R150x150M000001TEc6V0kjpVC.jpg?max_age=2592000"
}
}
DROP TABLE IF EXISTS `pay_order`;
CREATE TABLE `pay_order` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`date` varchar(40) NOT NULL DEFAULT '' COMMENT '随机订单号',
`title` bigint(11) NOT NULL DEFAULT '0' COMMENT '会员id',
`imgSrc` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '订单应付金额',
`avatar` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '运费金额',
`content` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '订单实付金额',
`reading` varchar(128) NOT NULL DEFAULT '' COMMENT '第三方流水号',
`collection` varchar(128) NOT NULL DEFAULT '' COMMENT '第三方预付id',
`headImgSrc` text NOT NULL COMMENT '备注信息',
`author` tinyint(4) NOT NULL DEFAULT '0' COMMENT '1支付完成 0 无效 -1 申请退款 -2 退款中 -9 退款成功 -8 待支付 -7 完成支付待确认',
`dateTime` tinyint(4) NOT NULL DEFAULT '0' COMMENT '快递状态,-8 待支付 -7 已付款待发货 1确认收货 0失败',
`detail` int(11) NOT NULL DEFAULT '0' COMMENT '快递地址id',
`postId` varchar(1000) NOT NULL DEFAULT '' COMMENT '快递信息',
`comment_status` tinyint(1) NOT NULL DEFAULT '0' COMMENT '评论状态',
`pay_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '付款到账时间',
`updated_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '最近一次更新时间',
`created_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '插入时间',
PRIMARY KEY (`id`),
UNIQUE KEY `idx_order_sn` (`order_sn`),
KEY `idx_member_id_status` (`member_id`,`status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='在线购买订单表';
create TABLE IF NOT EXISTS `dongtai_list`(
`listid` INT UNSIGNED AUTO_INCREMENT,
`date` VARCHAR(100) NOT NULL DEFAULT '',
`title` VARCHAR(40) NOT NULL DEFAULT '',
`imgSrc` varchar(100) NOT NULL DEFAULT '' ,
`avatar` varchar(100) NOT NULL DEFAULT '' ,
`content` varchar(128) NOT NULL DEFAULT '',
`reading` varchar(128) NOT NULL DEFAULT '',
`collection` varchar(128) NOT NULL DEFAULT '' ,
`headImgSrc` varchar(100) NOT NULL COMMENT '',
`author` varchar(100) NOT NULL DEFAULT '',
`dateTime` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY ( `listid` )
)ENGINE=InnoDB DEFAULT CHARSET=utf8;
INSERT INTO `dongtai_list` (`listid`, `date`, `title`, `imgSrc`, `avatar`, `content`, `reading`, `collection`, `headImgSrc`, `author`, `dateTime`)
VALUES
(1, 'Sep 18 2016', 'sdfwefsdf正是虾肥蟹壮时', '/images/post/crab.png', '/images/avatar/1.png', 'sdfwefsdfe菊黄蟹正肥品尝秋之味。徐志摩把,“看初花的荻芦”和“到楼外楼吃蟹”,并列', '112', '96', '/images/post/crab.png', '林白衣', '2017-03-15 14:08:48');