作者 潘浩文
1 个管道 的构建 通过 耗费 1 秒

个人中心页面渲染

... ... @@ -43,11 +43,13 @@ class AdminLightController extends AdminBaseController
*/
public function index()
{
cmf_get_current_admin_id();
//接收搜索参数
$param = $this->request->param();
//添加搜索条件
$where = [];
if (cmf_get_current_admin_id()!=1){
$where['t.user_id']=cmf_get_current_admin_id();
};
$keyword = empty($param['number']) ? '' : $param['number'];
if (!empty($keyword)) {
$where['l.number'] = ['like', "%$keyword%"];
... ... @@ -105,7 +107,12 @@ class AdminLightController extends AdminBaseController
*/
public function add()
{
$address = Db::name('temple')->field('address')->distinct('true')->select();
$where = [];
if (cmf_get_current_admin_id()!=1){
$where['user_id']=cmf_get_current_admin_id();
};
$address = Db::name('temple')->where($where)->field('address')->distinct('true')->select();
$this->assign('address', $address);
return $this->fetch();
}
... ... @@ -115,7 +122,12 @@ class AdminLightController extends AdminBaseController
public function getTemple()
{
$address = $this->request->param('address');
$temple = Db::name('temple')->where('address', $address)->select()->toJson();
$where = [];
if (cmf_get_current_admin_id()!=1){
$where['user_id']=cmf_get_current_admin_id();
};
$where['address']=$address;
$temple = Db::name('temple')->where($where)->select()->toJson();
return $temple;
}
... ... @@ -222,6 +234,10 @@ class AdminLightController extends AdminBaseController
*/
public function edit()
{
$where=[];
if (cmf_get_current_admin_id()!=1){
$where['user_id']=cmf_get_current_admin_id();
};
$id = $this->request->param('id');
$data = Db::name('light')
->alias('l')
... ... @@ -230,10 +246,10 @@ class AdminLightController extends AdminBaseController
->field('l.*,t.name as tname,t.id as tid,t.address as taddress')
->find();
$data['location']=[$data['row'],$data['column']];
$address = Db::name('temple')->field('address')->distinct('true')->select();
$address = Db::name('temple')->where($where)->field('address')->distinct('true')->select();
$this->assign('address',$address);
if (!empty($data['taddress'])) {
$temple = Db::name('temple')->where('address', $data['taddress'])->select();
$temple = Db::name('temple')->where('address', $data['taddress'])->where($where)->select();
$this->assign('temple', $temple);
}
if(!empty($data['temple_id'])) {
... ...
... ... @@ -79,7 +79,11 @@ class AdminTempleAreaController extends AdminBaseController
*/
public function add()
{
$temple=Db::name('temple')->select();
$where=[];
if (cmf_get_current_admin_id()!=1){
$where['user_id']=cmf_get_current_admin_id();
};
$temple=Db::name('temple')->where($where)->select();
$this->assign('temple',$temple);
return $this->fetch();
}
... ... @@ -131,7 +135,11 @@ class AdminTempleAreaController extends AdminBaseController
->where('id', $id)
// ->field('t.*,u.user_login')
->find();
$temple=Db::name('temple')->select();
$where=[];
if (cmf_get_current_admin_id()!=1){
$where['user_id']=cmf_get_current_admin_id();
};
$temple=Db::name('temple')->where($where)->select();
$this->assign('temple',$temple);
$this->assign('list', $data);
return $this->fetch();
... ...
... ... @@ -30,7 +30,7 @@
<th width="120">所属寺庙<span class="form-required">*</span></th>
<td>
<select name="temple_id" required>
<option value="">请选择寺庙账户</option>
<option value="">请选择所属寺庙</option>
<foreach name="temple" item="vo">
<option value="{$vo.id}">{$vo.name}</option>
</foreach>
... ...