文件
mashangyoujiu/Application/Retail/Controller/JurisdictionController.class.php

81 行
2.9 KiB
PHP
可执行文件

此文件含有模棱两可的 Unicode 字符

此文件含有可能会与其他字符混淆的 Unicode 字符。 如果您是想特意这样的,可以安全地忽略该警告。 使用 Escape 按钮显示他们。

<?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);
}
}
}