Skip to content

Commit

Permalink
功能重构带来的bug:后台评论审核报错
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyecommerce committed Sep 3, 2017
1 parent 6c2f269 commit 8430f9d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
13 changes: 13 additions & 0 deletions models/mongodb/product/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,19 @@ class Review extends ActiveRecord
const ACTIVE_STATUS = 1;
// 审核拒绝的状态
const REFUSE_STATUS = 2;


public function getActiveStatus(){
return self::ACTIVE_STATUS;
}

public function getNoActiveStatus(){
return self::NOACTIVE_STATUS;
}

public function getRefuseStatus(){
return self::REFUSE_STATUS;
}
/**
* mongodb collection 的名字,相当于mysql的table name
*/
Expand Down
6 changes: 3 additions & 3 deletions services/product/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ protected function actionAuditReviewByIds($ids)
if ($model[$this->getPrimaryKey()]) {
$model->audit_user = $user_id;
$model->audit_date = time();
$model->status = $reviewModel->ACTIVE_STATUS;
$model->status = $reviewModel->getActiveStatus();
$model->save();
// 更新评论信息到产品表中。
$this->updateProductSpuReview($model['product_spu'], $model['lang_code']);
Expand All @@ -351,7 +351,7 @@ protected function actionAuditRejectedReviewByIds($ids)
if ($model[$this->getPrimaryKey()]) {
$model->audit_user = $user_id;
$model->audit_date = time();
$model->status = $reviewModel->REFUSE_STATUS;
$model->status = $reviewModel->getRefuseStatus();
$model->save();
// 更新评论的信息到产品表
$this->updateProductSpuReview($model['product_spu'], $model['lang_code']);
Expand All @@ -370,7 +370,7 @@ protected function actionUpdateProductSpuReview($spu, $lang_code)
$filter = [
'where' => [
['product_spu' => $spu],
['status' => $reviewModel->ACTIVE_STATUS],
['status' => $reviewModel->getActiveStatus()],
],
];
$coll = $this->coll($filter);
Expand Down

0 comments on commit 8430f9d

Please sign in to comment.