• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Wechat类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了PHP中Wechat的典型用法代码示例。如果您正苦于以下问题:PHP Wechat类的具体用法?PHP Wechat怎么用?PHP Wechat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了Wechat类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。

示例1: _initialize

 function _initialize()
 {
     parent::_initialize();
     if (!$this->_userid) {
         header("Location: " . U('User/Login/index'));
         exit;
     }
     $this->dao = M('User');
     $this->assign('bcid', 0);
     $user = $this->dao->find($this->_userid);
     if (empty($user["wxpas"])) {
         $himt = "<script type=\"text/javascript\">\$(document).ready(function(){alert(\"你还没绑定微信请扫描二维码绑定!\");});</script>";
         $this->assign("himt", $himt);
     }
     $user["username"] = $user["realname"] != "" ? $user["realname"] . "[" . $user["username"] . "]" : $user["username"];
     //////////////获得绑定二维码
     import("@.ORG.Weixin");
     $wechatObj = new Wechat();
     $user["ticket"] = $wechatObj->ewm($user["id"], 0);
     //////////////获得绑定二维码
     $this->user = $user;
     $this->assign('vo', $user);
     unset($_POST['status']);
     unset($_POST['groupid']);
     unset($_POST['amount']);
     unset($_POST['point']);
     $_GET = get_safe_replace($_GET);
     $order["count"] = M("order")->where(array('status' => 0, 'userid' => $this->_userid))->count();
     $order["all"] = M("order")->where(array('userid' => $this->_userid))->count();
     $order["ok"] = M("order")->where(array('status' => 1, 'userid' => $this->_userid))->count();
     $this->assign('order', $order);
     $this->assign('actionname', ACTION_NAME);
 }
开发者ID:anywn3773,项目名称:gzsrex,代码行数:33,代码来源:IndexAction.class.php


示例2: index

 public function index()
 {
     $thisurl = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
     $rt = explode('index.php', $thisurl);
     $arg = isset($rt[1]) ? $rt[1] : '';
     if (!empty($arg)) {
         $rt = explode('/', $arg);
         $arg = isset($rt[1]) ? $rt[1] : '';
         if (!empty($arg)) {
             $this->token = trim($arg);
         }
     }
     if (!class_exists('SimpleXMLElement')) {
         exit('SimpleXMLElement class not exist');
     }
     if (!function_exists('dom_import_simplexml')) {
         exit('dom_import_simplexml function not exist');
     }
     if (!preg_match("/^[0-9a-zA-Z]{3,42}\$/", $this->token)) {
         exit('error token');
     }
     $weixin = new Wechat($this->token);
     $this->data = $weixin->request();
     if ($this->data) {
         list($content, $type) = $this->reply($this->data);
         $weixin->response($content, $type);
     }
 }
开发者ID:henryxxk,项目名称:wxapi,代码行数:28,代码来源:index.php


示例3: index

 function index()
 {
     if (!session('openid_' . $this->token)) {
         $this->info = M('wxuser')->where(array('token' => $this->token))->find();
         vendor("Oauth2.OAuth2", LIB_PATH . '../Extend/Vendor');
         vendor("Oauth2.Provider.Wechat", LIB_PATH . '../Extend/Vendor');
         $wechat = new Wechat();
         $wechat->config(array('id' => $this->info['appid'], 'secret' => $this->info['appsecret']));
         $redirect_uri = C('site_url') . '/index.php/Wap/Login/index?token=' . $this->token . '&url=' . $this->url;
         if (!$_GET['code']) {
             // By sending no options it'll come back here
             $url = $wechat->authorize(array('redirect_uri' => $redirect_uri));
             redirect($url);
         } else {
             try {
                 // Have a go at creating an access token from the code
                 $access_token = $wechat->access($_GET['code'], array('redirect_uri' => $redirect_uri));
                 // Use this object to try and get some user details (username, full name, etc)
                 $user = $wechat->get_user_info($access_token);
                 $this->save_wechat_user($user);
                 session('openid_' . $this->token, $user->openid);
             } catch (OAuth2_Exception $e) {
                 print_r($e);
                 die;
             }
         }
     }
     if ($this->url) {
         redirect($this->url);
     }
 }
开发者ID:zhaoshengloveqingqing,项目名称:Wechat,代码行数:31,代码来源:LoginAction.class.php


