转账给个人
@param array $args
@return bool|array
@throws Exception
336162
public function transfer(array $args) {
        $data = $this->getTransfer()->parameters($this->merge($args))->text();
        if (empty($data)) {
            return false;
        }
        if ($data['return_code'] != 'SUCCESS') {
            throw new Exception($data['return_msg']);
        }
        if ($data['result_code'] != 'SUCCESS') {
            throw new Exception($data['err_code_des']);
        }
        return $data;
    }
1219151
public function parse(array $args = []) : string
    {
        $strAux = $this->str;
        $params = $this->getParameters();

        foreach ($args as $argKey => $argValue) {
            if (in_array($argKey, $params)) {
                $strAux = str_replace("{{$argKey}}", $argValue, $strAux);
            }
        }

        return $strAux;
    }
400252
public function parseArguments(array $args)
    {
        if (!isset($args['action']) || empty($args['action'])) {
            if (isset($args['version']) ||  isset($args['V'])) {
                $this->action = 'Version';
                $this->arguments = $args;
                return $this->arguments;
            }
            if (isset($args['help']) || isset($args['h'])) {
                $this->action = 'Help';
                $this->arguments = $args;
                return $this->arguments;
            }
            throw new RequestException($this, "No valid action argument specified.");
        }
        $this->action = $args['action'];
        unset($args['action']);
        $this->arguments = $args;
        return $this->arguments;
    }
91147
public function run($args)
	{
		$runner=$this->getCommandRunner();
		$commands=$runner->commands;
		if(isset($args[0]))
			$name=strtolower($args[0]);
		if(!isset($args[0]) || !isset($commands[$name]))
		{
			if(!empty($commands))
			{
				echo "Yii command runner (based on Yii v".Yii::getVersion().")\n";
				echo "Usage: ".$runner->getScriptName()." <command-name> [parameters...]\n";
				echo "\nThe following commands are available:\n";
				$commandNames=array_keys($commands);
				sort($commandNames);
				echo ' - '.implode("\n - ",$commandNames);
				echo "\n\nTo see individual command help, use the following:\n";
				echo "   ".$runner->getScriptName()." help <command-name>\n";
			}
			else
			{
				echo "No available commands.\n";
				echo "Please define them under the following directory:\n";
				echo "\t".Yii::app()->getCommandPath()."\n";
			}
		}
		else
			echo $runner->createCommand($name)->getHelp();
		return 1;
	}
325883
public final function index(...$args) {
        $len = count($args);
        switch ($len) {
            case 0:
                return null;
            case 1:
                $subname = array_shift($args);
                $action  = 'index';
                break;
            default:
                $subname = array_shift($args);
                $fParam  = $action = array_shift($args);
        }
        if (empty($subname) || empty($action)) {
            return null;
        }
        $module = $this->module->getDirname();
        $app    = DefaultDispatcher::findApp($module, $action, $args, $this->module->getNamespace(), $subname);
        if ($app) {
            list ($controllerClz, $action, $pms, , $controllerSlag, $actionSlag) = $app;
            if (in_array($action, ['beforerun', 'afterrun', 'geturlprefix'])) {
                return null;
            }
            try {
                $clz = new $controllerClz ($this->module);

                if ($clz instanceof Controller && $clz->slag == $controllerSlag) {
                    $rqMethod = strtolower($_SERVER ['REQUEST_METHOD']);
                    $rm       = ucfirst($rqMethod);
                    // 存在index_get,index_post,add_get add_post这新的方法.
                    $md          = $action . $rm;
                    $actionFound = false;
                    if (method_exists($clz, $md)) {
                        $action      = $md;
                        $actionSlag  = $actionSlag . '-' . $rqMethod;
                        $actionFound = true;
                    } else if (!method_exists($clz, $action)) {
                        array_unshift($pms, $actionSlag);
                        $action     = 'index';
                        $actionSlag = 'index';
                    }
                    if (!$actionFound) {
                        $md = $action . $rm;
                        if (method_exists($clz, $md)) {
                            $action      = $md;
                            $actionSlag  = $actionSlag . '-' . $rqMethod;
                            $actionFound = true;
                        } else if (method_exists($clz, $action)) {
                            $actionFound = true;
                        }
                    }
                    if ($actionFound) {
                        $ref        = $clz->reflectionObj;
                        $method     = $ref->getMethod($action);
                        $methodSlag = Router::addSlash($method->getName());
                        if (!$method->isPublic() || $methodSlag != $actionSlag) {
                            return null;
                        }
                        /* @var \ReflectionParameter[] $params */
                        $params      = $method->getParameters();
                        $paramsCount = count($params);
                        if ($paramsCount < count($pms)) {
                            return null;
                        }
                        $rtn = $clz->beforeRun($action, $method);

                        $module .= '/' . $subname;
                        //beforeRun可以返回view了
                        if ($rtn instanceof View) {
                            DefaultDispatcher::prepareView($rtn, $module, $clz, $action);

                            return $rtn;
                        }
                        $args = [];

                        if ($paramsCount) {
                            $idx = 0;
                            foreach ($params as $p) {
                                $name    = $p->getName();
                                $def     = isset ($pms [ $idx ]) ? $pms [ $idx ] : ($p->isDefaultValueAvailable() ? $p->getDefaultValue() : null);
                                $value   = rqst($name, $def, true);
                                $args [] = is_array($value) ? array_map(function ($v) {
                                    return is_array($v) ? $v : urldecode($v);
                                }, $value) : urldecode($value);
                                $idx++;
                            }
                        }
                        $view = $clz->{$action}(...$args);
                        if ($view !== null) {
                            if (is_array($view)) {
                                $view = new JsonView($view);
                            } else if (!$view instanceof View) {
                                $view = new SimpleView($view);
                            } else {
                                DefaultDispatcher::prepareView($view, $module, $clz, $action);
                            }
                        }

                        return $clz->afterRun($action, $view, $method);
                    }
                }
            } catch (\Exception $e) {
                if (DEBUG == DEBUG_DEBUG) {
                    throw $e;
                }
            }
        }

        //通过插件扩展路由
        $ns = 'router:' . $this->module->getNamespace() . '/' . $subname;
        if (isset($fParam)) {
            array_unshift($args, $fParam);
        }

        return apply_filter($ns, null, $args);
    }
