コード例 #1
0
ファイル: processor.php プロジェクト: zhang19960118/html11
 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
0
ファイル: site.php プロジェクト: keycoolkui/weixinfenxiao
 function __construct()
 {
     global $_W, $_GPC;
     $this->_fromuser = $_W['fans']['from_user'];
     //debug
     if ($_SERVER['HTTP_HOST'] == '127.0.0.1') {
         $this->_fromuser = '******';
     }
     $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
0
ファイル: site.php プロジェクト: legeng/project-2
 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
0
ファイル: api.php プロジェクト: ChainBoy/wxfx
 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
0
 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
0
ファイル: site.php プロジェクト: keycoolkui/weixinfenxiao
 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
0
ファイル: site.php プロジェクト: wisemyth/weizan
 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
0
ファイル: receiver.php プロジェクト: aspnmy/weizan
 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
0
ファイル: notice.ctrl.php プロジェクト: nsoff/wdlcms
                 $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
0
ファイル: site.php プロジェクト: noikiy/mygit
 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
0
ファイル: site.php プロジェクト: eduNeusoft/weixin
 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":"******","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
0
ファイル: site.php プロジェクト: aspnmy/weizan
 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
0
ファイル: bootstrap.app.inc.php プロジェクト: aspnmy/weizan
        $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
0
ファイル: url2qr.ctrl.php プロジェクト: legeng/project-2
/**
 * [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
0
ファイル: weixin.account.class.php プロジェクト: noikiy/mygit
 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();
 }
コード例 #16
0
ファイル: mc.mod.php プロジェクト: wisemyth/weizan
function mc_notice_init()
{
    global $_W;
    if (empty($_W['account'])) {
        $_W['account'] = uni_fetch($_W['uniacid']);
    }
    if (empty($_W['account'])) {
        return error(-1, '创建公众号操作类失败');
    }
    if ($_W['account']['level'] < 3) {
        return error(-1, '公众号没有经过认证,不能使用模板消息和客服消息');
    }
    $acc = WeAccount::create();
    if (is_null($acc)) {
        return error(-1, '创建公众号操作对象失败');
    }
    $setting = uni_setting();
    $noticetpl = $setting['tplnotice'];
    $acc->noticetpl = $noticetpl;
    if (!is_array($acc->noticetpl)) {
        return error(-1, '微信通知参数错误');
    }
    return $acc;
}
コード例 #17
0
ファイル: site.php プロジェクト: ChainBoy/wxfx
 public function checkSubscribe()
 {
     global $_W;
     session_start();
     if (empty($_W['openid']) || empty($_W['acid'])) {
         return false;
     }
     if (empty($_SESSION['__:subscribe'])) {
         $account = WeAccount::create($_W['acid']);
         if (!empty($account)) {
             $ainfo = $account->fetchAccountInfo();
             if (!empty($ainfo['secret']) && !empty($ainfo['key'])) {
                 $fans = $account->fansQueryInfo($_W['openid']);
                 if (!is_error($fans) && !empty($fans) && !empty($fans['subscribe'])) {
                     $_SESSION['__:subscribe'] = true;
                     return true;
                 }
             } else {
                 $_SESSION['__:subscribe'] = true;
                 return true;
             }
         }
     } else {
         return true;
     }
     return false;
 }
コード例 #18
0
    }
} else {
    if (isset($avatar) && isset($nickname) && isset($from_user)) {
        $shareuserdata = $_W['siteroot'] . 'app/' . $this->createMobileUrl('shareuserdata', array('rid' => $rid, 'fromuser' => $fromuser, 'duli' => $_GPC['duli'], 'tfrom_user' => $tfrom_user));
        header("location:{$shareuserdata}");
        exit;
    } else {
        $from_user = $_W['openid'];
        if ($from_user) {
            //取得openid后查询是否为高级号
            if ($serverapp == 4) {
                //认证服务号查询是否关注
                $profile = pdo_fetch("SELECT follow FROM " . tablename('mc_mapping_fans') . " WHERE uniacid = :uniacid and openid = :from_user", array(':uniacid' => $uniacid, ':from_user' => $from_user));
                if ($_W['fans']['follow'] || $profile['follow']) {
                    //已关注直接获取信息
                    $access_token = WeAccount::token();
                    $oauth2_url = "https://api.weixin.qq.com/cgi-bin/user/info?access_token=" . $access_token . "&openid=" . $from_user . "&lang=zh_CN";
                    $content = ihttp_get($oauth2_url);
                    $info = @json_decode($content['content'], true);
                    if (empty($info) || !is_array($info) || empty($info['openid']) || empty($info['nickname'])) {
                        echo '<h1>分享获取微信公众号授权失败[无法取得info], 请稍后重试! 公众平台返回原始数据为: <br />' . $content['meta'] . '<h1>';
                        exit;
                    } else {
                        $avatar = $info['headimgurl'];
                        $nickname = $info['nickname'];
                        $sex = $info['sex'];
                        //设置cookie信息
                        setcookie("user_oauth2_avatar", $avatar, time() + 3600 * 24 * 7);
                        setcookie("user_oauth2_nickname", $nickname, time() + 3600 * 24 * 7);
                        setcookie("user_oauth2_sex", $sex, time() + 3600 * 24 * 7);
                        setcookie("user_oauth2_openid", $from_user, time() + 3600 * 24 * 7);
コード例 #19
0
ファイル: model.php プロジェクト: ChainBoy/wxfx
 public function getQR($poster, $member, $goodsid = 0)
 {
     global $_W, $_GPC;
     $acid = $_W['acid'];
     if ($poster['type'] == 1) {
         $qrimg = m('qrcode')->createShopQrcode($member['id'], $poster['id']);
         $qr = pdo_fetch('select * from ' . tablename('ewei_shop_poster_qr') . ' where openid=:openid and acid=:acid and type=:type limit 1', array(':openid' => $member['openid'], ':acid' => $_W['acid'], ':type' => 1));
         if (empty($qr)) {
             $qr = array('acid' => $acid, 'openid' => $member['openid'], 'type' => 1, 'qrimg' => $qrimg);
             pdo_insert('ewei_shop_poster_qr', $qr);
             $qr['id'] = pdo_insertid();
         }
         $qr['current_qrimg'] = $qrimg;
         return $qr;
     } else {
         if ($poster['type'] == 2) {
             $p = p('commission');
             if ($p) {
                 $qrimg = $p->createMyShopQrcode($member['id'], $poster['id']);
                 $qr = pdo_fetch('select * from ' . tablename('ewei_shop_poster_qr') . ' where openid=:openid and acid=:acid and type=:type limit 1', array(':openid' => $member['openid'], ':acid' => $_W['acid'], ':type' => 2));
                 if (empty($qr)) {
                     $qr = array('acid' => $acid, 'openid' => $member['openid'], 'type' => 2, 'qrimg' => $qrimg);
                     pdo_insert('ewei_shop_poster_qr', $qr);
                     $qr['id'] = pdo_insertid();
                 }
                 $qr['current_qrimg'] = $qrimg;
                 return $qr;
             }
         } else {
             if ($poster['type'] == 3) {
                 $qrimg = m('qrcode')->createGoodsQrcode($member['id'], $goodsid, $poster['id']);
                 $qr = pdo_fetch('select * from ' . tablename('ewei_shop_poster_qr') . ' where openid=:openid and acid=:acid and type=:type and goodsid=:goodsid limit 1', array(':openid' => $member['openid'], ':acid' => $_W['acid'], ':type' => 3, ':goodsid' => $goodsid));
                 if (empty($qr)) {
                     $qr = array('acid' => $acid, 'openid' => $member['openid'], 'type' => 3, 'goodsid' => $goodsid, 'qrimg' => $qrimg);
                     pdo_insert('ewei_shop_poster_qr', $qr);
                     $qr['id'] = pdo_insertid();
                 }
                 $qr['current_qrimg'] = $qrimg;
                 return $qr;
             } else {
                 if ($poster['type'] == 4) {
                     $uniacccount = WeAccount::create($acid);
                     $qr = pdo_fetch('select * from ' . tablename('ewei_shop_poster_qr') . ' where openid=:openid and acid=:acid and type=4 limit 1', array(':openid' => $member['openid'], ':acid' => $acid));
                     if (empty($qr)) {
                         $sceneid = pdo_fetchcolumn("SELECT qrcid FROM " . tablename('qrcode') . " WHERE acid = :acid and model=2 ORDER BY qrcid DESC LIMIT 1", array(':acid' => $acid));
                         $barcode['action_info']['scene']['scene_id'] = intval($sceneid) + 1;
                         if ($barcode['action_info']['scene']['scene_id'] > 100000) {
                             return error(-1, '抱歉,永久二维码已经生成最大数量,请先删除一些。');
                         }
                         $barcode['action_name'] = 'QR_LIMIT_SCENE';
                         $result = $uniacccount->barCodeCreateFixed($barcode);
                         if (is_error($result)) {
                             return error(-1, "公众平台返回接口错误. <br />错误代码为: {$result['errorcode']} <br />错误信息为: {$result['message']}");
                         }
                         $qrimg = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" . $result['ticket'];
                         $ims_qrcode = array('uniacid' => $_W['uniacid'], 'acid' => $_W['acid'], 'qrcid' => $barcode['action_info']['scene']['scene_id'], "model" => 2, "name" => "EWEI_SHOP_POSTER_QRCODE", "keyword" => 'EWEI_SHOP_POSTER', "expire" => 0, "createtime" => time(), "status" => 1, 'url' => $result['url'], "ticket" => $result['ticket']);
                         pdo_insert('qrcode', $ims_qrcode);
                         $qr = array('acid' => $acid, 'openid' => $member['openid'], 'type' => 4, 'sceneid' => $barcode['action_info']['scene']['scene_id'], 'ticket' => $result['ticket'], 'qrimg' => $qrimg, 'url' => $result['url']);
                         pdo_insert('ewei_shop_poster_qr', $qr);
                         $qr['id'] = pdo_insertid();
                         $qr['current_qrimg'] = $qrimg;
                     } else {
                         $qr['current_qrimg'] = "https://mp.weixin.qq.com/cgi-bin/showqrcode?ticket=" . $qr['ticket'];
                     }
                     return $qr;
                 }
             }
         }
     }
 }
コード例 #20
0
ファイル: site.php プロジェクト: eduNeusoft/weixin
 public function payResult($params)
 {
     global $_W, $_GPC;
     $weid = $this->_weid;
     $orderid = $params['tid'];
     $fee = intval($params['fee']);
     $data = array('status' => $params['result'] == 'success' ? 1 : 0);
     $paytype = array('credit' => '1', 'wechat' => '2', 'alipay' => '2', 'delivery' => '3');
     $data['paytype'] = $paytype[$params['type']];
     if ($params['type'] == 'wechat') {
         $data['dateline'] = TIMESTAMP;
         $paylog = pdo_fetch("SELECT plid FROM " . tablename('core_paylog') . " WHERE uniacid= :uniacid and tid = :tid", array(':uniacid' => $weid, ':tid' => $orderid));
         if (!empty($paylog)) {
             $data['transid'] = $paylog['plid'];
         }
         //            $data['transid'] = $params['tag']['transaction_id'];
     }
     if ($params['type'] == 'delivery') {
         $data['status'] = 1;
     }
     $order = pdo_fetch("SELECT * FROM " . tablename($this->table_order) . " WHERE id = '{$orderid}'");
     $storeid = $order['storeid'];
     pdo_update($this->table_order, $data, array('id' => $orderid));
     if ($params['from'] == 'return') {
         //邮件提醒
         $goods_str = '';
         //本订单产品
         $goods = pdo_fetchall("SELECT a.*,b.title,b.unitname FROM " . tablename($this->table_order_goods) . " as a left join  " . tablename($this->table_goods) . " as b on a.goodsid=b.id WHERE a.weid = '{$weid}' and a.orderid={$orderid}");
         $goods_str = '';
         $goods_tplstr = '';
         $flag = false;
         foreach ($goods as $key => $value) {
             if (!$flag) {
                 $goods_str .= "{$value['title']} 价格:{$value['price']} 数量:{$value['total']}{$value['unitname']}";
                 $goods_tplstr .= "{$value['title']} {$value['total']}{$value['unitname']}";
                 $flag = true;
             } else {
                 $goods_str .= "<br/>{$value['title']} 价格:{$value['price']} 数量:{$value['total']}{$value['unitname']}";
                 $goods_tplstr .= ",{$value['title']} {$value['total']}{$value['unitname']}";
             }
         }
         //发送邮件提醒
         $emailSetting = pdo_fetch("SELECT * FROM " . tablename($this->table_email_setting) . " WHERE weid=:weid AND storeid=:storeid LIMIT 1", array(':weid' => $weid, ':storeid' => $storeid));
         $email_tpl = $emailSetting['email_business_tpl'];
         //您有新的订单:[sn],收货人:[name],菜单:[goods],电话:[tel],请及时确认订单!
         $email_tpl = "\r\n        您有新订单:<br/>\r\n        所属门店:[store]<br/>\r\n        单号[sn] 总数量:[totalnum] 总价:[totalprice]<br/>\r\n        菜单:[goods]<br/>\r\n        姓名:[name]<br/>\r\n        电话:[tel]<br/>\r\n        桌号:[tables]<br/>\r\n        备注:[remark]\r\n        ";
         if ($order['dining_mode'] == 2) {
             $email_tpl = "\r\n        您有新订单:<br/>\r\n        所属门店:[store]<br/>\r\n        单号[sn] 总数量:[totalnum] 总价:[totalprice]<br/>\r\n        收货人:[name]<br/>\r\n        送达时间:[mealtime]<br/>\r\n        菜单:<br/>[goods]<br/>\r\n        电话:[tel]<br/>\r\n        地址:[address]<br>\r\n        备注:[remark]\r\n        ";
         }
         $smsStatus = '';
         //发送短信提醒
         $smsSetting = pdo_fetch("SELECT * FROM " . tablename($this->table_sms_setting) . " WHERE weid=:weid AND storeid=:storeid LIMIT 1", array(':weid' => $weid, ':storeid' => $storeid));
         $sendInfo = array();
         if (!empty($smsSetting)) {
             if ($smsSetting['sms_enable'] == 1 && !empty($smsSetting['sms_mobile'])) {
                 //模板
                 if (empty($smsSetting['sms_business_tpl'])) {
                     $smsSetting['sms_business_tpl'] = '您有新的订单:[sn],收货人:[name],电话:[tel],请及时确认订单!';
                 }
                 //订单号
                 $smsSetting['sms_business_tpl'] = str_replace('[sn]', $order['ordersn'], $smsSetting['sms_business_tpl']);
                 //用户名
                 $smsSetting['sms_business_tpl'] = str_replace('[name]', $order['username'], $smsSetting['sms_business_tpl']);
                 //就餐时间
                 $smsSetting['sms_business_tpl'] = str_replace('[date]', $order['meal_time'], $smsSetting['sms_business_tpl']);
                 //电话
                 $smsSetting['sms_business_tpl'] = str_replace('[tel]', $order['tel'], $smsSetting['sms_business_tpl']);
                 $smsSetting['sms_business_tpl'] = str_replace('[totalnum]', $order['totalnum'], $smsSetting['sms_business_tpl']);
                 $smsSetting['sms_business_tpl'] = str_replace('[totalprice]', $order['totalprice'], $smsSetting['sms_business_tpl']);
                 $smsSetting['sms_business_tpl'] = str_replace('[address]', $order['address'], $smsSetting['sms_business_tpl']);
                 $smsSetting['sms_business_tpl'] = str_replace('[remark]', $order['remark'], $smsSetting['sms_business_tpl']);
                 $smsSetting['sms_business_tpl'] = str_replace('[goods]', $goods_str, $smsSetting['sms_business_tpl']);
                 $sendInfo['username'] = $smsSetting['sms_username'];
                 $sendInfo['pwd'] = $smsSetting['sms_pwd'];
                 $sendInfo['mobile'] = $smsSetting['sms_mobile'];
                 $sendInfo['content'] = $smsSetting['sms_business_tpl'];
                 //debug
                 if ($data['status'] == 1) {
                     if ($order['issms'] == 0) {
                         pdo_update($this->table_order, array('issms' => 1), array('id' => $orderid));
                         $return_result_code = $this->_sendSms($sendInfo);
                         $smsStatus = $this->sms_status[$return_result_code];
                     }
                 }
             }
         }
         $store = pdo_fetch("SELECT * FROM " . tablename($this->table_stores) . " WHERE weid=:weid AND id=:id LIMIT 1", array(':weid' => $weid, ':id' => $storeid));
         if (!empty($emailSetting) && !empty($emailSetting['email'])) {
             $email_tpl = str_replace('[store]', $store['title'], $email_tpl);
             $email_tpl = str_replace('[sn]', $order['ordersn'], $email_tpl);
             $email_tpl = str_replace('[name]', $order['username'], $email_tpl);
             //用户名
             $email_tpl = str_replace('[name]', $order['username'], $email_tpl);
             //就餐时间
             $email_tpl = str_replace('[mealtime]', $order['meal_time'], $email_tpl);
             //电话
             $email_tpl = str_replace('[tel]', $order['tel'], $email_tpl);
             $email_tpl = str_replace('[tables]', $order['tables'], $email_tpl);
             $email_tpl = str_replace('[goods]', $goods_str, $email_tpl);
             $email_tpl = str_replace('[totalnum]', $order['totalnum'], $email_tpl);
             $email_tpl = str_replace('[totalprice]', $order['totalprice'], $email_tpl);
             $email_tpl = str_replace('[address]', $order['address'], $email_tpl);
             $email_tpl = str_replace('[remark]', $order['remark'], $email_tpl);
             if ($emailSetting['email_host'] == 'smtp.qq.com' || $emailSetting['email_host'] == 'smtp.gmail.com') {
                 $secure = 'ssl';
                 $port = '465';
             } else {
                 $secure = 'tls';
                 $port = '25';
             }
             $mail_config = array();
             $mail_config['host'] = $emailSetting['email_host'];
             $mail_config['secure'] = $secure;
             $mail_config['port'] = $port;
             $mail_config['username'] = $emailSetting['email_user'];
             $mail_config['sendmail'] = $emailSetting['email_send'];
             $mail_config['password'] = $emailSetting['email_pwd'];
             $mail_config['mailaddress'] = $emailSetting['email'];
             $mail_config['subject'] = '订单提醒';
             $mail_config['body'] = $email_tpl;
             if ($data['status'] == 1) {
                 if ($order['isemail'] == 0) {
                     pdo_update($this->table_order, array('isemail' => 1), array('id' => $orderid));
                     $result = $this->sendmail($mail_config);
                 }
             }
         }
         $setting = pdo_fetch("select * from " . tablename($this->table_setting) . " where weid =:weid LIMIT 1", array(':weid' => $weid));
         if (!empty($setting) && $setting['istplnotice'] == 1) {
             $templateid = $setting['tplneworder'];
             $noticeuser = $setting['tpluser'];
             $template = array('touser' => $noticeuser, 'template_id' => $templateid, 'url' => '', 'topcolor' => "#FF0000", 'data' => array('first' => array('value' => urlencode("您有一个新的订单"), 'color' => '#000'), 'keyword1' => array('value' => urlencode($order['ordersn']), 'color' => '#000'), 'keyword2' => array('value' => urlencode($order['username'] . ' ' . $order['tel']), 'color' => '#000'), 'keyword3' => array('value' => urlencode($goods_tplstr), 'color' => '#000'), 'keyword4' => array('value' => urlencode($order['address']), 'color' => '#000'), 'keyword5' => array('value' => urlencode($order['meal_time']), 'color' => '#000'), 'remark' => array('value' => urlencode('总金额:' . $order['totalprice'] . '元'), 'color' => '#f00')));
             if ($data['status'] == 1) {
                 if ($order['istpl'] == 0) {
                     pdo_update($this->table_order, array('istpl' => 1), array('id' => $orderid));
                     $templateMessage = new class_templateMessage($this->_appid, $this->_appsecret);
                     $access_token = WeAccount::token();
                     $templateMessage->send_template_message($template, $access_token);
                 }
             }
         }
         $this->feiyinSendFreeMessage($orderid);
         $setting = uni_setting($_W['uniacid'], array('creditbehaviors'));
         $credit = $setting['creditbehaviors']['currency'];
         if ($params['type'] == $credit) {
             message('支付成功!' . $smsStatus, $this->createMobileUrl('order', array('storeid' => $storeid, 'status' => 1), true), 'success');
         } else {
             message('支付成功!' . $smsStatus, '../../app/' . $this->createMobileUrl('order', array('storeid' => $storeid), true), 'success');
         }
     }
 }
コード例 #21
0
ファイル: common.php プロジェクト: ChainBoy/wxfx
 public function getAccount()
 {
     global $_W;
     load()->model('account');
     if (!empty($_W['acid'])) {
         return WeAccount::create($_W['acid']);
     } else {
         $acid = pdo_fetchcolumn("SELECT acid FROM " . tablename('account_wechats') . " WHERE `uniacid`=:uniacid LIMIT 1", array(':uniacid' => $_W['uniacid']));
         return WeAccount::create($acid);
     }
     return false;
 }
コード例 #22
0
ファイル: menu.ctrl.php プロジェクト: nsoff/wdlcms
    }
    foreach ($accounts as $acc) {
        $account = WeAccount::create($acc['acid']);
        $ret = $account->menuCreate($menus);
        if (is_error($ret)) {
            exit(json_encode($ret));
        }
    }
    exit('success');
}
if ($do == 'display') {
    $_W['page']['title'] = '菜单设计器 - 自定义菜单 - 高级功能';
    if (!empty($accounts)) {
        if (empty($menus) || !is_array($menus)) {
            $acc = array_shift($accounts);
            $account = WeAccount::create($acc['acid']);
            $menus = $account->menuQuery();
        }
    }
    if (is_error($menus)) {
        message($menus['message'], '', 'error');
    }
    $sql = 'SELECT `menuset` FROM ' . tablename('uni_settings') . ' WHERE `uniacid` = :uniacid';
    $hmenus = array();
    $hmenu = pdo_fetchcolumn($sql, array(':uniacid' => $_W['uniacid']));
    if (!empty($hmenu)) {
        $hmenus = iunserializer(base64_decode($hmenu));
        $createtime = !empty($hmenus) && is_array($hmenus) ? array_pop($hmenus) : '';
    }
    if (!is_array($hmenus)) {
        $hmenus = array();
コード例 #23
0
ファイル: sync.ctrl.php プロジェクト: aspnmy/weizan
 * [WEIZAN System] Copyright (c) 2015 012WZ.COM
 * WeiZan is NOT a free software, it under the license terms, visited http://www.012wz.com/ for more details.
 */
defined('IN_IA') or exit('Access Denied');
if (!empty($_W['uniacid'])) {
    load()->model('account');
    load()->model('mc');
    $setting = uni_setting($_W['uniacid'], 'sync');
    $sync = $setting['sync'];
    if ($sync != 1) {
        exit;
    }
    if ($_W['account']['type'] == 1 && $_W['account']['level'] >= 3) {
        $data = pdo_fetchall('SELECT fanid, openid, acid, uid, uniacid FROM ' . tablename('mc_mapping_fans') . " WHERE uniacid = :uniacid AND acid = :acid AND follow = 1 ORDER BY updatetime ASC, fanid DESC LIMIT 10", array(':uniacid' => $_W['uniacid'], ':acid' => $_W['acid']));
        if (!empty($data)) {
            $acc = WeAccount::create($_W['acid']);
            foreach ($data as $row) {
                $fan = $acc->fansQueryInfo($row['openid'], true);
                if (!is_error($fan) && $fan['subscribe'] == 1) {
                    $group = $acc->fetchFansGroupid($row['openid']);
                    $record = array();
                    if (!is_error($group)) {
                        $record['groupid'] = $group['groupid'];
                    }
                    $record['updatetime'] = time();
                    $record['followtime'] = $fan['subscribe_time'];
                    $record['follow'] = 1;
                    $fan['nickname'] = stripcslashes($fan['nickname']);
                    $record['nickname'] = stripslashes($fan['nickname']);
                    if (!empty($fan['remark'])) {
                        $fan['remark'] = stripslashes($fan['remark']);
コード例 #24
0
ファイル: display.ctrl.php プロジェクト: zhang19960118/html11
    $groups = pdo_fetch('SELECT * FROM ' . tablename('mc_fans_groups') . ' WHERE uniacid = :uniacid AND acid = :acid', array(':uniacid' => $_W['uniacid'], ':acid' => $_W['acid']));
    if (!empty($groups)) {
        $groups = iunserializer($groups['groups']);
    }
    $record = array('uniacid' => $_W['uniacid'], 'acid' => $_W['acid'], 'groupname' => $groups[$group]['name'], 'fansnum' => $groups[$group]['count'], 'msgtype' => $type, 'group' => $group, 'attach_id' => $id, 'status' => 0, 'type' => 0, 'sendtime' => TIMESTAMP, 'createtime' => TIMESTAMP);
    pdo_insert('mc_mass_record', $record);
    exit('success');
}
if ($do == 'del') {
    $id = intval($_GPC['id']);
    $media = pdo_get('wechat_attachment', array('uniacid' => $_W['uniacid'], 'id' => $id));
    if (empty($media)) {
        exit('素材不存在或已经删除');
    }
    $media_id = trim($media['media_id']);
    $acc = WeAccount::create();
    $data = $acc->delMaterial($media_id);
    if (is_error($data)) {
        exit($data['message']);
    } else {
        pdo_delete('wechat_attachment', array('uniacid' => $_W['uniacid'], 'id' => $id));
        if ($type == 'image' || $type == 'voice') {
            $path = ATTACHMENT_ROOT . "/{$media['type']}s/{$_W['uniacid']}/material/{$media['$media_id']}";
            @unlink($path);
        } elseif ($type == 'news') {
            pdo_delete('wechat_news', array('uniacid' => $_W['uniacid'], 'attach_id' => $id));
        }
        exit('success');
    }
}
template('material/display');
コード例 #25
0
ファイル: qr.ctrl.php プロジェクト: legeng/project-2
        } else {
            message("公众平台返回接口错误. <br />错误代码为: {$result['errorcode']} <br />错误信息为: {$result['message']}");
        }
    }
    $id = intval($_GPC['id']);
    $row = pdo_fetch("SELECT * FROM " . tablename('qrcode') . " WHERE uniacid = {$_W['uniacid']} AND id = '{$id}'");
    template('platform/qr-post');
}
if ($do == 'extend') {
    load()->func('communication');
    $id = intval($_GPC['id']);
    if (!empty($id)) {
        $qrcrow = pdo_fetch("SELECT * FROM " . tablename('qrcode') . " WHERE uniacid = {$_W['uniacid']} AND id = '{$id}'");
        $update = array();
        if ($qrcrow['model'] == 1) {
            $uniacccount = WeAccount::create($qrcrow['acid']);
            $barcode['action_info']['scene']['scene_id'] = $qrcrow['qrcid'];
            $barcode['expire_seconds'] = 1800;
            $barcode['action_name'] = 'QR_SCENE';
            $result = $uniacccount->barCodeCreateDisposable($barcode);
            if (is_error($result)) {
                message($result['message'], '', 'error');
            }
            $update['ticket'] = $result['ticket'];
            $update['expire'] = $result['expire_seconds'];
            $update['createtime'] = TIMESTAMP;
            pdo_update('qrcode', $update, array('id' => $id, 'uniacid' => $_W['uniacid']));
        }
        message('恭喜,延长临时二维码时间成功!', referer(), 'success');
    }
}
コード例 #26
0
ファイル: site.php プロジェクト: noikiy/mygit
 private function changeWechatSend($id, $status, $msg = '')
 {
     global $_W;
     $paylog = pdo_fetch("SELECT plid, openid, tag FROM " . tablename('core_paylog') . " WHERE tid = '{$id}' AND status = 1 AND type = 'wechat'");
     if (!empty($paylog['openid'])) {
         $paylog['tag'] = iunserializer($paylog['tag']);
         $acid = $paylog['tag']['acid'];
         $account = account_fetch($acid);
         $payment = uni_setting($account['uniacid'], 'payment');
         if ($payment['payment']['wechat']['version'] == '2') {
             return true;
         }
         $send = array('appid' => $account['key'], 'openid' => $paylog['openid'], 'transid' => $paylog['tag']['transaction_id'], 'out_trade_no' => $paylog['plid'], 'deliver_timestamp' => TIMESTAMP, 'deliver_status' => $status, 'deliver_msg' => $msg);
         $sign = $send;
         $sign['appkey'] = $payment['payment']['wechat']['signkey'];
         ksort($sign);
         $string = '';
         foreach ($sign as $key => $v) {
             $key = strtolower($key);
             $string .= "{$key}={$v}&";
         }
         $send['app_signature'] = sha1(rtrim($string, '&'));
         $send['sign_method'] = 'sha1';
         $account = WeAccount::create($acid);
         $response = $account->changeOrderStatus($send);
         if (is_error($response)) {
             message($response['message']);
         }
     }
 }
コード例 #27
0
ファイル: site.php プロジェクト: keycoolkui/weixinfenxiao
 /**
  * 获取用户称呼
  */
 private function nickname($uid = 0, $ty = '')
 {
     global $_W;
     return value($_COOKIE, 'run_username_' . intval($this->reply['rid']));
     //
     load()->model('mc');
     //获取会员资料
     $user = mc_fetch($uid ? $uid : $_W['member']['uid'], array('nickname', 'mobile', 'email', 'avatar'));
     if ($ty) {
         return $user[$ty];
     }
     $niemmo = '';
     if ($user) {
         $niemmo = $user['nickname'];
         if (empty($niemmo)) {
             $niemmo = $user['mobile'];
         }
         if (empty($niemmo)) {
             //$niemmo = cutstr($user['email'], 10);
             //
             $fans = pdo_fetch('SELECT acid,openid FROM ' . tablename('mc_mapping_fans') . ' WHERE openid = :openid AND uid = :uid', array(':openid' => $_W['openid'], ':uid' => $user['uid']));
             if ($fans) {
                 $acc = WeAccount::create($fans['acid']);
                 if (method_exists($acc, 'fetchAccountInfo')) {
                     $accinfo = $acc->fetchAccountInfo();
                     $access_token = iunserializer($accinfo['access_token']);
                     $accesstoken = $access_token['token'];
                     //
                     load()->func('communication');
                     $url = 'https://api.weixin.qq.com/cgi-bin/user/info?access_token=' . $accesstoken . '&openid=' . $fans['openid'] . '&lang=zh_CN';
                     $response = ihttp_get($url);
                     if (!is_error($response)) {
                         $userinfo = json_decode($response['content'], true);
                         $niemmo = $userinfo['nickname'];
                         $userdata = array('nickname' => $userinfo['nickname'], 'gender' => $userinfo['sex'], 'avatar' => $userinfo['headimgurl'], 'resideprovince' => $userinfo['province'], 'residecity' => $userinfo['city'], 'nationality' => $userinfo['country']);
                         if (empty($userinfo['nickname'])) {
                             $url = 'https://open.weixin.qq.com/connect/oauth2/authorize?appid=' . $accinfo['key'] . '&redirect_uri=' . urlencode(urwdo('nickname', '', 1) . '&uid=' . $user['uid']) . '&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect';
                             gourl($url);
                         }
                         pdo_update('mc_members', $userdata, array('uid' => $user['uid']));
                     }
                 }
             }
         }
     }
     return $niemmo;
 }
コード例 #28
0
ファイル: site.php プロジェクト: scbizu/Wechat_we7Job
 /**
  * 模板消息 
  * 接口已开放   
  * 
  */
 private function SendTpl($openid, $info, $type, $res)
 {
     load()->func('communication');
     require_once 'template_conf_ap.php';
     require_once 'template_conf_auth.php';
     require_once 'template_conf_re.php';
     require_once 'template_conf_cd.php';
     require_once 'template_conf_fl.php';
     global $_W;
     $access_token = WeAccount::token();
     $apply = json_decode($apply, true);
     //		$this->saveSettings($apply);
     $auth = json_decode($auth, true);
     //		$this->saveSettings(auth);
     $refu = json_decode($refu, true);
     //		$this->saveSettings($refu);
     $credit = json_decode($credit, true);
     //		$this->saveSettings($credit);
     $full = json_decode($full, true);
     //		$this->saveSettings($full);
     //post URL
     $url = 'https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . $access_token;
     //POST data
     if ($type == 'apply') {
         $data = array('touser' => $openid, 'template_id' => $apply['apply_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $apply['apply_first'], 'color' => $apply['apply_fcolor']), 'keynote1' => array('value' => $apply['apply_keynote1'], 'color' => $apply['apply_kfcolor']), 'keynote2' => array('value' => '请联系雇主确认....', 'color' => '#000'), 'remark' => array('value' => $apply['apply_remark'], 'color' => $apply['apply_mkcolor'])));
     } else {
         if ($type == 'auth') {
             $date = date('Y-m-d H:i');
             $data = array('touser' => $openid, 'template_id' => $auth['auth_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $auth['auth_first'], 'color' => $apply['auth_first']), 'keyword1' => array('value' => $info['name'], 'color' => '#000'), 'keyword2' => array('value' => $info['phone'], 'color' => '#000'), 'keyword3' => array('value' => $date, 'color' => '#000'), 'remark' => array('value' => $auth['auth_remark'], 'color' => $auth['auth_mkcolor'])));
         } else {
             if ($type == 'refuse') {
                 $date = date('Y-m-d H:i');
                 $data = array('touser' => $openid, 'template_id' => $refu['refu_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $refu['refu_first'], 'color' => $refu['refu_fcolor']), 'keyword1' => array('value' => $info['name'], 'color' => '#000'), 'keyword2' => array('value' => $info['phone'], 'color' => '#000'), 'keyword3' => array('value' => $date, 'color' => '#000'), 'remark' => array('value' => $refu['refu_remark'], 'color' => $refu['refu_mkcolor'])));
             } else {
                 if ($type == 'credit1') {
                     $date = date('Y-m-d H:i:s');
                     $data = array('touser' => $openid, 'template_id' => $credit['credit_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $credit['credit_first'], 'color' => $credit['credit_fcolor']), 'account' => array('value' => $info['name'], 'color' => '#000'), 'time' => array('value' => $date, 'color' => '#000'), 'type' => array('value' => $credit['credit_type'], 'color' => $credit['credit_tpcolor']), 'creditChange' => array('value' => '支出', 'color' => '#000'), 'number' => array('value' => '100', 'color' => '#000'), 'creditName' => array('value' => '账户积分', 'color' => '#000'), 'amount' => array('value' => $res, 'color' => '#000'), 'remark' => array('value' => $credit['credit_remark'], 'color' => $credit['crefit_mkcolor'])));
                 } else {
                     if ($type == 'full') {
                         $data = array('touser' => $openid, 'template_id' => $full['full_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjmyinfo&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => $full['full_first'], 'color' => $full['full_fcolor']), 'keyword1' => array('value' => $info['title'], 'color' => '#000'), 'keyword2' => array('value' => "待办", 'color' => 'red'), 'remark' => array('value' => $full['full_remark'], 'color' => $full['full_mkcolor'])));
                     } else {
                         if ($type == 'first_third') {
                             $data = array('touser' => $openid, 'template_id' => $full['full_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjmyinfo&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => '请尽快去录取应答者,完成本次招募。', 'color' => '#000'), 'keyword1' => array('value' => $info['title'], 'color' => '#000'), 'keyword2' => array('value' => '待办', 'color' => 'red'), 'remark' => array('value' => '帖子有人认领啦,快去看看.', 'color' => '#0542FA')));
                         } else {
                             if ($type == 'second_third') {
                                 $data = array('touser' => $openid, 'template_id' => $full['full_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjmyinfo&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => '请尽快去录取应聘者,完成本次招聘。', 'color' => '#000'), 'keyword1' => array('value' => $info['title'], 'color' => '#000'), 'keyword2' => array('value' => '待办', 'color' => 'red'), 'remark' => array('value' => '招聘帖子人数快满了,请速去验收.', 'color' => '#0542FA')));
                             } else {
                                 if ($type == 'admit') {
                                     $data = array('touser' => $openid, 'template_id' => $apply['apply_tid'], 'url' => $_W['siteroot'] . 'app/index.php?i=1&c=entry&do=ptjindex&m=hypernet_iptj', 'topcolor' => '#FF0000', 'data' => array('first' => array('value' => 'congrats!你已被' . $info['name'] . '招募', 'color' => '#FF0000'), 'keynote1' => array('value' => $info['name'] . '欢迎你的加入~', 'color' => '#000'), 'keynote2' => array('value' => '请联系雇主确认....', 'color' => '#000'), 'remark' => array('value' => '要愉快地玩耍哦~~~~', 'color' => '#000')));
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return ihttp_post($url, json_encode($data));
 }
コード例 #29
0
ファイル: designer.ctrl.php プロジェクト: yunsite/my-we7
<?php

/**
 * [WeEngine System] Copyright (c) 2013 WE7.CC
 */
defined('IN_IA') or exit('Access Denied');
$current['designer'] = ' class="current"';
checkaccount();
require_once IA_ROOT . '/source/class/account.class.php';
$acc = WeAccount::create($_W['weid']);
if (empty($acc)) {
    message('非法访问');
}
$menusetcookie = 'menuset-' . $_W['weid'];
if ($_W['ispost']) {
    if ($_GPC['do'] == 'remove') {
        $ret = $acc->menuDelete();
        if (is_error($ret)) {
            message($ret['message'], 'refresh');
        } else {
            isetcookie($menusetcookie, '', -500);
            message('已经成功删除菜单,请重新创建。', 'refresh');
        }
    }
    if ($_GPC['do'] == 'refresh') {
        isetcookie($menusetcookie, '', -500);
        message('已清空缓存,将重新从公众平台接口获取菜单信息。', 'refresh');
    }
    require model('rule');
    $mDat = $_GPC['do'];
    $mDat = htmlspecialchars_decode($mDat);
コード例 #30
0
ファイル: account.mod.php プロジェクト: wisemyth/weizan
function uni_update_yesterday_stat()
{
    global $_W;
    $cachekey = "stat:todaylock:{$_W['uniacid']}";
    $cache = cache_load($cachekey);
    if (!empty($cache) && $cache['expire'] > TIMESTAMP) {
        return true;
    }
    $yesterday = date('Ymd', strtotime('-1 days'));
    $yesterday_stat = pdo_get('stat_fans', array('date' => $yesterday, 'uniacid' => $_W['uniacid']));
    if ($_W['account']['level'] == ACCOUNT_SUBSCRIPTION_VERIFY || $_W['account']['level'] == ACCOUNT_SERVICE_VERIFY) {
        $account_obj = WeAccount::create();
        $weixin_stat = $account_obj->getFansStat();
        if (!is_error($weixin_stat) && !empty($weixin_stat)) {
            $yesterday_weixin_stat = $weixin_stat[$yesterday];
            $update_stat = array('uniacid' => $_W['uniacid'], 'new' => $yesterday_weixin_stat['new'], 'cancel' => $yesterday_weixin_stat['cancel'], 'cumulate' => $yesterday_weixin_stat['cumulate'], 'date' => $yesterday);
        }
    } else {
        $update_stat = array();
        $update_stat['cumulate'] = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('mc_mapping_fans') . ' WHERE acid = :acid AND uniacid = :uniacid AND follow = :follow AND followtime < :endtime', array(':acid' => $_W['acid'], ':uniacid' => $_W['uniacid'], ':endtime' => strtotime(date('Y-m-d')), ':follow' => 1));
        $update_stat['date'] = $yesterday;
        $update_stat['uniacid'] = $_W['uniacid'];
    }
    if (empty($yesterday_stat)) {
        pdo_insert('stat_fans', $update_stat);
    } else {
        pdo_update('stat_fans', $update_stat, array('id' => $yesterday_stat['id']));
    }
    cache_write($cachekey, array('expire' => strtotime(date('Y-m-d')) + 86399));
    return true;
}