Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_admin
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
4d65e59e
authored
Nov 18, 2022
by
宁成龙
Browse files
Options
_('Browse Files')
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
45b622f0
6a117665
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
0 deletions
app/Admin/Controllers/InquiryController.php
app/Admin/Service/InquiryService.php
app/Models/Inquiry.php
app/Admin/Controllers/InquiryController.php
View file @
4d65e59e
...
...
@@ -7,6 +7,7 @@ use App\Admin\Renderable\BarChart;
use
App\Admin\Renderable\InquiryDetail
;
use
App\Admin\Renderable\PostTable
;
use
App\Admin\Repositories\Inquiry
;
use
App\Admin\Service\InquiryService
;
use
App\Models\Cms\CmsUser
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
...
...
app/Admin/Service/InquiryService.php
View file @
4d65e59e
...
...
@@ -15,4 +15,19 @@ class InquiryService
{
return
Inquiry
::
batchUpdateSalesId
(
$salesId
,
$userIds
);
}
//根据用户id列表获取待处理和所有询价单的数量
public
static
function
getInquiryCountByUserIds
(
$userIds
=
[])
{
$result
=
[];
foreach
(
$userIds
as
$userId
)
{
$pendingCount
=
Inquiry
::
getInquiryCountByStatus
(
$userId
,
Inquiry
::
STATUS_PENDING
);
$allCount
=
Inquiry
::
where
(
'user_id'
,
$userId
)
->
count
();
$result
[
$userId
]
=
[
'pending'
=>
$pendingCount
,
'all'
=>
$allCount
,
];
}
return
$result
;
}
}
app/Models/Inquiry.php
View file @
4d65e59e
...
...
@@ -32,6 +32,11 @@ class Inquiry extends Model
return
$this
->
hasOne
(
CmsUser
::
class
,
'userId'
,
'sales_id'
);
}
public
static
function
getInquiryCountByStatus
(
$userId
,
$status
)
{
return
self
::
where
(
'user_id'
,
$userId
)
->
where
(
'status'
,
$status
)
->
count
();
}
public
static
function
batchUpdateSalesId
(
$salesId
,
$userIds
=
[])
{
...
...
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