...
|
...
|
@@ -18,7 +18,10 @@ use think\Db; |
|
|
|
|
|
class CommentController extends UserBaseController
|
|
|
{
|
|
|
//去评价
|
|
|
/**
|
|
|
* 学生评价部分
|
|
|
*/
|
|
|
//学员去评价教练
|
|
|
public function index(){
|
|
|
$id = $this->request->param("id", 0, "intval");
|
|
|
$yuyue_id = $this->request->param("yuyue_id", 0, "intval");
|
...
|
...
|
@@ -35,7 +38,7 @@ class CommentController extends UserBaseController |
|
|
$this->assign("yuyue_id", $yuyue_id);
|
|
|
return $this->fetch('go_ping');
|
|
|
}
|
|
|
//评价提交接口
|
|
|
//学员去评价教练提交接口
|
|
|
public function comment_do_by_stu(){
|
|
|
$data = $this->request->param();
|
|
|
if(!$data){
|
...
|
...
|
@@ -44,6 +47,10 @@ class CommentController extends UserBaseController |
|
|
$dataa['teach_id'] = $data['teach_id'];
|
|
|
$dataa['yuyue_id'] = $data['yuyue_id'];
|
|
|
$dataa['uid'] = session('user.id');
|
|
|
$yiping = Db::name('commente')->where($dataa)->find();
|
|
|
if($yiping){
|
|
|
return json(['code'=>'1','msg'=>'您已经评价']);
|
|
|
}
|
|
|
$dataa['create_time'] = time();
|
|
|
$dataa['comment_tag'] = $data['comment_tag'];
|
|
|
$dataa['comment'] = $data['comment'];
|
...
|
...
|
@@ -57,20 +64,86 @@ class CommentController extends UserBaseController |
|
|
}else{
|
|
|
return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
|
|
}
|
|
|
} //评价提交接口
|
|
|
}
|
|
|
//评价详情--对教练的评价
|
|
|
public function show_stu(){
|
|
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
if(!$id){
|
|
|
$this->error('数据异常');
|
|
|
}
|
|
|
//获取预约信息
|
|
|
$yuyue_data = Db::name('yuyue')
|
|
|
->alias('yy')
|
|
|
->join('qnb_user qu','qu.id = yy .teach_id')
|
|
|
->field('yy.*,qu.user_nickname,qu.headimgurl')
|
|
|
->where(['yy.id'=>$id])
|
|
|
->find();
|
|
|
$teach_id = $yuyue_data['teach_id'];
|
|
|
$kemu = Db::name('user')->where(['id'=>$yuyue_data['uid']])->value('kemu');
|
|
|
$yuyue_data['kemu'] = $kemu;
|
|
|
//获取标签
|
|
|
$rre = Db::name('commente')->where(['yuyue_id'=>$id,'teach_id'=>$teach_id])->find();
|
|
|
$rree = Db::name('commente_tag')->where(['id'=>['in',$rre['comment_tag']]])->field('name')->select()->toArray();
|
|
|
|
|
|
$this->assign("yuyue",$yuyue_data);
|
|
|
$this->assign("ctdata",$rree);
|
|
|
$this->assign("cdata",$rre);
|
|
|
return $this->fetch('look_ping');
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
* 教练评价部分
|
|
|
*/
|
|
|
public function pingjia_by_coach(){
|
|
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
$uid = $this->request->param("id", 0, "intval");
|
|
|
$this->assign('yuyue_id',$id);
|
|
|
$this->assign('uid',$uid);
|
|
|
return $this->fetch('ping_stu');
|
|
|
}
|
|
|
//对学生的评价放到commente1
|
|
|
public function pingjia_by_coach_do(){
|
|
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
$uid = $this->request->param("uid", 0, "intval");
|
|
|
$comment = $this->request->param("comment");
|
|
|
if($id && $uid){
|
|
|
$data['uid'] = $uid;
|
|
|
$data['yuyue_id'] = $id;
|
|
|
$data['teach_id'] = session('user.id');
|
|
|
$data['comment'] = $comment;
|
|
|
$data['create_time'] = time();
|
|
|
$re = DB::name('commente1')->insert($data);
|
|
|
$res = Db::name('yuyue')->where(['id'=>$data['yuyue_id']])->update(['status'=>'3','pingjia_xueyuan'=>'1']);
|
|
|
if($re){
|
|
|
return json(['code'=>'1','msg'=>'评价成功']);
|
|
|
}else{
|
|
|
return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
|
|
}
|
|
|
}else{
|
|
|
return json(['code'=>'0','msg'=>'数据异常']);
|
|
|
}
|
|
|
}
|
|
|
//教练对学生的评价提交
|
|
|
public function comment_do(){
|
|
|
$data = $this->request->param();
|
|
|
if(!$data){
|
|
|
return json(['code'=>'0','msg'=>'非法提交']);
|
|
|
}
|
|
|
|
|
|
$dataa['teach_id'] = $data['teach_id'];
|
|
|
$dataa['yuyue_id'] = $data['yuyue_id'];
|
|
|
$dataa['uid'] = session('user.id');
|
|
|
$yiping = Db::name('commente1')->where($dataa)->find();
|
|
|
if($yiping){
|
|
|
return json(['code'=>'1','msg'=>'您已经评价']);
|
|
|
}
|
|
|
|
|
|
|
|
|
$dataa['create_time'] = time();
|
|
|
$dataa['comment_tag'] = $data['comment_tag'];
|
|
|
$dataa['comment'] = $data['comment'];
|
|
|
$dataa['type'] = $data['type'];
|
|
|
$re = Db::name('commente')->insert($dataa);
|
|
|
$re = Db::name('commente1')->insert($dataa);
|
|
|
$res = Db::name('yuyue')->where(['id'=>$data['yuyue_id']])->update(['status'=>'3','pingjia_xueyuan'=>'1']);
|
|
|
//echo Db::name('yuyue')->getLastSql();
|
|
|
|
...
|
...
|
@@ -80,7 +153,7 @@ class CommentController extends UserBaseController |
|
|
return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
|
|
}
|
|
|
}
|
|
|
//评价详情--对学生的评价
|
|
|
//评价详情--教练对学生的评价
|
|
|
public function show(){
|
|
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
|
...
|
...
|
@@ -91,54 +164,22 @@ class CommentController extends UserBaseController |
|
|
$yuyue_data = Db::name('yuyue')
|
|
|
->alias('yy')
|
|
|
->join('qnb_user qu','qu.id = yy.uid')
|
|
|
->field('yy.*,qu.user_nickname,qu.headimgurl')
|
|
|
->field('yy.*,qu.user_nickname,qu.headimgurl,qu.kemu')
|
|
|
->where(['yy.id'=>$id])
|
|
|
->find();
|
|
|
$uid = $yuyue_data['uid'];
|
|
|
//获取学车的资料
|
|
|
$gname = Db::name('goods')
|
|
|
->alias('g')
|
|
|
->join('qnb_order qo','qo.gid = g.id')
|
|
|
->where(['qo.uid'=>$yuyue_data['uid'],'qo.status'=>1])
|
|
|
->value('g.name');
|
|
|
//获取评价
|
|
|
$cdata = Db::name('commente1')->where(['uid'=>$uid,'yuyue_id'=>$id])->find();
|
|
|
|
|
|
$this->assign("gname",$gname);
|
|
|
$this->assign("yuyue",$yuyue_data);
|
|
|
$this->assign("cdata",$cdata);
|
|
|
return $this->fetch('my_ping');
|
|
|
}
|
|
|
//评价详情--教练的评价
|
|
|
public function show_stu(){
|
|
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
if(!$id){
|
|
|
$this->error('数据异常');
|
|
|
}
|
|
|
//获取预约信息
|
|
|
$yuyue_data = Db::name('yuyue')
|
|
|
->alias('yy')
|
|
|
->join('qnb_user qu','qu.id = yy .teach_id')
|
|
|
->field('yy.*,qu.user_nickname,qu.headimgurl')
|
|
|
->where(['yy.id'=>$id])
|
|
|
->find();
|
|
|
//获取学车的资料
|
|
|
$teach_id = $yuyue_data['teach_id'];
|
|
|
$gname = Db::name('goods')
|
|
|
->alias('g')
|
|
|
->join('qnb_order qo','qo.gid = g.id')
|
|
|
->where(['qo.uid'=>$yuyue_data['uid'],'qo.status'=>1])
|
|
|
->value('g.name');
|
|
|
//获取标签
|
|
|
$rre = Db::name('commente')->where(['teach_id'=>$teach_id])->find();
|
|
|
$rree = Db::name('commente_tag')->where(['id'=>['in',$rre['comment_tag']]])->field('name')->select()->toArray();
|
|
|
|
|
|
$this->assign("gname",$gname);
|
|
|
$this->assign("yuyue",$yuyue_data);
|
|
|
$this->assign("ctdata",$rree);
|
|
|
$this->assign("cdata",$rre);
|
|
|
return $this->fetch('look_ping');
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//评价详情--对教练的评价
|
|
|
public function jindu(){
|
...
|
...
|
@@ -167,36 +208,6 @@ class CommentController extends UserBaseController |
|
|
|
|
|
}
|
|
|
|
|
|
public function pingjia_by_coach(){
|
|
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
$uid = $this->request->param("id", 0, "intval");
|
|
|
$this->assign('yuyue_id',$id);
|
|
|
$this->assign('uid',$uid);
|
|
|
return $this->fetch('ping_stu');
|
|
|
}
|
|
|
//对学生的评价放到commente1
|
|
|
public function pingjia_by_coach_do(){
|
|
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
$uid = $this->request->param("uid", 0, "intval");
|
|
|
$comment = $this->request->param("comment");
|
|
|
if($id && $uid){
|
|
|
$data['uid'] = $uid;
|
|
|
$data['yuyue_id'] = $id;
|
|
|
$data['teach_id'] = session('user.id');
|
|
|
$data['comment'] = $comment;
|
|
|
$data['create_time'] = time();
|
|
|
$re = DB::name('commente1')->insert($data);
|
|
|
$res = Db::name('yuyue')->where(['id'=>$data['yuyue_id']])->update(['status'=>'3','pingjia_xueyuan'=>'1']);
|
|
|
if($re){
|
|
|
return json(['code'=>'1','msg'=>'评价成功']);
|
|
|
}else{
|
|
|
return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
|
|
}
|
|
|
}else{
|
|
|
return json(['code'=>'0','msg'=>'数据异常']);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
...
|
...
|
|