作者 赵彬吉
... ... @@ -2,6 +2,7 @@
namespace App\Console\Commands\Domain;
use App\Models\Geo\GeoCount;
use App\Models\Project\DeployBuild;
use App\Models\Project\DeployOptimize;
use App\Models\Project\Project;
... ... @@ -58,41 +59,31 @@ class RemainDay extends Command
*/
protected $description = '网站服务剩余时长';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
$this->project = new Project();
$this->deployBuild = new DeployBuild();
parent::__construct();
}
/**
* @return bool
*/
public function handle()
{
$this->saveRemainDay();
$this->_action();
return true;
}
/**
* @remark :普通项目剩余服务时常
* @name :saveRemainDay
* @remark :计算剩余服务时常
* @name :_action
* @author :lyh
* @method :post
* @time :2025/4/2 10:48
* @time :2025/11/4 10:59
*/
public function saveRemainDay(){
$list = $this->project->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','level','uptime','remain_day','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day']);
public function _action(){
$projectModel = new Project();
$deployBuildModel = new DeployBuild();
$list = $projectModel->list(['extend_type'=>Project::TYPE_ZERO,'type'=>['in',[Project::TYPE_TWO,Project::TYPE_THREE,Project::TYPE_FOUR,Project::TYPE_SIX]]],'id',['id','type','level','uptime','remain_day','version','is_remain_today','pause_days','finish_remain_day','bm_finish_remain_day','geo_qualify_num']);
foreach ($list as $item){
$deploy_build = $deployBuildModel->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']);
echo 'start->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
$deploy_build = $this->deployBuild->read(['project_id'=>$item['id']],['service_duration','seo_service_duration','plan','seo_plan']);
//todo::暂停的项目停止计时
if(in_array($item['id'],$this->ceaseProjectId)){//暂停的项目
if(($item['type'] == Project::TYPE_TWO) && ($item['is_remain_today'] == 1)){
$pause_days = $item['pause_days'] + 1;
... ... @@ -111,15 +102,14 @@ class RemainDay extends Command
//白帽版本单独计算
$this->seoRemainDay($deploy_build,$item);
//默认版本统计
if($deploy_build['service_duration'] == 0){
continue;
}
$this->remainDay($item,$deploy_build);
echo 'end->项目id:' . $item['id'] . '执行时间:'. date('Y-m-d H:i:s') . PHP_EOL;
}
return true;
}
/**
* @remark :白帽版本单独计算
* @name :seoRemainDay
... ... @@ -140,13 +130,7 @@ class RemainDay extends Command
$compliance_day = floor($diff / (60 * 60 * 24));
$seo_remain_day = $deploy_build['seo_service_duration'] - $compliance_day;
}
if($deploy_build['plan'] == 0 && $seo_remain_day < 0 && $deploy_build['seo_service_duration'] != 0){//只有白帽版本的项目且剩余服务时常为0,放入未续费中
// $this->project->edit(['seo_remain_day'=>$seo_remain_day,'finish_remain_day'=>$compliance_day ?? 0,'extend_type'=>Project::TYPE_FIVE],['id'=>$item['id']]);
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
}else{
//同时包括白帽版本+默认版本的项目
$this->project->edit(['seo_remain_day'=>$seo_remain_day,'bm_finish_remain_day'=>$compliance_day ?? 0],['id'=>$item['id']]);
}
}
}
return true;
... ... @@ -160,6 +144,10 @@ class RemainDay extends Command
* @time :2025/4/25 14:31
*/
public function remainDay($item,$deploy_build){
//默认版本统计
if($deploy_build['service_duration'] == 0){
return false;
}
//默认版本计算剩余服务时常
if($item['type'] == Project::TYPE_TWO || $item['type'] == Project::TYPE_FOUR){
if(in_array($item['id'],$this->projectId)){//已开始优化的时间结算
... ... @@ -173,6 +161,14 @@ class RemainDay extends Command
$remain_day = $deploy_build['service_duration'] - $compliance_day;
}else{
$compliance_day = ($item['finish_remain_day'] ?? 0);
//todo::7.5版本单独计算
if($item['version'] == 7.5 && $deploy_build['seo_plan'] != 0 && $deploy_build['plan'] != 0){
$geoCountModel = new GeoCount();
$is_qualify = $geoCountModel->where('project_id', $item['id'])->orderBy('id', 'desc')->value('is_qualify');
if($compliance_day > 0 && $is_qualify > 0){
$compliance_day = 1;
}
}
$remain_day = $deploy_build['service_duration'] - $compliance_day;
}
}else{
... ...
... ... @@ -42,11 +42,14 @@ class GeoWritingsTask extends Command
continue;
}
echo date("Y-m-d H:i:s").',执行的任务id'.$task_id.PHP_EOL;
$info = $geoWritingsTaskModel->read(['id'=>$task_id]);
$info = $geoWritingsTaskModel->read(['id'=>$task_id,'status'=>1]);
if($info === false){
echo date("Y-m-d H:i:s").',任务id数据不存在:'.$task_id.PHP_EOL;
echo date("Y-m-d H:i:s").',任务id数据不存在/或已被执行:'.$task_id.PHP_EOL;
continue;
}
//修改状态为生成中
$geoWritingsModel = new GeoWritings();
$geoWritingsModel->edit(['status'=>$geoWritingsModel::STATUS_AI_RUNNING],['id'=>$info['writings_id']]);
//生成引言
$aiCommand1 = "请根据这个文章标题:{$info['title']},并同时参考公司的介绍’{$info['description']}‘以及公司参与的事件内容’{$info['event_content']}‘,给我写一个英文Press Release前言内容,前言内容请参考并引用{$info['keyword']}行业的一些专业数据报告,只需要1个段落,大约150-200字,请一定要出现这个关键词“{$info['prefix']}{$info['keyword']}{$info['suffix']}”,所有内容一定要用英文, 只需要回复我引言内容,不需要别的内容(比如序号、你的提示、寒暄、解释、注释之类的)";
$gptHelper = new Gpt();
... ... @@ -57,21 +60,17 @@ class GeoWritingsTask extends Command
$images = explode(',',$info['img']);
//组装一条数据
try {
$geoWritingsModel = new GeoWritings();
$saveData = [
'project_id'=>$info['project_id'],
'type'=>$geoWritingsModel::TYPE_AI_CREATE,
'title'=>$info['title'],
'content'=>$introduction.($images[0] ?? '').PHP_EOL.$main.($images[1] ?? ''),
'content_length'=>strlen($introduction.PHP_EOL.$main),
'uniqid'=>md5(uniqid().$task_id.$info['project_id']),
'status'=>$geoWritingsModel::STATUS_INIT
];
$id = $geoWritingsModel->addReturnId($saveData);
$geoWritingsModel->edit($saveData,['id'=>$info['writings_id']]);
$data = [
'introduction'=>$introduction,
'main'=>$main,
'status'=>2,
'writings_id'=>$id,
];
$geoWritingsTaskModel->edit($data,['id'=>$task_id]);
}catch (\Exception $e){
... ... @@ -88,20 +87,34 @@ class GeoWritingsTask extends Command
* @method :post
* @time :2025/10/27 14:22
*/
public function getTaskId(){
public function getTaskId()
{
$task_id = Redis::rpop('geo_writings_task');
$geoWritingsTaskModel = new GeoWritingsTaskModel();
// 如果队列空了,尝试补充
if (empty($task_id)) {
$ids = $geoWritingsTaskModel->formatQuery(['status'=>0])->limit(100)->pluck('id');
if(!empty($ids)){
$lock_key = 'geo_writings_task_lock';
$lock_ttl = 10; // 锁过期时间10秒,防止死锁
$lock = Redis::set($lock_key, 1, 'EX', $lock_ttl, 'NX');
if ($lock) {
try {
$geoWritingsTaskModel = new GeoWritingsTaskModel();
$ids = $geoWritingsTaskModel->formatQuery(['status' => 0])->limit(100)->pluck('id');
if (!$ids->isEmpty()) {
// 标记这批任务为“生成中”
$geoWritingsTaskModel->edit(['status' => 1], ['id' => ['in', $ids]]);
foreach ($ids as $id) {
Redis::lpush('geo_writings_task', $id);
}
}
} finally {
// 释放锁
Redis::del($lock_key);
}
// 再次从队列中取任务
$task_id = Redis::rpop('geo_writings_task');
}
}else{
$geoWritingsTaskModel->edit(['status'=>1],['id'=>$task_id]);
}
return $task_id;
}
}
... ...
... ... @@ -116,7 +116,7 @@ class SyncProject extends Command
}
$item->status = NoticeLog::STATUS_SUCCESS;
$item->save();
echo 'success:' . $item['id'] . '执行时间:' . date('Y-m-d H:i:s') . PHP_EOL;
echo 'success:' . $item['id'] . '执行时间:'. 'ordet_id:'. $order_id . date('Y-m-d H:i:s') . PHP_EOL;
}catch (\Exception $e){
echo 'error:' . $item['id'] . $e->getMessage() .' line ' . $e->getLine() . '执行时间:' . PHP_EOL;
errorLog('项目同步失败', $item, $e);
... ...
... ... @@ -38,12 +38,11 @@ class SyncFile extends Command
}else{
$code = $this->synchronizationFile($v['path']);
}
echo date('Y-m-d H:i:s') . 'code:'. $code . PHP_EOL;
if((int)$code == 200){
echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
$errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
}
// echo date('Y-m-d H:i:s') . 'code:'. $code . PHP_EOL;
// if((int)$code == 200){
// echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
// $errorFileModel->edit(['status'=>1],['id'=>$v['id']]);
// }
}
echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL;
return true;
... ... @@ -60,7 +59,7 @@ class SyncFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ... @@ -69,7 +68,7 @@ class SyncFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.s3')['cdn'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
}
... ...
... ... @@ -40,9 +40,9 @@ class SyncProjectFile extends Command
}else{
$code = $this->synchronizationFile($v['path']);
}
if((int)$code == 200){
// if((int)$code == 200){
echo date('Y-m-d H:i:s') . '编辑的path为:'. $v['path'] .',主键id:'. $v['id'] . PHP_EOL;
}
// }
}
echo date('Y-m-d H:i:s') . '编辑的end为:' . PHP_EOL;
return true;
... ... @@ -59,7 +59,7 @@ class SyncProjectFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ... @@ -68,7 +68,7 @@ class SyncProjectFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.s3')['cdn'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
}
... ...
... ... @@ -33,18 +33,13 @@ class SyncTimeFiles extends Command
{
// $fileModel = new File();
$imagesModel = new Image();
$start = '2025-08-28 00:00:00';
$end = '2025-08-29 23:59:59';
$lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]]);
$start = '2025-10-13 17:20:00';
$end = '2025-10-31 23:59:59';
$lists = $imagesModel->list(['created_at'=>['between',[$start,$end]]],'id',['path'],'asc');
foreach ($lists as $v){
$path = $v['path'];
echo date('Y-m-d H:i:s') . ' | 图片链接:' . $path . PHP_EOL;
$code = $this->synchronizationFile($path);
if(200 != (int)$code){
echo date('Y-m-d H:i:s') . ' | 错误状态:' . $code . PHP_EOL;
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
}
echo date('Y-m-d H:i:s') . ' | ok:' . $code . PHP_EOL;
}
return true;
... ... @@ -52,9 +47,7 @@ class SyncTimeFiles extends Command
public function synchronizationFile($path_name){
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ...
... ... @@ -52,11 +52,6 @@ class SyncTimeMinuteFile extends Command
// continue;
// }
$code = $this->synchronizationFile($path);
if(200 != (int)$code){
echo date('Y-m-d H:i:s') . ' | 错误状态:' . $code . PHP_EOL;
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
}
echo date('Y-m-d H:i:s') . ' | ok:' . $code . PHP_EOL;
}
return true;
... ... @@ -66,7 +61,7 @@ class SyncTimeMinuteFile extends Command
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ...
... ... @@ -32,11 +32,6 @@ class SyncVideo extends Command
$path = $this->argument('path');
$code = $this->synchronizationFile($path);
echo date('Y-m-d H:i:s') . ' | ' . $code . PHP_EOL;
if(200 != (int)$code){
echo date('Y-m-d H:i:s') . ' | ' . $code . PHP_EOL;
$errorFileModel = new ErrorFile();
$errorFileModel->add(['path'=>$this->param['path'].'/'.$this->param['name']]);
}
return true;
}
... ... @@ -44,7 +39,7 @@ class SyncVideo extends Command
//同步到大文件
$file_path = config('filesystems.disks.cos')['cdn1'].$path_name;
$directoryPath = pathinfo($path_name, PATHINFO_DIRNAME);
$cmd = 'curl -k -F "file_path='.$file_path.'" -F "save_path=/www/wwwroot/cos'.$directoryPath.'" https://v6-file.globalso.com/upload.php';
$cmd = 'curl -k -F "file_path='.$path_name.'" -F "save_path=/www/wwwroot/cos'.$path_name.'" https://v6-file.globalso.com/upload.php';
return shell_exec($cmd);
}
... ...
<?php
/**
* @remark :
* @name :ManageEntryPositionController.php
* @author :lyh
* @method :post
* @time :2025/11/3 17:13
*/
namespace App\Http\Controllers\Aside\Manage;
use App\Enums\Common\Code;
use App\Http\Controllers\Aside\BaseController;
use App\Http\Logic\Aside\Manage\ManageEntryPositionLogic;
use Illuminate\Http\Request;
/**
* @remark :岗位管理
* @name :ManageEntryPositionController
* @author :lyh
* @method :post
* @time :2025/11/3 17:13
*/
class ManageEntryPositionController extends BaseController
{
/**
* @param Request $request
*/
public function __construct(Request $request)
{
parent::__construct($request);
$this->logic = new ManageEntryPositionLogic();
}
/**
* @remark :列表数据
* @name :lists
* @author :lyh
* @method :post
* @time :2025/11/3 17:20
*/
public function lists()
{
$data = $this->logic->listEntryPosition();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :保存数据
* @name :save
* @author :lyh
* @method :post
* @time :2025/11/3 17:20
*/
public function save()
{
$this->request->validate([
'name'=>'required'
],[
'name.required' => 'name不能为空'
]);
$data = $this->logic->saveEntryPosition();
$this->response('success',Code::SUCCESS,$data);
}
/**
* @remark :删除数据
* @name :del
* @author :lyh
* @method :post
* @time :2025/11/3 17:20
*/
public function del()
{
$this->request->validate([
'id'=>'required|array'
],[
'id.required' => 'ID不能为空'
]);
$data = $this->logic->delEntryPosition();
$this->response('success',Code::SUCCESS,$data);
}
}
... ...
... ... @@ -16,6 +16,7 @@ use App\Models\Geo\GeoLink;
use App\Models\Geo\GeoQuestion;
use App\Models\Geo\GeoWritings;
use App\Models\Manage\ManageHr;
use App\Models\Project\DeployBuild;
use App\Models\Project\KeywordPrefix;
use App\Models\Project\Project;
... ... @@ -48,15 +49,19 @@ class GeoLogic extends BaseLogic
$project_geo_conf = $projectModel->read(['id' => $project_id],['title', 'version', 'geo_status', 'geo_qualify_num']);
$geoConfModel = new GeoConf();
$geo_conf = $geoConfModel->read(['project_id' => $project_id]);
$deployModel = new DeployBuild();
$seo_plan = $deployModel->getValue(['project_id'=>$project_id],'seo_plan');
$seo_plan_name = ($projectModel::seoMap()[$seo_plan]) ?? '无选择';
$geo_conf['seo_plan_name'] = $seo_plan_name;
if($geo_conf === false){//数据未初始化
$geo_conf = [
'project_id' => $project_id, 'manager_id'=>0, 'company'=>$project_geo_conf['title'], 'brand'=>'', 'description'=>''
'project_id' => $project_id, 'manager_id'=>0, 'company'=>$project_geo_conf['title'], 'brand'=>'', 'description'=>'','seo_plan_name'=>$seo_plan_name
];
}
//负责人集合
$geo_manage_list = $geoConfModel->geoManage();
// geo配置管理员,已经移除管理员列表,补充管理员信息
if ($geo_conf && $geo_conf['manager_id'] && empty($geo_manage_list[$geo_conf['manager_id']])) {
if ($geo_conf && isset($geo_conf['manager_id']) && empty($geo_manage_list[$geo_conf['manager_id']])) {
$manage = ManageHr::where(['id' => $geo_conf['manager_id']])->pluck('name', 'id')->toArray();
$geo_manage_list = array_merge($geo_manage_list, $manage);
}
... ...
... ... @@ -49,6 +49,11 @@ class GeoWritingsTaskLogic extends BaseLogic
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
//自动保存一条数据
$writingModel = new GeoWritings();
$this->param['writings_id'] = $writingModel->addReturnId(['project_id'=>$this->param['project_id'],
'type'=>$writingModel::TYPE_AI_CREATE,'status'=>$writingModel::STATUS_AI_WAIT,
'uniqid'=>md5(uniqid().rand(1, 99999).$this->param['project_id'])]);
$id = $this->model->addReturnId($this->param);
}
}catch (\Exception $e){
... ...
<?php
/**
* @remark :
* @name :ManageEntryPositionLogic.php
* @author :lyh
* @method :post
* @time :2025/11/3 17:14
*/
namespace App\Http\Logic\Aside\Manage;
use App\Http\Logic\Aside\BaseLogic;
use App\Models\Manage\EntryPosition;
class ManageEntryPositionLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->param = $this->requestAll;
$this->model = new EntryPosition();
}
/**
* @remark :列表数据
* @name :listEntryPosition
* @author :lyh
* @method :post
* @time :2025/11/3 17:27
*/
public function listEntryPosition($map = [],$page = 1, $row = 10,$order = 'id')
{
$data = $this->model->lists($map,$page,$row,$order);
return $this->success($data);
}
/**
* @remark :保存数据
* @name :saveEntryPosition
* @author :lyh
* @method :post
* @time :2025/11/3 17:28
*/
public function saveEntryPosition()
{
try {
if(isset($this->param['id']) && !empty($this->param['id'])){
$id = $this->param['id'];
$this->model->edit($this->param,['id'=>$id]);
}else{
$id = $this->model->addReturnId($this->param);
}
}catch (\Exception $e){
$this->fail('保存失败,请联系管理员'.$e->getMessage());
}
return $this->success(['id'=>$id]);
}
/**
* @remark :删除数据
* @name :delEntryPosition
* @author :lyh
* @method :post
* @time :2025/11/3 17:28
*/
public function delEntryPosition()
{
$this->model->del(['id'=>['in',$this->param['id']]]);
return $this->success();
}
}
... ...
... ... @@ -528,22 +528,23 @@ class InquiryForwardLogic extends BaseLogic
{
$data = Cache::get('inquiry_manage_count');
if (!$data) {
$manage_ids = ForwardCount::select('manage_id')->orderBy('manage_id', 'asc')->distinct()->pluck('manage_id')->toArray();
$manageModel = new Manage();
//月统计
$last_year_month = date('Y-m', strtotime('-11 months'));
$month_manage_ids = ForwardCount::select('manage_id')->where('created_at', '>', $last_year_month . '-02')->where('count', '>', 0)->orderBy('manage_id', 'asc')->distinct()->pluck('manage_id')->toArray();
$data_month = [];
$data_month_total = [];
$now_month = date('Y-m');
$last_year_month = date('Y-m', strtotime('-11 months'));
while ($last_year_month <= $now_month) {
$month_arr = explode('-', $last_year_month);
$year = $month_arr[0];
$month = $month_arr[1];
foreach ($manage_ids as $mid) {
$name = $manageModel->getName($mid);
$month_count = intval(ForwardCount::where('manage_id', $mid)->where('year', $year)->where('month', $month)->sum('count') ?? 0);
foreach ($month_manage_ids as $month_mid) {
$name = $manageModel->getName($month_mid);
$month_count = intval(ForwardCount::where('manage_id', $month_mid)->where('year', $year)->where('month', $month)->sum('count') ?? 0);
$data_month_total[$name] = ($data_month_total[$name] ?? 0) + $month_count;
$data_month[$last_year_month][$name] = $month_count;
}
... ... @@ -554,19 +555,21 @@ class InquiryForwardLogic extends BaseLogic
//周统计
$last_week_day = date('Y-m-d', strtotime('-1 week'));
$week_manage_ids = ForwardCount::select('manage_id')->where('created_at', '>', $last_week_day . ' +1 day')->where('count', '>', 0)->orderBy('manage_id', 'asc')->distinct()->pluck('manage_id')->toArray();
$data_week = [];
$data_week_total = [];
$now_day = date('Y-m-d');
$last_week_day = date('Y-m-d', strtotime('-1 week'));
while ($last_week_day < $now_day) {
$day_arr = explode('-', $last_week_day);
$year = $day_arr[0];
$month = $day_arr[1];
$day = $day_arr[2];
foreach ($manage_ids as $mid) {
$name = $manageModel->getName($mid);
$day_count = ForwardCount::where('manage_id', $mid)->where('year', $year)->where('month', $month)->where('day', $day)->value('count') ?? 0;
foreach ($week_manage_ids as $week_mid) {
$name = $manageModel->getName($week_mid);
$day_count = ForwardCount::where('manage_id', $week_mid)->where('year', $year)->where('month', $month)->where('day', $day)->value('count') ?? 0;
$data_week_total[$name] = ($data_week_total[$name] ?? 0) + $day_count;
$data_week[substr($last_week_day, 5)][$name] = $day_count;
}
... ...
... ... @@ -170,6 +170,15 @@ class TicketUploadDataLogic extends BaseLogic
return $this->success($data);
}
public function setProductSort($mdoel){
$info = $mdoel->orderBy('sort','desc')->first();
if(empty($info)){
return 1;
}
$sort = $info['sort']+1;
return $sort;
}
/**
* @remark :保存数据详情
* @name :saveData
... ... @@ -196,6 +205,7 @@ class TicketUploadDataLogic extends BaseLogic
}
try {
$productModel = new Product();
$sort = $this->setProductSort($productModel);
$data = [
'project_id' => $info['project_id'],
'title' => $info['text']['title'],
... ... @@ -205,6 +215,7 @@ class TicketUploadDataLogic extends BaseLogic
'category_id'=>$category_id ?? '',
'keyword_id'=>$keyword_id ?? '',
'status'=>1,
'sort'=>$sort,
];
$id = $productModel->addReturnId($data);
CategoryRelated::saveRelated($id, $info['text']['category_id'] ?? []);//分类关联
... ... @@ -237,6 +248,8 @@ class TicketUploadDataLogic extends BaseLogic
if(isset($info['text']['image'])){
$info['text']['image'] = str_replace_url($info['text']['image'] ?? '');
}
$blogModel = new Blog();
$sort = $this->setProductSort($blogModel);
$data = [
'project_id' => $info['project_id'],
'name' => $info['text']['title'],
... ... @@ -245,9 +258,10 @@ class TicketUploadDataLogic extends BaseLogic
'remark'=>$info['text']['intro'] ?? '',
'category_id'=>$category_id ?? '',
'status'=>1,
'sort'=>$sort,
];
try {
$blogModel = new Blog();
$id = $blogModel->addReturnId($data);
$route = RouteMap::setRoute($data['name'],RouteMap::SOURCE_BLOG,$id,$info['project_id']);
$blogModel->edit(['url'=>$route],['id'=>$id]);
... ... @@ -272,6 +286,8 @@ class TicketUploadDataLogic extends BaseLogic
if(isset($info['text']['image'])){
$info['text']['image'] = str_replace_url($info['text']['image'] ?? '');
}
$newsModel = new News();
$sort = $this->setProductSort($newsModel);
$data = [
'project_id' => $info['project_id'],
'name' => $info['text']['title'],
... ... @@ -280,9 +296,10 @@ class TicketUploadDataLogic extends BaseLogic
'remark'=>$info['text']['intro'] ?? '',
'category_id'=>$category_id ?? '',
'status'=>1,
'sort'=>$sort,
];
try {
$newsModel = new News();
$id = $newsModel->addReturnId($data);
$route = RouteMap::setRoute($data['name'],RouteMap::SOURCE_NEWS,$id,$info['project_id']);
$newsModel->edit(['url'=>$route],['id'=>$id]);
... ...
... ... @@ -32,6 +32,9 @@ class SettingFaqLogic extends BaseLogic
public function getRouteList($map = [])
{
$routeModel = new RouteMap();
if(!empty($map['route'])){
$map['route'] = ['like','%'.$map['route'].'%'];
}
$list = $routeModel->list($map,'id',['*'],'desc',20);
return $this->success($list);
}
... ...
... ... @@ -5,7 +5,7 @@ namespace App\Models\Manage;
use App\Models\Base;
/**
* @remark :
* @remark :岗位管理
* @class :EntryPosition.php
* @author :lyh
* @time :2023/7/22 18:08
... ...
... ... @@ -679,7 +679,12 @@ Route::middleware(['aloginauth'])->group(function () {
Route::any('/save', [Aside\Ticket\TicketUploadDataController::class,'save'])->name('ticket_upload_save');
Route::any('/detail', [Aside\Ticket\TicketUploadDataController::class,'detail'])->name('ticket_upload_detail');
});
//岗位管理
Route::prefix('entry_position')->group(function () {
Route::any('/', [Aside\Manage\ManageEntryPositionController::class,'lists'])->name('entry_position_lists');
Route::any('/save', [Aside\Manage\ManageEntryPositionController::class,'save'])->name('entry_position_save');
Route::any('/del', [Aside\Manage\ManageEntryPositionController::class,'del'])->name('entry_position_del');
});
});
... ...