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