349880
public function run(array $arguments): bool
    {
        $exception = null;
        try {
            $this->prepareConfigurationProvider($arguments);
            $this->prepareCustomBootstrapAndAutoloading($this->configurationProvider->get('bootstrap'));
            $this->printer->setVerbose($this->configurationProvider->get('verbose'));
            $this->exceptionPrinter->setVerbose($this->configurationProvider->get('verbose'));

            switch ($this->configurationProvider->get('command')) {
                case 'list':
                    $commandClass = ListCommand::class;
                    break;

                case 'run':
                default:
                    $commandClass = RunCommand::class;
                    break;
            }

            /** @var CommandInterface $command */
            $command = $this->objectManager->get(
                $commandClass,
                $this->configurationProvider,
                $this->objectManager,
                $this->classLoader,
                $this->printer,
                $this->exceptionPrinter
            );
            $result = $command->run();

            $this->printFooter();

            return $result;
        } catch (ConfigurationException $exception) {
        } catch (FileNotExistsException $exception) {
        }

        $this->error($exception->getMessage());

        return false;
    }
1178314
public function query($sql, array $args = [])
    {
        if ($args) {
            $sql = \wf\db\QueryBuilder::format($sql, $args);
        }
        $sql = \wf\db\QueryBuilder::tablePrefix($sql, $this->cfg['tablePrefix']);
                            
        // 记录数据库查询次数
        $this->execTimes ++;
        $this->log[] = $sql;
        
        $query = $this->dbh->query($sql);        
        if(false === $query) {
            $this->log[] = $this->getLastErr();
            throw new \wf\db\Exception($this->getLastErr());
        }
        
        return $query;
    }
272795
public static function create(...$args) {
        list($table,$pk,$config) = $args;
        $class = get_called_class();
        if($table===null) {
            $class = explode('\\',$class);
            $table = end($class);
        }

        if(!$config) {
            throw new \Exception('dao config not exists!');
        }

        $class = static::parse(get_class(),$config);

        return new $class($table,$pk,$config);
    }
809622
public function withArgs($args = [])
    {
        if (!is_array($args)) {
            $args = func_get_args();
        }

        $this->args = $args;
        return $this;
    }
1091000
public static function serialize(array $args)
    {
        return array_reduce(
            $args,
            function ($msg, $arg) {
                return $msg.'$'.strlen($arg)."\r\n".$arg."\r\n";
            },
            '*'.count($args)."\r\n"
        );
    }
1017936
protected function processArgs(array $args) {
		foreach ($args as &$arg) {
			if (is_array($arg)) {
				$arg = $this->processArgs($arg);
				continue;
			}
			
			if ($arg instanceof Argument\ArgumentInterface) {
				$arg = $arg->getValue();
			}
		}
		unset($arg);
		
		return $args;
	}
361675
public function queryOrder(array $args = array()) {
        $args = $this->getQuery()->parameters($this->merge($args))->json();
        if (!array_key_exists('alipay_trade_query_response', $args)) {
            throw new \Exception('未知错误！');
        }
        $args = $args['alipay_trade_query_response'];
        if ($args['code'] != 10000) {
            throw new \Exception($args['msg']);
        }
        if (!$this->verify($args)) {
            throw new \Exception('数据验签失败！');
        }
        return $args;
    }
