|
@@ -22,7 +22,7 @@ class CenterController extends HomeBaseController |
|
@@ -22,7 +22,7 @@ class CenterController extends HomeBaseController |
22
|
function _initialize()
|
22
|
function _initialize()
|
23
|
{
|
23
|
{
|
24
|
if (empty(session('user.id'))) {
|
24
|
if (empty(session('user.id'))) {
|
25
|
- echo json_encode(['msg' => '登陆失败', 'code' => 40001]);
|
25
|
+ $this->redirect(url('portal/Index/index'));
|
26
|
exit();
|
26
|
exit();
|
27
|
}
|
27
|
}
|
28
|
}
|
28
|
}
|
|
@@ -473,7 +473,16 @@ class CenterController extends HomeBaseController |
|
@@ -473,7 +473,16 @@ class CenterController extends HomeBaseController |
473
|
public function comment(){
|
473
|
public function comment(){
|
474
|
$request = request();
|
474
|
$request = request();
|
475
|
if($request->isAjax()) {
|
475
|
if($request->isAjax()) {
|
476
|
-
|
476
|
+ $data = $request->param();
|
|
|
477
|
+ $data['user_id'] = session('user.id');
|
|
|
478
|
+ $data['comment_time'] = time();
|
|
|
479
|
+ $data['activity_id'] = Db::name('order_info')->where(['id'=>$data['oid']])->value('activity_id');
|
|
|
480
|
+ unset($data['oid']);
|
|
|
481
|
+ if(Db::name('activity_comment')->insert($data)) {
|
|
|
482
|
+ $this->success('评论成功', url('user/Center/orderDetail', ['oid'=>$request->param('oid')]), true);
|
|
|
483
|
+ }else {
|
|
|
484
|
+ $this->success('评论失败', '', false);
|
|
|
485
|
+ }
|
477
|
}else {
|
486
|
}else {
|
478
|
return $this->fetch(':comment', [
|
487
|
return $this->fetch(':comment', [
|
479
|
'oid' => request()->param('oid')
|
488
|
'oid' => request()->param('oid')
|