/** * テスト用 会員データ を生成する. * * @return void */ function createCustomers() { lfPrintLog("createCustomers START.(" . CUSTOMERS_VOLUME . " data)"); for ($i = 0; $i < CUSTOMERS_VOLUME; $i++) { lfPrintLog("----------"); lfPrintLog("creating customer data count:[" . ($i + 1) . "] start."); $sqlval['name01'] = "検証"; $sqlval['name02'] = sprintf("太郎%05d", $i + 1); $sqlval['kana01'] = "ケンショウ"; $sqlval['kana02'] = "タロウ"; $sqlval['zip01'] = '101'; $sqlval['zip02'] = '0051'; $sqlval['pref'] = '13'; // 13:東京都 $sqlval['addr01'] = "千代田区神田神保町"; $sqlval['addr02'] = "1-3-5"; $sqlval['tel01'] = '012'; $sqlval['tel02'] = '3456'; $sqlval['tel03'] = '7890'; $sqlval['email'] = EMAIL_ADDRESS_ACCOUNT . "+" . sprintf("%05d", $i + 1) . EMAIL_ADDRESS_DOMAIN; $sqlval['sex'] = '1'; // 1:男性 2:女性 $sqlval['password'] = '******'; $sqlval['reminder'] = '1'; // 1:「母親の旧姓は?」 $sqlval['reminder_answer'] = "てすと"; $sqlval['mailmaga_flg'] = (string) '1'; // 1:HTMLメール 2:テキストメール 3:希望しない // 生年月日の作成 $sqlval['birth'] = SC_Utils_Ex::sfGetTimestamp(2006, 9, 1); // 仮会員 1 本会員 2 $sqlval['status'] = '2'; /* * secret_keyは、テーブルで重複許可されていない場合があるので、 * 本会員登録では利用されないがセットしておく。 */ $sqlval['secret_key'] = SC_Helper_Customer_Ex::sfGetUniqSecretKey(); // 入会時ポイント $CONF = SC_Helper_DB_Ex::sfGetBasisData(); $sqlval['point'] = $CONF['welcome_point']; // 会員データの生成 SC_Helper_Customer_Ex::sfEditCustomerData($sqlval); print "*"; lfPrintLog("creating customer data count:[" . ($i + 1) . "] end."); } print "\n"; lfPrintLog("createCustomers DONE.(" . CUSTOMERS_VOLUME . " data created)"); }
/** * 会員を削除する処理 * * @param integer $customer_id 会員ID * @return boolean true:成功 false:失敗 */ public static function delete($customer_id) { $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id, 'del_flg = 0'); if (SC_Utils_Ex::isBlank($arrData)) { //対象となるデータが見つからない。 return false; } // XXXX: 仮会員は物理削除となっていたが論理削除に変更。 $arrVal = array('del_flg' => '1'); SC_Helper_Customer_Ex::sfEditCustomerData($arrVal, $customer_id); return true; }
/** * 登録処理 * * @param array $objFormParam フォームパラメータークラス * @return array エラー配列 */ public function lfRegistData(&$objFormParam) { // 登録用データ取得 $arrData = $objFormParam->getDbArray(); // 足りないものを作る if (!SC_Utils_Ex::isBlank($objFormParam->getValue('year'))) { $arrData['birth'] = $objFormParam->getValue('year') . '/' . $objFormParam->getValue('month') . '/' . $objFormParam->getValue('day') . ' 00:00:00'; } if (!is_numeric($arrData['customer_id'])) { $arrData['secret_key'] = SC_Utils_Ex::sfGetUniqRandomId('r'); } else { $arrOldCustomerData = SC_Helper_Customer_Ex::sfGetCustomerData($arrData['customer_id']); if ($arrOldCustomerData['status'] != $arrData['status']) { $arrData['secret_key'] = SC_Utils_Ex::sfGetUniqRandomId('r'); } } return SC_Helper_Customer_Ex::sfEditCustomerData($arrData, $arrData['customer_id']); }
/** * 会員情報を登録する * * @param mixed $objFormParam * @param mixed $customer_id * @access private * @return void */ function lfRegistCustomerData(&$objFormParam, $customer_id) { $arrRet = $objFormParam->getHashArray(); $sqlval = $objFormParam->getDbArray(); $sqlval['birth'] = SC_Utils_Ex::sfGetTimestamp($arrRet['year'], $arrRet['month'], $arrRet['day']); SC_Helper_Customer_Ex::sfEditCustomerData($sqlval, $customer_id); }
/** * 秘密の質問確認 * * @param array $arrForm フォーム入力値 * @param array $arrReminder リマインダー質問リスト * @return string エラー文字列 問題が無ければNULL */ function lfCheckForgotSecret(&$arrForm, &$arrReminder) { $errmsg = ''; $objQuery =& SC_Query_Ex::getSingletonInstance(); $cols = 'customer_id, reminder, reminder_answer, salt'; $table = 'dtb_customer'; $where = '(email Like ? OR email_mobile Like ?)' . ' AND name01 Like ? AND name02 Like ?' . ' AND status = 2 AND del_flg = 0'; $arrVal = array($arrForm['email'], $arrForm['email'], $arrForm['name01'], $arrForm['name02']); $result = $objQuery->select($cols, $table, $where, $arrVal); if (isset($result[0]['reminder']) and isset($arrReminder[$result[0]['reminder']]) and $result[0]['reminder'] == $arrForm['reminder']) { $is_authorized = false; if (empty($result[0]['salt'])) { // 旧バージョン(2.11未満)からの移行を考慮 if ($result[0]['reminder_answer'] == $arrForm['reminder_answer']) { $is_authorized = true; } } elseif (SC_Utils_Ex::sfIsMatchHashPassword($arrForm['reminder_answer'], $result[0]['reminder_answer'], $result[0]['salt'])) { $is_authorized = true; } if ($is_authorized) { // 秘密の答えが一致 // 新しいパスワードを設定する $new_password = GC_Utils_Ex::gfMakePassword(8); if (FORGOT_MAIL == 1) { // メールで変更通知をする $objDb = new SC_Helper_DB_Ex(); $CONF = $objDb->sfGetBasisData(); $this->lfSendMail($CONF, $arrForm['email'], $arrForm['name01'], $new_password); } $sqlval = array(); $sqlval['password'] = $new_password; SC_Helper_Customer_Ex::sfEditCustomerData($sqlval, $result[0]['customer_id']); $arrForm['new_password'] = $new_password; } else { // 秘密の答えが一致しなかった $errmsg = '秘密の質問が一致しませんでした。'; } } else { //不正なアクセス リマインダー値が前画面と異なる。 // 新リファクタリング基準ではここで遷移は不許可なのでエラー表示 //SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); $errmsg = '秘密の質問が一致しませんでした。'; } return $errmsg; }
/** * * @deprecated 重複決済される * @param unknown $accountDay */ function doContBillResult($accountDay) { if ($accountDay == null) { $accountDay = $this->getAccountDay(); } $objQuery = SC_Query_Ex::getSingletonInstance(); $curl = $this->curl_init(); do { $zip_file = CSV_TEMP_REALDIR . "auone/" . date("Y/m/d/His") . ".zip"; if (file_exists($zip_file)) { sleep(5); } } while (file_exists($zip_file)); SC_Utils_Ex::recursiveMkdir(dirname($zip_file)); $fp = fopen($zip_file, "w"); // FIXME 決済認可 $curl = $this->curl_init(false, true); // $post_history = array (); $post = $this->getPost("ContBillResult", $this->config, compact("accountDay")); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); curl_setopt($curl, CURLOPT_HEADER, FALSE); curl_setopt($curl, CURLOPT_FILE, $fp); curl_exec($curl); $zip = new ZipArchive(); if (!$zip->open($zip_file)) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR); } $extr = dirname($zip_file) . "/" . basename($zip_file, ".zip") . "/"; SC_Utils_Ex::recursiveMkdir($extr); if (!$zip->extractTo($extr)) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR); } $files = glob($extr . "*.csv"); foreach ($files as $file) { $enc_filepath = SC_Utils_Ex::sfEncodeFile($file, CHAR_CODE, dirname($file) . DIRECTORY_SEPARATOR); $fp2 = fopen($enc_filepath, "r"); fgetcsv($fp2); while ($arrCsv = fgetcsv($fp2)) { if (count($arrCsv) == 0) { // 空の列 continue; } if ($arrCsv[4] != $this->config["serviceId"]) { // 別サービス・チェック continue; } if ($arrCsv[8] != 'MPL01000') { // 取消レコード continue; } $pay_info_no = $arrCsv[1]; $amount_in_tax = $arrCsv[2]; $service_id = $arrCsv[4]; $au_open_id = $arrCsv[5]; $member_manage_no = $arrCsv[6]; $process_day = $arrCsv[11]; $cont_bill_regst_day = $arrCsv[13]; $continue_account_id = $arrCsv[19]; $amount = $amount_in_tax - $amount_in_tax % 100; $add_point = $amount; $where = "au_open_id =? AND status = 2 AND del_flg = 0"; $arrWhereVal = (array) $au_open_id; $customer = SC_Helper_Customer_Ex::sfGetCustomerDataFromId(null, $where, $arrWhereVal); if (SC_Utils_Ex::isBlank($customer)) { // ユーザー復旧は手動の方がいいかもしれない。 continue; } $name = "継続(" . $amount_in_tax . "円)"; $customer_id = $customer["customer_id"]; if ($add_point) { $lost_point = 0; // 更新後ポイント $updatePoint = array("point" => min($customer["point"] + $add_point, AU_MAXPOINT)); // 最大ポイントへ変更している場合は失効ポイントを計算 if ($updatePoint["point"] == AU_MAXPOINT) { $lost_point = max($customer["point"] + $add_point, AU_MAXPOINT) - AU_MAXPOINT; } SC_Helper_Customer_Ex::sfEditCustomerData($updatePoint, $customer_id); $objQuery->insert("cp_dtb_point_history", array("id" => $objQuery->nextVal("cp_dtb_point_history_id"), "customer_id" => $customer_id, "add_point" => $add_point, "use_point" => 0, "lost_point" => $lost_point, "order_id" => 0, "name" => $name, "create_date" => "NOW()", "update_date" => "NOW()")); $arrWhereVal[] = $continue_account_id; if ($objQuery->exists("cp_dtb_customer_transaction", "au_open_id=? AND del_flg=0 AND continue_account_id =?", $arrWhereVal)) { // 何かしらの影響で削除された場合後続処理を行う continue; } $objQuery->insert("cp_dtb_customer_transaction", array("id" => $objQuery->nextVal("cp_dtb_customer_transaction_id"), "customer_id" => $customer_id, "au_open_id" => $au_open_id, "transaction_id" => "", "transaction_status" => "40", "pay_info_no" => $pay_info_no, "pay_status" => 20, "continue_account_id" => $continue_account_id, "member_manage_no" => $member_manage_no, "process_day" => $process_day, "process_time" => "000000", "cont_bill_regst_day" => $cont_bill_regst_day, "cont_bill_regst_time" => "000000", "ammount" => $amount, "ammount_in_tax" => $amount_in_tax, "del_flg" => 0, "contents_id" => sprintf("%05d%09d", $service_id, $add_point), "status" => 0)); } } } }
/** * Page のアクション. * * @return void */ public function action() { $objQuery = SC_Query_Ex::getSingletonInstance(); parent::action(); switch ($this->getMode()) { case "operate_cancel_cont_bill": $objFormParam = new SC_FormParam_Ex(); $objFormSearchParam = new SC_FormParam_Ex(); // パラメーター処理 $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); // 入力パラメーターチェック $this->arrErr = $this->lfCheckError($objFormParam); $this->arrForm = $objFormParam->getHashArray(); // 検索引き継ぎ用パラメーター処理 $this->lfInitSearchParam($objFormSearchParam); $objFormSearchParam->setParam($objFormParam->getValue('search_data')); $this->arrSearchErr = $this->lfCheckErrorSearchParam($objFormSearchParam); $this->arrSearchData = $objFormSearchParam->getSearchArray(); break; } GC_Utils_Ex::gfDebugLog($this->arrErr); $objDb = new SC_Helper_DB_Ex(); $this->customer_id = $this->arrForm['customer_id']; $this->customer = SC_Helper_Customer_Ex::sfGetCustomerData($this->customer_id); // モードによる処理切り替え switch ($this->getMode()) { case 'confirm': // 購入履歴情報の取得 (ポイント付与でエラーチェックに通らない時用) list($this->tpl_linemax, $this->arrPurchaseHistory, $this->objNavi) = $this->lfPurchaseHistory($this->customer_id); break; case "operate_cancel_cont_bill": list($this->tpl_linemax, $this->arrPurchaseHistory, $this->objNavi) = $this->lfPurchaseHistory($this->customer_id); $curl = $this->curl_init(true, false); $transactionId = $_REQUEST["au_payment_transaction_id"]; $config = SC_AuonePayment_Ex::getConfig(); if (strlen($transactionId) == 32) { $post = $this->getPost("OperateCancelContBill", $config, compact("transactionId")); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); $result = $this->curl_result($curl); $result["post_history"] = $post; $this->arrErr["au_payment_transaction_id"] = $this->check_result($result, array()); $this->arrErr = array_filter($this->arrErr); if (!isset($this->arrErr["au_payment_transaction_id"])) { $curl = $this->curl_init(true); // FIXME 状態確認 $post = $this->getPost("ConditionInquiryForPayTranStat", $config, compact("transactionId")); curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post)); $result = $this->curl_result($curl); $arrWhereVal = array("del_flg" => 1, "transaction_status" => $result["body"]["transactionStatus"], "pay_status" => $result["body"]["payStatus"]); $arrWhereVal = array_filter($arrWhereVal, "strlen"); $objQuery->update("cp_dtb_customer_transaction", $arrWhereVal, "transaction_id = ? AND del_flg = 0", array($transactionId)); } } else { $this->arrErr["au_payment_transaction_id"] = "不正な処理"; } break; } if ($objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) { $objQuery->setOrder("id DESC"); $this->customer["transaction"] = $objQuery->select("*", "cp_dtb_customer_transaction", "\n customer_id = ?\n AND continue_account_id IS NOT NULL\n AND transaction_status = '40'\n ", array($this->customer_id)); $this->customer["transaction2"] = $objQuery->select("*", "cp_dtb_customer_transaction", "\n customer_id = ?\n AND continue_account_id IS NULL\n AND transaction_status = '40'\n ", array($this->customer_id)); $objQuery->setOrder(""); if (count($this->customer["transaction"]) == 0 && $this->customer["status"] == "2") { SC_Helper_Customer_Ex::sfEditCustomerData(array("status" => 1), $this->customer_id); $this->arrForm["status"]["value"] = 1; } } foreach ($this->arrErr as $msg) { $this->tpl_onload .= ";console.log('{$msg}');"; } }
/** * 会員情報の登録 * * @access private * @return uniqid */ public function lfRegistCustomerData($sqlval) { SC_Helper_Customer_Ex::sfEditCustomerData($sqlval); return $sqlval['secret_key']; }
/** * 顧客を削除する処理 * * @param integer $customer_id 顧客ID * @return boolean true:成功 false:失敗 */ function lfDoDeleteCustomer($customer_id) { $arrData = SC_Helper_Customer_Ex::sfGetCustomerDataFromId($customer_id, "del_flg = 0"); if (SC_Utils_Ex::isBlank($arrData)) { //対象となるデータが見つからない。 return false; } // XXXX: 仮会員は物理削除となっていたが論理削除に変更。 $arrVal["del_flg"] = "1"; $arrVal["update_date"] = 'CURRENT_TIMESTAMP'; SC_Helper_Customer_Ex::sfEditCustomerData($arrVal, $customer_id); return true; }