public function handle_request() { //实例微信 $WechatMbroker = new Bll_Wechat_Mbroker_WechatMbroker(); //服务器认证,监听事件,接收用户消息等所有微信向我们自有服务器发起请求 $result = $WechatMbroker->WechatServer(); //结果返回 echo $result; }
public function handle_request() { $request = APF::get_instance()->get_request(); $params = $request->get_parameters(); $allowTypes = array('image', 'voice', 'video', 'thumb', 'news'); header('Content-Type:text/html; charset=utf-8'); if (!in_array($params['type'], $allowTypes)) { echo "素材类型不对\n"; print_r($allowTypes); exit; } //实例微信 $WechatMbroker = new Bll_Wechat_Mbroker_WechatMbroker(); //设置自定义菜单 $result = $WechatMbroker->getMediaList($params['type'], $params['offset'], $params['count']); //结果返回 print_r($result); }
/** * 微信授权登陆 * @return array */ public static function checkAuthLogin() { //根据code获取经纪人的openid $WechatMbroker = new Bll_Wechat_Mbroker_WechatMbroker(); $wechatUserInfo = $WechatMbroker->getAuthUserInfo(); //判断openid是否存在 if (!$wechatUserInfo['openid']) { return self::getMsg(array('msg' => '未获取到openid')); } //获取绑定信息 $wechatUser = Model_Wechat_WechatUsers::getUserIdByOpenId($wechatUserInfo['openid']); if (!$wechatUser || !$wechatUser['userId']) { return self::getMsg(array('msg' => '微信未绑定', 'openid' => $wechatUserInfo['openid'])); } //查询用户信息 $userInfo = Model_Broker_Member::getAjkMembersByUserId($wechatUser['userId']); if (empty($userInfo)) { return self::getMsg(array('msg' => '微信未绑定', 'openid' => $wechatUserInfo['openid'])); } //返回用户信息 return self::getMsg($userInfo, true); }
public function handle_request() { //获取关注的微信用户 $WechatInfoList = Model_Wechat_WechatUsers::getWechatInfoListById($this->id, $this->limit); //判断当前队列是否处理完成 if (empty($WechatInfoList)) { //清空游标 $this->setFlag(array('id' => 0)); //停止shell调用 $this->setStop(); //写过程日志 $this->setLog('处理完成'); exit; } $WechatMbroker = new Bll_Wechat_Mbroker_WechatMbroker(); //数据处理 foreach ($WechatInfoList as $list) { $this->id = $list['id']; //判断微信是否关注 if ($list['status'] != Model_Wechat_WechatUsers::subscribe) { $this->setLog(date('Y-m-d H:i:s') . ' openid:' . $list['openId'] . ' userid:' . $list['userId'] . ' 未关注'); continue; } //判断关注账号是否绑定 if (!$list['userId']) { $this->setLog(date('Y-m-d H:i:s') . ' openid:' . $list['openId'] . ' userid:' . $list['userId'] . ' 微信未绑定'); continue; } //推送消息 $WechatMbroker->setMbrokeNoticeFromTemplate($list['openId'], $list['userId'], $list['userType']); //记录游标 $this->setFlag(array('id' => $this->id)); } //休息10毫秒 $this->setShCommonSleepTime(0.01); }
public function menuList() { //实例微信 $WechatMbroker = new Bll_Wechat_Mbroker_WechatMbroker(); return array(array('name' => '数据控', 'type' => null, 'key' => null, 'buttons' => array(array('name' => '查询数据', 'type' => 'view', 'key' => $WechatMbroker->getLoginAuthUrl()), array('name' => '数据项说明', 'type' => 'click', 'key' => Bll_Wechat_Mbroker_WechatMbroker::key_mbroker_data_explain))), array('name' => '赚客宝', 'type' => null, 'key' => null, 'buttons' => array(array('name' => '微聊', 'type' => 'click', 'key' => Bll_Wechat_Mbroker_WechatMbroker::key_mbroker_we_chat), array('name' => '微店营销', 'type' => 'click', 'key' => Bll_Wechat_Mbroker_WechatMbroker::key_mbroker_micro_shop), array('name' => '下载app', 'type' => 'click', 'key' => Bll_Wechat_Mbroker_WechatMbroker::key_mbroker_app_down))), array('name' => '福利多', 'type' => 'click', 'key' => Bll_Wechat_Mbroker_WechatMbroker::key_mbroker_more_welfare)); }