case COMMENT_BOUGHT :
if ($_SESSION['user_id'] > 0)
{
$sql = "SELECT o.order_id".
" FROM " . $ecs->table('order_info'). " AS o, ".
$ecs->table('order_goods') . " AS og ".
" WHERE o.order_id = og.order_id".
" AND o.user_id = '" . $_SESSION['user_id'] . "'".
" AND og.goods_id = '" . $cmt->id . "'".
" AND o.order_status = '" . OS_CONFIRMED . "' ".
" AND (o.pay_status = '" . PS_PAYED . "' OR o.pay_status = '" . PS_PAYING . "') ".
" AND (o.shipping_status = '" . SS_SHIPPED . "' OR o.shipping_status = '" . SS_RECEIVED . "') ".
" LIMIT 1";
$tmp = $db->getOne($sql);
if (emptyempty($tmp))
{
$result['error'] = 1;
$result['message'] = $_LANG['comment_brought'];
}
}
替换为
case COMMENT_BOUGHT :
if ($_SESSION['user_id'] > 0)
{
$sql = "SELECT COUNT(o.order_id)".
" FROM " . $ecs->table('order_info'). " AS o, ".
$ecs->table('order_goods') . " AS og ".
" WHERE o.order_id = og.order_id".
" AND o.user_id = '" . $_SESSION['user_id'] . "'".
" AND og.goods_id = '" . $cmt->id . "'".
" AND (o.order_status = '" . OS_CONFIRMED . "' or o.order_status = '" . OS_SPLITED . "') ".
" AND (o.pay_status = '" . PS_PAYED . "' OR o.pay_status = '" . PS_PAYING . "') ".
" AND (o.shipping_status = '" . SS_SHIPPED . "' OR o.shipping_status = '" . SS_RECEIVED . "') ";
$bought_count = $db->getOne($sql);
if (!$bought_count)
{
$result['error'] = 1;
$result['message'] = $_LANG['comment_brought'];
}else{
$sql = "SELECT COUNT(comment_id) FROM " . $ecs->table('comment') .
" WHERE user_id = '" . $_SESSION['user_id'] . "'".
" AND id_value= '" . $cmt->id . "'";
$comment_count = $db->getOne($sql);
if($comment_count >= $bought_count){
$result['error'] = 1;
$result['message'] = '您已对此商品进行过评价!您可以继续购买以便再次评论。';
}
}
}
版权声明: 本站资源均来自互联网或会员发布,如果侵犯了您的权益请与我们联系,我们将在24小时内删除!谢谢!
转载请注明: ecshop商品评论增加评论权限购买多少次评论多少次