...
|
...
|
@@ -283,46 +283,44 @@ class User extends Api |
|
|
unset($shu[$k]);
|
|
|
}
|
|
|
}
|
|
|
//定义一个空数组
|
|
|
$ids = [];
|
|
|
foreach ($shu as &$v){
|
|
|
$id1 = Db::name('video')
|
|
|
->where('keyword','like',"%$v%")
|
|
|
->whereOr('title','like',"%$v%")
|
|
|
->column('id');
|
|
|
foreach ($id1 as $val){
|
|
|
array_push($ids,$val);
|
|
|
}
|
|
|
$id2 = Db::name('words')
|
|
|
->where('name',$v)
|
|
|
->field('id,type')
|
|
|
->find();
|
|
|
if(!empty($id2)){
|
|
|
if($id2['type'] == 1){
|
|
|
$a = Db::name('video')
|
|
|
->where('address_ids','like','%,'.$id2['id'].',%')
|
|
|
->order('is_show desc')
|
|
|
->column('id');
|
|
|
}elseif ($id2['type'] == 2){
|
|
|
$a = Db::name('video')
|
|
|
->where('text_ids','like','%,'.$id2['id'].',%')
|
|
|
->order('is_show desc')
|
|
|
->column('id');
|
|
|
}
|
|
|
foreach ($a as $val){
|
|
|
if($param['type_id'] == 1){
|
|
|
//定义一个空数组
|
|
|
$ids = [];
|
|
|
foreach ($shu as &$v){
|
|
|
$id1 = Db::name('video')
|
|
|
->where('keyword','like',"%$v%")
|
|
|
->whereOr('title','like',"%$v%")
|
|
|
->column('id');
|
|
|
foreach ($id1 as $val){
|
|
|
array_push($ids,$val);
|
|
|
}
|
|
|
$id2 = Db::name('words')
|
|
|
->where('name',$v)
|
|
|
->field('id,type')
|
|
|
->find();
|
|
|
if(!empty($id2)){
|
|
|
if($id2['type'] == 1){
|
|
|
$a = Db::name('video')
|
|
|
->where('address_ids','like','%,'.$id2['id'].',%')
|
|
|
->order('is_show desc')
|
|
|
->column('id');
|
|
|
}elseif ($id2['type'] == 2){
|
|
|
$a = Db::name('video')
|
|
|
->where('text_ids','like','%,'.$id2['id'].',%')
|
|
|
->order('is_show desc')
|
|
|
->column('id');
|
|
|
}
|
|
|
foreach ($a as $val){
|
|
|
array_push($ids,$val);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$ids2 = array_unique($ids);
|
|
|
if($ids2 === $ids){
|
|
|
$result = $ids;
|
|
|
}else{
|
|
|
$result=array_diff_assoc($ids,$ids2);
|
|
|
}
|
|
|
}
|
|
|
$ids2 = array_unique($ids);
|
|
|
if($ids2 === $ids){
|
|
|
$result = $ids;
|
|
|
}else{
|
|
|
$result=array_diff_assoc($ids,$ids2);
|
|
|
}
|
|
|
|
|
|
|
|
|
if($param['type_id'] == 1){
|
|
|
$data = Db::name('video')
|
|
|
->whereIn('id',$result)
|
|
|
->field('id,title,thumbnail')
|
...
|
...
|
@@ -334,6 +332,43 @@ class User extends Api |
|
|
}
|
|
|
$this->success('success',$data);
|
|
|
}else{
|
|
|
//定义一个空数组
|
|
|
$ids = [];
|
|
|
foreach ($shu as &$v){
|
|
|
$id1 = Db::name('pic')
|
|
|
->where('keyword','like',"%$v%")
|
|
|
->whereOr('title','like',"%$v%")
|
|
|
->column('id');
|
|
|
foreach ($id1 as $val){
|
|
|
array_push($ids,$val);
|
|
|
}
|
|
|
$id2 = Db::name('words')
|
|
|
->where('name',$v)
|
|
|
->field('id,type')
|
|
|
->find();
|
|
|
if(!empty($id2)){
|
|
|
if($id2['type'] == 1){
|
|
|
$a = Db::name('pic')
|
|
|
->where('address_ids','like','%,'.$id2['id'].',%')
|
|
|
->order('is_show desc')
|
|
|
->column('id');
|
|
|
}elseif ($id2['type'] == 2){
|
|
|
$a = Db::name('pic')
|
|
|
->where('text_ids','like','%,'.$id2['id'].',%')
|
|
|
->order('is_show desc')
|
|
|
->column('id');
|
|
|
}
|
|
|
foreach ($a as $val){
|
|
|
array_push($ids,$val);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
$ids2 = array_unique($ids);
|
|
|
if($ids2 === $ids){
|
|
|
$result = $ids;
|
|
|
}else{
|
|
|
$result=array_diff_assoc($ids,$ids2);
|
|
|
}
|
|
|
$data = Db::name('pic')
|
|
|
->whereIn('id',$result)
|
|
|
->field('id,title,thumbnail')
|
...
|
...
|
|