作者 刘锟

update

@@ -54,7 +54,7 @@ class Temp extends Command @@ -54,7 +54,7 @@ class Temp extends Command
54 */ 54 */
55 public function specialImport() 55 public function specialImport()
56 { 56 {
57 - $file_url = 'https://ecdn6.globalso.com/upload/p/3531/file/2025-07/www-cninfo-com-cn_news_v1-1.csv'; 57 + $file_url = 'https://ecdn6.globalso.com/upload/p/3531/file/2025-07/www-cninfo-com-cn_news_v1-2.csv';
58 $domain = 'static.cninfo.com.cn'; 58 $domain = 'static.cninfo.com.cn';
59 $project_id = 3531; 59 $project_id = 3531;
60 $is_gbk = 0; 60 $is_gbk = 0;
@@ -138,11 +138,19 @@ class Temp extends Command @@ -138,11 +138,19 @@ class Temp extends Command
138 protected function importModule($project_id, $domain, $data) 138 protected function importModule($project_id, $domain, $data)
139 { 139 {
140 $module_id = 4; 140 $module_id = 4;
141 - $category_id = 3;  
142 $model = new CustomModuleContent(); 141 $model = new CustomModuleContent();
143 $module = $model->read(['module_id' => $module_id, 'name' => $data[0]]); 142 $module = $model->read(['module_id' => $module_id, 'name' => $data[0]]);
144 if (!$module) { 143 if (!$module) {
145 144
  145 + $category_id = '';
  146 + if ($data[2] ?? '') {
  147 + if ($data['2'] == '最新公告') {
  148 + $category_id = ',3,4,';
  149 + } elseif ($data['2'] == '定期报告') {
  150 + $category_id = ',3,5,';
  151 + }
  152 + }
  153 +
146 $content = ''; 154 $content = '';
147 if ($data[4] ?? '') { 155 if ($data[4] ?? '') {
148 //处理内容中的pdf文件 156 //处理内容中的pdf文件
@@ -199,7 +207,7 @@ class Temp extends Command @@ -199,7 +207,7 @@ class Temp extends Command
199 $id = $model->addReturnId( 207 $id = $model->addReturnId(
200 [ 208 [
201 'name' => $data[0], 209 'name' => $data[0],
202 - 'category_id' => ',' . $category_id . ',', 210 + 'category_id' => $category_id,
203 'module_id' => $module_id, 211 'module_id' => $module_id,
204 'content' => $content, 212 'content' => $content,
205 'seo_title' => $seo_title, 213 'seo_title' => $seo_title,
@@ -218,9 +226,20 @@ class Temp extends Command @@ -218,9 +226,20 @@ class Temp extends Command
218 $model->edit(['route' => $route], ['id' => $id]); 226 $model->edit(['route' => $route], ['id' => $id]);
219 227
220 return true; 228 return true;
221 - } 229 + } else {
  230 + $category_id = '';
  231 + if ($data[2] ?? '') {
  232 + if ($data['2'] == '最新公告') {
  233 + $category_id = ',3,4,';
  234 + } elseif ($data['2'] == '定期报告') {
  235 + $category_id = ',3,5,';
  236 + }
  237 + }
222 238
223 - return false; 239 + $model->edit(['category_id' => $category_id], ['id' => $module['id']]);
  240 +
  241 + return false;
  242 + }
224 } 243 }
225 244
226 //特殊字符转换 245 //特殊字符转换