示例4: index

 public function index()
 {
     if (!class_exists('SimpleXMLElement')) {
         exit('SimpleXMLElement class not exist');
     }
     if (!function_exists('dom_import_simplexml')) {
         exit('dom_import_simplexml function not exist');
     }
     $this->token = $this->_get('token', "htmlspecialchars");
     if (!preg_match("/^[0-9a-zA-Z]{3,42}\$/", $this->token)) {
         exit('error token');
     }
     $weixin = new Wechat($this->token);
     $data = $weixin->request();
     $this->data = $weixin->request();
     $this->fans = S('fans_' . $this->token . '_' . $this->data['FromUserName']);
     if (!$this->fans || 1) {
         $this->fans = M('Userinfo')->where(array('token' => $this->token, 'wecha_id' => $this->data['FromUserName']))->find();
         S('fans_' . $this->token . '_' . $this->data['FromUserName'], $this->fans);
     }
     $this->wxuser = S('wxuser_' . $this->token);
     if (!$this->wxuser || 1) {
         $this->wxuser = D('Wxuser')->where(array('token' => $this->token))->find();
         S('wxuser_' . $this->token, $this->wxuser);
     }
     $this->my = C('site_my');
     $this->apiServer = apiServer::getServerUrl();
     $open = M('Token_open')->where(array('token' => $this->_get('token')))->find();
     $this->fun = $open['queryname'];
     list($content, $type) = $this->reply($data);
     $weixin->response($content, $type);
 }
开发者ID:SubDong,项目名称:pigcms,代码行数:32,代码来源:WeixinAction.class.php


示例5: index

 public function index()
 {
     $this->token = $this->_get('token');
     $this->my = C('site_my');
     #        Log::record('weixinmsg',Log::DEBUG);
     #       Log::record('weixinmsg',$this->token,Log::DEBUG);
     #      Log::save();
     #     $this->siteName = C('site_name');
     $weixin = new Wechat($this->token);
     //$data = $weixin->request();
     //$this->xml = $weixin->xml;
     $this->data = $weixin->request();
     //是否是在上墙中
     if ($this->data) {
         $data = $this->data;
         $users = S($data['FromUserName'] . 'wxq');
         if ($users != false) {
             $res = $this->wxq($users);
         } else {
             $res = $this->reply($data);
         }
         list($content, $type) = $res;
         $weixin->response($content, $type);
     }
 }
开发者ID:yakrsa,项目名称:football,代码行数:25,代码来源:WeixinAction.class.php


示例6: index

 public function index()
 {
     if (!session('openid_' . $this->token)) {
         $this->info = M('wxuser')->where(array('token' => $this->token))->find();
         vendor("Oauth2.OAuth2", LIB_PATH . '../Extend/Vendor');
         vendor("Oauth2.Provider.Wechat", LIB_PATH . '../Extend/Vendor');
         $wechat = new Wechat();
         $wechat->config(array('id' => $this->info['appid'], 'secret' => $this->info['appsecret']));
         $redirect_uri = C('site_url') . '/index.php/Wap/Coupons/index?token=' . $this->token . '&coupon_id=' . $this->coupon_id;
         if (!$_GET['code']) {
             // By sending no options it'll come back here
             $url = $wechat->authorize(array('redirect_uri' => $redirect_uri));
             redirect($url);
         } else {
             try {
                 // Have a go at creating an access token from the code
                 $token = $wechat->access($_GET['code'], array('redirect_uri' => $redirect_uri));
                 // Use this object to try and get some user details (username, full name, etc)
                 $user = $wechat->get_user_info($token);
                 $this->openid = $user->openid;
                 session('openid_' . $this->token, $user->openid);
             } catch (OAuth2_Exception $e) {
                 print_r($e);
                 die;
             }
         }
     } else {
         $this->openid = session('openid_' . $this->token);
     }
     $url = C('site_url') . "/index.php?g=Wap&m=Coupon&a=index&type=1&token=" . $this->token . '&id=' . $this->coupon_id . '&wecha_id=' . $this->openid;
     header('Location:' . $url);
 }
开发者ID:zhaoshengloveqingqing,项目名称:Wechat,代码行数:32,代码来源:CouponsAction.class.php


