Exemplo n.º 1
0
 public function actionTest()
 {
     $comment = new Comment();
     $orderDetail = new OrderDetail();
     $commentList = $comment->SelectAllProductCom();
     $count = 0;
     $num = 0;
     foreach ($commentList as $k => $v) {
         $orderDetailProductId = $orderDetail->findIdOrderDetailIsEvaluate($v['typeId']);
         if ($orderDetailProductId->productId == GlobalArray::$productIdArray['0']) {
             $count++;
             $num += $comment->findByIdCom($orderDetailProductId->id)->score;
         }
     }
     echo $num / $count;
 }