From c48250b972eb62e0d23811374beb99eea52a8cae Mon Sep 17 00:00:00 2001 From: wenqiurong Date: Thu, 12 Sep 2019 13:14:40 +0800 Subject: [PATCH] =?UTF-8?q?Update=20page=20'=E6=B2=B3=E5=8C=97=E7=89=88?= =?UTF-8?q?=E4=B8=8A=E7=BA=BFSQL'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...%B3%E5%8C%97%E7%89%88%E4%B8%8A%E7%BA%BFSQL.md | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/%E6%B2%B3%E5%8C%97%E7%89%88%E4%B8%8A%E7%BA%BFSQL.md b/%E6%B2%B3%E5%8C%97%E7%89%88%E4%B8%8A%E7%BA%BFSQL.md index 321ef69..36cc75e 100644 --- a/%E6%B2%B3%E5%8C%97%E7%89%88%E4%B8%8A%E7%BA%BFSQL.md +++ b/%E6%B2%B3%E5%8C%97%E7%89%88%E4%B8%8A%E7%BA%BFSQL.md @@ -1,13 +1,15 @@ ### 生日短信模板 +#### 已配置会员生日积分倍率 ``` --- 已配置会员生日积分倍率 INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`, `open`, `msg_type`, `role_type`) VALUES ((select unix_timestamp(now()) + CEILING(RAND()*90000+10000)) , '${tenant_id}', 28, '会员生日券开启', '富茂服务商', '亲到的{userName},在您的生日到来之际,我们精心的为您准备了一份生日礼物,并在生日当天消费领取{creditScale}倍积分,赶快打开{mallName}微信小程序领取您的专属生日礼物吧!', now(), 0, 5, NULL, NULL, 0, 1, 3); --- 未配置会员生日积分倍率 +``` +#### 未配置会员生日积分倍率 +``` INSERT INTO `wx_msg_validationcode_model` (`id`, `tenant_id`, `type`, `name`, `signature`, `content`, `createtime`, `status`, `minutes`, `model_id`, `email_bg_img`, `open`, `msg_type`, `role_type`) VALUES @@ -24,4 +26,14 @@ UPDATE wx_c_user_basic_info cub SET cub.poins=(SELECT cu.score FROM wx_c_user cu ### 修复数据,积分不一致,以wx_c_user表数据为准 ``` UPDATE wx_c_user_basic_info cub SET cub.credit=(SELECT cu.credit FROM wx_c_user cu WHERE cu.id=cub.id AND cu.credit!=cub.credit),update_date=now(); +``` + +### 修复数据 券库存不一致 +``` +update wx_coupon c, (select * from (select c.id, c.inventory, c.remain_inventory, c.create_date, c.update_date, +(select count(*) from wx_coupon_order co left join wx_order o on co.order_id=o.id +where co.coupon_id=c.id and o.order_status in (0, 1, 3, 5, 6, 7, 10, 11, 15) and co.coupon_order_status in (0,1,2,4,5,6,8,100)) as sended +from wx_coupon c where (c.valid_type=1 and valid_end_date < now())) coupon +where coupon.inventory!=(coupon.remain_inventory + coupon.sended) and coupon.inventory!=coupon.remain_inventory) c1 +set c.update_date =now(),c.remain_inventory=c.inventory- c1.sended ; ``` \ No newline at end of file