lvhao преди 5 месеца
родител
ревизия
28bfd90abc
променени са 1 файла, в които са добавени 1 реда и са изтрити 187 реда
  1. 1 187
      core/CoreApp/controllers/Apitt.php

+ 1 - 187
core/CoreApp/controllers/Apitt.php

@@ -77,10 +77,6 @@ class Apitt extends Start_Controller {
 		else if($arg == 'ttwebhook')
         {
              $this->_ttwebhook();
-        }
-		else if($arg == 'ttwebhookbak')
-        {
-             $this->_ttwebhookbak();
         }
 		else if($arg == 'cs')
         {
@@ -1242,189 +1238,7 @@ $j = json_decode($j, true);
 	}
 	
 	
-	public function _ttwebhookbak()
-	{
-		$post = [
-			'j'=>'{"is_on_hold_order":true,"order_id":"576907245601919910","order_status":"DELIVERED","update_time":1741395921}'
-		];
-		if(isset($post['j']))
-		{
-			$j = $this->input->post('j',true);
-			$j = json_decode($j, true);
-			echo "<pre>";
-			var_dump($j);
-			die;
-			$xq = array();
-			if($j['type'] == 1 && $j['data']['order_status'] == 'UNPAID')
-			{
-				$shop = $this->shop->get_shopid($j['shop_id']);
-				if(!$shop)
-				{
-					exit;
-				}
-				$d = $this->apitt->get_data(array($j['data']['order_id']),$shop);
-				if(isset($d['data']['orders'][0]['user_id']))
-				{
-				    $post = array('orderinfo'=>$j['data']['order_id'],'user_id'=>$d['data']['orders'][0]['user_id']);
-				    $id = $this->ttcf->insert($post);
-					$post['shop'] = $shop['id'];
-					$post['id'] = $id;
-				    $this->_znxc($post,$v,3);
-				}
-				exit;
-			}
-            $d = $this->fullordertt->get_orderinfo($j['data']['order_id']);
-			if($d)
-			{
-				$post = $this->fullordertt->read($d['id']);
-				$shop = $this->shop->read($d['shop']);
-				$qchz = array();
-				$f = explode('|',trim($d['whlabel'],'|'));
-				foreach ($f as $v) 
-		        {
-					$hz = explode('-',trim($v,'-'));
-					if(isset($hz[2]) && $hz[2] != 'DNOTO' && $hz[2] != '0')
-					{
-						$qchz[] = $hz[2];
-					}
-				}
-				$d['whlabel']= str_replace($qchz,'0',$d['whlabel']);
-				$d['fpdata']= str_replace($qchz,'0',$d['fpdata']);
-				$this->db->trans_begin();
-				if($j['type'] == 1)
-				{
-					if($j['data']['order_status'] == 'CANCEL' || $j['data']['order_status'] == 'Canceled')
-					{
-						if($d['library'] != 2)
-						{
-						    $whlabel = $this->whlabel->find_all("zd = '".$d['number']."'");
-						    foreach ($whlabel as $v) 
-		       		        {
-							    $this->whlabel->save(array('zd'=>''),$v['id']);
-						    }
-						    $this->fullordertt->save(array('state'=>217,'whlabel'=>$d['whlabel'],'fpdata'=>$d['fpdata']),$d['id']);
-						}
-						else
-						{
-							$this->fullordertt->save(array('state'=>214),$d['id']);
-						}
-					}
-					else if(($j['data']['order_status'] == 'IN_TRANSIT' || $j['data']['order_status'] == 'COMPLETED currently)') && $d['state'] != 216)
-					{
-						if($d['cf'] == 1 && $d['type'] == 34 && $j['data']['order_status'] == 'IN_TRANSIT')
-						{
-							$wb = $this->apitt->get_data(array($d['orderinfo']),$shop);
-							$waybill = $wb['data']['orders']['0']['tracking_number'];
-							$ex = $wb['data']['orders']['0']['shipping_provider'];
-							$express = 0;
-							if(stripos($ex,"UPS") !== false)
-							{
-								$express = 3;
-							}
-							else if(stripos($ex,"DHL") !== false)
-							{
-								$express = 1;
-							}
-							else if(stripos($ex,"FEDEX") !== false)
-							{
-								$express = 24;
-							}
-							else if(stripos($ex,"USPS") !== false)
-							{
-								$express = 2;
-							}
-							else if(stripos($ex,"ONTRAC") !== false)
-							{
-								$express = 62;
-							}
-							$time = time();
-							$post['waybill'] = $waybill;
-							$post['express'] = $express;
-							$express_id = $express;
-							$d['waybill'] = $waybill;
-							$this->fullordertt->save(array('state'=>216,'fpdata'=>$d['fpdata'],'waybill'=>$waybill,'print'=>3,'printtime'=>$time,'printnumber'=>1,'libraryconfirm'=>2,'library'=>2,'librarytime'=>$time,'weight'=>'0.4kg','review'=>6,'reviewtime'=>$time,'express'=>$express),$d['id']);
-						}
-						else
-						{
-							$this->fullordertt->save(array('state'=>216,'whlabel'=>$d['whlabel'],'fpdata'=>$d['fpdata']),$d['id']);
-							$express_id = $d['express'];
-						}
-						if($express_id != 0)
-						{
-							if(stripos('|'.$post['zdstate'],'|4-') === false)
-							{
-						        $this->_znxc($post,$post['orderinfo'],4);
-							}
-							
-							$expressdata = $this->express->read($express_id);
-							$service = $this->service->read($expressdata['service']); 
-							if(($expressdata['cxcode'] == 'ups' || $expressdata['cxcode'] == '17track' || $expressdata['cxcode'] == 'usps') && $d['webhookregister'] < 1)
-						 	{
-								$logistics = $expressdata['cxcode'];
-								$d['servicename'] =$service['title'];//增加快递名称
-		    					$d['url'] = $expressdata['url'];//增加快递链接
-		    					@$fs = $this->$logistics->get_logistics($d);
-								if(isset($fs) && $fs['f'] == '1')
-								{
-									$this->fullordertt->save(array('expressstate'=>$fs['exstate'],'excontent'=>$fs['data'],'webhookregister'=>1),$d['id']);
-									
-								}
-						 	}
-						}
-					}
-					else if($j['data']['order_status'] == 'DELIVERED')
-					{
-						$je = $this->apitt->get_je($d,$shop);
-						$budget = 0;
-						if(isset($je['data']['statement_transactions']['0']['settlement_amount']))
-						{
-							foreach ($je['data']['statement_transactions'] as $val) 
-		       		    	{
-								$budget += $val['settlement_amount'];
-							}
-							$this->fullordertt->save(array('budget'=>$budget),$d['id']);
-						}
-						if(stripos('|'.$post['zdstate'],'|2-') === false)
-						{
-						    $this->_znxc($post,$post['orderinfo'],2,6);//2物流模板,6已签收
-						}
-					}
-				}
-				if($j['type'] == 2)
-				{
-					if($j['reverse_order_status '] == 50 || $j['reverse_order_status '] == 51)
-				    {
-						$whlabel = $this->whlabel->find_all("zd = '".$d['number']."'");
-						foreach ($whlabel as $v) 
-		       		    {
-							$this->whlabel->save(array('zd'=>''),$v['id']);
-						}
-					    $this->fullordertt->save(array('state'=>214,'whlabel'=>$d['whlabel'],'fpdata'=>$d['fpdata']),$d['id']);
-					}
-					/**
-					reverse_order_status
-					售后申请 = 1
-					售后拒绝申请 = 2
-					售后退货 = 3
-					售后买家已发货 = 4
-					售后卖家_拒绝接收 = 5
-					售后成功 = 50
-					取消成功 = 51
-					关闭 = 99
-					完成 = 100
-					**/
-				}
-				if ($this->db->trans_status() === TRUE)
-        		{
-					$this->db->trans_commit();
-				}
-				else
-				{
-					$this->db->trans_rollback();
-				}
-			}
-		}
-	}
+