userScratch(); // lsm_ep($tmpWinData); // $checkResult = self::checkLoginStatus(false, Request::url()); // if (!$checkResult->isSuccess()) { // self::redirect($checkResult->getData()); // } // echo self::getNickname() .'已登录';exit; // self::echo_404();exit; # 写登录cookie $objPassport = new Passport(); $tmpResult = $objPassport->writeLoginCookie(array( 'uid' => '1', 'openid' => 'oFXnzjiwQjurzw-rv_N4YRFxK5B0', 'loginType' => Passport::LOGIN_TYPE_HAS_AUTH,//base userInfo 'nickname' => '林子', 'sex' => '1', 'headimgurl'=> 'http://wx.qlogo.cn/mmopen/5SIXXLvbyUzwfpcLCvWgfctgRLzmicFUCL0QFyxL8atGWsJFcpse1Mg4ib8JbHv4QUnXrVN3bdq4JYA8TkqOsNl9oE2CibUHfIQ/0', 'expire' => time() + 70*24*60*60, //cookie有效期7天 )); var_dump($tmpResult);exit; # 删除登录cookie // var_dump(Cookie::set('TM_PASSPORT_MEMBER', 0, -1));exit; // $objVogueConnect = new VogueConnect(); // $t = $objVogueConnect->add(array( // 'openid' => 'osWOmsxdrjwt0Wtm-KDL0Fch98Zo', // 'connect_uid' => '533', // 'connect_uname' => '林子', // 'connect_email' => 'lsm1@gmail.com', // 'connect_mobile' => '15811111116', // ),AbstractDao::PARAM_CREATE_ACTION_ONDUPLICATE, array()); // lsm_ep($t); // echo md5('wechatosWOmsxdrjwt0Wtm-KDL0Fch98Zo渠大昂。Bboy_Canal1http://wx.qlogo.cn/mmopen/PiajxSqBRaEJXxL6L1JmZHfUNFBjpd4BARNh90A23mZiaicGUPtznkfBKriaL3OU1rTicJiapbQHG0cIm6dLomcCl1bg/0og8M4uOsdzMDosPNv8R1dyNd__VQOezXcEiiBSKSxW0eoylIeCTtFeFp0E9z6KaC1KJvJQiCzMu1UJZOeat1AWpqDWjTgbFecE_ZQ2JaueBskOcsZfMKGKhXV9aCLEkk-cmFKJX_U4Eql2ilgKzyMiu-eWO_CT-5se8i-_hokHtLg8B0Lgwechatproductsecretkey');exit; // $objVogueApi = new VogueApi(); // $objWeixinApi = new WeixinApi(); // $qrcodeUrlResult = $objWeixinApi->createSteadyQrcode(3); // lsm_ep($qrcodeUrlResult->getData()); // $r = $objWeixinApi->getUserInfo('oFXnzjqBIeyU9pRbnDifP40KSY0o'); // lsm_ep($r); # 修改用户信息 # 绑定 // $openid = 'osWOmsxdrjwt0Wtm-KDL0Fch98Zo'; // $unionid = md5($openid + 'wechat'); // $r = $objVogueApi->bind(array( // 'openid' => $openid, // 'nickname' => '渠大昂。Bboy_Canal', // 'sex' => '1', // 'headimgurl' => 'http://wx.qlogo.cn/mmopen/PiajxSqBRaEJXxL6L1JmZHfUNFBjpd4BARNh90A23mZiaicGUPtznkfBKriaL3OU1rTicJiapbQHG0cIm6dLomcCl1bg/0', // 'unionid' => 'og8M4uOsdzMDosPNv8R1dyNd__VQ', // 'token' => 'OezXcEiiBSKSxW0eoylIeCTtFeFp0E9z6KaC1KJvJQiCzMu1UJZOeat1AWpqDWjTgbFecE_ZQ2JaueBskOcsZfMKGKhXV9aCLEkk-cmFKJX_U4Eql2ilgKzyMiu-eWO_CT-5se8i-_hokHtLg8B0Lg', // )); // lsm_ep($r); # 获取用户信息 // $r = $objVogueApi->userInfo('4027995'); // lsm_ep($r); # 发送验证码短信 // $r = $objVogueApi->sendSMS('15810227564'); // lsm_ep($r); # 检查验证码 // $r = $objVogueApi->verifyCode(15810227564, '03632'); // lsm_ep($r); // $objWeixinQrcode = new WeixinQrcode(); // $a = $objWeixinQrcode->incrStatis('oEuf2t5oS6yILLEf124neknCVweM', 4); // var_dump($a);exit; // $result = self::checkLoginStatus(false, Request::schemeDomain()); // lsm_ep($result); // $user = $this->getUser(); // lsm_ep($user); // $objTest = new \Cas\Dao\Test(); // $a = $objTest->create(array( // 'content' => 'hello world', // )); // var_dump($a); // $key = 'test'; // $objMemcached = new Memcached(); // $r = $objMemcached->set($key, 'hello world'); // var_dump($r); // $m = $objMemcached->getResultMessage(); // var_dump($m); // $a = $objMemcached->get($key); // var_dump($a); // $objWeixinApi = new WeixinApi(); // $tmpResult = $objWeixinApi->mediaUpload('/export/manager/vogue/kissy/public/upload/media/2014/0817/170257_27899.mp3', 'voice'); // lsm_ep($tmpResult); // $user = array(); // $objPassport = new Passport(); // $tmpResult = $objPassport->getLoginInfo(); // if ($tmpResult->isSuccess()) { // $user = $tmpResult->getData(); // } // lsm_ep($user); // $objWeixinUser = new WeixinUser(); // $openid = 'lsm-b'; // $info = array( // 'openid' => $openid, // 'nickname' => 'lsm-a-name', // 'sex' => 1, // ); // $a = $objWeixinUser->notsubscribe($info); // lsm_ep($a); # 写登录cookie // $objPassport = new Passport(); // $tmpResult = $objPassport->writeLoginCookie(array( // 'uid' => '2', // 'openid' => 'oEuf2t5oS6yILLEf124neknCVweM', // 'loginType' => Passport::LOGIN_TYPE_HAS_AUTH,//base userInfo // 'expire' => time() + 7*24*60*60, //cookie有效期7天 // )); // lsm_ep($tmpResult); $this->tpl = 'test'; // $this->setOutput('user', $user); // $this->setOutput('weixinShare', array( // 'title' => '标题', // 'content' => '内容', // 'imgUrl' => 'http://vogue.lishuy.com/public/upload/image/2014/0913/z.134441_22298.jpeg' // )); } public function doLogout() { # 删除登录cookie var_dump(Cookie::set('TM_PASSPORT_MEMBER', 0, -1));exit; } public function uploadMedia(){ $fields['media'] = '@/export/manager/vogue/kissy/public/upload/media/2014/0817/170257_27899.mp3'; $ch = curl_init('http://file.api.weixin.qq.com/cgi-bin/media/upload?type=voice&access_token=d_clnHeNrfgiS6yWy66Dy4tNOtposlCJrry-abs-MsaK1bSW8ENyXY-91Eku5o-UbARBbo4Ye7HLgH9UaNQ4fA') ; curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$fields); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch) ; if (curl_errno($ch)) { return curl_error($ch); } curl_close($ch); return $result; } public function doSendTemplate() { $objWeixinApi = new WeixinApi(); $openid = 'oFXnzjiwQjurzw-rv_N4YRFxK5B0';//李淑明 test $result = $objWeixinApi->sendTemplateMessage($openid); print_r($result); } public function doModifyMsgType() { $objWeixinChatsData = new WeixinChatsData(); $ids = $objWeixinChatsData->findIdsBy(array('type' => array(1, 3))); $data = $objWeixinChatsData->gets($ids); foreach ($data as $info) { switch ($info['MsgType']) { case 'text': $contentType = "文本"; $msgType = WeixinChatsData::MSG_TYPE_TEXT; break; case 'image': $contentType = "图片"; $msgType = WeixinChatsData::MSG_TYPE_IMG; break; case 'voice': $contentType = "语音"; $msgType = WeixinChatsData::MSG_TYPE_VOICE; break; case 'video': $contentType = "视频"; $msgType = WeixinChatsData::MSG_TYPE_VIDEO; break; case 'location': $contentType = "地理位置"; $msgType = WeixinChatsData::MSG_TYPE_LOCATION; break; case 'link': $contentType = "链接"; $msgType = WeixinChatsData::MSG_TYPE_LINK; break; case 'event': $event = $info['Event']; switch ($event) { case 'subscribe': $eventKey = $info['EventKey']; if ($eventKey) { $contentType = "扫二维码"; $msgType = WeixinChatsData::MSG_TYPE_QR; } else { $contentType = "订阅"; $msgType = WeixinChatsData::MSG_TYPE_SUBSCRIBE; } break 2; case 'unsubscribe': $contentType = "取消订阅"; $msgType = WeixinChatsData::MSG_TYPE_UNSUBSCRIBE; break 2; case 'LOCATION': $contentType = "地理位置"; $msgType = WeixinChatsData::MSG_TYPE_LOCATION; break 2; case 'CLICK': $contentType = "菜单操作"; $msgType = WeixinChatsData::MSG_TYPE_MENU; break 2; case 'VIEW': $contentType = "菜单操作"; $msgType = WeixinChatsData::MSG_TYPE_MENU; break 2; case 'SCAN': $contentType = "扫二维码"; $msgType = WeixinChatsData::MSG_TYPE_QR; break; } break; case 'custom_send_text': //后台自定义的消息 $contentType = "客服消息"; $msgType = WeixinChatsData::MSG_TYPE_SEND; break; default: $contentType = "不支持"; $msgType = WeixinChatsData::MSG_TYPE_UNKNOW; break; } $tableInfo = array( 'id' => $info['id'], 'type' => 1, 'msgType' => $msgType, ); $result = $objWeixinChatsData->modify($tableInfo); if (!$result->isSuccess()) { print_r($result->getData());exit; } } } public function doBindTest() { $objVogueApi = new VogueApi(); $openid = 'osWOmsxdrjwt0Wtm-KDL0Fch98Zo'; $unionid = md5($openid + 'wechat'); $r = $objVogueApi->bind(array( 'openid' => $openid, 'nickname' => '渠大昂。Bboy_Canal', 'sex' => '1', 'headimgurl' => 'http://wx.qlogo.cn/mmopen/PiajxSqBRaEJXxL6L1JmZHfUNFBjpd4BARNh90A23mZiaicGUPtznkfBKriaL3OU1rTicJiapbQHG0cIm6dLomcCl1bg/0', 'unionid' => 'og8M4uOsdzMDosPNv8R1dyNd__VQ', 'token' => 'OezXcEiiBSKSxW0eoylIeCTtFeFp0E9z6KaC1KJvJQiCzMu1UJZOeat1AWpqDWjTgbFecE_ZQ2JaueBskOcsZfMKGKhXV9aCLEkk-cmFKJX_U4Eql2ilgKzyMiu-eWO_CT-5se8i-_hokHtLg8B0Lg', )); print_r($r);exit; } /** * * 导入订阅时间 * @author lishumingoo@gmail.com */ public function doImportSubscribeTime() { $objWeixinUserBaseInfo = new WeixinUserBaseInfo(); $users = $objWeixinUserBaseInfo->findBy(null,null,null,'id,extend'); foreach ($users as $tmpUser) { $uid = $tmpUser['id']; $tmpUser = unserialize($tmpUser['extend']); if (!$tmpUser['subscribe_time']) { continue; } $tableInfo = array( 'subscribe_time' => $tmpUser['subscribe_time'], ); $condition = array( 'id' => $uid, ); $tmpResult = $objWeixinUserBaseInfo->update($tableInfo, $condition); if (!$tmpResult) { self::echo_msg("导入失败UID:{$uid}"); } self::echo_msg("导入成功"); } } public function display() { $this->render(); } }