作者 李宇航

合并分支 'master-lyh-edit' 到 'master'

修改关键字生成视频



查看合并请求 !574
@@ -87,7 +87,7 @@ class VideoTask extends Command @@ -87,7 +87,7 @@ class VideoTask extends Command
87 continue; 87 continue;
88 } 88 }
89 ProjectServer::useProject($task_project->project_id); 89 ProjectServer::useProject($task_project->project_id);
90 - $keyword = $this->getProjectKeyword($task_project->number); 90 + $keyword = $this->getProjectKeyword($task_project->num);
91 // 已经没有需要生成视频的关键词 91 // 已经没有需要生成视频的关键词
92 if (!$keyword) { 92 if (!$keyword) {
93 $task_project->status = KeywordVideoTask::STATUS_CLOSE; 93 $task_project->status = KeywordVideoTask::STATUS_CLOSE;
@@ -95,7 +95,13 @@ class VideoTask extends Command @@ -95,7 +95,13 @@ class VideoTask extends Command
95 continue; 95 continue;
96 } 96 }
97 $logo_bg = $this->getImage($domainInfo); 97 $logo_bg = $this->getImage($domainInfo);
  98 + $num = $task_project->num;
98 foreach ($keyword as $val) { 99 foreach ($keyword as $val) {
  100 + if($sub_task_num == 0){
  101 + $task_project->num = $num;
  102 + $task_project->save();
  103 + break;
  104 + }
99 $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first(); 105 $log = KeywordVideoTaskLog::where(['project_id' => $task_project->project_id, 'keyword_id' => $val->id])->first();
100 if ($log){ 106 if ($log){
101 continue; 107 continue;
@@ -114,11 +120,15 @@ class VideoTask extends Command @@ -114,11 +120,15 @@ class VideoTask extends Command
114 'created_at' => date('Y-m-d H:i:s'), 120 'created_at' => date('Y-m-d H:i:s'),
115 ]; 121 ];
116 KeywordVideoTaskLog::insert($array); 122 KeywordVideoTaskLog::insert($array);
  123 + $num--;
117 $sub_task_num--; 124 $sub_task_num--;
118 } 125 }
119 } 126 }
120 - $task_project->status = KeywordVideoTask::STATUS_CLOSE;  
121 - $task_project->save(); 127 + if($sub_task_num != 0){
  128 + $task_project->num = 0;
  129 + $task_project->status = KeywordVideoTask::STATUS_CLOSE;
  130 + $task_project->save();
  131 + }
122 } 132 }
123 return true; 133 return true;
124 } 134 }
@@ -108,7 +108,7 @@ class KeywordVideoController extends BaseController @@ -108,7 +108,7 @@ class KeywordVideoController extends BaseController
108 if($info === false){ 108 if($info === false){
109 $this->response('请先设置域名',Code::SYSTEM_ERROR); 109 $this->response('请先设置域名',Code::SYSTEM_ERROR);
110 } 110 }
111 - 111 + $this->param['num'] = $this->param['number'];
112 $rs = $keywordModel->add($this->param); 112 $rs = $keywordModel->add($this->param);
113 if($rs === false){ 113 if($rs === false){
114 $this->response('添加失败',Code::SYSTEM_ERROR); 114 $this->response('添加失败',Code::SYSTEM_ERROR);
@@ -130,6 +130,9 @@ class KeywordVideoController extends BaseController @@ -130,6 +130,9 @@ class KeywordVideoController extends BaseController
130 'id.required' => '主键标识不为空', 130 'id.required' => '主键标识不为空',
131 ]); 131 ]);
132 $keywordModel = new KeywordVideoTask(); 132 $keywordModel = new KeywordVideoTask();
  133 + if($this->param['status'] == 0){
  134 + $this->param['num'] = $this->param['number'];
  135 + }
133 $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]); 136 $rs = $keywordModel->edit($this->param,['id'=>$this->param['id']]);
134 if($rs === false){ 137 if($rs === false){
135 $this->response('编辑失败',Code::SYSTEM_ERROR); 138 $this->response('编辑失败',Code::SYSTEM_ERROR);