|
@@ -94,7 +94,7 @@ class TestService extends Service
|
|
|
|
|
|
public function getSnforMap($data){
|
|
|
list($status, $msg) = $this->rule();
|
|
|
-// if(! $status) return [false, 'IP未入白名单'];
|
|
|
+ if(! $status) return [false, 'IP未入白名单'];
|
|
|
if(empty($data['urlFromT9']) || $data['urlFromT9'] != "getSnMap") return [false,'API请求参数不能为空'];
|
|
|
if(empty($data['sn'])) return [false, 'sn码不能为空'];
|
|
|
if(empty($data['code'])) return [false, '产品编码不能为空'];
|
|
@@ -110,6 +110,23 @@ class TestService extends Service
|
|
|
return [$status, $msg];
|
|
|
}
|
|
|
|
|
|
+ public function getSnForWarranty($data){
|
|
|
+ list($status, $msg) = $this->rule();
|
|
|
+ if(! $status) return [false, 'IP未入白名单'];
|
|
|
+ if(empty($data['urlFromT9']) || $data['urlFromT9'] != "getSnForWarranty") return [false,'API请求参数不能为空'];
|
|
|
+ if(empty($data['sn'])) return [false, 'sn码不能为空'];
|
|
|
+
|
|
|
+ list($status, $msg) = $this->connectYy();
|
|
|
+ if(! $status) return [false, $msg];
|
|
|
+
|
|
|
+ //数据库
|
|
|
+ $db = $msg[0];
|
|
|
+ $u8 = $msg[1];
|
|
|
+ list($status, $msg) = $this->getSnForWarrantyData($db, $u8,$data);
|
|
|
+
|
|
|
+ return [$status, $msg];
|
|
|
+ }
|
|
|
+
|
|
|
public function rule(){
|
|
|
// 获取用户的IP地址
|
|
|
$userIP = $_SERVER['REMOTE_ADDR'];
|
|
@@ -274,15 +291,44 @@ class TestService extends Service
|
|
|
$bool = $this->isDomainAvailable($u8['domain']);
|
|
|
if(! $bool) return [false, 'U8程序外部域名不可达'];
|
|
|
|
|
|
+ $warehouse = [
|
|
|
+ '001',
|
|
|
+ '003',
|
|
|
+ '010',
|
|
|
+ ];
|
|
|
+
|
|
|
$list = $db->table('ST_SNState')
|
|
|
->select("cInvCode as code",'cinvSN as sn')
|
|
|
+ ->whereIn("cWhCode", $warehouse)
|
|
|
->whereIn("cInvCode", $data['code'])
|
|
|
->whereIn('cInvSN', $data['sn'])
|
|
|
+ ->where("iSNState", 2)
|
|
|
->get()->toArray();
|
|
|
|
|
|
return [true, $list];
|
|
|
}
|
|
|
|
|
|
+ public function getSnForWarrantyData($db, $u8, $data){
|
|
|
+ //映射ip是否通畅
|
|
|
+ $bool = $this->isDomainAvailable($u8['domain']);
|
|
|
+ if(! $bool) return [false, 'U8程序外部域名不可达'];
|
|
|
+
|
|
|
+ $warehouse = [
|
|
|
+ '001',
|
|
|
+ '003',
|
|
|
+ '010',
|
|
|
+ ];
|
|
|
+
|
|
|
+ $list = $db->table('ST_SNState')
|
|
|
+ ->select("cInvCode as code",'cinvSN as sn')
|
|
|
+ ->whereIn("cWhCode", $warehouse)
|
|
|
+ ->where('cInvSN', $data['sn'])
|
|
|
+// ->where("iSNState", 2)
|
|
|
+ ->first();
|
|
|
+
|
|
|
+ return [true, $list];
|
|
|
+ }
|
|
|
+
|
|
|
public function post_helper($url, $data, $header = [], $timeout = 20){
|
|
|
Log::channel('apiLog')->info('朗峰POST', ["api" => $url , "param" => $data ,"header" => $header]);
|
|
|
|