本文整理汇总了PHP中WeAccount类的典型用法代码示例。如果您正苦于以下问题:PHP WeAccount类的具体用法?PHP WeAccount怎么用?PHP WeAccount使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WeAccount类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: respond
public function respond()
{
global $_W;
$rid = $this->rule;
$sql = "SELECT * FROM " . tablename('wxcard_reply') . " WHERE rid = :rid ORDER BY RAND() LIMIT 1";
$reply = pdo_fetch($sql, array(':rid' => $rid));
if (empty($reply)) {
return false;
}
load()->classs('weixin.account');
load()->classs('coupon');
$coupon = new coupon($_W['acid']);
if (is_error($coupon)) {
$this->error($reply, $coupon['message']);
die;
}
$card = $coupon->BuildCardExt($reply['cid']);
if (is_error($card)) {
$this->error($reply, $card['message']);
die;
}
$data = array('touser' => $_W['openid'], 'msgtype' => 'wxcard', 'wxcard' => array('card_id' => $card['card_id'], 'card_ext' => $card['card_ext']));
$acc = WeAccount::create($_W['acid']);
$status = $acc->sendCustomNotice($data);
if (is_error($status)) {
$this->error($reply, $status['message']);
die;
}
if (!empty($reply['success'])) {
return $this->respText($reply['success']);
die;
}
return true;
}
示例2: __construct
function __construct()
{
global $_W, $_GPC;
$this->_fromuser = $_W['fans']['from_user'];
//debug
if ($_SERVER['HTTP_HOST'] == '127.0.0.1') {
$this->_fromuser = 'debug';
}
$this->_weid = $_W['uniacid'];
$account = account_fetch($this->_weid);
$this->_auth2_openid = 'auth2_openid_' . $_W['uniacid'];
$this->_auth2_nickname = 'auth2_nickname_' . $_W['uniacid'];
$this->_auth2_headimgurl = 'auth2_headimgurl_' . $_W['uniacid'];
$this->_appid = '';
$this->_appsecret = '';
$this->_accountlevel = $account['level'];
//是否为高级号
if ($this->_accountlevel == 4) {
$this->_appid = $account['key'];
$this->_appsecret = $account['secret'];
}
if (!empty($this->_appid) && !empty($this->_appsecret)) {
require_once IA_ROOT . '/framework/class/account.class.php';
$acc = WeAccount::create($this->_weid);
$_W['account']['jssdkconfig'] = $acc->getJssdkConfig();
$accountInfo = $acc->fetchAccountInfo();
$_W['account']['access_token'] = $accountInfo['access_token'];
$_W['account']['jsapi_ticket'] = $accountInfo['jsapi_ticket'];
}
}
示例3: doWebChatlog
public function doWebChatlog()
{
global $_GPC, $_W;
load()->func('tpl');
$acids = uni_accounts($_W['uniacid']);
if (!empty($acids)) {
$data = array();
foreach ($acids as $acid) {
if (in_array($acid['level'], array(3, 4))) {
$data[] = $acid;
}
}
}
$starttime = empty($_GPC['starttime']) ? strtotime(date('Y-m-d')) : strtotime($_GPC['starttime']);
if (!empty($_GPC['token'])) {
unset($_GPC['token']);
$avatar = '';
$endtime = $starttime + 23 * 3600 + 3599;
$acid = intval($_GPC['acid']);
if (!empty($_GPC['nickname']) && empty($_GPC['openid'])) {
$user = pdo_fetch('SELECT b.openid,a.avatar FROM ' . tablename('mc_members') . ' AS a LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS b ON a.uid = b.uid WHERE a.nickname = :nickname', array(':nickname' => trim($_GPC['nickname'])));
if (empty($user['openid'])) {
message('没有找到昵称为 "' . $_GPC['nickname'] . '" 的用户', $this->createWebUrl('chatlog', array('acid' => $acid, 'nickname' => $_GPC['nickname'], 'openid' => $_GPC['openid'], 'starttime' => $_GPC['starttime'])), 'error');
} else {
if (!empty($user['avatar'])) {
$avatar = tomedia($user['avatar']);
$nickname = $user['nickname'];
}
}
} else {
$openid = trim($_GPC['openid']);
$user = pdo_fetch('SELECT b.openid,a.avatar,a.nickname FROM ' . tablename('mc_members') . ' AS a LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS b ON a.uid = b.uid WHERE b.openid = :openid', array(':openid' => trim($_GPC['openid'])));
if (!empty($user['avatar'])) {
$avatar = tomedia($user['avatar']);
$nickname = $user['nickname'];
}
}
if ($acid > 0 && !empty($starttime) && !empty($endtime) && !empty($openid)) {
$pindex = max(1, intval($_GPC['page']));
$acc = WeAccount::create($acid);
$params = array('openid' => trim($_GPC['openid']), 'starttime' => $starttime, 'endtime' => $endtime, 'pageindex' => $pindex, 'pagesize' => 1000);
$logs = $acc->fetchChatLog($params);
$next = 1;
if (is_error($logs) || empty($logs['recordlist']) || count($logs['recordlist']) < $params['pagesize']) {
$next = 0;
}
$codedata = array();
$codedata[1000] = '创建未接入会话';
$codedata[1001] = '接入会话';
$codedata[1002] = '主动发起会话';
$codedata[1004] = '关闭会话';
$codedata[1005] = '抢接会话';
$codedata[2001] = '公众号收到消息';
$codedata[2002] = '客服发送消息';
$codedata[2003] = '客服收到消息';
}
}
include $this->template('chatlog');
}
示例4: __construct
public function __construct()
{
global $_W;
$this->account = WeAccount::create($_W['account']);
$this->modules = array_keys($_W['modules']);
$this->modules[] = 'cover';
$this->modules[] = 'default';
$this->modules = array_unique($this->modules);
}
示例5: getAccessToken
public function getAccessToken()
{
global $_W;
load()->model('account');
$acid = $_W['acid'];
if (empty($acid)) {
$acid = $_W['uniacid'];
}
$account = WeAccount::create($acid);
$token = $account->fetch_available_token();
return $token;
}
示例6: doMobileIndex
public function doMobileIndex()
{
global $_W, $_GPC;
$account = account_fetch($_W['uniacid']);
if (!empty($account['key']) && !empty($account['secret'])) {
require_once IA_ROOT . '/framework/class/account.class.php';
$acc = WeAccount::create($_W['uniacid']);
$_W['account']['jssdkconfig'] = $acc->getJssdkConfig();
$accountInfo = $acc->fetchAccountInfo();
$_W['account']['access_token'] = $accountInfo['access_token'];
$_W['account']['jsapi_ticket'] = $accountInfo['jsapi_ticket'];
}
$setting = pdo_fetch("select * from " . tablename($this->modulename . '_setting') . " where weid =:weid LIMIT 1", array(':weid' => $_W['uniacid']));
$share_image = empty($setting['share_image']) ? $_W['siteroot'] . '../addons/weiyun_shuqian/icon.jpg' : tomedia($setting['share_image']);
$share_title = empty($setting['share_title']) ? '数钱数到手抽筋' : $setting['share_title'];
$share_desc = empty($setting['share_desc']) ? '数钱数到手抽筋' : $setting['share_desc'];
$share_url = empty($setting['share_url']) ? $_W['siteroot'] . 'app/' . $this->createMobileUrl('index') : $setting['share_url'];
include $this->template('index');
}
示例7: doMobilelikePage
public function doMobilelikePage()
{
global $_GPC, $_W;
$uniacid = $_W['uniacid'];
$openid = $_W['openid'];
load()->func('logging');
logging_run($openid, '', 'openid');
if (empty($openid)) {
echo "error";
exit;
}
$acid = intval($_W['account']['uniacid']);
$acc = WeAccount::create($acid);
$fan = $acc->fansQueryInfo($_W['openid'], true);
if (intval($fan['errno']) == -1) {
echo "noway";
exit;
}
if ($fan['subscribe'] != '1') {
echo "unsub";
exit;
}
$type = 1;
$result = $this->pic_limit($type);
if ($result) {
echo 'liked';
} else {
$param = array('uniacid' => $uniacid, 'openid' => $openid, 'tousername' => $tousername, 'time' => date("Y-m-d H:i:s", time()), 'picid' => $_GPC['personalPicWallId']);
pdo_insert('ice_picWallLikelist', $param);
$param2 = array(':uniacid' => $uniacid, 'picid' => $_GPC['personalPicWallId']);
$sql = 'SELECT count(openid) FROM ' . tablename('ice_picWallLikelist') . ' WHERE uniacid = :uniacid and picid = :picid';
$column = pdo_fetchcolumn($sql, $param2);
load()->func('logging');
logging_run('点赞数据更新:' . $column, '', 'column');
if (intval($column) > 0) {
pdo_update('ice_picWallMain', array('likenum' => $column), array('id' => $_GPC['personalPicWallId']));
}
echo $column;
}
}
示例8: receive
public function receive()
{
global $_W;
load()->model('mc');
$type = $this->message['type'];
$event = $this->message['event'];
$openid = $this->message['from'];
$config = $this->module['config'];
$acc = WeAccount::create($_W['acid']);
if ($event == 'subscribe' && $config['sub_num'] != 0 && !empty($config['sub_type'])) {
$log = pdo_fetch("SELECT id FROM " . tablename('ju_credit_log') . " WHERE uniacid=:uniacid and openid=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
if (empty($log)) {
$uid = mc_openid2uid($openid);
$result = mc_credit_update($uid, $config['sub_type'], $config['sub_num'], array('0' => '1', '1' => '关注平台奖励'));
if ($result) {
$insert = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'subscribetime' => time(), 'unsubscribetime' => 0, 'follow' => 1);
pdo_insert('ju_credit_log', $insert);
$this->sendText($acc, $this->message['from'], '感谢您的关注,赠送您' . $config['sub_num'] . '!');
}
} else {
pdo_update('ju_credit_log', array('follow' => 1, 'subscribetime' => time()), array('id' => $log['id']));
}
} elseif ($event == 'unsubscribe' && $config['unsub_num'] != 0) {
$log = pdo_fetch("SELECT id FROM " . tablename('ju_credit_log') . " WHERE uniacid=:uniacid and openid=:openid", array(':uniacid' => $_W['uniacid'], ':openid' => $openid));
$uid = mc_openid2uid($openid);
if (empty($log)) {
$result = mc_credit_update($uid, $config['unsub_type'], '-' . $config['unsub_num'], array('0' => '1', '1' => '取消关注平台扣除'));
if ($result) {
$insert = array('uniacid' => $_W['uniacid'], 'openid' => $openid, 'subscribetime' => 0, 'unsubscribetime' => time(), 'follow' => 0);
pdo_insert('ju_credit_log', $insert);
}
} else {
$result = mc_credit_update($uid, $config['unsub_type'], '-' . $config['unsub_num'], array('0' => '1', '1' => '取消关注平台扣除'));
pdo_update('ju_credit_log', array('follow' => 0, 'subscribetime' => 0, 'unsubscribetime' => time()), array('id' => $log['id']));
}
}
}
示例9: base64_encode
$auth = base64_encode(json_encode($pass));
$vars = array();
$vars['__auth'] = $auth;
$vars['forward'] = base64_encode($c['url']);
$row['url'] = $_W['siteroot'] . 'app/' . murl('auth/forward', $vars);
}
$news[] = $row;
}
$send['news']['articles'] = $news;
} else {
$idata = array();
$send['news'] = '';
}
}
if ($acid) {
$acc = WeAccount::create($acid);
$data = $acc->sendCustomNotice($send);
if (is_error($data)) {
exit(json_encode(array('status' => 'error', 'message' => $data['message'])));
} else {
$account = account_fetch($acid);
$message['from'] = $_W['openid'] = $send['touser'];
$message['to'] = $account['original'];
if (!empty($message['to'])) {
$sessionid = md5($message['from'] . $message['to'] . $_W['uniacid']);
load()->classs('wesession');
load()->classs('account');
session_id($sessionid);
WeSession::start($_W['uniacid'], $_W['openid'], 300);
$processor = WeUtility::createModuleProcessor('chats');
$processor->begin(300);
示例10: payResult
public function payResult($params)
{
global $_W;
$fee = intval($params['fee']);
$data = array('status' => $params['result'] == 'success' ? 1 : 0);
$paytype = array('credit' => 1, 'wechat' => 2, 'alipay' => 2, 'delivery' => 3);
$data['pay_type'] = $paytype[$params['type']];
if ($params['result'] == 'success') {
$data['pay_time'] = TIMESTAMP;
}
pdo_update('daijia_orders', $data, array('ordersn' => $params['tid']));
if ($params['from'] == 'return') {
$setting = uni_setting($_W['uniacid'], array('creditbehaviors'));
$credit = $setting['creditbehaviors']['currency'];
//支付成功,打印订单
$order = pdo_fetch("SELECT * FROM " . tablename('daijia_orders') . "where ordersn={$params['tid']}");
//获取所有打印机
$prints = pdo_fetchall('SELECT * FROM ' . tablename('daijia_print') . ' WHERE uniacid = :aid AND status = 1', array(':aid' => $_W['uniacid']));
if (empty($prints)) {
// exit('没有有效的打印机');
}
$paytype = $order['paytype'] == '3' ? '货到付款' : '已付款';
$ordertype = $order['type'] == 'daijia' ? '代驾' : '代劳、代步';
//邮件提醒
$orderinfo = '';
$orderinfo .= '订单编号 起始地址 目的地址 价格 备注<BR>';
$orderinfo .= '--------------------------------<BR>';
$orderInfo .= "{$order['ordersn']}{$order['start_address']}{$order['end_address']}{$order['price']}{$order['remark']}<br />";
$orderInfo .= '--------------------------------<BR>';
$orderinfo .= "合计:{$order['price']}元<BR>";
$orderinfo .= "联系电话:{$order['mobile']}<BR>";
$orderinfo .= "支付方式:{$paytype}<BR>";
//微信提醒
$sendinfo = '您的订单支付成功,请等待处理:\\n';
$sendinfo .= '--------------------\\n';
$sendinfo .= "{$ordertype}详情:\n";
$sendinfo .= '--------------------\\n';
$sendinfo .= "订单编号:{$order['ordersn']}\n";
$sendinfo .= "起始地址: {$order['start_address']}\n";
$sendinfo .= "目的地址: {$order['end_address']}\n";
$sendinfo .= "备注: {$order['remark']}\n";
$sendinfo .= '--------------------\\n';
$sendinfo .= "合计:{$order['price']}元\n";
$sendinfo .= "联系电话:{$order['mobile']}\n";
$sendinfo .= "支付方式:{$paytype}\n";
//发送微信提醒
$send['msgtype'] = 'text';
$send['text'] = array('content' => urlencode($sendinfo));
$acc = WeAccount::create($_W['account']['acid']);
$send['touser'] = trim($_W['openid']);
$s_mess = $acc->sendCustomNotice($send);
include 'wprint.class.php';
//遍历所有打印机
foreach ($prints as $li) {
if (!empty($li['qrcode_link'])) {
$orderinfo .= "<QR>{$li['qrcode_link']}</QR>";
}
if (!empty($li['print_no']) && !empty($li['key'])) {
$wprint = new wprint();
$status = $wprint->StrPrint($li['print_no'], $li['key'], $orderinfo, 1);
if (!is_error($status)) {
$i++;
$data2 = array('uniacid' => $_W['uniacid'], 'sid' => $sid, 'pid' => $li['id'], 'oid' => $id, 'status' => 1, 'aid' => $status, 'addtime' => TIMESTAMP);
pdo_insert('daijia_order_print', $data2);
}
}
}
// if($i > 0) {
// pdo_query('UPDATE ' . tablename('str_order') . " SET print_nums = print_nums + {$i} WHERE uniacid = {$_W['uniacid']} AND id = {$id}");
// } else {
// exit('发送打印指令失败。没有有效的机器号');
// }
// exit('success');
//打印结束
if ($params['type'] == $credit) {
message('支付成功!', $this->createMobileUrl('daijia', array('op' => 'yes')), 'success');
} else {
message('支付成功!', '../../app/' . $this->createMobileUrl('daijia', array('op' => 'yes')), 'success');
}
}
}
示例11: sendtempmsg
public function sendtempmsg($template_id, $url, $data, $topcolor, $tousers = '')
{
load()->func('communication');
load()->classs('weixin.account');
$access_token = WeAccount::token();
if (empty($access_token)) {
return;
}
$postarr = '{"touser":"' . $tousers . '","template_id":"' . $template_id . '","url":"' . $url . '","topcolor":"' . $topcolor . '","data":' . $data . '}';
$res = ihttp_post('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token, $postarr);
return true;
}
示例12: doWebhotelset
public function doWebhotelset()
{
global $_GPC, $_W;
$acc = WeAccount::create($_W['acid']);
$id = intval($_GPC['id']);
if (checksubmit('submit')) {
$data = array('weid' => $_W['uniacid'], 'location_p' => $_GPC['district']['province'], 'location_c' => $_GPC['district']['city'], 'location_a' => $_GPC['district']['district'], 'version' => $_GPC['version'], 'user' => $_GPC['user'], 'reg' => $_GPC['reg'], 'regcontent' => $_GPC['regcontent'], 'bind' => $_GPC['bind'], 'ordertype' => $_GPC['ordertype'], 'paytype1' => $_GPC['paytype1'], 'paytype2' => $_GPC['paytype2'], 'paytype3' => $_GPC['paytype3'], 'is_unify' => $_GPC['is_unify'], 'tel' => $_GPC['tel'], 'email' => $_GPC['email'], 'mobile' => $_GPC['mobile'], 'template' => $_GPC['template'], 'templateid' => trim($_GPC['templateid']));
if ($data['template'] && $data['templateid'] == '') {
message('请输入模板ID', referer(), 'info');
}
if (!empty($id)) {
pdo_update("hotel2_set", $data, array("id" => $id));
} else {
pdo_insert("hotel2_set", $data);
}
message("保存设置成功!", referer(), "success");
}
$sql = 'SELECT * FROM ' . tablename('hotel2_set') . ' WHERE `weid` = :weid';
$set = pdo_fetch($sql, array(':weid' => $_W['uniacid']));
if (empty($set)) {
$set = array('user' => 1, 'reg' => 1, 'bind' => 1);
}
include $this->template("hotelset");
}
示例13: header
$oauth_account = WeAccount::create($_W['account']['oauth']);
$forward = $oauth_account->getOauthCodeUrl($callback, $state);
header('Location: ' . $forward);
exit;
}
}
$_W['account']['groupid'] = $_W['uniaccount']['groupid'];
$_W['account']['qrcode'] = tomedia('qrcode_' . $_W['acid'] . '.jpg') . '?time=' . $_W['timestamp'];
$_W['account']['avatar'] = tomedia('headimg_' . $_W['acid'] . '.jpg') . '?time=' . $_W['timestamp'];
if ($_W['container'] == 'wechat') {
if ($_W['account']['level'] < 3) {
if (!empty($unisetting['jsauth_acid'])) {
$jsauth_acid = $unisetting['jsauth_acid'];
} elseif (!empty($unisetting['oauth']['account'])) {
$jsauth_acid = $unisetting['oauth']['account'];
}
} else {
$jsauth_acid = $_W['acid'];
}
if (!empty($jsauth_acid)) {
$accountObj = WeAccount::create($jsauth_acid);
$_W['account']['jssdkconfig'] = $accountObj->getJssdkConfig();
$_W['account']['jsauth_acid'] = $jsauth_acid;
}
unset($jsauth_acid, $accountObj);
}
$_W['card_permission'] = 0;
if ($_W['acid'] && $_W['account']['level'] >= 3 && $_W['container'] == 'wechat') {
$_W['card_permission'] = 1;
}
load()->func('compat.biz');
示例14: defined
/**
* [WeEngine System] Copyright (c) 2014 WE7.CC
* WeEngine is NOT a free software, it under the license terms, visited http://www.we7.cc/ for more details.
*/
defined('IN_IA') or exit('Access Denied');
$dos = array('display', 'change', 'qr', 'chat');
$do = !empty($_GPC['do']) && in_array($do, $dos) ? $do : 'display';
load()->model('account');
if ($do == 'display') {
template('platform/url2qr');
}
if ($do == 'change') {
if ($_W['ispost']) {
load()->func('communication');
$longurl = trim($_GPC['longurl']);
$token = WeAccount::token(WeAccount::TYPE_WEIXIN);
$url = "https://api.weixin.qq.com/cgi-bin/shorturl?access_token={$token}";
$send = array();
$send['action'] = 'long2short';
$send['long_url'] = $longurl;
$response = ihttp_request($url, json_encode($send));
if (is_error($response)) {
$result = error(-1, "访问公众平台接口失败, 错误: {$response['message']}");
}
$result = @json_decode($response['content'], true);
if (empty($result)) {
$result = error(-1, "接口调用失败, 元数据: {$response['meta']}");
} elseif (!empty($result['errcode'])) {
$result = error(-1, "访问微信接口错误, 错误代码: {$result['errcode']}, 错误信息: {$result['errmsg']}");
}
if (is_error($result)) {
示例15: getVailableAccessToken
public function getVailableAccessToken()
{
$accounts = pdo_fetchall("SELECT `key`, `secret`, `acid` FROM " . tablename('account_wechats') . " WHERE uniacid = :uniacid ORDER BY `level` DESC ", array(':uniacid' => $GLOBALS['_W']['uniacid']));
if (empty($accounts)) {
return error(-1, 'no permission');
}
foreach ($accounts as $account) {
if (empty($account['key']) || empty($account['secret'])) {
continue;
}
$acid = $account['acid'];
break;
}
$account = WeAccount::create($acid);
return $account->getAccessToken();
}