示例#1
0
 public function dlorder_cancel()
 {
     $id = I('id', NULL);
     $result = true;
     if (!empty($id)) {
         if (is_array($id)) {
             foreach ($id as $order_id) {
                 $rtn = order_cancel($order_id, '2');
                 if (!$rtn) {
                     $result = false;
                 }
             }
         } else {
             $result = order_cancel($id, '2');
         }
         if ($result) {
             $this->message('订单取消成功!', __URL__ . '/order_daili');
         } else {
             $this->message('部分或全部订单取消失败', __URL__ . '/order_daili');
         }
     } else {
         $this->message('请选择要取消的订单', __URL__ . '/order_daili');
     }
 }
示例#2
0
function ask($info, $sellprice, $last_order, $wall = 0, $balancing = 0, $sudden_mode = 0)
{
    global $fake;
    $last_order = order_Add("ask", $info["btc_balance"], $sellprice, $last_order["price"], $last_order["amount"], $fake);
    $last_order["sudden_mode"] = 0;
    if ($last_order == false) {
        return false;
    }
    echo "*** Processing order...";
    global $fake;
    $myorders = get_orders($fake);
    $c = 0;
    global $timeout;
    while (count($myorders["data"]) >= 1 and $c < $timeout) {
        echo "." . $c;
        $myorders = get_orders($fake);
        echo "(" . count($myorders["data"]) . ")";
        sleep(2);
        $c++;
        if ($c >= $timeout) {
            cli_beep();
            cli_beep();
            $cancel = order_cancel($last_order["success"]);
            echo "\n*** Order timeoout! canceled..";
            $last_order["status"] = "cancelled";
            global $fake;
            $infodata = get_infodataf($fake);
            $info = get_infodata($infodata, $fake);
            if ($info['usd_balance'] > 10) {
                echo "\n*** WARNING: transacao processada sim!";
                $last_order["status"] = "notbalanced";
            }
        }
    }
    if ($c < $timeout or $last_order["status"] == "notbalanced") {
        $last_order["sudden_mode"] = 0;
        if ($last_order["status"] == "notbalanced") {
            $last_order["sudden_mode"] = 1;
        }
        $last_order["status"] = "processed";
    } else {
        if ($sudden_mode == 1) {
            $last_order["sudden_mode"] = 1;
        }
    }
    return $last_order;
}