作者 李宇航

合并分支 'lyh-server' 到 'master'

Lyh server



查看合并请求 !1881
@@ -190,7 +190,7 @@ class RecommendedSuppliers extends Command @@ -190,7 +190,7 @@ class RecommendedSuppliers extends Command
190 public function getKeywords($project_id){ 190 public function getKeywords($project_id){
191 $keywordModel = new Keyword(); 191 $keywordModel = new Keyword();
192 $keyword_array = $this->getPurchaserList($project_id); 192 $keyword_array = $this->getPurchaserList($project_id);
193 - $title = $keywordModel->where('title', 'not in', $keyword_array)->orderRaw('RAND()')->limit(1)->value('title'); // 只返回 title 字段 193 + $title = $keywordModel->whereNotIn('title', $keyword_array)->inRandomOrder()->limit(1)->value('title');
194 if(empty($title)){ 194 if(empty($title)){
195 return ''; 195 return '';
196 } 196 }
@@ -207,6 +207,9 @@ class RecommendedSuppliers extends Command @@ -207,6 +207,9 @@ class RecommendedSuppliers extends Command
207 public function savePurchaserInfo($project_id,$keyword,$data){ 207 public function savePurchaserInfo($project_id,$keyword,$data){
208 $purchaserInfoModel = new PurchaserInfo(); 208 $purchaserInfoModel = new PurchaserInfo();
209 foreach ($data as $k =>$v){ 209 foreach ($data as $k =>$v){
  210 + if(empty($v['buyer_id'])){
  211 + continue;
  212 + }
210 $v['project_id'] = $project_id; 213 $v['project_id'] = $project_id;
211 $v['keyword'] = $keyword; 214 $v['keyword'] = $keyword;
212 $v['email'] = json_encode($v['email']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE); 215 $v['email'] = json_encode($v['email']??[],JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);