本文整理汇总了PHP中clean_query_user_cache函数的典型用法代码示例。如果您正苦于以下问题:PHP clean_query_user_cache函数的具体用法?PHP clean_query_user_cache怎么用?PHP clean_query_user_cache使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了clean_query_user_cache函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveAvatar
public function saveAvatar($uid, $path)
{
//删除旧头像和临时头像
$this->removeAvatar($uid);
$this->removeTempAvatar($uid);
//保存新头像
$data = array('uid' => $uid, 'path' => $path, 'status' => 1, 'is_temp' => 0);
$data = $this->create($data);
clean_query_user_cache($uid, array('avatar32', 'avatar64', 'avatar128', 'avatar256', 'avatar512'));
return $this->add($data);
}
示例2: unfollow
public function unfollow($uid)
{
$follow['who_follow'] = is_login();
$follow['follow_who'] = $uid;
clean_query_user_cache($uid, 'fans');
clean_query_user_cache(is_login(), 'following');
S('atUsersJson_' . is_login(), null);
$user = query_user(array('id', 'username', 'space_url'));
D('Message')->sendMessage($uid, $user['username'] . '取消了对你的关注', '粉丝数减少', $user['space_url'], is_login(), 0);
return $this->where($follow)->delete();
}
示例3: setuserscore
function setuserscore($uid, $score, $inc = true)
{
$member = D('Member');
if ($inc) {
$res = $member->where(array('uid' => $uid))->setInc('score', $score);
clean_query_user_cache($uid, array('artnum'));
} else {
$res = $member->where(array('uid' => $uid))->setDec('score', $score);
clean_query_user_cache($uid, array('artnum'));
}
return $res;
}
示例4: send_weibo
/**
* send_weibo 发布分享
* @param $content
* @param $type
* @param string $feed_data
* @param string $from
* @return bool
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
function send_weibo($content, $type, $feed_data = '', $from = '')
{
$uid = is_login();
D('Weibo/Topic')->addTopic($content);
$weibo_id = D('Weibo')->addWeibo($uid, $content, $type, $feed_data, $from);
if (!$weibo_id) {
return false;
}
action_log('add_weibo', 'weibo', $weibo_id, $uid);
$uids = get_at_uids($content);
send_at_message($uids, $weibo_id, $content);
clean_query_user_cache(is_login(), array('weibocount'));
return $weibo_id;
}
示例5: doUserAddRank
public function doUserAddRank($id = null, $uid, $reason, $is_show, $rank_id)
{
$is_Edit = $id ? true : false;
$data = array('uid' => $uid, 'reason' => $reason, 'is_show' => $is_show, 'rank_id' => $rank_id);
$model = D('rank_user');
if ($is_Edit) {
$data = $model->create($data);
$data['create_time'] = time();
$result = $model->where('id=' . $id)->save($data);
if (!$result) {
$this->error('关联失败');
}
} else {
$rank_user = $model->where(array('uid' => $uid, 'rank_id' => $rank_id))->find();
if ($rank_user) {
$this->error('该用户已经拥有该头衔,请选着其他头衔');
}
$data = $model->create($data);
$data['create_time'] = time();
$result = $model->add($data);
if (!$result) {
$this->error('关联失败');
} else {
$rank = D('rank')->where('id=' . $data['rank_id'])->find();
//$logoUrl=getRootUrl().D('picture')->where('id='.$rank['logo'])->getField('path');
$u_name = D('member')->where('uid=' . $uid)->getField('nickname');
$content = '管理员给你颁发了头衔:[' . $rank['title'] . ']';
//<img src="'.$logoUrl.'" title="'.$rank['title'].'" alt="'.$rank['title'].'">';
$user = query_user(array('username', 'space_link'), $uid);
$content1 = '管理员给@' . $user['username'] . ' 颁发了新的头衔:[' . $rank['title'] . '],颁发理由:' . $reason;
//<img src="'.$logoUrl.'" title="'.$rank['title'].'" alt="'.$rank['title'].'">';
clean_query_user_cache($uid, array('rank_link'));
$this->sendMessage($data, $content);
//写入数据库
$model = D('Weibo/Weibo');
$result = $model->addWeibo(is_login(), $content1);
}
}
$this->success($is_Edit ? '编辑关联成功' : '添加关联成功', U('Rank/userRankList?id=' . $uid));
}
示例6: addFollow
public function addFollow($who_follow, $follow_who)
{
$follow['who_follow'] = $who_follow;
$follow['follow_who'] = $follow_who;
if ($follow['who_follow'] == $follow['follow_who']) {
//禁止关注和被关注都为同一个人的情况。
return 0;
}
if ($this->where($follow)->count() > 0) {
return 0;
}
$follow = $this->create($follow);
clean_query_user_cache($follow_who, 'fans');
clean_query_user_cache($who_follow, 'following');
S('atUsersJson_' . $who_follow, null);
/**
* @param $to_uid 接受消息的用户ID
* @param string $content 内容
* @param string $title 标题,默认为 您有新的消息
* @param $url 链接地址,不提供则默认进入消息中心
* @param $int $from_uid 发起消息的用户,根据用户自动确定左侧图标,如果为用户,则左侧显示头像
* @param int $type 消息类型,0系统,1用户,2应用
*/
$user = query_user(array('id', 'username', 'space_url'), $who_follow);
D('Message')->sendMessage($follow_who, $user['username'] . ' 关注了你。', '粉丝数增加', $user['space_url'], $who_follow, 0);
return $this->add($follow);
}
示例7: cancelWithdraw
public function cancelWithdraw()
{
$aId = I('post.id', 0, 'intval');
//取消提现,可以是管理员或者当事人
$withdrawModel = D('Withdraw');
$withdraw = $withdrawModel->getWithdraw($aId);
if (empty($withdraw) || $aId <= 0) {
$this->error('提现不存在。');
}
$this->checkAuth(null, $withdraw['uid']);
if ($withdraw['payok'] != 0) {
$this->error('该提现不能被取消');
}
//取消订单
$rs = $withdrawModel->where(array('id' => $withdraw['id']))->setField('payok', -1);
S('withdraw_order_' . $withdraw['id'], null);
//返还现金
D('Member')->where(array('uid' => $withdraw['uid']))->setInc('score' . $withdraw['field'], $withdraw['frozen_amount']);
clean_query_user_cache($withdraw['uid'], 'score' . $withdraw['field']);
if (!$rs) {
$withdrawModel->where(array('id' => $withdraw['id']))->setField('payok', 2);
//待返还状态
$this->error('返还金额失败。请联系管理员。');
}
$this->success('取消订单成功。冻结' . $withdraw['score_type']['title'] . $withdraw['frozen_amount'] . $withdraw['score_type']['unit'] . '已返还到您的指定账户。');
}
示例8: cleanUserCache
public function cleanUserCache($uid, $type)
{
$uid = is_array($uid) ? $uid : explode(',', $uid);
$type = is_array($type) ? $type : explode(',', $type);
foreach ($uid as $val) {
foreach ($type as $v) {
clean_query_user_cache($val, 'score' . $v);
}
clean_query_user_cache($uid, 'title');
}
}
示例9: userChangeRank
public function userChangeRank($id = null, $uid = '', $reason = '', $is_show = '', $rank_id = '')
{
if (IS_POST) {
$is_Edit = $id ? true : false;
$data = array('uid' => $uid, 'reason' => $reason, 'is_show' => $is_show, 'rank_id' => $rank_id);
$model = D('rank_user');
if ($is_Edit) {
$data = $model->create($data);
$data['create_time'] = time();
$result = $model->where('id=' . $id)->save($data);
if (!$result) {
$this->error('关联失败');
}
} else {
$rank_user = $model->where(array('uid' => $uid, 'rank_id' => $rank_id))->find();
if ($rank_user) {
$this->error('该用户已经拥有该头衔,请选着其他头衔');
}
$data = $model->create($data);
$data['create_time'] = time();
$result = $model->add($data);
if (!$result) {
$this->error('关联失败');
} else {
$rank = D('rank')->where('id=' . $data['rank_id'])->find();
//$logoUrl=getRootUrl().D('picture')->where('id='.$rank['logo'])->getField('path');
//$u_name = D('member')->where('uid=' . $uid)->getField('nickname');
$content = '管理员给你颁发了头衔:[' . $rank['title'] . ']';
//<img src="'.$logoUrl.'" title="'.$rank['title'].'" alt="'.$rank['title'].'">';
$user = query_user(array('username', 'space_link'), $uid);
$content1 = '管理员给@' . $user['username'] . ' 颁发了新的头衔:[' . $rank['title'] . '],颁发理由:' . $reason;
//<img src="'.$logoUrl.'" title="'.$rank['title'].'" alt="'.$rank['title'].'">';
clean_query_user_cache($uid, array('rank_link'));
$this->sendMessage($data, $content);
//写入数据库
$model = D('Weibo/Weibo');
$result = $model->addWeibo(is_login(), $content1);
}
}
$this->success($is_Edit ? '编辑关联成功' : '添加关联成功', U('Rank/userRankList?id=' . $uid));
} else {
if (!$id) {
$this->error('请选择要修改的头衔关联');
}
$data = D('rank_user')->where('id=' . $id)->find();
if (!$data) {
$this->error('该头衔关联不存在');
}
$ranks = D('rank')->select();
if (!$ranks) {
$this->error('还没有头衔,请先添加头衔');
}
foreach ($ranks as $val) {
$rank_ids[$val['id']] = $val['title'];
}
$builder = new AdminConfigBuilder();
$builder->title('编辑头衔关联')->keyId()->keyReadOnly('uid', '用户ID')->keyText('reason', '关联理由')->keyRadio('is_show', '是否显示在昵称右侧', null, array(1 => '是', 0 => '否'))->keySelect('rank_id', '头衔编号', null, $rank_ids)->data($data)->buttonSubmit(U('userChangeRank'))->buttonBack()->display();
}
}
示例10: setVerifyStatus
public function setVerifyStatus($ids, $status)
{
$model_user = D('rankUser');
$model = D('rank');
if ($status == 1) {
foreach ($ids as $val) {
$rank_user = $model_user->where(array('id' => $val))->field('uid,rank_id,reason')->find();
$rank = $model->where(array('id' => $rank_user['rank_id']))->find();
$content = '管理员通过了你的头衔申请:[' . $rank['title'] . ']';
$user = query_user(array('username', 'space_link'), $rank_user['uid']);
$content1 = '管理员通过了@' . $user['username'] . ' 的头衔申请:[' . $rank['title'] . '],申请理由:' . $rank_user['reason'];
clean_query_user_cache($rank_user['uid'], array('rank_link'));
$this->sendMessage($rank_user, $content, '头衔申请审核通过');
}
} else {
if ($status = -1) {
foreach ($ids as $val) {
$rank_user = $model_user->where(array('id' => $val))->field('uid,rank_id')->find();
$rank = $model->where(array('id' => $rank_user['rank_id']))->find();
$content = '管理员驳回了你的头衔申请:[' . $rank['title'] . ']';
$this->sendMessage($rank_user, $content, '头衔申请审核不通过');
}
}
}
$builder = new AdminListBuilder();
$builder->doSetStatus('rankUser', $ids, $status);
}
示例11: unbindMobile
public function unbindMobile($verify)
{
$uid = $this->getUid();
clean_query_user_cache($uid, 'mobile');
$this->requireLogin();
//确认用户已经绑定手机
$model = D('User/UcenterMember');
$user = $model->where(array('id' => $this->getUid()))->find();
if (!$user['mobile']) {
$this->apiError(1901, "您尚未绑定手机");
}
//确认被验证的手机号码与用户绑定的手机号相符
$mobile = getMobileFromSession();
if ($mobile != $user['mobile']) {
$this->apiError(1902, "验证的手机与绑定的手机不符合");
}
//确认验证码正确
$addon = new TianyiAddon();
if (!$addon->checkVerify($mobile, $verify)) {
$this->apiError(1903, "手机验证码错误");
}
//写入数据库
$model->where(array('uid' => $uid))->save(array('mobile' => ''));
//返回成功结果
$this->apiSuccess("解绑成功");
}
示例12: update
public function update()
{
//$Api = new UserApi();
$model = D('Member');
$uid = I('post.uid');
$username = I('post.username');
$email = I('post.email');
$nickname = I('post.nickname');
$mroleId = I('post.mroleId', 0);
$roleId = I('post.roleId', 0);
$score = I('post.score', 0);
$data = array('nickname' => $nickname, 'username' => $username, 'email' => $email, 'uid' => $uid, 'score' => $score, 'id' => $uid);
if ($roleId == 0) {
M('role_user')->delete($uid);
}
if ($mroleId == 0) {
M('mrole_user')->delete($uid);
}
$res = callApi('Public/updateUser', array($uid, $data));
if (!$res['success']) {
$this->mtReturn(300, $res['message']);
} else {
$this->after_update($uid, $roleId, $mroleId);
clean_query_user_cache($uid, array('nickname', 'email', 'username'));
$this->mtReturn(200, '编辑成功');
}
/*
if (false === $data1= $model->create()) {
$this->mtReturn(300, $model->getError());
}
if(false !== D('Member')->save($data1)){
$data=array(
'id'=>$uid,
'username'=>$username,
'email'=>$email
);
$res = $Api->updateInfo($uid, 'admin', $data);
if ($res['status']) {
$this->_after_update($uid);
clean_query_user_cache($uid,array('nickname','email','username'));
$this->mtReturn(200,'编辑成功');
} else {
$this->mtReturn(300,$res['info']);
}
}else{
$this->mtReturn(300,'编辑失败');
}*/
}
示例13: addFollow
public function addFollow($who_follow, $follow_who, $invite = 0)
{
$follow['who_follow'] = $who_follow;
$follow['follow_who'] = $follow_who;
if ($follow['who_follow'] == $follow['follow_who']) {
//禁止关注和被关注都为同一个人的情况。
return 0;
}
if ($this->where($follow)->count() > 0) {
return 0;
}
$follow = $this->create($follow);
clean_query_user_cache($follow_who, 'fans');
clean_query_user_cache($who_follow, 'following');
S('atUsersJson_' . $who_follow, null);
/**
* @param $to_uid 接受消息的用户ID
* @param string $content 内容
* @param string $title 标题,默认为 您有新的消息
* @param $url 链接地址,不提供则默认进入消息中心
* @param $int $from_uid 发起消息的用户,根据用户自动确定左侧图标,如果为用户,则左侧显示头像
* @param int $type 消息类型,0系统,1用户,2应用
*/
$user = query_user(array('id', 'nickname', 'space_url'), $who_follow);
if ($invite) {
if ($who_follow < $follow_who) {
$content = '邀请者 ' . $user['nickname'] . ' 关注了你。';
} else {
$content = '你邀请的用户 ' . $user['nickname'] . ' 关注了你。';
}
} else {
if ($who_follow < $follow_who) {
$content = '系统推荐用户 ' . $user['nickname'] . ' 关注了你。';
} else {
$content = '新入住用户 ' . $user['nickname'] . ' 关注了你。';
}
}
M('Message')->sendMessage($follow_who, '粉丝数增加', $content, 'Ucenter/Index/index', array('uid' => $who_follow), $who_follow);
return $this->add($follow);
}
示例14: artadd
public function artadd()
{
if (IS_POST) {
$input = new \OT\Input();
$input->noGPC();
$uid = $_SESSION['cs_home']['user_auth']['uid'];
if (!$uid > 0) {
$this->error('请先登录');
}
if (false === ($data = D('Article')->create())) {
$this->error(D('Article')->getError());
}
if ($data['cid'] == null) {
$this->error('分类为空');
}
$data['description'] = op_h(I('description'));
if (mb_strlen(op_h($data['description']), 'utf-8') < 30) {
$this->error('文章内容必须大于30字');
}
if (mb_strlen($data['title'], 'utf-8') > 80) {
$this->error('文章标题必须小于80字');
}
foreach ($data['tag'] as $key => $vo) {
$data['tag'][$key] = mb_substr($vo, 0, 15, 'utf-8');
}
D('Tags')->InsertTags($data['tag'], 1);
$data['tag'] = implode(',', $data['tag']);
//$this->apiError(0,$data['description']);
//$data['description']=$data['description'];
$data['title'] = op_t($data['title']);
$data['uid'] = $uid;
$status = $data['status'];
$data['copyright'] = str_replace('{title}', $data['title'], $data['copyright']);
$data['copyright'] = str_replace('{url}', $_SERVER["HTTP_HOST"], $data['copyright']);
$data['copyright'] = str_replace('{name}', C('WEB_SITE'), $data['copyright']);
//保存当前数据对象
$list = D('Article')->add($data);
if ($list !== false) {
if ($status == 1) {
setuserscore($uid, C('ARTSCORE'));
}
clean_query_user_cache($uid, array('artnum'));
$this->success('添加文章成功!', U('Ucenter/userart'));
} else {
$this->error('添加文章失败!');
}
} else {
$uid = is_login();
//判断如果是后台管理员则不受限制
if (is_admin($uid) == false) {
$roleauth = getmroleauth($uid);
// $setting['exts'] =$roleauth['fileext'];
$extsarr = explode(',', $roleauth['fileext']);
if (!empty($extsarr)) {
$extstr = '';
foreach ($extsarr as $key1 => $vo1) {
$extstr .= '*.' . $vo1 . ';';
}
$this->assign('extstr', $extstr);
}
if ($roleauth['yesart'] != 1) {
$this->error('你无权投稿!');
}
}
$this->display();
}
}
示例15: saveAvatar
/**
* saveAvatar 保存头像
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function saveAvatar()
{
$aCrop = I('post.crop', '', 'op_t');
$aUid = session('temp_login_uid') ? session('temp_login_uid') : is_login();
$aExt = I('post.ext', '', 'op_t');
if (empty($aCrop)) {
$this->success('保存成功!', session('temp_login_uid') ? U('Ucenter/member/step', array('step' => get_next_step('change_avatar'))) : 'refresh');
}
$dir = './Uploads/Avatar/' . $aUid;
$dh = opendir($dir);
while ($file = readdir($dh)) {
if ($file != "." && $file != ".." && $file != 'original.' . $aExt) {
$fullpath = $dir . "/" . $file;
if (!is_dir($fullpath)) {
unlink($fullpath);
} else {
deldir($fullpath);
}
}
}
closedir($dh);
A('Ucenter/UploadAvatar', 'Widget')->cropPicture($aUid, $aCrop, $aExt);
$res = M('avatar')->where(array('uid' => $aUid))->save(array('uid' => $aUid, 'status' => 1, 'is_temp' => 0, 'path' => "/" . $aUid . "/crop." . $aExt, 'create_time' => time()));
if (!$res) {
M('avatar')->add(array('uid' => $aUid, 'status' => 1, 'is_temp' => 0, 'path' => "/" . $aUid . "/crop." . $aExt, 'create_time' => time()));
}
clean_query_user_cache($aUid, array('avatar256', 'avatar128', 'avatar64'));
$this->success('头像更新成功!', session('temp_login_uid') ? U('Ucenter/member/step', array('step' => get_next_step('change_avatar'))) : 'refresh');
}