示例7: Oauth2

 public function Oauth2()
 {
     if (!session('openid_' . $this->token)) {
         $this->info = M('wxuser')->where(array('token' => $this->token))->find();
         vendor("Oauth2.OAuth2", LIB_PATH . '../Extend/Vendor');
         vendor("Oauth2.Provider.Wechat", LIB_PATH . '../Extend/Vendor');
         $wechat = new Wechat();
         $wechat->config(array('id' => $this->info['appid'], 'secret' => $this->info['appsecret']));
         $redirect_uri = $_GET['method_name'];
         if (!$_GET['code']) {
             $redirect_uri = C('site_url') . '/index.php/Fxs/Fxs/Oauth2?token=' . $this->token . '&method_name=' . $_GET['method_name'];
             // By sending no options it'll come back here
             $url = $wechat->authorize(array('redirect_uri' => $redirect_uri));
             redirect($url);
         } else {
             try {
                 // Have a go at creating an access token from the code
                 $token = $wechat->access($_GET['code'], array('method_name' => $redirect_uri));
                 // Use this object to try and get some user details (username, full name, etc)
                 $user = $wechat->get_user_info($token);
                 session('openid_' . $this->token, $user->openid);
             } catch (OAuth2_Exception $e) {
                 print_r($e);
                 die;
             }
         }
     }
     if (session('openid_' . $this->token)) {
         $user = M('reguser')->where(array('token' => $this->token, 'openid' => session('openid_' . $this->token)))->find();
         if (!$user) {
             session_destroy();
         }
     }
     header('Location:' . U('Fxs/' . $_GET['method_name'], array('token' => $this->token)));
 }
开发者ID:zhaoshengloveqingqing,项目名称:Wechat,代码行数:35,代码来源:FxsAction.class.php


示例8: updatefeedback

 function updatefeedback()
 {
     $id = $this->_get('id', 'intval');
     header('Content-Type:text/html;charset=utf-8');
     $wetallroute = dirname(dirname(dirname(dirname(dirname(__FILE__)))));
     //dump($wetallroute);exit;
     include $wetallroute . "/wxpay/config.php";
     //dump($config);exit;
     include $wetallroute . "/wxpay/lib.php";
     $wechat = new Wechat();
     // openid 与 feedback参数都可以从数据库中得到
     $feedback = $this->_mod->where(array('id' => $id))->find();
     //dump($feedback);exit;
     //$content = 'http://api.weixin.qq.com/cgi-bin/pay/delivernotify?access_token=' . $wechat->getAccessToken($config) . '&openid=' . $feedback['openid'] . '&feedbackid=' . $feedback['feedbackid'];
     $content = 'https://api.weixin.qq.com/payfeedback/update?access_token=' . $wechat->getAccessToken($config) . '&openid=' . $feedback['openid'] . '&feedbackid=' . $feedback['feedbackid'];
     //dump($content);
     $result = $wechat->curlGet($content);
     //dump($result);exit;
     $result = json_decode($result, true);
     if ($result['errcode'] == 0) {
         //echo 'success';
         //IS_AJAX && $this->ajaxReturn(1, $result['errmsg'], '', 'edit');
         $this->_mod->where(array('id' => $id))->save(array('status' => 1));
         $this->success('通知微信成功!');
     } elseif ($result['errcode'] == -1 && $result['errmsg'] == 'system error') {
         $this->_mod->where(array('id' => $id))->save(array('status' => 1));
         $this->success('已经通知过微信,更改状态成功!');
     } else {
         //IS_AJAX && $this->ajaxReturn(0, $result['errmsg']);
         $this->error($result['errmsg']);
     }
 }
开发者ID:dlpc,项目名称:weixinshop,代码行数:32,代码来源:wxpay_rightsAction.class.php


示例9: send

 function send()
 {
     $u = M("user")->where(array(id => intval($_REQUEST['id'])))->find();
     import("@.ORG.Weixin");
     $wechatObj = new Wechat();
     $data = " {\r\n           \"touser\":\"" . $u['wxpas'] . "\",\r\n           \"template_id\":\"SCFdz1m9pGOO6U-LXp6qv8CUJakT3_Zk-74tjdnK0ok\",\r\n           \"url\":\"http://weixin.qq.com/download\",\r\n           \"topcolor\":\"#FF0000\",\r\n           \"data\":{\r\n                   \"first\": {\r\n                       \"value\":\"恭喜你购买成功!\",\r\n                       \"color\":\"#173177\"\r\n                   },\r\n                   \"keyword1\":{\r\n                       \"value\":\"" . $u['realname'] . "\",\r\n                       \"color\":\"#173177\"\r\n                   },\r\n                   \"keynote2\": {\r\n                       \"value\":\"" . $u['id'] . "产品名称\",\r\n                       \"color\":\"#173177\"\r\n                   },\r\n                   \"keynote3\": {\r\n                       \"value\":\"" . $u['id'] . "\",\r\n                       \"color\":\"#173177\"\r\n                   },\r\n                   \"remark\":{\r\n                       \"value\":\"此订单信息请点击这里查看!!\",\r\n                       \"color\":\"#173177\"\r\n                   }\r\n           }\r\n       }";
     echo $wechatObj->tplmsg($data);
 }
