作者 刘锟

Merge remote-tracking branch 'origin/master' into akun

@@ -9,14 +9,13 @@ @@ -9,14 +9,13 @@
9 9
10 namespace App\Console\Commands\Suppliers; 10 namespace App\Console\Commands\Suppliers;
11 11
12 -use App\Models\Com\Purchaser;  
13 use App\Models\Product\Keyword; 12 use App\Models\Product\Keyword;
14 use App\Models\Project\DeployBuild; 13 use App\Models\Project\DeployBuild;
15 -use App\Models\Project\Project; 14 +use App\Models\Purchaser\Purchaser;
  15 +use App\Models\Purchaser\PurchaserInfo;
16 use App\Services\ProjectServer; 16 use App\Services\ProjectServer;
17 use Illuminate\Console\Command; 17 use Illuminate\Console\Command;
18 use Illuminate\Support\Facades\DB; 18 use Illuminate\Support\Facades\DB;
19 -use Illuminate\Support\Facades\Log;  
20 19
21 class RecommendedSuppliers extends Command 20 class RecommendedSuppliers extends Command
22 { 21 {
@@ -98,7 +97,8 @@ class RecommendedSuppliers extends Command @@ -98,7 +97,8 @@ class RecommendedSuppliers extends Command
98 ]; 97 ];
99 $res = http_post($url,json_encode($param)); 98 $res = http_post($url,json_encode($param));
100 echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL; 99 echo date('Y-m-d H:i:s') . json_encode($res) . PHP_EOL;
101 - if(!empty($res) && $res['code'] == 200){ 100 + if(!empty($res) && $res['code'] == 200 && !empty($res['data'])){
  101 + //保存多条数据
102 $saveData = [ 102 $saveData = [
103 'project_id'=>$project_id, 103 'project_id'=>$project_id,
104 'keyword'=>$keyword, 104 'keyword'=>$keyword,
@@ -106,7 +106,31 @@ class RecommendedSuppliers extends Command @@ -106,7 +106,31 @@ class RecommendedSuppliers extends Command
106 ]; 106 ];
107 $purchaserModel = new Purchaser(); 107 $purchaserModel = new Purchaser();
108 $purchaserModel->add($saveData); 108 $purchaserModel->add($saveData);
  109 + $this->savePurchaserInfo($project_id,$keyword,$res['data']);
109 } 110 }
110 return true; 111 return true;
111 } 112 }
  113 +
  114 + /**
  115 + * @remark :保存供应商详情
  116 + * @name :savePurchaserInfo
  117 + * @author :lyh
  118 + * @method :post
  119 + * @time :2024/5/29 16:38
  120 + */
  121 + public function savePurchaserInfo($project_id,$keyword,$data){
  122 + $param = [];
  123 + foreach ($data as $k =>$v){
  124 + $v['project_id'] = $project_id;
  125 + $v['keyword'] = $keyword;
  126 + $v['email'] = json_encode($v['email'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  127 + $v['mobile'] = json_encode($v['mobile'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  128 + $v['social_media'] = json_encode($v['social_media'],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
  129 + $v['created_at'] = date('Y-m-d H:i:s');
  130 + $v['updated_at'] = $v['created_at'];
  131 + $param[] = $v;
  132 + }
  133 + $purchaserInfoModel = new PurchaserInfo();
  134 + return $purchaserInfoModel->insert($param);
  135 + }
112 } 136 }
@@ -54,7 +54,7 @@ class UpdateRoute extends Command @@ -54,7 +54,7 @@ class UpdateRoute extends Command
54 */ 54 */
55 public function handle(){ 55 public function handle(){
56 $projectModel = new Project(); 56 $projectModel = new Project();
57 - $list = $projectModel->list(['id'=>917]); 57 + $list = $projectModel->list(['id'=>['in',[358,951]]]);
58 $data = []; 58 $data = [];
59 foreach ($list as $v){ 59 foreach ($list as $v){
60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL; 60 echo date('Y-m-d H:i:s') . 'project_id:'.$v['id'] . PHP_EOL;
@@ -6,10 +6,7 @@ use App\Enums\Common\Code; @@ -6,10 +6,7 @@ use App\Enums\Common\Code;
6 use App\Helper\Arr; 6 use App\Helper\Arr;
7 use App\Helper\Common; 7 use App\Helper\Common;
8 use App\Http\Controllers\Bside\BaseController; 8 use App\Http\Controllers\Bside\BaseController;
9 -use App\Http\Logic\Aside\Project\ProjectLogic;  
10 -use App\Http\Logic\Bside\User\UserLogic;  
11 use App\Jobs\PurchaserJob; 9 use App\Jobs\PurchaserJob;
12 -use App\Models\Com\Purchaser;  
13 use App\Models\CustomModule\CustomModule; 10 use App\Models\CustomModule\CustomModule;
14 use App\Models\Project\DeployBuild; 11 use App\Models\Project\DeployBuild;
15 use App\Models\Project\Project; 12 use App\Models\Project\Project;
@@ -18,7 +15,6 @@ use App\Models\User\ProjectMenu as ProjectMenuModel; @@ -18,7 +15,6 @@ use App\Models\User\ProjectMenu as ProjectMenuModel;
18 use App\Models\User\ProjectRole as ProjectRoleModel; 15 use App\Models\User\ProjectRole as ProjectRoleModel;
19 use App\Models\User\User; 16 use App\Models\User\User;
20 use Illuminate\Support\Facades\Cache; 17 use Illuminate\Support\Facades\Cache;
21 -use Illuminate\Support\Facades\Hash;  
22 18
23 /*** 19 /***
24 * 当前为公共类 20 * 当前为公共类
@@ -11,7 +11,7 @@ namespace App\Http\Controllers\Bside\Suppliers; @@ -11,7 +11,7 @@ namespace App\Http\Controllers\Bside\Suppliers;
11 11
12 use App\Enums\Common\Code; 12 use App\Enums\Common\Code;
13 use App\Http\Controllers\Bside\BaseController; 13 use App\Http\Controllers\Bside\BaseController;
14 -use App\Models\Com\Purchaser; 14 +use App\Models\Purchaser\Purchaser;
15 15
16 /** 16 /**
17 * @remark :推荐采购商 17 * @remark :推荐采购商
@@ -38,11 +38,13 @@ class SuppliersController extends BaseController @@ -38,11 +38,13 @@ class SuppliersController extends BaseController
38 $lists = $purchaserModel->list($this->map); 38 $lists = $purchaserModel->list($this->map);
39 if(!empty($lists)){ 39 if(!empty($lists)){
40 foreach ($lists as $v){ 40 foreach ($lists as $v){
41 - $resultData = json_decode($v['data']);  
42 - foreach ($resultData as $value){  
43 - $value = (array)$value;  
44 - $value['keyword'] = $v['keyword'];  
45 - $data[] = $value; 41 + if(!empty($v['data'])){
  42 + $resultData = json_decode($v['data'],true);
  43 + foreach ($resultData as $value){
  44 + $value = (array)$value;
  45 + $value['keyword'] = $v['keyword'];
  46 + $data[] = $value;
  47 + }
46 } 48 }
47 } 49 }
48 } 50 }
@@ -176,9 +176,6 @@ class ProjectLogic extends BaseLogic @@ -176,9 +176,6 @@ class ProjectLogic extends BaseLogic
176 * @time :2023/8/30 12:14 176 * @time :2023/8/30 12:14
177 */ 177 */
178 public function saveProject($param){ 178 public function saveProject($param){
179 - if($param['type'] == Project::TYPE_ONE){  
180 - $param['serve_id'] = 9;  
181 - }  
182 if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){ 179 if((($param['type'] == Project::TYPE_TWO) || ($param['type'] == Project::TYPE_THREE)) && empty($param['uptime'])){
183 $param['uptime'] = date('Y-m-d H:i:s'); 180 $param['uptime'] = date('Y-m-d H:i:s');
184 } 181 }
@@ -7,7 +7,7 @@ @@ -7,7 +7,7 @@
7 * @time :2024/3/4 14:39 7 * @time :2024/3/4 14:39
8 */ 8 */
9 9
10 -namespace App\Models\Com; 10 +namespace App\Models\Purchaser;
11 11
12 use App\Models\Base; 12 use App\Models\Base;
13 13
  1 +<?php
  2 +/**
  3 + * @remark :
  4 + * @name :PurchaserInfo.php
  5 + * @author :lyh
  6 + * @method :post
  7 + * @time :2024/5/29 16:57
  8 + */
  9 +
  10 +namespace App\Models\Purchaser;
  11 +
  12 +use App\Models\Base;
  13 +
  14 +class PurchaserInfo extends Base
  15 +{
  16 + protected $table = 'gl_purchaser_info';
  17 +}