123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131 |
- <?php
- namespace app\company\controller;
- use app\company\service\DataService;
- use library\Controller;
- use think\Db;
- class User extends Controller
- {
-
- protected $table = 'CompanyUser';
-
- public function index()
- {
- $this->title = '仓库权限管理';
- $this->_query($this->table)->like('nickname,svn_username')->equal('status')->page();
- }
-
- public function add()
- {
- $this->_form($this->table, 'form');
- }
-
- public function edit()
- {
- $this->_form($this->table, 'form');
- }
-
- protected function _form_filter(&$data)
- {
- if ($this->request->isGet()) {
- $where = ['status' => '1', 'is_deleted' => '0'];
- $this->auths = Db::name('company_user_auth')->where($where)->order('sort desc,id desc')->select();
- array_unshift($this->auths, ['id' => '0', 'title' => '所有权限', 'path' => '/']);
- $data['svn_authorize'] = isset($data['svn_authorize']) ? explode(',', $data['svn_authorize']) : [];
- } else {
- if (isset($data['svn_authorize']) && is_array($data['svn_authorize'])) {
- $data['svn_authorize'] = join(',', $data['svn_authorize']);
- } else {
- $data['svn_authorize'] = '';
- }
- $macs = [];
- foreach (explode(PHP_EOL, preg_replace("/\s+/", PHP_EOL, trim($data['mobile_macs']))) as $mac) {
- if (DataService::applyMacValue($mac)) $macs[] = $mac;
- }
- $data['mobile_macs'] = join(PHP_EOL, array_unique($macs));
- }
- }
-
- public function state()
- {
- $this->_save($this->table, ['status' => input('status', '0')]);
- }
-
- public function remove()
- {
- $this->_delete($this->table);
- }
- }
|