开发者ID:anywn3773,项目名称:gzsrex,代码行数:8,代码来源:UserAction.class.php


示例10: index

 public function index()
 {
     $this->token = 'cmgeshengli';
     $weixin = new \Wechat($this->token);
     $this->data = $weixin->request();
     list($content, $type) = $this->reply($this->data);
     $weixin->response($content, $type);
 }
开发者ID:00606,项目名称:cmge,代码行数:8,代码来源:WeixinController.class.php


示例11: wxoauth

 public function wxoauth()
 {
     $scope = 'snsapi_base';
     $code = isset($_GET['code']) ? $_GET['code'] : '';
     $token_time = isset($_SESSION['token_time']) ? $_SESSION['token_time'] : 0;
     if (!$code && isset($_SESSION['open_id']) && isset($_SESSION['user_token']) && $token_time > time() - 3600) {
         if (!$this->wxuser) {
             $this->wxuser = $_SESSION['wxuser'];
         }
         $this->open_id = $_SESSION['open_id'];
         return $this->open_id;
     } else {
         $options = array('token' => $this->options["token"], 'appid' => $this->options["appid"], 'appsecret' => $this->options["appsecret"]);
         $we_obj = new Wechat($options);
         if ($code) {
             $json = $we_obj->getOauthAccessToken();
             if (!$json) {
                 unset($_SESSION['wx_redirect']);
                 die('获取用户授权失败,请重新确认');
             }
             $_SESSION['open_id'] = $this->open_id = $json["openid"];
             $access_token = $json['access_token'];
             $_SESSION['user_token'] = $access_token;
             $_SESSION['token_time'] = time();
             $userinfo = $we_obj->getUserInfo($this->open_id);
             if ($userinfo && !empty($userinfo['nickname'])) {
                 $this->wxuser = array('open_id' => $this->open_id, 'nickname' => $userinfo['nickname'], 'sex' => intval($userinfo['sex']), 'location' => $userinfo['province'] . '-' . $userinfo['city'], 'avatar' => $userinfo['headimgurl']);
             } elseif (strstr($json['scope'], 'snsapi_userinfo') !== false) {
                 $userinfo = $we_obj->getOauthUserinfo($access_token, $this->open_id);
                 if ($userinfo && !empty($userinfo['nickname'])) {
                     $this->wxuser = array('open_id' => $this->open_id, 'nickname' => $userinfo['nickname'], 'sex' => intval($userinfo['sex']), 'location' => $userinfo['province'] . '-' . $userinfo['city'], 'avatar' => $userinfo['headimgurl']);
                 } else {
                     return $this->open_id;
                 }
             }
             if ($this->wxuser) {
                 $_SESSION['wxuser'] = $this->wxuser;
                 $_SESSION['open_id'] = $json["openid"];
                 unset($_SESSION['wx_redirect']);
                 return $this->open_id;
             }
             $scope = 'snsapi_userinfo';
         }
         if ($scope == 'snsapi_base') {
             $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
             $_SESSION['wx_redirect'] = $url;
         } else {
             $url = $_SESSION['wx_redirect'];
         }
         if (!$url) {
             unset($_SESSION['wx_redirect']);
             die('获取用户授权失败');
         }
         $oauth_url = $we_obj->getOauthRedirect($url, "wxbase", $scope);
         header('Location: ' . $oauth_url);
     }
 }
开发者ID:pinghu1,项目名称:wechat-php-sdk,代码行数:57,代码来源:auth.php


示例12: __construct

 public function __construct(Wechat $wechat)
 {
     $this->content = $wechat->getRev()->getRevContent();
     $this->sender = $wechat->getRev()->getRevFrom();
     $this->create_time = $wechat->getRev()->getRevCtime();
     $this->msg_id = $wechat->getRev()->getRevID();
     $this->models = new TextModel();
     $this->models->actionIndex($this->content, $this->sender, $this->msg_id);
 }
