示例#1
0
 public function testFindIDm()
 {
     $idm = getIDmInstance();
     $imapper = new IDmMapper(self::$pdo);
     $imapper->insert($idm);
     $newIdm = $imapper->find($idm->idm_id);
     $this->assertEquals($idm->idm_no, $newIdm->idm_no);
 }
示例#2
0
    $nfcpyPath = $options["nfcpypath"];
}
if (array_key_exists('mock', $options)) {
    $nfcpyPath = "mock.py";
}
$imapper = new IDmMapper($pdo);
$umapper = new UserMapper($pdo);
while (true) {
    sleep(5);
    $result = tagToolsParser(exec('python ' . htmlspecialchars($nfcpyPath)));
    if (!isset($result['IDm'])) {
        continue;
    }
    $dbfacade = DBFacade::I($pdo);
    $log = $dbfacade->checkin($result['IDm']);
    $idm = $imapper->find($log->idm_id);
    $idmArray = $idm->toArray();
    $postData = array();
    var_dump($idm);
    if ($idm != NULL) {
        $postData += array('cardName' => $idm->card_name);
        $postData += array('checkinNum' => $idm->checkin_num);
        $user = $umapper->find($idm->user_id);
        $postData += array('userName' => $user->user_name);
    }
    $postData += array('IDm' => $result['IDm']);
    $postData += array('checkinTime' => $log->checkin_time);
    $result = file_get_contents($domainName . "touch", false, stream_context_create(array('http' => array('method' => 'POST', 'header' => implode("\r\n", array('Content-Type: application/x-www-form-urlencoded')), 'content' => http_build_query(array('json' => json_encode((array) $postData)))))));
    // この行を実行すると貯金箱からの入金機能が利用できる
    // 挙動が恐ろしいほど安定していないかつ現状では500円しか読み取れないので、デフォルトではコメントアウトしておく
    // exec("php observeMoneyBox.php &");