Exemplo n.º 1
0
<?php

require_once realpath(dirname(__FILE__)) . '/../require.php';
$qrcode = new Image_QRCode(array("path" => DATA_REALDIR . "module/Image/data", "image_path" => DATA_REALDIR . "module/Image/imagedata"));
$objProduct = new SC_Product_Ex();
if ($objProduct->isValidProductId($_GET["product_id"], true)) {
    $sid = $_GET["sid"];
    $p_detail_url = HTTP_URL . substr(P_DETAIL_URLPATH, strlen(ROOT_URLPATH));
    $p_detail_url = str_replace("detail.php", "detail_spass.php", $p_detail_url);
    $qrcode->makeCode($p_detail_url . $_GET["product_id"] . "&admin=on&sid={$sid}", array('image_type' => 'jpeg', 'error_correct' => 'L'));
}
 /**
  * 表示用フォームパラメーター取得
  * - 入力画面
  *
  * @param SC_UploadFile_Ex $objUpFile
  *            SC_UploadFileインスタンス
  * @param SC_UploadFile_Ex $objDownFile
  *            SC_UploadFileインスタンス
  * @param array $arrForm
  *            フォーム入力パラメーター配列
  * @return array 表示用フォームパラメーター配列
  */
 public function lfSetViewParam_InputPage(SC_UploadFile &$objUpFile, SC_UploadFile &$objDownFile, &$arrForm)
 {
     $objProduct = new SC_Product_Ex();
     $arrForm = parent::lfSetViewParam_InputPage($objUpFile, $objDownFile, $arrForm);
     $product_id = $arrForm["product_id"];
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $objDb = new SC_Helper_DB_Ex();
     $check = $objQuery->extractOnlyColsOf("dtb_products", array("auto_display_start_date" => true, "auto_display_end_date" => true, "spass_provide_start_date" => true, "spass_provide_end_date" => true));
     $check = array_keys($check);
     if (count($check) && $objProduct->isValidProductId($product_id, true)) {
         $arrProduct = $objQuery->getRow(implode(",", $check), "dtb_products", "product_id = ?", (array) $product_id);
         $arrForm["auto_display_start_date"] = strtotime($arrProduct["auto_display_start_date"]);
         $arrForm["auto_display_end_date"] = strtotime($arrProduct["auto_display_end_date"]);
         $arrForm["spass_provide_start_date"] = strtotime($arrProduct["spass_provide_start_date"]);
         $arrForm["spass_provide_end_date"] = strtotime($arrProduct["spass_provide_end_date"]);
         GC_Utils_Ex::gfPrintLog(print_r($arrProduct, true), DEBUG_LOG_REALFILE);
         if ($arrForm["auto_display_start_date"]) {
             $arrForm["auto_display_start_date_year"] = date("Y", $arrForm["auto_display_start_date"]);
             $arrForm["auto_display_start_date_month"] = date("m", $arrForm["auto_display_start_date"]);
             $arrForm["auto_display_start_date_day"] = date("d", $arrForm["auto_display_start_date"]);
         }
         unset($arrForm["auto_display_start_date"]);
         if ($arrForm["auto_display_end_date"]) {
             $arrForm["auto_display_end_date_year"] = date("Y", $arrForm["auto_display_end_date"]);
             $arrForm["auto_display_end_date_month"] = date("m", $arrForm["auto_display_end_date"]);
             $arrForm["auto_display_end_date_day"] = date("d", $arrForm["auto_display_end_date"]);
         }
         unset($arrForm["auto_display_end_date"]);
         // spass_provide_start_date
         if ($arrForm["spass_provide_start_date"]) {
             $arrForm["spass_provide_start_date_year"] = date("Y", $arrForm["spass_provide_start_date"]);
             $arrForm["spass_provide_start_date_month"] = date("m", $arrForm["spass_provide_start_date"]);
             $arrForm["spass_provide_start_date_day"] = date("d", $arrForm["spass_provide_start_date"]);
         }
         unset($arrForm["spass_provide_start_date"]);
         // spass_provide_end_date
         if ($arrForm["spass_provide_end_date"]) {
             $arrForm["spass_provide_end_date_year"] = date("Y", $arrForm["spass_provide_end_date"]);
             $arrForm["spass_provide_end_date_month"] = date("m", $arrForm["spass_provide_end_date"]);
             $arrForm["spass_provide_end_date_day"] = date("d", $arrForm["spass_provide_end_date"]);
         }
         unset($arrForm["spass_provide_end_date"]);
     } elseif (count($check)) {
         $arrForm["auto_display_start_date_year"] = date("Y");
         $arrForm["auto_display_start_date_month"] = date("m");
         $arrForm["auto_display_start_date_day"] = date("d");
         unset($arrForm["auto_display_start_date"]);
         unset($arrForm["auto_display_end_date"]);
         unset($arrForm["spass_provide_start_date"]);
         unset($arrForm["spass_provide_end_date"]);
     }
     if ($objDb->sfColumnExists("cp_dtb_product_characters", "product_id")) {
         $arrForm["character_id"] = $objQuery->getCol("character_id", "cp_dtb_product_characters", "product_id=?", array($product_id));
     }
     // auto_display_end_date_year
     return $arrForm;
 }
 /**
  * 都度課金.
  *
  * @param unknown $config
  * @param SC_Customer $objCustomer
  * @param number $ammount
  */
 function doPayCertForAuthorySold($config, SC_Customer $objCustomer, $ammount = 500)
 {
     // TODO 次期リリースで マスタ化
     switch ($ammount) {
         case 1000:
             $ammount = 1000;
             break;
         default:
             $ammount = 500;
     }
     $objQuery = SC_Query_Ex::getSingletonInstance();
     if (!$objCustomer->isLoginSuccess()) {
         $this->doLogin($this->getMode(), $objCustomer, $objQuery);
     }
     // FIXME 1円 1ポイント購入計算
     $point = $ammount;
     if ($this->tpl_point + $point > AU_MAXPOINT) {
         $msg = "合計ポイントが%sポイントを越えるためポイントの購入が出来ません";
         $msg = sprintf($msg, number_format(AU_MAXPOINT));
         SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", true, $msg);
     }
     $objProduct = new SC_Product_Ex();
     $ammount_in_tax = SC_Helper_TaxRule_Ex::sfCalcIncTax($ammount);
     $_SESSION["return_to_key"] = "pay_cert_for_authory_sold_return_to";
     if ($objProduct->isValidProductId($_REQUEST["product_id"])) {
         $_SESSION[$_SESSION["return_to_key"]] = P_DETAIL_URLPATH . $_REQUEST["product_id"];
     } else {
         $_SESSION[$_SESSION["return_to_key"]] = ROOT_URLPATH . "au/point_add_complete.php?ammount={$ammount}";
     }
     $_SESSION["before_mode"] = "pay_cert_for_authory_sold";
     $okUrl = new Net_URL($_SERVER["SCRIPT_NAME"]);
     $ngUrl = new Net_URL($_SERVER["SCRIPT_NAME"]);
     $okUrl->addQueryString("mode", "pay_cert_for_authory_sold_ok");
     $okUrl->addQueryString("ammount", $ammount);
     $okUrl->addQueryString("ammount_in_tax", $ammount_in_tax);
     $ngUrl->addQueryString("mode", "pay_cert_for_authory_sold_ng");
     $shop_name = mb_convert_kana($this->arrSiteInfo["shop_name"], "AKc");
     $shop_tel = $this->getShopTel();
     // FIXME 決済認可
     $curl = $this->curl_init();
     $post_history = array();
     $post = $this->getPost("PayCertForAuthorySold", $config, array("certType" => "01", "openId" => $objCustomer->getValue("au_open_id"), "amount" => $ammount_in_tax, "commodity" => mb_convert_kana("ポイント購入", "A"), "memberAuthOkUrl" => $okUrl->getURL(), "memberAuthNgUrl" => $ngUrl->getURL(), "serviceName" => $shop_name, "serviceTel" => $shop_tel));
     $post_history[] = $post;
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
     $result = $this->curl_result($curl);
     $result["post_history"] = $post_history;
     $this->check_result($result);
     $transactionId = rawurldecode($result["body"]["transactionId"]);
     // FIXME ユーザー認証
     $result = $this->doUserPermitBridge($config, $objCustomer, $transactionId, $post_history);
     header("Location: " . $result["head"]["Location"]);
     SC_Response_Ex::actionExit();
 }
 function __construct($array, $mode = true)
 {
     parent::__construct($array);
     GC_Utils_Ex::gfPrintLog(print_r($this->arrSql, true), DEBUG_LOG_REALFILE);
     $this->arrWhereVal = array();
     $objDb = new SC_Helper_DB_Ex();
     $this->setEquals("0", "del_flg", "is_numeric");
     if ($mode && ($_REQUEST["mode"] == "pre_edit" || $_REQUEST["mode"] == "preEdit")) {
         // FIXME 端末ID(編集対象 )
         $this->setEquals($this->arrSql["edit_device_id"], "device_id", "is_numeric");
         return;
     }
     // FIXME 端末ID
     $this->setEquals($this->arrSql["search_device_id"], "device_id", "is_numeric");
     // FIXME 端末名
     $this->setLike($this->arrSql["search_device_name"], "device_name");
     // FIXME OS(発売)
     $this->setFromTo($this->arrSql["search_os_min_version_min"], $this->arrSql["search_os_min_version_max"], "os_min_version");
     // FIXME OS(最新)
     $this->setFromTo($this->arrSql["search_os_max_version_min"], $this->arrSql["search_os_max_version_max"], "os_max_version");
     // FIXME OS(発売|最新)
     $this->setFromTo($this->arrSql["search_os_version_min"], $this->arrSql["search_os_version_max"], array("os_min_version", "os_max_version"));
     // FIXME サイズ(幅)
     if (is_numeric($this->arrSql["search_display_width_min"]) || is_numeric($this->arrSql["search_display_width_max"])) {
         $this->setFromTo($this->arrSql["search_display_width_min"], $this->arrSql["search_display_width_max"], "display_width");
     }
     // FIXME サイズ(高)
     if (is_numeric($this->arrSql["search_display_height_min"]) || is_numeric($this->arrSql["search_display_height_max"])) {
         $this->setFromTo($this->arrSql["search_display_height_min"], $this->arrSql["search_display_height_max"], "display_height");
     }
     $base_table = $this->table;
     // FIXME カテゴリーID
     if (is_numeric($this->arrSql["search_category_id"])) {
         list($where, $arrRet) = $objDb->sfGetCatWhere($this->arrSql["search_category_id"]);
         $this->setWhere("    EXISTS (SELECT 1 FROM cp_dtb_device_categories A WHERE A.device_id = {$base_table}.device_id AND {$where})");
         $this->arrWhereVal = array_merge($this->arrWhereVal, $arrRet);
     } elseif ($this->arrSql["search_category_id_unset"] == "1" || $this->arrSql["search_category_id_unset"][0] == "1") {
         $this->setWhere("NOT EXISTS (SELECT 1 FROM cp_dtb_device_categories A WHERE A.device_id = {$base_table}.device_id)");
     }
     // FIXME 商品ID
     if (is_numeric($this->arrSql["search_product_id"])) {
         $id = $this->arrSql["search_product_id"];
         $objProduct = new SC_Product_Ex();
         if ($objProduct->isValidProductId($id)) {
             $arrCategory_id = $objProduct->getCategoryIds($id);
             foreach ($arrCategory_id as $category_id) {
                 list($where, $arrRet) = $objDb->sfGetCatWhere($category_id);
                 // TODO cp_dtb_device_products 連携
                 $this->setWhere("    EXISTS (SELECT 1 FROM cp_dtb_device_categories A WHERE A.device_id = {$base_table}.device_id AND {$where})");
                 $this->arrWhereVal = array_merge($this->arrWhereVal, $arrRet);
             }
         }
     }
     // FIXME キャリア
     if (is_numeric($this->arrSql["search_carrier"])) {
         $this->setEquals($this->arrSql["search_carrier"], 'carrier');
     }
     // FIXME 状態
     if (is_array($this->arrSql["search_status"])) {
         $this->setItemTerm($this->arrSql["search_status"], 'status');
     } elseif (is_numeric($this->arrSql["search_status"])) {
         $this->setEquals($this->arrSql["search_status"], 'status');
     }
     // FIXME UA
     $this->setEquals($this->arrSql["search_device_user_agent_word"], array('device_user_agent_word_1', 'device_user_agent_word_2', 'device_user_agent_word_3'));
     // END
     GC_Utils_Ex::gfPrintLog(print_r($this->arrWhereVal, true), DEBUG_LOG_REALFILE);
 }