修复商城1
This commit is contained in:
parent
6fb593b39f
commit
613251ae1f
@ -119,7 +119,58 @@ class CommunityRepository extends BaseRepository
|
|||||||
if ($list) $list = $list->toArray();
|
if ($list) $list = $list->toArray();
|
||||||
return compact('count','list');
|
return compact('count','list');
|
||||||
}
|
}
|
||||||
|
public function getApiListTwo(array $where, int $page, int $limit, $userInfo)
|
||||||
|
{
|
||||||
|
if (!$userInfo){
|
||||||
|
$count=0;
|
||||||
|
$list=[];
|
||||||
|
return compact('count','list');
|
||||||
|
}
|
||||||
|
$village_id=Db::name('nk_user')->where('user_id',$userInfo->uid)->value('village_id');
|
||||||
|
if (!$village_id){
|
||||||
|
$count=0;
|
||||||
|
$list=[];
|
||||||
|
return compact('count','list');
|
||||||
|
}
|
||||||
|
$arr=Db::name('community_address')->where('village_id',$village_id)->page($page, $limit)->select();
|
||||||
|
if (count($arr)==0){
|
||||||
|
$count=0;
|
||||||
|
$list=[];
|
||||||
|
return compact('count','list');
|
||||||
|
}
|
||||||
|
$arr2=[];
|
||||||
|
foreach ($arr as $k=>$v){
|
||||||
|
$arr2[]=$v['community_id'];
|
||||||
|
}
|
||||||
|
$arrWhere=['id_and_in'=>$arr2];
|
||||||
|
$query = $this->dao->getSearch($arrWhere)->order('start DESC,create_time DESC,community_id DESC');
|
||||||
|
$query->with([
|
||||||
|
'author' => function($query) use($userInfo){
|
||||||
|
$query->field('uid,real_name,status,avatar,nickname,count_start');
|
||||||
|
},
|
||||||
|
'is_start' => function($query) use ($userInfo) {
|
||||||
|
$query->where('left_id',$userInfo->uid ?? null);
|
||||||
|
},
|
||||||
|
'topic' => function($query) {
|
||||||
|
$query->where('status', 1)->where('is_del',0);
|
||||||
|
$query->field('topic_id,topic_name,status,category_id,pic,is_del');
|
||||||
|
},
|
||||||
|
'relevance' => [
|
||||||
|
'spu' => function($query) {
|
||||||
|
$query->field('spu_id,store_name,image,price,product_type,activity_id,product_id');
|
||||||
|
}
|
||||||
|
],
|
||||||
|
'is_fans' => function($query) use($userInfo){
|
||||||
|
$query->where('left_id',$userInfo->uid?? 0);
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
$count = Db::name('community_address')->where('village_id',$village_id)->count();
|
||||||
|
$list = $query->setOption('field',[])
|
||||||
|
->field('community_id,title,image,topic_id,count_start,count_reply,start,create_time,uid,status,is_show,content')
|
||||||
|
->select()->append(['time']);
|
||||||
|
|
||||||
|
return compact('count','list');
|
||||||
|
}
|
||||||
public function getFirtVideo($where,$page, $userInfo)
|
public function getFirtVideo($where,$page, $userInfo)
|
||||||
{
|
{
|
||||||
$with =[];
|
$with =[];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user