更新修复交易大厅中的内容应根据对应的商户类型展示内容

This commit is contained in:
yaooo 2023-08-26 17:47:48 +08:00
parent bcd0fa539a
commit 1d37a2c270

View File

@ -109,9 +109,17 @@ class CommunityRepository extends BaseRepository
$config = systemConfig("community_app_switch");
// if (!isset($where['is_type']) && $config) $where['is_type'] = is_array($config) ? implode(',', $config) : $config;
if (empty($where['is_type'])) $where['is_type'] = '1,2';
$uIdArray = [];
if ($where['is_type'] == 3) {
$categoryId = Db::name('merchant')->where('uid', $userInfo->uid)->where('status', 1)->value('category_id');
$uIdArray = Db::name('merchant')->where('category_id', $categoryId)->where('status', 1)->where('uid', '>', 0)->column('uid');
}
$where['is_del'] = 0;
$query = $this->dao->search($where)->when(in_array(self::COMMUNITY_TYPE_RESALE, explode(',', $where['is_type'])), function ($query) {
$query->where('is_sale', 0);
$query = $this->dao->search($where)->when(in_array(self::COMMUNITY_TYPE_RESALE, explode(',', $where['is_type'])), function ($query) use ($where, $uIdArray) {
$query->where('Community.is_sale', 0);
if (is_array($uIdArray) && count($uIdArray) > 0) {
$query->whereIn('Community.uid', $uIdArray);
}
})->order('start DESC,Community.create_time DESC,community_id DESC');
$query->with([
'author' => function($query) use($userInfo){
@ -138,7 +146,6 @@ class CommunityRepository extends BaseRepository
$list = $query->page($page, $limit)->setOption('field',[])
->field('community_id,title,image,resale_type,topic_id,Community.count_start,count_reply,start,Community.create_time,Community.uid,Community.status,is_show,content,video_link,is_type,refusal')
->select()->append(['time']);
if ($list) $list = $list->toArray();
foreach ($list as $k => $item) {
if ($item['is_type'] == self::COMMUNITY_TYPE_RESALE) {