修复:商户员工不是商户超管时 进行部分操作可能报错 - 无操作权限
This commit is contained in:
parent
2e25d63673
commit
97e31c2bf3
|
|
@ -34,8 +34,12 @@ class MerchantServerMiddleware extends BaseMiddleware
|
||||||
$service = app()->make(StoreServiceRepository::class)->getService($userInfo->main_uid, $this->merId);
|
$service = app()->make(StoreServiceRepository::class)->getService($userInfo->main_uid, $this->merId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!$service) {
|
||||||
|
$service = app()->make(StoreServiceRepository::class)->getAdminService($this->merId);
|
||||||
|
}
|
||||||
|
|
||||||
if (!$service || !$service->$field) {
|
if (!$service || !$service->$field) {
|
||||||
// throw new HttpResponseException(app('json')->fail('您没有权限操作'));
|
throw new HttpResponseException(app('json')->fail('您没有权限操作'));
|
||||||
}
|
}
|
||||||
$request->macro('serviceInfo', function () use (&$service) {
|
$request->macro('serviceInfo', function () use (&$service) {
|
||||||
return $service;
|
return $service;
|
||||||
|
|
|
||||||
|
|
@ -419,7 +419,22 @@ class StoreServiceRepository extends BaseRepository
|
||||||
|
|
||||||
return $this->dao->delete($id);
|
return $this->dao->delete($id);
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Common: 获取当前商户超管
|
||||||
|
* Author: wu-hui
|
||||||
|
* Time: 2024/03/30 9:56
|
||||||
|
* @param int $merId
|
||||||
|
* @return array|\think\Model
|
||||||
|
*/
|
||||||
|
public function getAdminService(int $merId){
|
||||||
|
return $this->dao->getSearch([])
|
||||||
|
->hasWhere('merchant',function($query){
|
||||||
|
$query->where('is_del', 0);
|
||||||
|
})
|
||||||
|
->where('StoreService.mer_id',$merId)
|
||||||
|
->where('StoreService.is_del', 0)
|
||||||
|
->where('StoreService.is_manage', 1)
|
||||||
|
->findOrEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue