正在显示
1 个修改的文件
包含
1 行增加
和
51 行删除
| @@ -269,6 +269,7 @@ class ProjectUpdate extends Command | @@ -269,6 +269,7 @@ class ProjectUpdate extends Command | ||
| 269 | $new_category[] = $cate['id']; | 269 | $new_category[] = $cate['id']; |
| 270 | } | 270 | } |
| 271 | } | 271 | } |
| 272 | + | ||
| 272 | if ($type_arr) { | 273 | if ($type_arr) { |
| 273 | $product_type = ',' . implode(',', $type_arr); | 274 | $product_type = ',' . implode(',', $type_arr); |
| 274 | } | 275 | } |
| @@ -277,21 +278,6 @@ class ProjectUpdate extends Command | @@ -277,21 +278,6 @@ class ProjectUpdate extends Command | ||
| 277 | $category_arr = $category_model->list(['original_id' => ['in', $new_category]]); | 278 | $category_arr = $category_model->list(['original_id' => ['in', $new_category]]); |
| 278 | $category_id = $logic->getLastCategory(array_column($category_arr, 'id')); | 279 | $category_id = $logic->getLastCategory(array_column($category_arr, 'id')); |
| 279 | } | 280 | } |
| 280 | - | ||
| 281 | -// $category_arr = []; | ||
| 282 | -// $pid = 0; | ||
| 283 | -// for ($i = 0; $i < count($new_category); $i++) { | ||
| 284 | -// $return = $this->get_category_name_arr($new_category, $pid); | ||
| 285 | -// if ($return) { | ||
| 286 | -// $category_arr[] = $this->special2str($return['name'] ?? ''); | ||
| 287 | -// $pid = $return['id']; | ||
| 288 | -// } | ||
| 289 | -// } | ||
| 290 | -// | ||
| 291 | -// if ($category_arr) { | ||
| 292 | -// $categoryLogic = new CategoryLogic(); | ||
| 293 | -// $category_id = $categoryLogic->importProductCategory($project_id, implode('/', $category_arr)); | ||
| 294 | -// } | ||
| 295 | } | 281 | } |
| 296 | try { | 282 | try { |
| 297 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); | 283 | $item['ttile'] = $this->special2str($item['ttile'] ?? ''); |
| @@ -323,30 +309,6 @@ class ProjectUpdate extends Command | @@ -323,30 +309,6 @@ class ProjectUpdate extends Command | ||
| 323 | echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; | 309 | echo 'date:' . date('Y-m-d H:i:s') . ', task_id: ' . $task->id . ', error: ' . $e->getMessage() . PHP_EOL; |
| 324 | continue; | 310 | continue; |
| 325 | } | 311 | } |
| 326 | - } else { | ||
| 327 | - //分类 | ||
| 328 | - $category_id = ''; | ||
| 329 | - | ||
| 330 | - if ($item['category'] ?? []) { | ||
| 331 | - $type_arr = []; | ||
| 332 | - $new_category = []; | ||
| 333 | - foreach ($item['category'] as $cate) { | ||
| 334 | - if ($cate['parent'] == 0 && $cate['name'] == 'Featured Products') { | ||
| 335 | - $type_arr[] = 2; | ||
| 336 | - } elseif ($cate['parent'] == 0 && $cate['name'] == 'Hot Products') { | ||
| 337 | - $type_arr[] = 3; | ||
| 338 | - } else { | ||
| 339 | - $new_category[] = $cate['id']; | ||
| 340 | - } | ||
| 341 | - } | ||
| 342 | - | ||
| 343 | - if ($new_category) { | ||
| 344 | - $category_arr = $category_model->list(['original_id' => ['in', $new_category]]); | ||
| 345 | - $category_id = $logic->getLastCategory(array_column($category_arr, 'id')); | ||
| 346 | - } | ||
| 347 | - } | ||
| 348 | - | ||
| 349 | - $model->edit(['category_id' => $category_id], ['id' => $product['id']]); | ||
| 350 | } | 312 | } |
| 351 | } | 313 | } |
| 352 | } | 314 | } |
| @@ -559,18 +521,6 @@ class ProjectUpdate extends Command | @@ -559,18 +521,6 @@ class ProjectUpdate extends Command | ||
| 559 | } | 521 | } |
| 560 | } | 522 | } |
| 561 | 523 | ||
| 562 | - //获取分类名称数组 | ||
| 563 | - protected function get_category_name_arr($category, $pid = 0) | ||
| 564 | - { | ||
| 565 | - foreach ($category as $k => $v) { | ||
| 566 | - if ($v['parent'] == $pid) { | ||
| 567 | - return $v; | ||
| 568 | - } | ||
| 569 | - } | ||
| 570 | - | ||
| 571 | - return []; | ||
| 572 | - } | ||
| 573 | - | ||
| 574 | //特殊字符转换 | 524 | //特殊字符转换 |
| 575 | protected function special2str($str) | 525 | protected function special2str($str) |
| 576 | { | 526 | { |
-
请 注册 或 登录 后发表评论