Esempio n. 1
0
 /**
  * 更新 group 与 详细 purview的对应关系
  */
 public static function updateGroupPurview()
 {
     $groupModel = new Group();
     $groupList = $groupModel->field(['purview', 'id'])->find();
     foreach ($groupList as $group) {
         $list = [];
         if ($group->purview) {
             $purviewModel = new Purview();
             $group->purview = json_decode($group->purview, true);
             $group->purview = implode('","', $group->purview);
             $purview = $purviewModel->field('data')->where('id in ("' . $group->purview . '")')->find();
             if ($purview) {
                 foreach ($purview as $v) {
                     $v = json_decode($v->data, true);
                     foreach ($v as $string) {
                         $list[] = $string;
                     }
                 }
             }
         }
         Auth::setPurviewCache($group->id, $list);
     }
 }
Esempio n. 2
0
 public static function groupEnum()
 {
     $groupModel = new Group();
     $group = $groupModel->find();
     return Helper::renderEnum($group, 'id', 'name');
 }
Esempio n. 3
0
 public static function modModSetting()
 {
     return ['id' => '', 'js' => '', 'mod' => [['title' => adminModel::attributes()['id'], 'name' => 'id', 'type' => 'hidden', 'display' => false], ['title' => adminModel::attributes()['group_id'], 'name' => 'group_id', 'type' => 'select', 'option' => $group = Group::groupEnum()], ['title' => adminModel::attributes()['name'], 'name' => 'name', 'type' => 'input', 'required' => true], ['title' => adminModel::attributes()['true_name'], 'name' => 'true_name', 'type' => 'input', 'required' => true], ['title' => adminModel::attributes()['department'], 'name' => 'department', 'type' => 'input', 'required' => true], ['title' => adminModel::attributes()['tel'], 'name' => 'tel', 'type' => 'input'], ['title' => adminModel::attributes()['password'], 'name' => 'password', 'value' => '', 'type' => 'password', 'require' => true]]];
 }