OracleBasCustomerService.php 975 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Services;
  3. use App\OracleBasCustomer;
  4. Class OracleBasCustomerService
  5. {
  6. /** @var CacheService $cacheService */
  7. private $cacheService;
  8. function __construct(){
  9. $this->cacheService=app('CacheService');
  10. }
  11. public function getWareHouse($customerIDs = null)
  12. {
  13. if(!$customerIDs){
  14. return OracleBasCustomer::query()->where('Customer_Type','WH')->get();
  15. }
  16. return OracleBasCustomer::query()->where('Customer_Type','WH')->get();
  17. }
  18. public function getCustomers($codes)
  19. {
  20. return $this->cacheService->getOrExecute('OracleBasCustomersAll'.md5(json_encode($codes)),function()use($codes){
  21. return OracleBasCustomer::query()->select('customerid','descr_c')
  22. ->where('customer_type','OW')
  23. ->where('active_flag','Y')
  24. ->whereIn('customerid',$codes)
  25. ->get();
  26. },config('cache.expirations.owners'));
  27. }
  28. }