Exemple #1
0
 /**
  * 获取详情
  * @param $arr
  * @return array
  */
 public static function articalDetail($arr)
 {
     $returnErrorn = array("data" => null, "errorn" => 308);
     if (ifIsset($arr, array('tid'))) {
         $result = Flight::read()->getReadDetail($arr);
         if ($result) {
             $returnErrorn = array("data" => $result, "errorn" => 300);
         } else {
             $returnErrorn = array("data" => null, "errorn" => 308);
         }
     }
     return $returnErrorn;
 }
Exemple #2
0
 /**
  * 用户注册
  * @param $arr
  * @return int
  */
 public static function registUserInfo($arr)
 {
     $returnRegist = array("uid" => "0", "errorn" => 101);
     if (ifIsset($arr, array('name', 'email', 'password', 'repassword'))) {
         if (ifInfoLegal($arr['name'], "/^\\w{5,10}/i") && ifInfoLegal($arr['email'], "/^\\w+([-+.]\\w+)*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*/i")) {
             if (ifInfoLegal(array($arr['password'], $arr['repassword']), "/^\\w{5,18}/i")) {
                 if ($arr['password'] == $arr['repassword']) {
                     /** @var Flight::user Models\UserModel */
                     $sqlReturn = Flight::user()->getUserInfoByNameOrEmail($arr);
                     if ($sqlReturn && $sqlReturn['uid']) {
                         $returnRegist['errorn'] = 307;
                     } else {
                         $sqlReturn = Flight::user()->addUserInfo($arr);
                         $returnRegist = array("uid" => $sqlReturn, "errorn" => 300);
                         $statusEmail = sendMail("admin", $arr['email'], $arr['name'] . "同学", "web-欢迎注册", "<h2 style='color:#00A600'>谢谢您的注册!</h2><hr><p style='color:#BBFFBB'>Thank you for register.</p>");
                     }
                 } else {
                     $returnRegist['errorn'] = 301;
                 }
             } else {
                 $returnRegist['errorn'] = 306;
             }
         } else {
             $returnRegist['errorn'] = 303;
         }
     }
     return $returnRegist;
 }