...
|
...
|
@@ -275,6 +275,7 @@ class User extends Api |
|
|
"after"://售后的订单数
|
|
|
"summarize"://待总结的订单数
|
|
|
"jiesuan"://结算中的订单数
|
|
|
"level"://星级
|
|
|
}
|
|
|
})
|
|
|
*/
|
...
|
...
|
@@ -287,6 +288,7 @@ class User extends Api |
|
|
->where('id',$user_id)
|
|
|
->find();
|
|
|
if($data['identity'] == 1){
|
|
|
//学生身份
|
|
|
$data['underway'] = Db::name('order')
|
|
|
->where('user_id',$user_id)
|
|
|
->where('finish_status',1)
|
...
|
...
|
@@ -301,6 +303,28 @@ class User extends Api |
|
|
->where('is_complaint',1)
|
|
|
->count();
|
|
|
}else{
|
|
|
//老师身份
|
|
|
$teacher = Db::name('teacher')->where('user_id',$user_id)->find();
|
|
|
|
|
|
//查看老师的已帮助人数以及评分星级
|
|
|
$comment = Db::name('comment')->where('teacher_id',$teacher['id'])->select();
|
|
|
//评价为五星的人数
|
|
|
$five = Db::name('comment')->where('teacher_id',$teacher['id'])->where('level',5)->count();
|
|
|
//评价为四星的人数
|
|
|
$four = Db::name('comment')->where('teacher_id',$teacher['id'])->where('level',4)->count();
|
|
|
//评价为三星的人数
|
|
|
$three = Db::name('comment')->where('teacher_id',$teacher['id'])->where('level',3)->count();
|
|
|
//评价为二星的人数
|
|
|
$two = Db::name('comment')->where('teacher_id',$teacher['id'])->where('level',2)->count();
|
|
|
//评价为一星的人数
|
|
|
$one = Db::name('comment')->where('teacher_id',$teacher['id'])->where('level',1)->count();
|
|
|
if(!empty($comment)){
|
|
|
$data['help_num'] = $five + $four + $three + $two + $one + $teacher['help_num'];
|
|
|
$data['level'] = ceil(($teacher['help_num'] * 5 + $four * 4 + $three * 3 + $two * 2 + $one)/$teacher['help_num']);
|
|
|
}else{
|
|
|
$data['help_num'] = $teacher['help_num'];
|
|
|
$data['level'] = $teacher['level'];
|
|
|
}
|
|
|
//进行中
|
|
|
$data['underway'] = Db::name('order')
|
|
|
->where('user_id',$user_id)
|
...
|
...
|
|