|
|
@@ -222,14 +222,18 @@ Class OwnerService
|
|
|
$collect = collect();
|
|
|
if(count($codes) == 0)return $collect;
|
|
|
foreach ($codes as $code) {
|
|
|
- $collect->push(Cache::remember("getOwnerByCodes_{$code}", config('database.cache.expirations.rand'), function ()use($code){
|
|
|
- $owner = Owner::query()->where('code',$code)->first();
|
|
|
- if($owner) return $owner;
|
|
|
- $basCustomer = OracleBasCustomer::query()->where('Customer_Type','OW')->where('CustomerID', $code)->first();
|
|
|
- if(!$basCustomer)return null;
|
|
|
- return Owner::query()->create(['name'=>$basCustomer['descr_c'],'code'=>$basCustomer['customerid']]);
|
|
|
- }));
|
|
|
+ $collect->push($this->getOwnerByCode($code));
|
|
|
}
|
|
|
return $collect;
|
|
|
}
|
|
|
+
|
|
|
+ public function getOwnerByCode($code){
|
|
|
+ return Cache::remember("getOwnerByCode_{$code}", config('database.cache.expirations.rand'), function ()use($code){
|
|
|
+ $owner = Owner::query()->where('code',$code)->first();
|
|
|
+ if($owner) return $owner;
|
|
|
+ $basCustomer = app('OracleBasCustomerService')->first(['Customer_Type'=>'OW','CustomerID'=>$code]);
|
|
|
+ if(!$basCustomer)return null;
|
|
|
+ return Owner::query()->create(['name'=>$basCustomer['descr_c'],'code'=>$basCustomer['customerid']]);
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|