作者 lyh

gx

@@ -10,25 +10,38 @@ @@ -10,25 +10,38 @@
10 namespace App\Http\Controllers\Bside; 10 namespace App\Http\Controllers\Bside;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
  13 +use App\Models\CustomModule\CustomModuleContent;
  14 +use App\Models\RouteMap\RouteMap;
  15 +use App\Services\ProjectServer;
  16 +use Illuminate\Support\Facades\DB;
13 17
14 class TestController extends BaseController 18 class TestController extends BaseController
15 { 19 {
16 public function ceshi(){ 20 public function ceshi(){
  21 + ProjectServer::useProject(2209);
17 $title_str = $this->datas(); 22 $title_str = $this->datas();
18 $title_array = preg_split("/\r\n|\n|\r/", $title_str); 23 $title_array = preg_split("/\r\n|\n|\r/", $title_str);
19 $title_count = count($title_array); 24 $title_count = count($title_array);
20 $des_str = $this->data2(); 25 $des_str = $this->data2();
21 $des_array = preg_split("/\r\n|\n|\r/", $des_str); 26 $des_array = preg_split("/\r\n|\n|\r/", $des_str);
22 - $des_count = count($des_array);  
23 $brand_str = $this->data3(); 27 $brand_str = $this->data3();
24 $brand_array = preg_split("/\r\n|\n|\r/", $brand_str); 28 $brand_array = preg_split("/\r\n|\n|\r/", $brand_str);
25 - $brand_count = count($brand_array);  
26 - $count = [  
27 - 'title_count'=>$title_count,  
28 - 'des_count'=>$des_count,  
29 - 'brand_count'=>$brand_count 29 + for ($i = 0;$i < $title_count;$i++){
  30 + $data = [
  31 + 'module_id' => 7,
  32 + 'name'=>$title_array[$i],
  33 + 'remark'=>$brand_array[$i],
  34 + 'content'=>$des_array[$i],
  35 + 'route'=>$title_array[$i],
30 ]; 36 ];
31 - $this->response('success',Code::SUCCESS,$count); 37 + $customModel = new CustomModuleContent();
  38 + $id = $customModel->addReturnId($data);
  39 + $route = RouteMap::setRoute($title_array[$i], RouteMap::SOURCE_MODULE,
  40 + $id, 2209);
  41 + $customModel->edit(['route'=>$route],['id'=>$id]);
  42 + }
  43 + DB::disconnect('custom_mysql');
  44 + $this->response('success');
32 } 45 }
33 public function datas(){ 46 public function datas(){
34 return 'Cat. NO.кот. Нет. 47 return 'Cat. NO.кот. Нет.
@@ -1816,8 +1829,7 @@ TA12S05-2546WT'; @@ -1816,8 +1829,7 @@ TA12S05-2546WT';
1816 } 1829 }
1817 1830
1818 public function data2(){ 1831 public function data2(){
1819 - return 'Description  
1820 -EXCEL 5 AQ 250 X 4.6MM 1832 + return 'EXCEL 5 AQ 250 X 4.6MM
1821 HPLC COLUMN ACE EXCEL C18 150 * 4.6 MM, 3 µM 1833 HPLC COLUMN ACE EXCEL C18 150 * 4.6 MM, 3 µM
1822 UMC-5 CLIP, MTG, UNIV. 2-2 1/2INCH OD 1834 UMC-5 CLIP, MTG, UNIV. 2-2 1/2INCH OD
1823 UMC-4 CLIP, MTG, UNIV. 1 5/8-1 7/8IN OD 1835 UMC-4 CLIP, MTG, UNIV. 1 5/8-1 7/8IN OD