开发者ID:emonmit,项目名称:shikun.wang-wechat-gsjl,代码行数:9,代码来源:TextController.php


示例13: index

 public function index()
 {
     $this->token = $this->_get('token');
     $weixin = new Wechat($this->token);
     $data = $weixin->request();
     $this->data = $weixin->request();
     $this->my = C('site_my');
     list($content, $type) = $this->reply($data);
     $weixin->response($content, $type);
 }
开发者ID:dlpc,项目名称:wxshoppingmall,代码行数:10,代码来源:WeixinAction.class.php


示例14: send_wechat_msg_pe

function send_wechat_msg_pe($staff_openid, $template_id, $url_ticket_id, $first_data, $remark_data, $keyword1_data, $keyword2_data, $keyword3_data = null)
{
    $notice_data = ["touser" => $staff_openid, "template_id" => $template_id, "url" => "https://wechat.gds-services.com/static/html/query_req_detail.html?tid=" . $url_ticket_id, "topcolor" => "#000", "data" => ["first" => ["value" => $first_data, "color" => "#000"], "remark" => ["value" => $remark_data, "color" => "#000"], "keyword1" => ["value" => $keyword1_data, "color" => "#000"], "keyword2" => ["value" => $keyword2_data, "color" => "#000"]]];
    if (!empty($keyword3_data) && $keyword3_data != null) {
        $notice_data->data->keyword3 = ["value" => $keyword3_data, "color" => "#000"];
    }
    $options = ['token' => 'nizhidaoma', 'encodingaeskey' => 'IXR7m0K8Q7KOIC4z9s1CRHNQBqrJfFGTUT86CECPaXM', 'appid' => 'wx6bc0c53a3a1c150d', 'appsecret' => '3888ccc01ec4e5d6e0e673308e92e627', 'debug' => true, 'logcallback' => '_log'];
    include dirname(__FILE__) . "/../qy-sdk/wechat.class.php";
    $weObj = new Wechat($options);
    return $weObj->sendTemplateMessage($notice_data);
}
开发者ID:adexbn,项目名称:gds_wechat,代码行数:11,代码来源:send_wechat_test.php


示例15: index

 public function index()
 {
     $wechat = new Wechat($this->config);
     $data = $wechat->request();
     list($content, $type) = $this->reply($data);
     if (!empty($content)) {
         $wechat->response($content, $type);
     } else {
         exit;
     }
 }
开发者ID:belerweb,项目名称:pigcms,代码行数:11,代码来源:WeixinAction.class.php


示例16: index

 public function index()
 {
     import("@.ORG.Weixin");
     $config = $this->Config;
     $wxconfig = F("wxconfig");
     $user = M("user");
     $data = array();
     $wechatObj = new Wechat();
     if ($wxconfig["wstatu"] != "") {
         $data = $wechatObj->responseMsg($idx);
         //接收到的
         $me = $data['me'];
         $guest = $data['user'];
         //////////////////////*用户打入库-开始*///////////////
         $this->adduser($guest);
         if ($data['key'] == "ewm") {
             $ewm = $wechatObj->ewm(2, 1);
             $wechatObj->sendtext($guest, $me, $ewm);
         }
         $wechatObj->sendtext($guest, $me, $guest);
         exit;
         ///////////////////////////////事件开始/////////////////////////
         if ($data['type'] == "event") {
             //关注
             if ($data['event'] == "subscribe" || $data['event'] == "SCAN") {
                 if ($data['key'] == 1) {
                     $user = M("user")->where("wxid='" . sysmd5($guest) . "'")->setfield('vip', 1);
                     $map1['url'] = "http://mall.bydauto.com.cn/echo/index/store";
                     $map1['title'] = "vip会议标题['待定..']";
                     $map1['description'] = "描述的文字['待定..'],点击进去的链接待定,下面的图片大小700x400";
                     $map1['thumb'] = "http://byd.gzqizhen.com/Public/byd/byd.jpg";
                     $wechatObj->sendimg($guest, $me, $map1);
                     exit;
                 }
                 if ($data['key'] == 2) {
                     $vip = M("user")->where("wxid='" . sysmd5($guest) . "'")->getfield('vip');
                     if (!$vip) {
                         $user = M("user")->where("wxid='" . sysmd5($guest) . "'")->setfield('vip', 2);
                     }
                     $map2['url'] = "http://mall.bydauto.com.cn/echo/index/store";
                     $map2['title'] = "新能源['待定..']";
                     $map2['description'] = "描述的文字['待定..']下面的图片大小700x400";
                     $map2['thumb'] = "http://byd.gzqizhen.com/Public/byd/byd.jpg";
                     $wechatObj->sendimg($guest, $me, $map2);
                     // $wechatObj->sendtext($guest,$me,"新能源");
                     exit;
                 }
             }
         }
         ///////////////////////////////事件结束/////////////////////////
         $wechatObj->sendimg($guest, $me, $wxconfig);
     } else {
         M("config")->where("varname='wstatu'")->setField('value', "清理此位置可以重新设置微信接入!");
         $wechatObj->valid($wxconfig["token"]);
         savecache("Config");
     }
 }
