2025-04-10 23:19:13 +08:00

90 lines
2.2 KiB
PHP
Executable File

<?php
/**
* @Author: fm453
* @Date: 2021-09-08 00:25:51
# @Last modified by: fm453
# @Last modified time: 2022-02-08T09:46:43+08:00
* @Email: fm453@lukegzs.com
*/
namespace backend\components;
use Yii;
use common\models\CLog;
use common\models\User;
use common\models\Member;
use common\models\Fans;
use common\models\CAttachment;
use common\models\CSms;
use common\models\CVcode;
use addons\models\AcCar;
use addons\models\AcCarOwner;
use addons\models\AcCarBrand;
use addons\models\AcCarSeries;
use addons\models\AcStore;
use addons\models\AcEmployee;
use addons\models\AcOrder;
use addons\models\AcOrderPre;
use addons\models\AcOrderStatus;
use addons\models\AcTruck;
use addons\models\AcDriver;
use addons\models\AcPlat;
use addons\models\AcContact;
class Helper {
//历史访客数
public static function getHistoryVisNum(){
$res = CLog::find()->count();
return $res;
}
//最近一个月访问量
public static function getMonthHistoryVisNum(){
$LastMonth = strtotime("-1 month");
$res = CLog::find()->where(['>','create_time',$LastMonth])->count();
return $res;
}
//API接口站用户总数
public static function getApierCount(){
$res = User::find()->count();
return $res;
}
//会员数据总数
public static function getMemberCount(){
$res = Member::find()->count();
return $res;
}
//粉丝数据总数
public static function getFansCount(){
$res = Fans::find()->count();
return $res;
}
//短信统计
public static function getSmsStat(){
$sms = CSms::find()->count();
$mobile = CSms::find()->groupBy('mobile')->count();
return ['sms'=>$sms,'mobile'=>$mobile];
}
//附件统计
public static function getAttachStat(){
$num = CAttachment::find()->count();
$size = CAttachment::find()->sum('filesize');
return ['num'=>$num, 'size'=>$size];
}
//今日运单
public static function getOrderToday(){
$num = CAttachment::find()->count();
$size = CAttachment::find()->sum('filesize');
return ['num'=>$num, 'size'=>$size];
}
}