1234567891011121314151617181920212223242526272829303132333435 |
- <?php namespace Manage\Lib;
- use Dever;
- use Dever\Helper\Str;
- class Group extends Auth
- {
- public function getTree()
- {
- $data = Dever::db('group')->select([]);
- $result = array();
- $result[] = array
- (
- 'id' => 'root',
- 'name' => '全部集团',
- 'children' => $data,
- );
- return $result;
- }
- public function update($data)
- {
- if ($data['mobile']) {
- $database = '"2_' . $data['id'] . '"';
- $db = Dever::db('group_user', '', 'default', array('database' => $database));
- $info = $db->find(1);
- if (!$info) {
- $password = '123456';
- $insert['name'] = Str::hide($data['mobile']);
- $insert['mobile'] = $data['mobile'];
- $insert['role'] = 1;
- $insert += Dever::load('common')->createPwd($password);
- $db->insert($insert);
- }
- }
- }
- }
|