开发者ID:anywn3773,项目名称:gzqz,代码行数:57,代码来源:IndexAction.class.php


示例17: showTip

function showTip($smarty, $tip, $db, $title)
{
    $options = array('token' => WX_TOKEN, 'appid' => WX_APPID, 'encodingaeskey' => '6pnP7qHyqJ1kFXMjuO4Z3QrpOa9WfapsgkPOtXoZKC2', 'appsecret' => WX_SECRET, 'logcallback' => logdebug);
    $we = new Wechat($options);
    $auth = $we->checkAuth();
    $js_ticket = $we->getJsTicket();
    $smarty->assign('tip', $tip);
    $smarty->assign('title', $title);
    $url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $smarty->assign('js_sign', $we->getJsSign($url));
    $smarty->display('templates/tip.html');
    $db->disconnect();
    die;
}
开发者ID:xuhongxu96,项目名称:Tagexing,代码行数:14,代码来源:main.php


示例18: index

 public function index()
 {
     import('Vendor.Wechat.Wechat');
     $option = array('token' => 'weixin', 'appid' => 'wx444c22311a33b40d', 'secret' => 'f39ae15e9d86c293edbff26a9c47af6e');
     $wechatObj = new \Wechat($option);
     $wechatObj->valid();
     //解析来向XML
     $msg = $wechatObj->getRev();
     $message['fromUsername'] = $msg->getRevFrom();
     $message['toUsername'] = $msg->getRevTo();
     $message['type'] = $msg->getRevType();
     $message['createtime'] = $msg->getRevCtime();
     $message['keyword'] = $msg->getRevContent();
     $message['event'] = $msg->getRevEvent();
     //保存新用户相关信息
     $status = D('Member');
     $status->InsertNewer($message['fromUsername']);
     //主要部分,暂时仅使用TEXT,EVENT两种
     switch ($message['type']) {
         case $wechatObj::MSGTYPE_TEXT:
             $text = A('Text');
             $ret = $text->textSkip($message);
             if ('text' == $ret['type']) {
                 $wechatObj->text($ret['content'])->reply();
             } else {
                 if ('news' == $ret['type']) {
                     $wechatObj->news($ret['content'])->reply();
                 }
             }
             break;
         case $wechatObj::MSGTYPE_EVENT:
             $event = A('Event');
             $ret = $event->eventSkip($message);
             if ('text' == $ret['type']) {
                 $wechatObj->text($ret['content'])->reply();
             } else {
                 if ('news' == $ret['type']) {
                     $wechatObj->news($ret['content'])->reply();
                 }
             }
             break;
         default:
             $wechatObj->text('更多功能正在研发中,敬请期待')->reply();
     }
     //获取菜单
     $menu = $wechatObj->getMenu();
     //创建菜单
     $newmenu = array('小瓜神力' => array(array('type' => 'click', 'name' => '新生专题', 'key' => 'V1001_01_01'), array('type' => 'click', 'name' => '校车时刻', 'key' => 'V1001_01_02'), array('type' => 'click', 'name' => '交通导航', 'key' => 'V1001_01_03'), array('type' => 'click', 'name' => '考试成绩', 'key' => 'V1001_01_04'), array('type' => 'click', 'name' => '图书信息', 'key' => 'V1001_01_05')), '军训专题' => array(array('type' => 'click', 'name' => '通知公告', 'key' => 'V1001_02_01'), array('type' => 'click', 'name' => '军训快报', 'key' => 'V1001_02_02'), array('type' => 'click', 'name' => '军营风采', 'key' => 'V1001_02_03'), array('type' => 'view', 'name' => '军歌嘹亮', 'url' => 'http://mp.weixin.qq.com/s?__biz=MjM5OTIxMTM2Mg==&mid=209183345&idx=1&sn=96c4cf9ad618e5e051167456210d9fe8&scene=5&srcid=OJ8qMfaW9nS5T0jFFjQj#rd'), array('type' => 'click', 'name' => '微军训', 'key' => 'V1001_02_05')), '小瓜威武' => array(array('type' => 'click', 'name' => '小瓜在线', 'key' => 'V1001_03_01'), array('type' => 'click', 'name' => '跑操查询', 'key' => 'V1001_03_02'), array('type' => 'view', 'name' => '瓜棚论坛', 'url' => 'http://npuxiaogua.mgschool.cn/wx/apps/liuyan/'), array('type' => 'view', 'name' => '失物招领', 'url' => 'http://npuxiaogua.mgschool.cn/wx/npuxg_blog/wxq/index.php'), array('type' => 'click', 'name' => '表白墙', 'key' => 'V1001_03_05')));
     $result = $wechatObj->createMenu($newmenu);
 }
