本文整理汇总了PHP中account::getcoins方法的典型用法代码示例。如果您正苦于以下问题:PHP account::getcoins方法的具体用法?PHP account::getcoins怎么用?PHP account::getcoins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类account
的用法示例。
在下文中一共展示了account::getcoins方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: grant
public static function grant()
{
$net = new Gnet();
$m['account'] = config::$accountId;
$m = GsonCrypt::sign(Gmsg::create($m));
$m = Gmsg::create(Gmsg::Prepare($m, "pullrequests", config::$bankId));
$net = new Gnet();
$r = $net->send($m);
unset($net);
if (!$r) {
$status = 0;
$res = "Unable to send the message";
} else {
$v = GsonCrypt::verify($r, config::$bankId);
if (!$v) {
$status = 0;
$res = "Unable to verify response from bank";
} else {
$v = Gmsg::extract($v);
if (!$v) {
$status = 0;
$res = "Unable to understand the response";
} else {
$status = $v['status'];
$res = $v['response'];
}
}
}
if (!$status) {
gio::output($res);
} else {
$res = Gmsg::extract($res);
if (!is_array($res)) {
$status = 0;
gio::output("Invalid response from bank");
} else {
if (count($res) < 1) {
gio::output("No pending payment requests");
} else {
foreach ($res as $id => $req) {
gio::output();
$payc[$id] = account::getcoins($req['amount']);
$disp = $req;
$disp['time'] = date(config::$timeFormat, $disp['time']);
gio::display($disp);
gio::output();
}
if (gio::confirm("Do you want to grant the listed payment rerquests")) {
foreach ($res as $id => $req) {
$coins = $payc[$id];
if (!$coins) {
gio::output("Isufficient ecash to process order id '{$id}'");
} else {
$req['coins'] = $coins;
$r = self::sendnotification($id, $req);
$status = $r[0];
if ($status) {
account::spentcoins($coins);
}
}
}
gio::output("All transactions completed");
}
}
}
}
}
示例2: grant
public static function grant()
{
$net = new Gnet();
$m['account'] = config::$accountId;
$m = GsonCrypt::sign(Gmsg::create($m));
$m = Gmsg::create(Gmsg::Prepare($m, "pullrequests", config::$bankId));
$net = new Gnet();
$r = $net->send($m);
unset($net);
if (!$r) {
$status = 0;
$res = "Unable to send the message";
} else {
$v = GsonCrypt::verify($r, config::$bankId);
if (!$v) {
$status = 0;
$res = "Unable to verify response from bank";
} else {
$v = Gmsg::extract($v);
if (!$v) {
$status = 0;
$res = "Unable to understand the response";
} else {
$status = $v['status'];
$res = $v['response'];
}
}
}
if (!$status) {
gio::output($res);
} else {
$res = Gmsg::extract($res);
if (!is_array($res)) {
$status = 0;
gio::output("Invalid response from bank");
} else {
if (count($res) < 1) {
gio::output("No pending payment requests");
} else {
foreach ($res as $id => $req) {
gio::output();
$disp = $req;
$disp['time'] = date(config::$timeFormat, $disp['time']);
gio::display($disp);
gio::output();
if (gio::confirm("Do you want to grant this payment")) {
while (true) {
$amount = gio::input("Enter amount to confirm or c to cancel");
if ($amount == 'c' || $amount == 'C') {
break;
}
if ($req['amount'] == $amount) {
while (true) {
$coins = account::getcoins($amount);
if (!$coins) {
gio::output("Isufficient balance");
break;
}
$req['coins'] = $coins;
$r = self::sendnotification($id, $req);
$status = $r[0];
gio::output($r[1]);
if ($status) {
account::spentcoins($coins);
}
if ($status || !$status && !gio::confirm("Do you want to try again")) {
break;
}
}
gio::output();
break;
}
}
}
}
}
}
}
}