本文整理汇总了PHP中set_user_status函数的典型用法代码示例。如果您正苦于以下问题:PHP set_user_status函数的具体用法?PHP set_user_status怎么用?PHP set_user_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_user_status函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: reply
function reply($dataArr, $keywordArr = array())
{
$config = getAddonConfig('Juhe');
// 获取后台插件的配置参数
if ($keywordArr['keyword'] == '股票') {
if ($dataArr['Content'] == $keywordArr['keyword']) {
set_user_status('Juhe', $keywordArr);
$this->replyText('请输入股票编号,上海股市以sh开头,深圳股市以sz开头如:sh601009');
} else {
$url = 'http://web.juhe.cn:8080/finance/stock/hs?gid=' . $dataArr['Content'] . '&key=' . $config['stock'];
$content = file_get_contents($url);
$content = json_decode($content, true);
$content = $content['result'][0]['dapandata'];
if (empty($content)) {
$this->replyText('股票编号不对');
return false;
}
$str = "名称: " . $content['name'] . "\n当前点数: " . $content['dot'] . "\n当前价格: " . $content['nowPic'] . "\n涨跌率: " . $content['rate'] . "\n成交量: " . $content['traNumber'] . "手\n成交金额: " . $content['traAmount'] . "万元\r\n";
$str .= '如需查询其它股票,请在菜单再次点击"股票查询"重新进入查询';
$this->replyText($str);
}
} elseif ($keywordArr['keyword'] == '黄金') {
if ($dataArr['Content'] == $keywordArr['keyword']) {
$url = 'http://web.juhe.cn:8080/finance/gold/shgold?key=' . $config['gold'];
$content = file_get_contents($url);
addWeixinLog($content, $url);
$content = json_decode($content, true);
$keywordArr['content'] = $content['result'][0];
$str = "请输入以下列表前的编号查询,如要查询品种为 Ag(T+D)的情况,回复:1\r\n";
$accept['type'] = 'array';
foreach ($keywordArr['content'] as $key => $vo) {
$str .= $key . ': ' . $vo['variety'] . "\n";
$accept['data'][] = $key;
}
$keywordArr['accept'] = $accept;
set_user_status('Juhe', $keywordArr);
$this->replyText($str);
} else {
$vo = $keywordArr['content'][$dataArr['Content']];
$str = "品种: " . $vo['variety'] . "\n最新价: " . $vo['latestpri'] . "\n开盘价: " . $vo['openpri'] . "\n最高价: " . $vo['maxpri'] . "\n最低价: " . $vo['minpri'] . "\n涨跌幅: " . $vo['limit'] . "\n昨收价: " . $vo['yespri'] . "\n总成交量: " . $vo['totalvol'] . "\r\n";
$str .= '如需查询其它黄金品种,请在菜单再次点击"黄金数据"重新进入查询';
$this->replyText($str);
}
} elseif ($keywordArr['keyword'] == '货币汇率') {
$url = 'http://web.juhe.cn:8080/finance/exchange/rmbquot?key=' . $config['exchange'];
$content = file_get_contents($url);
$content = json_decode($content, true);
$content = $content['result'][0];
$str = "货币 : 中间价\r\n";
foreach ($content as $vo) {
$str .= $vo['name'] . ' :' . $vo['bankConversionPri'] . "\n";
}
$this->replyText($str);
}
}
示例2: reply
public function reply($dataArr, $keywordArr = array())
{
// 进入学习模式
if ($dataArr['Content'] == '机器人学习时间') {
// 设置用户状态
$keywordArr['step'] = 'set_question';
set_user_status('Robot', $keywordArr);
$this->replyText('你的问题是?');
return true;
}
// 机器人学习中
if (isset($keywordArr['step'])) {
switch ($keywordArr['step']) {
case 'set_question':
// 判断问题是否已经存在
$map['keyword'] = $dataArr['Content'];
$map['addon'] = 'Robot';
$info = D('Common/Keyword')->where($map)->find();
if ($info) {
$keywordArr['step'] = 'answer_exist';
$keywordArr['question'] = $dataArr['Content'];
set_user_status('Robot', $keywordArr);
$this->replyText('你的问题已经有了答案:“' . $info['extra_text'] . '”,是否需要更新答案?回复”是“更新答案,回答”否“退出学习模式');
} else {
$keywordArr['step'] = 'set_answer';
$keywordArr['question'] = $dataArr['Content'];
set_user_status('Robot', $keywordArr);
$this->replyText('你的答案是?');
}
break;
case 'answer_exist':
if ($dataArr['Content'] == '是') {
$keywordArr['step'] = 'set_answer';
set_user_status('Robot', $keywordArr);
$this->replyText('你的新答案是?');
} else {
$this->replyText('已经退出学习模式');
}
case 'set_answer':
// 把问题和答案保存关键词表中
D('Common/Keyword')->set($keywordArr['question'], 'Robot', 0, 0, $dataArr['Content']);
$this->replyText('我明白啊,不信你可以问问我');
break;
}
}
// 机器人回复
$this->replyText($keywordArr['extra_text']);
}
示例3: cut_off_user
function cut_off_user($id)
{
$status = get_user_status($id);
$event = new SysEvent();
$event->setUserListById($id);
if ($status == 1) {
set_user_status($id, 0);
$event->sendCutOn();
} else {
set_user_status($id, 1);
$event->sendCutOff();
}
}
示例4: ban_account
/**
* ban_account 封停帐号
* @param $item
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
function ban_account($item)
{
set_user_status($item['user_id'], 0);
}
示例5: md5
$md5password = md5(md5(trim($_POST['password'])) . $pwd_hash . $QS_pwdhash);
if ($db->query("UPDATE " . table('members') . " SET password = '{$md5password}' WHERE uid='" . $user_info['uid'] . "'")) {
if (defined('UC_API')) {
include_once QISHI_ROOT_PATH . 'uc_client/client.php';
uc_user_edit($user_info['username'], trim($_POST['password']), trim($_POST['password']), "", 1);
}
$link[0]['text'] = "返回列表";
$link[0]['href'] = $_POST['url'];
adminmsg('操作成功!', 2, $link);
} else {
adminmsg('操作失败!', 1);
}
} elseif ($act == 'userstatus_edit') {
check_token();
check_permissions($_SESSION['admin_purview'], "com_user_edit");
if (set_user_status(intval($_POST['status']), intval($_POST['userstatus_uid']))) {
$link[0]['text'] = "返回列表";
$link[0]['href'] = $_POST['url'];
adminmsg('操作成功!', 2, $link);
} else {
adminmsg('操作失败!', 1);
}
} elseif ($act == 'del_auditreason') {
//check_token();
check_permissions($_SESSION['admin_purview'], "jobs_audit");
//用的是职位审核的权限
$id = !empty($_REQUEST['a_id']) ? $_REQUEST['a_id'] : adminmsg("你没有选择日志!", 1);
$n = reasonaudit_del($id);
if ($n > 0) {
adminmsg("删除成功!共删除 {$n} 行", 2);
} else {
示例6: doActivate
/**
* doActivate 激活步骤
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function doActivate()
{
$aAccount = I('get.account', '', 'op_t');
$aVerify = I('get.verify', '', 'op_t');
$aType = I('get.type', '', 'op_t');
$aUid = I('get.uid', 0, 'intval');
$check = D('Verify')->checkVerify($aAccount, $aType, $aVerify, $aUid);
if ($check) {
set_user_status($aUid, 1);
$this->success('激活成功', U('Ucenter/member/step', array('step' => get_next_step('start'))));
} else {
$this->error('激活失败!');
}
}
示例7: init_ucuser
/**
* 实现的init_ucuser钩子方法,对公众号粉丝进行初始化,在需要初始化粉丝信息的地方通过 hook('init_ucuser',$params); 调用
* @params string $mp_id 公众号在系统中的唯一标识,member_public表的id,必填
* @params string $weObj 公众号实例
* @return void hook函数木有返回值
* 注意:
*/
public function init_ucuser($params)
{
if ($params['mp_id'] && $params['weObj'] instanceof TPWechat) {
//带有公众号在系统中唯一ID,存在公众号实例,例如weixincontroller中的被动响应
$map['openid'] = get_openid();
$map['mp_id'] = $params['mp_id'];
$ucuser = D('Ucuser');
$data = $ucuser->where($map)->find();
if (!$data) {
//公众号没有这个粉丝信息,就注册一个
//先在Member表注册会员,使系统中uid统一,公众号粉丝在绑定手机后可登录网站
$aUsername = $aNickname = $map['openid'];
//substr(,20); //以openid作为默认UcenterMember用户名和Member昵称
$aPassword = UCenterMember()->create_rand();
//随机密码,用户未通过公众号注册,就不可登录网站
$email = $aUsername . '@mp_id' . $map['mp_id'] . '.com';
//以openid@mpid123.com作为默认邮箱
$mobile = arr2str(UCenterMember()->rand_mobile());
//生成随机手机号已通过model校验,不实际使用,准确手机以微信绑定的为准
$aUnType = 5;
//微信公众号粉丝注册
$aRole = 3;
//默认公众号粉丝用户角色
/* 注册用户 */
$uid = UCenterMember()->register($aUsername, $aNickname, $aPassword, $email, $mobile, $aUnType);
if (0 < $uid) {
//注册成功
initRoleUser($aRole, $uid);
//初始化角色用户
set_user_status($uid, 1);
//微信注册的用户状态直接设置为1
} else {
//注册失败,显示错误信息
}
$uid = $ucuser->registerUser($uid, $map['mp_id'], $map['openid']);
//用注册member获取的统一uid注册微信粉丝
get_ucuser_uid($uid);
//设置session中uid
} else {
get_ucuser_uid($data['uid']);
//设置session中uid
}
} else {
//不存在公众号实例或没显式传mp_id参数,例如分享到朋友圈的内容,访问参数中必须带有公众号在系统中唯一标识mp_id
$umap['openid'] = get_openid();
//只存在公众号信息的,在get_openid中通过oauth获取用户openid
$umap['mp_id'] = I('mp_id');
//从controller的访问请求中获取mp_id
if (!empty($umap['mp_id'])) {
$ucuser = D('Ucuser');
$data = $ucuser->where($umap)->find();
if (!$data) {
//公众号没有这个粉丝信息,就注册一个
//先在Member表注册会员,使系统中uid统一,公众号粉丝在绑定手机后可登录网站
$aUsername = $aNickname = $umap['openid'];
//以openid作为默认UcenterMember用户名和Member昵称
$aPassword = UCenterMember()->create_rand();
//随机密码,用户未通过公众号注册,就不可登录网站
$email = $aUsername . '@mp_id' . $umap['mp_id'] . 'com';
//以openid@mpid123.com作为默认邮箱
$mobile = arr2str(UCenterMember()->rand_mobile());
//生成随机手机号已通过model校验,不实际使用,准确手机以微信绑定的为准
$aUnType = 5;
//微信公众号粉丝注册
$aRole = 3;
//默认公众号粉丝用户角色
/* 注册用户 */
$uid = UCenterMember()->register($aUsername, $aNickname, $aPassword, $email, $mobile, $aUnType);
if (0 < $uid) {
//注册成功
initRoleUser($aRole, $uid);
//初始化角色用户
set_user_status($uid, 1);
//微信注册的用户状态直接设置为1
} else {
//注册失败,显示错误信息
}
$uid = $ucuser->registerUser($uid, $umap['mp_id'], $umap['openid']);
//用注册member获取的统一uid注册微信粉丝
get_ucuser_uid($uid);
//设置session中uid
} else {
get_ucuser_uid($data['uid']);
//设置session中uid
}
} else {
//没有公众号信息,未能初始化粉丝
}
}
}
示例8: doActivate
/**
* doActivate 激活步骤
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function doActivate()
{
$aAccount = I('get.account', '', 'op_t');
$aVerify = I('get.verify', '', 'op_t');
$aType = I('get.type', '', 'op_t');
$aUid = I('get.uid', 0, 'intval');
$check = D('Verify')->checkVerify($aAccount, $aType, $aVerify, $aUid);
if ($check) {
set_user_status($aUid, 1);
$this->success(L('_SUCCESS_ACTIVE_'), U('Ucenter/member/step', array('step' => get_next_step('start'))));
} else {
$this->error(L('_FAIL_ACTIVE_') . L('_EXCLAMATION_'));
}
}
示例9: get_ucuser_uid
function get_ucuser_uid($uid = 0)
{
$mp_id = get_mpid();
if ($uid !== NULL) {
session('uid_' . $mp_id, $uid);
} elseif (!empty($_REQUEST['uid'])) {
session('uid_' . $mp_id, $_REQUEST['uid']);
}
//以上是带uid参数调用函数时设置session中的uid
$uid = session('uid_' . $mp_id);
$isWeixinBrowser = isWeixinBrowser();
if (!$isWeixinBrowser) {
//非微信浏览器返回false,调用此函数必须对false结果进行判断,非微信浏览器不可访问调用的controller
return false;
}
//下面这段应该逻辑没问题,如果公众号配置信息错误或者没有snsapi_base作用域的获取信息权限可能会出现死循环,注释掉以下if可治愈
if ($uid <= 0 && $isWeixinBrowser) {
$map['openid'] = get_openid();
$map['mp_id'] = $mp_id;
$ucuser = D('Ucuser');
$data = $ucuser->where($map)->find();
if (!$data) {
//公众号没有这个粉丝信息,就注册一个
//先在Member表注册会员,使系统中uid统一,公众号粉丝在绑定手机后可登录网站
//先在Member表注册会员,使系统中uid统一,公众号粉丝在绑定手机后可登录网站
$aUsername = $aNickname = $map['openid'];
//以openid作为默认UcenterMember用户名和Member昵称
$aPassword = UCenterMember()->create_rand();
//随机密码,用户未通过公众号注册,就不可登录网站
$email = $aUsername . '@mp_id' . $map['mp_id'] . '.com';
//以openid@mpid123.com作为默认邮箱
$mobile = arr2str(UCenterMember()->rand_mobile());
//生成随机手机号以通过model校验,不实际使用,准确手机以微信绑定的为准
$aUnType = 5;
//微信公众号粉丝注册
$aRole = 3;
//默认公众号粉丝用户角色
/* 注册用户 */
$uid = UCenterMember()->register($aUsername, $aNickname, $aPassword, $email, $mobile, $aUnType);
if (0 < $uid) {
//注册成功
initRoleUser($aRole, $uid);
//初始化角色用户
set_user_status($uid, 1);
//微信注册的用户状态直接设置为1
} else {
//注册失败,显示错误信息
}
$uid = $ucuser->registerUser($uid, $map['mp_id'], $map['openid']);
//用注册member获取的统一uid注册微信粉丝
session('uid_' . $mp_id, $uid);
} else {
$uid = $data['uid'];
session('uid_' . $mp_id, $uid);
}
}
if (empty($uid)) {
return -1;
}
return $uid;
}
示例10: register
public function register()
{
if (!modC('REG_SWITCH', '', 'USERCONFIG')) {
$this->apiError('注册已关闭');
}
//获取参数
$aUsername = $username = I('username', '', 'op_t');
$aNickname = I('nickname', '', 'op_t');
$aPassword = I('password', '', 'op_t');
$aVerify = I('verify', '', 'op_t');
$aRegVerify = I('reg_verify', 0, 'intval');
$aRegType = I('reg_type', '', 'op_t');
$aRole = I('role', '', 'op_t');
$aType = I('type', '', 'op_t');
//注册用户
$return = check_action_limit('reg', 'ucenter_member', 1, 1, true);
if ($return && !$return['state']) {
$this->apiError($return['info']);
}
/* 检测验证码 */
if (check_verify_open('reg')) {
if (!check_verify($aVerify)) {
$this->apiError('验证码输入错误。');
}
}
if (!$aRole) {
$this->apiError('请选择角色。');
}
if ($aRegType == 'mobile' && modC('MOBILE_VERIFY_TYPE', 0, 'USERCONFIG') == 1 || modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 2 && $aRegType == 'email') {
if (!D('Verify')->checkVerify($aUsername, $aRegType, $aRegVerify, 0)) {
$str = $aRegType == 'mobile' ? '手机' : '邮箱';
$this->apiError($str . '验证失败');
}
}
$aUnType = 0;
//获取注册类型
check_username($aUsername, $email, $mobile, $aUnType);
if ($aRegType == 'email' && $aUnType != 2) {
$this->apiError('邮箱格式不正确');
}
if ($aRegType == 'mobile' && $aUnType != 3) {
$this->apiError('手机格式不正确');
}
if ($aRegType == 'username' && $aUnType != 1) {
$this->apiError('用户名格式不正确');
}
if (!check_reg_type($aUnType)) {
$this->apiError('该类型未开放注册。');
}
$aCode = I('post.code', '', 'op_t');
if (!$this->checkInviteCode($aCode)) {
$this->apiError('非法邀请码!');
}
/* 注册用户 */
$uid = UCenterMember()->register($aUsername, $aNickname, $aPassword, $email, $mobile, $aUnType);
if (0 < $uid) {
//注册成功
$this->initInviteUser($uid, $aCode, $aRole);
$this->initRoleUser($aRole, $uid);
//初始化角色用户
if (modC('EMAIL_VERIFY_TYPE', 0, 'USERCONFIG') == 1 && $aUnType == 2) {
set_user_status($uid, 3);
$verify = D('Verify')->addVerify($email, 'email', $uid);
dump($verify);
$res = $this->sendActivateEmail($email, $verify, $uid);
//发送激活邮件
$this->apiSuccess('注册成功,请登录邮箱进行激活');
}
$uid = UCenterMember()->login($username, $aPassword, $aUnType);
//通过账号密码取到uid
D('Member')->login($uid, false, $aRole);
//登陆
$this->apiSuccess('注册成功,并登陆');
} else {
//注册失败,显示错误信息
$this->apiError($this->showRegError($uid));
}
}
示例11: doActivate
/**
* doActivate 激活步骤
* @author:xjw129xjt(肖骏涛) xjt@ourstu.com
*/
public function doActivate()
{
$aAccount = I('get.account', '', 'op_t');
$aVerify = I('get.verify', '', 'op_t');
$aType = I('get.type', '', 'op_t');
$aUid = I('get.uid', 0, 'intval');
$check = D('Verify')->checkVerify($aAccount, $aType, $aVerify, $aUid);
if ($check) {
set_user_status($aUid, USER_ACTIVE);
$username = Member()->field('username')->where("uid=" . $aUid)->find();
$this->success('激活成功', U('Member/info', array('uid' => $aUid, 'username' => $username['username'])));
} else {
$this->error("激活失败");
}
}