81 行
2.9 KiB
PHP
可执行文件
81 行
2.9 KiB
PHP
可执行文件
<?php
|
||
|
||
namespace Retail\Controller;
|
||
|
||
use Boris\DumpInspector;
|
||
use Common\Business\Role;
|
||
use Common\Model\RetailStoreModel;
|
||
use Think\Controller;
|
||
|
||
//[1.8.50]
|
||
class JurisdictionController extends BasetwoController
|
||
{
|
||
public function index()
|
||
{
|
||
$id = I('get.id');
|
||
$platform_type = session('merchant_userinfo')['platform_type']; //商户平台类型 1默认系统 2微礼平台
|
||
$little_arr = [];
|
||
if ($platform_type == 2) {
|
||
//微礼平台屏蔽的权限
|
||
$little_arr = [
|
||
'showpurch_price',
|
||
'addgoods_num',
|
||
'check_goods_pd',
|
||
'cost_price',
|
||
];
|
||
}
|
||
$one = M('retail_store_jurisdiction')->where(array('storeid' => $id))->find();
|
||
if (!$one) {
|
||
$adata['storeid'] = $id;
|
||
$ret = M('retail_store_jurisdiction')->add($adata);
|
||
$one = M('retail_store_jurisdiction')->where(array('id' => $ret))->find();
|
||
}
|
||
$RoleClass = new Role();
|
||
$not_arr = $RoleClass->storeUseLimit($id); //无权限集合
|
||
$not_arr = array_merge($little_arr,$not_arr);
|
||
$arr = array();
|
||
foreach ($one as $k => $v) {
|
||
if ($k == 'id' || $k == 'storeid' || $k == 'express_search' || $k == 'addgoods_num') {
|
||
continue;
|
||
}
|
||
if (strpos($k, '_name')) {
|
||
continue;
|
||
}
|
||
if (in_array($k, $not_arr)) {
|
||
continue;
|
||
}
|
||
$name = $one[$k . '_name'] ? $one[$k . '_name'] : '权限名称';
|
||
$arr[] = array('name' => $name, 'key' => $k, 'status' => $one[$k]);
|
||
}
|
||
$storetag = M('retail_store')->where(array('id' => $id))->getField('storetag');
|
||
$this->assign('shopname', $storetag);
|
||
$this->assign('one', $one);
|
||
$this->assign('arr', $arr);
|
||
$this->display();
|
||
}
|
||
|
||
public function setJurisdiction()
|
||
{
|
||
if (IS_POST) {
|
||
$id = I('post.id');
|
||
$status = I('post.status');
|
||
$key = I('post.key');
|
||
$res = M('retail_store_jurisdiction')->where(array('id' => $id))->setField($key, $status);
|
||
if ($res) {
|
||
$rt['status'] = 1;
|
||
$rt['msg'] = '设置成功';
|
||
//操作日志记录
|
||
$source = 0;//请求来源: 0pc系统 1小助手
|
||
$type = 3;//平台:1合伙人端 2代理商端 3商户端 4门店端
|
||
$request_data = json_encode($_POST);//请求参数 json数据
|
||
$desc = '编辑门店权限';//操作行为描述
|
||
action_log($source, $type, $request_data, $desc);
|
||
//end
|
||
} else {
|
||
$rt['status'] = 0;
|
||
$rt['msg'] = '设置失败';
|
||
}
|
||
$this->ajaxReturn($rt);
|
||
}
|
||
}
|
||
} |