作者 lyh

gx

... ... @@ -18,7 +18,7 @@ class FetchTicketProjects extends Command
*
* @var string
*/
protected $signature = 'workorder:fetch-ticket-projects {action}';
protected $signature = 'workorder:fetch-Ticket-projects {action}';
/**
* The console command description.
... ...
... ... @@ -179,7 +179,7 @@ class LoginController extends BaseController
$accessToken = $wechat->getAccessToken();
$data = $wechat->setQrcode('global-v6_'.$this->param['type'].'_'.$this->param['id'],$accessToken);
if(!empty($data)){
$data['url'] = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=".$data['ticket'];
$data['url'] = "https://mp.weixin.qq.com/cgi-bin/showqrcode?Ticket=".$data['Ticket'];
}
$this->response('success',Code::SUCCESS,$data);
}
... ... @@ -218,11 +218,11 @@ class LoginController extends BaseController
*/
public function getWechatLoginInfo(){
$this->param = $this->request->validate([
'ticket' => 'required',
'Ticket' => 'required',
],[
'ticket.required' => 'ticket不能为空',
'Ticket.required' => 'ticket不能为空',
]);
$info = Cache::get($this->param['ticket']);
$info = Cache::get($this->param['Ticket']);
$this->response('success',Code::SUCCESS,$info);
}
... ...
<?php
/**
* @remark :
* @name :TicketController.php
* @author :lyh
* @method :post
* @time :2025/8/11 10:46
*/
namespace App\Http\Controllers\Bside\Ticket;
use App\Enums\Common\Code;
use App\Http\Controllers\Bside\BaseController;
use App\Http\Logic\Bside\Ticket\TicketLogic;
use App\Models\WorkOrder\Tickets;
use Illuminate\Http\Request;
class TicketController extends BaseController
{
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new TicketLogic();
}
/**
* @remark :统计记录(今日)
* @name :ticketCount
* @author :lyh
* @method :post
* @time :2025/8/11 10:47
*/
public function ticketCount(){
$data['daily'] = $this->logic->getTicketCount();
$data['list'] = $this->logic->getDailyTicketCount();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
<?php
/**
* @remark :
* @name :TicketLogic.php
* @author :lyh
* @method :post
* @time :2025/8/11 10:54
*/
namespace App\Http\Logic\Bside\Ticket;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Ticket\TicketDailyCount;
use App\Models\Ticket\TicketDailyDeptCount;
use App\Models\Ticket\TicketDailyManageCount;
use App\Models\WorkOrder\Tickets;
use Illuminate\Support\Carbon;
class TicketLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
}
/**
* @remark :获取今日统计数据
* @name :getTicketCount
* @author :lyh
* @method :post
* @time :2025/8/11 10:54
*/
public function getTicketCount(){
$data = [];
$ticketModel = new Tickets();
$data['ticket_num'] = $ticketModel->count();//工单总数
$date = date('Y-m-d');//今日时间
$data['add_num'] = $ticketModel->counts(['created_at'=>['between',[$date.' 00:00:00',$date.' 23:59:59']]]);//今日新增工单
$data['processed_num'] = $ticketModel->counts(['end_at'=>['between',[$date.' 00:00:00',$date.' 23:59:59']]]);//今日已处理工单
$data['untreated_num'] = $ticketModel->counts(['end_at'=>null]);//今日未处理工单
return $this->success($data);
}
/**
* @remark :按日统计数据
* @name :getDailyTicketCount
* @author :lyh
* @method :post
* @time :2025/8/11 10:57
*/
public function getDailyTicketCount(){
$dailyModel = new TicketDailyCount();
$dailyList = $dailyModel->list([],'average_time',['*'],'desc',5);//取最近5条数据
$date = Carbon::yesterday()->toDateString(); //昨日时间
$manageModel = new TicketDailyManageCount();
$manageList = $manageModel->list(['date'=>$date],'average_time',['*'],'desc',5);//取最近5条数据
$deptModel = new TicketDailyDeptCount();
$deptList = $deptModel->list(['date'=>$date],'average_time',['*'],'desc',5);
$data = ['daily'=>$dailyList,'manage'=>$manageList,'dept'=>$deptList];
return $this->success($data);
}
}
... ...
... ... @@ -27,7 +27,7 @@ class MessagePush extends Base
const TYPE_INQUIRY = 'inquiry';
const TYPE_WEEK = 'week';
const TYPE_TICKET = 'ticket';
const TYPE_TICKET = 'Ticket';
//设置关联表名
/**
* @var mixed
... ...