UserData.php 1.18 KB
<?php
namespace LibModels\Web\Home;
use Api\Yohobuy;
use Api\Sign;
use WebPlugin\Helpers;
class UserData extends \LibModels\Wap\Home\UserData
{
    /**
     * 根据手机号获取用户信息[TODO +cache]
     *
     * @param string $area
     * @param string $mobile
     * @return array
     */
    public static function getUserInfoByMobile($area, $mobile)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.passport.userlist';
        $param['mobile'] = Helpers::makeMobile($area, $mobile);
        $param['debug'] = 'Y';
        $param['screen_size'] = '320x568';
        $param['client_secret'] = Sign::getSign($param);
        return Yohobuy::get(Yohobuy::API_URL, $param, 3600);
    }
    
    /**
     * 根据email获取用户信息
     * 
     * @param string $email
     * @return array
     */
    public static function getUserInfoByEmail($email)
    {
        $param = Yohobuy::param();
        $param['method'] = 'app.passport.userlist';
        $param['email'] = $email;
        $param['debug'] = 'Y';
        $param['screen_size'] = '320x568';
        $param['client_secret'] = Sign::getSign($param);
        return Yohobuy::get(Yohobuy::API_URL, $param, 3600);
    }
}