Пример #1
0
 private function _getOpenReplay($responseId)
 {
     $post_string = $GLOBALS["HTTP_RAW_POST_DATA"];
     $openReplayInfo = OpenReplayModel::model()->with('open_openPlatForm')->findByPk($responseId);
     $apiUrl = $openReplayInfo->open_openPlatForm->apiUrl;
     $token = $openReplayInfo->open_openPlatForm->token;
     $wechatApi = new WechatApi($token);
     $url = $wechatApi->buildSignUrl($apiUrl);
     $result = HttpRequest::sendHttpRequest($url, $post_string, 'POST', array("Content-type: text/xml"));
     return $result['content'] ? $result['content'] : '';
 }
Пример #2
0
 /**
  * 转接平台状态检查
  * @param $id
  */
 public function actionOpenStatus($id)
 {
     $result = 0;
     $model = OpenPlatformModel::model()->findByPk($id);
     if ($model) {
         $echostr = 'hello';
         $wechatApi = new WechatApi($model->token);
         $url = $wechatApi->buildSignUrl($model->apiUrl, array('echostr' => $echostr));
         $content = HttpRequest::sendHttpRequest($url);
         if ($content['content'] == $echostr) {
             $result = 1;
         }
         $model->status = $result;
         $model->save();
     }
     echo json_encode(array('result' => $result));
 }