Exemplo n.º 1
0
function s_badge_new($uid, $bid, $username, $password)
{
    if (s_bad_id($uid) || s_bad_string($username) || s_bad_string($password)) {
        return s_err_arg();
    }
    $key = 'badge_new_by#' . $uid . $bid . $username . $password;
    if (false === ($data = s_memcache($key))) {
        $data = array('source' => APP_KEY, 'badge_id' => $bid, 'uids' => $uid, '_username' => $username, '_password' => $password);
        if ($data = s_badge_http('http://i2.api.weibo.com/2/proxy/badges/issue.json', $data, 'post')) {
            //缓存一小时
            s_memcache($key, $data, 3600);
        }
    }
    return $data;
}
Exemplo n.º 2
0
function s_badge_new($uid, $bid, $username, $password)
{
    if (s_bad_id($uid) || s_bad_string($username) || s_bad_string($password)) {
        return s_err_arg();
    }
    $key = "badge_new_by#uid={$uid}&bid={$bid}&user={$username}&password={$password}";
    if (false === ($data = s_memcache($key))) {
        $data = array('badge_id' => $bid, 'uids' => $uid, '_username' => $username, '_password' => $password);
        if (false === ($data = s_badge_http('http://api.t.sina.com.cn/badges/app/issue.json?source=' . APP_KEY, $data, 'post'))) {
            return s_err_sdk();
        }
        //缓存一小时
        s_memcache($key, $data, 300);
    }
    return $data;
}
Exemplo n.º 3
0
function s_badge_new($uid, $bid, $username, $password)
{
    if (s_bad_id($uid) || s_bad_string($username) || s_bad_string($password)) {
        return s_err_arg();
    }
    $key = "badge_new_by#uid={$uid}&bid={$bid}&user={$username}&password={$password}";
    if (false === ($data = s_memcache($key))) {
        $data = array('badge_id' => $bid, 'uids' => $uid, '_username' => $username, '_password' => $password);
        //if (false === ( $data = s_badge_http('http://api.weibo.com/2/proxy/badges/issue.json', $data, 'post') )) {
        if (false === ($data = s_badge_http('http://i2.api.weibo.com/2/proxy/badges/issue.json', $data, 'post'))) {
            return s_err_sdk();
        }
        //缓存五分钟
        s_memcache($key, $data, 300);
    }
    return $data;
}