Closed 1452479141 closed 3 years ago
表结构 CREATE TABLE sm_order ( id int(11) NOT NULL AUTO_INCREMENT, order_number varchar(50) NOT NULL DEFAULT '' COMMENT '订单号', device_id int(11) NOT NULL DEFAULT '0' COMMENT '设备id', sole_agent_id int(11) NOT NULL DEFAULT '0' COMMENT '独家代理id', agent_id int(11) NOT NULL DEFAULT '0' COMMENT '代理id', point_id int(11) NOT NULL DEFAULT '0' COMMENT '点位id', goods_id int(11) NOT NULL DEFAULT '0' COMMENT '商品id', plan_id int(11) DEFAULT NULL COMMENT '方案id', price decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '支付价', cost_price decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '成本价', payment_type tinyint(1) DEFAULT '1' COMMENT '支付类型:1:微信支付,2:支付宝', is_into tinyint(1) NOT NULL DEFAULT '1' COMMENT '分成成功:1:成功,0:失败', open_id varchar(32) DEFAULT NULL COMMENT '用户openID', box_num int(11) DEFAULT NULL COMMENT '格子号', status tinyint(3) NOT NULL DEFAULT '0' COMMENT '订单状态 0:未支付 ,1:已支付,2:退款,3:错误分成', try_status tinyint(1) NOT NULL DEFAULT '1' COMMENT '异常状态:1:正常,2,出货失败,3:蓝牙断开连接,4:疑识机器卡主', rem_time char(11) DEFAULT NULL COMMENT '撤除时间', create_time char(11) NOT NULL DEFAULT '' COMMENT '下单时间', update_time char(11) DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (id) USING BTREE, UNIQUE KEY order_number (order_number) USING BTREE, KEY device_id (device_id) USING BTREE, KEY agent_id (agent_id) USING BTREE, KEY goods_id (goods_id) USING BTREE, KEY point_id (point_id) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COMMENT='订单表';
sm_order
id
order_number
device_id
sole_agent_id
agent_id
point_id
goods_id
plan_id
price
cost_price
payment_type
is_into
open_id
box_num
status
try_status
rem_time
create_time
update_time
CREATE TABLE sm_goods ( id int(11) NOT NULL AUTO_INCREMENT, goods_name varchar(32) DEFAULT NULL COMMENT '商品名', goods_code varchar(32) DEFAULT NULL COMMENT '商品编号', low_price decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '最低价格', high_price decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '最高价格', basis_sales int(10) NOT NULL DEFAULT '0' COMMENT '基础销量', img varchar(255) DEFAULT NULL COMMENT '商品图片', intro varchar(255) DEFAULT NULL COMMENT '商品描述', type_id int(11) NOT NULL DEFAULT '1' COMMENT '商品分类ID', sort int(3) NOT NULL DEFAULT '50' COMMENT '排序', bg_color varchar(100) DEFAULT NULL COMMENT '背景色', opac_photo varchar(255) DEFAULT NULL COMMENT '透明图', detail text COMMENT '商品详情', create_time char(11) DEFAULT NULL COMMENT '添加时间', update_time char(11) DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (id) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='商品表';
sm_goods
goods_name
goods_code
low_price
high_price
basis_sales
img
intro
type_id
sort
bg_color
opac_photo
detail
return $this->hasOne(Goods::class,null,'goods_id','id');
表结构 CREATE TABLE
sm_order
(id
int(11) NOT NULL AUTO_INCREMENT,order_number
varchar(50) NOT NULL DEFAULT '' COMMENT '订单号',device_id
int(11) NOT NULL DEFAULT '0' COMMENT '设备id',sole_agent_id
int(11) NOT NULL DEFAULT '0' COMMENT '独家代理id',agent_id
int(11) NOT NULL DEFAULT '0' COMMENT '代理id',point_id
int(11) NOT NULL DEFAULT '0' COMMENT '点位id',goods_id
int(11) NOT NULL DEFAULT '0' COMMENT '商品id',plan_id
int(11) DEFAULT NULL COMMENT '方案id',price
decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '支付价',cost_price
decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '成本价',payment_type
tinyint(1) DEFAULT '1' COMMENT '支付类型:1:微信支付,2:支付宝',is_into
tinyint(1) NOT NULL DEFAULT '1' COMMENT '分成成功:1:成功,0:失败',open_id
varchar(32) DEFAULT NULL COMMENT '用户openID',box_num
int(11) DEFAULT NULL COMMENT '格子号',status
tinyint(3) NOT NULL DEFAULT '0' COMMENT '订单状态 0:未支付 ,1:已支付,2:退款,3:错误分成',try_status
tinyint(1) NOT NULL DEFAULT '1' COMMENT '异常状态:1:正常,2,出货失败,3:蓝牙断开连接,4:疑识机器卡主',rem_time
char(11) DEFAULT NULL COMMENT '撤除时间',create_time
char(11) NOT NULL DEFAULT '' COMMENT '下单时间',update_time
char(11) DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (id
) USING BTREE, UNIQUE KEYorder_number
(order_number
) USING BTREE, KEYdevice_id
(device_id
) USING BTREE, KEYagent_id
(agent_id
) USING BTREE, KEYgoods_id
(goods_id
) USING BTREE, KEYpoint_id
(point_id
) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COMMENT='订单表';CREATE TABLE
sm_goods
(id
int(11) NOT NULL AUTO_INCREMENT,goods_name
varchar(32) DEFAULT NULL COMMENT '商品名',goods_code
varchar(32) DEFAULT NULL COMMENT '商品编号',low_price
decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '最低价格',high_price
decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '最高价格',basis_sales
int(10) NOT NULL DEFAULT '0' COMMENT '基础销量',img
varchar(255) DEFAULT NULL COMMENT '商品图片',intro
varchar(255) DEFAULT NULL COMMENT '商品描述',type_id
int(11) NOT NULL DEFAULT '1' COMMENT '商品分类ID',sort
int(3) NOT NULL DEFAULT '50' COMMENT '排序',bg_color
varchar(100) DEFAULT NULL COMMENT '背景色',opac_photo
varchar(255) DEFAULT NULL COMMENT '透明图',detail
text COMMENT '商品详情',create_time
char(11) DEFAULT NULL COMMENT '添加时间',update_time
char(11) DEFAULT NULL COMMENT '更新时间', PRIMARY KEY (id
) USING BTREE ) ENGINE=InnoDB AUTO_INCREMENT=17 DEFAULT CHARSET=utf8 COMMENT='商品表';