5 changed files with 145 additions and 9 deletions
@ -0,0 +1,87 @@ |
|||
<?php |
|||
|
|||
include_once(dirname(dirname(__FILE__))."/library/publicBase.php"); |
|||
|
|||
// 拼多多 |
|||
include_once (SERVER_ROOT."/library/pinduoduo/pdd_api.php"); |
|||
|
|||
class api extends publicBase { |
|||
|
|||
public function _api_get_order_info() { |
|||
$access_token = $this->get_access_token(); |
|||
|
|||
$obj = new PDD(PDD_CLIENT_ID, PDD_CLIENT_SECRET, $access_token); |
|||
|
|||
$order_sn = $this->post('order_sn'); |
|||
if (empty($order_sn)) $this->ajax_json(false, '订单号不能为空'); |
|||
|
|||
$res = $obj->getOrderInformation($order_sn); |
|||
// {"order_info_get_response":{"request_id":"16547568855546893","order_info":{"support_nationwide_warranty":0,"country":"中国","group_status":1,"free_sf":0,"discount_amount":0.0,"platform_discount":0.0,"return_freight_payer":0,"order_status":1,"id_card_num":"","risk_control_status":0,"province":"","town_id":0,"item_list":[{"goods_name":"checkpass论文查重无限次数低价免注册查重","outer_goods_id":"","goods_price":1.0,"goods_id":329073007863,"sku_id":1115504481445,"goods_count":1,"goods_spec":"千字符","outer_id":"","goods_img":"https://img.pddpic.com/mms-material-img/2022-03-28/0c075d33-b036-46f7-a0bf-d40774f68190.png.a.jpeg"}],"pay_no":"","last_ship_time":"2022-06-11 14:37:23","delivery_one_day":0,"created_time":"2022-06-09 14:37:14","card_info_list":[],"refund_status":1,"town":"","is_stock_out":0,"receiver_address_mask":"","receive_time":"","pay_time":"2022-06-09 14:37:23","gift_list":[],"capital_free_discount":0.0,"receiver_phone_mask":"13*******67","country_id":0,"city_id":0,"invoice_status":0,"service_fee_detail":[],"city":"","order_tag_list":[{"name":"delivery_one_day","value":0},{"name":"no_trace_delivery","value":0},{"name":"self_contained","value":0},{"name":"return_freight_payer","value":0},{"name":"free_sf","value":0},{"name":"duoduo_wholesale","value":0},{"name":"support_nationwide_warranty","value":0},{"name":"only_support_replace","value":0},{"name":"oversea_tracing","value":0},{"name":"distributional_sale","value":0},{"name":"open_in_festival","value":0},{"name":"same_city_distribution","value":0},{"name":"region_black_delay_shipping","value":0},{"name":"has_subsidy_postage","value":0},{"name":"has_sf_express_service","value":0},{"name":"community_group","value":0},{"name":"has_ship_additional","value":0},{"name":"ship_additional_order","value":0}],"is_lucky_flag":1,"yyps_time":"","mkt_biz_type":0,"shipping_type":0,"remark":"","pre_sale_time":"","inner_transaction_id":"","order_change_amount":0.0,"only_support_replace":0,"logistics_id":0,"updated_at":"2022-06-09 14:37:33","street":"","receiver_name_mask":"","receiver_name":"","tracking_number":"","pay_type":"","duoduo_wholesale":0,"buyer_memo":"","is_pre_sale":0,"shipping_time":"","home_delivery_type":0,"after_sales_status":0,"address":"","id_card_name":"","self_contained":0,"goods_amount":1.0,"pay_amount":1.0,"seller_discount":0.0,"address_mask":"","yyps_date":"","confirm_status":1,"confirm_time":"2022-06-09 14:37:23","stock_out_handle_status":-1,"postage":0.0,"province_id":0,"cat_id_3":9056,"cat_id_4":0,"cat_id_1":8726,"receiver_address":"","cat_id_2":8786,"trade_type":0,"urge_shipping_time":"","receiver_phone":"$3MpaxbKBnse9$AgAAAAF2+qYGan7+ggANYOk6e6B2tcD3m4NUAgu6bY4=$0$$","order_sn":"220609-635730697112661"}}} |
|||
$res = json_decode($res, true); |
|||
if (isset($res['error_response'])) $this->ajax_json(false, $res['error_response']['error_msg'].' '.$res['error_response']['sub_msg']); |
|||
|
|||
$order_info = $res['order_info_get_response']['order_info']; |
|||
|
|||
$data = array(); |
|||
$data['confirm_status'] = $order_info['confirm_status']; |
|||
$data['refund_status'] = $order_info['refund_status']; |
|||
$data['order_status'] = $order_info['order_status']; |
|||
$data['group_status'] = $order_info['group_status']; |
|||
$data['after_sales_status'] = $order_info['after_sales_status']; |
|||
$data['is_pre_sale'] = $order_info['is_pre_sale']; |
|||
$data['item_list'] = $order_info['item_list']; |
|||
$data['goods_amount'] = $order_info['goods_amount']; |
|||
$data['risk_control_status'] = $order_info['risk_control_status']; |
|||
|
|||
$this->ajax_json(true, 'succ', $data); |
|||
} |
|||
|
|||
public function _api_get_goods_list() { |
|||
$access_token = $this->get_access_token(); |
|||
$obj = new PDD(PDD_CLIENT_ID, PDD_CLIENT_SECRET, $access_token); |
|||
|
|||
$goods_name = $this->post('goods_name'); |
|||
if (empty($goods_name)) $this->ajax_json(false, '商品名称不能为空'); |
|||
|
|||
$res = $obj->getGoodsList($goods_name); |
|||
|
|||
// {"goods_list_get_response":{"goods_list":[{"is_more_sku":1,"goods_name":"checkpass论文查重无限次数低价免注册查重","thumb_url":"https://img.pddpic.com/gaudit-image/2022-03-28/edac0af376a509b227714488bd5dfa37.jpeg","goods_reserve_quantity":0,"image_url":"","sku_list":[{"outer_goods_id":"","is_sku_onsale":1,"reserve_quantity":0,"sku_id":1115504481445,"outer_id":"","spec":"千字符","sku_quantity":1277},{"outer_goods_id":"","is_sku_onsale":1,"reserve_quantity":0,"sku_id":1115476736663,"outer_id":"","spec":"无限次数","sku_quantity":1495}],"goods_quantity":2772,"goods_id":329073007863,"is_onsale":1}],"total_count":1,"request_id":"16551061312578732"}} |
|||
$res = json_decode($res, true); |
|||
|
|||
if (isset($res['error_response'])) $this->ajax_json(false, $res['error_response']['error_msg'].' '.$res['error_response']['sub_msg']); |
|||
|
|||
|
|||
$this->ajax_json(true, 'succ', $res['goods_list_get_response']['goods_list']); |
|||
} |
|||
|
|||
public function _api_get_goods_info() { |
|||
$access_token = $this->get_access_token(); |
|||
$obj = new PDD(PDD_CLIENT_ID, PDD_CLIENT_SECRET, $access_token); |
|||
|
|||
$goods_id = $this->post('goods_id'); |
|||
if (empty($goods_id)) $this->ajax_json(false, '商品编码不能为空'); |
|||
|
|||
$res = $obj->getGoodsInformation($goods_id); |
|||
|
|||
// {"goods_info_get_response":{"goods_info":{"goods_name":"checkpass论文查重无限次数低价免注册查重","last_category":"论文检测与查询","image_url":"","shipment_limit_second":"172800","goods_quantity":2772,"goods_id":"329073007863","goods_sn":"329073007863","goods_category":"教育培训","is_onsale":"1","is_refundable":"0","second_hand":0,"sku_list":[{"single_price":"12.00","sku_img":"https://img.pddpic.com/mms-material-img/2022-03-28/3cd06438-b959-42ac-936a-93c273367355.png.a.jpeg","outer_goods_id":"","is_sku_onsale":"1","sku_id":"1115476736663","group_price":"10.00","outer_id":"","spec":"无限次数","sku_quantity":"1495"},{"single_price":"2.00","sku_img":"https://img.pddpic.com/mms-material-img/2022-03-28/0c075d33-b036-46f7-a0bf-d40774f68190.png.a.jpeg","outer_goods_id":"","is_sku_onsale":"1","sku_id":"1115504481445","group_price":"1.00","outer_id":"","spec":"千字符","sku_quantity":"1277"}],"goods_type":"1","group_required_customer_num":"2"},"request_id":"16551080285427607"}} |
|||
$res = json_decode($res, true); |
|||
if (isset($res['error_response'])) $this->ajax_json(false, $res['error_response']['error_msg'].' '.$res['error_response']['sub_msg']); |
|||
|
|||
$this->ajax_json(true, 'succ', $res['goods_info_get_response']['goods_info']); |
|||
} |
|||
|
|||
public function _api_get_order_status() { |
|||
$access_token = $this->get_access_token(); |
|||
$obj = new PDD(PDD_CLIENT_ID, PDD_CLIENT_SECRET, $access_token); |
|||
|
|||
$tids = $this->post('order_sns'); |
|||
if (empty($tids)) $this->ajax_json(false, '订单编号不能为空'); |
|||
|
|||
$res = $obj->getOrderStatus($tids); |
|||
|
|||
$res = json_decode($res, true); |
|||
if (isset($res['error_response'])) $this->ajax_json(false, $res['error_response']['error_msg'].' '.$res['error_response']['sub_msg']); |
|||
|
|||
$this->ajax_json(true, 'succ', $res['order_status_get_response']['order_status_list']); |
|||
} |
|||
} |
Loading…
Reference in new issue