Reg.php 1.56 KB
<?php
namespace Passport;
use LibModels\Web\Home\IndexData;
use LibModels\Web\Passport\RegData;
use Plugin\Images;
use Plugin\Captcha;
class RegModel
{
    const LEFT_BANNER_CODE = 'c479ec90120cae7f96e52922b4917064';
    
    /**
     * 获取左侧banner
     * 
     * @return array
     */
    public static function getLeftBanner()
    {
        $ret = array('img'=>'','url'=>'');
        $resource = IndexData::getResourceData(self::LEFT_BANNER_CODE);
        if(isset($resource['data'][0]))
        {
            $val = current($resource['data'][0]['data']);
            $ret['img'] = Images::getImageUrl($val['src'], 252, 190);
            $ret['url'] = $val['url'];
        }
        return $ret;
    }
    
    /**
     * 校验验证码
     * 
     * @param string $verifyCode
     * @return boolean
     */
    public static function verifyCode($verifyCode)
    {
        $verifyCode = strtolower($verifyCode);
        $ret = true;
        //检测验证码不正确
        if($verifyCode != strtolower(Captcha::getFromSession('passport_istration'))) {
            $ret = false;
        }
        return $ret;
    }
    
    /**
     * 根据手机号获取用户信息
     * 
     * @param string $area
     * @param string $mobile
     * @return array
     */
    public static function getUserInfoByMobile($area, $mobile) {
        $ret = array();
        $data = RegData::getUserInfoByMobile($area, $mobile);
        if($data['code'] == 200) {
            if(!empty($data['data'])) {
                $ret = current($data['data']);
            }
        }
        return $ret;
    }
}