本文整理汇总了PHP中addWeixinLog函数的典型用法代码示例。如果您正苦于以下问题:PHP addWeixinLog函数的具体用法?PHP addWeixinLog怎么用?PHP addWeixinLog使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addWeixinLog函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: problem
public function problem()
{
$post = I('post.');
addWeixinLog($post, '[微信告警接口]');
LogRecord(serialize($post), '[微信告警接口]');
echo "";
}
示例2: index
public function index()
{
// 删除微信传递的token干扰
unset($_REQUEST['token']);
$weixin = D('Weixin');
// 获取数据
$data = $weixin->getData();
$this->data = $data;
if (!empty($data['ToUserName'])) {
get_token($data['ToUserName']);
}
if (!empty($data['FromUserName'])) {
get_openid($data['FromUserName']);
}
$this->token = $data['ToUserName'];
// 记录日志
addWeixinLog($data, $GLOBALS['HTTP_RAW_POST_DATA']);
// 初始化用户
$data['ToUserName'] == 'gh_3c884a361561' || $this->init_follow($data);
// 回复数据
$this->reply($data, $weixin);
// 客服接口群发消息:未发送成功的消息给用户重新发
$this->sendOldMessage($data['ToUserName'], $data['FromUserName']);
// 结束程序。防止oneThink框架的调试信息输出
exit;
}
示例3: _dealWeixinPost
private function _dealWeixinPost()
{
$content = wp_file_get_contents('php://input');
vendor('WXBiz.wxBizMsgCrypt');
$this->sReqTimeStamp = I('get.timestamp');
$this->sReqNonce = I('get.nonce');
$this->sEncryptMsg = I('get.msg_signature');
$this->wxcpt = new \WXBizMsgCrypt('weiphp', '0c79e1fa963cd80cc0be99b20a18faeb', 'wx2685aca90abe2895');
$sMsg = "";
// 解析之后的明文
$errCode = $this->wxcpt->DecryptMsg($this->sEncryptMsg, $this->sReqTimeStamp, $this->sReqNonce, $content, $sMsg);
if ($errCode != 0) {
addWeixinLog($_GET, "DecryptMsg Error: " . $errCode);
return false;
} else {
// 解密成功,sMsg即为xml格式的明文
$content = $sMsg;
}
$data = new \SimpleXMLElement($content);
// $data || die ( '参数获取失败' );
foreach ($data as $key => $value) {
$this->data[$key] = safe(strval($value));
}
return $data;
}
示例4: init_follow
function init_follow($openid, $token = '', $has_subscribe = false)
{
empty($token) && ($token = get_token());
addWeixinLog($openid . '::_' . $token, 'init_follow_in');
if (empty($openid) || $openid == -1 || empty($token) || $token == -1) {
return false;
}
$data['token'] = $token;
$data['openid'] = $openid;
$datas = $data;
$uid = M('public_follow')->where($data)->getField('uid');
addWeixinLog($uid, 'init_follow_check_uid');
if ($uid) {
return $uid;
}
// 自动注册
$config = getAddonConfig('UserCenter', $token);
$user = array('experience' => intval($config['experience']), 'score' => intval($config['score']), 'reg_ip' => get_client_ip(1), 'reg_time' => NOW_TIME, 'last_login_ip' => get_client_ip(1), 'last_login_time' => NOW_TIME, 'status' => 1, 'is_init' => 1, 'is_audit' => 1, 'come_from' => 1);
$user2 = getWeixinUserInfo($openid);
$user = array_merge($user, $user2);
$data['uid'] = $uid = D('Common/User')->add($user);
if ($has_subscribe !== false) {
$data['has_subscribe'] = $has_subscribe;
}
M('public_follow')->add($data);
return $uid;
}
示例5: setTicket
function setTicket()
{
include_once ONETHINK_ADDON_PATH . 'PublicBind/wxBizMsgCrypt.php';
// 第三方发送消息给公众平台
$encodingAesKey = 'DfEqNBRvzbg8MJdRQCSGyaMp6iLcGOldKFT0r8I6Tnp';
$token = 'weiphp';
$appId = D('Addons://PublicBind/PublicBind')->component_appid;
$timeStamp = empty($_GET['timestamp']) ? "" : trim($_GET['timestamp']);
$nonce = empty($_GET['nonce']) ? "" : trim($_GET['nonce']);
$msg_sign = empty($_GET['msg_signature']) ? "" : trim($_GET['msg_signature']);
$encryptMsg = file_get_contents('php://input');
$pc = new \WXBizMsgCrypt($token, $encodingAesKey, $appId);
// 第三方收到公众号平台发送的消息
$msg = '';
$errCode = $pc->decryptMsg($msg_sign, $timeStamp, $nonce, $encryptMsg, $msg);
if ($errCode == 0) {
$data = $this->_xmlToArr($msg);
$map['name'] = 'PublicBind';
$config = M('addons')->where($map)->getField('config');
$config = (array) json_decode($config, true);
$config['ComponentVerifyTicket'] = $data['ComponentVerifyTicket'];
$save['config'] = json_encode($config);
M('addons')->where($map)->save($save);
echo 'success';
} else {
addWeixinLog('解密后失败:' . $errCode, 'setTicket_error');
}
}
示例6: 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);
}
}
示例7: sendtempmsg
public function sendtempmsg($openid, $template_id, $url, $data, $topcolor = '#FF0000')
{
$xml = '{"touser":"' . $openid . '","template_id":"' . $template_id . '","url":"' . $url . '","topcolor":"' . $topcolor . '","data":' . $data . '}';
$res = $this->curlPost('https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=' . get_access_token(), $xml);
$res = json_decode($res, true);
// 记录日志
if ($res['errcode'] == 0) {
addWeixinLog($xml, 'post');
}
$senddata = array('openid' => $openid, 'template_id' => $template_id, 'MsgID' => $res['msgid'], 'message' => $data, 'sendstatus' => $res['errcode'] == 0 ? 0 : 1, 'token' => get_token(), 'ctime' => time());
M('tmplmsg')->add($senddata);
return $res;
}
示例8: index
public function index()
{
$this->token = get_token();
$weixin = D('Weixin');
// 获取数据
$data = $weixin->getData();
if (!empty($data['FromUserName'])) {
session('openid', $data['FromUserName']);
}
// 记录日志
addWeixinLog($data, $GLOBALS['HTTP_RAW_POST_DATA']);
// 回复数据
$this->reply($data);
}
示例9: NotifyProcess
public function NotifyProcess($data, &$msg)
{
$notfiyOutput = array();
if (!array_key_exists("transaction_id", $data)) {
$msg = "输入参数不正确";
return false;
}
//查询订单,判断订单真实性
// if(!$this->Queryorder($data["transaction_id"])){
// $msg = "订单查询失败";
// return false;
// }
//支付成功通知地址
// $url = "http://2test.8raw.com/index.php/Shop/WxpayNotify/aysncNotify?key=hebidu";
$url = $this->config['PROCESS_URL'];
addWeixinLog(json_encode($data), "[成功通知处理数据结构]");
$entity = array();
fsockopenRequest($url, $data);
//TODO: 异步处理流程
// <xml><appid><![CDATA[wx5f9ed360f5da5370]]></appid>
//<attach><![CDATA[13_]]></attach>
//<bank_type><![CDATA[CFT]]></bank_type>
//<cash_fee><![CDATA[1]]></cash_fee>
//<fee_type><![CDATA[CNY]]></fee_type>
//<is_subscribe><![CDATA[Y]]></is_subscribe>
//<mch_id><![CDATA[1238878502]]></mch_id>
//<nonce_str><![CDATA[lgejoe9g234qsz67lwk5qhoafv4nuvz9]]></nonce_str>
//<openid><![CDATA[oxGH0sgeUkH4g8aowy0452xJnX1o]]></openid>
//<out_trade_no><![CDATA[2015042820173392481208_2]]></out_trade_no>
//<result_code><![CDATA[SUCCESS]]></result_code>
//<return_code><![CDATA[SUCCESS]]></return_code>
//<sign><![CDATA[1DFD346C8F496CCC7D45CF7031B0257C]]></sign>
//<time_end><![CDATA[20150428201758]]></time_end>
//<total_fee>1</total_fee>
//<trade_type><![CDATA[JSAPI]]></trade_type>
//<transaction_id><![CDATA[1009360424201504280096239638]]></transaction_id>
//</xml>
return true;
}
示例10: index
public function index()
{
//删除微信传递的token干扰
unset($_REQUEST['token']);
$weixin = D('Weixin');
// 获取数据
$data = $weixin->getData();
if (!empty($data['ToUserName'])) {
get_token($data['ToUserName']);
}
if (!empty($data['FromUserName'])) {
session('openid', $data['FromUserName']);
}
$this->token = $data['ToUserName'];
$this->initFollow($weixin);
// 记录日志
addWeixinLog($data, $GLOBALS['HTTP_RAW_POST_DATA']);
// 回复数据
$this->reply($data, $weixin);
// 结束程序。防止oneThink框架的调试信息输出
exit;
}
示例11: save
/**
* 订单保存
*/
public function save()
{
//收货地址ID
$address_id = I('post.address_id', 0);
$province_name = I('post.province_name', '');
$city_name = I('post.city_name', '');
$area_name = I('post.area_name', '');
$notes = I('post.notes', array());
$userinfo = $this->userinfo;
if (IS_POST && is_array($userinfo)) {
addWeixinLog($userinfo, '[session]saveispost');
//购买的商品的列表
$buyProductList = session("confirm_order_info");
if (empty($buyProductList)) {
$this->error("您尚未选购商品!");
}
addWeixinLog($buyProductList, '购买商品的列表');
$map = array('id' => $address_id);
$result = apiCall(AddressApi::GET_INFO, array($map));
if (!$result['status']) {
$this->error($result['info']);
}
if (is_null($result['info'])) {
LogRecord("收货地址信息获取失败", __FILE__ . __LINE__);
//如果是空的
$this->error("收货地址信息获取失败!");
}
$address_info = $result['info'];
//总价,不含运费
$all_price = $buyProductList['all_price'];
//运费
$all_express = $buyProductList['all_express'];
//订单对象
$entity = array('wxaccountid' => $this->wxaccount['id'], 'storeid' => 0, 'wxuser_id' => $userinfo['id'], 'price' => 0, 'mobile' => $address_info['mobile'], 'wxno' => $address_info['wxno'], 'contactname' => $address_info['contactname'], 'note' => '', 'country' => $address_info['country'], 'province' => $province_name, 'city' => $city_name, 'area' => $area_name, 'detailinfo' => $address_info['detailinfo'], 'orderid' => '', 'items' => '');
$i = 0;
$ids = '';
$orderid = $this->getOrderID();
// addWeixinLog($buyProductList['list'],'订单');
//分店铺保存订单,每个店铺一张订单
foreach ($buyProductList['list'] as $key => $vo) {
//店铺ID
$entity['storeid'] = $key;
$entity['orderid'] = $orderid . '_' . $key;
$entity['items'] = $vo;
//
$price = 0.0;
foreach ($vo['products'] as $item) {
// addWeixinLog($item,'订单[test]');
$price += $item['price'] * intval($item['count']);
}
$entity['price'] = $price;
if ($i < count($notes)) {
$entity['note'] = $notes[$i];
}
$i++;
// dump($entity['items']['products']);
// exit();
//dump($entity);
$result = apiCall(OrdersApi::ADD_ORDER, array($entity));
// addWeixinLog($result,'订单3333');
if (!$result['status']) {
LogRecord($result['info'], __FILE__ . __LINE__);
$this->error($result['info']);
}
$ids .= $result['info'] . '-';
}
$ids = trim($ids, "-");
//TODO: 从购物车中移除相对应的商品,根据店铺ID,商品ID,商品SKU
//目前 就直接删除购物车
session("shoppingcart", null);
session("confirm_order_info", null);
$this->success("订单保存成功,前往支付!", C('SITE_URL') . "/index.php/Shop/Pay/pay/id/{$ids}?showwxpaytitle=1");
} else {
LogRecord("禁止访问!", __FILE__ . __LINE__);
$this->error("禁止访问!");
}
}
示例12: toCompleted
/**
*
* 1. 订单[已收货]-》检测 time() - updatetime > 指定时间,暂定15天 满足条件变更为订单[已收货]
*/
private function toCompleted()
{
$interval = 24 * 3600 * 15;
//15天
$result = apiCall("Tool/Orders/orderStatusToCompleted", array($interval));
if (!$result['status']) {
LogRecord($result['info'], __FILE__ . __LINE__);
} else {
if ($result['info'] > 0) {
addWeixinLog("更新订单为已完成影响记录数:" . $result['info'], '3');
}
}
}
示例13: sendToWxaccount
private function sendToWxaccount($wxaccountid, $text)
{
$result = apiCall(WxaccountApi::GET_INFO, array(array('id' => $wxaccountid)));
if ($result['status']) {
$wxapi = new WeixinApi($result['info']['appid'], $result['info']['appsecret']);
$map = array('name' => "WXPAY_OPENID");
$result = apiCall(ConfigApi::GET_INFO, array($map));
addWeixinLog($result, "接收订单支付成功的OPENID");
if ($result['status']) {
$openidlist = explode(",", $result['info']['value']);
foreach ($openidlist as $openid) {
$wxapi->sendTextToFans($openid, $text);
}
}
} else {
LogRecord($result['info'], __FILE__ . __LINE__ . "发送支付成功消息失败");
}
}
示例14: pay
/**
* 微信支付页面
*/
public function pay()
{
//订单ID
$ids = I('get.id', 0);
//
$ids = rtrim($ids, "-");
$ids_arr = explode("-", $ids);
if (count($ids_arr) == 0) {
$this->error("参数错误!");
}
$map = array();
$map['id'] = array('in', $ids_arr);
$result = apiCall(OrdersInfoViewApi::QUERY_NO_PAGING, array($map));
//TODO: 判断订单状态是否为待支付
// dump($result['status']);
if ($result['status']) {
$order_list = $result['info'];
$payConfig = C('WXPAY_CONFIG');
$payConfig['jsapicallurl'] = getCurrentURL();
//dump($payConfig);
addWeixinLog($payConfig, "配置信息");
$items = array();
$total_fee = 0;
$total_express = 0.0;
$body = "";
$attach = "";
foreach ($order_list as $order) {
$trade_no = $order['orderid'];
$total_fee += $order['price'];
$order_express = 0;
$products = $this->getProducts($order[id]);
foreach ($products as $vo) {
if ($order_express < $vo['post_price']) {
$order_express = $vo['post_price'];
}
if (empty($body)) {
$body = $vo['name'];
}
}
$total_express += $order_express;
$attach .= $order['id'] . '_';
array_push($items, $item);
}
$dnotNeedPostPrice = C('DNOT_NEED_POST_PRICE');
$dnotNeedPostPrice = floatval($dnotNeedPostPrice);
if (floatval($total_fee) >= $dnotNeedPostPrice * 100.0) {
$total_express = 0;
}
// dump($total_fee);
// dump($total_express);
$total_fee = $total_fee + $total_express;
if ($total_fee <= 0) {
$this->error("支付金额不能小于0!");
}
if (APP_DEBUG) {
// $total_fee = 1;
}
if (empty($body)) {
$body = date("Y-m-d", time()) . "购买商品";
}
$body = mb_substr($body, 0, 31, 'utf-8');
//测试时
$this->setWxpayConfig($payConfig, $trade_no, $body, $total_fee, $attach);
//dump($payConfig);
$this->assign("total_express", $total_express);
$this->assign("ids", I('get.id', 0));
$this->assign("total_fee", $total_fee);
$this->theme($this->themeType)->display();
} else {
$this->error("支付失败!");
}
}
示例15: index
/**
* 微信消息接口入口
* 所有发送到微信的消息都会推送到该操作
* 所以,微信公众平台后台填写的api地址则为该操作的访问地址
* 在mp.weixin.qq.com 开发者中心配置的 URL(服务器地址) http://域名/index.php/home/weixin/index/id/member_public表的id.html
*/
public function index()
{
$this->WX->valid();
$type = $this->WX->getRev()->getRevType();
if (C('DEVELOP_MODE')) {
addWeixinLog($GLOBALS['HTTP_RAW_POST_DATA']);
}
//与微信交互的中控服务器逻辑可以自己定义,这里实现一个通用的
switch ($type) {
//事件
case TPWechat::MSGTYPE_EVENT:
//先处理事件型消息
$event = $this->WX->getRevEvent();
switch ($event['event']) {
//关注l
case TPWechat::EVENT_SUBSCRIBE:
//二维码关注
if (isset($event['eventkey']) && isset($event['ticket'])) {
} else {
//普通关注
}
$openid = $this->WX->getRevFrom();
$User = M('User');
$user_info = $User->where(array('openid' => $openid))->find();
if ($user_info) {
$map = array('openid' => $this->WX->getRevFrom());
$User->where($map)->setField('is_subscribe', 1);
} else {
$wx_info = $this->WX->getUserInfo($this->WX->getRevFrom());
$wx_info['nickname'] = remove_emoji($wx_info['nickname']);
$data = array('openid' => $openid, 'user_name' => $wx_info['nickname'], 'user_avatar' => $wx_info['headimgurl'], 'is_subscribe' => 1, 'status' => 1, 'create_time' => NOW_TIME, 'update_time' => NOW_TIME);
$User->add($data);
}
$this->WX->text(html_entity_decode(C('SUBSCRIBE_MSG')))->reply();
break;
//扫描二维码
//扫描二维码
case TPWechat::EVENT_SCAN:
break;
//地理位置
//地理位置
case TPWechat::EVENT_LOCATION:
break;
//自定义菜单 - 点击菜单拉取消息时的事件推送
//自定义菜单 - 点击菜单拉取消息时的事件推送
case TPWechat::EVENT_MENU_CLICK:
switch ($event['key']) {
case 'MENU_KEY_NEWS':
break;
default:
# code...
break;
}
break;
//自定义菜单 - 点击菜单跳转链接时的事件推送
//自定义菜单 - 点击菜单跳转链接时的事件推送
case TPWechat::EVENT_MENU_VIEW:
$this->WX->text('//自定义菜单 - 点击菜单跳转链接时的事件推送')->reply();
break;
//自定义菜单 - 扫码推事件的事件推送
//自定义菜单 - 扫码推事件的事件推送
case TPWechat::EVENT_MENU_SCAN_PUSH:
break;
//自定义菜单 - 扫码推事件且弹出“消息接收中”提示框的事件推送
//自定义菜单 - 扫码推事件且弹出“消息接收中”提示框的事件推送
case TPWechat::EVENT_MENU_SCAN_WAITMSG:
break;
//自定义菜单 - 弹出系统拍照发图的事件推送
//自定义菜单 - 弹出系统拍照发图的事件推送
case TPWechat::EVENT_MENU_PIC_SYS:
break;
//自定义菜单 - 弹出拍照或者相册发图的事件推送
//自定义菜单 - 弹出拍照或者相册发图的事件推送
case TPWechat::EVENT_MENU_PIC_PHOTO:
break;
//自定义菜单 - 弹出微信相册发图器的事件推送
//自定义菜单 - 弹出微信相册发图器的事件推送
case TPWechat::EVENT_MENU_PIC_WEIXIN:
break;
//自定义菜单 - 弹出地理位置选择器的事件推送
//自定义菜单 - 弹出地理位置选择器的事件推送
case TPWechat::EVENT_MENU_LOCATION:
break;
//取消关注
//取消关注
case TPWechat::EVENT_UNSUBSCRIBE:
$openid = $this->WX->getRevFrom();
$User = M('User');
$user_info = $User->where(array('openid' => $openid))->find();
if ($user_info) {
$map = array('openid' => $this->WX->getRevFrom());
$User->where($map)->setField('is_subscribe', 0);
} else {
$wx_info = $this->WX->getUserInfo($this->WX->getRevFrom());
//.........这里部分代码省略.........