function lfRegistFavoriteProduct($customer_id, $product_id) { $objQuery = new SC_Query(); $objConn = new SC_DbConn(); $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = ?", array($customer_id, $product_id)); if ($count == 0) { $sqlval['customer_id'] = $customer_id; $sqlval['product_id'] = $product_id; $sqlval['update_date'] = "now()"; $sqlval['create_date'] = "now()"; $objQuery->begin(); $objQuery->insert('dtb_customer_favorite_products', $sqlval); $objQuery->commit(); } }
function lfRegistData($array, $arrRegistColumn, $arrRejectRegistColumn, $confirm_flg, $isMobile = false, $email_mobile = "") { $objConn = new SC_DbConn(); // 登録データの生成 foreach ($arrRegistColumn as $data) { if (strlen($array[$data["column"]]) > 0 && !in_array($data["column"], $arrRejectRegistColumn)) { $arrRegist[$data["column"]] = $array[$data["column"]]; } } // 誕生日が入力されている場合 if (strlen($array["year"]) > 0) { $arrRegist["birth"] = $array["year"] . "/" . $array["month"] . "/" . $array["day"] . " 00:00:00"; } // パスワードの暗号化 $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC); // 仮会員登録の場合 if ($confirm_flg == true) { // 重複しない会員登録キーを発行する。 $count = 1; while ($count != 0) { $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t"); $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid)); } switch ($array["mailmaga_flg"]) { case 1: $arrRegist["mailmaga_flg"] = 4; break; case 2: $arrRegist["mailmaga_flg"] = 5; break; default: $arrRegist["mailmaga_flg"] = 6; break; } $arrRegist["status"] = "1"; // 仮会員 } else { // 重複しない会員登録キーを発行する。 $count = 1; while ($count != 0) { $uniqid = SC_Utils_Ex::sfGetUniqRandomId("r"); $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid)); } $arrRegist["status"] = "2"; // 本会員 } /* secret_keyは、テーブルで重複許可されていない場合があるので、 本会員登録では利用されないがセットしておく。 */ $arrRegist["secret_key"] = $uniqid; // 会員登録キー $arrRegist["create_date"] = "now()"; // 作成日 $arrRegist["update_date"] = "now()"; // 更新日 $arrRegist["first_buy_date"] = ""; // 最初の購入日 $arrRegist["point"] = $this->CONF["welcome_point"]; // 入会時ポイント if ($isMobile) { // 携帯メールアドレス $arrRegist['email_mobile'] = $arrRegist['email']; //PHONE_IDを取り出す $phoneId = SC_MobileUserAgent::getId(); $arrRegist['mobile_phone_id'] = $phoneId; } //-- 仮登録実行 $objConn->query("BEGIN"); $objQuery = new SC_Query(); $objQuery->insert("dtb_customer", $arrRegist); /* メルマガ会員機能は現在停止中 2007/03/07 //-- 非会員でメルマガ登録しているかの判定 $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?"; $mailResult = $objConn->getOne($sql, array($arrRegist["email"])); //-- メルマガ仮登録実行 $arrRegistMail["email"] = $arrRegist["email"]; if ($array["mailmaga_flg"] == 1) { $arrRegistMail["mailmaga_flg"] = 4; } elseif ($array["mailmaga_flg"] == 2) { $arrRegistMail["mailmaga_flg"] = 5; } else { $arrRegistMail["mailmaga_flg"] = 6; } $arrRegistMail["update_date"] = "now()"; // 非会員でメルマガ登録している場合 if ($mailResult == 1) { $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'"); } else { // 新規登録の場合 $arrRegistMail["create_date"] = "now()"; $objQuery->insert("dtb_customer_mail", $arrRegistMail); } */ $objConn->query("COMMIT"); return $uniqid; }
function lfRegistData($array, $arrRegistColumn, $arrRejectRegistColumn) { $objConn = new SC_DbConn(); // 仮登録 foreach ($arrRegistColumn as $data) { if (strlen($array[$data["column"]]) > 0 && !in_array($data["column"], $arrRejectRegistColumn)) { $arrRegist[$data["column"]] = $array[$data["column"]]; } } // 誕生日が入力されている場合 if (strlen($array["year"]) > 0) { $arrRegist["birth"] = $array["year"] . "/" . $array["month"] . "/" . $array["day"] . " 00:00:00"; } // パスワードの暗号化 $arrRegist["password"] = sha1($arrRegist["password"] . ":" . AUTH_MAGIC); $count = 1; while ($count != 0) { $uniqid = SC_Utils_Ex::sfGetUniqRandomId("t"); $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer WHERE secret_key = ?", array($uniqid)); } $arrRegist["secret_key"] = $uniqid; // 仮登録ID発行 $arrRegist["create_date"] = "now()"; // 作成日 $arrRegist["update_date"] = "now()"; // 更新日 $arrRegist["first_buy_date"] = ""; // 最初の購入日 //-- 仮登録実行 $objConn->query("BEGIN"); $objQuery = new SC_Query(); $objQuery->insert("dtb_customer", $arrRegist); /* メルマガ会員機能は現在停止中 2007/03/07 //-- 非会員でメルマガ登録しているかの判定 $sql = "SELECT count(*) FROM dtb_customer_mail WHERE email = ?"; $mailResult = $objConn->getOne($sql, array($arrRegist["email"])); //-- メルマガ仮登録実行 $arrRegistMail["email"] = $arrRegist["email"]; if ($array["mailmaga_flg"] == 1) { $arrRegistMail["mailmaga_flg"] = 4; } elseif ($array["mailmaga_flg"] == 2) { $arrRegistMail["mailmaga_flg"] = 5; } else { $arrRegistMail["mailmaga_flg"] = 6; } $arrRegistMail["update_date"] = "now()"; // 非会員でメルマガ登録している場合 if ($mailResult == 1) { $objQuery->update("dtb_customer_mail", $arrRegistMail, "email = '" .addslashes($arrRegistMail["email"]). "'"); } else { // 新規登録の場合 $arrRegistMail["create_date"] = "now()"; $objQuery->insert("dtb_customer_mail", $arrRegistMail); } */ $objConn->query("COMMIT"); return $uniqid; }
function lfDeleteFavoriteProduct($customer_id, $product_id) { $objQuery = new SC_Query(); $objConn = new SC_DbConn(); $count = $objConn->getOne("SELECT COUNT(*) FROM dtb_customer_favorite_products WHERE customer_id = ? AND product_id = ?", array($customer_id, $product_id)); if ($count > 0) { $where = "customer_id = ? AND product_id = ?"; $sqlval['customer_id'] = $customer_id; $sqlval['product_id'] = $product_id; $objQuery->begin(); $objQuery->delete('dtb_customer_favorite_products', $where, $sqlval); $objQuery->commit(); } }