本文整理匯總了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("激活失敗");
}
}