作者 lihan
1 个管道 的构建 通过 耗费 0 秒

项目细节完善

@@ -482,18 +482,22 @@ class CenterController extends HomeBaseController @@ -482,18 +482,22 @@ class CenterController extends HomeBaseController
482 $data['comment_time'] = time(); 482 $data['comment_time'] = time();
483 $data['activity_id'] = Db::name('order_info')->where(['id' => $oid])->value('activity_id'); 483 $data['activity_id'] = Db::name('order_info')->where(['id' => $oid])->value('activity_id');
484 Db::startTrans(); 484 Db::startTrans();
485 - if (Db::name('activity_comment')->insert($data)) {  
486 - //改变订单状态  
487 - if (Db::name('order_info')->update(['id' => $oid, 'status' => 6])) {  
488 - Db::commit();  
489 - $this->success('评论成功', url('user/Center/orderDetail', ['oid' => $request->param('oid')]), true); 485 + if(Db::name('order_info')->where(['id'=>$oid])->value('status') == 5) {
  486 + if (Db::name('activity_comment')->insert($data)) {
  487 + //改变订单状态
  488 + if (Db::name('order_info')->update(['id' => $oid, 'status' => 6])) {
  489 + Db::commit();
  490 + $this->success('评论成功', url('user/Center/orderDetail', ['oid' => $request->param('oid')]), true);
  491 + } else {
  492 + Db::rollback();
  493 + $this->success('评论失败', '', false);
  494 + }
490 } else { 495 } else {
491 Db::rollback(); 496 Db::rollback();
492 $this->success('评论失败', '', false); 497 $this->success('评论失败', '', false);
493 } 498 }
494 - } else {  
495 - Db::rollback();  
496 - $this->success('评论失败', '', false); 499 + }else {
  500 + $this->success('禁止重复评论', '', false);
497 } 501 }
498 } else { 502 } else {
499 return $this->fetch(':comment', [ 503 return $this->fetch(':comment', [