|
|
@@ -16,8 +16,12 @@ namespace app\adminapi\logic;
|
|
|
|
|
|
|
|
|
use app\common\logic\BaseLogic;
|
|
|
+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\user\User;
|
|
|
+use think\facade\Db;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -48,11 +52,19 @@ class WorkbenchLogic extends BaseLogic
|
|
|
// 服务支持
|
|
|
'support' => self::support(),
|
|
|
// 销售数据
|
|
|
- 'sale' => self::sale()
|
|
|
+ 'sale' => self::sale(),
|
|
|
+
|
|
|
+ 'income'=>self::income(),
|
|
|
+
|
|
|
+ 'customer'=>self::customer()
|
|
|
];
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ public static function getServiceInfo($type,$area_id){
|
|
|
+ return [
|
|
|
+ 'service'=>self::service($type,$area_id),
|
|
|
+ ];
|
|
|
+ }
|
|
|
/**
|
|
|
* @notes 常用功能
|
|
|
* @return array[]
|
|
|
@@ -231,4 +243,54 @@ class WorkbenchLogic extends BaseLogic
|
|
|
];
|
|
|
}
|
|
|
|
|
|
+ /*
|
|
|
+ * 收益
|
|
|
+ * **/
|
|
|
+ public static function income(){
|
|
|
+ $where=[];
|
|
|
+ $now = time();
|
|
|
+ $start_time = date('Y-m-d',$now).' 00:00:00';
|
|
|
+
|
|
|
+ $where[]=['pay_status','=',1];
|
|
|
+ $total_income = RechargeOrder::where($where)->sum('order_amount');
|
|
|
+
|
|
|
+ $where[]=['pay_time','>=',strtotime($start_time)];
|
|
|
+
|
|
|
+ $today_income = RechargeOrder::where($where)->sum('order_amount');
|
|
|
+ $data['total_income']=$total_income;
|
|
|
+ $data['today_income']=$today_income;
|
|
|
+ return ($data);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*
|
|
|
+ * 客户总数
|
|
|
+ * */
|
|
|
+
|
|
|
+ public static function customer(){
|
|
|
+ $userCount = User::count();
|
|
|
+ return $userCount;
|
|
|
+ }
|
|
|
+
|
|
|
+ public static function service($type=1,$area_id=''){
|
|
|
+ $where = [];
|
|
|
+ $where[]=['type','=',$type];
|
|
|
+ $where[]=['status','=',1];
|
|
|
+ if(!empty($area_id)){
|
|
|
+ $where[] = ['area_id', 'like','%'. ',' . $area_id. ',' .'%'];
|
|
|
+ }
|
|
|
+ $userCount = UserService::where($where)->count();
|
|
|
+
|
|
|
+ switch ($type){
|
|
|
+ case 1 :
|
|
|
+ $type_desc='农机手';
|
|
|
+ break;
|
|
|
+ case 2:
|
|
|
+ $type_desc='烘干服务';
|
|
|
+ break;
|
|
|
+ case 3:
|
|
|
+ $type_desc='飞防服务';
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ return ['type_desc'=>$type_desc,'count'=>$userCount];
|
|
|
+ }
|
|
|
}
|