181 行
4.3 KiB
PHP
可执行文件
181 行
4.3 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace Retail\Controller;
|
|
|
|
use Common\Business\Role;
|
|
use Think\Controller;
|
|
|
|
//[1.9.13]
|
|
|
|
/**
|
|
* 商户角色管理
|
|
* Class MerchantRolesController
|
|
* @package Retail\Controller
|
|
*/
|
|
class MerchantRolesController extends BaseController
|
|
{
|
|
/**
|
|
* 角色列表页
|
|
*/
|
|
public function index()
|
|
{
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* 获取角色列表
|
|
*/
|
|
public function getRoles()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->getRoleList([
|
|
'operator_id' => $this->login_user['id'],
|
|
'user_type' => 3,
|
|
'page' => I('post.page'),
|
|
'limit' => I('post.limit'),
|
|
'keyword' => I('post.keyword'),
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 修改开启关闭状态
|
|
*/
|
|
public function changeStatus()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->changeCustomerRoleStatus([
|
|
'id' => I('post.id'),
|
|
'operator_id' => $this->login_user['id'],
|
|
'user_type' => 3,
|
|
'source' => 0,
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 角色删除
|
|
*/
|
|
public function rolesDel()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->delCustomerRole([
|
|
'id' => I('post.id'),
|
|
'operator_id' => $this->login_user['id'],
|
|
'user_type' => 3,
|
|
'source' => 0,
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 角色添加页面
|
|
*/
|
|
public function rolesAdd()
|
|
{
|
|
$this->display();
|
|
}
|
|
|
|
/**
|
|
* 获取权限列表
|
|
*/
|
|
public function getAllJurList()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->getRole([
|
|
'operate_type' => 1,
|
|
'operator_id' => $this->login_user['id'],
|
|
'group_id' => $this->login_user['jurisdiction_group_id'],
|
|
'next_user_type' => I('post.role_type'),
|
|
'next_id' => I('post.group_id'),
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 角色添加
|
|
*/
|
|
public function rolesAddAjax()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->setRole([
|
|
'operate_type' => 1,
|
|
'operator_id' => $this->login_user['id'],
|
|
'group_id' => $this->login_user['jurisdiction_group_id'],
|
|
'next_user_type' => $this->login_user['login_type'],
|
|
'next_id' => I('post.group_id'),
|
|
'role_name' => I('post.role_name'),
|
|
'status' => I('post.status'),
|
|
'checkIds' => I('post.checkIds'),
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 获取门店菜单栏权限
|
|
*/
|
|
public function getStoreRole()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->getRole([
|
|
'operate_type' => 2,
|
|
'operator_id' => $this->login_user['id'],
|
|
'next_user_type' => 4,
|
|
'next_id' => I('post.store_id'),
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 保存门店菜单栏权限
|
|
*/
|
|
public function setStoreRole()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->setRole([
|
|
'operate_type' => 2,
|
|
'operator_id' => $this->login_user['id'],
|
|
'next_user_type' => 4,
|
|
'next_id' => I('post.store_id'),
|
|
'checkIds' => I('post.checkIds'),
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 获取门店权限操作记录
|
|
*/
|
|
public function getRoleRecord()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->getRoleRecord([
|
|
'operator_user_id' => I('post.operator_id'),
|
|
'operate_type' => 2,
|
|
'operator_id' => $this->login_user['id'],
|
|
'next_user_type' => 4,
|
|
'next_id' => I('post.store_id'),
|
|
'page' => I('post.page'),
|
|
'limit' => I('post.limit'),
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 获取操作者列表-供选择
|
|
*/
|
|
public function getOperatorList()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->getOperatorList([
|
|
'user_id' => $this->login_user['id'],
|
|
'user_type' => $this->login_user['user_type'],
|
|
'first_pid' => $this->login_user['first_pid'],
|
|
]));
|
|
}
|
|
|
|
/**
|
|
* 重置门店权限为初始状态
|
|
*/
|
|
public function resetUserRole()
|
|
{
|
|
$Role = new Role();
|
|
$this->ajaxReturn($Role->resetUserRole([
|
|
'operator_id' => $this->login_user['id'],
|
|
'next_id' => I('post.store_id'),
|
|
'next_user_type' => 3,
|
|
]));
|
|
}
|
|
}
|