作者 王智

修改

... ... @@ -32,7 +32,7 @@ class GuanYiCloud extends Api
$data['sessionkey'] = SESSIONKEY;
$data['method'] = 'gy.erp.shop.get';
$data['page_no'] = '1';
$data['page_size'] = '10';
$data['page_size'] = '100';
// $data['code'] = '001';
$data['sign'] = $this->sign($data, SECRET);
$this->success('成功', json_decode($this->mycurl(URL, $data)));
... ... @@ -100,25 +100,49 @@ class GuanYiCloud extends Api
$this->success('成功', json_decode($this->mycurl(URL, $data)));
}
//获取订单
function getOrders()
//获取订单 $OrderSn 平台单号
public function getOrders()
{
$data = array();
$data['appkey'] = APPKEY;
$data['sessionkey'] = SESSIONKEY;
$data['method'] = 'gy.erp.trade.get';
$data['page_no'] = '1';
$data['page_size'] = '10';
$data['start_date'] = '2015-8-1 09:06:01';
$data['end_date'] = '2020-11-27 09:06:01';
$data['date_type'] = 0;
$data['order_state'] = 0;
$data['warehouse_code'] = '02';//仓库Code
// $data['shop_code'] = '005';
$data['platform_code'] = '1453793019';
$data['platform_code'] = 'Brone1t81881';
// $date['receiver_mobile']='15928552965';
$data['sign'] = $this->sign($data, SECRET);
$this->success('成功', json_decode($this->mycurl(URL, $data)));
$Array = json_decode(json_encode(json_decode($this->mycurl(URL, $data))), true);
//验证
if (empty($Array['orders'])) {
$this->error('获取订单失败:单号' . '231');
}
$delivery_state = $Array['orders'][0]['delivery_state'];
$refund = $Array['orders'][0]['details'][0]['refund'];
$platform_code = $Array['orders'][0]['platform_code'];
if (!empty($Array['orders'][0]['deliverys'])) {
$express_name = $Array['orders'][0]['deliverys'][0]['express_name'];
$express_code = $Array['orders'][0]['deliverys'][0]['express_code'];
$mail_no = $Array['orders'][0]['deliverys'][0]['mail_no'];
} else {
$express_name = '';
$express_code = '';
$mail_no = '';
}
$Return = [
//发货状态 0-未发货//1-部分发货//2-全部发货
'delivery_state' => $delivery_state,
//退款状态 0:未退款//1:退款成功//2:退款中
'refund' => $refund,
//平台单号
'platform_code' => $platform_code,
//快递公司名称
'express_name' => $express_name,
//快递公司代码
'express_code' => $express_code,
//快递单号
'mail_no' => $mail_no
];
$Json = json_encode($Return);
return $Json;
}
//获取发货单
... ... @@ -198,21 +222,6 @@ class GuanYiCloud extends Api
$data['sessionkey'] = SESSIONKEY;
$data['method'] = 'gy.erp.item.update';
$data['id'] = '11589572901';
// $data['code'] = 'YUIOKLO';
// $data['name'] = 'change_';
// $data['simple_name'] = 'change_...';
// $data['category_code'] = 'change_';
// $data['supplier_code'] = '002';
// $data['stock_status_code'] = '02';
// $data['weight'] = '6000';
// $data['unit_code'] = '002';
// $data['sales_point'] = 'sales_point';
// $data['package_point'] = '61';
// $data['purchase_price'] = '160';
// $data['sales_price'] = '161';
// $data['agent_price'] = '162';
// $data['cost_price'] = '163';
// $data['note'] = 'test...';
$skus = array();
$skus[] = array(
'sku_id' => '11589572902',
... ... @@ -226,18 +235,6 @@ class GuanYiCloud extends Api
'sku_sales_point' => '8',
'sku_note' => 'haha'
);
// $skus[] = array(
// 'sku_id' => '17392138451',
// 'sku_code' => '规格wwwwwwwwwww',
// 'sku_weight' => '70800',
// 'sku_purchase_price' => '71',
// 'sku_sales_price' => '72',
// 'sku_agent_price' => '72',
// 'sku_cost_price' => '73',
// 'sku_package_point' => '7',
// 'sku_sales_point' => '8',
// 'sku_note' => 'haha'
// );
$data['skus'] = $skus;
$data['sign'] = $this->sign($data, SECRET);
echo 'response: ' . $this->mycurl(URL, $data);
... ... @@ -352,50 +349,56 @@ class GuanYiCloud extends Api
//仓库代码 未提供时,根据系统仓库匹配规则自动分配仓库,若内部服务调用超时,调用多次无果,相关项留空进行订单新增,调用结果按创建成功返回
// $data['warehouse_code'] = 'CK001';
//店铺代码
$data['shop_code'] = 'CJ001';
$data['shop_code'] = 'ZCZXCX';
//未提供时,根据系统快递公司匹配规则自动分配快递公司,若内部服务调用超时,调用多次无果,相关项留空进行订单新增,调用结果按创建成功返回
// $data['express_code'] = 'sto';
$random_code = time(); //获取当前时间戳,以时间戳做平台单号可以防止重复,避免出错,此方式仅为测试
//平台单号
$data['platform_code'] = 'Bronet888';
$data['platform_code'] = 'Brone1t81881';
//下单时间
$data['deal_datetime'] = '2020-12-01 14:39:23';
//支付时间
$data['pay_datetime'] = '2015-09-09 10:47:00';
//会员代码
$data['vip_code'] = 'guqilong';
$data['buyer_memo'] = 'buyer_memo';
$data['seller_memo'] = 'seller_memo+%$#@!~^late';
$data['seller_memo_late'] = '二次备注seller_memo+%$#@!~^lat';
$data['receiver_name'] = '张越';
$data['receiver_phone'] = '';
$data['receiver_mobile'] = '15928552965';
$data['receiver_address'] = '校园路一号绵世溪地湾4栋2306(犀浦西南交大旁)';
$data['receiver_province'] = '安徽省';
$data['receiver_city'] = '安徽省';
$data['receiver_district'] = '高新技术产业开发区';
$data['vipRealName'] = '仔仔';
$data['vipIdCard'] = '71314141333331318831';
$data['vipEmail'] = 'd11111d@qq.com';
$data['vip_code'] = 'bronettest';
//买家留言
$data['buyer_memo'] = '这是买家留言';
//收货人
$data['receiver_name'] = '王叨叨';
$data['receiver_mobile'] = '13292442918';
$data['receiver_address'] = '鑫茂科技园F座412';
$data['receiver_province'] = '天津';
$data['receiver_city'] = '天津市';
$data['receiver_district'] = '南开区';
$details = array();
$details[] = array(
'item_code' => 'A002',
'sku_code' => 'A002012',
//商品代码
'item_code' => '4060250152',
//规格代码
// 'sku_code' => 'A002012',
//实际单价
'price' => 9.99,
//商品数量
'qty' => 2,
'refund' => 0
//0:未退款//1:退款完成//2:退款中
// 'refund' => 0
);
$data['details'] = $details;
$payments = array();
$payments[] = array(
'pay_type_code' => 'zhifubao',
//支付放视
'pay_type_code' => 'WechatPay',
//支付金额
'payment' => 22.03,
//交易号
'pay_code' => 9.99,
//支付时间
'paytime' => $random_code * 1000
);
$data['payments'] = $payments;
$invoices = array();
$invoices[] = array(
//发票部分
'invoice_type' => 1,
'invoice_title' => '上海管易云计算软件有限公司kkkkk',
'invoice_content' => '明细',
... ... @@ -404,6 +407,10 @@ class GuanYiCloud extends Api
$data['invoices'] = $invoices;
$data['sign'] = $this->sign($data, SECRET);
echo 'response: ' . $this->mycurl(URL, $data);
// $Array = json_decode(json_encode(json_decode($this->mycurl(URL, $data))), true);
//订单单据编号
//SO285064111288
// dump($Array['code']);
}
//新增退货单
... ...