Browse Source

接口字段调整

lizhen_gitee 1 year ago
parent
commit
0b35f0cc2b

+ 79 - 1
application/api/controller/company/Index.php

@@ -66,7 +66,85 @@ class Index extends Apic
             'usernumber' => $usernumber,
             'summoney' => $summoney,
         ];
-        return $this->success(1,$rs);
+        $this->success(1,$rs);
+    }
+
+    //资金账单,下部列表
+    public function usermoney_lists(){
+        $keyword = input('keyword','');
+
+        $where = [
+            'log.company_id' => $this->auth->company_id,
+        ];
+        if(!empty($keyword)){
+            $where['user.nickname|user.mobile'] = ['LIKE','%'.$keyword.'%'];
+        }
+        $lists = Db::name('user_money_log')->alias('log')
+            ->field('log.id,log.log_type,log.change_value,log.remain,log.remark,log.createtime,user.nickname,user.mobile')
+            ->join('user','log.user_id = user.id','LEFT')
+            ->where($where)->autopage()->select();
+
+        $this->success(1,$lists);
+    }
+
+    //数据中心
+    public function datacenter_one(){
+        $date = input('date',0);
+        $starttime = strtotime($date);    //月初第一天
+        $endtime = strtotime("+1 month",$starttime) - 1; //月末最后一天
+
+        $ec_date = [];
+        $ec_ordernum = [];
+
+        $map = [
+            'company_id'  => $this->auth->company_id,
+        ];
+        if($this->auth->type == 2){
+            $map['staff_id'] = $this->auth->id;
+        }
+
+        for($i=$starttime;$i<$endtime;$i+=86400){
+            $starttime_i = $i;
+            $endtime_i = $i + 86399;
+            //日历
+            $ec_date[] = date('d',$starttime_i);
+            //下单人数
+            $map['finish_time'] = ['between',[$starttime_i,$endtime_i]];
+            $ec_ordernum[] = Db::name('order')->where($map)->count('id');
+        }
+
+        //饼图
+        $map['finish_time'] = ['between',[$starttime,$endtime]];
+        $servicetype = Db::name('servicetype')->field('id,title')->select();
+        foreach($servicetype as $key => &$val){
+            $map['servicetype_id'] = $val['id'];
+            $val['ordernum'] = Db::name('order')->where($map)->count('id');
+        }
+
+        $result = [
+            'ec_data' => $ec_date,
+            'ec_ordernum' => $ec_ordernum,
+            'servicetype' => $servicetype,
+        ];
+        $this->success(1,$result);
+    }
+
+    public function datacenter_two(){
+        $usernumber = Db::name('user_wallet')->where('company_id',$this->auth->company_id)->count();
+        $summoney = Db::name('user_wallet')->where('company_id',$this->auth->company_id)->sum('money');
+
+        $result = [
+            'usernumber' => $usernumber,
+            'summoney' => $summoney,
+        ];
+
+        $this->success(1,$result);
+    }
+    public function datacenter_three(){
+
+    }
+    public function datacenter_four(){
+
     }
 
 

+ 2 - 1
application/api/controller/company/Order.php

@@ -58,7 +58,7 @@ class Order extends Apic
         }
         $list = Db::name('order')->alias('order')
             ->join('servicetype','order.servicetype_id = servicetype.id','LEFT')
-            ->field('order.id,orderno,ordertype,user_name,user_car_number,createtime,servicetype_id,server_info,status,finish_time,cancel_reason,servicetype.title as servicetype_title,servicetype.baoyang_switch')->where($where)->order('order.id desc')->autopage()->select();
+            ->field('order.id,orderno,ordertype,user_name,user_car_number,createtime,servicetype_id,server_info,status,finish_time,cancel_reason,cancel_time,servicetype.title as servicetype_title,servicetype.baoyang_switch')->where($where)->order('order.id desc')->autopage()->select();
 
         foreach($list as $key => &$val){
             $val['status_text'] = $this->status_text($val['status']);
@@ -76,6 +76,7 @@ class Order extends Apic
             ->where('order.id',$id)->find();
         $info = info_domain_image($info,['server_images']);
         $info['status_text'] = $this->status_text($info['status']);
+        $info['total_fee'] = bcadd($info['pay_fee'],$info['appen_fee'],2);
 
         $info['appen_list'] = Db::name('order_appen')->where('order_id',$id)->select();