{$sticker->bought_count}

 

판매수 코드가 위와 같이 되어있는데 판매수가 전혀 올라가질 않고 있는데요 혹시 코드가 잘못된건가요?

  • profile
    function _increaseStickerBuyCount($sticker_srl){
    $args = new stdClass();
    $args->sticker_srl = $sticker_srl;
    $output = executeQuery('sticker.updateBoughtCount', $args);
    return !$output->toBool() ? FALSE : TRUE;
    }




    아래 쿼리가 문제인듯 한데요.. 저도 카운트가 안되서 제작자분께 문의 한 적이 있는데 특별한...
    아마 서버환경에 따라 저게 안먹히는 거 같습니다.
    저도 이것 좀 고칠 수 있으면 고쳐야 겠는데....

    <query id="updateBoughtCount" action="update">
    <tables>
    <table name="sticker" />
    </tables>
    <columns>
    <column name="bought_count" var="bought_count" default="plus(1)" />
    </columns>
    <conditions>
    <condition operation="equal" column="sticker_srl" var="sticker_srl" filter="number" notnull="notnull" />
    </conditions>
    </query>


    고수분께서 아마 답변을.....
  • profile profile
    웹지기님 코드를 어느부분을 수정하신걸까요?
  • profile
    원래 값을 불러온다음 해당 원래값에서 bought_count의 값을 +1 처리하면 왼만한 서버에서도 동작할거로보여지는..
  • profile profile
    지금 그렇게 고쳐볼까 생각중인긴 한데요. 다른 뭐리는 위에 코드로 해 놓았는데 잘 되는거 같더라구요.
  • profile profile
    지금 위 처리 방법이 문제가 있어 보이시나요?
  • profile profile
    function _increaseStickerBuyCount($sticker_srl){
    $args = new stdClass();
    $args->sticker_srl = $sticker_srl;
    $bought_count = executeQuery('sticker.getBougthCount',$args)->data->bought_count;
    $args->bought_count = $bought_count+1;
    $output = executeQuery('sticker.updateBoughtCount', $args);
    return !$output->toBool() ? FALSE : TRUE;
    }







    <query id="getBoughtCount" action="select">
    <tables>
    <table name="sticker" />
    </tables>
    <columns>
    <column name="bought_count" var="bought_count" />
    </columns>
    <conditions>
    <condition operation="equal" column="sticker_srl" var="sticker_srl" filter="number" notnull="notnull" />
    </conditions>
    </query>



    <query id="updateBoughtCount" action="update">
    <tables>
    <table name="sticker" />
    </tables>
    <columns>
    <column name="bought_count" var="bought_count" />
    </columns>
    <conditions>
    <condition operation="equal" column="sticker_srl" var="sticker_srl" filter="number" notnull="notnull" />
    </conditions>
    </query>




    이렇게 해 봤는데 잘 안되네요....
  • profile profile
    getBought 으로 호출하고
    <columns>
    <column name="bought_count" var="bought_count" />
    </columns>
    이부분을
    <columns>
    <column name="*" />
    </columns>

    이렇게 처리한다음 나머지는 그대로 유지하면 모든 데이터가 불러와져요.

    그러면 executeQuery('sticker.getBougth',$args) 에서 가져온 값을 이용해서
    $output->data->bought_count 를 가져올 수 있을꺼에요.

    만약 data가 없는 경우 update가 안되니 insert으로 처리해야하고요.
  • profile profile
    이것 저것 해 봐도 안도네요. data는 있는 상황이라 업데이트가 되어야 하는상황인데요..

    function _increaseStickerBuyCount($sticker_srl){
    $args = new stdClass();
    $args->sticker_srl = $sticker_srl;
    $output = executeQuery('sticker.getBougthCount',$args);
    $bought_count = $output->data->bought_count;
    $args = new stdClass();
    $args->sticker_srl = $sticker_srl;
    $args->bought_count = $bought_count+1;
    $output = executeQuery('sticker.updateBoughtCount', $args);
    return !$output->toBool() ? FALSE : TRUE;
    }





    <query id="getBoughtCount" action="select">
    <tables>
    <table name="sticker" />
    </tables>
    <columns>
    <column name="*" />
    </columns>
    <conditions>
    <condition operation="equal" column="sticker_srl" var="sticker_srl" filter="number" notnull="notnull" />
    </conditions>
    </query>






    <query id="updateBoughtCount" action="update">
    <tables>
    <table name="sticker" />
    </tables>
    <columns>
    <column name="bought_count" var="bought_count" />
    </columns>
    <conditions>
    <condition operation="equal" column="sticker_srl" var="sticker_srl" filter="number" notnull="notnull" />
    </conditions>
    </query>
  • profile profile
    직접 서버에서 디버그 찍어봐야 알 수 있을거같아요.
  • profile profile

    여기를 건드릴게 아닌거 같아요... ㅡㅡ;
    $checkBuyHistoryToday = $this->_checkBuyStickerToday($member_srl, $sticker_srl);
    if($sticker->member_srl != $member_srl && $checkBuyHistoryToday === 0){
    $this->_increaseStickerBuyCount($sticker_srl);
    }



    이런 코드가 보이네요..

    일단 원래대로 돌려 놓고 오늘은 포기하고 나중에 어디가 문제인지 다시 봐야 겠어요.
     

  • profile profile
    if($sticker->member_srl != $member_srl && $checkBuyHistoryToday === 0){
    $this->_increaseStickerBuyCount($sticker_srl);
    }

    저기서 && $checkBuyHistoryToday === 0 이걸 빼버리니 증가하네요.
    뭔지 모르지만 그냥 빼는거로 마무리요 ㅋ
  • profile profile
    checkBuyHistoryToday 함수가 없으면 아마...중복으로 계쏙 채크 올라가는 문제가 있을지도 몰라요..
  • profile
    저도 이것 저것 해보다가 지금 막 해본게요..

    controll.php 파일에

    320번줄 밑으로 보시면
    if($sticker->member_srl != $member_srl && $checkBuyHistoryToday === 0){
    $this->_increaseStickerBuyCount($sticker_srl);
    }

    여기서 && $checkBuyHistoryToday === 0 제거해 보세요. 저는 그것 제거하고 구매 즉시 올라가네요.
  • profile profile
    sticker.controller 이 파일 말씀하시는거죠?
  • profile profile
    전 그대로네요 ㅠㅠ 웹지기님 고생하셨습니다..
  • profile profile
    아 적용하고 나서부터 구매되는것만 적용이 되는군요...
  • profile profile
    이전에 구매 후 트리거에 의해 db에 카운트가 안되었기 때문에 당연히 이전 구매 이력은 카운트가 안됩니다. 관리자페이지에서 직접 올려주세요.