作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -339,16 +339,16 @@ class GeoQuestionRes extends Command @@ -339,16 +339,16 @@ class GeoQuestionRes extends Command
339 $key = 'geo_task_list'; 339 $key = 'geo_task_list';
340 $task_id = Redis::rpop($key); 340 $task_id = Redis::rpop($key);
341 if(empty($task_id)){ 341 if(empty($task_id)){
342 - //todo::这里需要执行统计一次,统计当前项目当前日期的统计  
343 - # TODO 按照项目进行获取, 一个项目当天需要将所有跑完  
344 - $project_id = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN)->where('next_time', '<=', date('Y-m-d'))->value('project_id');  
345 - if (!empty($project_id)){  
346 - $this->project_id = $project_id;  
347 - $ids = GeoQuestion::where(['project_id' => $project_id, 'status' => GeoQuestion::STATUS_OPEN])->where('next_time', '<=', date('Y-m-d'))->pluck('id');  
348 - foreach ($ids as $id) {  
349 - Redis::lpush($key, $id); 342 + $project_ids = GeoQuestion::where('status', GeoQuestion::STATUS_OPEN)->where('next_time', '<=', date('Y-m-d'))
  343 + ->orderBy('next_time', 'asc')->pluck('project_id')->unique()->values()->toArray();
  344 + if(!empty($project_ids)){
  345 + foreach ($project_ids as $project_id){
  346 + $ids = GeoQuestion::where(['project_id' => $project_id, 'status' => GeoQuestion::STATUS_OPEN])->where('next_time', '<=', date('Y-m-d'))->pluck('id');
  347 + foreach ($ids as $id) {
  348 + Redis::lpush($key, $id);
  349 + }
  350 + $task_id = Redis::rpop($key);
350 } 351 }
351 - $task_id = Redis::rpop($key);  
352 } 352 }
353 } 353 }
354 return $task_id; 354 return $task_id;
@@ -24,7 +24,7 @@ class AiBlogController extends BaseController @@ -24,7 +24,7 @@ class AiBlogController extends BaseController
24 if(isset($this->map['new_title']) && !empty($this->map['new_title'])){ 24 if(isset($this->map['new_title']) && !empty($this->map['new_title'])){
25 $this->map['new_title'] = ['like', '%'.$this->map['new_title'].'%']; 25 $this->map['new_title'] = ['like', '%'.$this->map['new_title'].'%'];
26 } 26 }
27 - $lists = $aiBlog->lists($this->map,$this->page,$this->row,'id',['id','keyword','new_title','route','image','task_id','status','created_at','updated_at']); 27 + $lists = $aiBlog->lists($this->map,$this->page,$this->row,'id',['id','keyword','new_title','route','image','task_id','status','uuid','created_at','updated_at']);
28 if(!empty($lists) && !empty($lists['list'])){ 28 if(!empty($lists) && !empty($lists['list'])){
29 foreach ($lists['list'] as $k => $v){ 29 foreach ($lists['list'] as $k => $v){
30 $v['image'] = getImageUrl($v['image']); 30 $v['image'] = getImageUrl($v['image']);
@@ -201,7 +201,7 @@ class TicketUploadDataLogic extends BaseLogic @@ -201,7 +201,7 @@ class TicketUploadDataLogic extends BaseLogic
201 'title' => $info['text']['title'], 201 'title' => $info['text']['title'],
202 'thumb'=>$thumb, 202 'thumb'=>$thumb,
203 'gallery'=>$info['text']['image'] ?? [], 203 'gallery'=>$info['text']['image'] ?? [],
204 - 'intro'=>$info['text']['remark'], 204 + 'intro'=>$info['text']['intro'] ?? '',
205 'category_id'=>$category_id ?? '', 205 'category_id'=>$category_id ?? '',
206 'keyword_id'=>$keyword_id ?? '', 206 'keyword_id'=>$keyword_id ?? '',
207 'status'=>1, 207 'status'=>1,
@@ -187,7 +187,9 @@ class AiBlogLogic extends BaseLogic @@ -187,7 +187,9 @@ class AiBlogLogic extends BaseLogic
187 } 187 }
188 if(isset($param['id']) && !empty($param['id'])){ 188 if(isset($param['id']) && !empty($param['id'])){
189 $id = $param['id']; 189 $id = $param['id'];
190 - $data['task_id'] = $param['task_id']; 190 + if(!empty($param['task_id'])){
  191 + $data['task_id'] = $param['task_id'];
  192 + }
191 if(!isset($param['seo_keyword']) || empty($param['seo_keyword'])){ 193 if(!isset($param['seo_keyword']) || empty($param['seo_keyword'])){
192 $ai = "contains keyword {$param['title']} recommend 8 purchaser search keywords, separated by commas"; 194 $ai = "contains keyword {$param['title']} recommend 8 purchaser search keywords, separated by commas";
193 $text = Gpt::instance()->openai_chat_qqs($ai); 195 $text = Gpt::instance()->openai_chat_qqs($ai);
@@ -222,7 +224,7 @@ class AiBlogLogic extends BaseLogic @@ -222,7 +224,7 @@ class AiBlogLogic extends BaseLogic
222 //todo::更新列表页 224 //todo::更新列表页
223 shell_exec("php artisan save_ai_blog_list {$this->user['project_id']} > /dev/null 2>&1 &"); 225 shell_exec("php artisan save_ai_blog_list {$this->user['project_id']} > /dev/null 2>&1 &");
224 }else{ 226 }else{
225 - $this->fail('发布失败,请编辑后重新发布'); 227 + $this->fail('文章已发布,文章无法同步到列表,请编辑后保存');
226 } 228 }
227 return $this->success(); 229 return $this->success();
228 } 230 }