作者 lyh

gx

... ... @@ -23,6 +23,7 @@ use App\Models\Project\ProjectWhiteHatAffix;
use App\Models\Template\BTemplateMain;
use App\Models\Template\TemplateTypeMain;
use App\Models\WebSetting\WebSetting;
use App\Models\WorkOrder\Tickets;
use App\Services\AiBlogService;
use App\Services\CosService;
use App\Services\Geo\GeoService;
... ... @@ -48,13 +49,14 @@ class lyhDemo extends Command
protected $description = '更新路由';
public function handle(){
// $content = "{Introducing the cutting-edge product from Zhejiang Yuexiang Gas Technology Co., Ltd., the Bracket Gas Flowmeter. This innovative gas flowmeter is designed to provide accurate and reliable measurements for a wide range of industrial applications,Equipped with advanced technology and precision components, the Bracket Gas Flowmeter ensures exceptional performance and durability. It offers highly accurate gas flow readings, allowing users to closely monitor and control gas consumption in various processes. The meter's user-friendly interface displays real-time flow rates and totalized flow data, facilitating efficient and convenient data management,With its robust construction and corrosion-resistant materials, the Bracket Gas Flowmeter guarantees long-term reliability, even in harsh operating conditions. It is compatible with various gases such as natural gas, propane, and hydrogen, making it a versatile choice for multiple industries including oil and gas, chemical, and manufacturing,Furthermore, the Bracket Gas Flowmeter is engineered with ease of installation and maintenance in mind. Its compact and space-saving design allows for flexible mounting options, while its modular construction enables quick and hassle-free maintenance. Additionally, it meets international standards for accuracy and safety, ensuring compliance with industry regulations,Choose the Bracket Gas Flowmeter for precise and efficient gas flow measurement, backed by the expertise and commitment of Zhejiang Yuexiang Gas Technology Co., Ltd},{Shop Quality Brackets: Top China Products & Services for Your Needs},4K,高清 --no logo --ar 16:9";
// $midJourneyService = new MidJourneyService();
// $result = $midJourneyService->imagine($content);
$url = 'https://ecdn6-nc.globalso.com/upload/p/1/png/2025-08/688dcebc26a7a59911.png';
$cosService = new CosService();
$data = $cosService->cropAndUploadToCOS($url);
dd($data);
$ticketModel = new Tickets();
$list = $ticketModel->list(['end_at'=>['!=',null]]);
foreach ($list as $item){
echo '执行的任务id:'.$item['id'];
$end_time = diffInHours($item['created_at'],$item['end_at']);
$ticketModel->edit(['end_time'=>$end_time],['id'=>$item['id']]);
}
return true;
}
/**
... ...
<?php
/**
* @remark :
* @name :TicketCount.php
* @author :lyh
* @method :post
* @time :2025/8/7 17:42
*/
namespace App\Console\Commands\Ticket;
use App\Models\Manage\ManageHr;
use App\Models\Ticket\TicketDailyManageCount;
use Illuminate\Console\Command;
class TicketCount extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'ticket_count {action}';
/**
* The console command description.
*
* @var string
*/
protected $description = '日统计工单';
/**
* @remark :统计脚本
* @name :handle
* @author :lyh
* @method :post
* @time :2025/8/7 17:45
*/
public function handle(){
}
/**
* @remark :按管理员统计(只统计技术组)
* @name :manage_action
* @author :lyh
* @method :post
* @time :2025/8/7 17:45
*/
public function manage_action(){
$manageHrModel = new ManageHr();
$manageList = $manageHrModel->list(['status'=>1,'dept_id'=>1],'id',['id','name','nickname']);
$date = date('Y-m-d');
$ticketManageCountModel = new TicketDailyManageCount();
foreach ($manageList as $item){
$data = [
'date'=>$date,
'manage_id'=>$item['id'],
'manage_name'=>$item['name'],
'ticket_num'=>'',//工单总数量
'average_time'=>'',//平均完成工单时长
'fastest_time'=>'',//最快完成工单时间
'timeout_num'=>'',//超时工单数量
'complete_num'=>'',//完成工单数量
];
//查询当前用户是否当日已有记录
$ticketManageInfo = $ticketManageCountModel->read(['date'=>$date,'manage_id'=>$item['id']],['id']);
if($ticketManageInfo === false){
//TODO::执行新增
}else{
//TODO::执行编辑
}
}
}
}
... ...
... ... @@ -1421,3 +1421,22 @@ function getTopDomain ($url) {
return $host;
}
/**
* @remark :两个时间的差值
* @name :diffInHours
* @author :lyh
* @method :post
* @time :2025/8/8 9:10
*/
function diffInHours($startTime, $endTime)
{
$start = new DateTime($startTime);
$end = new DateTime($endTime);
// 计算时间差
$interval = $start->diff($end);
// 总小时数 = 天数 * 24 + 小时数 + 分钟数换算成小数小时
$hours = $interval->days * 24 + $interval->h + ($interval->i / 60);
// 四舍五入保留1位小数
return round($hours, 1);
}
... ...
... ... @@ -239,6 +239,7 @@ class AsideTicketController extends BaseController
{
// 完成工单,把子任务里面未完成的工单改为完成
$ticket->end_at = now();
$ticket->end_time = diffInHours($ticket->end_at,$ticket->created_at);
$ticket->logs()->where('status', '<', TicketLog::STATUS_COMPLETED)->where('is_engineer', 1)
->update(['status' => TicketLog::STATUS_COMPLETED, 'end_at' => now()]);
// 推动微信通知
... ...
... ... @@ -91,6 +91,7 @@ class AsideTicketLogController extends BaseController
{
$ticket->status = Tickets::STATUS_COMPLETED;
$ticket->end_at = now();
$ticket->end_time = diffInHours($ticket->end_at,$ticket->created_at);
$project = $ticket->project;
if ($project->wechat_switch && !$ticket->close_wechat)
$project->pushWechatGroupMsg("工单(ID:{$ticket->id})已全部完成,请访问查看详情!");
... ...
<?php
/**
* @remark :
* @name :TicketDailyCount.php
* @author :lyh
* @method :post
* @time :2025/8/7 17:50
*/
namespace App\Models\Ticket;
use App\Models\Base;
/**
* @remark :工单日统计
* @name :TicketDailyCount
* @author :lyh
* @method :post
* @time :2025/8/7 17:51
*/
class TicketDailyCount extends Base
{
protected $table = 'gl_ticket_daily_count';
}
... ...
<?php
/**
* @remark :
* @name :TicketDailyDeptCount.php
* @author :lyh
* @method :post
* @time :2025/8/7 17:51
*/
namespace App\Models\Ticket;
use App\Models\Base;
/**
* @remark :工单日统计:按照技术组统计
* @name :TicketDailyDeptCount
* @author :lyh
* @method :post
* @time :2025/8/7 17:51
*/
class TicketDailyDeptCount extends Base
{
protected $table = 'gl_ticket_daily_dept_count';
}
... ...
<?php
/**
* @remark :
* @name :TicketDailyManageCount.php
* @author :lyh
* @method :post
* @time :2025/8/7 17:52
*/
namespace App\Models\Ticket;
use App\Models\Base;
/**
* @remark :工单日统计:按照人员统计
* @name :TicketDailyManageCount
* @author :lyh
* @method :post
* @time :2025/8/7 17:53
*/
class TicketDailyManageCount extends Base
{
protected $table = 'gl_ticket_daily_manage_count';
}
... ...