Example #1
0
function parseText($message_body)
{
    $message_body = strtolower($message_body);
    $action = 0;
    // if $action is unchanged, it's not one of the commands
    if (strpos($message_body, 'send') !== false) {
        $action = 1;
    }
    if (strpos($message_body, 'request') !== false) {
        $action = 2;
    }
    if (strpos($message_body, 'balance') !== false) {
        $action = 3;
    }
    if (strpos($message_body, 'reset') !== false) {
        send_text(0, resetDemo());
        $action = 999;
    }
    logToFile("parseText", "action = {$action}");
    return $action;
}
Example #2
0
                $text .= " Price:" . $unit_price;
                $total_qty += $quantity;
                $total_amount += $quantity * $unit_price;
            }
        }
        $text .= "\nTotal Items:" . $total_qty;
        $text .= "\nTotal Amount:" . $total_amount;
        $result = updateMaker($table, array('total_amount'), array($total_amount), "where trans_no='{$trans_no}'");
        $type1 = "type=With Po";
        if ($type == "withoutpo") {
            $type1 = "type=Without Po";
        }
        $trans_num = $trans_no;
        if ($status != 'Save' && $status != 'pending') {
            // $text=urlencode($text);
            send_text($text, $phone_number);
            //    echo $response;
            echo "<br>Trans_num" . $trans_num . " " . $trans_no;
            $trans_no = "";
            $trans_num = "";
            $number_code = "";
            echo "<script>alert('Successfull Transaction');</script>";
        }
        //  echo "<script>document.getElementById('form1').action='view_data.php?".$type1."';";
        //  echo " document.form1.submit();";
        echo "</script>";
    }
}
if ($type == "withoutpo") {
    $type = "Without PO";
} else {
Example #3
0
/*
    author:leafrainy
    time:2016-01-09 16:03:07
    version:0.2.1
*/
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE);
//配置微信
define('CorpID', 'XXXXXX');
define('Secret', 'XXXXXX');
if ($_GET['msg']) {
    $text = urldecode(htmlspecialchars(trim($_GET['msg'])));
    $touser = urldecode(htmlspecialchars(trim($_GET['to'])));
    if ($touser) {
        send_text($text, $touser);
    } else {
        send_text($text, "yywt");
    }
    exit;
} else {
    echo "error";
}
//获取token 并写入文件
function get_token()
{
    $get_token_url = "https://qyapi.weixin.qq.com/cgi-bin/gettoken?corpid=" . CorpID . "&corpsecret=" . Secret;
    $res = json_decode(http_get($get_token_url));
    $access_token = $res->access_token;
    $createtime = time();
    $content = json_encode(array("access_token" => $access_token, "createtime" => $createtime));
    w_token($content);
}