作者 郭盛
1 个管道 的构建 通过 耗费 12 秒

修改搜索

@@ -387,10 +387,8 @@ class User extends Api @@ -387,10 +387,8 @@ class User extends Api
387 if(!empty($param['address'])){ 387 if(!empty($param['address'])){
388 $address = $param['address']; 388 $address = $param['address'];
389 $where_address = function ($query_address) use ($address) { 389 $where_address = function ($query_address) use ($address) {
390 - foreach ($address as $v){  
391 - $a = Db::name('words')->where('id',$v)->field('id,name')->find();  
392 - $query_address->where('address_ids','like','%,'.$v.',%')->whereor('keyword','like',"%$a[name]%");  
393 - } 390 + $a = Db::name('words')->where('id',$address)->field('id,name')->find();
  391 + $query_address->where('address_ids','like','%,'.$address.',%')->whereor('keyword','like',"%$a[name]%");
394 }; 392 };
395 } 393 }
396 394
@@ -399,21 +397,18 @@ class User extends Api @@ -399,21 +397,18 @@ class User extends Api
399 if(!empty($param['text'])){ 397 if(!empty($param['text'])){
400 $text = $param['text']; 398 $text = $param['text'];
401 $where_text = function ($query_text) use ($text) { 399 $where_text = function ($query_text) use ($text) {
402 - foreach ($text as $vt){  
403 - $a = Db::name('words')->where('id',$vt)->field('id,name')->find();  
404 - $query_text->where('text_ids','like','%,'.$vt.',%')->whereor('keyword','like',"%$a[name]%");  
405 - } 400 + $a = Db::name('words')->where('id',$text)->field('id,name')->find();
  401 + $query_text->where('text_ids','like','%,'.$text.',%')->whereor('keyword','like',"%$a[name]%");
406 }; 402 };
407 } 403 }
408 404
  405 +
409 //判断如果传递过来价格关键词不为空 406 //判断如果传递过来价格关键词不为空
410 $where_price = []; 407 $where_price = [];
411 if(!empty($param['price'])){ 408 if(!empty($param['price'])){
412 $price = $param['price']; 409 $price = $param['price'];
413 $where_price = function ($query_price) use ($price) { 410 $where_price = function ($query_price) use ($price) {
414 - foreach ($price as $vp){  
415 - $query_price->where('price',$vp);  
416 - } 411 + $query_price->where('price',$price);
417 }; 412 };
418 } 413 }
419 414