|
@@ -208,17 +208,29 @@ function __construct(){
|
|
|
$purl = 'https://shop.tiktok.com/view/product/';
|
|
|
$link = '';$product = '';$sku = '';$quantity = '';$price = "";$row_total ="";
|
|
|
$lpsq = array();
|
|
|
+ $extra_text = [];
|
|
|
+ $line_items = [];
|
|
|
+ $extra_text['packages'] = $data['packages'];
|
|
|
foreach ($data['line_items'] as $v)
|
|
|
{
|
|
|
+ // $line_items[] = [
|
|
|
+ // "id"=>$v["id"],
|
|
|
+ // "package_id"=>$v['package_id'],
|
|
|
+ // 'product_id'=>$v['product_id']
|
|
|
+ // ];
|
|
|
if(isset($lpsq[$v['seller_sku']]))
|
|
|
{
|
|
|
$lpsq[$v['seller_sku']]['quantity'] += 1;
|
|
|
$tmp_row_total = $v['sale_price'] ;
|
|
|
- foreach($v['item_tax'] as $kk => $vv){
|
|
|
- if(isset($vv['tax_amount'])){
|
|
|
- $tmp_row_total = $tmp_row_total*1 + $vv['tax_amount']*1;
|
|
|
- }
|
|
|
-
|
|
|
+ if(empty($v['item_tax'])){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ foreach($v['item_tax'] as $kk => $vv){
|
|
|
+ if(isset($vv['tax_amount'])){
|
|
|
+ $tmp_row_total = $tmp_row_total*1 + $vv['tax_amount']*1;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
$lpsq[$v['seller_sku']]['row_total'] = $lpsq[$v['seller_sku']]['row_total']*1 + $tmp_row_total*1;
|
|
|
}
|
|
@@ -226,16 +238,21 @@ function __construct(){
|
|
|
{
|
|
|
//$lpsq[$v['seller_sku']] = array('link'=>$purl.$v['product_id'],'product'=>$v['product_name'],'sku'=>$v['seller_sku'],'quantity'=>1);
|
|
|
$tmp_row_total = $v['sale_price'] ;
|
|
|
- foreach($v['item_tax'] as $kk => $vv){
|
|
|
- if(isset($vv['tax_amount'])){
|
|
|
- $tmp_row_total = $tmp_row_total*1 + $vv['tax_amount']*1;
|
|
|
- }
|
|
|
-
|
|
|
+ if(empty($v['item_tax'])){
|
|
|
+
|
|
|
+ }else{
|
|
|
+ foreach($v['item_tax'] as $kk => $vv){
|
|
|
+ if(isset($vv['tax_amount'])){
|
|
|
+ $tmp_row_total = $tmp_row_total*1 + $vv['tax_amount']*1;
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
+
|
|
|
$lpsq[$v['seller_sku']] = array('link'=>$purl.$v['product_id'],'product'=>$v['product_name'],'sku'=>$v['seller_sku'],'quantity'=>1,'price'=>$v['original_price'],"row_total"=>$tmp_row_total);
|
|
|
}
|
|
|
}
|
|
|
- $this->logic_ding->sendToDing($shop['shopname']."测试获取TT订单".json_encode($data));
|
|
|
+// $this->logic_ding->sendToDing($shop['shopname']."测试获取TT订单".json_encode($data));
|
|
|
// $this->logic_ding->sendToDing($shop['shopname']."测试获取TT订单数据转化".json_encode($lpsq));
|
|
|
foreach ($lpsq as $v)
|
|
|
{
|
|
@@ -299,8 +316,17 @@ function __construct(){
|
|
|
$post['orderinfo'] = $data['id'];//订单号
|
|
|
$post['insurance'] = 0;//运输保险费用
|
|
|
$address = $data['recipient_address']['address_detail'];
|
|
|
- $post['baddress'] = $address.','.$data['recipient_address']['district_info'][3]['address_name'].','.$data['recipient_address']['district_info'][1]['address_name'].','.$data['recipient_address']['postal_code'].','.$data['recipient_address']['region_code'].','.$data['recipient_address']['phone_number'];
|
|
|
- $post['saddress'] = $address.','.$data['recipient_address']['district_info'][3]['address_name'].','.$data['recipient_address']['district_info'][1]['address_name'].','.$data['recipient_address']['postal_code'].','.$data['recipient_address']['region_code'].','.$data['recipient_address']['phone_number'];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(isset($data['recipient_address']['district_info'][3])){
|
|
|
+ $post['baddress'] = $address.','.$data['recipient_address']['district_info'][3]['address_name'].','.$data['recipient_address']['district_info'][1]['address_name'].','.$data['recipient_address']['postal_code'].','.$data['recipient_address']['region_code'].','.$data['recipient_address']['phone_number'];
|
|
|
+ $post['saddress'] = $address.','.$data['recipient_address']['district_info'][3]['address_name'].','.$data['recipient_address']['district_info'][1]['address_name'].','.$data['recipient_address']['postal_code'].','.$data['recipient_address']['region_code'].','.$data['recipient_address']['phone_number'];
|
|
|
+ }else{
|
|
|
+ $post['baddress'] = $address.','.$data['recipient_address']['district_info'][2]['address_name'].','.$data['recipient_address']['district_info'][1]['address_name'].','.$data['recipient_address']['postal_code'].','.$data['recipient_address']['region_code'].','.$data['recipient_address']['phone_number'];
|
|
|
+ $post['saddress'] = $address.','.$data['recipient_address']['district_info'][2]['address_name'].','.$data['recipient_address']['district_info'][1]['address_name'].','.$data['recipient_address']['postal_code'].','.$data['recipient_address']['region_code'].','.$data['recipient_address']['phone_number'];
|
|
|
+ }
|
|
|
$post['country'] = $cuy[$data['recipient_address']['region_code']];//此国家的ID
|
|
|
$post['al'] = $data['recipient_address']['region_code'];//联邦名称
|
|
|
$post['bname'] = preg_replace('/( | | |\s)/',' ',$data['recipient_address']['name']);//名称
|
|
@@ -311,7 +337,12 @@ function __construct(){
|
|
|
$post['email'] = preg_replace('/( | | |\s)+/','',$data['buyer_email']);//客户邮箱
|
|
|
$post['zipcode'] = $data['recipient_address']['postal_code'];//收件人邮编
|
|
|
$post['province'] = $data['recipient_address']['district_info'][1]['address_name'];//收件人省份
|
|
|
- $post['city'] = $data['recipient_address']['district_info'][3]['address_name'];//收件人城市
|
|
|
+ if(isset($data['recipient_address']['district_info'][3])){
|
|
|
+ $post['city'] = $data['recipient_address']['district_info'][3]['address_name'];//收件人城市
|
|
|
+ }else{
|
|
|
+ $post['city'] = $data['recipient_address']['district_info'][2]['address_name'];//收件人城市
|
|
|
+ }
|
|
|
+
|
|
|
$post['address'] = $address;//收件人地址
|
|
|
$post['shouldmoney'] = $data['payment']['total_amount'];//应收金额
|
|
|
$post['skje'] = $post['shouldmoney'];//收款金额
|