99 lines
7.2 KiB
Plaintext
99 lines
7.2 KiB
Plaintext
|
|
SELECT sum(o.order_zhe_total)
|
|
FROM `order` o
|
|
LEFT join `user` u ON o.user_id=u.id
|
|
where u.status=1 and u.istest=0 and o.status=1
|
|
and o.addtime>UNIX_TIMESTAMP(CURDATE());
|
|
|
|
SELECT o.user_id,u.nickname,u.mobile,
|
|
IFNULL(sum(price)+SUM(use_money),0) use_money,
|
|
( select sum(goodslist_money) sc_money from order_list where addtime<1746374399 and user_id=21617 and status=2) fh_money,
|
|
( select sum(goodslist_money) sc_money from order_list where addtime<1746374399 and user_id=21617 and status=1) bb_money,
|
|
u.money2
|
|
FROM `order` o LEFT join `user` u ON o.user_id=u.id where u.status=1 and u.istest=0
|
|
and o.addtime>1745550000 and o.addtime<1746374399 group by o.user_id;
|
|
|
|
select c.* from (
|
|
select t.*,
|
|
(CASE
|
|
WHEN t.use_money>0 THEN (t.use_money-t.fh_money-t.bb_money-t.sy_money)
|
|
ELSE 0
|
|
END) yue_money
|
|
from (
|
|
SELECT o.user_id, u.uid, u.nickname, u.headimg, u.mobile,
|
|
u.money,
|
|
u.integral,
|
|
count(1) orderCount,
|
|
sum(IFNULL(order_zhe_total,0)) order_zhe_total,
|
|
IFNULL(sum(price),0) money_1,
|
|
IFNULL(sum(use_money),0) money_2,
|
|
IFNULL(sum(price)+SUM(use_money),0) use_money,
|
|
(select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=2 and choice_time > 1746201600 and choice_time < 1746374399) fh_money,
|
|
(select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=0 and addtime < 1746374399) bb_money,
|
|
(TRUNCATE(u.money2/100, 2)) money2,
|
|
(TRUNCATE(IFNULL((SELECT money FROM profit_money2 where user_id=o.user_id and addtime > 1746201600 and addtime < 1746374399 order by id desc LIMIT 1),0)/100, 2)) sy_money
|
|
FROM `user` u INNER join `order` o ON o.user_id=u.id where u.status=1 and u.istest=0 and o.status=1 and o.addtime > 1746201600 and o.addtime < 1746374399 group by o.user_id ) t where use_money>0
|
|
) c order by yue_money desc;
|
|
|
|
SELECT change_money,money,content,FROM_UNIXTIME(addtime) addtime FROM profit_money2 where user_id=23824 and addtime > 1746201600 and addtime < 1746374399 order by id asc;
|
|
|
|
SELECT * from order_list where user_id=24603 and send_num='FH_MONYDMP02025050810052102922' and choice_time<1746979200 ;
|
|
|
|
select c.* from (
|
|
select t.*,
|
|
(CASE
|
|
WHEN t.use_money>0 THEN (t.use_money-t.fh_money-t.bb_money-t.sy_money)
|
|
ELSE 0
|
|
END) yue_money
|
|
from (
|
|
SELECT o.user_id, u.uid, u.nickname, u.headimg, u.mobile,
|
|
u.money,
|
|
u.integral,
|
|
count(1) orderCount,
|
|
sum(IFNULL(order_zhe_total,0)) order_zhe_total,
|
|
IFNULL(sum(price),0) money_1,
|
|
IFNULL(sum(use_money),0) money_2,
|
|
IFNULL(sum(price)+SUM(use_money),0) use_money,
|
|
(select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=2 and choice_time > 1746288000 and choice_time < 1746547199) fh_money,
|
|
(select IFNULL(sum(goodslist_money),0) sc_money from order_list where user_id=o.user_id and status=0 and addtime < 1746288000 ) bb_money,
|
|
(TRUNCATE(u.money2/100, 2)) money2,
|
|
(TRUNCATE(IFNULL((SELECT money FROM profit_money2 where user_id=o.user_id and addtime > 1746288000 and addtime < 1746547199 order by id desc LIMIT 1),0)/100, 2)) sy_money
|
|
FROM `order` o LEFT join `user` u ON o.user_id=u.id where u.status=1 and u.istest=0 and o.status=1 and o.addtime > 1746288000 and o.addtime < 1746547199 and o.user_id = 24426 group by o.user_id ) t where use_money>0
|
|
) c order by yue_money desc;
|
|
select * from order_list where user_id=24426 and status=0 and addtime < 1746288000 ;
|
|
|
|
select o.order_num,o.order_zhe_total from `order` o INNER join `user` u on o.user_id=u.id where o.status=1 and o.addtime>1746979200 and o.addtime<1747497599 and u.istest=0 and u.status=1;
|
|
|
|
select sum(goodslist_money) sc_money from order_list where addtime<1746374399 and user_id=21617 and status=2;
|
|
select sum(goodslist_money) sc_money from order_list where addtime<1746374399 and user_id=21617 and status=1;
|
|
|
|
# 按天订单数据统计
|
|
select DATE(FROM_UNIXTIME(o.addtime)) add_day,count(1) order_count,count(DISTINCT o.user_id) user_count,sum(price) price,sum(use_money) use_money,sum(use_integral) use_integral,sum(use_money2) use_money2 from `order` o LEFT join `user` u ON o.user_id=u.id where u.status=1 and u.istest=0 and o.status=1 group by DATE(FROM_UNIXTIME(o.addtime));
|
|
|
|
|
|
# 今日出货总额
|
|
SELECT IFNULL(sum(goodslist_money),0) FROM order_list oll LEFT join `user` us on oll.user_id=us.id where us.status=1 and us.istest=0 and oll.goodslist_type<3 and oll.addtime>UNIX_TIMESTAMP(CURDATE());
|
|
# 每日发货总金额
|
|
SELECT DATE(FROM_UNIXTIME(oll.choice_time)) choice_time,IFNULL(sum(goodslist_money),0) goodslist_money FROM order_list oll LEFT join `user` us on oll.user_id=us.id where us.status=1 and us.istest=0 and oll.status=2 and oll.goodslist_type<3 GROUP BY DATE(FROM_UNIXTIME(oll.choice_time));
|
|
# 每日兑换达达券
|
|
SELECT DATE(FROM_UNIXTIME(oll.choice_time)) choice_time,IFNULL(sum(goodslist_money),0) goodslist_money FROM order_list oll LEFT join `user` us on oll.user_id=us.id where us.status=1 and us.istest=0 and oll.status=1 and oll.goodslist_type<3 GROUP BY DATE(FROM_UNIXTIME(oll.choice_time));
|
|
# 今日盒柜剩余价值
|
|
SELECT IFNULL(sum(goodslist_money),0) FROM order_list oll LEFT join `user` us on oll.user_id=us.id where us.status=1 and us.istest=0 and oll.status=0 and oll.goodslist_type<3 and oll.addtime>UNIX_TIMESTAMP(CURDATE());;
|
|
|
|
-- 今日达达券货币发放
|
|
select IFNULL(sum(change_money),0) from profit_money2 m LEFT join `user` u on m.user_id=u.id where u.status=1 and u.istest=0 and m.change_money>0 and m.addtime>UNIX_TIMESTAMP(CURDATE());
|
|
|
|
|
|
-- 每日达达券货币消费 ·
|
|
select DATE(FROM_UNIXTIME(m.addtime)) addtime,IFNULL(sum(ABS(change_money)),0) change_money from profit_money2 m LEFT join `user` u on m.user_id=u.id where u.status=1 and u.istest=0 and m.change_money<0 GROUP BY DATE(FROM_UNIXTIME(m.addtime));
|
|
|
|
# 今日钻石发放
|
|
select DATE(FROM_UNIXTIME(m.addtime)) addtime,IFNULL(sum(change_money),0) from profit_money m LEFT join `user` u on m.user_id=u.id where u.status=1 and u.istest=0 and m.change_money>0 GROUP BY DATE(FROM_UNIXTIME(m.addtime));
|
|
# 今日钻石消费
|
|
select IFNULL(sum(ABS(change_money)),0) from profit_money m LEFT join `user` u on m.user_id=u.id where u.status=1 and u.istest=0 and m.change_money<0 and m.addtime>UNIX_TIMESTAMP(CURDATE());
|
|
|
|
# 今日UU币发放
|
|
select IFNULL(sum(change_money),0) from profit_integral m LEFT join `user` u on m.user_id=u.id where u.status=1 and u.istest=0 and m.change_money>0 and m.addtime>UNIX_TIMESTAMP(CURDATE());
|
|
# 今日UU币消费
|
|
select IFNULL(sum(ABS(change_money)),0) from profit_integral m LEFT join `user` u on m.user_id=u.id where u.status=1 and u.istest=0 and m.change_money<0 and m.addtime>UNIX_TIMESTAMP(CURDATE());
|