Browse Source

工作台

moonsflyer 8 months ago
parent
commit
94dbfedf12

+ 8 - 0
app/adminapi/controller/WorkbenchController.php

@@ -42,4 +42,12 @@ class WorkbenchController extends BaseAdminController
         $result = WorkbenchLogic::getServiceInfo($type,$area_id);
         return $this->data($result);
     }
+
+    public function getProductionInfo(){
+        $start_time = $this->request->get('start_time', '');
+        $end_time = $this->request->get('end_time', '');
+        $area_id = $this->request->get('area_id', '');
+        $result = WorkbenchLogic::getProductionInfo($area_id,$start_time,$end_time);
+        return $this->data($result);
+    }
 }

+ 39 - 0
app/adminapi/logic/WorkbenchLogic.php

@@ -20,6 +20,7 @@ use app\common\model\agricultural_machinery\UserService;
 use app\common\service\ConfigService;
 use app\common\service\FileService;
 use app\common\model\recharge\RechargeOrder;
+use app\common\model\supply_demand\SupplyDemandInfo;
 use app\common\model\user\User;
 use app\common\model\article\Article;
 use think\facade\Db;
@@ -72,6 +73,10 @@ class WorkbenchLogic extends BaseLogic
             'service'=>self::service($type,$area_id),
         ];
     }
+
+    public static function getProductionInfo($area_id,$start_time,$end_time){
+        return ['chat_data'=>self::production($area_id,$start_time,$end_time)];
+    }
     /**
      * @notes 常用功能
      * @return array[]
@@ -305,6 +310,40 @@ class WorkbenchLogic extends BaseLogic
         return ['type_desc'=>$type_desc,'count'=>$userCount];
     }
 
+    public static function production($area_id,$start_time,$end_time){
+        if($area_id){
+
+        }
+
+        if($start_time <> '' && $end_time <> ''){
+
+        }else{
+            if($start_time<>''){
+
+            }
+
+            if($end_time <> ''){
+
+            }
+        }
+        $where = [];
+        $where[]=['sdi.type','=',1];
+        $where[]=['sdi.status','=',2];
+
+        $supply_demand_list = SupplyDemandInfo::alias('sdi')
+                            ->leftJoin('supply_demand_cate sdc','sdc.id = sdi.cate_id')
+                            ->field('sdi.cate_id,sdc.name,sum(sdi.number) total_num')
+                            ->where($where)->group('sdi.cate_id')->select()->toArray();
+        $name = [];
+        $value = [] ;
+        if($supply_demand_list){
+            $name = array_column($supply_demand_list,'name');
+            $value = array_column($supply_demand_list,'total_num');
+        }
+        $data=['name'=>$name,'value'=>$value];
+        return $data;
+    }
+
     public static function agricultural(){
         $nowYear = date('Y');
         $nowMonth = date('n');

+ 1 - 1
app/adminapi/logic/agricultural_machinery/SupplyDemandLogic.php

@@ -42,7 +42,7 @@ class SupplyDemandLogic extends BaseLogic
      */
     public static function delete(array $params)
     {
-        UserService::destroy($params['id']);
+        SupplyDemandInfo::destroy($params['id']);
     }
 
     /**