static function cli($cli, $action, $args = "") { $cmd = "php " . PATH_APP . "/bin/ptphp.php --cli={$cli} --action={$action} " . $args; Logger::trace($cmd); $res = shell_exec($cmd); Logger::trace($res); return $res; }
public function media_get($media_id) { $access_token = $this->getAccessToken(); Logger::debug($access_token); $url = "https://api.weixin.qq.com/cgi-bin/media/get?access_token={$access_token}&media_id=" . $media_id; $res = $this->httpGet($url); $file_path = "media/wechat/" . date("Ymdhis") . rand(10, 99) . rand(100, 999) . rand(1000, 9999) . ".jpg"; Model_Tools_Qiniu::upload_content($res, $file_path); $url = "http://" . PtConfig::$qiniu['domain'] . "/" . $file_path; Logger::debug($url); return $url; }
static function _warn($msg = '') { $argc = func_num_args(); if ($argc > 1) { $msg = func_get_args(); } elseif ($argc == 1) { $msg = func_get_arg(0); } Logger::warn($msg); }
foreach ($reflection->getParameters() as $arg) { if (isset($_REQUEST[$arg->name])) { $fire_args[$arg->name] = $_REQUEST[$arg->name]; } else { $fire_args[$arg->name] = null; } } $controller_obj = new $controller(); $return = call_user_func_array(array($controller_obj, $action), $fire_args); } else { $controller_obj = new $controller(); if (!method_exists($controller_obj, $action)) { _throw($controller . "::{$action} is no exsits", 9004); } //$return = $controller_obj->$action(); $return = call_user_func_array(array($controller_obj, $action), array()); } if ($return !== null) { $result = $return; } } catch (AppException $e) { //print_r($exception_point); $error_code = $e->getCode() ? $e->getCode() : 1; $result = $e->getMessage(); Logger::warn(array($error_code, $result), Utils::get_exception_file_line($e->getTrace())); } catch (Exception $e) { $error_code = $e->getCode() ? $e->getCode() : 1; $result = $e->getMessage(); Logger::error(array($error_code, $result, $e->getTrace())); } api_json_response($result, $error_code);