当前位置: 首页>>代码示例>>PHP>>正文


PHP account::getcoins方法代码示例

本文整理汇总了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");
                 }
             }
         }
     }
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:67,代码来源:transaction.php

示例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;
                             }
                         }
                     }
                 }
             }
         }
     }
 }
开发者ID:perfectcode1,项目名称:Gcoin,代码行数:79,代码来源:transaction.php


注:本文中的account::getcoins方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。