포인트와 같은방식으로 경험치를 추가해봤는대요.. 정보
포인트와 같은방식으로 경험치를 추가해봤는대요..본문
포인트와 같은방식으로 경험치를 추가해봤는대요
뭔가빼먹었는지 몇군데에서 차이가 나는군요;;
게시물을 삭제하면 포인트의 경우에는 포인트내역에서 삭제됩니다.
하지만 경험치의 경우에는 경험치내역에서 삭제되지 않고 추가로 "어떤글삭제" 라고 나옵니다.
많은 문제는 되지 않는대 데이터양이 많아지면 불편할것 같아서요
포인트기능중에 "어떤글삭제" 를 추가하지 않고 데이터를 삭제하는부분을
찾아주시면 감사하겠습니다.
ps. common.lip.php 의 해당부분 입니다.
딱히 활동량 삭제 부분에서 db 에 insert 하는 부분은 안보이는대 말이죠 ;;
삭제하는 부분은 보이는대 ㅠㅠ
// 포인트 부여
function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='')
{
global $config;
global $g4;
global $is_admin;
// 포인트 사용을 하지 않는다면 return
if (!$config[cf_use_point]) { return 0; }
// 포인트가 없다면 업데이트 할 필요 없음
if ($point == 0) { return 0; }
// 회원아이디가 없다면 업데이트 할 필요 없음
if ($mb_id == "") { return 0; }
$mb = sql_fetch(" select mb_id from $g4[member_table] where mb_id = '$mb_id' ");
if (!$mb[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$sql = " select count(*) as cnt from $g4[point_table]
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
return -1;
}
// 포인트 건별 생성
$sql = " insert into $g4[point_table]
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$point',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from $g4[point_table] where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row[sum_po_point];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
// 포인트 삭제
function delete_point($mb_id, $rel_table, $rel_id, $rel_action)
{
global $g4;
$result = false;
if ($rel_table || $rel_id || $rel_action)
{
$result = sql_query(" delete from $g4[point_table]
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from $g4[point_table] where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row[sum_po_point];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
$result = sql_query($sql);
}
return $result;
}
// 활동량 부여
function insert_active($mb_id, $active, $content='', $rel_table='', $rel_id='', $rel_action='')
{
global $config;
global $g4;
global $is_admin;
// 포인트 사용을 하지 않는다면 return
if (!$config[cf_use_point]) { return 0; }
// 포인트가 없다면 업데이트 할 필요 없음
if ($active == 0) { return 0; }
// 회원아이디가 없다면 업데이트 할 필요 없음
if ($mb_id == "") { return 0; }
$mb = sql_fetch(" select mb_id from $g4[member_table] where mb_id = '$mb_id' ");
if (!$mb[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$sql = " select count(*) as cnt from g4_active
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
return -1;
}
// 활동량 건별 생성
$sql = " insert into g4_active
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$active',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 활동량 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from g4_active where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_active = $row[sum_po_point];
// 활동량 UPDATE
$sql = " update $g4[member_table] set mb_2 = '$sum_active' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
// 활동량 삭제
function delete_active($mb_id, $rel_table, $rel_id, $rel_action)
{
global $g4;
$result = false;
if ($rel_table || $rel_id || $rel_action)
{
$result = sql_query(" delete from g4_active
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
// 활동량 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from g4_active where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_active = $row[sum_po_point];
// 활동량 UPDATE
$sql = " update $g4[member_table] set mb_2 = '$sum_active' where mb_id = '$mb_id' ";
$result = sql_query($sql);
}
return $result;
}
뭔가빼먹었는지 몇군데에서 차이가 나는군요;;
게시물을 삭제하면 포인트의 경우에는 포인트내역에서 삭제됩니다.
하지만 경험치의 경우에는 경험치내역에서 삭제되지 않고 추가로 "어떤글삭제" 라고 나옵니다.
많은 문제는 되지 않는대 데이터양이 많아지면 불편할것 같아서요
포인트기능중에 "어떤글삭제" 를 추가하지 않고 데이터를 삭제하는부분을
찾아주시면 감사하겠습니다.
ps. common.lip.php 의 해당부분 입니다.
딱히 활동량 삭제 부분에서 db 에 insert 하는 부분은 안보이는대 말이죠 ;;
삭제하는 부분은 보이는대 ㅠㅠ
// 포인트 부여
function insert_point($mb_id, $point, $content='', $rel_table='', $rel_id='', $rel_action='')
{
global $config;
global $g4;
global $is_admin;
// 포인트 사용을 하지 않는다면 return
if (!$config[cf_use_point]) { return 0; }
// 포인트가 없다면 업데이트 할 필요 없음
if ($point == 0) { return 0; }
// 회원아이디가 없다면 업데이트 할 필요 없음
if ($mb_id == "") { return 0; }
$mb = sql_fetch(" select mb_id from $g4[member_table] where mb_id = '$mb_id' ");
if (!$mb[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$sql = " select count(*) as cnt from $g4[point_table]
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
return -1;
}
// 포인트 건별 생성
$sql = " insert into $g4[point_table]
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$point',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from $g4[point_table] where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row[sum_po_point];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
// 포인트 삭제
function delete_point($mb_id, $rel_table, $rel_id, $rel_action)
{
global $g4;
$result = false;
if ($rel_table || $rel_id || $rel_action)
{
$result = sql_query(" delete from $g4[point_table]
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
// 포인트 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from $g4[point_table] where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_point = $row[sum_po_point];
// 포인트 UPDATE
$sql = " update $g4[member_table] set mb_point = '$sum_point' where mb_id = '$mb_id' ";
$result = sql_query($sql);
}
return $result;
}
// 활동량 부여
function insert_active($mb_id, $active, $content='', $rel_table='', $rel_id='', $rel_action='')
{
global $config;
global $g4;
global $is_admin;
// 포인트 사용을 하지 않는다면 return
if (!$config[cf_use_point]) { return 0; }
// 포인트가 없다면 업데이트 할 필요 없음
if ($active == 0) { return 0; }
// 회원아이디가 없다면 업데이트 할 필요 없음
if ($mb_id == "") { return 0; }
$mb = sql_fetch(" select mb_id from $g4[member_table] where mb_id = '$mb_id' ");
if (!$mb[mb_id]) { return 0; }
// 이미 등록된 내역이라면 건너뜀
if ($rel_table || $rel_id || $rel_action)
{
$sql = " select count(*) as cnt from g4_active
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ";
$row = sql_fetch($sql);
if ($row[cnt])
return -1;
}
// 활동량 건별 생성
$sql = " insert into g4_active
set mb_id = '$mb_id',
po_datetime = '$g4[time_ymdhis]',
po_content = '".addslashes($content)."',
po_point = '$active',
po_rel_table = '$rel_table',
po_rel_id = '$rel_id',
po_rel_action = '$rel_action' ";
sql_query($sql);
// 활동량 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from g4_active where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_active = $row[sum_po_point];
// 활동량 UPDATE
$sql = " update $g4[member_table] set mb_2 = '$sum_active' where mb_id = '$mb_id' ";
sql_query($sql);
return 1;
}
// 활동량 삭제
function delete_active($mb_id, $rel_table, $rel_id, $rel_action)
{
global $g4;
$result = false;
if ($rel_table || $rel_id || $rel_action)
{
$result = sql_query(" delete from g4_active
where mb_id = '$mb_id'
and po_rel_table = '$rel_table'
and po_rel_id = '$rel_id'
and po_rel_action = '$rel_action' ", false);
// 활동량 내역의 합을 구하고
$sql = " select sum(po_point) as sum_po_point from g4_active where mb_id = '$mb_id' ";
$row = sql_fetch($sql);
$sum_active = $row[sum_po_point];
// 활동량 UPDATE
$sql = " update $g4[member_table] set mb_2 = '$sum_active' where mb_id = '$mb_id' ";
$result = sql_query($sql);
}
return $result;
}
댓글 전체
해결했내요 -ㅅ- ;; 이런실수 ㅠㅠ
해결하셨으면 저한테 베스트답변을...