示例#1
0
 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::api_url('api.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_alipay', 'callback');
     $this->submit_url = 'https://www.alipay.com/cooperate/gateway.do?_input_charset=utf-8';
     $this->submit_method = 'POST';
     $this->submit_charset = 'utf-8';
 }
示例#2
0
 public function __construct($app)
 {
     parent::__construct($app);
     $this->callback_url = kernel::api_url('api.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_paypal', 'callback');
     $this->callback_url = str_replace("//", "/", $this->callback_url);
     $this->submit_url = 'https://www.paypal.com/cgi-bin/webscr';
     $this->submit_method = 'POST';
     $this->submit_charset = 'utf-8';
 }
示例#3
0
 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::api_url('api.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_tenpay', 'callback');
     $this->submit_url = 'https://www.tenpay.com/cgi-bin/v1.0/pay_gate.cgi';
     $this->submit_method = 'POST';
     $this->submit_charset = 'gb2312';
 }
示例#4
0
 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::api_url('api.ectools_payment/parse/' . $this->app->app_id . '/ectools_payment_plugin_99bill', 'callback');
     $this->submit_url = 'https://www.99bill.com/gateway/recvMerchantInfoAction.htm';
     $this->submit_method = 'POST';
     $this->submit_charset = 'utf-8';
 }
示例#5
0
 function runtask($task_id)
 {
     $http = kernel::single('base_httpclient');
     $_POST['task_id'] = $task_id;
     $url = kernel::api_url('api.queue', 'worker', array('task_id' => $task_id));
     kernel::log('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';
     $ret = $http->post($url, $_POST, null, null, true);
 }
示例#6
0
 public function call($method, $params)
 {
     $rpc_id = $this->begin_transaction($method, $params);
     $headers = array('Connection' => $this->timeout);
     $query_params = array('app_id' => 'ecos.' . $this->app->app_id, 'method' => $method, 'date' => date('Y-m-d H:i:s'), 'callback_url' => kernel::api_url('api.rpc_callback', 'async_result_handler', array('id' => $rpc_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['node_id'] = $params['to_node_id'];
     $query_params = array_merge((array) $params, $query_params);
     $query_params['sign'] = base_certificate::gen_sign($query_params);
     $url = $this->get_url($this->network_id);
     $core_http = kernel::single('base_httpclient');
     $response = $core_http->post($url, $query_params, $headers);
     if ($response === HTTP_TIME_OUT) {
         $headers = $core_http->responseHeader;
         kernel::log('Request timeout, process-id is ' . $headers['process-id']);
         app::get('base')->model('rpcpoll')->update(array('process_id' => $headers['process-id']), array('id' => $rpc_id, 'type' => 'request'));
         $this->status = RPC_RST_RUNNING;
         return false;
     } else {
         kernel::log('Response: ' . $response);
         $result = json_decode($response);
         if ($result) {
             $this->error = $response->error;
             switch ($result->rst) {
                 case 'running':
                     $this->status = RPC_RST_RUNNING;
                     return false;
                 case 'succ':
                     app::get('base')->model('rpcpoll')->delete(array('id' => $rpc_id, 'type' => 'request'));
                     $this->status = RPC_RST_FINISH;
                     $method = $this->callback_method;
                     kernel::single($this->callback_class)->{$method}($result->data);
                     return $result->data;
                 case 'fail':
                     $this->error = 'Bad response';
                     $this->status = RPC_RST_ERROR;
                     return false;
             }
         } else {
             //error 解码失败
         }
     }
 }
示例#7
0
 public function column_editbutton($row)
 {
     $callback_url = urlencode(kernel::api_url('api.b2c.callback.shoprelation', 'callback', array('shop_id' => $row['shop_id'])));
     $api_url = kernel::base_url(1) . kernel::url_prefix() . '/api';
     $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">编辑</a>';
         if ($str_operation) {
             $str_operation .= '&nbsp;<a href="index.php?ctl=shoprelation&act=index&p[0]=apply&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '">申请绑定</a>';
         } else {
             $str_operation .= '<a href="index.php?ctl=shoprelation&act=index&p[0]=apply&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '&p[3]=' . $api_url . '">申请绑定</a>';
         }
     } else {
         $str_operation = '';
         if ($str_operation) {
             $str_operation .= '&nbsp;<a href="index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '">解除绑定</a>';
         } else {
             $str_operation .= '<a href="index.php?ctl=shoprelation&act=index&p[0]=accept&p[1]=' . $this->app->app_id . '&p[2]=' . $callback_url . '">解除绑定</a>';
         }
     }
     return $str_operation;
 }
示例#8
0
 function get_callback_url($module)
 {
     return kernel::api_url('api.pam_callback', 'login', array('module' => $module, 'type' => $this->type, 'redirect' => $this->redirect_url));
 }