订单处理
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

55 lines
1.9 KiB

<?php
/**
*
*/
include_once(dirname(dirname(__FILE__))."/library/publicBase.php");
class callback extends publicBase {
public function pdd() {
$obj = new mPdd();
$info = $obj->getPddAccessToken($this->get('code'));
$obj->writeLog('application', 'pdd_auth.log', json_encode($info)."\n");
// if($info['expires_in']<=0) $this->show_message('对不起,服务已到期,请续费后再使用。', PDD_APPLICATION_BUY_URL);
$access_token = $info['access_token'];
// if(empty($access_token)) $this->show_message('授权信息token不存在');
$name = urldecode($info['owner_name']);
$expire_time = date("Y-m-d H:i:s", $info['expires_at']);
$uid = $_SESSION['app_uid'] ? $_SESSION['app_uid'] : 0;
$sobj = new mShop();
$shopinfo = $sobj->addShop($name, $access_token, $info['owner_id'], $expire_time, $uid);
$_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;
}
}
header('Location: /');
exit;
}
}