作者 lianghiu
此 diff 太大无法显示。
... ... @@ -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'=>'数据异常']);
}
}
... ...
... ... @@ -35,15 +35,17 @@ class ProfileController extends UserBaseController
if ($data['user_type'] == '3') {
$yyxs = Db::name('yuyue')
->where(['teach_id' => $uid, 'status' => 3])
->count();
$yyxs = $yyxs ? $yyxs : 0;
->field(' SUM(yuyue_end - yuyue_begin) as yyxs ')
->select()->toArray();
$yyxs = $yyxs ? $yyxs[0]['yyxs'] : '0';
$this->assign("yyxs", $yyxs);
return $this->fetch('percenter_coach');
} else {
$yyxs = Db::name('yuyue')
->where(['uid' => $uid, 'status' => 3])
->count();
$yyxs = $yyxs ? $yyxs : 0;
->field(' SUM(yuyue_end - yuyue_begin) as yyxs ')
->select()->toArray();
$yyxs = $yyxs ? $yyxs[0]['yyxs'] : '0';
$this->assign("yyxs", $yyxs);
return $this->fetch('percenter_stu');
}
... ...
... ... @@ -406,10 +406,16 @@ class YuyueController extends UserBaseController
->select()
->toArray();
// $yyxs = Db::name('yuyue')
// ->where(['uid' => $id, 'status' => 3])
// ->count();
// $yyxs = $yyxs ? $yyxs : 0;
$yyxs = Db::name('yuyue')
->where(['uid' => $id, 'status' => 3])
->count();
$yyxs = $yyxs ? $yyxs : 0;
->field(' SUM(yuyue_end - yuyue_begin) as yyxs ')
->select()->toArray();
$yyxs = $yyxs ? $yyxs[0]['yyxs'] : '0';
$this->assign("data", $data);
$this->assign("yyxs", $yyxs);
... ... @@ -483,10 +489,16 @@ class YuyueController extends UserBaseController
->select()
->toArray();
$yjxs = Db::name('yuyue')
// $yjxs = Db::name('yuyue')
// ->where(['teach_id' => $id, 'status' => 3])
// ->count();
// $yjxs = $yjxs ? $yjxs : 0;
$yyxs = Db::name('yuyue')
->where(['teach_id' => $id, 'status' => 3])
->count();
$yjxs = $yjxs ? $yjxs : 0;
->field(' SUM(yuyue_end - yuyue_begin) as yyxs ')
->select()->toArray();
$yjxs = $yyxs ? $yyxs[0]['yyxs'] : '0';
$this->assign("data", $data);
$this->assign("data1", $data1);
... ...
... ... @@ -19,7 +19,7 @@
<img src="{$yuyue.headimgurl}" class="yu_user_head"/>
<div class="yu_user_info">
<b class="user_name">{$yuyue.user_nickname}</b>
<i class="user_fun">{$gname}</i>
<i class="user_fun">{$yuyue.kemu}</i>
</div>
<div class="yu_date">
<b class="yu_week">{$yuyue.yuyue_week}</b>
... ...
... ... @@ -25,7 +25,7 @@
<img src="{$yuyue.headimgurl}" class="yu_user_head"/>
<div class="yu_user_info">
<b class="user_name">{$yuyue.user_nickname}</b>
<i class="user_fun">{$gname}</i>
<i class="user_fun">{$yuyue.kemu}</i>
</div>
<div class="yu_date">
<b class="yu_week">{$yuyue.yuyue_week}</b>
... ...
... ... @@ -60,7 +60,10 @@
$('#wordage').html(pattern);
}
);
var click_num = 0;
$('.btn_ping').click(function () {
if(click_num == 0){
click_num++;
var str_len = $('#wordtext').val().length;
if (str_len ==0) {
layer.msg('评价不能为空!')
... ... @@ -78,9 +81,15 @@
layer.msg(res.msg);
window.location.href="/user/profile/percenter";
}
},
error:function(err){
click_num=0;
}
});
}
}else{
layer.msg("请勿重复评价");
}
});
})(window, jQuery)
</script>
... ...
... ... @@ -241,33 +241,11 @@
<i class="yu_times">{$vo.yuyue_begin}:00 - {$vo.yuyue_end}:00</i>
</div>
</div>
<switch name="$vo.status">
<case value="1">
<div class="yuyue_btn">
<b class="click_yuyue" data-id="{$vo.id}">开始学车</b>
<b class="click_jindu"
onclick=location.href="{:url('user/comment/jindu',array('id'=>$vo['uid'],'yuyue_id'=>$vo['id']))}">查看进度</b>
</div>
</case>
<case value="2">
<div class="yuyue_btn" onclick=location.href="{:url('user/comment/pingjia_by_coach',array('id'=>
$vo['uid'],'yuyue_id'=>$vo['id']))}">
<b class="click_yuyue">去评价</b>
</div>
</case>
<case value="3">
<div class="yuyue_btn" onclick=location.href="{:url('user/comment/show',array('id'=>
$vo['uid'],'yuyue_id'=>$vo['id']))}">
<b class="click_yuyue">查看评价</b>
</div>
</case>
<case value="4">
<div class="yuyue_btn">
<b class="click_yuyue" data-id="{$vo.id}">学车完毕</b>
</div>
</case>
<default/>
</switch>
</div>
</volist>
</empty>
... ...
... ... @@ -2089,12 +2089,18 @@ function birthday_old($id){
function id_xueshi($id){
$name = Db::name('yuyue')
->where(['uid'=>$id,'status'=>'3'])
->count();
return $name;
->field(' SUM(yuyue_end - yuyue_begin) as yyxs ')
->select()->toArray();
// return Db::name('yuyue')->getLastSql();
// return json_encode($name,true) ;
$yyxs = $name ? $name[0]['yyxs'] : '0';
return $yyxs;
}
function tid_xueshi($id){
$name = Db::name('yuyue')
->where(['teach_id'=>$id,'status'=>'3'])
->count();
return $name;
->field(' SUM(yuyue_end - yuyue_begin) as yyxs ')
->select()->toArray();
$yyxs = $name ? $name[0]['yyxs'] : '0';
return $yyxs;
}
\ No newline at end of file
... ...