123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- <?php
- namespace app\admin\controller;
- use app\BaseController;
- use think\App;
- use think\facade\Db;
- class Data extends BaseController
- {
-
-
- public function todaySalesVolume()
- {
- $rs = Db::name('sale')
- ->field('count(id) orders_number,sum(total_price) money')
- ->where('is_del', 0)
- ->whereDay('addtime', 'today')
- ->find();
- $temp = [
- 'orders_number' => isset($rs['orders_number']) ? $rs['orders_number'] : 0,
- 'money' => isset($rs['money']) ? $rs['money'] : 0,
- ];
- return app_show(0, '请求成功', $temp);
- }
-
- public function todaySalesChampion()
- {
- $temp = Db::name('sale')
- ->field('count(id) orders,sum(total_price) money,apply_id')
- ->where('is_del', 0)
- ->whereDay('addtime', 'today')
- ->group('apply_id')
- ->order('money', 'desc')
- ->limit(1)
- ->buildSql();
- $rs = Db::table($temp)
- ->alias('t')
- ->field('t.apply_id,t.orders,t.money,u.itemid company_id, c.`name` company, u.nickname')
- ->leftJoin('depart_user u', 'u.uid=t.apply_id AND u.is_del=0')
- ->leftJoin('company_item c', 'c.id=u.itemid AND c.is_del=0')
- ->select()
- ->toArray();
- return app_show(0, '请求成功', empty($rs[0]) ? [] : $rs[0]);
- }
-
- public function todayPurchase()
- {
- $rs = Db::name('purchease_order')
- ->field('count(id) orders_number,sum(good_num) good_num')
- ->where('is_del', 0)
- ->whereDay('addtime', 'today')
- ->find();
- $consult_info_total = Db::name('consult_info')
- ->where('is_del', 0)
- ->whereDay('addtime', 'today')
- ->count('id');
- $consult_bids_total = Db::name('consult_bids')
- ->where('is_del', 0)
- ->whereDay('addtime', 'today')
- ->count('id');
- $data = [
- 'orders_number' => isset($rs['orders_number']) ? $rs['orders_number'] : 0,
- 'good_num' => isset($rs['good_num']) ? $rs['good_num'] : 0,
- 'consult_info_total' => $consult_info_total,
- 'consult_bids_total' => $consult_bids_total,
- ];
- return app_show(0, '请求成功', $data);
- }
-
-
- public function totalZixunPurchease()
- {
-
- $zixun_total = Db::name('consult_info')
- ->where('is_del', 0)
- ->count('id');
-
- $zixun_bids = Db::name('consult_bids')
- ->where('is_del', 0)
- ->count('id');
-
- $not_feedback = $zixun_total - $zixun_bids;
-
- $purchease_total = Db::name('purchease_order')
- ->where('is_del', 0)
- ->count('id');
-
- $purchease_wait_confirm = Db::name('purchease_order')
- ->where(['is_del' => 0, 'status' => 0])
- ->count('id');
- return app_show(0, '请求成功', [
- 'zixun_total' => $zixun_total,
- 'not_feedback' => $not_feedback,
- 'purchease_total' => $purchease_total,
- 'purchease_wait_confirm' => $purchease_wait_confirm,
- ]);
- }
-
- public function waitSendTotal()
- {
- return 123;
- }
-
- public function todaySale()
- {
- $temp = Db::name('sale')
- ->alias('s')
- ->field('s.id,s.apply_id,s.total_price,u.nickname,u.itemid')
- ->leftJoin('depart_user u', 'u.uid=s.apply_id AND u.is_del=0')
- ->where('s.is_del', 0)
- ->whereDay('s.addtime', 'today')
- ->buildSql();
- $rs = Db::table($temp)
- ->alias('t')
- ->field('itemid companyId,c.`name` companyName,SUM(t.total_price) total_price,COUNT(t.id) total_order')
- ->leftJoin('company_item c', 'c.id=t.itemid')
- ->group('t.itemid')
- ->order('total_price', 'desc')
- ->limit(3)
- ->select()
- ->toArray();
- return app_show(0, '请求成功', $rs);
- }
-
- public function monthFinishRate()
- {
- }
-
- public function orderTransferRateToday(){
- }
-
- public function orderTransferRateMonth(){
- }
-
- public function orderTransferRateYear(){
- }
- }
|