Changeset 20140


Ignore:
Timestamp:
2011/02/11 18:57:18 (15 years ago)
Author:
kimoto
Message:

退会手続きリファクタリング #981

Location:
branches/version-2_5-dev/data
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_5-dev/data/Smarty/templates/default/mypage/refusal_confirm.tpl

    r20116 r20140  
    2828  <form name="form1" method="post" action="?"> 
    2929  <input type="hidden" name="mode" value="complete" /> 
    30   <input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->" /> 
     30  <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
     31 
    3132  <div id="mycontentsarea"> 
    3233    <h3><!--{$tpl_subtitle|h}--></h3> 
  • branches/version-2_5-dev/data/Smarty/templates/mobile/mypage/refusal.tpl

    r20116 r20140  
    2727<form action="?" method="post"> 
    2828    <input type="hidden" name="mode" value="complete"> 
     29    <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
     30     
    2931    <input type="submit" name="complete" value="退会する"> 
    3032</form> 
  • branches/version-2_5-dev/data/Smarty/templates/sphone/mypage/refusal_confirm.tpl

    r20116 r20140  
    2828  <form name="form1" method="post" action="?"> 
    2929  <input type="hidden" name="mode" value="complete" /> 
    30   <input type="hidden" name="uniqid" value="<!--{$tpl_uniqid}-->" /> 
     30  <input type="hidden" name="<!--{$smarty.const.TRANSACTION_ID_NAME}-->" value="<!--{$transactionid}-->" /> 
    3131  <div id="mycontentsarea"> 
    3232    <h3><!--{$tpl_subtitle|h}--></h3> 
  • branches/version-2_5-dev/data/class/pages/mypage/LC_Page_Mypage_Refusal.php

    r20116 r20140  
    2323 
    2424// {{{ requires 
    25 require_once(CLASS_REALDIR . "pages/LC_Page.php"); 
     25require_once(CLASS_REALDIR . "pages/mypage/LC_Page_AbstractMypage.php"); 
    2626 
    2727/** 
     
    3232 * @version $Id$ 
    3333 */ 
    34 class LC_Page_Mypage_Refusal extends LC_Page { 
     34class LC_Page_Mypage_Refusal extends LC_Page_AbstractMypage { 
    3535 
    3636    // }}} 
     
    4444    function init() { 
    4545        parent::init(); 
    46         $this->tpl_title = 'MYページ'; 
     46        $this->tpl_title    = 'MYページ'; 
    4747        $this->tpl_subtitle = '退会手続き(入力ページ)'; 
    48         $this->tpl_navi = TEMPLATE_REALDIR . 'mypage/navi.tpl'; 
    49         $this->tpl_mainno = 'mypage'; 
     48        $this->tpl_navi     = TEMPLATE_REALDIR . 'mypage/navi.tpl'; 
     49        $this->tpl_mainno   = 'mypage'; 
    5050        $this->tpl_mypageno = 'refusal'; 
    5151    } 
     
    5858    function process() { 
    5959        parent::process(); 
    60         $this->action(); 
    61         $this->sendResponse(); 
    6260    } 
    6361 
     
    6866     */ 
    6967    function action() { 
    70         $objCustomer = new SC_Customer(); 
    71         $objSiteSess = new SC_SiteSession(); 
    72  
    73         // 退会判定用情報の取得 
    74         $this->tpl_login = $objCustomer->isLoginSuccess(true); 
    75  
    76         $this->lfCheckLogin(); 
    7768 
    7869        switch ($this->getMode()){ 
    7970        case 'confirm': 
    80  
    81             $this->tpl_mainpage = TEMPLATE_REALDIR . 'mypage/refusal_confirm.tpl'; 
    82             $this->tpl_subtitle = '退会手続き(確認ページ)'; 
    83  
    84             // 確認ページを経由したことを登録 
    85             $objSiteSess->setRegistFlag(); 
    86             // hiddenにuniqidを埋め込む 
    87             $this->tpl_uniqid = $objSiteSess->getUniqId(); 
    88  
     71            $this->tpl_mainpage     = TEMPLATE_REALDIR . 'mypage/refusal_confirm.tpl'; 
     72            $this->tpl_subtitle     = '退会手続き(確認ページ)'; 
    8973            break; 
    9074 
    9175        case 'complete': 
    92             // 正しい遷移かどうかをチェック 
    93             $this->lfIsValidMovement($objSiteSess); 
    94             $this->lfDeleteCustomer();    //会員削除 
     76            if (!SC_Helper_Session_Ex::isValidToken()) { 
     77                SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true); 
     78            } 
     79 
     80            $objCustomer = new SC_Customer(); 
     81            $this->lfDeleteCustomer($objCustomer->getValue('customer_id')); 
     82            $objCustomer->EndSession(); 
     83            SC_Response_Ex::sendRedirect('refusal_complete.php'); 
    9584        } 
    96  
     85        // mobileは確認画面がない 
     86        $this->transactionid    = SC_Helper_Session_Ex::getToken(); 
    9787    } 
    9888 
     
    10696    } 
    10797 
    108     // 正しい遷移かどうかをチェック 
    109     function lfIsValidMovement(&$objSiteSess) { 
    110         // uniqid がPOSTされているかをチェック 
    111         $uniqid = $objSiteSess->getUniqId(); 
    112         if ($objSiteSess->isPrePage() || !empty($_POST['uniqid']) && ($_POST['uniqid'] === $uniqid) ) { 
    113             return; 
    114         } else { 
    115             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSess); 
    116         } 
    117     } 
    11898 
    119     function lfCheckLogin(){ 
    120         $objCustomer = new SC_Customer(); 
    121         //ログイン判定 
    122         if (!$objCustomer->isLoginSuccess(true)){ 
    123             SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 
    124         }else { 
    125             //マイページトップ顧客情報表示用 
    126             $this->CustomerName1 = $objCustomer->getvalue('name01'); 
    127             $this->CustomerName2 = $objCustomer->getvalue('name02'); 
    128             $this->CustomerPoint = $objCustomer->getvalue('point'); 
    129         } 
    130     } 
     99    /** 
     100     * 会員情報を削除する 
     101     * 
     102     * @access private 
     103     * @return void 
     104     */ 
     105    function lfDeleteCustomer($customer_id){ 
     106        $objQuery       = SC_Query::getSingletonInstance(); 
    131107 
    132     function lfDeleteCustomer(){ 
    133         $objQuery = new SC_Query(); 
    134         $objCustomer = new SC_Customer(); 
    135         //会員削除 
    136         $objQuery->exec("UPDATE dtb_customer SET del_flg=1, update_date=now() WHERE customer_id=?", array($objCustomer->getValue('customer_id'))); 
    137  
    138         $objCustomer->EndSession(); 
    139         //完了ページへ 
    140         SC_Response_Ex::sendRedirect('refusal_complete.php'); 
    141         exit; 
     108        $sqlval['del_flg']      = 1; 
     109        $sqlval['update_date']  = 'now()'; 
     110        $where                  = 'customer_id = ?'; 
     111        $objQuery->update('dtb_customer', $sqlval, $where, array($customer_id)); 
    142112    } 
    143113 
    144114} 
    145 ?> 
Note: See TracChangeset for help on using the changeset viewer.