|
|
|
@ -15,6 +15,7 @@ namespace app\admin\controller; |
|
|
|
|
use cores\BaseController; |
|
|
|
|
use app\admin\service\admin\User as AdminUserService; |
|
|
|
|
use cores\exception\BaseException; |
|
|
|
|
use app\common\model\Channel; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 超管后台控制器基类 |
|
|
|
@ -67,7 +68,48 @@ class Controller extends BaseController |
|
|
|
|
// 强制验证当前访问的控制器方法method |
|
|
|
|
$this->checkMethodRules(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 获取当前用户的数据平台权限 |
|
|
|
|
* [getUserPlatform description] |
|
|
|
|
* @return [type] [description] |
|
|
|
|
*/ |
|
|
|
|
public function getUserPlatform(){ |
|
|
|
|
if ($this->admin['user']['role'] == 1) { |
|
|
|
|
//京东账号可以看到京东和自营的 |
|
|
|
|
if ($this->admin['user']['channel'] == 'jd') { |
|
|
|
|
$list = Channel::where('status', 1)->whereIn('code',['jd','zy'])->select(); |
|
|
|
|
//苏宁账号可以看到苏宁和自营的 |
|
|
|
|
} elseif($this->admin['user']['channel'] == 'sn'){ |
|
|
|
|
$list = Channel::where('status', 1)->whereIn('code',['sn','zy'])->select(); |
|
|
|
|
//新阙通信账号可以看到新阙通信和自营的 |
|
|
|
|
} elseif($this->admin['user']['channel'] == 'xqtx'){ |
|
|
|
|
$list = Channel::where('status', 1)->whereIn('code',['xqtx','zy'])->select(); |
|
|
|
|
//其他账号供应商只能看到自己的 |
|
|
|
|
} else { |
|
|
|
|
$list = Channel::where('status', 1)->whereIn('code',[$this->admin['user']['channel']])->select(); |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
//超级管理员看到所有的 |
|
|
|
|
$list = Channel::where('status', 1)->select(); |
|
|
|
|
} |
|
|
|
|
return $list; |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 获取用户添加和导入数据时的platform |
|
|
|
|
* [getUserAddPlatform description] |
|
|
|
|
* @return [type] [description] |
|
|
|
|
*/ |
|
|
|
|
public function getUserAddPlatform(){ |
|
|
|
|
if ($this->admin['user']['role'] == 1) { |
|
|
|
|
if (in_array($this->admin['user']['channel'], ['jd','sn','xqtx'])) { |
|
|
|
|
return 'zy'; |
|
|
|
|
} else { |
|
|
|
|
return $this->admin['user']['channel']; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
return 'zy'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
/** |
|
|
|
|
* 设置管理员登录信息 |
|
|
|
|
*/ |
|
|
|
|