修改评价

This commit is contained in:
wucongxing 2023-04-17 16:30:18 +08:00
parent abeb3f8776
commit 257701e6cd
2 changed files with 9 additions and 7 deletions

View File

@ -50,7 +50,7 @@ class OrderEvaluation extends Model
*/ */
public static function getPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array public static function getPage(array $params, array $fields = ["*"], int $page = null, ?int $per_page = 10): array
{ {
$raw = self::where($params)->paginate($per_page, $fields, "page", $page); $raw = self::where($params)->orderBy('created_at','desc')->paginate($per_page, $fields, "page", $page);
$data = array(); $data = array();
$data['current_page'] = $raw->currentPage();// 当前页码 $data['current_page'] = $raw->currentPage();// 当前页码
$data['total'] = $raw->total();//数据总数 $data['total'] = $raw->total();//数据总数
@ -74,7 +74,9 @@ class OrderEvaluation extends Model
{ {
$raw = self::where($params) $raw = self::where($params)
->whereBetween('avg_score',$avg_score_params) ->whereBetween('avg_score',$avg_score_params)
->orderBy('created_at','desc')
->paginate($per_page, $fields, "page", $page); ->paginate($per_page, $fields, "page", $page);
$data = array(); $data = array();
$data['current_page'] = $raw->currentPage();// 当前页码 $data['current_page'] = $raw->currentPage();// 当前页码
$data['total'] = $raw->total();//数据总数 $data['total'] = $raw->total();//数据总数

View File

@ -716,7 +716,7 @@ class UserDoctorService extends BaseService
$avg_score_params = [80, 100]; $avg_score_params = [80, 100];
} elseif ($evaluation_type == 3) { } elseif ($evaluation_type == 3) {
// 中/差评 // 中/差评
$avg_score_params = [0, 80]; $avg_score_params = [0, 79];
} else { } else {
return fail(); return fail();
} }
@ -730,28 +730,28 @@ class UserDoctorService extends BaseService
} }
// 获取其他类型评论总数 // 获取其他类型评论总数
if ($evaluation_type != 1) { if ($evaluation_type == 1) {
// 好评 // 好评
$avg_score_params = [80, 100]; $avg_score_params = [80, 100];
$good_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params); $good_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params);
// 中/差评 // 中/差评
$avg_score_params = [0, 80]; $avg_score_params = [0, 79];
$bad_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params); $bad_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params);
} }
if ($evaluation_type != 2) { if ($evaluation_type == 2) {
// 全部+ // 全部+
$avg_score_params = [0, 100]; $avg_score_params = [0, 100];
$total_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params); $total_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params);
// 中/差评 // 中/差评
$avg_score_params = [0, 80]; $avg_score_params = [0, 79];
$bad_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params); $bad_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params);
} }
if ($evaluation_type != 3) { if ($evaluation_type == 3) {
// 全部+ // 全部+
$avg_score_params = [0, 100]; $avg_score_params = [0, 100];
$total_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params); $total_quantity = OrderEvaluation::getScoreCount($params, $avg_score_params);