|
@@ -18,7 +18,10 @@ use think\Db; |
|
@@ -18,7 +18,10 @@ use think\Db; |
18
|
|
18
|
|
19
|
class CommentController extends UserBaseController
|
19
|
class CommentController extends UserBaseController
|
20
|
{
|
20
|
{
|
21
|
- //去评价
|
21
|
+ /**
|
|
|
22
|
+ * 学生评价部分
|
|
|
23
|
+ */
|
|
|
24
|
+ //学员去评价教练
|
22
|
public function index(){
|
25
|
public function index(){
|
23
|
$id = $this->request->param("id", 0, "intval");
|
26
|
$id = $this->request->param("id", 0, "intval");
|
24
|
$yuyue_id = $this->request->param("yuyue_id", 0, "intval");
|
27
|
$yuyue_id = $this->request->param("yuyue_id", 0, "intval");
|
|
@@ -35,7 +38,7 @@ class CommentController extends UserBaseController |
|
@@ -35,7 +38,7 @@ class CommentController extends UserBaseController |
35
|
$this->assign("yuyue_id", $yuyue_id);
|
38
|
$this->assign("yuyue_id", $yuyue_id);
|
36
|
return $this->fetch('go_ping');
|
39
|
return $this->fetch('go_ping');
|
37
|
}
|
40
|
}
|
38
|
- //评价提交接口
|
41
|
+ //学员去评价教练提交接口
|
39
|
public function comment_do_by_stu(){
|
42
|
public function comment_do_by_stu(){
|
40
|
$data = $this->request->param();
|
43
|
$data = $this->request->param();
|
41
|
if(!$data){
|
44
|
if(!$data){
|
|
@@ -44,6 +47,10 @@ class CommentController extends UserBaseController |
|
@@ -44,6 +47,10 @@ class CommentController extends UserBaseController |
44
|
$dataa['teach_id'] = $data['teach_id'];
|
47
|
$dataa['teach_id'] = $data['teach_id'];
|
45
|
$dataa['yuyue_id'] = $data['yuyue_id'];
|
48
|
$dataa['yuyue_id'] = $data['yuyue_id'];
|
46
|
$dataa['uid'] = session('user.id');
|
49
|
$dataa['uid'] = session('user.id');
|
|
|
50
|
+ $yiping = Db::name('commente')->where($dataa)->find();
|
|
|
51
|
+ if($yiping){
|
|
|
52
|
+ return json(['code'=>'1','msg'=>'您已经评价']);
|
|
|
53
|
+ }
|
47
|
$dataa['create_time'] = time();
|
54
|
$dataa['create_time'] = time();
|
48
|
$dataa['comment_tag'] = $data['comment_tag'];
|
55
|
$dataa['comment_tag'] = $data['comment_tag'];
|
49
|
$dataa['comment'] = $data['comment'];
|
56
|
$dataa['comment'] = $data['comment'];
|
|
@@ -57,20 +64,86 @@ class CommentController extends UserBaseController |
|
@@ -57,20 +64,86 @@ class CommentController extends UserBaseController |
57
|
}else{
|
64
|
}else{
|
58
|
return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
65
|
return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
59
|
}
|
66
|
}
|
60
|
- } //评价提交接口
|
67
|
+ }
|
|
|
68
|
+ //评价详情--对教练的评价
|
|
|
69
|
+ public function show_stu(){
|
|
|
70
|
+ $id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
71
|
+ if(!$id){
|
|
|
72
|
+ $this->error('数据异常');
|
|
|
73
|
+ }
|
|
|
74
|
+ //获取预约信息
|
|
|
75
|
+ $yuyue_data = Db::name('yuyue')
|
|
|
76
|
+ ->alias('yy')
|
|
|
77
|
+ ->join('qnb_user qu','qu.id = yy .teach_id')
|
|
|
78
|
+ ->field('yy.*,qu.user_nickname,qu.headimgurl')
|
|
|
79
|
+ ->where(['yy.id'=>$id])
|
|
|
80
|
+ ->find();
|
|
|
81
|
+ $teach_id = $yuyue_data['teach_id'];
|
|
|
82
|
+ $kemu = Db::name('user')->where(['id'=>$yuyue_data['uid']])->value('kemu');
|
|
|
83
|
+ $yuyue_data['kemu'] = $kemu;
|
|
|
84
|
+ //获取标签
|
|
|
85
|
+ $rre = Db::name('commente')->where(['yuyue_id'=>$id,'teach_id'=>$teach_id])->find();
|
|
|
86
|
+ $rree = Db::name('commente_tag')->where(['id'=>['in',$rre['comment_tag']]])->field('name')->select()->toArray();
|
|
|
87
|
+
|
|
|
88
|
+ $this->assign("yuyue",$yuyue_data);
|
|
|
89
|
+ $this->assign("ctdata",$rree);
|
|
|
90
|
+ $this->assign("cdata",$rre);
|
|
|
91
|
+ return $this->fetch('look_ping');
|
|
|
92
|
+ }
|
|
|
93
|
+
|
|
|
94
|
+ /**
|
|
|
95
|
+ * 教练评价部分
|
|
|
96
|
+ */
|
|
|
97
|
+ public function pingjia_by_coach(){
|
|
|
98
|
+ $id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
99
|
+ $uid = $this->request->param("id", 0, "intval");
|
|
|
100
|
+ $this->assign('yuyue_id',$id);
|
|
|
101
|
+ $this->assign('uid',$uid);
|
|
|
102
|
+ return $this->fetch('ping_stu');
|
|
|
103
|
+ }
|
|
|
104
|
+ //对学生的评价放到commente1
|
|
|
105
|
+ public function pingjia_by_coach_do(){
|
|
|
106
|
+ $id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
107
|
+ $uid = $this->request->param("uid", 0, "intval");
|
|
|
108
|
+ $comment = $this->request->param("comment");
|
|
|
109
|
+ if($id && $uid){
|
|
|
110
|
+ $data['uid'] = $uid;
|
|
|
111
|
+ $data['yuyue_id'] = $id;
|
|
|
112
|
+ $data['teach_id'] = session('user.id');
|
|
|
113
|
+ $data['comment'] = $comment;
|
|
|
114
|
+ $data['create_time'] = time();
|
|
|
115
|
+ $re = DB::name('commente1')->insert($data);
|
|
|
116
|
+ $res = Db::name('yuyue')->where(['id'=>$data['yuyue_id']])->update(['status'=>'3','pingjia_xueyuan'=>'1']);
|
|
|
117
|
+ if($re){
|
|
|
118
|
+ return json(['code'=>'1','msg'=>'评价成功']);
|
|
|
119
|
+ }else{
|
|
|
120
|
+ return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
|
|
121
|
+ }
|
|
|
122
|
+ }else{
|
|
|
123
|
+ return json(['code'=>'0','msg'=>'数据异常']);
|
|
|
124
|
+ }
|
|
|
125
|
+ }
|
|
|
126
|
+ //教练对学生的评价提交
|
61
|
public function comment_do(){
|
127
|
public function comment_do(){
|
62
|
$data = $this->request->param();
|
128
|
$data = $this->request->param();
|
63
|
if(!$data){
|
129
|
if(!$data){
|
64
|
return json(['code'=>'0','msg'=>'非法提交']);
|
130
|
return json(['code'=>'0','msg'=>'非法提交']);
|
65
|
}
|
131
|
}
|
|
|
132
|
+
|
66
|
$dataa['teach_id'] = $data['teach_id'];
|
133
|
$dataa['teach_id'] = $data['teach_id'];
|
67
|
$dataa['yuyue_id'] = $data['yuyue_id'];
|
134
|
$dataa['yuyue_id'] = $data['yuyue_id'];
|
68
|
$dataa['uid'] = session('user.id');
|
135
|
$dataa['uid'] = session('user.id');
|
|
|
136
|
+ $yiping = Db::name('commente1')->where($dataa)->find();
|
|
|
137
|
+ if($yiping){
|
|
|
138
|
+ return json(['code'=>'1','msg'=>'您已经评价']);
|
|
|
139
|
+ }
|
|
|
140
|
+
|
|
|
141
|
+
|
69
|
$dataa['create_time'] = time();
|
142
|
$dataa['create_time'] = time();
|
70
|
$dataa['comment_tag'] = $data['comment_tag'];
|
143
|
$dataa['comment_tag'] = $data['comment_tag'];
|
71
|
$dataa['comment'] = $data['comment'];
|
144
|
$dataa['comment'] = $data['comment'];
|
72
|
$dataa['type'] = $data['type'];
|
145
|
$dataa['type'] = $data['type'];
|
73
|
- $re = Db::name('commente')->insert($dataa);
|
146
|
+ $re = Db::name('commente1')->insert($dataa);
|
74
|
$res = Db::name('yuyue')->where(['id'=>$data['yuyue_id']])->update(['status'=>'3','pingjia_xueyuan'=>'1']);
|
147
|
$res = Db::name('yuyue')->where(['id'=>$data['yuyue_id']])->update(['status'=>'3','pingjia_xueyuan'=>'1']);
|
75
|
//echo Db::name('yuyue')->getLastSql();
|
148
|
//echo Db::name('yuyue')->getLastSql();
|
76
|
|
149
|
|
|
@@ -80,7 +153,7 @@ class CommentController extends UserBaseController |
|
@@ -80,7 +153,7 @@ class CommentController extends UserBaseController |
80
|
return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
153
|
return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
81
|
}
|
154
|
}
|
82
|
}
|
155
|
}
|
83
|
- //评价详情--对学生的评价
|
156
|
+ //评价详情--教练对学生的评价
|
84
|
public function show(){
|
157
|
public function show(){
|
85
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
158
|
$id = $this->request->param("yuyue_id", 0, "intval");
|
86
|
|
159
|
|
|
@@ -91,54 +164,22 @@ class CommentController extends UserBaseController |
|
@@ -91,54 +164,22 @@ class CommentController extends UserBaseController |
91
|
$yuyue_data = Db::name('yuyue')
|
164
|
$yuyue_data = Db::name('yuyue')
|
92
|
->alias('yy')
|
165
|
->alias('yy')
|
93
|
->join('qnb_user qu','qu.id = yy.uid')
|
166
|
->join('qnb_user qu','qu.id = yy.uid')
|
94
|
- ->field('yy.*,qu.user_nickname,qu.headimgurl')
|
167
|
+ ->field('yy.*,qu.user_nickname,qu.headimgurl,qu.kemu')
|
95
|
->where(['yy.id'=>$id])
|
168
|
->where(['yy.id'=>$id])
|
96
|
->find();
|
169
|
->find();
|
97
|
$uid = $yuyue_data['uid'];
|
170
|
$uid = $yuyue_data['uid'];
|
98
|
- //获取学车的资料
|
|
|
99
|
- $gname = Db::name('goods')
|
|
|
100
|
- ->alias('g')
|
|
|
101
|
- ->join('qnb_order qo','qo.gid = g.id')
|
|
|
102
|
- ->where(['qo.uid'=>$yuyue_data['uid'],'qo.status'=>1])
|
|
|
103
|
- ->value('g.name');
|
|
|
104
|
//获取评价
|
171
|
//获取评价
|
105
|
$cdata = Db::name('commente1')->where(['uid'=>$uid,'yuyue_id'=>$id])->find();
|
172
|
$cdata = Db::name('commente1')->where(['uid'=>$uid,'yuyue_id'=>$id])->find();
|
106
|
|
173
|
|
107
|
- $this->assign("gname",$gname);
|
|
|
108
|
$this->assign("yuyue",$yuyue_data);
|
174
|
$this->assign("yuyue",$yuyue_data);
|
109
|
$this->assign("cdata",$cdata);
|
175
|
$this->assign("cdata",$cdata);
|
110
|
return $this->fetch('my_ping');
|
176
|
return $this->fetch('my_ping');
|
111
|
}
|
177
|
}
|
112
|
- //评价详情--教练的评价
|
|
|
113
|
- public function show_stu(){
|
|
|
114
|
- $id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
115
|
- if(!$id){
|
|
|
116
|
- $this->error('数据异常');
|
|
|
117
|
- }
|
|
|
118
|
- //获取预约信息
|
|
|
119
|
- $yuyue_data = Db::name('yuyue')
|
|
|
120
|
- ->alias('yy')
|
|
|
121
|
- ->join('qnb_user qu','qu.id = yy .teach_id')
|
|
|
122
|
- ->field('yy.*,qu.user_nickname,qu.headimgurl')
|
|
|
123
|
- ->where(['yy.id'=>$id])
|
|
|
124
|
- ->find();
|
|
|
125
|
- //获取学车的资料
|
|
|
126
|
- $teach_id = $yuyue_data['teach_id'];
|
|
|
127
|
- $gname = Db::name('goods')
|
|
|
128
|
- ->alias('g')
|
|
|
129
|
- ->join('qnb_order qo','qo.gid = g.id')
|
|
|
130
|
- ->where(['qo.uid'=>$yuyue_data['uid'],'qo.status'=>1])
|
|
|
131
|
- ->value('g.name');
|
|
|
132
|
- //获取标签
|
|
|
133
|
- $rre = Db::name('commente')->where(['teach_id'=>$teach_id])->find();
|
|
|
134
|
- $rree = Db::name('commente_tag')->where(['id'=>['in',$rre['comment_tag']]])->field('name')->select()->toArray();
|
|
|
135
|
|
178
|
|
136
|
- $this->assign("gname",$gname);
|
|
|
137
|
- $this->assign("yuyue",$yuyue_data);
|
|
|
138
|
- $this->assign("ctdata",$rree);
|
|
|
139
|
- $this->assign("cdata",$rre);
|
|
|
140
|
- return $this->fetch('look_ping');
|
|
|
141
|
- }
|
179
|
+
|
|
|
180
|
+
|
|
|
181
|
+
|
|
|
182
|
+
|
142
|
|
183
|
|
143
|
//评价详情--对教练的评价
|
184
|
//评价详情--对教练的评价
|
144
|
public function jindu(){
|
185
|
public function jindu(){
|
|
@@ -167,36 +208,6 @@ class CommentController extends UserBaseController |
|
@@ -167,36 +208,6 @@ class CommentController extends UserBaseController |
167
|
|
208
|
|
168
|
}
|
209
|
}
|
169
|
|
210
|
|
170
|
- public function pingjia_by_coach(){
|
|
|
171
|
- $id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
172
|
- $uid = $this->request->param("id", 0, "intval");
|
|
|
173
|
- $this->assign('yuyue_id',$id);
|
|
|
174
|
- $this->assign('uid',$uid);
|
|
|
175
|
- return $this->fetch('ping_stu');
|
|
|
176
|
- }
|
|
|
177
|
- //对学生的评价放到commente1
|
|
|
178
|
- public function pingjia_by_coach_do(){
|
|
|
179
|
- $id = $this->request->param("yuyue_id", 0, "intval");
|
|
|
180
|
- $uid = $this->request->param("uid", 0, "intval");
|
|
|
181
|
- $comment = $this->request->param("comment");
|
|
|
182
|
- if($id && $uid){
|
|
|
183
|
- $data['uid'] = $uid;
|
|
|
184
|
- $data['yuyue_id'] = $id;
|
|
|
185
|
- $data['teach_id'] = session('user.id');
|
|
|
186
|
- $data['comment'] = $comment;
|
|
|
187
|
- $data['create_time'] = time();
|
|
|
188
|
- $re = DB::name('commente1')->insert($data);
|
|
|
189
|
- $res = Db::name('yuyue')->where(['id'=>$data['yuyue_id']])->update(['status'=>'3','pingjia_xueyuan'=>'1']);
|
|
|
190
|
- if($re){
|
|
|
191
|
- return json(['code'=>'1','msg'=>'评价成功']);
|
|
|
192
|
- }else{
|
|
|
193
|
- return json(['code'=>'0','msg'=>'抱歉,评价失败']);
|
|
|
194
|
- }
|
|
|
195
|
- }else{
|
|
|
196
|
- return json(['code'=>'0','msg'=>'数据异常']);
|
|
|
197
|
- }
|
|
|
198
|
- }
|
|
|
199
|
-
|
|
|
200
|
|
211
|
|
201
|
|
212
|
|
202
|
|
213
|
|