需求 #7251
支付红包
历史记录
#2
由 卓建贺 更新于 将近 6 年 之前
接口链接:
1)、api
专场商品列表:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=2020 增加 discount_label字段
获取专场详情头部详细信息:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=1906 增加 coupons、activities字段
获取商品详情数据:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=1714 增加coupons、activities字段
红包聚合页:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=2205 新增接口
活动聚合页:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=2207 新增接口
领取满减红包:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=2208 新增接口
我的红包4.0.1:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=2041 新增列表字段、兼容4.0.1以前
订单确认页:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=1741 增加selected_coupon_id入参、出参:activities_reduce_amount、coupon_reduce_amount、my_coupons
根据进货车选中商品获取活动、红包:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=2209 新增接口
指定商品获取该商品参与活动信息:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=2210 新增接口
获取购物车数据:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=1700 增加is_new_goods、is_goods_original_price、is_goods_in_stock、restriction_number、activity、coupon字段
添加商品到购物车:http://xdebug.yishou.com/dist/project-api-list?project_id=2&api_id=1699 增加is_new_goods、is_goods_original_price、is_goods_in_stock
2)、os
获取满减活动列表:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2188
设置活动状态:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2195
通过审核:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2196
活动详情:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2197
创建满减活动:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2198
获取条件红包列表:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2190
红包详情:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2191
设置红包状态:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2192
通过审核:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2193
创建条件红包:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2194
获取限购列表:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2200
设置限购状态:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2201
创建限购:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2202
限购详情:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2203
通过审核:http://xdebug.yishou.com/dist/project-api-list?project_id=1&api_id=2204
调试环境:dev9.yishou.com
后端分支:feature/v4.0.1支付系统规则
sql:
#满减活动表 create table fmys_full_scale_activities( `id` int(10) unsigned not null auto_increment, `use_type` tinyint(4) not null comment '使用类型 0-专场 1-指定商品 2-全平台', `title` varchar(255) not null comment '活动标题', `is_exclude_goods_new` tinyint(1) not null default 0 comment '是否排除新品 0-否 1-是', `is_exclude_goods_original_price` tinyint(1) not null default 0 comment '是否排除原价商品 0-否 1-是', `is_exclude_goods_in_stock` tinyint(1) not null default 0 comment '是否排除现货商品 0-否 1-是', `cost_bearer` tinyint(1) not null comment '费用承担方 0-平台 1-供应商', `start_time` int(11) not null comment '开始时间', `end_time` int(11) not null comment '结束时间', `create_time` int(11) not null default 0 comment '创建时间', `create_admin` smallint(5) not null comment '创建人', `status` tinyint(4) not null default 0 comment '状态 0-未启用 1-已启用', `audit_status` tinyint(4) not null default 0 comment '审核状态 0-未审核 1-审核通过', `audit_admin` int(10) not null default 0 comment '审核人', primary key (`id`), key (`start_time`,`end_time`,`status`,`audit_status`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='满减活动表'; #满减活动规则 create table fmys_full_scale_activities_rule( `id` int(10) unsigned not null auto_increment, `full_scale_activities_id` int(10) not null comment '满减活动ID', `using_threshold` tinyint(4) not null comment '使用门槛 0-指定会员等级 1-全平台注册会员 2-全平台已激会用户 3-全平台未激活用户', `user_level` varchar(20) default 0 comment '会员等级 0-普通(未激活) 1-普通(已激活) 2-黄金 3-白金 4-钻石', `condition_goods_amount` int(10) unsigned not null comment '商品总价满足条件金额', `reduce_amount` int(10) unsigned not null comment '减少金额', primary key (`id`), key (`full_scale_activities_id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='满减活动规则'; #满减活动指定类型值(专场、商品) create table fmys_full_scale_activities_range( `id` int(10) unsigned not null auto_increment, `full_scale_activities_id` int(10) not null comment '满减活动id', `special_id` int(10) not null comment '专场ID', `goods_id` int(10) not null comment '商品id', primary key (`id`), key (`full_scale_activities_id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='满减活动指定类型值(专场、商品)'; #红包规则 create table fmys_cash_coupon_rule( `id` int(10) unsigned not null auto_increment, `cash_coupon_id` int(10) not null comment '红包ID', `using_threshold` tinyint(4) not null comment '使用门槛 0-指定会员等级 1-全平台注册会员 2-全平台已激会用户 3-全平台未激活用户', `user_level` varchar(20) default 0 comment '会员等级 0-普通(未激活) 1-普通(已激活) 2-黄金 3-白金 4-钻石', `condition_goods_amount` int(10) unsigned not null comment '商品总价满足条件金额', `reduce_amount` int(10) unsigned not null comment '减少金额', `pick_max` int(10) unsigned not null comment '最大领取总数', `picked_number` int(0) unsigned not null default 0 comment '已领取数量', primary key (`id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='红包规则'; #红包作用域(专场、商品) create table fmys_cash_coupon_range( `id` int(10) unsigned not null auto_increment, `cash_coupon_id` int(10) not null comment '红包ID', `special_id` int(10) not null comment '专场ID', `goods_id` int(10) not null comment '商品id', primary key (`id`), key (`cash_coupon_id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='红包作用域(专场、商品)'; #限购设置 create table fmys_purchase_restriction( `id` int(10) unsigned not null auto_increment, `use_type` tinyint(4) not null comment '使用类型 0-专场 1-指定商品', `title` varchar(255) not null comment '标题', `restriction_number` int(10) not null comment '限购数量', `start_time` int(11) not null comment '开始时间', `end_time` int(11) not null comment '结束时间', `status` tinyint(1) not null default 0 comment '限购状态', `create_admin` int(11) not null default 0 comment '创建人', `create_time` timestamp not null default current_timestamp comment '创建时间', `audit_status` tinyint(4) not null default 0 comment '审核状态 0-未审核 1-审核通过', `audit_admin` int(10) not null default 0 comment '审核人', primary key (`id`), key (`start_time`,`end_time`,`status`,`audit_status`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='限购设置'; #限购作用域(专场、商品) create table fmys_purchase_restriction_range( `id` int(10) unsigned not null auto_increment, `purchase_restriction_id` int(10) not null comment '限购id', `special_id` int(10) not null comment '专场ID', `goods_id` int(10) not null comment '商品id', primary key (`id`), key (`special_id`), key (`goods_id`), key (`purchase_restriction_id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='限购作用域(专场、商品)'; #订单参与满减活动记录表 create table fmys_order_activities_coupon_records( `id` int(10) unsigned not null auto_increment, `order_id` int(10) unsigned not null comment '订单ID', `type` tinyint(1) not null comment '类型 0-活动 1-红包', `related_id` int(10) not null comment '活动/红包ID', `title` varchar(100) not null comment '活动标题', `cost_bearer` tinyint(1) not null comment '费用承担方 0-平台 1-供应商', `reduce_price` decimal(12,2) not null comment '优惠金额', primary key(`id`), key (`order_id`), key (`related_id`) )ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='订单参与满减'; #红包记录表增加字段 alter table fmys_cash_coupon add `type` tinyint(4) not null default 0 comment '红包类型 0-现金红包 1-满减红包'; alter table fmys_cash_coupon add `use_type` tinyint(4) not null comment '使用类型 0-专场 1-指定商品 2-全平台'; alter table fmys_cash_coupon add `is_exclude_goods_new` tinyint(1) not null default 0 comment '是否排除新品 0-否 1-是'; alter table fmys_cash_coupon add `is_exclude_goods_original_price` tinyint(1) not null default 0 comment '是否排除原价商品 0-否 1-是'; alter table fmys_cash_coupon add `is_exclude_goods_in_stock` tinyint(1) not null default 0 comment '是否排除现货商品 0-否 1-是'; alter table fmys_cash_coupon add `cost_bearer` tinyint(1) not null comment '费用承担方 0-平台 1-供应商'; alter table fmys_cash_coupon add `pick_max_number` int(10) not null default 1 comment '每个用户最多可领取数量'; alter table fmys_cash_coupon add `pick_start_time` int(11) not null comment '可领取开始时间'; alter table fmys_cash_coupon add `pick_end_time` int(11) not null comment '可领取结束时间'; alter table fmys_cash_coupon add `status` tinyint(4) not null default 0 comment '状态 0-未启用 1-已启用'; alter table fmys_cash_coupon add `audit_status` tinyint(4) not null default 0 comment '审核状态 0-未审核 1-审核通过'; alter table fmys_cash_coupon add `audit_admin` int(10) not null default 0 comment '审核人'; alter table fmys_cash_coupon_record add `coupon_rule_id` int(10) not null default 0 comment '红包规则ID'; alter table fmys_cash_coupon_record add unique couponId_ruleID(`user_id`,`coupon_id`,`coupon_rule_id`); alter table fmys_cash_coupon add key (`status`,`audit_status`); #订单fmys_order_infos增加字段-优惠前价格 alter table fmys_order_infos add `original_price` decimal(12,2) not null default '0.00' comment '优惠前价格'; alter table fmys_order_infos_cancel add `original_price` decimal(12,2) not null default '0.00' comment '优惠前价格'; alter table fmys_order_infos_copy add `original_price` decimal(12,2) not null default '0.00' comment '优惠前价格'; #订单fmys_order_infos副表 create table fmys_order_infos_subsidiary( `id` int(11) unsigned not null auto_increment, `platform_full_scale_activities_derate` decimal(12,2) not null default '0.00' comment '平台满减活动优惠', `supplier_full_scale_activities_derate` decimal(12,2) not null default '0.00' comment '供应商满减活动优惠', `platform_conpon_derate` decimal(12,2) not null default '0.00' comment '平台红包优惠', `supplier_conpon_derate` decimal(12,2) not null default '0.00' comment '供应红包优惠', `order_id` int(11) not null default '0' comment '订单ID', `goods_id` int(11) not null default '0' comment '商品ID', `sku` int(11) not null default '0' comment 'sku号', `buy_num` int(11) not null default '0' comment '购买数量', primary key(`id`), key (`order_id`), key (`goods_id`) ) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8 COMMENT='订单fmys_order_infos副表';
INSERT INTO `fmys_cash_coupon` (`coupon_id`, `coupon_title`, `coupon_subtitle`, `face_value`, `validity_day`, `validity_hours`, `start_use_time`, `end_use_time`, `create_admin`, `create_time`, `auto_time`, `type`, `use_type`, `is_exclude_goods_new`, `is_exclude_goods_original_price`, `is_exclude_goods_in_stock`, `cost_bearer`, `pick_max_number`, `pick_start_time`, `pick_end_time`, `status`, `audit_status`, `audit_admin`) VALUES ('29', '随机红包', '随机红包', '6', '0', '120', '0', '0', '146', '2019-06-06 09:54:46', '2019-07-13 18:03:46', '1', '2', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0');
INSERT INTO `fmys_cash_coupon` (`coupon_id`, `coupon_title`, `coupon_subtitle`, `face_value`, `validity_day`, `validity_hours`, `start_use_time`, `end_use_time`, `create_admin`, `create_time`, `auto_time`, `type`, `use_type`, `is_exclude_goods_new`, `is_exclude_goods_original_price`, `is_exclude_goods_in_stock`, `cost_bearer`, `pick_max_number`, `pick_start_time`, `pick_end_time`, `status`, `audit_status`, `audit_admin`) VALUES ('30', '随机红包', '随机红包', '8', '0', '120', '0', '0', '146', '2019-06-06 09:54:46', '2019-07-13 18:03:46', '1', '2', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0');
INSERT INTO `fmys_cash_coupon` (`coupon_id`, `coupon_title`, `coupon_subtitle`, `face_value`, `validity_day`, `validity_hours`, `start_use_time`, `end_use_time`, `create_admin`, `create_time`, `auto_time`, `type`, `use_type`, `is_exclude_goods_new`, `is_exclude_goods_original_price`, `is_exclude_goods_in_stock`, `cost_bearer`, `pick_max_number`, `pick_start_time`, `pick_end_time`, `status`, `audit_status`, `audit_admin`) VALUES ('31', '随机红包', '随机红包', '10', '0', '120', '0', '0', '146', '2019-06-06 09:54:46', '2019-07-13 18:03:46', '1', '2', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0');
INSERT INTO `fmys_cash_coupon` (`coupon_id`, `coupon_title`, `coupon_subtitle`, `face_value`, `validity_day`, `validity_hours`, `start_use_time`, `end_use_time`, `create_admin`, `create_time`, `auto_time`, `type`, `use_type`, `is_exclude_goods_new`, `is_exclude_goods_original_price`, `is_exclude_goods_in_stock`, `cost_bearer`, `pick_max_number`, `pick_start_time`, `pick_end_time`, `status`, `audit_status`, `audit_admin`) VALUES ('32', '随机红包', '随机红包', '12', '0', '120', '0', '0', '146', '2019-06-06 09:54:46', '2019-07-13 18:03:46', '1', '2', '0', '0', '0', '0', '1', '0', '0', '0', '0', '0');
INSERT INTO `fmys_cash_coupon_rule` (`cash_coupon_id`, `using_threshold`, `user_level`, `condition_goods_amount`, `reduce_amount`, `pick_max`, `picked_number`) VALUES ('29', '1', '0', '30', '6', '0', '0');
INSERT INTO `fmys_cash_coupon_rule` (`cash_coupon_id`, `using_threshold`, `user_level`, `condition_goods_amount`, `reduce_amount`, `pick_max`, `picked_number`) VALUES ('30', '1', '0', '32', '8', '0', '0');
INSERT INTO `fmys_cash_coupon_rule` (`cash_coupon_id`, `using_threshold`, `user_level`, `condition_goods_amount`, `reduce_amount`, `pick_max`, `picked_number`) VALUES ('31', '1', '0', '34', '10', '0', '0');
INSERT INTO `fmys_cash_coupon_rule` (`cash_coupon_id`, `using_threshold`, `user_level`, `condition_goods_amount`, `reduce_amount`, `pick_max`, `picked_number`) VALUES ('32', '1', '0', '36', '12', '0', '0');
定时脚本:
1、当期满减、红包数据缓存(1分钟跑一次)
*/1 * * * * /usr/local/php7/bin/php /www/yishou/tp5/think crontab3 -f setActivityAndCouponCache
2、校验活动订单参与、订单金额(10分钟跑一次)
*/10 * * * * /usr/local/php7/bin/php /www/yishou/tp5/think crontab3 -f checkActivityOrders
更新mongo、redis商品数据
/usr/local/php7/bin/php /www/yishou/tp5/think mongodb -f recoverAllGoodsData
/usr/local/php7/bin/php /www/yishou/tp5/think mongodb -f quickRecoverExp3
代码上线后执行SQL
1、更新原有红包数据
INSERT INTO fmys_cash_coupon_rule ( cash_coupon_id, using_threshold, condition_goods_amount, reduce_amount) SELECT coupon_id AS cash_coupon_id, 1 AS using_threshold, face_value + 24 AS condition_goods_amount, face_value AS reduce_amount FROM fmys_cash_coupon WHERE coupon_id IN ( 1, 2, 3, 4, 5, 6, 22, 23, 24, 25 );
update fmys_cash_coupon set type = 1, use_type = 2 where coupon_id in(1, 2, 3, 4, 5, 6, 22, 23, 24, 25)
update fmys_cash_coupon_record ccr join fmys_cash_coupon cc on cc.coupon_id = ccr.coupon_id join fmys_cash_coupon_rule ccr2 on ccr.coupon_id = ccr2.cash_coupon_id set ccr.coupon_rule_id = ccr2.id where ccr.coupon_rule_id = 0;
2、更新order_info原价值
update fmys_order_infos set original_price=shop_price;
update fmys_order_infos_cancel set original_price=shop_price;
update fmys_order_infos_copy set original_price=shop_price;