Added post-newstatus-electrical
This commit is contained in:
parent
327c3b60a4
commit
7be79529df
1 changed files with 50 additions and 0 deletions
|
|
@ -660,5 +660,55 @@ func connect() {
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
|
router.POST("/api/post-newstatus-electrical", func(c *gin.Context) {
|
||||||
|
type RegistrationData struct {
|
||||||
|
Data int `json:"data"`
|
||||||
|
Data2 string `json:"data2"`
|
||||||
|
Data3 string `json:"data3"`
|
||||||
|
Data4 string `json:"data4"`
|
||||||
|
Data5 string `json:"data5"`
|
||||||
|
Data6 string `json:"data6"`
|
||||||
|
Data7 string `json:"data7"`
|
||||||
|
Data8 string `json:"data8"`
|
||||||
|
Data9 string `json:"data9"`
|
||||||
|
}
|
||||||
|
var registrationData RegistrationData
|
||||||
|
if err := c.ShouldBindJSON(®istrationData); err != nil {
|
||||||
|
c.String(http.StatusBadRequest, "Invalid request body")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
c.Writer.Header().Set("X-XSS-Protection", "1; mode=block")
|
||||||
|
c.Writer.Header().Set("X-Content-Type-Options", "nosniff")
|
||||||
|
c.Writer.Header().Set("X-DNS-Prefetch-Control", "off")
|
||||||
|
c.Writer.Header().Set("X-Frame-Options", "DENY")
|
||||||
|
c.Writer.Header().Set("X-Download-Options", "noopen")
|
||||||
|
c.Writer.Header().Set("Referrer-Policy", "no-referrer")
|
||||||
|
|
||||||
|
dbpost, err := db.Prepare(`INSERT INTO electrical_orderofpayment_new (electrical_orderofpayment_newid, electricalid, assessedbyid, reviewedbyid, ref_bldgcomputationsheetid, amount, orNo, is_approve, for_approval, is_release, is_paid, popstransmitted, opDate, amt_Gflgu, amt_Gfdpwh, amt_Tfbo, optn, datePaid, is_delete, securitycode, barcode)
|
||||||
|
VALUES (NULL, ?, ?, ?, ?, ?, NULL, 1, 1, 0, 0, 0, ?, ?, ?, ?, NULL, NULL, 0, NULL, NULL)`)
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
defer dbpost.Close()
|
||||||
|
|
||||||
|
exec, err := dbpost.Exec(registrationData.Data, registrationData.Data2, registrationData.Data3, registrationData.Data4, registrationData.Data5, registrationData.Data6, registrationData.Data7, registrationData.Data8, registrationData.Data9)
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
affect, err := exec.RowsAffected()
|
||||||
|
if err != nil {
|
||||||
|
panic(err.Error())
|
||||||
|
}
|
||||||
|
|
||||||
|
if affect > 0 {
|
||||||
|
c.String(http.StatusOK, "Success on Registrating e-Sign")
|
||||||
|
} else {
|
||||||
|
c.String(http.StatusInternalServerError, "Failed on Registrating e-Sign")
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
|
||||||
router.Run(":4320")
|
router.Run(":4320")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue