step 8 : configurasi url path selfie, load file, image not found, and deploy to devone

This commit is contained in:
sindhu
2024-01-23 14:54:36 +07:00
parent d3fe3234eb
commit f83fe2dab0
8 changed files with 80 additions and 13 deletions

View File

@@ -147,11 +147,12 @@ func (transabsensi *TransAbsensiResponse) ClockInAbsensi(T_TransactionM_StaffID
var varGetM_StaffNIP string
var varProsesFotoSelfie string
var jamClockIn string
var varFileName string
// check user token
qCheckTokenStaff := `SELECT
M_StaffToken,
M_StaffNIP
LOWER(M_StaffNIP) AS M_StaffNIP
FROM m_staff
WHERE M_StaffIsActive = 'Y'
AND M_StaffToken = ?
@@ -232,15 +233,6 @@ func (transabsensi *TransAbsensiResponse) ClockInAbsensi(T_TransactionM_StaffID
log.Printf("documentPath: %s", photoPath)
// create folder selfie_attachment jika belum ada
// if _, err := os.Stat(photoPath); errors.Is(err, os.ErrNotExist) {
// err = os.MkdirAll(photoPath, os.ModePerm)
// if err != nil {
// log.Printf("here %v", err)
// return &ret, err
// }
// }
if _, err := os.Stat(photoPath); errors.Is(err, os.ErrNotExist) {
err = os.MkdirAll(photoPath, os.ModePerm.Perm())
if err != nil {
@@ -268,7 +260,8 @@ func (transabsensi *TransAbsensiResponse) ClockInAbsensi(T_TransactionM_StaffID
fs.Write(decodedByte)
fs.Sync()
varProsesFotoSelfie = strPhoto
varProsesFotoSelfie = "selfie_attachment/" + folderName + "/" + strPhoto
varFileName = strPhoto
}
qInsertClockIn := `INSERT INTO t_transaction (
@@ -280,7 +273,8 @@ func (transabsensi *TransAbsensiResponse) ClockInAbsensi(T_TransactionM_StaffID
T_TransactionCurrentLatitude,
T_TransactionCurrentLongitude,
T_TransactionCurrentDistance,
T_TransactionSelfiePhoto,
T_TransactionFileName,
T_TransactionSelfiePhotoPath,
T_TransactionIsActive,
T_TransactionCreated
) VALUES (
@@ -294,6 +288,7 @@ func (transabsensi *TransAbsensiResponse) ClockInAbsensi(T_TransactionM_StaffID
?,
?,
?,
?,
NOW()
)`
@@ -305,6 +300,7 @@ func (transabsensi *TransAbsensiResponse) ClockInAbsensi(T_TransactionM_StaffID
T_TransactionCurrentLatitude,
T_TransactionCurrentLongitude,
T_TransactionCurrentDistance,
&varFileName,
&varProsesFotoSelfie,
"Y",
)