Exemplo n.º 1
0
 public function competence1()
 {
     $ajaxAcc = commonAct::ajaxAccess();
     if (!$ajaxAcc) {
         self::$errCode = "1003";
         self::$errMsg = "您无用户颗粒(添加、修改)权限!";
         return false;
     }
     $userid = isset($_POST["userid"]) ? post_check($_POST["userid"]) : '';
     $visacc = isset($_POST["visacc"]) ? post_check($_POST["visacc"]) : '';
     if (empty($userid)) {
         self::$errCode = "1001";
         self::$errMsg = "用户参数非法";
         return false;
     }
     if (empty($visacc)) {
         self::$errCode = "1002";
         self::$errMsg = "可见帐号内容非法";
         return false;
     }
     $userarr = explode(",", $userid);
     foreach ($userarr as $userid) {
         $userid = is_numeric($userid) ? $userid : 0;
         if (empty($userid)) {
             self::$errCode = "1000";
             self::$errMsg = "单个用户ID参数非法";
             return false;
         }
         $data = array("user_id" => $userid, "power_ids" => $visacc);
         $res = UserCompetenceModel::competence($data);
         self::$errCode = UserCompetenceModel::$errCode;
         self::$errMsg = UserCompetenceModel::$errMsg;
     }
     return $res;
 }