Ejemplo n.º 1
0
<?php

require_once dirname(dirname(__FILE__)) . '/app.php';
$action = trim($_GET['action']);
require dirname(__FILE__) . '/Zhongyu.class.php';
$zhongyu = new Zhongyu();
//重发中娱码
if ('resend' == $action) {
    $id = strval($_GET['id']);
    $code = Table::Fetch('code', $id);
    if ($code['mms'] >= 5) {
        json('发送失败!重发数量已超过5次!', 'alert');
    }
    $info = array('req_seq' => $code['id']);
    $result = $zhongyu->repeat($info);
    $doc = new DOMDocument();
    $doc->loadXML($result);
    $response_id = $doc->getElementsByTagName("id")->item(0)->nodeValue;
    $comment = $doc->getElementsByTagName("comment")->item(0)->nodeValue;
    if ('0000' == $response_id) {
        json($comment, 'alert');
    } else {
        json('重发失败 ' . $comment, 'alert');
    }
} elseif ('recreate' == $action) {
    $id = strval($_GET['id']);
    $code = Table::Fetch('code', $id);
    $team = Table::Fetch('team', $code['team_id']);
    $order = Table::Fetch('order', $code['order_id']);
    $info = array('req_seq' => $code['id'], 'serv_code' => $team['serv_code'], 'phone_rece' => $order['mobile'], 'notes' => '');
    $result = $zhongyu->send($info);