function up_push() { $phone = $_POST['phone']; if (!$phone) { return self::re(C('emp_phone')); } $sig = $_POST['sig']; if (!$sig) { return self::re(C('emp_password')); } if (!CheckHeaders::check_sig($phone, $sig)) { header("HTTP/1.0 403 Signature Inconsistent"); return self::re(C('no_data')); } $r = M('user')->where(array('phone' => $phone))->find(); if (!$r) { return self::re(C('noex_phone')); } $isios = $_POST['isios']; $channelid = $_POST['channelid']; $userid = $_POST['userid']; if (!$_POST['isios']) { $isios = '0'; } if ($userid != null && $channelid != null) { $res = M('user')->where(array_filter(array('phone' => $phone)))->save(array('status' => '1', 'isios' => $isios, 'tokenid' => $userid, 'channelid' => $channelid)); } return self::re(0); }
function profile() { $phone = $_POST['phone']; if (!$phone) { return self::re(C('emp_phone')); } $sig = $_POST['sig']; if (!$sig) { return self::re(C('emp_password')); } if (!CheckHeaders::check_sig($phone, $sig)) { header("HTTP/1.0 403 Signature Inconsistent"); return self::re(C('no_data')); } if (!$_POST['fuid']) { return self::re(C('emp_fuid')); } $fuid = $_POST['fuid']; $profile = M('user')->where(array_filter(array('uid' => $fuid)))->field('password,creatTime,rid,channelid,tokenid', TRUE)->find(); if (!$profile) { return self::re(C('no_data'), 'no this fuid'); } $profile['ret'] = '0'; $uid = M('user')->where(array_filter(array('phone' => $phone)))->getField('uid'); $where['_uid'] = 'uid = ' . $uid . ' and fuid = ' . $fuid . ' '; $c = M('friend')->where($where['_uid'])->find(); if ($c) { $profile['isfriend'] = '1'; } else { $profile['isfriend'] = '0'; } $avatar = $profile['avatar']; $avatararr = json_decode($avatar, TRUE); $profile['small_url'] = $avatararr['small_url']; $profile['middle_url'] = $avatararr['middle_url']; $profile['big_url'] = $avatararr['big_url']; unset($profile['avatar']); return self::JSON($profile); }