作者 lyh

变更数据

@@ -35,6 +35,7 @@ class ShareUser extends Command @@ -35,6 +35,7 @@ class ShareUser extends Command
35 */ 35 */
36 public function handle() 36 public function handle()
37 { 37 {
  38 + $this->output('start');
38 echo $this->user_operator_record(); 39 echo $this->user_operator_record();
39 return true; 40 return true;
40 } 41 }
@@ -51,37 +52,36 @@ class ShareUser extends Command @@ -51,37 +52,36 @@ class ShareUser extends Command
51 $ayr_release = new AyrReleaseModel(); 52 $ayr_release = new AyrReleaseModel();
52 $ayr_share_list = $ayr_share_model->list(['profile_key'=>['!=','']]); 53 $ayr_share_list = $ayr_share_model->list(['profile_key'=>['!=','']]);
53 foreach ($ayr_share_list as $v){ 54 foreach ($ayr_share_list as $v){
54 - echo date('Y-m-d H:i:s').'执行数据的邮箱--'.$v['title'].PHP_EOL; 55 + $this->output('执行数据的邮箱--'.$v['title']);
55 $time = Carbon::now()->modify('-1 days')->toDateString(); 56 $time = Carbon::now()->modify('-1 days')->toDateString();
56 //创建时间小于7天前的当前时间 57 //创建时间小于7天前的当前时间
57 if($v['created_at'] > $time){ 58 if($v['created_at'] > $time){
58 - echo '创建时间小于7天跳过。'.date('Y-m-d H:i:s').PHP_EOL; 59 + $this->output('创建时间小于7天跳过--'.$v['title']);
59 continue; 60 continue;
60 } 61 }
61 //查询当前用户是否有未推送的博文 62 //查询当前用户是否有未推送的博文
62 $release_info = $this->release_info($ayr_release,$v); 63 $release_info = $this->release_info($ayr_release,$v);
63 //有推文时,直接跳出循环 64 //有推文时,直接跳出循环
64 if($release_info !== false){ 65 if($release_info !== false){
65 - echo '有推文直接跳过。'.date('Y-m-d H:i:s').PHP_EOL; 66 + $this->output('有未推送的推文直接跳过--'.$v['title']);
66 continue; 67 continue;
67 } 68 }
68 //查询7天是否发送博文 69 //查询7天是否发送博文
69 $release_info = $this->release_seven_info($ayr_release,$v); 70 $release_info = $this->release_seven_info($ayr_release,$v);
70 //有发送博文,则跳出循环 71 //有发送博文,则跳出循环
71 if($release_info !== false){ 72 if($release_info !== false){
72 - echo '7天内有推文跳过。'.date('Y-m-d H:i:s').PHP_EOL; 73 + $this->output('7天内有推文跳过--'.$v['title']);
73 continue; 74 continue;
74 } 75 }
75 $aiVideoInfo = $this->aiVideoInfo($v['project_id'] ?? 0); 76 $aiVideoInfo = $this->aiVideoInfo($v['project_id'] ?? 0);
76 if($aiVideoInfo !== false){ 77 if($aiVideoInfo !== false){
77 - echo '7天内有ai视频推送跳过。'.date('Y-m-d H:i:s').PHP_EOL; 78 + $this->output('7天内有ai视频推送跳过--'.$v['title']);
78 continue; 79 continue;
79 } 80 }
80 //删除用户第三方配置 81 //删除用户第三方配置
81 if(!empty($v['profile_key'])){ 82 if(!empty($v['profile_key'])){
82 $res = $this->del_profiles($v); 83 $res = $this->del_profiles($v);
83 if($res === false){ 84 if($res === false){
84 - //删除失败-跳过  
85 continue; 85 continue;
86 } 86 }
87 } 87 }
@@ -179,4 +179,17 @@ class ShareUser extends Command @@ -179,4 +179,17 @@ class ShareUser extends Command
179 $videoInfo = $aiVideoModel->read(['project_id'=>$project_id,'next_auto_date'=>null,'created_at'=>['between',[$start_at,$end_at]]]); 179 $videoInfo = $aiVideoModel->read(['project_id'=>$project_id,'next_auto_date'=>null,'created_at'=>['between',[$start_at,$end_at]]]);
180 return $videoInfo; 180 return $videoInfo;
181 } 181 }
  182 +
  183 + /**
  184 + * 输入日志
  185 + * @param $message
  186 + * @return bool
  187 + */
  188 + public function output($message)
  189 + {
  190 + $message = date('Y-m-d H:i:s') . ' ' . $message . PHP_EOL;
  191 + echo $message;
  192 + file_put_contents(storage_path('logs/share_user/') . date('Ymd') . '.log', $message, FILE_APPEND);
  193 + return true;
  194 + }
182 } 195 }