Changeset 20675
- Timestamp:
- 2011/03/17 11:06:22 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eccube-donation/html/mobile/frontparts/bloc/send_point.php
r20622 r20675 48 48 $this->tpl_disable_logout = false; 49 49 $this->tpl_error = ""; 50 $this->complete = false; 50 51 } 51 52 … … 56 57 */ 57 58 function process() { 59 if(!file_exists(DATA_PATH.'downloads/donation.csv')){ 60 $objQuery = new SC_Query; 61 $ret = $objQuery->getOne("SELECT php_path FROM dtb_bloc WHERE php_path = 'frontparts/bloc/send_point.php'"); 62 if(!$ret){ 63 $objQuery->query("INSERT INTO dtb_bloc (bloc_name,tpl_path,filename,create_date,update_date,php_path,del_flg) 64 VALUES('東北地方太平洋沖地震ポイント寄付','','send_point',NOW(),NOW(),'frontparts/bloc/send_point.php',0)"); 65 if(!file_exists(DATA_PATH.'downloads/donation_summary.csv') AND $fp = fopen(DATA_PATH.'downloads/donation_summary.csv','a+')){ 66 fwrite($fp,'0,0,0'); 67 fclose($fp); 68 } 69 } 70 } 71 72 58 73 59 74 $objCustomer = new SC_Customer(); … … 61 76 // クッキー管理クラス 62 77 $objCookie = new SC_Cookie(COOKIE_EXPIRE); 63 78 79 $limit = 0; 80 if($fp2 = fopen(DATA_PATH.'downloads/donation_summary.csv','a+')){ 81 flock($fp2,LOCK_EX); 82 $summary = file_get_contents(DATA_PATH.'downloads/donation_summary.csv'); 83 $summary = explode(",",$summary); 84 $total = intval($summary[1]); 85 $limit = intval($summary[2]); 86 if($limit != 0 and $total == $limit){ 87 $this->complete = true; 88 } 89 } 90 64 91 // ログイン判定 65 if($objCustomer->isLoginSuccess() ) {92 if($objCustomer->isLoginSuccess() and $this->complete == false ) { 66 93 $this->tpl_user_point = $objCustomer->getValue('point'); 67 94 if (strlen($this->tpl_user_point) == 0) $this->tpl_user_point = 0; … … 72 99 $this->tpl_error = "1以上のポイントを保有ポイント内で半角数字で入力してください。"; 73 100 }else{ 74 $objQuery = new SC_Query; 75 $sqlval = array('point' => ($this->tpl_user_point - $point)); 76 $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; 77 $rs = $objQuery->update('dtb_customer', $sqlval, $where, array($objCustomer->getValue('customer_id'))); 78 if($rs){ 79 $fp = fopen(DATA_PATH.'downloads/donation.csv','a+'); 80 fwrite($fp,date("Y-m-d G:i:s").",".$objCustomer->getValue('customer_id').",".$point."\n"); 81 $objCustomer->setValue("point", ($this->tpl_user_point - $point)); 82 $this->tpl_error = "ご協力ありがとうございます。".$point."ptを承りました。<br />寄付頂いたポイント分を、東北地方太平洋沖地震の復旧活動へ寄付いたします。"; 101 if(isset($summary) and $this->complete == false){ 102 if(($limit - $total) < $point){ 103 $point = $limit - $total; 104 $this->complete = true; 105 } 106 } 107 if($fp = fopen(DATA_PATH.'downloads/donation.csv','a+') and $point > 0){ 108 $objQuery = new SC_Query; 109 $sqlval = array('point' => ($this->tpl_user_point - $point)); 110 $where = 'customer_id = ? AND del_flg = 0 AND status = 2'; 111 $rs = $objQuery->update('dtb_customer', $sqlval, $where, array($objCustomer->getValue('customer_id'))); 112 if($rs){ 113 flock($fp,LOCK_EX); 114 fwrite($fp,date("Y-m-d G:i:s").",".$objCustomer->getValue('customer_id').",".$point."\n"); 115 $objCustomer->setValue("point", ($this->tpl_user_point - $point)); 116 $this->tpl_error = "ご協力ありがとうございます。".$point."ptを承りました。<br />寄付頂いたポイント分を、東北地方太平洋沖地震の復旧活動へ寄付いたします。"; 117 //サマリー更新 118 if(isset($summary)){ 119 $num = intval($summary[0]) + 1; 120 $total = $total+$point; 121 ftruncate($fp2,0); 122 fwrite($fp2,$num.','.$total.','.$limit); 123 }else{ 124 $this->tpl_error = "正常に寄付ポイントを集計出来ませんでした。サイト管理者へご連絡願います。"; 125 } 126 }else{ 127 $this->tpl_error = "正常に寄付ポイントを記録出来ませんでした。もう一度お願いします。"; 128 } 129 fclose($fp); 83 130 } else { 84 131 $this->tpl_error = "システムエラー"; … … 92 139 $this->tpl_name1 = $objCustomer->getValue('name01'); 93 140 $this->tpl_name2 = $objCustomer->getValue('name02'); 94 } else { 95 // クッキー判定 96 $this->tpl_login_email = $objCookie->getCookie('login_email'); 97 if($this->tpl_login_email != "") { 98 $this->tpl_login_memory = "1"; 99 } 100 101 // POSTされてきたIDがある場合は優先する。 102 if($_POST['login_email'] != "") { 103 $this->tpl_login_email = $_POST['login_email']; 104 } 105 } 141 } 142 143 if($fp2){ 144 fclose($fp2); 145 } 146 106 147 $this->transactionid = $this->getToken(); 107 148 } … … 126 167 <div id="sendPoint" style="border: none;background: #FFF6CF;text-align: center;overflow: auto;"> 127 168 <div id="innner" style="border: 3px solid red;margin:8px;"> 128 <p><font color="red">東北地方太平洋沖地震へのポイント寄付のお願い</font></p> 129 <?php if($objPage->tpl_login){?> 130 <p><font size="-2" color="#333">現在お客様が保有している当店のポイントを東北地方太平洋沖地震の復旧活動へ寄付出来ます。<br /> 131 下記フォームに寄付するポイント数を入力の上、「寄付」ボタンをクリックしてください。<br /> 132 運営担当者が寄付されたポイントを集計し、東北地方太平洋沖地震の復旧活動に寄付させて頂きます。<br /> 169 <?php if($objPage->complete === true){ ?> 170 <h2><font color="red" size="3">ご協力ありがとうございました</font></h2> 171 <p><font size="-2" color="#333">ポイントの東北地方太平洋沖地震の復旧活動への寄付ですが、皆様のご協力により目標ポイント数を達成する事が出来ました。</font></p> 172 <p><font size="-2" color="#333">寄付して頂いたポイント分の金額を、当店がお客様に代わり東北地方太平洋沖地震の復旧活動へ寄付させて頂きます。<br />多大なご協力ありがとうございました。<br /></font></p> 173 <p><font size="-2" color="#333">現金で赤十字に募金される場合は<a href="http://www.jrc.or.jp/contribution/l3/Vcms3_00002069.html" target="_blank" title="赤十字募金ページへ">コチラ</a>をご参照ください。</font></p> 174 <?php }else{ ?> 175 <h2><font color="red" size="3">東北地方太平洋沖地震へのポイント寄付のお願い</font></h2> 176 <?php if($objPage->tpl_login){?> 177 <p><font size="-2" color="#333">現在お客様が保有している当店のポイントを東北地方太平洋沖地震の復旧活動へ寄付出来ます。</font></p> 178 <p><font size="-2" color="#333">下記フォームに寄付するポイント数を入力の上、「寄付」ボタンをクリックしてください。</font></p> 179 <p><font size="-2" color="#333">運営担当者が寄付されたポイントを集計し、東北地方太平洋沖地震の復旧活動に寄付させて頂きます。</font></p> 133 180 <div id="sendForm"> 134 181 <p><font color="#FF0000"><?php echo $objPage->tpl_error; ?></font></p> … … 137 184 <p><font size="-2" color="#333">現在お客様が保有しているポイント:<?php echo $objPage->tpl_user_point ?>pt</font></p> 138 185 <p> 139 <font size="-2" color="#333"><input type="text" maxlength="10" name="sendpoint" id="sendpointValue" value="" size="5" istyle="4" />ptを寄付</font><br />186 <font size="-2" color="#333"><input type="text" maxlength="10" name="sendpoint" id="sendpointValue" value="" size="5" />ptを寄付<br /></font> 140 187 <input type="submit" value="寄付" /> 141 188 </p> 142 189 </form> 143 190 </div> 144 <?php }else{ ?> 145 <p><font size="-2" color="#333">会員のお客様は、現在お客様が保有している当店のポイントを東北地方太平洋沖地震の復旧活動へ寄付できます。ログインしてご協力をお願いします。<br /> 146 </font><font size="3">- <a href="./mypage/index.php?">ログイン</a> -<br /></font> 147 <font size="-2" color="#333">運営担当者が寄付されたポイントを集計し、東北地方太平洋沖地震の復旧活動へ寄付させて頂きます。</font></p> 191 <p><font size="-2" color="#333">直接現金で赤十字に募金される場合は<a href="http://www.jrc.or.jp/contribution/l3/Vcms3_00002069.html" target="_blank" title="赤十字募金ページへ">コチラ</a>をご参照ください。</font></p> 192 <?php }else{ ?> 193 <p><font size="-2" color="#333">会員のお客様は、現在お客様が保有している当店のポイントを東北地方太平洋沖地震の復旧活動へ寄付できます。ログインしてご協力をお願いします。</font></p> 194 <p><font size="3">- <a href="<?php echo URL_MYPAGE_TOP ?>">ログイン</a> -</font></p> 195 <p><font size="-2" color="#333">運営担当者が寄付されたポイントを集計し、東北地方太平洋沖地震の復旧活動へ寄付させて頂きます。</font></p> 196 <p><font size="-2" color="#333">直接現金で赤十字に募金される場合は<a href="http://www.jrc.or.jp/contribution/l3/Vcms3_00002069.html" target="_blank" title="赤十字募金ページへ">コチラ</a>をご参照ください。</font></p> 197 <?php } ?> 148 198 <?php } ?> 149 199 </div> 150 200 </div> 151
Note: See TracChangeset
for help on using the changeset viewer.