|
|
@@ -37,6 +37,7 @@ class ViolationProduct extends Controller
|
|
|
$admin_company_id = request('admin_company_id', '0');
|
|
|
$company_id = request('access_token.company_id', '0');
|
|
|
$is_admin = request('access_token.is_admin', '0'); //是否管理员操作 0=是1=否
|
|
|
+ $user_id = request('access_token.uid', 0);
|
|
|
// 查询条件
|
|
|
$map = [];
|
|
|
$limit = request('limit', config('page_num', 10));
|
|
|
@@ -139,10 +140,22 @@ class ViolationProduct extends Controller
|
|
|
$query1->select('violation_product_logid')->fromSub($subQuery, 'sub1');
|
|
|
});
|
|
|
}
|
|
|
- $result = $ViolationProductModel
|
|
|
- ->where($map)
|
|
|
- ->orderByDesc('id')
|
|
|
- ->paginate($limit)->toarray();
|
|
|
+
|
|
|
+ if ($is_admin != 1 && $company_id != 0) {
|
|
|
+ $result = $ViolationProductModel->where(function ($q) use ($user_id) {
|
|
|
+ $q->where('first_responsible_person', 'like', "%,$user_id,%")
|
|
|
+ ->orWhere('responsible_person', 'like', "%,$user_id,%")
|
|
|
+ ->orWhere('source_responsible_person', 'like', "%,$user_id,%");
|
|
|
+ })
|
|
|
+ ->where($map)
|
|
|
+ ->orderByDesc('id')
|
|
|
+ ->paginate($limit)->toarray();
|
|
|
+ } else {
|
|
|
+ $result = $ViolationProductModel
|
|
|
+ ->where($map)
|
|
|
+ ->orderByDesc('id')
|
|
|
+ ->paginate($limit)->toarray();
|
|
|
+ }
|
|
|
// 分配数据
|
|
|
if (!$result) json_send(['code' => 'success', 'msg' => '获取成功', 'data' => []]);
|
|
|
if (isset($result['data']) && count($result['data']) > 0) {
|