|
...
|
...
|
@@ -167,13 +167,25 @@ class UpdateSeoTdk extends Command |
|
|
|
$ai_commands = AiCommand::where('is_batch', 1)->select('key', 'scene', 'ai')->get()->toArray();
|
|
|
|
$ai_commands = Arr::setValueToKey($ai_commands, 'key');
|
|
|
|
foreach ($this->maps as $table => $map) {
|
|
|
|
$update[$table] = ['total_page'=>0, 'title'=>0, 'keyword'=>0, 'des'=>0,'keyword_title'=>0,'keyword_content'=>0];
|
|
|
|
$total_page = DB::connection('custom_mysql')->table($table)->count();
|
|
|
|
$update[$table] = ['total_page'=>$total_page, 'title'=>0, 'keyword'=>0, 'des'=>0,'keyword_title'=>0,'keyword_content'=>0];
|
|
|
|
echo date('Y-m-d H:i:s') . '更新--' . $table . ': 项目id' . $project_id . PHP_EOL;
|
|
|
|
$list = DB::connection('custom_mysql')->table($table)->select('id')->get();
|
|
|
|
$list = DB::connection('custom_mysql')->table($table)
|
|
|
|
->where(function ($query) use ($table, $map){
|
|
|
|
if($table == 'gl_product'){
|
|
|
|
foreach ($map as $field){
|
|
|
|
$field_arr = explode('.', $field);
|
|
|
|
$query->orWhereRaw('JSON_EXTRACT('.$field_arr[0].', "$.'.$field_arr[1].'") IS NULL OR JSON_EXTRACT('.$field_arr[0].', "$.'.$field_arr[1].'") = ""');
|
|
|
|
}
|
|
|
|
}else{
|
|
|
|
foreach ($map as $field){
|
|
|
|
$query->orWhereRaw($field . " IS NULL OR ".$field." = ''");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
})->select('id')->get();
|
|
|
|
if (!empty($list)) {
|
|
|
|
$list = $list->toArray();
|
|
|
|
foreach ($list as $v) {
|
|
|
|
$update[$table]['total_page']++;
|
|
|
|
$v = (array)$v;
|
|
|
|
|
|
|
|
//缓存 在处理的项目数据 id
|
...
|
...
|
|