Commit aaca8261 by 杨树贤

页码

parent 82c92f6f
...@@ -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();
......
...@@ -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']);
} }
......
...@@ -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');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment