/// CI Controller
public function InsertNewBookingService() {
$ResultData = $this->m_booking_service->insertNewBookingService();
//$data_string = json_encode($ResultData);
print_r($ResultData);
}
/// CI Models
function insertNewBookingService() {
$this->load->library('Emails');
$save['NAME']=$this->input->post('NAME');
$save['EMAIL']=$this->input->post('EMAIL');
$save['PHONE']=$this->input->post('PHONE');
$save['TNKB']=$this->input->post('TNKB');
$save['ALAMAT']=$this->input->post('ALAMAT');
$save['TANGGAL_SERVICE']=$this->input->post('TANGGAL_SERVICE');
$save['STATUS']=$this->input->post('STATUS');
$save['NOTE']=$this->input->post('NOTE');
$save['DEALER_ID']=$this->input->post('DEALER_ID');
$save['VEHICLE_DESC']=$this->input->post('VEHICLE_DESC');
$save['TIPE_SERVICE']=$this->input->post('TIPE_SERVICE');
$save['JAM_SERVICE']=$this->input->post('JAM_SERVICE');
//insert data to database
$this->db->insert('booking_order',$save);
$insert_id = $this->db->insert_id();
//insert notifications
$saveNotif['ID']=$insert_id;
$saveNotif['NOTIF_TYPE']='BS';
$saveNotif['NOTIF_STATUS']=$this->input->post('STATUS');
$saveNotif['NOTIF_DATE']=date("Y/m/d");
$saveNotif['EMAIL']=$this->input->post('EMAIL');
$saveNotif['IS_READ']='0';
$saveNotif['IS_SHOW']='0';
$this->db->insert('notifications',$saveNotif);
//send email
$role = array('admin', 'admin_bs');
$userData = $this->db->where_in('ROLE', $role)->get('user_apps')->result_array();
$dataNumRows = count($userData);
for ($i = 0; $i < $dataNumRows; $i++) {
Emails::SendEmailBookingService($insert_id,$userData[$i]['USERNAME'],$userData[$i]['EMAIL']);
}
}
//Insert Data on Java (Android)
selectedServiceType = textHelper.getSpinnerText(spnServiceType);
selectedServiceTime = textHelper.getSpinnerText(spnServiceTimeHourMinute);
paramPhoneNo = txtPhoneNumber.getText().toString();
paramServiceDate = textHelper.formatStringDate(txtServiceDate.getText().toString(), "dd-MMM-yyyy", "yyyy-MM-dd");
paramNote = txtNote.getText().toString();
final ProgressDialog loading = ProgressDialog.show(BookingServiceNewActivity.this,"Saving","Please wait...",false,false);
StringRequest reqInsertBookingService = new StringRequest(Request.Method.POST, URLServices.insertDataBookingService, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
try {
if(response.equals("")){
loading.dismiss();
//Show popup message
AlertDialog.Builder builder = new AlertDialog.Builder(BookingServiceNewActivity.this);
LayoutInflater inflater = getLayoutInflater();
final View rootView = inflater.inflate(R.layout.activity_popup_message,null);
builder.setView(rootView);
final TextView tvMessage = (TextView) rootView.findViewById(R.id.tvMessage);
tvMessage.setText(R.string.booking_service_message);
builder.setPositiveButton("OK", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialogInterface, int i) {
dialogInterface.dismiss();
finish();
}
});
final AlertDialog dialog = builder.create();
//dialog.setCanceledOnTouchOutside(true);
dialog.setCancelable(false);
dialog.show();
//End Show popup message
// Toast.makeText(getApplicationContext(),"Save Successful",Toast.LENGTH_LONG).show();
// //Intent bookingList = new Intent(getApplicationContext(),BookingServiceListActivity.class);
// //startActivity(bookingList);
// finish();
}
else{
loading.dismiss();
Toast.makeText(getApplicationContext(),response,Toast.LENGTH_LONG).show();
}
} catch (Exception e) {
loading.dismiss();
e.printStackTrace();
Toast.makeText(getApplicationContext(), "Error: " + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
loading.dismiss();
Toast.makeText(BookingServiceNewActivity.this, error.getMessage(), Toast.LENGTH_SHORT).show();
}
}) {
@Override
protected Map<String, String> getParams() {
Map<String, String> params = new HashMap<String, String>();
params.put("NAME", userName);
params.put("EMAIL", userEmail);
params.put("PHONE", paramPhoneNo);
params.put("TNKB", selectedTNKB);
params.put("ALAMAT", "");
params.put("TANGGAL_SERVICE", paramServiceDate);
params.put("STATUS", "REVIEW");
params.put("NOTE", paramNote);
params.put("DEALER_ID", dealerId);
params.put("VEHICLE_DESC", selectedVehicleType);
params.put("TIPE_SERVICE", selectedServiceType);
params.put("JAM_SERVICE", selectedServiceTime);
return params;
}
};
SingletonApiSync.getInstance(BookingServiceNewActivity.this).getRequestQueue().getCache().clear();
SingletonApiSync.getInstance(BookingServiceNewActivity.this).addToRequestQueue(reqInsertBookingService);
//End Insert Data
所以有人告诉我使用setretrypolicy,
reqInsertBookingService.setRetryPolicy(new DefaultRetryPolicy(0,DefaultRetryPolicy.DEFAULT_MAX_RETRIES,DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
是的,它的作品,但它使功能运行真的很慢,所以我想尝试一些在ci-api,而不是更新android上的代码,有什么想法?已尝试此codeigniter更新查询执行两次,但它不起作用
我不知道为什么,因为android应用程序和api从2019年开始就没有更新过,这个月突然出现了bug谢谢
暂无答案!
目前还没有任何答案,快来回答吧!