public function notify() { $rsv_data = $GLOBALS['HTTP_RAW_POST_DATA']; $result = xmlToArray($rsv_data); $map["appid"] = $result["appid"]; $map["mchid"] = $result["mch_id"]; $info = M('member_public')->where($map)->find(); //获取公众号信息,jsApiPay初始化参数 $this->options['appid'] = $info['appid']; $this->options['mchid'] = $info['mchid']; $this->options['mchkey'] = $info['mchkey']; $this->options['secret'] = $info['secret']; $this->options['notify_url'] = $info['notify_url']; $this->wxpaycfg = new WxPayConfig($this->options); //发送模板消息 $TMArray = array("touser" => $result["openid"], "template_id" => "diW6jm5hBwemeoDF0FZdU2agSZ9kydje22YJIC0gVMo", "url" => "http://test.uctoo.com/index.php?s=/home/addons/execute/Ucuser/Ucuser/index/mp_id/107.html", "topcolor" => "#FF0000", "data" => array("name" => array("value" => "优创智投", "color" => "#173177"), "remark" => array("value" => "今天", "color" => "#173177"))); $options['appid'] = $info['appid']; //初始化options信息 $options['appsecret'] = $info['secret']; $options['encodingaeskey'] = $info['encodingaeskey']; $weObj = new TPWechat($options); $res = $weObj->sendTemplateMessage($TMArray); //回复公众平台支付结果 $notify = new PayNotifyCallBackController($this->wxpaycfg); // $notify->Handle(false); //处理业务逻辑 }
public function notify() { $rsv_data = $GLOBALS['HTTP_RAW_POST_DATA']; $result = json_decode(json_encode($rsv_data), true); import('Com.Wxpay.lib.WxPayDataBase'); //获取公众号信息,jsApiPay初始化参数 // $config = get_addon_config('Wxpay'); // //发送模板消息 // $TMArray = array( // "touser" => 'oiPJjuAWphisWwn9aLyjJzDI_9v4', // "template_id" => 'bkBZQbP6HCy_OWMIqYhD_fh-zCK2Zk7aeTlSoPelXMY', // "url" => "", // "topcolor" => "#FF0000", // "data" => array( // "first" => array("value" => "我们已收到您的货款,开始为您打包商品,请耐心等待: )","color" => "#173177"), // "orderMoneySum" => array("value" => "30.00元"), // "orderProductName" => array("value" => "我是商品名字"), // "remark" => array("value" => "如有问题请致电400-000-0000或直接在微信留言,我们将第一时间为您服务!","color" => "#173177") // ) // ); // $options['token'] = '123456'; //初始化options信息 // $options['appid'] = $config['appid']; //初始化options信息 // $options['appsecret'] = $config['secret']; // $weObj = new TPWechat($options); // $res = $weObj->sendTemplateMessage($TMArray); //回复公众平台支付结果 $notify = new PayNotifyCallBackController(); $notify->Handle(false); //处理业务逻辑 }