소스 검색

个人资料增加统计信息

lizhen_gitee 1 년 전
부모
커밋
d7173cd585
2개의 변경된 파일40개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      application/api/controller/company/Order.php
  2. 39 0
      application/common/library/Authcompany.php

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

@@ -119,7 +119,7 @@ class Order extends Apic
         }
 
         //完成
-        $rs = Db::name('order')->where('id',$id)->update(['status'=>3,'finish_time'=>time()]);
+        $rs = Db::name('order')->where('id',$id)->update(['status'=>3,'finish_time'=>time(),'staff_id'=>$this->auth->id]);
 
         if($rs === false){
             $this->error('操作失败');

+ 39 - 0
application/common/library/Authcompany.php

@@ -308,6 +308,45 @@ class Authcompany
         $userinfo['company']['image'] = one_domain_image($userinfo['company']['image']);
         $userinfo['money'] = model('walletcompany')->getWallet($this->company_id,'money');
 
+/////////////////////////////////////
+        //个人信息
+        $strattime = strtotime(date('Y-m-d'));
+        $endtime   = $strattime + 86399;
+
+
+
+        //今日开单
+        $map = [
+            'company_id' => $this->company_id,
+            'finishtime' => ['BETWEEN',[$strattime,$endtime]], //开单时间用完成时间
+            'status'     => 3,
+        ];
+        if($this->type == 2){
+            //员工的
+            $map['staff_id'] = $this->id;
+        }
+        $today_pay_fee   = Db::name('order')->where($map)->sum('pay_fee');
+        $today_appen_fee = Db::name('order')->where($map)->sum('appen_fee');
+        $userinfo['today_order_totalfee'] = $today_appen_fee + $today_pay_fee;
+
+        //今日新增客户
+        $map = [
+            'company_id' => $this->company_id,
+            'createtime'=>['BETWEEN',[$strattime,$endtime]],
+        ];
+        if($this->type == 2){
+            //员工的
+            $map['staff_id'] = $this->id;
+        }
+        $userinfo['today_newcus'] = Db::name('user_wallet')->where($map)->count();
+
+        //今日新增预约
+        $map = [
+            'company_id' => $this->company_id,
+            'createtime'=>['BETWEEN',[$strattime,$endtime]],
+        ];
+        $userinfo['today_newpre'] = Db::name('pre_order')->where($map)->count();
+
         return $userinfo;
     }