联系官方销售客服
1835022288
028-61286886
想在前台会员中心,显示同用户组发布的内容。我参照这个解答:https://www.xunruicms.com/wenda/23914.html,《table类增加列表查询条件》
修改了/dayrui/App/Demo/Controllers/Member/Home.php文件,
<?php namespace Phpcmf\Controllers\Member; class Home extends \Phpcmf\Member\Module { // 内容列表 public function index() { if ($this->member['groupid']) { $where = " uid in (select uid from ".\Phpcmf\Service::M()->dbprefix('member_group_index')." where gid in(".implode(",", $this->member['groupid'])."))"; if ($this->init['where_list']) { $this->init['where_list'].= ' or '.$where; // 考虑到父类也许有可能会自带条件,防止被覆盖默认条件,所以追加一个 AND } else { $this->init['where_list'] = $where; } } $this->_Member_List(); } public function add() { $this->_Member_Add(); } public function edit() { if ($this->member['groupid']) { $where = " uid in (select uid from ".\Phpcmf\Service::M()->dbprefix('member_group_index')." where gid in(".implode(",", $this->member['groupid'])."))"; if ($this->init['where_list']) { $this->init['where_list'].= ' or '.$where; // 考虑到父类也许有可能会自带条件,防止被覆盖默认条件,所以追加一个 AND } else { $this->init['where_list'] = $where; } } $this->_Member_Edit(); } public function del() { $this->_Member_Del(); } }
我用同用户组账号登录,内容列表是显示出来了,但是点击编辑的时候,提示“数据#1不存在”
回复迅睿框架创始人
这个id=2是同会员组另外的账号发布的,id=1是自己发布的,没问题
回复迅睿框架创始人