| @@ -37,7 +37,7 @@ func (m *TransactionDB) close() { | |||
| m.h = nil //clear it, very important to prevent multiple opening | |||
| } | |||
| func (m *TransactionDB) addRequest(r *http.Request) (row LeanworkIn, err error) { | |||
| func (m *TransactionDB) addRequest(r *http.Request, md5key string) (row LeanworkIn, err error) { | |||
| if err = m.conn(Config); err != nil { | |||
| return row, err | |||
| } | |||
| @@ -54,16 +54,16 @@ func (m *TransactionDB) addRequest(r *http.Request) (row LeanworkIn, err error) | |||
| orderCurrency := r.FormValue("orderCurrency") | |||
| customerId := r.FormValue("customerId") | |||
| sign := r.FormValue("sign") | |||
| valid := isLeanworkFormValid(r.Form) | |||
| valid := isLeanworkFormValid(r.Form, md5key) | |||
| ip4 := getClientIPLong(r) | |||
| insForm, err := m.h.Prepare("INSERT INTO leanworkIn (pickupUrl, receiveUrl, signType, orderNo, orderAmount, orderCurrency, customerId, sign, valid, ip4) VALUES(?,?,?,?,?,?,?,?,?,?)") | |||
| insForm, err := m.h.Prepare("INSERT INTO leanworkIn (pickupUrl, receiveUrl, signType, orderNo, orderAmount, orderCurrency, customerId, sign, valid, ip4, md5key) VALUES(?,?,?,?,?,?,?,?,?,?,?)") | |||
| if err != nil { | |||
| log.Printf("Failed to prepare SQL statment for insert") | |||
| return | |||
| } | |||
| res, err := insForm.Exec(pickupUrl, receiveUrl, signType, orderNo, orderAmount, orderCurrency, customerId, sign, valid, ip4) | |||
| res, err := insForm.Exec(pickupUrl, receiveUrl, signType, orderNo, orderAmount, orderCurrency, customerId, sign, valid, ip4, md5key) | |||
| if err != nil { | |||
| log.Printf("Error inserting leanworkIn with orderNo =%s \n", orderNo) | |||
| return | |||
| @@ -85,6 +85,7 @@ func (m *TransactionDB) addRequest(r *http.Request) (row LeanworkIn, err error) | |||
| row.Sign = sign | |||
| row.Valid = valid | |||
| row.Ip4 = ip4 | |||
| row.MD5Key = md5key | |||
| log.Println("INSERT[" + strconv.FormatInt(row.Id, 10) + "]: customerId: " + customerId + " | orderAmount: " + orderCurrency + " " + orderAmount) | |||
| return row, err | |||