private function getUserInfo($account) { $userId = null; if (MyTool::isEmail($account)) { $userId = sprintf("%s='%s'", MyConst::FIELD_EMAIL, $account); } else { $userId = sprintf("%s='%s'", MyConst::FIELD_PHONE, $account); } return MaUser::findFirst($userId); }
/** * cgi/singup/verify/email/{email} */ public function checkEmailAction($email) { $email = @trim($email); if (!MyTool::isEmail($email)) { return $this->onExit(MyConst::STATUS_INVALID_EMAIL, 'wrong email address: ' . $email); } $userId = sprintf("%s='%s'", MyConst::FIELD_EMAIL, $email); $number = @intval(MaUser::count($userId)); if ($number > 0) { return $this->onExit(MyConst::STATUS_EMAIL_EXISTS, 'email address already exists'); } return $this->onExit(MyConst::STATUS_OK); }
public static function getUser($account) { $userId = null; if (MyTool::isEmail($account)) { $userId = sprintf("%s='%s'", MyConst::FIELD_EMAIL, $account); } else { if (MyTool::isPhone($account)) { $userId = sprintf("%s='%s'", MyConst::FIELD_PHONE, $account); } else { $userId = sprintf("id=%s", $account); } } return MaUser::findFirst($userId); }