/** * 构造方法 * @param null * @return boolean */ public function __construct($app) { parent::__construct($app); //$this->callback_url = $this->app->base_url(true)."/apps/".basename(dirname(__FILE__))."/".basename(__FILE__); $this->notify_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_alipay_server', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->notify_url, $matches)) { $this->notify_url = str_replace('http://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "http://" . $this->notify_url; } else { $this->notify_url = str_replace('https://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "https://" . $this->notify_url; } $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_alipay', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } //$this->submit_url = 'https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8'; //ajx 按照相应要求请求接口网关改为一下地址 $this->submit_url = 'https://mapi.alipay.com/gateway.do?_input_charset=utf-8'; $this->submit_method = 'POST'; $this->submit_charset = 'utf-8'; }
public function __construct($app) { parent::__construct($app); $this->notify_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_unionpay_server', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->notify_url, $matches)) { $this->notify_url = str_replace('http://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "http://" . $this->notify_url; } else { $this->notify_url = str_replace('https://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "https://" . $this->notify_url; } $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_unionpay', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } // 按照相应要求请求接口网关改为一下地址 //$this->submit_url = 'https://www.epay.lxdns.com/UpopWeb/api/Pay.action'; $this->submit_url = 'https://unionpaysecure.com/api/Pay.action'; $this->submit_method = 'POST'; $this->submit_charset = 'utf-8'; }
/** * 构造方法 * @param null * @return boolean */ public function __construct($app) { parent::__construct($app); //$this->callback_url = $this->app->base_url(true)."/apps/".basename(dirname(__FILE__))."/".basename(__FILE__); $this->notify_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_upacp', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->notify_url, $matches)) { $this->notify_url = str_replace('http://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "http://" . $this->notify_url; } else { $this->notify_url = str_replace('https://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "https://" . $this->notify_url; } $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_upacp', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } }
/** * 构造方法 * @param object 传递应用的app * @return null */ public function __construct($app) { parent::__construct($app); $this->notify_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_paypal_server', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->notify_url, $matches)) { $this->notify_url = str_replace('http://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "http://" . $this->notify_url; } else { $this->notify_url = str_replace('https://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "https://" . $this->notify_url; } $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_paypal', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } $this->submit_url = 'https://www.paypal.com/cgi-bin/webscr'; // $this->submit_url = 'https://www.sandbox.paypal.com/cgi-bin/webscr'; //test $this->submit_method = 'POST'; $this->submit_charset = 'utf-8'; }
/** * 构造方法 * @param null * @return boolean */ public function __construct($app) { parent::__construct($app); $this->notify_url = kernel::openapi_url('openapi.ectools_payment/parse/wap/wap_payment_plugin_mtenpay_server', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->notify_url, $matches)) { $this->notify_url = str_replace('http://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "http://" . $this->notify_url; } else { $this->notify_url = str_replace('https://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "https://" . $this->notify_url; } $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/wap/wap_payment_plugin_mtenpay', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } $this->submit_url = $this->gateway; $this->submit_method = 'GET'; $this->submit_charset = $this->_input_charset; }
public function __construct($app) { parent::__construct($app); $this->notify_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_ibankinginner_server', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->notify_url, $matches)) { $this->notify_url = str_replace('http://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "http://" . $this->notify_url; } else { $this->notify_url = str_replace('https://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "https://" . $this->notify_url; } $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_ibankinginner', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } $this->submit_url = 'https://pay3.chinabank.com.cn/PayGate?encoding=UTF-8'; $this->submit_method = 'POST'; $this->submit_charset = 'utf-8'; }
public function column_editbutton($row) { $callback_url = urlencode(kernel::openapi_url('openapi.b2c.callback.shoprelation', 'callback', array('shop_id' => $row['shop_id']))); $api_url = kernel::base_url(1) . kernel::url_prefix() . '/api'; $obj_user = kernel::single('desktop_user'); $user_id = $obj_user->user_data['user_id']; $user_name = $obj_user->user_data['name']; $api_v = $this->app->getConf("api.local.version"); $str_operation = ""; if ($row['status'] == 'unbind') { $str_operation = '<a href="index.php?app=b2c&ctl=admin_shoprelation&act=showEdit&p[0]=' . $row['shop_id'] . '" target="_blank">' . app::get('b2c')->_('编辑') . '</a>'; if ($str_operation) { $str_operation .= ' <a href="javascript:void(0);" onclick="new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=apply&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get();">' . app::get('b2c')->_('申请绑定') . '</a>'; } else { $str_operation .= '<a href="javascript:void(0);" onclick="new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=apply&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get();">' . app::get('b2c')->_('申请绑定') . '</a>'; } } else { $str_operation = ''; if ($str_operation) { $str_operation .= ' <a href="javascript:void(0);" onclick="new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get();">' . app::get('b2c')->_('解除绑定') . '</a>'; } else { $str_operation .= '<a href="javascript:void(0);" onclick="new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get();">' . app::get('b2c')->_('解除绑定') . '</a>'; } } return $str_operation; }
/** * 构造方法 * @param null * @return boolean */ public function __construct($app) { parent::__construct($app); // $this->notify_url = kernel::openapi_url('openapi.ectools_payment/parse/weixin/weixin_payment_plugin_wxpay_server', 'callback'); $this->notify_url = kernel::base_url(1) . '/index.php/openapi/weixin/wxpay'; #test // $this->notify_url = kernel::base_url(1).'/index.php/wap/paycenter-wxpay.html'; if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->notify_url, $matches)) { $this->notify_url = str_replace('http://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "http://" . $this->notify_url; } else { $this->notify_url = str_replace('https://', '', $this->notify_url); $this->notify_url = preg_replace("|/+|", "/", $this->notify_url); $this->notify_url = "https://" . $this->notify_url; } $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/weixin/weixin_payment_plugin_wxpay', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } // $this->submit_url = $this->gateway; // $this->submit_method = 'GET'; $this->submit_charset = 'UTF-8'; $this->signtype = 'sha1'; }
public function serverCallback() { $servercallback_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ecstoreappabcwap_payment_plugin_ecstoreappabcwap', 'callback'); $httpclient = kernel::single('base_httpclient'); $httpclient->timeout = 30; $result = $httpclient->post($servercallback_url, $_POST); exit; }
function runtask($task_id) { $http = new base_httpclient(); $_POST['task_id'] = $task_id; $url = kernel::openapi_url('openapi.queue', 'worker', array('task_id' => $task_id)); logger::info('Spawn [Task-' . $task_id . '] ' . $url); //99%概率不会有问题 $http->hostaddr = $_SERVER["SERVER_ADDR"] ? $_SERVER["SERVER_ADDR"] : '127.0.0.1'; $http->hostport = $_SERVER["SERVER_PORT"] ? $_SERVER["SERVER_PORT"] : '80'; $http->set_timeout(2); logger::info($http->post($url, $_POST)); }
function index() { $callback_url = ''; $callback = urlencode(kernel::openapi_url('openapi.b2c.callback.shoprelation', 'callback')); $api_url = kernel::base_url(1) . kernel::url_prefix() . '/api'; $ceti_id = base_certificate::get('certificate_id'); $node_id = base_shopnode::node_id($this->app->app_id); $obj_user = kernel::single('desktop_user'); $user_id = $obj_user->user_data['user_id']; $user_name = $obj_user->user_data['name']; $api_v = $this->app->getConf("api.local.version"); $this->finder('b2c_mdl_shop', array('title' => app::get('b2c')->_('数据互联') . app::get('b2c')->_('证书:') . $ceti_id . ', ' . app::get('b2c')->_('节点:') . $node_id, 'actions' => array(array('label' => app::get('b2c')->_('新建绑定关系'), 'icon' => 'add.gif', 'href' => 'index.php?app=b2c&ctl=admin_shoprelation&act=addnew', 'target' => '_blank'), array('label' => app::get('b2c')->_('查看绑定情况'), 'icon' => 'add.gif', 'onclick' => 'new Request({evalScripts:true,url:\'index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback . '&p[3]=' . $api_url . '&p[4]=' . $user_id . '&p[5]=' . $user_name . '&p[6]=' . $api_v . '\'}).get()')))); }
function wxpay() { $postData = array(); $httpclient = kernel::single('base_httpclient'); $callback_url = kernel::openapi_url('openapi.ectools_payment/parse/weixin/weixin_payment_plugin_wxpay', 'callback'); $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; $postArray = kernel::single('site_utility_xml')->xml2array($postStr); $postData['weixin_postdata'] = $postArray['xml']; $nodify_data = array_merge($_GET, $postData); $response = $httpclient->post($callback_url, $nodify_data); echo 'success'; exit; }
public function __construct($app) { $this->my_url = kernel::openapi_url('openapi.trustlogin_api/parse/' . $this->app->app_id . '/trustlogin_plugin_alipay', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->my_url, $matches)) { $this->my_url = str_replace('http://', '', $this->my_url); $this->my_url = preg_replace("|/+|", "/", $this->my_url); $this->my_url = "http://" . $this->my_url; } else { $this->my_url = str_replace('https://', '', $this->my_url); $this->my_url = preg_replace("|/+|", "/", $this->my_url); $this->my_url = "https://" . $this->my_url; } $this->app = $app; $this->obj_session = kernel::single('base_session'); $this->obj_session->start(); }
/** * 构造方法 * @param object 传递应用的app * @return null */ public function __construct($app) { parent::__construct($app); //$this->callback_url = $this->app->base_url(true)."/apps/".basename(dirname(__FILE__))."/".basename(__FILE__); $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_tenpay', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } $this->submit_url = 'https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi'; $this->submit_method = 'POST'; $this->submit_charset = 'gb2312'; }
public function wxpayjsapi() { // 新微信支付回调地址 $postData = array(); $httpclient = kernel::single('base_httpclient'); $callback_url = kernel::openapi_url('openapi.ectools_payment/parse/ectools_payment_plugin_wxpayjsapi', 'callback'); $postStr = $GLOBALS["HTTP_RAW_POST_DATA"]; logger::info('wxpayjsapi data, xml to array :' . var_export($postStr, 1)); $postArray = kernel::single('site_utility_xml')->xml2array($postStr); $postData['weixin_postdata'] = $postArray['xml']; $nodify_data = array_merge(input::get(), $postData); $response = $httpclient->post($callback_url, $nodify_data); // if($notify->checkSign() == FALSE){ // $arr = array('return_code'=>'FAIL','return_msg'=>'签名失败'); // }else{ // $arr = array('return_code'=>'SUCCESS'); // } // $returnXml = $notify->returnXml(); // echo $returnXml;exit; }
public function call($method, $params, $rpc_id = null, $gzip = false) { if (is_null($rpc_id)) { $rpc_id = $this->begin_transaction($method, $params); } else { $rpc_id = $this->begin_transaction($method, $params, $rpc_id); } $obj_rpc_poll = app::get('base')->model('rpcpoll'); $headers = array('Connection' => 'Close'); if ($gzip) { $headers['Content-Encoding'] = 'gzip'; } $query_params = array('app_id' => 'ecos.' . $this->app->app_id, 'method' => $method, 'date' => date('Y-m-d H:i:s'), 'callback_url' => kernel::openapi_url('openapi.rpc_callback', 'async_result_handler', array('id' => $rpc_id, 'app_id' => $this->app->app_id)), 'format' => 'json', 'certi_id' => base_certificate::certi_id(), 'v' => $this->api_version($method), 'from_node_id' => base_shopnode::node_id($this->app->app_id)); // rpc_id 分id 和 calltime $arr_rpc_key = explode('-', $rpc_id); $rpc_id = $arr_rpc_key[0]; $rpc_calltime = $arr_rpc_key[1]; $query_params['task'] = $rpc_id; $query_params = array_merge((array) $params, $query_params); if (!base_shopnode::token($this->app->app_id)) { $query_params['sign'] = base_certificate::gen_sign($query_params); } else { $query_params['sign'] = base_shopnode::gen_sign($query_params, $this->app->app_id); } $url = $this->get_url($this->network_id); $core_http = kernel::single('base_httpclient'); $response = $core_http->set_timeout($this->timeout)->post($url, $query_params, $headers); kernel::log('Response: ' . $response); if ($this->callback_class && method_exists(kernel::single($this->callback_class), 'response_log')) { $response_log_func = 'response_log'; $callback_params = $this->callback_params ? array_merge($this->callback_params, array('rpc_key' => $rpc_id . '-' . $rpc_calltime)) : array('rpc_key' => $rpc_id . '-' . $rpc_calltime); kernel::single($this->callback_class)->{$response_log_func}($response, $callback_params); } if ($response === HTTP_TIME_OUT) { $headers = $core_http->responseHeader; kernel::log('Request timeout, process-id is ' . $headers['process-id']); $obj_rpc_poll->update(array('process_id' => $headers['process-id']), array('id' => $rpc_id, 'calltime' => $rpc_calltime, 'type' => 'request')); $this->status = RPC_RST_RUNNING; return false; } else { $result = json_decode($response); if ($result) { $this->error = $response->error; switch ($result->rsp) { case 'running': $this->status = RPC_RST_RUNNING; // 存入中心给的process-id也就是msg-id $obj_rpc_poll->update(array('process_id' => $result->msg_id), array('id' => $rpc_id, 'type' => 'request', 'calltime' => $rpc_calltime)); return true; case 'succ': //$obj_rpc_poll->delete(array('id'=>$rpc_id,'calltime'=>$rpc_calltime,'type'=>'request','fail_times'=>1)); $obj_rpc_poll->delete(array('id' => $rpc_id, 'calltime' => $rpc_calltime, 'type' => 'request', 'fail_times' => 1)); $this->status = RPC_RST_FINISH; $method = $this->callback_method; if ($method && $this->callback_class) { kernel::single($this->callback_class)->{$method}($result->data); } $this->rpc_response = $response; return $result->data; case 'fail': $this->error = 'Bad response'; $this->status = RPC_RST_ERROR; $this->rpc_response = $response; return false; } } else { //error 解码失败 } } }
public function call($method, $params, $rpc_id = null, $gzip = false) { $api_log = kernel::single('apiactionlog_router_logging'); $rpc_id = $api_log->request_log($method, $params, $rpc_id); if (!$rpc_id) { $microtime = microtime(true); $rpc_id = str_replace('.', '', strval($microtime)); $randval = uniqid('', true); $rpc_id .= strval($randval); $rpc_id = md5($rpc_id); } $headers = array('Connection' => 'Close'); if ($gzip) { $headers['Content-Encoding'] = 'gzip'; } $query_params = array('app_id' => 'ecos.' . $this->app->app_id, 'method' => $method, 'date' => date('Y-m-d H:i:s'), 'callback_url' => kernel::openapi_url('openapi.rpc_callback', 'async_result_handler', array('id' => $rpc_id, 'app_id' => $this->app->app_id)), 'format' => 'json', 'certi_id' => base_certificate::certi_id(), 'v' => $this->api_version($method), 'from_node_id' => base_shopnode::node_id($this->app->app_id)); $query_params = array_merge((array) $params, $query_params); // rpc_id 分id 和 calltime $arr_rpc_key = explode('-', $rpc_id); $rpc_id = $arr_rpc_key[0]; $rpc_calltime = $arr_rpc_key[1]; $query_params['task'] = $rpc_id; if (!base_shopnode::token($this->app->app_id)) { $query_params['sign'] = base_certificate::gen_sign($query_params); } else { $query_params['sign'] = base_shopnode::gen_sign($query_params, $this->app->app_id); } $url = $this->get_url($this->network_id); $core_http = kernel::single('base_httpclient'); $response = $core_http->set_timeout($this->timeout)->post($url, $query_params, $headers); logger::info('Response: ' . $response); if ($response === HTTP_TIME_OUT) { $headers = $core_http->responseHeader; logger::info('Request timeout, process-id is ' . $headers['process-id']); $api_log->update(array('msg_id' => $headers['process-id'], 'status' => 'fail', 'msg' => '请求超时'), $rpc_id, $rpc_calltime); $this->status = RPC_RST_RUNNING; return false; } else { $result = json_decode($response); if ($result) { $this->error = $response->error; switch ($result->rsp) { case 'running': $this->status = RPC_RST_RUNNING; $api_log->update(array('msg_id' => $result->msg_id, 'status' => 'running'), $rpc_id, $rpc_calltime); // 存入中心给的process-id也就是msg-id return true; case 'succ': $result = json_decode($response, true); $api_log->update(array('msg_id' => $result['msg_id'], 'status' => 'success', 'calltime' => time()), $rpc_id, $rpc_calltime); $this->status = RPC_RST_FINISH; $this->rpc_response = $response; return $result['data']; case 'fail': $this->error = 'Bad response'; $this->status = RPC_RST_ERROR; $api_log->update(array('msg_id' => $result->msg_id, 'status' => 'fail', 'msg' => $result->res), $rpc_id, $rpc_calltime); $this->rpc_response = $response; return false; } } else { //error 解码失败 } } }
/** * 获取回调的openapi地址 * @param string $module 认证方式类名 * @return string 返回回调的openapi地址 */ function get_callback_url($module) { return kernel::openapi_url('openapi.pam_callback', 'login', array('module' => $module, 'type' => $this->type, 'appid' => $this->appid, 'redirect' => $this->redirect_url)); }
/** * 构造方法 * @param object 传递应用的app * @return null */ public function __construct($app) { parent::__construct($app); //$this->callback_url = $this->app->base_url(true)."/apps/".basename(dirname(__FILE__))."/".basename(__FILE__); $this->callback_url = kernel::openapi_url('openapi.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_99bill', 'callback'); if (preg_match("/^(http):\\/\\/?([^\\/]+)/i", $this->callback_url, $matches)) { $this->callback_url = str_replace('http://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "http://" . $this->callback_url; } else { $this->callback_url = str_replace('https://', '', $this->callback_url); $this->callback_url = preg_replace("|/+|", "/", $this->callback_url); $this->callback_url = "https://" . $this->callback_url; } $this->submit_url = 'https://www.99bill.com/gateway/recvMerchantInfoAction.htm'; $this->submit_method = 'POST'; $this->submit_charset = 'utf-8'; }
public function iframe_url($params, &$service) { if (!($order_id = $params['tid'])) { return $service->send_user_error('7001', 'tid不能为空!'); } if (!($notify_url = $params['notify_url'])) { return $service->send_user_error('7002', 'notify_url不能为空!'); } base_kvstore::instance('b2c.iframe')->fetch('iframe.whitelist', $whitelist); if (!$whitelist) { $whitelist = array(); } $random = md5(time() . mt_rand()) . '.' . time(); array_push($whitelist, $random); $url_params = array('tid' => $order_id, 'secret_key' => $random, 'notify_url' => $notify_url); base_kvstore::instance('b2c.iframe')->store('iframe.whitelist', $whitelist); $url = kernel::openapi_url('openapi.b2c.iframe.order.edit', 'edit', $url_params); return $url; }