Commit 55d54a82 by jscat

nyx sql

1. 更新一版sql
parent 70f6c7a3
USE rockwell_key;
USE rockwell_key;
/*
order 表及对应的 member|activity|order_item info 信息
*/
DROP VIEW IF EXISTS view_order_info;
CREATE VIEW view_order_info
AS
SELECT dd.member_name, cc.title, bb.product_image, bb.product_desc, bb.unit_price, bb.quantity, aa.order_status, aa.order_id, aa.user_id, aa.qrcode_url, aa.create_datetime, aa.update_datetime
FROM tbl_order aa
LEFT JOIN tbl_order_item bb ON aa.order_id=bb.order_id
LEFT JOIN tbl_activity cc ON aa.activity_id=cc.activity_id
LEFT JOIN tbl_member dd ON cc.member_id=dd.id
\ No newline at end of file
USE rockwell_key;
USE rockwell_key;
USE rockwell_key;
/*
view goods
view activity.wxml 页面的 product 视图
*/
DROP VIEW IF EXISTS view_goods;
CREATE VIEW view_goods
DROP VIEW IF EXISTS view_activity_product;
CREATE VIEW view_activity_product
AS
SELECT aa.goods_id, aa.goods_status, aa.price, aa.amount,
bb.wine_name, CONCAT(bb.category," / ABV ", bb.abv," / ", bb.region) AS wine_desc,
bb.category, bb.region, bb.abv, bb.wine_body, bb.scale, bb.tasting_notes, bb.glassware, bb.temperature,
bb.scores, bb.num_reviews, bb.food_pairing,
cc.member_name, cc.member_address, cc.lon, cc.lat, cc.geo_code,
bb.img_url, aa.create_datetime, aa.update_datetime
FROM tbl_goods aa
LEFT JOIN tbl_goods_detail bb ON aa.detail_id=bb.detail_id
LEFT JOIN tbl_member cc ON aa.member_id=cc.id
SELECT aa.product_id, aa.activity_id, aa.product_status, aa.product_desc, aa.price, aa.stock, bb.member_name, bb.member_slogan, bb.tag, bb.content, bb.title, aa.product_image, aa.create_datetime, aa.update_datetime
FROM tbl_product AS aa
LEFT JOIN view_activity_info bb ON aa.activity_id=bb.activity_id
\ No newline at end of file
/*
/*
/*
目标: 梳理流程 DIN
一. 商家活动创建流程:
1. 自定义活动
......@@ -68,36 +69,117 @@
三. 商家活动参与流程
1. 竞答
-- 进入竞答, weapp activity.wxml
-- 点击进入活动详情页面 weapp activity.wxml <navigator>
-- 回到首页 weapp quiz-info.wxml bindtap="toHome"
-- 分享 weapp quiz-info.js options.from == 'button'
-- 右上角分享 weapp quiz-info.js onShareAppMessage()
-- 立即参与 weapp quiz-info.wxml bindtap="toGame"
-- 转到竞答页 weapp quiz.js wx.navigateTo(/matchTest)
-- 下一题 weapp matchTest.wxml bindtap="onTypeNext"
-- 完成测试 weapp matchTest.js doneDaily()
-- 转到结果页 weapp quiz.js wx.navigateTo(/quiz-result)
-- 查看积分 weapp quiz-result.wxml bindtap="onCheckPoints"
-- 分享战绩 weapp quiz-result.wxml open-type="share"
-- 返回首页 weapp quiz-result.wxml bindtap="toHome"
--311 进入竞答, weapp activity.wxml
--312 点击进入竞答详情页面 weapp activity.wxml <navigator>
--313 回到首页 weapp quiz-info.wxml bindtap="toHome"
--314 页面分享 weapp quiz-info.js options.from == 'button'
--315 右上角分享 weapp quiz-info.js onShareAppMessage()
--316 立即参与 weapp quiz-info.wxml bindtap="toGame"
--317 转到竞答页 weapp quiz-info.js wx.navigateTo(/matchTest)
--318 下一题 weapp matchTest.wxml bindtap="onTypeNext"
--319 完成测试 weapp matchTest.js doneDaily()
--3110 转到结果页 weapp quiz-info.js wx.navigateTo(/quiz-result)
--3111 查看积分 weapp quiz-result.wxml bindtap="onCheckPoints"
--3112 分享战绩 weapp quiz-result.wxml open-type="share"
--3113 返回首页 weapp quiz-result.wxml bindtap="toHome"
2. 活动
--321 进入活动, weapp activity.wxml
图片 note_image
标题 title
价格 unit_price
SELECT * view_activity_product
--322 点击进入活动详情页面 weapp activity_info.wxml todo 新增activity_info.wxml todo-1:1的image
图片 note_image
价格 unit_price1/unit_price2
标题 title
类别 product_desc1/product_desc2
描述 content
--323 页面分享 weapp activity-info.js options.from == 'button'
--324 回到首页 weapp activity-info.wxml bindtap="toHome"
--325 右上角分享 weapp activity-info.js onShareAppMessage()
--326 立即购买 (直接跳转到结算页 order.wxml) weapp activity-info.wxml bindtap="toBuy"
-- 弹出模态框 weapp activity-info.wxml 确定 bindtap="toConfirm"
-- 类别1/类别2 weapp activity-info.wxml bindtap="tab"
切换类别 product_desc 和价格 unit_price 显示已选: product_desc
-- 跳转到商品结算页 weapp order.wxml bindtap="toPay"
--327 加入购物车 (直接添加到购物车图标) todo 购物车数据存在客户端。
-- 弹出模态框 weapp activity-info.wxml 确定 bindtap="toConfirm"
-- 类别1/类别2 weapp activity-info.wxml bindtap="tab"
切换类别 product_desc 和价格 unit_price 显示已选: product_desc
-- 回到 weapp activity-info.wxml 购物车数据新增
--328 购物车 (点击购物车图标) weapp cart.wxml
-- 编辑 weapp cart.wxml bindtap="onEdit"
酒肆活动 编辑
member_name (Renaissance Bar) · title (酒集市)
图片 product_desc
note_image unit_price quantity
图片 product_desc
note_image unit_price quantity
全选 合计: 去结算 (bindtap="toOrder")
-- 完成 weapp cart.wxml bindtap="onFinish"
酒肆活动 完成
member_name (Renaissance Bar) · title (酒集市)
图片 product_desc
note_image unit_price quantity
图片 product_desc
note_image unit_price quantity
全选 删除所选 (bindtap="onDelete")
-- 删除所选 weapp cart.wxml bindtap="onDelete"
如果是全选 更改订单状态 tbl_order order_status 为 00-订单取消
如果是单个 更改子项状态 tbl_order_item item_status 为 00-订单取消 todo 添加item_status
-- 模态框 确定要从购物车删除所选商品 确定|取消
-- 点击"确定"之后 跳转到"去结算"页面
-- 默认剩下的所有item为全选状态
-- 去结算 weapp cart.wxml bindtap="toOrder"
-- 结算页 weapp order.wxml bindtap="toPay"
member_name (Renaissance Bar) · title (酒集市)
图片 product_desc
note_image unit_price quantity
图片 product_desc
note_image unit_price quantity
商品金额 total_price
合计: 去支付 (bindtap="toPay")
四. 用户到店使用流程
1. 竞答
-- 进入个人 我的->我的积分 weapp my.wxml
-- 进入我的积分 weapp my.wxml <navigator> /points.wxml
-- 可用|不可用 weapp points.wxml bindtap="tab"
-- 可用-助力清单 weapp points.wxml bindtap="onClickPoints"
-- 可用-优惠券码 weapp points.wxml bindtap="onClickBarcode"
-- 不可用-助力清单 weapp points.wxml bindtap="onClickPoints"
-- 扫一扫 weapp activity.wxml bindtap="getQRCode"
-- 扫码流程 weapp activity.js getQRCode() 更新match_status
--411 进入个人 我的->我的积分 weapp my.wxml
--412 进入我的积分 weapp my.wxml <navigator> /points.wxml
--413 可用|不可用 weapp points.wxml bindtap="tab"
--414 可用-助力清单 weapp points.wxml bindtap="onClickPoints"
--415 可用-优惠券码 weapp points.wxml bindtap="onClickBarcode"
--416 不可用-助力清单 weapp points.wxml bindtap="onClickPoints"
--417 扫一扫 weapp activity.wxml bindtap="getQRCode"
--418 扫码流程 weapp activity.js getQRCode() start with mid 更新 tbl_match 表 match_status
2. 活动
--421 进入个人 我的->我的活动 weapp my.xml
--422 进入我的活动 weapp order.wxml <navigator> /order.wxml
--423 可使用|待付款|不可用 weapp /order.wxml bindtap="tab"
--424 可使用页面 weapp /order.wxml
--425 可使用-优惠券码 weapp order.wxml bindtap="onClickBarcode"
--426 待付款-立即支付 weapp order.wxml bindtap="onPay", 生成 qrcode; 钱到账, 数据到位
--427 扫一扫 weapp activity.wxml bindtap="getQRCode"
--428 扫码流程 weapp activity.js getQRCode() start with oid_ 更新 tbl_order 表 order_status 20->30
五. 用户注册流程
todo
......@@ -107,7 +189,96 @@
sql:
428 UPDATE tbl_order SET order_status='30', end_datetime=NOW(), update_datetime=NOW() WHERE order_id='oid_001';
427
426 更新 tbl_order 表 order_status 10->20 total_price -> 59 qrcodeUrl="" payment_type="01" payment_datetime
获取价格 SELECT SUM(total_price) AS total_price FROM tbl_order_item WHERE order_id='oid_002'
生成 qrcode_url
更新
update tbl_order set order_status="20", payment=59.0, payment_type="01", payment_datetime=NOW(), qrcode_url=""
where order_id='oid_002'
更新 tbl_pay_info 表 备注: 更新 pay_number 一定是在pay的时候
参考1: https://www.cnblogs.com/heyuquan/p/global-guid-identity-maxId.html 如何在高并发分布式系统中生成全局唯一Id
12位年月日时分秒+5位流水码+3位服务器编码 (这样流水码就需要结合数据库和缓存)---共20位 (将影响顺序权重大的“流水码”放前面,影响顺序权重小的服务器编码放后)
缺陷:因为使用到流水码,流水码的生成必然会遇到和MaxId、序列表、Sequence方案中类似的问题
参考2: https://blog.csdn.net/wzn1054162229/article/details/88587021 如何自动生成流水号(以MySQL为例)
SELECT CONCAT(DATE_FORMAT(NOW(),'%Y%m%d%h%i%s'),
(
CASE
WHEN SUBSTR(pay_number, 1, 8) = DATE_FORMAT(NOW(),'%Y%m%d')
THEN SUBSTR(CONCAT('0000' , (IFNULL(MAX(SUBSTR(pay_number,-5)),0) + 1 )), -5)
ELSE '00001'
END
)) AS pay_number
FROM
tbl_pay_info
update tbl_pay_info
set pay_number='2020080610555700003', pay_platform='10', pay_status='01'
where order_id='oid_002'
425
424 页面数据
member.member_name Renaissance Bar
activity.title 意大利红酒周
note_image product_desc quantity
note_image product_desc quantity
券码: aid_001 图标
SELECT member_name, title, product_image, product_desc, unit_price, quantity, order_status, order_id, user_id, qrcode_url, create_datetime, update_datetime
FROM view_order_info
WHERE 1=1
AND user_id='uid_030e7057-e6b5-4fb0-bcbf-d8bf055e38d9'
AND order_status='20'
orders = [
{
order_id : "",
member_name : "",
title: "",
qrcode_url : "",
order_item: [
{
note_image : "",
product_desc : "",
quantity : ""
},
{
note_image : "",
product_desc : "",
quantity : ""
},
]
}
]
423
422
422
421
*/
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论