317638
private function parseArgs(array $args) : string
    {
        if (!is_array($args)) return false;
        $components = array();
        if (count($args) == 1 && is_string($args[0])) {
            $components['src'] = $args[0];
            return $this->makeLink($components);
        } elseif (count($args) == 1 && is_array($args)) {
            $components = $args[0];
            return $this->makeLink($components);
        } elseif (count($args) == 2 && is_string($args[0]) && is_array($args[1])) {
            $args[1]['src'] = $args[0];
            $components = $args[1];
            return $this->makeLink($components);
        } elseif (count($args) == 2 && is_string($args[0]) && is_string($args[1])) {
            return '<script type="'.$args[1].'">'."\n".$args[0]."\n</script>\n";
        }
        Core::i()->log->warning('Unable to interpret script. Not added.');
        return false;
    }
327644
public function executeAll(...$args)
    {
        if ($this->isEmpty()) {
            return 0;
        }
        $n = 0;
        do {
            $cb = $this->extract();
            if ($cb) {
                $cb(...$args);
                ++$n;
            }
        } while (!$this->isEmpty());
        return $n;
    }
1173889
public function catchAll(...$args) : object
    {
        $title = " | Anax";
        $pages = [
            "403" => [
                "Anax 403: Forbidden",
                "You are not permitted to do this."
            ],
            "404" => [
                "Anax 404: Not Found",
                "The page you are looking for is not here."
            ],
            "500" => [
                "Anax 500: Internal Server Error",
                "An unexpected condition was encountered."
            ],
        ];

        $path = $this->di->get("router")->getMatchedPath();
        if (!array_key_exists($path, $pages)) {
            throw new NotFoundException("Internal route for '$path' is not found.");
        }

        $page = $this->di->get("page");
        $page->add(
            "anax/v2/error/default",
            [
                "header" => $pages[$path][0],
                "text" => $pages[$path][1],
            ]
        );

        return $page->render([
            "title" => $pages[$path][0] . $title
        ], $path);
    }
279126
private static function checkArgs(array $args) {
        if ($_FILES) {
            foreach ($_FILES as $key => $f) {
                if (is_array($f['name'])) {
                    foreach ($f['tmp_name'] as $tmp) {
                        $args[ $key ][] = self::getfileSha1('@"' . $tmp . '"');
                    }
                } else {
                    $args[ $key ] = self::getfileSha1('@"' . $f['tmp_name'] . '"');
                }
            }
        }

        return $args;
    }
1374464
public static function getFirst($arg) {
        $str = iconv('UTF-8', 'gb2312', $arg);//如果程序是gbk的，此行就要注释掉
        if (!preg_match('/^[\x7f-\xff]/', $str)) {
            return strtoupper($str[0]);
        }
        $firstChar=ord($str{0});
        if($firstChar >= ord('A') && $firstChar <= ord('z')) {
            return strtoupper($str{0});
        }
        $a = $str;
        $val = ord($a{0}) * 256 + ord($a{1}) - 65536;
        if ($val >= -20319 && $val <= -20284)  {
            return 'A';
        }
        if ($val >= -20283 && $val <= -19776) {
            return 'B';
        }
        if ($val >= -19775 && $val <= -19219) {
            return 'C';
        }
        if ($val >= -19218 && $val <= -18711) {
            return 'D';
        }
        if ($val >= -18710 && $val <= -18527) {
            return 'E';
        }
        if ($val >= -18526 && $val <= -18240) {
            return 'F';
        }
        if ($val >= -18239 && $val <= -17923) {
            return 'G';
        }
        if ($val >= -17922 && $val <= -17418) {
            return 'H';
        }
        if ($val >= -17417 && $val <= -16475) {
            return 'J';
        }
        if ($val >= -16474 && $val <= -16213) {
            return 'K';
        }
        if ($val >= -16212 && $val <= -15641) {
            return 'L';
        }
        if ($val >= -15640 && $val <= -15166) {
            return 'M';
        }
        if ($val >= -15165 && $val <= -14923) {
            return 'N';
        }
        if ($val >= -14922 && $val <= -14915) {
            return 'O';
        }
        if ($val >= -14914 && $val <= -14631) {
            return 'P';
        }
        if ($val >= -14630 && $val <= -14150) {
            return 'Q';
        }
        if ($val >= -14149 && $val <= -14091) {
            return 'R';
        }
        if ($val >= -14090 && $val <= -13319) {
            return 'S';
        }
        if ($val >= -13318 && $val <= -12839) {
            return 'T';
        }
        if ($val >= -12838 && $val <= -12557) {
            return 'W';
        }
        if ($val >= -12556 && $val <= -11848) {
            return 'X';
        }
        if ($val >= -11847 && $val <= -11056) {
            return 'Y';
        }
        if ($val >= -11055 && $val <= -10247) {
            return 'Z';
        }
        return strtoupper($str[0]);
    }