사용 후기 별점 평균에는 관리자가 확인된것만 포함하게 하기

This commit is contained in:
thisgun
2017-04-28 17:54:12 +09:00
parent 48a1bc6410
commit 0fd968d782
2 changed files with 3 additions and 2 deletions

View File

@ -24,6 +24,7 @@ if ($w == "u")
sql_query($sql); sql_query($sql);
update_use_cnt($_POST['it_id']); update_use_cnt($_POST['it_id']);
update_use_avg($_POST['it_id']);
goto_url("./itemuseform.php?w=$w&is_id=$is_id&sca=$sca&$qstr"); goto_url("./itemuseform.php?w=$w&is_id=$is_id&sca=$sca&$qstr");
} }

View File

@ -840,7 +840,7 @@ function get_star_image($it_id)
{ {
global $g5; global $g5;
$sql = "select (SUM(is_score) / COUNT(*)) as score from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' "; $sql = "select (SUM(is_score) / COUNT(*)) as score from {$g5['g5_shop_item_use_table']} where it_id = '$it_id' and is_confirm = 1 ";
$row = sql_fetch($sql); $row = sql_fetch($sql);
return (int)get_star($row['score']); return (int)get_star($row['score']);
@ -2062,7 +2062,7 @@ function update_use_cnt($it_id)
function update_use_avg($it_id) function update_use_avg($it_id)
{ {
global $g5; global $g5;
$row = sql_fetch(" select count(*) as cnt, sum(is_score) as total from {$g5['g5_shop_item_use_table']} where it_id = '{$it_id}' "); $row = sql_fetch(" select count(*) as cnt, sum(is_score) as total from {$g5['g5_shop_item_use_table']} where it_id = '{$it_id}' and is_confirm = 1 ");
$average = ($row['total'] && $row['cnt']) ? $row['total'] / $row['cnt'] : 0; $average = ($row['total'] && $row['cnt']) ? $row['total'] / $row['cnt'] : 0;
return sql_query(" update {$g5['g5_shop_item_table']} set it_use_avg = '$average' where it_id = '{$it_id}' "); return sql_query(" update {$g5['g5_shop_item_table']} set it_use_avg = '$average' where it_id = '{$it_id}' ");
} }