コード例 #1
0
 public function test_should_instantiate_controller_model_and_respect_core_text_helper()
 {
     $TextController = new TextController();
     $TextController->instantiateIncludedModelClasses();
     $this->assertTrue($TextController->Text instanceof AkActiveRecord);
     $this->assertTrue($TextController->text_helper instanceof AkTextHelper);
     $this->assertTrue($TextController->ak_text_helper instanceof AkTextHelper);
 }
コード例 #2
0
<?php

include "wechat.class.php";
include "./controller/textController/TextController.php";
include "./controller/eventController/EventController.php";
include "./model/TextModel.php";
include "./model/EventModel.php";
include "./config/params.php";
$options = array('token' => '', 'encodingaeskey' => '', 'appid' => '', 'appsecret' => '');
$weObj = new Wechat($options);
$weObj->valid();
$type = $weObj->getRev()->getRevType();
switch ($type) {
    case Wechat::MSGTYPE_TEXT:
        $textObj = new TextController($weObj);
        $reply = $textObj->replyIndex();
        $weObj->text($reply)->reply();
        break;
    case Wechat::MSGTYPE_EVENT:
        $eventObj = new EventController($weObj);
        $reply = $eventObj->replyIndex();
        //$weObj->text($reply)->reply();
        $weObj->news($reply)->reply();
        break;
    case Wechat::MSGTYPE_IMAGE:
        break;
    default:
        $weObj->text("help info")->reply();
}