Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
杨树贤
/
liexin_supplier
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4c23d36f
authored
Jun 06, 2023
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
优化mysql查询
parent
b5e29e55
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
8 deletions
app/Http/Controllers/Filter/SupplierFilter.php
app/Http/Services/SupplierStatisticsService.php
app/Http/Controllers/Filter/SupplierFilter.php
View file @
4c23d36f
...
@@ -6,6 +6,7 @@ namespace App\Http\Controllers\Filter;
...
@@ -6,6 +6,7 @@ namespace App\Http\Controllers\Filter;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\AdminUserService
;
use
App\Http\Services\DepartmentService
;
use
App\Http\Services\DepartmentService
;
use
App\Model\SupplierAttachmentsModel
;
use
App\Model\SupplierChannelModel
;
use
App\Model\SupplierChannelModel
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
...
@@ -150,12 +151,12 @@ class SupplierFilter
...
@@ -150,12 +151,12 @@ class SupplierFilter
//获取没有平台合作协议的数据
//获取没有平台合作协议的数据
if
(
!
empty
(
$map
[
'has_cooperation_agreement'
]))
{
if
(
!
empty
(
$map
[
'has_cooperation_agreement'
]))
{
if
(
$map
[
'has_cooperation_agreement'
]
==
1
)
{
if
(
$map
[
'has_cooperation_agreement'
]
==
1
)
{
$query
->
where
Has
(
'attachment
'
,
function
(
$query
)
{
$query
->
where
In
(
'supplier_id
'
,
function
(
$query
)
{
$query
->
where
(
'field_name'
,
'cooperation_agreement'
);
$query
->
select
(
'supplier_id'
)
->
from
(
with
(
new
SupplierAttachmentsModel
())
->
getTable
())
->
where
(
'field_name'
,
'cooperation_agreement'
);
});
});
}
else
{
}
else
{
$query
->
where
DoesntHave
(
'attachment
'
,
function
(
$query
)
{
$query
->
where
NotIn
(
'supplier_id
'
,
function
(
$query
)
{
$query
->
where
(
'field_name'
,
'cooperation_agreement'
);
$query
->
select
(
'supplier_id'
)
->
from
(
with
(
new
SupplierAttachmentsModel
())
->
getTable
())
->
where
(
'field_name'
,
'cooperation_agreement'
);
});
});
}
}
}
}
...
@@ -388,9 +389,9 @@ class SupplierFilter
...
@@ -388,9 +389,9 @@ class SupplierFilter
})
->
where
(
'uploaded_sku'
,
1
);
})
->
where
(
'uploaded_sku'
,
1
);
break
;
break
;
case
"no_cooperation_agreement"
:
case
"no_cooperation_agreement"
:
$query
->
where
DoesntHave
(
'attachment
'
,
function
(
$query
)
{
$query
->
where
NotIn
(
'supplier_id
'
,
function
(
$query
)
{
$query
->
where
(
'field_name'
,
'cooperation_agreement'
);
$query
->
select
(
'supplier_id'
)
->
from
(
with
(
new
SupplierAttachmentsModel
())
->
getTable
())
->
where
(
'field_name'
,
'cooperation_agreement'
);
})
->
where
(
'uploaded_sku'
,
1
)
;
});
break
;
break
;
}
}
return
$query
;
return
$query
;
...
...
app/Http/Services/SupplierStatisticsService.php
View file @
4c23d36f
...
@@ -115,7 +115,7 @@ class SupplierStatisticsService
...
@@ -115,7 +115,7 @@ class SupplierStatisticsService
return
$value
;
return
$value
;
},
$result
);
},
$result
);
$redis
->
set
(
$statisticsKey
,
json_encode
(
$result
));
$redis
->
set
(
$statisticsKey
,
json_encode
(
$result
));
$redis
->
expire
(
$statisticsKey
,
5
0
);
$redis
->
expire
(
$statisticsKey
,
60
0
);
return
$result
;
return
$result
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment