Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
semour
/
semour_web
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
388a016f
authored
Nov 22, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
询价数量返回修改
parent
ff2c8438
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
4 deletions
app/Http/Controllers/UserController.php
app/Http/Services/InquiryService.php
app/Models/InquiryModel.php
app/Http/Controllers/UserController.php
View file @
388a016f
...
...
@@ -27,6 +27,7 @@ class UserController extends Controller
$userId
=
$_COOKIE
[
'sem_user_id'
];
//获取不同状态的统计
$statusCount
=
InquiryService
::
getStatusCount
(
$userId
);
dd
(
$statusCount
);
return
view
(
'user.inquiry'
,
compact
(
'statusCount'
));
}
public
function
account
(
Request
$request
)
...
...
app/Http/Services/InquiryService.php
View file @
388a016f
...
...
@@ -96,8 +96,8 @@ class InquiryService
{
$pending
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
,
InquiryModel
::
STATUS_PENDING
);
$processed
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
,
InquiryModel
::
STATUS_PROCESSED
);
$
closed
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
,
InquiryModel
::
STATUS_CLOSED
);
return
compact
(
'pending'
,
'processed'
,
'
closed
'
);
$
all
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
);
return
compact
(
'pending'
,
'processed'
,
'
all
'
);
}
}
app/Models/InquiryModel.php
View file @
388a016f
...
...
@@ -27,9 +27,13 @@ class InquiryModel extends Model
return
self
::
insertGetId
(
$inquiry
);
}
public
static
function
getInquiryCountByStatus
(
$userId
,
$status
)
public
static
function
getInquiryCountByStatus
(
$userId
,
$status
=
null
)
{
return
self
::
where
(
'user_id'
,
$userId
)
->
where
(
'status'
,
$status
)
->
count
();
$query
=
self
::
where
(
'user_id'
,
$userId
);
if
(
$status
!==
null
)
{
$query
->
where
(
'status'
,
$status
);
}
return
$query
->
count
();
}
}
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