diff --git a/config/define.php b/config/define.php index af4450f..fb6f089 100644 --- a/config/define.php +++ b/config/define.php @@ -31,8 +31,6 @@ define('API_PDD_UID', 'bf3dfd836648d0d53657'); define('API_PDD_TOKEN', '030d17b10e2dfa7056a0'); - define('API_KUAILELUNWEN_UPDATE_PDD_AUTH_INFO', 'http://api.kuailelunwen.com/update_pdd_auth_info'); - # order_status 1:待发货,2:已发货待签收,3:已签收 5:全部 define('ORDER_STATUS_WAIT_DELIVER_GOODS', 1); define('ORDER_STATUS_DELIVERED', 2); diff --git a/control/api.php b/control/api.php index 38003b2..651d425 100644 --- a/control/api.php +++ b/control/api.php @@ -84,4 +84,11 @@ class api extends publicBase { $this->ajax_json(true, 'succ', $res['order_status_get_response']['order_status_list']); } + + public function _api_get_shopinfo() { + $shopinfo = $this->get_shopinfo(); + $shopinfo['aid'] = $this->post('aid')+0; + + $this->ajax_json(true, 'succ', $shopinfo); + } } diff --git a/control/callback.php b/control/callback.php index 2e42e3d..d2b4f30 100644 --- a/control/callback.php +++ b/control/callback.php @@ -28,26 +28,29 @@ class callback extends publicBase { $_SESSION['app_uid'] = $shopinfo['uid']; $_SESSION['app_name'] = $shopinfo['name']; - $state = $this->get('state'); - if(strpos($state, "kuaileaid") !== false) { - $aid = str_replace('kuaileaid_', '', $state)+0; - if ($aid) { - $params = array( - '_uid' => API_PDD_UID, - '_token' => API_PDD_TOKEN, - 'aid' => $aid, - 'access_token' => $access_token, - 'name' => $name, - 'expire_time' => $expire_time - ); - $json_res = $sobj->postCUrl(API_KUAILELUNWEN_UPDATE_PDD_AUTH_INFO, $params); - $res = json_decode($json_res, true); - if (!$res['status']) $this->show_message($res['info']); - - header('Location: http://www.kuailelunwen.com/pay/pay_list/paytype/1'); - exit; - } - } + // 因云内不能访问外网 此方案行不通 需要购买出云访问服务才可以 +// $state = $this->get('state'); +// if(strpos($state, "kuaileaid") !== false) { +// $aid = str_replace('kuaileaid_', '', $state)+0; +// if ($aid) { +// $params = array( +// '_uid' => API_PDD_UID, +// '_token' => API_PDD_TOKEN, +// 'aid' => $aid, +// 'access_token' => $access_token, +// 'name' => $name, +// 'expire_time' => $expire_time +// ); +// $json_res = $sobj->postCUrl(API_KUAILELUNWEN_UPDATE_PDD_AUTH_INFO, $params); +// $obj->writeLog('kuailelunwen', 'pdd_auth.log', API_KUAILELUNWEN_UPDATE_PDD_AUTH_INFO.'|'.json_encode($params).'|'.$json_res."\n"); + +// $res = json_decode($json_res, true); +// if (!$res['status']) $this->show_message($res['info']); + +// header('Location: http://www.kuailelunwen.com/pay/pay_list/paytype/1'); +// exit; +// } +// } header('Location: /'); exit; diff --git a/index.php b/index.php index c4e7aa4..1520872 100644 --- a/index.php +++ b/index.php @@ -69,6 +69,7 @@ class run extends publicBase { if (strtotime($shopinfo['expire_time']) < time()) $this->ajax_json(false, '店铺授权已过期,过期时间'.$shopinfo['expire_time']); $this->para['_access_token'] = $shopinfo['access_token']; + $this->para['_shopinfo'] = $shopinfo; $this->control_func = '_api_'.$this->control_func; } @@ -80,10 +81,8 @@ class run extends publicBase { $app_name = $_SESSION['app_name']; if (empty($app_uid) || empty($app_name)) { - $state = $_GET['aid'] ? 'kuaileaid_'.$_GET['aid'] : PDD_AUTH_STATE; - $pobj = new mPdd(); - $url = $pobj->getPddAuthUrl($state); + $url = $pobj->getPddAuthUrl(); header('Location:'.$url); exit;