Commit aaca8261 by 杨树贤

页码

parent 82c92f6f
......@@ -106,6 +106,10 @@ class AuthApiController extends Controller
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->password = Hash::make($password);
$user->update_time = time();
......
......@@ -31,8 +31,9 @@ class InquiryApiController extends Controller
{
$searchKeyWord = $request->input('keyword');
$status = $request->input('status');
$limit = $request->input('limit');
$userId = $request->user->id;
$result = InquiryService::getInquiryList($userId,$searchKeyWord, $status);
$result = InquiryService::getInquiryList($userId,$searchKeyWord, $status,$limit);
return $this->setSuccessData($result['data'],$result['total']);
}
......
......@@ -56,7 +56,7 @@ class InquiryService
return $inquiry;
}
public static function getInquiryList($userId, $searchKeyWord, $status)
public static function getInquiryList($userId, $searchKeyWord, $status, $limit)
{
$query = InquiryModel::with('inquiry_items')->select([
'inquiry_id',
......@@ -73,7 +73,7 @@ class InquiryService
if (!is_null($status)) {
$query->where('status', $status);
}
$result = $query->paginate(10)->toArray();
$result = $query->paginate($limit)->toArray();
foreach ($result['data'] as &$item) {
$item['create_time'] = date('Y-m-d H:i:s', $item['create_time']);
$item['status_name'] = \Arr::get(config('field.inquiry_status'), $item['status']);
......@@ -89,13 +89,13 @@ class InquiryService
$maxInquiryId = InquiryModel::orderBy('inquiry_id', 'desc')->value('inquiry_id');
$id = str_pad(($maxInquiryId + 1), 6, 0, STR_PAD_LEFT);
$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)
{
$pending = InquiryModel::getInquiryCountByStatus($userId,InquiryModel::STATUS_PENDING);
$processed = InquiryModel::getInquiryCountByStatus($userId,InquiryModel::STATUS_PROCESSED);
$pending = InquiryModel::getInquiryCountByStatus($userId, InquiryModel::STATUS_PENDING);
$processed = InquiryModel::getInquiryCountByStatus($userId, InquiryModel::STATUS_PROCESSED);
$all = InquiryModel::getInquiryCountByStatus($userId);
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