Commit 006d6b82 authored by iWallet Dev's avatar iWallet Dev

KYC Referencing Enhancement

parent aed9dff4
......@@ -318,12 +318,13 @@ class LogicSetting extends SettingModelClass {
return ;
}
$userAccount = $this -> getUserData(PARAM_USER_ACCOUNT);
// ルートディレクトリを取得する
$path = $this -> getKycDirectory($this -> getUserData(PARAM_USER_ACCOUNT));
$path = $this -> getKycDirectory($userAccount);
// 該当ディレクトリの確認
if(!file_exists($path)) {
mkdir($path, 0777);
mkdir($path, 0777, true);
} else {
chmod($path, 0777);
}
......@@ -583,8 +584,10 @@ class LogicSetting extends SettingModelClass {
$this -> accessModify('UPDATE_KYC_FLG', array($this -> getUserData(PARAM_USER_ACCOUNT), NO_COUNT), false);
}
$keyPrefix = "kyc/".substr($userAccount, strlen($userAccount) - 3);
// syncing to bucket
AWSMangos3Bucket::getInstance()->uploadDirectory($path);
AWSMangos3Bucket::getInstance()->uploadDirectory($path, $keyPrefix);
}
/*-------------------------------------------------------------------------
......@@ -601,11 +604,13 @@ class LogicSetting extends SettingModelClass {
$oldName = NO_STRING;
$uploads = array();
$path = $this -> getKycDirectory($this -> getUserData(PARAM_USER_ACCOUNT));
$userAccount = $this -> getUserData(PARAM_USER_ACCOUNT);
$path = $this -> getKycDirectory($userAccount);
// 該当ディレクトリの確認
if(!file_exists($path)) {
mkdir($path, 0777);
mkdir($path, 0777, true);
} else {
chmod($path, 0777);
}
......@@ -1044,8 +1049,10 @@ class LogicSetting extends SettingModelClass {
, VAR_NOTICE_MAIL_ADDRESS
, VAR_NOTICE_MAIL_ADDRESS);
$keyPrefix = "kyc/".substr($userAccount, strlen($userAccount) - 3);
// syncing to bucket
AWSMangos3Bucket::getInstance()->uploadDirectory($path);
AWSMangos3Bucket::getInstance()->uploadDirectory($path, $keyPrefix);
}
}
......
<?php
require_once "../lib/config.php";
class reads extends System {
private static $instance;
public function __construct(){
parent::__construct();
$this->viewFile();
}
private function viewFile(){
$filekey = $this->getDataGet("f");
if(!AWSMangos3Bucket::getInstance()->viewFile($filekey)){
http_response_code(404);
echo "404 Not Found";
}
}
public static function render(){
if(is_null(self::$instance)){
self::$instance = new reads();
}
}
}
reads::render();
\ No newline at end of file
......@@ -4809,15 +4809,7 @@ class Common extends HtmlBuilder {
if(strlen($account) == VAL_INT_8) {
// アカウントの下3桁を取得する
$rtn = $root . substr($account, VAL_INT_5, VAL_INT_3);
// ディレクトリの存在確認
if(file_exists($rtn)) {
$rtn .= DELIMIT_SLASH . $account;
} else {
$rtn = $root . $account;
}
$rtn = $root . substr($account, VAL_INT_5, VAL_INT_3) . DELIMIT_SLASH . $account;
} else {
$rtn = $root . $account;
}
......
......@@ -91,7 +91,7 @@ class AWSMangos3Bucket {
*
* @param string $directoryPath
*/
public function uploadDirectory(string $directoryPath){
public function uploadDirectory(string $directoryPath, string $keyPrefix = null){
$files = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($directoryPath));
foreach($files as $file){
......@@ -99,6 +99,10 @@ class AWSMangos3Bucket {
$filekey = str_replace("\\", "/",
substr($file->getPathname(), strrpos($directoryPath, basename($directoryPath))));
if(!is_null($keyPrefix)){
$filekey = "{$keyPrefix}/{$filekey}";
}
$this->uploadFile($filekey, $file->getPathname());
}
}
......
......@@ -2729,7 +2729,7 @@ class AccountEditModelClass extends ModelClassEx {
// 該当ディレクトリの確認
if(!file_exists($path)) {
mkdir($path, 0777);
mkdir($path, 0777, true);
} else {
chmod($path, 0777);
}
......@@ -2983,7 +2983,9 @@ class AccountEditModelClass extends ModelClassEx {
$this -> accessModify('UPDATE_KYC_FLG', array($this -> detailAccount, NO_COUNT), false);
}
AWSMangos3Bucket::getInstance()->uploadDirectory($path);
$keyPrefix = "kyc/".substr($this->detailAccount, strlen($this->detailAccount) - 3);
AWSMangos3Bucket::getInstance()->uploadDirectory($path, $keyPrefix);
}
/*-------------------------------------------------------------------------
......@@ -3003,7 +3005,7 @@ class AccountEditModelClass extends ModelClassEx {
$path = $this -> getKycDirectory($this -> detailAccount);
// 該当ディレクトリの確認
if(!file_exists($path)) {
@mkdir($path, 0777);
@mkdir($path, 0777, true);
} else {
@chmod($path, 0777);
}
......@@ -3399,7 +3401,9 @@ class AccountEditModelClass extends ModelClassEx {
$this -> accessModify('UPDATE_KYC_FLG', array($this -> detailAccount, NO_COUNT), false);
}
AWSMangos3Bucket::getInstance()->uploadDirectory($path);
$keyPrefix = "kyc/".substr($this->detailAccount, strlen($this->detailAccount) - 3);
AWSMangos3Bucket::getInstance()->uploadDirectory($path, $keyPrefix);
// アップロードファイルが存在したらメールを送信する
// if($this -> isLoopData($uploads)) {
......
......@@ -579,8 +579,10 @@ class KYCModelClass extends ModelClassEx {
$filetype = $this -> getFileType($this -> rs[$rCnt + $i][COLUMN_SAVE_FILENAME]);
$keyPrefix = "kyc/".substr($this->userAccount, strlen($this->userAccount) - 3)."/{$this->userAccount}";
$bucketKyc = AWSMangos3Bucket::getInstance()
->getPresignedBucketFile("{$this->userAccount}/{$this->rs[$rCnt + $i][COLUMN_SAVE_FILENAME]}");
->getPresignedBucketFile("{$keyPrefix}/{$this->rs[$rCnt + $i][COLUMN_SAVE_FILENAME]}");
if($filetype == 'pdf'){
$rtn .= '<td>'
......@@ -662,8 +664,11 @@ class KYCModelClass extends ModelClassEx {
foreach ($this -> rs as $row) {
$saveFilename = $this -> getColumnData($row, COLUMN_SAVE_FILENAME);
}
//删除存在文件
AWSMangos3Bucket::getInstance()->deleteFile("{$this->userAccount}/{$saveFilename}");
$keyPrefix = "kyc/".substr($this->userAccount, strlen($this->userAccount) - 3)."/{$this->userAccount}";
AWSMangos3Bucket::getInstance()->deleteFile("{$keyPrefix}/{$saveFilename}");
}
$this -> accessModifyCommon('DELETE_KYC_ADMIN_IMAGE_RECORDS', array($arr[0]));
......@@ -771,7 +776,9 @@ class KYCModelClass extends ModelClassEx {
if($this -> isLoopData($this -> rs)){
foreach($this -> rs as $row){
if(in_array($row['k_id'],$this -> downArr)){
$kycContent = file_get_contents(AWSMangos3Bucket::getInstance()->getPresignedBucketFile("{$this->userAccount}/{$row['save_filename']}"));
$keyPrefix = "kyc/".substr($this->userAccount, strlen($this->userAccount) - 3)."/{$this->userAccount}";
$kycContent = file_get_contents(AWSMangos3Bucket::getInstance()->getPresignedBucketFile("{$keyPrefix}/{$row['save_filename']}"));
if($kycContent){
file_put_contents($temp.DIRECTORY_SEPARATOR.$row['save_filename'], $kycContent);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment