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
aaca8261
authored
Nov 24, 2022
by
杨树贤
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
页码
parent
82c92f6f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
6 deletions
app/Http/Controllers/Api/AuthApiController.php
app/Http/Controllers/Api/InquiryApiController.php
app/Http/Services/InquiryService.php
app/Http/Controllers/Api/AuthApiController.php
View file @
aaca8261
...
@@ -106,6 +106,10 @@ class AuthApiController extends Controller
...
@@ -106,6 +106,10 @@ class AuthApiController extends Controller
return
$this
->
setError
(
'Wrong Password!'
);
return
$this
->
setError
(
'Wrong Password!'
);
}
}
if
(
Hash
::
check
(
$password
,
$hashedPassword
))
{
return
$this
->
setError
(
'The new password cannot be the same as the old password!'
);
}
$user
=
UserModel
::
find
(
$userId
);
$user
=
UserModel
::
find
(
$userId
);
$user
->
password
=
Hash
::
make
(
$password
);
$user
->
password
=
Hash
::
make
(
$password
);
$user
->
update_time
=
time
();
$user
->
update_time
=
time
();
...
...
app/Http/Controllers/Api/InquiryApiController.php
View file @
aaca8261
...
@@ -31,8 +31,9 @@ class InquiryApiController extends Controller
...
@@ -31,8 +31,9 @@ class InquiryApiController extends Controller
{
{
$searchKeyWord
=
$request
->
input
(
'keyword'
);
$searchKeyWord
=
$request
->
input
(
'keyword'
);
$status
=
$request
->
input
(
'status'
);
$status
=
$request
->
input
(
'status'
);
$limit
=
$request
->
input
(
'limit'
);
$userId
=
$request
->
user
->
id
;
$userId
=
$request
->
user
->
id
;
$result
=
InquiryService
::
getInquiryList
(
$userId
,
$searchKeyWord
,
$status
);
$result
=
InquiryService
::
getInquiryList
(
$userId
,
$searchKeyWord
,
$status
,
$limit
);
return
$this
->
setSuccessData
(
$result
[
'data'
],
$result
[
'total'
]);
return
$this
->
setSuccessData
(
$result
[
'data'
],
$result
[
'total'
]);
}
}
...
...
app/Http/Services/InquiryService.php
View file @
aaca8261
...
@@ -56,7 +56,7 @@ class InquiryService
...
@@ -56,7 +56,7 @@ class InquiryService
return
$inquiry
;
return
$inquiry
;
}
}
public
static
function
getInquiryList
(
$userId
,
$searchKeyWord
,
$status
)
public
static
function
getInquiryList
(
$userId
,
$searchKeyWord
,
$status
,
$limit
)
{
{
$query
=
InquiryModel
::
with
(
'inquiry_items'
)
->
select
([
$query
=
InquiryModel
::
with
(
'inquiry_items'
)
->
select
([
'inquiry_id'
,
'inquiry_id'
,
...
@@ -73,7 +73,7 @@ class InquiryService
...
@@ -73,7 +73,7 @@ class InquiryService
if
(
!
is_null
(
$status
))
{
if
(
!
is_null
(
$status
))
{
$query
->
where
(
'status'
,
$status
);
$query
->
where
(
'status'
,
$status
);
}
}
$result
=
$query
->
paginate
(
10
)
->
toArray
();
$result
=
$query
->
paginate
(
$limit
)
->
toArray
();
foreach
(
$result
[
'data'
]
as
&
$item
)
{
foreach
(
$result
[
'data'
]
as
&
$item
)
{
$item
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'create_time'
]);
$item
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
,
$item
[
'create_time'
]);
$item
[
'status_name'
]
=
\Arr
::
get
(
config
(
'field.inquiry_status'
),
$item
[
'status'
]);
$item
[
'status_name'
]
=
\Arr
::
get
(
config
(
'field.inquiry_status'
),
$item
[
'status'
]);
...
@@ -89,13 +89,13 @@ class InquiryService
...
@@ -89,13 +89,13 @@ class InquiryService
$maxInquiryId
=
InquiryModel
::
orderBy
(
'inquiry_id'
,
'desc'
)
->
value
(
'inquiry_id'
);
$maxInquiryId
=
InquiryModel
::
orderBy
(
'inquiry_id'
,
'desc'
)
->
value
(
'inquiry_id'
);
$id
=
str_pad
((
$maxInquiryId
+
1
),
6
,
0
,
STR_PAD_LEFT
);
$id
=
str_pad
((
$maxInquiryId
+
1
),
6
,
0
,
STR_PAD_LEFT
);
$time
=
Carbon
::
now
()
->
addMonths
(
-
9
)
->
addDays
(
-
10
)
->
timestamp
;
$time
=
Carbon
::
now
()
->
addMonths
(
-
9
)
->
addDays
(
-
10
)
->
timestamp
;
return
'XJ'
.
date
(
'Ymd'
,
$time
)
.
$id
;
return
'XJ'
.
date
(
'Ymd'
,
$time
)
.
$id
;
}
}
public
static
function
getStatusCount
(
$userId
)
public
static
function
getStatusCount
(
$userId
)
{
{
$pending
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
,
InquiryModel
::
STATUS_PENDING
);
$pending
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
,
InquiryModel
::
STATUS_PENDING
);
$processed
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
,
InquiryModel
::
STATUS_PROCESSED
);
$processed
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
,
InquiryModel
::
STATUS_PROCESSED
);
$all
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
);
$all
=
InquiryModel
::
getInquiryCountByStatus
(
$userId
);
return
compact
(
'pending'
,
'processed'
,
'all'
);
return
compact
(
'pending'
,
'processed'
,
'all'
);
}
}
...
...
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