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
ff2c8438
authored
Nov 22, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
寻报价数量
parent
a63f1e23
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
26 additions
and
2 deletions
app/Http/Controllers/Api/AuthApiController.php
app/Http/Controllers/UserController.php
app/Http/Middleware/EncryptCookies.php
app/Http/Services/InquiryService.php
app/Models/InquiryModel.php
app/Http/Controllers/Api/AuthApiController.php
View file @
ff2c8438
...
...
@@ -64,7 +64,9 @@ class AuthApiController extends Controller
$cookie
=
Cookie
::
make
(
'sem_email'
,
Auth
::
user
()
->
email
,
config
(
'session.lifetime'
),
null
,
null
,
false
,
false
);
Cookie
::
queue
(
$cookie
);
$userIdCookie
=
Cookie
::
make
(
'sem_user_id'
,
Auth
::
user
()
->
id
,
config
(
'session.lifetime'
),
null
,
null
,
false
,
false
);
Cookie
::
queue
(
$userIdCookie
);
return
$this
->
setSuccess
(
'Login success'
);
}
...
...
app/Http/Controllers/UserController.php
View file @
ff2c8438
...
...
@@ -2,6 +2,7 @@
namespace
App\Http\Controllers
;
use
App\Http\Services\InquiryService
;
use
Illuminate\Http\Request
;
class
UserController
extends
Controller
...
...
@@ -23,7 +24,10 @@ class UserController extends Controller
public
function
inquiry
(
Request
$request
)
{
return
view
(
'user.inquiry'
);
$userId
=
$_COOKIE
[
'sem_user_id'
];
//获取不同状态的统计
$statusCount
=
InquiryService
::
getStatusCount
(
$userId
);
return
view
(
'user.inquiry'
,
compact
(
'statusCount'
));
}
public
function
account
(
Request
$request
)
{
...
...
app/Http/Middleware/EncryptCookies.php
View file @
ff2c8438
...
...
@@ -14,5 +14,6 @@ class EncryptCookies extends Middleware
protected
$except
=
[
//
'sem_email'
,
'sem_user_id'
,
];
}
app/Http/Services/InquiryService.php
View file @
ff2c8438
...
...
@@ -92,4 +92,12 @@ class InquiryService
return
'XJ'
.
date
(
'Ymd'
,
$time
)
.
$id
;
}
public
static
function
getStatusCount
(
$userId
)
{
$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'
);
}
}
app/Models/InquiryModel.php
View file @
ff2c8438
...
...
@@ -13,6 +13,10 @@ class InquiryModel extends Model
const
PRIORITY_HIGH
=
2
;
const
STATUS_PROCESSED
=
1
;
const
STATUS_PENDING
=
0
;
const
STATUS_CLOSED
=
-
1
;
public
function
inquiry_items
()
{
return
$this
->
hasMany
(
InquiryItemsModel
::
class
,
'inquiry_id'
,
'inquiry_id'
);
...
...
@@ -23,4 +27,9 @@ class InquiryModel extends Model
return
self
::
insertGetId
(
$inquiry
);
}
public
static
function
getInquiryCountByStatus
(
$userId
,
$status
)
{
return
self
::
where
(
'user_id'
,
$userId
)
->
where
(
'status'
,
$status
)
->
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