Changeset 18631 for branches/comu-ver2
- Timestamp:
- 2010/05/05 20:11:17 (14 years ago)
- Location:
- branches/comu-ver2/data
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/Smarty/templates/default/admin/mail/history.tpl
r18254 r18631 26 26 <input type="hidden" name="mode" value="" /> 27 27 <div id="mail" class="contents-main"> 28 <table class="list center"> 29 <tr> 30 <th>配信開始時刻</th> 31 <th>配信終了時刻</th> 32 <th>Subject</th> 33 <th>プレビュー</th> 34 <th>配信条件</th> 35 <th>配信予定件数</th> 36 <th>配信件数</th> 37 <th>削除</th> 38 </tr> 39 <!--{section name=cnt loop=$arrDataList}--> 40 <tr> 41 <td><!--{$arrDataList[cnt].start_date|sfDispDBDate|escape}--></td> 42 <td><!--{$arrDataList[cnt].end_date|sfDispDBDate|escape}--></td> 43 <td class="left"><!--{$arrDataList[cnt].subject|escape}--></td> 44 <td><a href="./preview.php?send_id=<!--{$arrDataList[cnt].send_id|escape}-->" target="_blank">確認</a></td> 45 <td><a href="#" onclick="win03('./<!--{$smarty.const.DIR_INDEX_URL}-->?mode=query&send_id=<!--{$arrDataList[cnt].send_id|escape}-->','query','720','420'); return false;">確認</a></td> 46 <td><!--{$arrDataList[cnt].send_count|escape}--></td> 47 <td><!--{$arrDataList[cnt].complete_count|escape}--></td> 48 <td><a href="<!--{$smarty.server.PHP_SELF|escape}-->?mode=delete&send_id=<!--{$arrDataList[cnt].send_id|escape}-->" onclick="return window.confirm('配信履歴を削除しても宜しいでしょうか');">削除</a></td> 49 </tr> 50 <!--{/section}--> 51 </table> 28 <table class="list center"> 29 <tr> 30 <th>配信開始時刻</th> 31 <th>配信終了時刻</th> 32 <th>Subject</th> 33 <th>プレビュー</th> 34 <th>配信条件</th> 35 <th>配信総数</th> 36 <th>配信済数</th> 37 <th>配信失敗数</th> 38 <th>未配信数</th> 39 <th>再試行</th> 40 <th>削除</th> 41 </tr> 42 <!--{section name=cnt loop=$arrDataList}--> 43 <tr> 44 <td><!--{$arrDataList[cnt].start_date|sfDispDBDate|escape}--></td> 45 <td><!--{$arrDataList[cnt].end_date|sfDispDBDate|escape}--></td> 46 <td class="left"><!--{$arrDataList[cnt].subject|escape}--></td> 47 <td><a href="./preview.php?send_id=<!--{$arrDataList[cnt].send_id|escape}-->" target="_blank">確認</a></td> 48 <td><a href="#" onclick="win03('./<!--{$smarty.const.DIR_INDEX_URL}-->?mode=query&send_id=<!--{$arrDataList[cnt].send_id|escape}-->','query','720','420'); return false;">確認</a></td> 49 <td><!--{$arrDataList[cnt].count_all|escape}--></td> 50 <td><!--{$arrDataList[cnt].count_sent|escape}--></td> 51 <td style="<!--{if $arrDataList[cnt].count_error >= 1}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->"> 52 <!--{$arrDataList[cnt].count_error|escape}--> 53 </td> 54 <td style="<!--{if $arrDataList[cnt].count_unsent >= 1}-->background-color: <!--{$smarty.const.ERR_COLOR}-->;<!--{/if}-->"> 55 <!--{$arrDataList[cnt].count_unsent|escape}--> 56 </td> 57 <td> 58 <!--{if $arrDataList[cnt].count_error >= 1 || $arrDataList[cnt].count_unsent >= 1}--> 59 <a href="sendmail.php?mode=now&send_id=<!--{$arrDataList[cnt].send_id|escape}-->&retry=yes" onclick="return window.confirm('未配信と配信失敗となった宛先に再送信を試みますか?');">実行</a> 60 <!--{/if}--> 61 </td> 62 <td><a href="?mode=delete&send_id=<!--{$arrDataList[cnt].send_id|escape}-->" onclick="return window.confirm('配信履歴を削除しても宜しいでしょうか');">削除</a></td> 63 </tr> 64 <!--{/section}--> 65 </table> 52 66 </div> 53 67 </form> -
branches/comu-ver2/data/class/pages/admin/mail/LC_Page_Admin_Mail.php
r18630 r18631 66 66 $this->arrMagazineTypeAll = $masterData->getMasterData("mtb_magazine_type"); 67 67 68 // ----検索用項目配列68 // 検索用項目配列 69 69 $this->arrHtmlmail = array( "" => "両方", 1 => "HTML", 2 => "TEXT" ); 70 70 71 71 72 // ----配列内容専用項目の配列72 // 配列内容専用項目の配列 73 73 $this->arrRegistColumn = array( 74 74 array( "column" => "template_id", "convert" => "n" ), … … 83 83 ); 84 84 85 // ----メルマガ会員種別85 // メルマガ会員種別 86 86 $this->arrCustomerType = array(1 => "会員", 87 87 2 => "非会員", 88 // 3 => "CSV登録"88 // 3 => "CSV登録" 89 89 ); 90 90 91 // ----検索項目91 // 検索項目 92 92 $this->arrSearchColumn = array( 93 93 array( "column" => "name", "convert" => "aKV"), … … 149 149 function process() { 150 150 151 // ----ページ初期設定151 // ページ初期設定 152 152 $conn = new SC_DBConn(); 153 153 $objView = new SC_AdminView(); … … 221 221 case 'search': 222 222 case 'back': 223 // --入力値コンバート223 // 入力値コンバート 224 224 $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); 225 225 226 // --入力エラーのチェック226 // 入力エラーのチェック 227 227 $this->arrErr = $this->lfErrorCheck($this->list_data); 228 228 229 // --検索開始229 // 検索開始 230 230 if (empty($this->arrErr)) { 231 231 $this->list_data['name'] = isset($this->list_data['name']) … … 234 234 $this->arrHidden = $this->lfGetHidden($this->list_data); 235 235 236 // --検索データ取得236 // 検索データ取得 237 237 $objSelect = new SC_CustomerList($this->list_data, "magazine"); 238 238 // 生成されたWHERE文を取得する … … 262 262 $col = $objSelect->getMailMagazineColumn($this->lfGetIsMobile($_POST['mail_type'])); 263 263 $this->arrResults = $objQuery->select($col, $from, $where, $arrval); 264 // 現在時刻の取得264 // 現在時刻の取得 265 265 $this->arrNowDate = $this->lfGetNowDate(); 266 266 } … … 270 270 */ 271 271 case 'input': 272 // --入力値コンバート272 // 入力値コンバート 273 273 $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); 274 // --入力エラーのチェック274 // 入力エラーのチェック 275 275 $this->arrErr = $this->lfErrorCheck($this->list_data); 276 // --エラーなし276 // エラーなし 277 277 if (empty($this->arrErr)) { 278 // --現在時刻の取得278 // 現在時刻の取得 279 279 $this->arrNowDate = $this->lfGetNowDate(); 280 280 $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成 … … 286 286 */ 287 287 case 'template': 288 // --入力値コンバート288 // 入力値コンバート 289 289 $this->list_data = $this->lfConvertParam($_POST, $this->arrSearchColumn); 290 290 291 // --時刻設定の取得291 // 時刻設定の取得 292 292 $this->arrNowDate['year'] = isset($_POST['send_year']) ? $_POST['send_year'] : ""; 293 293 $this->arrNowDate['month'] = isset($_POST['send_month']) ? $_POST['send_month'] : ""; … … 296 296 $this->arrNowDate['minutes'] = isset($_POST['send_minutes']) ? $_POST['send_minutes'] : ""; 297 297 298 // --入力エラーのチェック298 // 入力エラーのチェック 299 299 $this->arrErr = $this->lfErrorCheck($this->list_data); 300 300 301 // --検索開始301 // 検索開始 302 302 if (empty($this->arrErr)) { 303 303 $this->list_data['name'] = isset($this->list_data['name']) ? SC_Utils_Ex::sfManualEscape($this->list_data['name']) : ""; … … 312 312 } 313 313 314 // --HTMLテンプレートを使用する場合は、HTMLソースを生成してBODYへ挿入314 // HTMLテンプレートを使用する場合は、HTMLソースを生成してBODYへ挿入 315 315 if ( $this->list_data["mail_method"] == 3) { 316 316 $objTemplate = new LC_HTMLtemplate; … … 318 318 $objSiteInfo = new SC_SiteInfo(); 319 319 $objTemplate->arrInfo = $objSiteInfo->data; 320 // メール担当写真の表示320 // メール担当写真の表示 321 321 $objUpFile = new SC_UploadFile(IMAGE_TEMP_URL, IMAGE_SAVE_URL); 322 322 $objUpFile->addFile("メール担当写真", 'charge_image', array('jpg'), IMAGE_SIZE, true, SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT); … … 337 337 case 'regist_back': 338 338 case 'regist_complete': 339 // --入力値コンバート339 // 入力値コンバート 340 340 $this->arrCheckColumn = array_merge( $this->arrSearchColumn, $this->arrRegistColumn ); 341 341 $this->list_data = $this->lfConvertParam($_POST, $this->arrCheckColumn); 342 342 343 // 現在時刻の取得343 // 現在時刻の取得 344 344 $this->arrNowDate = $this->lfGetNowDate(); 345 345 346 // --入力エラーのチェック346 // 入力エラーのチェック 347 347 $this->arrErr = $this->lfErrorCheck($this->list_data, 1); 348 348 $this->tpl_mainpage = 'mail/input.tpl'; 349 349 $this->arrHidden = $this->lfGetHidden($this->list_data); // hidden要素作成 350 350 351 // --検索開始351 // 検索開始 352 352 if (empty($this->arrErr)) { 353 353 $this->list_data['name'] = … … 358 358 $this->tpl_mainpage = 'mail/input_confirm.tpl'; 359 359 } else if( $_POST['mode'] == 'regist_complete' ){ 360 $ this->lfRegistData($conn, $this->list_data);361 if (MELMAGA_SEND == true) {362 if (MELMAGA_BATCH_MODE) {363 $this->sendRedirect($this->getLocation(URL_DIR . "admin/mail/history.php"));360 $sendId = $this->lfRegistData($conn, $this->list_data); 361 if (MELMAGA_SEND) { 362 if (MELMAGA_BATCH_MODE) { 363 $this->sendRedirect($this->getLocation(URL_DIR . 'admin/mail/history.php')); 364 364 } else { 365 $this->sendRedirect($this->getLocation(URL_DIR . "admin/mail/sendmail.php", array("mode" => "now")));365 $this->sendRedirect($this->getLocation(URL_DIR . 'admin/mail/sendmail.php', array('mode' => 'now', 'send_id' => $sendId))); 366 366 } 367 367 exit; … … 389 389 $this->arrCampaignList = $this->lfGetCampaignList($objQuery); 390 390 391 // ----ページ表示391 // ページ表示 392 392 $objView->assignobj($this); 393 393 $objView->display(MAIN_FRAME); … … 421 421 } 422 422 423 // 現在時刻の取得(配信時間デフォルト値)423 // 現在時刻の取得(配信時間デフォルト値) 424 424 function lfGetNowDate(){ 425 425 $nowdate = date("Y/n/j/G/i"); … … 451 451 } 452 452 453 // 配信内容と配信リストを書き込む 453 /** 454 * 配信内容と配信リストを書き込む 455 * 456 * @return string 登録した行の dtb_send_history.send_id の値 457 */ 454 458 function lfRegistData(&$conn, $arrData){ 455 459 … … 461 465 462 466 $dtb_send_history = array(); 463 if(DB_TYPE=='pgsql'){464 $dtb_send_history["send_id"] = $objQuery->nextval('dtb_send_history', 'send_id');465 }466 467 $dtb_send_history["mail_method"] = $arrData['mail_method']; 467 468 $dtb_send_history["subject"] = $arrData['subject']; … … 479 480 $dtb_send_history["create_date"] = "now()"; 480 481 $objQuery->insert("dtb_send_history", $dtb_send_history ); 481 if(DB_TYPE == "mysql"){ 482 $dtb_send_history["send_id"] = $objQuery->nextval('dtb_send_history','send_id');483 } 482 483 $sendId = $objQuery->currval('dtb_send_history', 'send_id'); 484 484 485 if ( is_array( $search_data ) ){ 485 486 foreach( $search_data as $line ){ 486 487 $dtb_send_customer = array(); 487 488 $dtb_send_customer["customer_id"] = $line["customer_id"]; 488 $dtb_send_customer["send_id"] = $ dtb_send_history["send_id"];489 $dtb_send_customer["send_id"] = $sendId; 489 490 $dtb_send_customer["email"] = $line["email"]; 490 491 491 $dtb_send_customer["name"] = $line["name01"] . " " . $line["name02"]; 492 493 492 $conn->autoExecute("dtb_send_customer", $dtb_send_customer ); 494 493 } 495 494 } 495 496 return $sendId; 496 497 } 497 498 … … 528 529 529 530 530 // ----HTMLテンプレートを使用する場合、データを取得する。531 // HTMLテンプレートを使用する場合、データを取得する。 531 532 function lfGetHtmlTemplateData($id) { 532 533 … … 559 560 $result = $conn->getAll($sql, array($list_data["sub_product_id" .$j])); 560 561 $list_data["sub"][$k][$l] = $result[0]; 561 $list_data["sub"][$k]["data_exists"] = "OK"; // 当該段にデータが1つ以上存在するフラグ562 $list_data["sub"][$k]["data_exists"] = "OK"; // 当該段にデータが1つ以上存在するフラグ 562 563 } 563 564 $l ++; … … 566 567 } 567 568 568 // ---テンプレートの種類を返す569 // テンプレートの種類を返す 569 570 function lfGetTemplateMethod($conn, $templata_id){ 570 571 … … 574 575 } 575 576 576 // ---hidden要素出力用配列の作成577 // hidden要素出力用配列の作成 577 578 function lfGetHidden( $array ){ 578 579 if ( is_array($array) ){ … … 590 591 } 591 592 592 // ----取得文字列の変換593 // 取得文字列の変換 593 594 function lfConvertParam($array, $arrSearchColumn) { 594 595 … … 612 613 613 614 614 // ----入力エラーチェック615 // 入力エラーチェック 615 616 function lfErrorCheck($array, $flag = '') { 616 617 … … 658 659 $objErr->doFunc(array("キャンペーン", "campaign_id", INT_LEN), array("NUM_CHECK")); 659 660 660 // 購入金額(from) > 購入金額(to) の場合はエラーとする661 // 購入金額(from) > 購入金額(to) の場合はエラーとする 661 662 if ( (is_numeric($array["buy_total_from"]) && is_numeric($array["buy_total_to"]) ) && 662 663 ($array["buy_total_from"] > $array["buy_total_to"]) ) { … … 689 690 $sql = "SELECT template_id, subject, mail_method FROM dtb_mailmaga_template WHERE del_flg = 0 "; 690 691 if ($_POST["htmlmail"] == 2 || $_POST['mail_type'] == 2) { 691 $sql .= " AND mail_method = 2 "; // TEXT希望者へのTESTメールテンプレートリスト692 $sql .= " AND mail_method = 2 "; // TEXT希望者へのTESTメールテンプレートリスト 692 693 } 693 694 $sql .= " ORDER BY template_id DESC"; -
branches/comu-ver2/data/class/pages/admin/mail/LC_Page_Admin_Mail_History.php
r18234 r18631 58 58 */ 59 59 function process() { 60 // ----ページ初期設定60 // ページ初期設定 61 61 $conn = new SC_DBConn(); 62 62 $objView = new SC_AdminView(); … … 72 72 73 73 // 削除時 74 if (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) && ($_GET['mode']=='delete') ){74 if (SC_Utils_Ex::sfCheckNumLength($_GET['send_id']) && ($_GET['mode']=='delete')) { 75 75 76 76 $sql = "UPDATE dtb_send_history SET del_flg = 1 WHERE send_id = ?"; … … 79 79 $this->reload(); 80 80 } 81 $col = "*";82 81 $from = "dtb_send_history"; 83 82 … … 102 101 $objQuery->setorder($order); 103 102 103 $col = "*"; 104 $col .= ",(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id) AS count_all"; 105 $col .= ",(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id AND send_flag = 1) AS count_sent"; 106 $col .= ",(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id AND send_flag = 2) AS count_error"; 107 $col .= ",(SELECT COUNT(*) FROM dtb_send_customer WHERE dtb_send_customer.send_id = dtb_send_history.send_id AND send_flag IS NULL) AS count_unsent"; 108 104 109 // 検索結果の取得 105 110 $this->arrDataList = $objQuery->select($col, $from, $where, $arrval); 106 111 107 // ----ページ表示112 // ページ表示 108 113 $objView->assignobj($this); 109 114 $objView->display(MAIN_FRAME); -
branches/comu-ver2/data/class/pages/admin/mail/LC_Page_Admin_Mail_Sendmail.php
r18284 r18631 34 34 class LC_Page_Admin_Mail_Sendmail extends LC_Page { 35 35 36 36 var $objMail; 37 37 // }}} 38 38 // {{{ functions … … 44 44 */ 45 45 function init() { 46 47 if(file_exists(MODULE_PATH . "mdl_speedmail/SC_SpeedMail.php")) {48 49 50 51 52 53 54 46 // SC_SendMailの拡張 47 if (file_exists(MODULE_PATH . "mdl_speedmail/SC_SpeedMail.php")) { 48 require_once(MODULE_PATH . "mdl_speedmail/SC_SpeedMail.php"); 49 // SpeedMail対応 50 $this->objMail = new SC_SpeedMail(); 51 } else { 52 $this->objMail = new SC_SendMail_Ex(); 53 } 54 55 55 parent::init(); 56 56 } … … 63 63 function process() { 64 64 $conn = new SC_DbConn(); 65 $objQuery = new SC_Query(); 65 66 $objSite = new SC_SiteInfo($conn); 66 67 67 if (MELMAGA_SEND != true) {68 if (MELMAGA_SEND != true) { 68 69 exit; 69 70 } 70 71 71 //リアルタイム配信モードがオンのとき 72 if($_GET['mode'] == 'now') { 73 //---- 未送信データを取得する 74 $time_data = $conn->getAll( "SELECT send_id FROM dtb_send_history WHERE complete_count = 0 AND del_flg = 0 AND end_date IS NULL ORDER BY send_id ASC, start_date ASC" ); 72 $where = 'del_flg = 0'; 73 $sqlval = array(); 74 // リアルタイム配信モードがオンのとき 75 if ($_GET['mode'] == 'now') { 76 // 指定データを取得する 77 $where .= ' AND send_id = ?'; 78 $sqlval[] = $_GET['send_id']; 79 if ($_GET['retry'] != 'yes') { 80 $where .= ' AND complete_count = 0 AND end_date IS NULL'; 81 } 75 82 } else { 83 $where .= ' AND end_date IS NULL'; 76 84 // postgresql と mysql とでSQLをわける 77 85 if (DB_TYPE == "pgsql") { 78 $sql = "SELECT send_id FROM dtb_send_history "; 79 $sql.= "WHERE start_date BETWEEN current_timestamp + '- 5 minutes' AND current_timestamp + '5 minutes' AND del_flg = 0 AND end_date IS NULL ORDER BY send_id ASC, start_date ASC"; 80 }else if (DB_TYPE == "mysql") { 81 $sql = "SELECT send_id FROM dtb_send_history "; 82 $sql.= "WHERE start_date BETWEEN date_add(now(),INTERVAL -5 minute) AND date_add(now(),INTERVAL 5 minute) AND del_flg = 0 AND end_date IS NULL ORDER BY send_id ASC, start_date ASC"; 86 $where .= "start_date BETWEEN current_timestamp + '- 5 minutes' AND current_timestamp + '5 minutes'"; 87 } else if (DB_TYPE == "mysql") { 88 $where .= "start_date BETWEEN date_add(now(),INTERVAL -5 minute) AND date_add(now(),INTERVAL 5 minute)"; 83 89 } 84 //---- 30分毎にCronが送信時間データ確認 85 $time_data = $conn->getAll($sql); 90 // 30分毎にCronが送信時間データ確認 86 91 } 92 $objQuery->setorder('send_id'); 93 $arrMailList = $objQuery->select('*', 'dtb_send_history', $where, $sqlval); 94 $objQuery->setorder(''); 87 95 88 //未送信メルマガの数 89 $count = count($time_data); 90 91 //未送信メルマガがあれば送信処理を続ける。なければ中断する。 92 if( $count > 0 ){ 93 print("start sending <br />\n"); 94 } else { 95 print("not found <br />\n"); 96 // 未送信メルマガがあれば送信処理を続ける。なければ中断する。 97 if (empty($arrMailList)) { 98 echo "not found\n"; 96 99 exit; 97 100 } 98 101 99 //---- メール送信準備 100 for( $i = 0; $i < $count; $i++ ) { 102 echo "start sending\n"; 103 104 // メール生成と送信 105 foreach ($arrMailList as $arrMail) { 106 $sendFlag = null; 107 101 108 // 送信先リストの取得 102 $ sql = "SELECT * FROM dtb_send_customer WHERE send_id = ? AND (send_flag = 2 OR send_flag IS NULL)";103 $list_data[] = $conn->getAll( $sql, array( $time_data[$i]["send_id"] ) );104 // 送信先データの取得105 $sql = "SELECT * FROM dtb_send_history WHERE send_id = ?";106 $mail_data[] = $conn->getAll( $sql, array( $time_data[$i]["send_id"] ) );107 }109 $arrDestinationList = $objQuery->select( 110 '*', 111 'dtb_send_customer', 112 'send_id = ? AND (send_flag = 2 OR send_flag IS NULL)', 113 array($arrMail["send_id"]) 114 ); 108 115 109 //---- 送信結果フラグ用SQL 110 $sql_flag ="UPDATE dtb_send_customer SET send_flag = ? WHERE send_id = ? AND customer_id = ?"; 116 foreach ($arrDestinationList as $arrDestination) { 111 117 112 //---- メール生成と送信 113 for( $i = 0; $i < $count; $i++ ) { 114 for( $j = 0; $j < count( $list_data[$i] ); $j ++ ) { 115 $customerName = ""; 116 $mailBody = ""; 117 $sendFlag = ""; 118 119 //-- 顧客名の変換 120 $name = trim($list_data[$i][$j]["name"]); 118 // 顧客名の変換 119 $name = trim($arrDestination["name"]); 121 120 122 121 if ($name == "") { … … 125 124 126 125 $customerName = htmlspecialchars($name); 127 $subjectBody = ereg_replace( "{name}", $customerName , $mail_data[$i][0]["subject"]);128 $mailBody = ereg_replace( "{name}", $customerName , $mail_data[$i][0]["body"]);126 $subjectBody = ereg_replace("{name}", $customerName, $arrMail["subject"]); 127 $mailBody = ereg_replace("{name}", $customerName, $arrMail["body"]); 129 128 130 129 $this->objMail->setItem( 131 $list_data[$i][$j]["email"]132 ,$subjectBody133 ,$mailBody134 ,$objSite->data["email03"] //送信元メールアドレス135 ,$objSite->data["shop_name"] //送信元名136 ,$objSite->data["email03"] //reply_to137 ,$objSite->data["email04"] //return_path138 ,$objSite->data["email04"] //errors_to139 130 $arrDestination["email"], 131 $subjectBody, 132 $mailBody, 133 $objSite->data["email03"], // 送信元メールアドレス 134 $objSite->data["shop_name"], // 送信元名 135 $objSite->data["email03"], // reply_to 136 $objSite->data["email04"], // return_path 137 $objSite->data["email04"] // errors_to 138 ); 140 139 141 // --テキストメール配信の場合142 if ( $mail_data[$i][0]["mail_method"] == 2) {140 // テキストメール配信の場合 141 if ($arrMail["mail_method"] == 2) { 143 142 $sendResut = $this->objMail->sendMail(); 144 // --HTMLメール配信の場合143 // HTMLメール配信の場合 145 144 } else { 146 145 $sendResut = $this->objMail->sendHtmlMail(); 147 146 } 148 147 149 // -- 送信完了なら1、失敗なら-1をメール送信結果フラグとしてDBに挿入150 if ( ! $sendResut ){151 $sendFlag = "-1";148 // 送信完了なら1、失敗なら2をメール送信結果フラグとしてDBに挿入 149 if (!$sendResut) { 150 $sendFlag = '2'; 152 151 } else { 153 $sendFlag = "1";152 $sendFlag = '1'; 154 153 155 154 // 完了を 1 増やす 156 155 $sql = "UPDATE dtb_send_history SET complete_count = complete_count + 1 WHERE send_id = ?"; 157 $conn->query( $sql, array($mail_data[$i][0]["send_id"]));156 $conn->query($sql, array($arrMail["send_id"])); 158 157 } 159 $conn->query( $sql_flag, array( $sendFlag, $mail_data[$i][0]["send_id"], $list_data[$i][$j]["customer_id"] ) ); 158 159 // 送信結果フラグ 160 $sql ="UPDATE dtb_send_customer SET send_flag = ? WHERE send_id = ? AND customer_id = ?"; 161 $conn->query($sql, array($sendFlag, $arrMail["send_id"], $arrDestination["customer_id"])); 160 162 } 161 163 162 // ---メール全件送信完了後の処理164 // メール全件送信完了後の処理 163 165 $completeSql = "UPDATE dtb_send_history SET end_date = now() WHERE send_id = ?"; 164 $conn->query( $completeSql, array( $time_data[$i]["send_id"] ));166 $conn->query($completeSql, array($arrMail["send_id"])); 165 167 166 // ---送信完了 報告メール167 $compSubject = date("Y年m月d日H時i分" . " 下記メールの配信が完了しました。" );168 // 送信完了 報告メール 169 $compSubject = date("Y年m月d日H時i分") . " 下記メールの配信が完了しました。"; 168 170 // 管理者宛に変更 169 171 $this->objMail->setTo($objSite->data["email03"]); 170 172 $this->objMail->setSubject($compSubject); 171 173 172 // --テキストメール配信の場合173 if ( $mail_data[$i][0]["mail_method"] == 2 ) {174 // テキストメール配信の場合 175 if ($arrMail["mail_method"] == 2 ) { 174 176 $sendResut = $this->objMail->sendMail(); 175 // --HTMLメール配信の場合177 // HTMLメール配信の場合 176 178 } else { 177 179 $sendResut = $this->objMail->sendHtmlMail(); 178 180 } 179 181 } 180 if ($_GET['mode'] = "now") {181 header("Location: " . URL_DIR . "admin/mail/history.php");182 if ($_GET['mode'] == 'now') { 183 $this->sendRedirect($this->getLocation(URL_DIR . 'admin/mail/history.php')); 182 184 } 183 185 echo "complete\n";
Note: See TracChangeset
for help on using the changeset viewer.