Ejemplo n.º 1
0
 /**
  * 获得关键字回复
  */
 public function getKeyWordRep($user, $object, $keyword, $weixinuser)
 {
     $firstkeyword = substr($keyword, 0, 1);
     if ("yy" === strtolower(trim($keyword))) {
         $firstkeyword = "yy";
     }
     $upfirstkeyword = strtoupper($firstkeyword);
     switch ($upfirstkeyword) {
         case 'D':
             $content = WeixinKeyWordService::getDKeyword($user, $object, $keyword, $weixinuser);
             break;
         case 'U':
             $content = WeixinKeyWordService::getUKeyword($user, $object, $keyword, $weixinuser);
             break;
         case 'P':
             $content = WeixinKeyWordService::getPKeyword($user, $object, $keyword, $weixinuser);
             break;
         case 'YY':
             $content = WeixinKeyWordService::getYYKeyword($user, $object, $keyword, $weixinuser);
             break;
         case 'Y':
             $content = WeixinKeyWordService::getYKeyword($user, $object, $keyword, $weixinuser);
             break;
         case 'F':
             $data = array('user' => $user, 'keyword' => $keyword);
             $content = WeixinKeyWordService::faFastBiao($data);
             break;
         default:
             $content = "您的回复参数不正确!\n1.回复D#2014-10得到月对帐单;\n2.回复U#username关联好帮贷用户名\n3.回复P#手机号获得验证码进行绑定操作";
             break;
     }
     return $content;
 }
Ejemplo n.º 2
0
 public static function _responseMsg()
 {
     $postStr = isset($GLOBALS['HTTP_RAW_POST_DATA']) ? $GLOBALS['HTTP_RAW_POST_DATA'] : "";
     if (!empty($postStr)) {
         $postObj = simplexml_load_string($postStr, 'SimpleXMLElement', LIBXML_NOCDATA);
         $RX_TYPE = trim($postObj->MsgType);
         #判断是否用户已经登录
         $user = self::addOrLoginUser($postObj->FromUserName);
         if ($user === 3) {
             $content = "您没有成为本平台成员,不能做这个操作。";
             self::_transmitText($postObj, $content);
         }
         switch ($RX_TYPE) {
             case "text":
                 $resultStr = WeixinKeyWordService::fitKeyWord($postObj, $user);
                 break;
             case "image":
                 $resultStr = WeixinImageService::fitImage($postObj, $user);
                 break;
             case "location":
                 $resultStr = WeixinLocationService::fitLocation($postObj);
                 break;
             case "voice":
                 $resultStr = WeixinVoiceService::fitVoice($postObj);
                 break;
             case "video":
                 $resultStr = WeixinVideoService::fitVideo($postObj);
                 break;
             case "link":
                 $resultStr = WeixinLinkService::fitLink($postObj);
                 break;
             case "event":
                 $resultStr = WeixinClickService::fitEvent($postObj, $user);
                 break;
             default:
                 $resultStr = "unknow msg type: " . $RX_TYPE;
                 break;
         }
         if (!empty($resultStr)) {
             echo $resultStr;
         }
     } else {
         echo "";
     }
 }