我有一个kotlin文件来更新这样的数据
fun editCustomer() {
val progressDialog = ProgressDialog(activity)
progressDialog.setMessage("Saving...")
progressDialog.show()
android.os.Handler().postDelayed({
val editSwitch = EditSwitch()
val custID = activity.intent.getStringExtra(ID_CUSTOMER_PROSPECT)
editSwitch.id = custID
editSwitch.assignedTo = "hehehehe"
editSwitch.salesmanId = "hehehehe"
API.getEditCustomerProspect(custID).enqueue(object : Callback<EditSwitch> {
override fun onResponse(call: Call<EditSwitch>, response: Response<EditSwitch>) {
Log.i("bebet", "onResponse: " + response.body()!!.id)
if (response.code() == 200) {
Toast.makeText(activity, "Success", Toast.LENGTH_SHORT).show()
}
}
override fun onFailure(call: Call<EditSwitch>, t: Throwable) {
Toast.makeText(activity, "Failed", Toast.LENGTH_SHORT).show()
}
})
progressDialog.dismiss()
activity.finish()
}, 2000)
}
我有一个像这样的节点js的网络服务
this.put = function(req,res,next) {
var id = req.query.id;
var assigned_to = req.body.assigned_to;
var salesman_id = req.body.salesman_id;
var modified_at = new Date();
connection.acquire(function(err,con,result,fields){
if (err) throw err;
con.query('UPDATE customer_prospect SET salesman_id = ?, assigned_to = ?, modified = ? WHERE id = "'+id+'"', [assigned_to, assigned_to, modified_at], function(err,results,fields){
con.release();
connection.acquire(function(err,con){
con.query('SELECT * FROM customer_prospect where id = "'+id+'" ',[id], function(err,results,fields){
con.release();
res.json(results[0]);
})
})
});
});
};
当我尝试使用postman检查我的查询成功更新,但是当我在android中更新显示成功但数据库中的数据变为null时,我该怎么办?