开发者ID:partholon,项目名称:xiaogua,代码行数:50,代码来源:IndexController.class.php


示例19: __construct

 /**
  * 初始化,判断此次请求是否为验证请求,并以数组形式保存
  *
  * @param string $token 验证信息
  * @param boolean $debug 调试模式,默认为关闭
  */
 public function __construct($token, $fromtype, $debug = FALSE)
 {
     if (!empty($_GET["version"])) {
         $ver = new version();
         $ver->verSions();
     }
     if (!$this->validateSignature($token)) {
         exit('签名验证失败');
     }
     if ($this->isValid()) {
         // 网址接入验证
         exit($_GET['echostr']);
     }
     if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) {
         exit('缺少数据');
     }
     set_error_handler(array(&$this, 'errorHandler'));
     // 设置错误处理函数,将错误通过文本消息回复显示
     //file_put_contents('s.txt',$GLOBALS['HTTP_RAW_POST_DATA']);
     $xml = (array) simplexml_load_string($GLOBALS['HTTP_RAW_POST_DATA'], 'SimpleXMLElement', LIBXML_NOCDATA);
     //file_put_contents('s.txt',$xml);
     $this->request = array_change_key_case($xml, CASE_LOWER);
     // 将数组键名转换为小写,提高健壮性,减少因大小写不同而出现的问题
     Wechat::$fromtype = $fromtype;
     $this->debug = $debug;
 }
开发者ID:renzg,项目名称:wxwall,代码行数:32,代码来源:wechat.php


示例20: notify

 public function notify(Request $request)
 {
     \Log::debug('payment_notify', ['request' => $request]);
     $input = XML::parse($request->getContent());
     if ($input['return_code'] == 'SUCCESS') {
         $order = Order::where('wx_out_trade_no', $input['out_trade_no'])->firstOrFail();
         $address_id = $order->address_id;
         # 当前订单收货地址id
         if ($order->isPaid()) {
             return 'FAIL';
         }
         $order->update(['wx_transaction_id' => $input['transaction_id'], 'cash_payment' => floatval($input['total_fee']) / 100.0]);
         $order->paid();
         /*  发送消息提醒 */
         $default_address = Address::where(['id' => $address_id])->first();
         $phone = $default_address->phone;
         $msg = '尊敬的顾客您好!您的订单已经收到,易康商城将尽快为您安排发货,如有任何问题可以拨打客服电话400-1199-802进行咨询,感谢您的惠顾!';
         \MessageSender::sendMessage($phone, $msg);
         //            if ($phone = env('ORDER_ADMIN_PHONE')) {
         //                \Log::error($phone);
         //                \MessageSender::sendMessage($phone, $order->toOrderMessageString());
         //            }
         $result = \Wechat::paymentNotify();
         return $result;
     }
     return 'FAIL';
 }
开发者ID:whplay,项目名称:ohmate-shop,代码行数:27,代码来源:PaymentController.php



注:本文中的Wechat类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Wekit类代码示例发布时间:2022-05-23
下一篇:
PHP Website类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap