소스 검색

避免tt的外键引起的存储报错

lvhao 1 개월 전
부모
커밋
d1eb8a2c94
1개의 변경된 파일5개의 추가작업 그리고 1개의 파일을 삭제
  1. 5 1
      core/CoreApp/controllers/Apitt.php

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

@@ -1041,7 +1041,11 @@ $j = json_decode($j, true);
 			}
 			}
 			else
 			else
 			{
 			{
-				$this->ttwebhook->insert(array('tid'=>$j['tts_notification_id'],'orderinfo'=>$j['data']['order_id'],'data'=>$data,'time'=>date("Y-m-d H:i:s",time())));
+				$num = $this->ttwebhook->find_count("data = ".$data);
+				if(!$num){
+					$this->ttwebhook->insert(array('tid'=>$j['tts_notification_id'],'orderinfo'=>$j['data']['order_id'],'data'=>$data,'time'=>date("Y-m-d H:i:s",time())));
+				}
+				
 			}
 			}
 			$ch = curl_init();
 			$ch = curl_init();
 		    curl_setopt($ch,CURLOPT_URL,'http://a10.wepolicy.cn/apitt/ttwebhook');
 		    curl_setopt($ch,CURLOPT_URL,'http://a10.wepolicy.cn/apitt/ttwebhook');