You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
	
	
		
		
			
	
    
		
			
				
					
						                                              | 
						 | 
						<?php
namespace App\Service\Admin;
use App\Models\WorkorderItem;use App\Traits\DemandTraits;use Dcat\Admin\Admin;use Illuminate\Support\Facades\Cache;use Illuminate\Support\Facades\DB;
/** * 全局通知-后台 * Class GlobalNoticeService * @package App\Service */class GlobalNoticeService{	public function unreadWOrder($pointType, $isBadge = false)	{
		$cacheNotice = Cache::get('w_order_notice', '[]');		$cacheNoticeIds = json_decode($cacheNotice, true);
		$builder = WorkorderItem::query()			->has('workorder')			->where(function ($query) use ($pointType) {				$query->where('point_id',Admin::user()->id)					->where('point_type',$pointType);			})			->where('is_read', 0)			->whereIn('id', $cacheNoticeIds);
		if ($isBadge === true) {			return $builder->count();		}
		$res = $builder->pluck('id')			->toArray();
		$cacheNoticeIds = array_diff($cacheNoticeIds, $res);		Cache::forever('w_order_notice', json_encode($cacheNoticeIds));		return empty($res) ? 0 : 1;	}
	public function cacheWOrderNotice($id)	{		$cacheNotice = Cache::get('w_order_notice', '[]');		$cacheNoticeIds = json_decode($cacheNotice, true);		$cacheNoticeIds[] = $id;		Cache::forever('w_order_notice', json_encode($cacheNoticeIds));	}}
  |