|
...
|
...
|
@@ -2,10 +2,14 @@ |
|
|
|
|
|
|
|
namespace App\Console\Commands\AyrShare;
|
|
|
|
use App\Helper\AyrShare as AyrShareHelper;
|
|
|
|
use App\Models\Ai\AiVideo;
|
|
|
|
use App\Models\AyrShare\AyrRelease as AyrReleaseModel;
|
|
|
|
use App\Models\Project\AiVideoTask;
|
|
|
|
use App\Services\ProjectServer;
|
|
|
|
use Carbon\Carbon;
|
|
|
|
use App\Models\AyrShare\AyrShare as AyrShareModel;
|
|
|
|
use Illuminate\Console\Command;
|
|
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
|
|
|
class ShareUser extends Command
|
|
|
|
{
|
|
...
|
...
|
@@ -32,6 +36,7 @@ class ShareUser extends Command |
|
|
|
public function handle()
|
|
|
|
{
|
|
|
|
echo $this->user_operator_record();
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
...
|
...
|
@@ -46,6 +51,7 @@ class ShareUser extends Command |
|
|
|
$ayr_release = new AyrReleaseModel();
|
|
|
|
$ayr_share_list = $ayr_share_model->list(['profile_key'=>['!=','']]);
|
|
|
|
foreach ($ayr_share_list as $v){
|
|
|
|
echo date('Y-m-d H:i:s').'执行数据的邮箱--'.$v['title'].PHP_EOL;
|
|
|
|
$time = Carbon::now()->modify('-1 days')->toDateString();
|
|
|
|
//创建时间小于7天前的当前时间
|
|
|
|
if($v['created_at'] > $time){
|
|
...
|
...
|
@@ -60,15 +66,24 @@ class ShareUser extends Command |
|
|
|
continue;
|
|
|
|
}
|
|
|
|
//查询7天是否发送博文
|
|
|
|
$release_info = $this->release_seven_info($ayr_release);
|
|
|
|
$release_info = $this->release_seven_info($ayr_release,$v);
|
|
|
|
//有发送博文,则跳出循环
|
|
|
|
if($release_info !== false){
|
|
|
|
echo '7天内有推文跳过。'.date('Y-m-d H:i:s').PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
$aiVideoInfo = $this->aiVideoInfo($v['project_id'] ?? 0);
|
|
|
|
if($aiVideoInfo !== false){
|
|
|
|
echo '7天内有ai视频推送跳过。'.date('Y-m-d H:i:s').PHP_EOL;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
//删除用户第三方配置
|
|
|
|
if(!empty($v['profile_key'])){
|
|
|
|
$this->del_profiles($v);
|
|
|
|
$res = $this->del_profiles($v);
|
|
|
|
if($res === false){
|
|
|
|
//删除失败-跳过
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//更新数据库
|
|
|
|
$this->save_ayr_share($ayr_share_model,$v);
|
|
...
|
...
|
@@ -90,8 +105,8 @@ class ShareUser extends Command |
|
|
|
];
|
|
|
|
$res = $ayr_share_helper->deleted_profiles($data_profiles);
|
|
|
|
if($res['status'] == 'fail'){
|
|
|
|
echo '第三方删除失败';
|
|
|
|
return true;
|
|
|
|
echo '第三方删除失败'.json_encode($data_profiles,true);
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
...
|
...
|
@@ -138,11 +153,30 @@ class ShareUser extends Command |
|
|
|
* @method :post
|
|
|
|
* @time :2023/6/14 16:28
|
|
|
|
*/
|
|
|
|
public function release_seven_info(&$ayr_release){
|
|
|
|
public function release_seven_info(&$ayr_release,$v){
|
|
|
|
//查看用户是否在一周内有发送博客
|
|
|
|
$start_at = Carbon::now()->modify('-7 days')->toDateString();
|
|
|
|
$end_at = Carbon::now()->toDateString();
|
|
|
|
$release_info = $ayr_release->read(['created_at'=>['between',[$start_at,$end_at]]]);
|
|
|
|
$release_info = $ayr_release->read(['created_at'=>['between',[$start_at,$end_at]],'share_id'=>$v['id']]);
|
|
|
|
return $release_info;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @remark :7天内是否推送了ai视频
|
|
|
|
* @name :aiVidoe
|
|
|
|
* @author :lyh
|
|
|
|
* @method :post
|
|
|
|
* @time :2025/9/22 17:13
|
|
|
|
*/
|
|
|
|
public function aiVideoInfo($project_id)
|
|
|
|
{
|
|
|
|
if($project_id == 0){
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
$start_at = Carbon::now()->modify('-7 days')->toDateString();
|
|
|
|
$end_at = Carbon::now()->toDateString();
|
|
|
|
$aiVideoModel = new AiVideoTask();
|
|
|
|
$videoInfo = $aiVideoModel->read(['project_id'=>$project_id,'next_auto_date'=>null,'created_at'=>['between',[$start_at,$end_at]]]);
|
|
|
|
return $videoInfo;
|
|
|
|
}
|
|
|
|
} |
...
|
...
|
|