initial
This commit is contained in:
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Appsettings_model extends CI_model
|
||||
{
|
||||
public function getappbyid()
|
||||
{
|
||||
return $this->db->get_where('app_settings', ['id' => '1'])->row_array();
|
||||
}
|
||||
|
||||
public function gettransfer()
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('list_bank');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getbankid($id)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('list_bank');
|
||||
$this->db->where('id_bank', $id);
|
||||
return $this->db->get()->row_array();
|
||||
}
|
||||
|
||||
public function ubahdataappsettings($data)
|
||||
{
|
||||
$this->db->set('app_logo', $data['app_logo']);
|
||||
$this->db->set('app_email', $data['app_email']);
|
||||
$this->db->set('app_website', $data['app_website']);
|
||||
|
||||
$this->db->set('app_privacy_policy', $data['app_privacy_policy']);
|
||||
$this->db->set('app_aboutus', $data['app_aboutus']);
|
||||
$this->db->set('app_address', $data['app_address']);
|
||||
$this->db->set('app_name', $data['app_name']);
|
||||
$this->db->set('app_contact', $data['app_contact']);
|
||||
$this->db->set('app_linkgoogle', $data['app_linkgoogle']);
|
||||
$this->db->set('app_currency', $data['app_currency']);
|
||||
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahdatarekening($data, $id)
|
||||
{
|
||||
$this->db->where('id_bank', $id);
|
||||
$this->db->update('list_bank', $data);
|
||||
}
|
||||
|
||||
public function hapusrekening($id)
|
||||
{
|
||||
$this->db->where('id_bank', $id);
|
||||
$this->db->delete('list_bank');
|
||||
}
|
||||
|
||||
public function adddatarekening($data)
|
||||
{
|
||||
$this->db->insert('list_bank', $data);
|
||||
}
|
||||
|
||||
public function ubahdataemail($data)
|
||||
{
|
||||
$this->db->set('email_subject', $data['email_subject']);
|
||||
$this->db->set('email_text1', $data['email_text1']);
|
||||
$this->db->set('email_text2', $data['email_text2']);
|
||||
$this->db->set('email_subject_confirm', $data['email_subject_confirm']);
|
||||
$this->db->set('email_text3', $data['email_text3']);
|
||||
$this->db->set('email_text4', $data['email_text4']);
|
||||
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahxendit($data)
|
||||
{
|
||||
$this->db->set('api_keyxendit', $data['api_keyxendit']);
|
||||
$this->db->set('apikey_server', $data['apikey_server']);
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahdataayopesan($data)
|
||||
{
|
||||
$this->db->set('api_password', $data['api_password']);
|
||||
$this->db->set('harga_pulsa', $data['harga_pulsa']);
|
||||
$this->db->set('api_token', $data['api_token']);
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahdatasmtp($data)
|
||||
{
|
||||
$this->db->set('smtp_host', $data['smtp_host']);
|
||||
$this->db->set('smtp_port', $data['smtp_port']);
|
||||
$this->db->set('smtp_username', $data['smtp_username']);
|
||||
$this->db->set('smtp_password', $data['smtp_password']);
|
||||
$this->db->set('smtp_from', $data['smtp_from']);
|
||||
$this->db->set('smtp_secure', $data['smtp_secure']);
|
||||
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
|
||||
public function ubahdatamobilepulsa($data)
|
||||
{
|
||||
$this->db->set('mobilepulsa_username', $data['mobilepulsa_username']);
|
||||
$this->db->set('mobilepulsa_harga', $data['mobilepulsa_harga']);
|
||||
$this->db->set('mobilepulsa_api_key', $data['mobilepulsa_api_key']);
|
||||
$this->db->set('mp_status', $data['mp_status']);
|
||||
$this->db->set('mp_active', $data['mp_active']);
|
||||
|
||||
$this->db->where('id', '1');
|
||||
$this->db->update('app_settings', $data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
class categorymerchant_model extends CI_model
|
||||
{
|
||||
public function getAllcm()
|
||||
{
|
||||
$this->db->where('category_merchant.id_fitur != 0');
|
||||
$this->db->join('fitur', 'category_merchant.id_fitur = fitur.id_fitur', 'left');
|
||||
return $this->db->get('category_merchant')->result_array();
|
||||
}
|
||||
|
||||
public function getfiturmerchant()
|
||||
{
|
||||
$this->db->where('home = 4');
|
||||
return $this->db->get('fitur')->result_array();
|
||||
}
|
||||
|
||||
public function tambahcm($data)
|
||||
{
|
||||
$this->db->insert('category_merchant', $data);
|
||||
}
|
||||
|
||||
public function hapuscm($id)
|
||||
{
|
||||
$this->db->where('id_kategori_merchant', $id);
|
||||
$this->db->delete('category_merchant');
|
||||
}
|
||||
|
||||
public function ubahcm($data, $id)
|
||||
{
|
||||
$this->db->set('nama_kategori', $data['nama_kategori']);
|
||||
$this->db->set('id_fitur', $data['id_fitur']);
|
||||
$this->db->set('status_kategori', $data['status_kategori']);
|
||||
$this->db->where('id_kategori_merchant', $id);
|
||||
$this->db->update('category_merchant');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,312 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Dashboard_model extends CI_model
|
||||
{
|
||||
public function getAlltransaksi()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function getAlltransaksi1()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->where('driver.wilayah = 1');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function getAlltransaksi3()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->where('driver.wilayah = 3');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getSuksestransaksi()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->where('history_transaksi.status != 5');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getSuksestransaksi1()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->where('history_transaksi.status != 5');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->where('driver.wilayah = 1');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function getSuksestransaksi3()
|
||||
{
|
||||
$this->db->select('transaksi.*,' . 'driver.nama_driver,' . 'pelanggan.fullnama,' . 'history_transaksi.*,' . 'status_transaksi.*,' . 'fitur.fitur');
|
||||
$this->db->from('transaksi');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->where('history_transaksi.status != 5');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->where('driver.wilayah = 3');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
|
||||
function getTotalTransaksiBulanan($bulan, $tahun, $typefitur)
|
||||
{
|
||||
// lihat tranasksi tanpa limit 15
|
||||
$query = $this->db->query("
|
||||
SELECT COUNT(transaksi.id) as jumlah
|
||||
FROM transaksi
|
||||
left join fitur on transaksi.order_fitur = fitur.id_fitur
|
||||
left join history_transaksi on transaksi.id = history_transaksi.id_transaksi
|
||||
|
||||
WHERE MONTH(waktu_selesai) = $bulan
|
||||
AND YEAR(waktu_selesai) = $tahun
|
||||
AND fitur.home = $typefitur
|
||||
AND history_transaksi.status = 4
|
||||
");
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
public function getbydate()
|
||||
{
|
||||
$day = date('d');
|
||||
$month = date('m');
|
||||
$year = date('Y');
|
||||
$this->db->select('fitur.fitur');
|
||||
$this->db->select("
|
||||
(SELECT COUNT(tr.id)
|
||||
FROM transaksi tr
|
||||
left join history_transaksi on tr.id = history_transaksi.id_transaksi
|
||||
WHERE DAY(tr.waktu_selesai) = $day
|
||||
AND tr.order_fitur = fitur.id_fitur
|
||||
AND history_transaksi.status = 4) as hari
|
||||
");
|
||||
$this->db->select("
|
||||
(SELECT COUNT(tr.id)
|
||||
FROM transaksi tr
|
||||
left join history_transaksi on tr.id = history_transaksi.id_transaksi
|
||||
WHERE MONTH(tr.waktu_selesai) = $month
|
||||
AND tr.order_fitur = fitur.id_fitur
|
||||
AND history_transaksi.status = 4) as bulan
|
||||
");
|
||||
$this->db->select("
|
||||
(SELECT COUNT(tr.id)
|
||||
FROM transaksi tr
|
||||
left join history_transaksi on tr.id = history_transaksi.id_transaksi
|
||||
WHERE YEAR(tr.waktu_selesai) = $year
|
||||
AND tr.order_fitur = fitur.id_fitur
|
||||
AND history_transaksi.status = 4) as tahun
|
||||
");
|
||||
$this->db->from('fitur');
|
||||
return $this->db->get()->result_array();
|
||||
|
||||
}
|
||||
|
||||
function getTotalTransaksiharian($hari, $fitur)
|
||||
{
|
||||
// lihat tranasksi tanpa limit 15
|
||||
$query = $this->db->query("
|
||||
SELECT COUNT(transaksi.id) as jumlah
|
||||
FROM transaksi
|
||||
left join history_transaksi on transaksi.id = history_transaksi.id_transaksi
|
||||
|
||||
WHERE DAY(waktu_selesai) = $hari
|
||||
AND history_transaksi.status = 4
|
||||
");
|
||||
return $query->result_array();
|
||||
}
|
||||
|
||||
public function getallsaldo()
|
||||
{
|
||||
$this->db->select('SUM(biaya_akhir)as total');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->where('history_transaksi.status = 4');
|
||||
return $this->db->get('transaksi')->row_array();
|
||||
}
|
||||
public function getallsaldo1()
|
||||
{
|
||||
$this->db->select('SUM(biaya_akhir)as total');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->where('history_transaksi.status = 4');
|
||||
$this->db->where('driver.wilayah = 1');
|
||||
return $this->db->get('transaksi')->row_array();
|
||||
}
|
||||
public function getallsaldo3()
|
||||
{
|
||||
$this->db->select('SUM(biaya_akhir)as total');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('partner_region', 'driver.wilayah = partner_region.id', 'left');
|
||||
$this->db->where('history_transaksi.status = 4');
|
||||
$this->db->where('driver.wilayah = 3');
|
||||
return $this->db->get('transaksi')->row_array();
|
||||
}
|
||||
|
||||
public function getAllfitur()
|
||||
{
|
||||
return $this->db->get('fitur')->result_array();
|
||||
}
|
||||
|
||||
public function gettransaksibyid($id)
|
||||
{
|
||||
$this->db->select('merchant.*');
|
||||
$this->db->select('transaksi_detail_merchant.total_biaya as total_belanja');
|
||||
$this->db->select('transaksi_detail_send.*');
|
||||
$this->db->select('history_transaksi.*');
|
||||
$this->db->select('status_transaksi.*');
|
||||
$this->db->select('voucher.*');
|
||||
$this->db->select('fitur.*');
|
||||
$this->db->select('rating_driver.*');
|
||||
$this->db->select('pelanggan.fullnama,pelanggan.email as email_pelanggan,pelanggan.no_telepon as telepon_pelanggan,pelanggan.fotopelanggan,pelanggan.token');
|
||||
$this->db->select('driver.nama_driver,driver.foto,driver.email,driver.no_telepon,driver.reg_id');
|
||||
$this->db->select('transaksi.*');
|
||||
|
||||
$this->db->join('transaksi_detail_merchant', 'transaksi.id = transaksi_detail_merchant.id_transaksi', 'left');
|
||||
$this->db->join('merchant', 'transaksi_detail_merchant.id_merchant = merchant.id_merchant', 'left');
|
||||
$this->db->join('transaksi_detail_send', 'transaksi.id = transaksi_detail_send.id_transaksi', 'left');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('voucher', 'transaksi.order_fitur = voucher.untuk_fitur', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->join('rating_driver', 'transaksi.id = rating_driver.id_transaksi', 'left');
|
||||
$this->db->join('driver', 'transaksi.id_driver = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
return $this->db->get_where('transaksi', ['transaksi.id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function getitem($id)
|
||||
{
|
||||
$this->db->where("transaksi_item.id_transaksi = $id");
|
||||
$this->db->join('item', 'transaksi_item.id_item = item.id_item', 'left');
|
||||
return $this->db->get('transaksi_item')->result_array();
|
||||
}
|
||||
|
||||
public function ubahstatustransaksibyid($id)
|
||||
{
|
||||
$this->db->set('status', 5);
|
||||
$this->db->where('id_transaksi', $id);
|
||||
$this->db->update('history_transaksi');
|
||||
}
|
||||
|
||||
public function ubahstatusdriverbyid($id_driver)
|
||||
{
|
||||
$this->db->set('status', 4);
|
||||
$this->db->where('id_driver', $id_driver);
|
||||
$this->db->update('config_driver');
|
||||
}
|
||||
|
||||
public function deletetransaksi($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('transaksi');
|
||||
|
||||
$this->db->where('id_transaksi', $id);
|
||||
$this->db->delete('history_transaksi');
|
||||
|
||||
$this->db->where('id_transaksi', $id);
|
||||
$this->db->delete('rating_driver');
|
||||
|
||||
$this->db->where('id_transaksi', $id);
|
||||
$this->db->delete('transaksi_detail_send');
|
||||
}
|
||||
|
||||
public function countdriver0()
|
||||
{
|
||||
|
||||
$this->db->where('status != 0');
|
||||
return $this->db->get('driver')->result_array();
|
||||
}
|
||||
|
||||
public function countdriver()
|
||||
{
|
||||
$this->db->where('wilayah = 1');
|
||||
$this->db->where('status != 0');
|
||||
return $this->db->get('driver')->result_array();
|
||||
}
|
||||
|
||||
public function countdriver3()
|
||||
{
|
||||
$this->db->where('wilayah = 3');
|
||||
$this->db->where('status != 0');
|
||||
return $this->db->get('driver')->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function countmitra0()
|
||||
{
|
||||
$this->db->where('status_mitra != 0');
|
||||
return $this->db->get('mitra')->result_array();
|
||||
}
|
||||
public function countmitra()
|
||||
{
|
||||
$this->db->where('wilayah = 1');
|
||||
$this->db->where('status_mitra != 0');
|
||||
return $this->db->get('mitra')->result_array();
|
||||
}
|
||||
public function countmitra3()
|
||||
{
|
||||
$this->db->where('wilayah = 3');
|
||||
$this->db->where('status_mitra != 0');
|
||||
return $this->db->get('mitra')->result_array();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,284 @@
|
||||
<?php
|
||||
|
||||
|
||||
class email_model extends CI_model
|
||||
{
|
||||
function emailsend($subject, $emailuser, $content, $host, $port, $username, $password, $from, $appname, $secure)
|
||||
{
|
||||
require APPPATH . '/libraries/class.phpmailer.php';
|
||||
$mail = new PHPMailer;
|
||||
$mail->IsSMTP();
|
||||
$mail->SMTPSecure = $secure;
|
||||
$mail->Host = $host; //host masing2 provider email
|
||||
$mail->SMTPDebug = 0;
|
||||
$mail->Port = $port;
|
||||
$mail->SMTPAuth = true;
|
||||
$mail->Username = $username; //user email
|
||||
$mail->Password = $password; //password email
|
||||
$mail->SetFrom($from, $appname); //set email pengirim
|
||||
$mail->Subject = $subject; //subyek email
|
||||
$mail->AddAddress($emailuser, "User"); //tujuan email
|
||||
$mail->MsgHTML($content); //pesan dapat berupa html
|
||||
$mail->Send();
|
||||
return true;
|
||||
var_dump($content);
|
||||
die();
|
||||
}
|
||||
|
||||
function template2($subject, $emailmessage, $address, $appname, $linkgoogle, $web)
|
||||
{
|
||||
|
||||
$msg = '<html xmlns="http://www.w3.org/1999/xhtml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">
|
||||
<head>
|
||||
<!--[if gte mso 9]><xml><o:OfficeDocumentSettings><o:AllowPNG/><o:PixelsPerInch>96</o:PixelsPerInch></o:OfficeDocumentSettings></xml><![endif]-->
|
||||
<meta content="text/html; charset=utf-8" http-equiv="Content-Type"/>
|
||||
<meta content="width=device-width" name="viewport"/>
|
||||
<!--[if !mso]><!-->
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible"/>
|
||||
<!--<![endif]-->
|
||||
<title></title>
|
||||
<!--[if !mso]><!-->
|
||||
<!--<![endif]-->
|
||||
<style type="text/css">
|
||||
body {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
table,
|
||||
td,
|
||||
tr {
|
||||
vertical-align: top;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
* {
|
||||
line-height: inherit;
|
||||
}
|
||||
|
||||
a[x-apple-data-detectors=true] {
|
||||
color: inherit !important;
|
||||
text-decoration: none !important;
|
||||
}
|
||||
</style>
|
||||
<style id="media-query" type="text/css">
|
||||
@media (max-width: 500px) {
|
||||
|
||||
.block-grid,
|
||||
.col {
|
||||
min-width: 320px !important;
|
||||
max-width: 100% !important;
|
||||
display: block !important;
|
||||
}
|
||||
|
||||
.block-grid {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.col {
|
||||
width: 100% !important;
|
||||
}
|
||||
|
||||
.col>div {
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
img.fullwidth,
|
||||
img.fullwidthOnMobile {
|
||||
max-width: 100% !important;
|
||||
}
|
||||
|
||||
.no-stack .col {
|
||||
min-width: 0 !important;
|
||||
display: table-cell !important;
|
||||
}
|
||||
|
||||
.no-stack.two-up .col {
|
||||
width: 50% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num4 {
|
||||
width: 33% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num8 {
|
||||
width: 66% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num4 {
|
||||
width: 33% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num3 {
|
||||
width: 25% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num6 {
|
||||
width: 50% !important;
|
||||
}
|
||||
|
||||
.no-stack .col.num9 {
|
||||
width: 75% !important;
|
||||
}
|
||||
|
||||
.video-block {
|
||||
max-width: none !important;
|
||||
}
|
||||
|
||||
.mobile_hide {
|
||||
min-height: 0px;
|
||||
max-height: 0px;
|
||||
max-width: 0px;
|
||||
display: none;
|
||||
overflow: hidden;
|
||||
font-size: 0px;
|
||||
}
|
||||
|
||||
.desktop_hide {
|
||||
display: block !important;
|
||||
max-height: none !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="clean-body" style="margin: 0; padding: 0; -webkit-text-size-adjust: 100%; background-color: #FFFFFF;">
|
||||
<!--[if IE]><div class="ie-browser"><![endif]-->
|
||||
<table bgcolor="#FFFFFF" cellpadding="0" cellspacing="0" class="nl-container" role="presentation" style="table-layout: fixed; vertical-align: top; min-width: 320px; Margin: 0 auto; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; background-color: #FFFFFF; width: 100%;" valign="top" width="100%">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top;" valign="top">
|
||||
<td style="word-break: break-word; vertical-align: top;" valign="top">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" style="background-color:#FFFFFF"><![endif]-->
|
||||
<div style="background-color:transparent;">
|
||||
<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
|
||||
<!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
|
||||
<div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">
|
||||
<div style="width:100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
|
||||
<!--<![endif]-->
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->
|
||||
<div style="color:#555555;font-family:Arial, Helvetica Neue, Helvetica, sans-serif;line-height:1.2;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
|
||||
<div style="line-height: 1.2; font-size: 12px; color: #555555; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; mso-line-height-alt: 14px;">
|
||||
<p style="font-size: 28px; line-height: 1.2; word-break: break-word; mso-line-height-alt: 34px; margin: 0;"><span style="font-size: 28px;"><strong>' . $subject . '</strong></span></p>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
<table border="0" cellpadding="0" cellspacing="0" class="divider" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top" width="100%">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top;" valign="top">
|
||||
<td class="divider_inner" style="word-break: break-word; vertical-align: top; min-width: 100%; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; padding-top: 10px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px;" valign="top">
|
||||
<table align="left" border="0" cellpadding="0" cellspacing="0" class="divider_content" role="presentation" style="table-layout: fixed; vertical-align: top; border-spacing: 0; border-collapse: collapse; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border-top: 8px solid #6DC0FF; width: 70%;" valign="top" width="70%">
|
||||
<tbody>
|
||||
<tr style="vertical-align: top;" valign="top">
|
||||
<td style="word-break: break-word; vertical-align: top; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;" valign="top"><span></span></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->
|
||||
<div style="color:#555555;font-family:Arial, Helvetica Neue, Helvetica, sans-serif;line-height:1.2;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
|
||||
<div style="line-height: 1.2; font-size: 12px; color: #555555; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; mso-line-height-alt: 14px;">
|
||||
<p style="font-size: 14px; line-height: 1.2; word-break: break-word; mso-line-height-alt: 17px; margin: 0;">' . $emailmessage . '</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background-color:transparent;">
|
||||
<div class="block-grid two-up" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
|
||||
<!--[if (mso)|(IE)]><td align="center" width="240" style="background-color:transparent;width:240px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
|
||||
<div class="col num6" style="max-width: 320px; min-width: 240px; display: table-cell; vertical-align: top; width: 240px;">
|
||||
<div style="width:100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
|
||||
<!--<![endif]-->
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 15px; padding-left: 15px; padding-top: 30px; padding-bottom: 30px; font-family: Arial, sans-serif"><![endif]-->
|
||||
<div style="color:#555555;font-family:Arial, Helvetica Neue, Helvetica, sans-serif;line-height:1.2;padding-top:30px;padding-right:15px;padding-bottom:30px;padding-left:15px;">
|
||||
<div style="line-height: 1.2; font-size: 12px; color: #555555; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; mso-line-height-alt: 14px;">
|
||||
<p style="font-size: 14px; line-height: 1.2; word-break: break-word; mso-line-height-alt: 17px; margin: 0;">' . $address . '</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
<!--[if (mso)|(IE)]></td><td align="center" width="240" style="background-color:transparent;width:240px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
|
||||
<div class="col num6" style="max-width: 320px; min-width: 240px; display: table-cell; vertical-align: top; width: 240px;">
|
||||
<div style="width:100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
|
||||
<!--<![endif]-->
|
||||
<div align="center" class="img-container center fixedwidth" style="padding-right: 0px;padding-left: 0px;">
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="padding-right: 0px;padding-left: 0px;" align="center"><![endif]--><a href="' . $linkgoogle . '" style="outline:none" tabindex="-1" target="_blank"> <img align="center" alt="Alternate text" border="0" class="center fixedwidth" src="https://learn.karinesia.com/iklan/delip.gif" style="text-decoration: none; -ms-interpolation-mode: bicubic; height: auto; border: none; width: 100%; max-width: 240px; display: block;" title="Alternate text" width="240"/></a>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
</div>
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="background-color:transparent;">
|
||||
<div class="block-grid" style="Margin: 0 auto; min-width: 320px; max-width: 480px; overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; background-color: transparent;">
|
||||
<div style="border-collapse: collapse;display: table;width: 100%;background-color:transparent;">
|
||||
<!--[if (mso)|(IE)]><table width="100%" cellpadding="0" cellspacing="0" border="0" style="background-color:transparent;"><tr><td align="center"><table cellpadding="0" cellspacing="0" border="0" style="width:480px"><tr class="layout-full-width" style="background-color:transparent"><![endif]-->
|
||||
<!--[if (mso)|(IE)]><td align="center" width="480" style="background-color:transparent;width:480px; border-top: 0px solid transparent; border-left: 0px solid transparent; border-bottom: 0px solid transparent; border-right: 0px solid transparent;" valign="top"><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 0px; padding-left: 0px; padding-top:5px; padding-bottom:5px;"><![endif]-->
|
||||
<div class="col num12" style="min-width: 320px; max-width: 480px; display: table-cell; vertical-align: top; width: 480px;">
|
||||
<div style="width:100% !important;">
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
<div style="border-top:0px solid transparent; border-left:0px solid transparent; border-bottom:0px solid transparent; border-right:0px solid transparent; padding-top:5px; padding-bottom:5px; padding-right: 0px; padding-left: 0px;">
|
||||
<!--<![endif]-->
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr><td style="padding-right: 10px; padding-left: 10px; padding-top: 10px; padding-bottom: 10px; font-family: Arial, sans-serif"><![endif]-->
|
||||
<div style="color:#555555;font-family:Arial, Helvetica Neue, Helvetica, sans-serif;line-height:1.2;padding-top:10px;padding-right:10px;padding-bottom:10px;padding-left:10px;">
|
||||
<div style="line-height: 1.2; font-size: 12px; color: #555555; font-family: Arial, Helvetica Neue, Helvetica, sans-serif; mso-line-height-alt: 14px;">
|
||||
<p style="font-size: 14px; line-height: 1.2; word-break: break-word; text-align: center; mso-line-height-alt: 17px; margin: 0;">Copyright © 2020 <a href="' . $web . '" rel="noopener" style="text-decoration: underline; color: #0068A5;" target="_blank">' . $appname . '</a>. All Rights Reserved</p>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
<div align="center" class="img-container center fixedwidth" style="padding-right: 0px;padding-left: 0px;">
|
||||
<!--[if mso]><table width="100%" cellpadding="0" cellspacing="0" border="0"><tr style="line-height:0px"><td style="padding-right: 0px;padding-left: 0px;" align="center"><![endif]--><a href="' . $web . '" style="outline:none" tabindex="-1" target="_blank"> </a>
|
||||
<!--[if mso]></td></tr></table><![endif]-->
|
||||
</div>
|
||||
<!--[if (!mso)&(!IE)]><!-->
|
||||
</div>
|
||||
<!--<![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
<!--[if (mso)|(IE)]></td></tr></table></td></tr></table><![endif]-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!--[if (mso)|(IE)]></td></tr></table><![endif]-->
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--[if (IE)]></div><![endif]-->
|
||||
</body>
|
||||
</html>';
|
||||
return $msg;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
class login_model extends CI_Model
|
||||
{
|
||||
function cek_login($where)
|
||||
{
|
||||
return $this->db->get_where('admin', $where)->row_array();
|
||||
}
|
||||
|
||||
function ambil_menu($data)
|
||||
{
|
||||
// $this->db->where('id_role', $data['admin_role']);
|
||||
// return $this->db->get('admin_menu_role')->result_array();
|
||||
|
||||
$this->db->select('amr.*, ap.nama_fitur, ap.url,ap.nama_fitur,ap.urut,ap.foregn,ap.nama_fitur,ap.icon');
|
||||
$this->db->from('admin_menu_role amr');
|
||||
$this->db->join('admin_privilage ap', 'ap.id = amr.id_privilage', 'left');
|
||||
$this->db->where('amr.id_role', $data['admin_role']);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,403 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Merchantapi_model extends CI_model
|
||||
{
|
||||
|
||||
public function check_banned($phone)
|
||||
{
|
||||
$stat = $this->db->query("SELECT id_mitra FROM mitra WHERE status_mitra='3' AND telepon_mitra='$phone'");
|
||||
if ($stat->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function check_exist($email, $phone)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where email_mitra = '$email' AND telepon_mitra='$phone'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function check_exist_phone($phone)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where telepon_mitra='$phone'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public function check_exist_email($email)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where email_mitra='$email'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function check_ktp($ktp)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where nomor_identitas_mitra='$ktp'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function get_partner_region()
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('partner_region');
|
||||
$this->db->where('status_region', '1');
|
||||
return $this->db->get()->result();
|
||||
}
|
||||
|
||||
|
||||
|
||||
public function get_data_merchant($condition)
|
||||
{
|
||||
$this->db->select('mitra.*, saldo.saldo, merchant.*');
|
||||
$this->db->from('mitra');
|
||||
$this->db->join('saldo', 'mitra.id_mitra = saldo.id_user');
|
||||
$this->db->join('merchant', 'mitra.id_merchant = merchant.id_merchant');
|
||||
$this->db->where($condition);
|
||||
$this->db->where('status_mitra', '1');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function onmerchant($data, $where)
|
||||
{
|
||||
$this->db->where($where);
|
||||
$this->db->update('merchant', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function edit_profile_token($data, $phone)
|
||||
{
|
||||
$this->db->where('telepon_merchant', $phone);
|
||||
$this->db->update('merchant', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function edit_profile($data, $phone)
|
||||
{
|
||||
$this->db->where('telepon_mitra', $phone);
|
||||
$this->db->update('mitra', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function edit_profile_mitra_merchant($data, $phone)
|
||||
{
|
||||
$datamitra = [
|
||||
'nama_mitra' => $data['nama'],
|
||||
'telepon_mitra' => $data['no_telepon'],
|
||||
'phone_mitra' => $data['phone'],
|
||||
'email_mitra' => $data['email'],
|
||||
'bank' => $data['bank'],
|
||||
'norek_mitra' => $data['norek_mitra'],
|
||||
'nama_rekening' => $data['nama_rekening'],
|
||||
'country_code_mitra' => $data['countrycode'],
|
||||
'alamat_mitra' => $data['alamat']
|
||||
];
|
||||
|
||||
$datamerchant = [
|
||||
'telepon_merchant' => $data['no_telepon'],
|
||||
'phone_merchant' => $data['phone'],
|
||||
'country_code_merchant' => $data['countrycode']
|
||||
];
|
||||
|
||||
$this->db->where('telepon_merchant', $phone);
|
||||
$this->db->update('merchant', $datamerchant);
|
||||
|
||||
$this->db->where('telepon_mitra', $phone);
|
||||
$this->db->update('mitra', $datamitra);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function signup($data_signup, $data_merchant, $data_berkas)
|
||||
{
|
||||
$this->db->insert('merchant', $data_merchant);
|
||||
$inserid = $this->db->insert_id();
|
||||
$datasignup = array(
|
||||
'id_mitra' => $data_signup['id_mitra'],
|
||||
'nama_mitra' => $data_signup['nama_mitra'],
|
||||
'jenis_identitas_mitra' => $data_signup['jenis_identitas_mitra'],
|
||||
'nomor_identitas_mitra' => $data_signup['nomor_identitas_mitra'],
|
||||
'alamat_mitra' => $data_signup['alamat_mitra'],
|
||||
'email_mitra' => $data_signup['email_mitra'],
|
||||
'bank' => $data_signup['bank'],
|
||||
'norek_mitra' => $data_signup['norek_mitra'],
|
||||
'nama_rekening' => $data_signup['nama_rekening'],
|
||||
'password' => $data_signup['password'],
|
||||
'telepon_mitra' => $data_signup['telepon_mitra'],
|
||||
'phone_mitra' => $data_signup['phone_mitra'],
|
||||
'partner_region' => $data_signup['partner_region'],
|
||||
'country_code_mitra' => $data_signup['country_code_mitra'],
|
||||
'partner' => '0',
|
||||
'id_merchant' => $inserid,
|
||||
'status_mitra' => '0'
|
||||
);
|
||||
$signup = $this->db->insert('mitra', $datasignup);
|
||||
|
||||
$databerkas = array(
|
||||
'id_driver' => $data_signup['id_mitra'],
|
||||
'foto_ktp' => $data_berkas['foto_ktp'],
|
||||
'foto_sim' => "",
|
||||
'id_sim' => ""
|
||||
);
|
||||
$insberkas = $this->db->insert('berkas_driver', $databerkas);
|
||||
|
||||
$datasaldo = array(
|
||||
'id_user' => $data_signup['id_mitra'],
|
||||
'saldo' => 0
|
||||
);
|
||||
$insSaldo = $this->db->insert('saldo', $datasaldo);
|
||||
return $signup;
|
||||
}
|
||||
|
||||
public function transaksi_home($idmerchant)
|
||||
{
|
||||
$this->db->select('transaksi_detail_merchant.*, history_transaksi.*, transaksi.id_pelanggan, pelanggan.fullnama, (SELECT SUM(ti.jumlah_item)
|
||||
FROM transaksi_item ti
|
||||
WHERE ti.id_transaksi = transaksi_detail_merchant.id_transaksi) quantity, pelanggan.fullnama');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('transaksi', 'transaksi_detail_merchant.id_transaksi = transaksi.id');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id');
|
||||
$this->db->where('transaksi_detail_merchant.id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status = 2');
|
||||
$this->db->order_by('transaksi.id DESC');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function transaksi_history($idmerchant)
|
||||
{
|
||||
$this->db->select('transaksi_detail_merchant.*, history_transaksi.*, transaksi.id_pelanggan, pelanggan.fullnama, (SELECT SUM(ti.jumlah_item)
|
||||
FROM transaksi_item ti
|
||||
WHERE ti.id_transaksi = transaksi_detail_merchant.id_transaksi) quantity');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('transaksi', 'transaksi_detail_merchant.id_transaksi = transaksi.id');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id');
|
||||
$this->db->where('transaksi_detail_merchant.id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status != 2');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
$this->db->order_by('transaksi.id DESC');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function total_history_daily($day, $idmerchant)
|
||||
{
|
||||
$this->db->select('SUM(transaksi_detail_merchant.total_biaya) daily');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('history_transaksi', 'transaksi_detail_merchant.id_transaksi = history_transaksi.id_transaksi');
|
||||
$this->db->where('date(transaksi_detail_merchant.created)', $day);
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status', '4');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function total_history_earning($idmerchant)
|
||||
{
|
||||
$this->db->select('SUM(transaksi_detail_merchant.total_biaya) earning');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('history_transaksi', 'transaksi_detail_merchant.id_transaksi = history_transaksi.id_transaksi');
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status', '4');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function total_history_month($month, $idmerchant)
|
||||
{
|
||||
$this->db->select('SUM(transaksi_detail_merchant.total_biaya) month');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('history_transaksi', 'transaksi_detail_merchant.id_transaksi = history_transaksi.id_transaksi');
|
||||
$this->db->where('MONTH(transaksi_detail_merchant.created)', $month);
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status', '4');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function total_history_yearly($year, $idmerchant)
|
||||
{
|
||||
$this->db->select('SUM(transaksi_detail_merchant.total_biaya) yearly');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('history_transaksi', 'transaksi_detail_merchant.id_transaksi = history_transaksi.id_transaksi');
|
||||
$this->db->where('YEAR(transaksi_detail_merchant.created)', $year);
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->where('history_transaksi.status', '4');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function kategori_active($idmerchant)
|
||||
{
|
||||
$this->db->select('category_item.*, (SELECT COUNT(ti.id_item)
|
||||
FROM item ti
|
||||
WHERE ti.kategori_item = category_item.id_kategori_item) total_item');
|
||||
$this->db->from('category_item');
|
||||
$this->db->where('category_item.id_merchant', $idmerchant);
|
||||
$this->db->where('category_item.all_category != 1');
|
||||
$this->db->where('category_item.status_kategori = 1');
|
||||
return $this->db->get()->result();
|
||||
}
|
||||
public function kategori_nonactive($idmerchant)
|
||||
{
|
||||
$this->db->select('category_item.*, (SELECT COUNT(ti.id_item)
|
||||
FROM item ti
|
||||
WHERE ti.kategori_item = category_item.id_kategori_item) total_item');
|
||||
$this->db->from('category_item');
|
||||
$this->db->where('category_item.id_merchant', $idmerchant);
|
||||
$this->db->where('category_item.all_category != 1');
|
||||
$this->db->where('category_item.status_kategori = 0');
|
||||
return $this->db->get()->result();
|
||||
}
|
||||
|
||||
public function itembycatactive($idmerchant, $idcat)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('item');
|
||||
$this->db->where('item.id_merchant', $idmerchant);
|
||||
$this->db->where('item.kategori_item', $idcat);
|
||||
$this->db->order_by('item.id_item DESC');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function totalitemactive($idmerchant)
|
||||
{
|
||||
$this->db->select('COUNT(id_item) as active, (SELECT COUNT(ti.id_item)
|
||||
FROM item ti
|
||||
WHERE ti.id_merchant =' . $idmerchant . ' and ti.status_item = 0) as nonactive, (SELECT COUNT(ti.id_item)
|
||||
FROM item ti
|
||||
WHERE ti.id_merchant =' . $idmerchant . ' and ti.status_item = 1 and ti.status_promo = 1) as promo');
|
||||
$this->db->from('item');
|
||||
$this->db->where('item.id_merchant', $idmerchant);
|
||||
$this->db->where('item.status_item', '1');
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function actived_kategori($id, $status)
|
||||
{
|
||||
$data = array(
|
||||
'status_kategori' => $status
|
||||
);
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->update('category_item', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function actived_item($id, $status)
|
||||
{
|
||||
$data = array(
|
||||
'status_item' => $status
|
||||
);
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->update('item', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function addkategori($nama, $status, $id)
|
||||
{
|
||||
$data = array(
|
||||
'nama_kategori_item' => $nama,
|
||||
'status_kategori' => $status,
|
||||
'id_merchant' => $id,
|
||||
'all_category' => 0,
|
||||
);
|
||||
$this->db->insert('category_item', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function editkategori($editdata, $id)
|
||||
{
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->update('category_item', $editdata);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deletekategori($id)
|
||||
{
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->delete('category_item');
|
||||
|
||||
$this->db->where('kategori_item', $id);
|
||||
$this->db->delete('item');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function additem($data)
|
||||
{
|
||||
$this->db->insert('item', $data);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function edititem($editdata, $id)
|
||||
{
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->update('item', $editdata);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deleteitem($id)
|
||||
{
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->delete('item');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function check_exist_phone_edit($id, $phone)
|
||||
{
|
||||
$cek = $this->db->query("SELECT telepon_mitra FROM mitra where telepon_mitra='$phone' AND id_mitra!='$id'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function check_exist_email_edit($id, $email)
|
||||
{
|
||||
$cek = $this->db->query("SELECT id_mitra FROM mitra where email_mitra='$email' AND id_mitra!='$id'");
|
||||
if ($cek->num_rows() == 1) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function kategori_merchant_active()
|
||||
{
|
||||
$this->db->select('nama_kategori,id_kategori_merchant');
|
||||
$this->db->where('status_kategori != 0');
|
||||
return $this->db->get('category_merchant')->result_array();
|
||||
}
|
||||
|
||||
public function kategori_merchant_active_data($idfitur)
|
||||
{
|
||||
$this->db->select('nama_kategori,id_kategori_merchant');
|
||||
$this->db->where('status_kategori != 0');
|
||||
$this->db->where('id_fitur', $idfitur);
|
||||
return $this->db->get('category_merchant')->result_array();
|
||||
}
|
||||
|
||||
public function fitur_merchant_active()
|
||||
{
|
||||
$this->db->select('id_fitur,fitur');
|
||||
$this->db->from('fitur');
|
||||
$this->db->where('home = 4');
|
||||
$this->db->where('active', '1');
|
||||
$this->db->order_by('id_fitur ASC');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,294 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Mitra_model extends CI_model
|
||||
{
|
||||
|
||||
function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
public function getAllmitra()
|
||||
{
|
||||
$this->db->select('category_merchant.nama_kategori');
|
||||
$this->db->select('partner_region.partner_region');
|
||||
$this->db->select('fitur.fitur');
|
||||
$this->db->select('merchant.*');
|
||||
$this->db->select('mitra.*');
|
||||
$this->db->join('merchant', 'mitra.id_merchant = merchant.id_merchant', 'left');
|
||||
$this->db->join('category_merchant', 'merchant.category_merchant = category_merchant.id_kategori_merchant', 'left');
|
||||
$this->db->join('partner_region', 'mitra.wilayah = partner_region.id', 'left');
|
||||
$this->db->join('fitur', 'merchant.id_fitur = fitur.id_fitur', 'left');
|
||||
return $this->db->get('mitra')->result_array();
|
||||
}
|
||||
|
||||
public function getmitrabyid($id)
|
||||
{
|
||||
$this->db->select('berkas_driver.foto_ktp');
|
||||
$this->db->select('category_merchant.nama_kategori');
|
||||
$this->db->select('partner_region.partner_region');
|
||||
$this->db->select('fitur.fitur');
|
||||
$this->db->select('saldo.saldo');
|
||||
$this->db->select('merchant.*');
|
||||
$this->db->select('mitra.*');
|
||||
$this->db->join('berkas_driver', 'mitra.id_mitra = berkas_driver.id_driver', 'left');
|
||||
$this->db->join('saldo', 'mitra.id_mitra = saldo.id_user', 'left');
|
||||
$this->db->join('merchant', 'mitra.id_merchant = merchant.id_merchant', 'left');
|
||||
$this->db->join('fitur', 'merchant.id_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->join('category_merchant', 'merchant.category_merchant = category_merchant.id_kategori_merchant', 'left');
|
||||
$this->db->join('partner_region', 'mitra.wilayah = partner_region.id', 'left');
|
||||
return $this->db->get_where('mitra', ['mitra.id_mitra' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function countorder($id)
|
||||
{
|
||||
$this->db->select('id_merchant');
|
||||
$query = $this->db->get_where('transaksi_detail_merchant', ['id_merchant' => $id])->result_array();
|
||||
return count($query);
|
||||
}
|
||||
|
||||
public function wallet($id)
|
||||
{
|
||||
$this->db->order_by('wallet.id', 'DESC');
|
||||
return $this->db->get_where('wallet', ['id_user' => $id])->result_array();
|
||||
}
|
||||
|
||||
public function partner_region()
|
||||
{
|
||||
$this->db->from('partner_region');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function blockmitrabyid($id)
|
||||
{
|
||||
$this->db->set('status_mitra', 3);
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra');
|
||||
}
|
||||
|
||||
public function unblockmitrabyid($id)
|
||||
{
|
||||
$this->db->set('status_mitra', 1);
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra');
|
||||
}
|
||||
|
||||
public function get_trans_merchant($idtransaksi)
|
||||
{
|
||||
$this->db->select('mitra.*,transaksi_detail_merchant.id_merchant,transaksi_detail_merchant.total_biaya');
|
||||
$this->db->from('transaksi_detail_merchant');
|
||||
$this->db->join('mitra', 'transaksi_detail_merchant.id_merchant = mitra.id_merchant');
|
||||
$this->db->where('id_transaksi', $idtransaksi);
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function getitembyid($id)
|
||||
{
|
||||
$this->db->from('item');
|
||||
$this->db->where('id_merchant', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getitemkbyid($id)
|
||||
{
|
||||
$this->db->from('category_item');
|
||||
$this->db->where('id_merchant', $id);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function getmerchantk()
|
||||
{
|
||||
$this->db->from('category_merchant');
|
||||
$this->db->where('id_fitur != 0');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function insertitem($data)
|
||||
{
|
||||
return $this->db->insert('item', $data);
|
||||
}
|
||||
|
||||
public function updateitem($data, $id)
|
||||
{
|
||||
$this->db->set('kategori_item', $data['kategori_item']);
|
||||
$this->db->set('nama_item', $data['nama_item']);
|
||||
$this->db->set('harga_item', $data['harga_item']);
|
||||
$this->db->set('harga_promo', $data['harga_promo']);
|
||||
$this->db->set('id_merchant', $data['id_merchant']);
|
||||
$this->db->set('deskripsi_item', $data['deskripsi_item']);
|
||||
$this->db->set('status_item', $data['status_item']);
|
||||
$this->db->set('status_promo', $data['status_promo']);
|
||||
$this->db->set('foto_item', $data['foto_item']);
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->update('item');
|
||||
}
|
||||
|
||||
public function hapusitembyid($id)
|
||||
{
|
||||
$this->db->where('id_item', $id);
|
||||
$this->db->delete('item');
|
||||
}
|
||||
|
||||
public function getfotoitem($id)
|
||||
{
|
||||
|
||||
$this->db->where('id_item', $id);
|
||||
return $this->db->get('item')->row_array();
|
||||
}
|
||||
|
||||
public function getmerchantdetail($id)
|
||||
{
|
||||
$this->db->where('id_merchant', $id);
|
||||
return $this->db->get('merchant')->row_array();
|
||||
}
|
||||
|
||||
public function getidmitra($id)
|
||||
{
|
||||
|
||||
$this->db->where('id_merchant', $id);
|
||||
return $this->db->get('mitra')->row_array();
|
||||
}
|
||||
public function get_fitur_merchant()
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('fitur');
|
||||
$this->db->where('active', '1');
|
||||
$this->db->where('home', '4');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
|
||||
public function updatemerchant($data)
|
||||
{
|
||||
$idmerchant = $data['id_merchant'];
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->update('merchant', $data);
|
||||
}
|
||||
|
||||
public function hapuskategoryitembyId($id)
|
||||
{
|
||||
$this->db->where('kategori_item', $id);
|
||||
$this->db->delete('item');
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->delete('category_item');
|
||||
}
|
||||
|
||||
public function getidmitrabycategory($id)
|
||||
{
|
||||
$this->db->select('mitra.*');
|
||||
$this->db->join('mitra', 'category_item.id_merchant = mitra.id_merchant');
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
return $this->db->get('category_item')->row_array();
|
||||
}
|
||||
|
||||
public function tambahkategoryitembyid($data)
|
||||
{
|
||||
return $this->db->insert('category_item', $data);
|
||||
}
|
||||
|
||||
public function ubahkategoryitembyid($data, $id)
|
||||
{
|
||||
$this->db->set('nama_kategori_item', $data['nama_kategori_item']);
|
||||
$this->db->where('id_kategori_item', $id);
|
||||
$this->db->update('category_item');
|
||||
}
|
||||
|
||||
public function ubahmitrabyid($data, $idm)
|
||||
{
|
||||
|
||||
$this->db->where('id_mitra', $idm);
|
||||
$this->db->update('mitra', $data);
|
||||
}
|
||||
|
||||
public function ubahfilemitrabyid($data, $id)
|
||||
{
|
||||
$this->db->set('foto_ktp', $data['foto_ktp']);
|
||||
$this->db->where('id_driver', $id);
|
||||
$this->db->update('berkas_driver');
|
||||
|
||||
|
||||
$this->db->set('nomor_identitas_mitra', $data['nomor_identitas_mitra']);
|
||||
$this->db->set('jenis_identitas_mitra', $data['jenis_identitas_mitra']);
|
||||
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra');
|
||||
}
|
||||
|
||||
public function ubahpassmitrabyid($data, $idm)
|
||||
{
|
||||
$this->db->set('password', $data['password']);
|
||||
$this->db->where('id_mitra', $idm);
|
||||
$this->db->update('mitra');
|
||||
}
|
||||
|
||||
public function gettranshistory($id)
|
||||
{
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('transaksi_item.*');
|
||||
$this->db->select('transaksi.*');
|
||||
$this->db->select('transaksi_detail_merchant.*');
|
||||
|
||||
$this->db->join('transaksi_item', 'transaksi_detail_merchant.id_transaksi = transaksi_item.id_transaksi', 'left');
|
||||
$this->db->join('transaksi', 'transaksi_detail_merchant.id_transaksi = transaksi.id', 'left');
|
||||
$this->db->join('pelanggan', 'transaksi.id_pelanggan = pelanggan.id', 'left');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->where('history_transaksi.status != 0');
|
||||
return $this->db->get_where('transaksi_detail_merchant', "transaksi_detail_merchant.id_merchant = $id")->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function hapusmitrabyid($id)
|
||||
{
|
||||
|
||||
$this->db->where('id_user', $id);
|
||||
$this->db->delete('wallet');
|
||||
$this->db->where('id_user', $id);
|
||||
$this->db->delete('saldo');
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->delete('mitra');
|
||||
}
|
||||
|
||||
public function ubahstatusmitra($id)
|
||||
{
|
||||
|
||||
|
||||
$mitra = $this->getmitrabyid($id);
|
||||
$idmerchant = $mitra['id_merchant'];
|
||||
|
||||
$this->db->set('status_mitra', '1');
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra');
|
||||
|
||||
$this->db->set('status_merchant', '1');
|
||||
$this->db->where('id_merchant', $idmerchant);
|
||||
$this->db->update('merchant');
|
||||
}
|
||||
|
||||
public function insertmerchant($data)
|
||||
{
|
||||
$this->db->insert('merchant', $data);
|
||||
return $this->db->insert_id();
|
||||
}
|
||||
|
||||
public function tambahkanmitra($datamitra, $databerkas, $datasaldo)
|
||||
{
|
||||
$this->db->insert('mitra', $datamitra);
|
||||
$this->db->insert('berkas_driver', $databerkas);
|
||||
$this->db->insert('saldo', $datasaldo);
|
||||
}
|
||||
|
||||
public function getitembyiditem($id)
|
||||
{
|
||||
$this->db->from('item');
|
||||
$this->db->where('id_item', $id);
|
||||
return $this->db->get()->row_array();
|
||||
}
|
||||
|
||||
public function getberkasbyid($id)
|
||||
{
|
||||
$this->db->where('id_driver', $id);
|
||||
return $this->db->get('berkas_driver')->row_array();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
class News_model extends CI_model
|
||||
{
|
||||
public function getAllnews()
|
||||
{
|
||||
// $this->db->select('config_driver.status as status_job');
|
||||
// $this->db->select('driver_job.driver_job');
|
||||
// $this->db->select('driver.*');
|
||||
// $this->db->join('config_driver', 'driver.id = config_driver.id_driver', 'left');
|
||||
$this->db->join('kategori_news', 'berita.id_kategori = kategori_news.id_kategori_news', 'left');
|
||||
return $this->db->get('berita')->result_array();
|
||||
}
|
||||
|
||||
public function getallkategorinews()
|
||||
{
|
||||
return $this->db->get('kategori_news')->result_array();
|
||||
}
|
||||
|
||||
public function tambahdataberita($data)
|
||||
{
|
||||
return $this->db->insert('berita', $data);
|
||||
}
|
||||
|
||||
public function getnewsbyid($id)
|
||||
{
|
||||
return $this->db->get_where('berita', ['id_berita' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function hapuskategoribyId($id)
|
||||
{
|
||||
$this->db->where('id_kategori_news', $id);
|
||||
$this->db->delete('kategori_news');
|
||||
}
|
||||
public function hapusberitabyId($id)
|
||||
{
|
||||
$this->db->where('id_berita', $id);
|
||||
$this->db->delete('berita');
|
||||
}
|
||||
|
||||
public function ubahdataberita($data)
|
||||
{
|
||||
|
||||
$this->db->set('foto_berita', $data['foto_berita']);
|
||||
$this->db->set('title', $data['title']);
|
||||
$this->db->set('content', $data['content']);
|
||||
$this->db->set('id_kategori', $data['id_kategori']);
|
||||
$this->db->set('status_berita', $data['status_berita']);
|
||||
|
||||
$this->db->where('id_berita', $data['id_berita']);
|
||||
$this->db->update('berita', $data);
|
||||
}
|
||||
|
||||
public function tambahdatakategori($data)
|
||||
{
|
||||
$this->db->set('kategori', $data['kategori']);
|
||||
$this->db->insert('kategori_news', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
<?php
|
||||
|
||||
class notification_model extends CI_model
|
||||
{
|
||||
public function notif_cancel_user($id_driver, $id_transaksi, $token_user)
|
||||
{
|
||||
|
||||
$datanotif = array(
|
||||
'id_driver' => $id_driver,
|
||||
'id_transaksi' => $id_transaksi,
|
||||
'response' => '5',
|
||||
'type' => 1
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $datanotif,
|
||||
'to' => $token_user
|
||||
);
|
||||
$headers = array(
|
||||
"Content-Type: application/json",
|
||||
"Authorization: key=" . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function notif_cancel_driver($id_transaksi, $token_driver)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'id_transaksi' => $id_transaksi,
|
||||
'response' => '0',
|
||||
'type' => 1
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $data,
|
||||
'to' => $token_driver
|
||||
);
|
||||
|
||||
$headers = array(
|
||||
"Content-Type: application/json",
|
||||
'Authorization: key=' . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
public function send_notif($title, $message, $topic)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'title' => $title,
|
||||
'message' => $message,
|
||||
'type' => 4
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $data,
|
||||
'to' => '/topics/' . $topic
|
||||
);
|
||||
|
||||
$headers = array(
|
||||
'Content-Type : application/json',
|
||||
'Authorization: key=' . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
public function send_notif_topup($title, $id, $message, $method, $token)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'title' => $title,
|
||||
'id' => $id,
|
||||
'message' => $message,
|
||||
'method' => $method,
|
||||
'type' => 3
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $data,
|
||||
'to' => $token
|
||||
|
||||
);
|
||||
|
||||
$headers = array(
|
||||
'Content-Type : application/json',
|
||||
'Authorization: key=' . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class partnerregion_model extends CI_model
|
||||
{
|
||||
public function getAllpartnerregion()
|
||||
{
|
||||
return $this->db->get('partner_region')->result_array();
|
||||
}
|
||||
|
||||
public function addpartnerregion($data)
|
||||
{
|
||||
$this->db->insert('partner_region', $data);
|
||||
}
|
||||
|
||||
public function getpartnerregionbyid($id)
|
||||
{
|
||||
return $this->db->get_where('partner_region', ['id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function editdatapartnerregion($data)
|
||||
{
|
||||
|
||||
$this->db->set('nama_cabang', $data['nama_cabang']);
|
||||
$this->db->set('partner_region', $data['partner_region']);
|
||||
$this->db->set('status_region', $data['status_region']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
return $this->db->update('partner_region', $data);
|
||||
}
|
||||
|
||||
public function deletepartnerregionbyId($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('partner_region');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
class partnerjob_model extends CI_model
|
||||
{
|
||||
public function getAllpartnerjob()
|
||||
{
|
||||
return $this->db->get('driver_job')->result_array();
|
||||
}
|
||||
|
||||
public function addpartnerjob($data)
|
||||
{
|
||||
$this->db->insert('driver_job', $data);
|
||||
}
|
||||
|
||||
public function getpartnerjobbyid($id)
|
||||
{
|
||||
return $this->db->get_where('driver_job', ['id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function editdatapartnerjob($data)
|
||||
{
|
||||
|
||||
$this->db->set('icon', $data['icon']);
|
||||
$this->db->set('driver_job', $data['driver_job']);
|
||||
$this->db->set('status_job', $data['status_job']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
return $this->db->update('driver_job', $data);
|
||||
}
|
||||
|
||||
public function deletepartnerjobbyId($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('driver_job');
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
|
||||
class Profile_model extends CI_model
|
||||
{
|
||||
|
||||
public function getRole()
|
||||
{
|
||||
return $this->db->get('admin_role')->result_array();
|
||||
}
|
||||
public function getRole1()
|
||||
{
|
||||
$this->db->select('admin_role.*');
|
||||
$this->db->from('admin_role');
|
||||
$this->db->where('admin_role.id != 1');
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function tambahadmin($data)
|
||||
{
|
||||
$this->db->insert('admin', $data);
|
||||
}
|
||||
|
||||
public function unblockuserbyid($id)
|
||||
{
|
||||
$this->db->set('status', 1);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('admin');
|
||||
}
|
||||
public function blockuserbyid($id)
|
||||
{
|
||||
$this->db->set('status', 0);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('admin');
|
||||
}
|
||||
public function getadmingedit($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->get('admin')->row_array();
|
||||
}
|
||||
public function ubahdataadmin($data)
|
||||
{
|
||||
$this->db->set('user_name', $data['user_name']);
|
||||
$this->db->set('nama',$data['nama']);
|
||||
$this->db->set('email', $data['email']);
|
||||
$this->db->set('image', $data['image']);
|
||||
$this->db->set('password', $data['password']);
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('admin', $data);
|
||||
}
|
||||
|
||||
public function hapus_pengguna($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('admin');
|
||||
}
|
||||
public function getadmin()
|
||||
{
|
||||
|
||||
$this->db->select('adm.*, ar.nama_role');
|
||||
$this->db->select('adm.*, rg.partner_region');
|
||||
$this->db->from('admin adm');
|
||||
$this->db->join('admin_role ar', 'ar.id = adm.admin_role', 'left');
|
||||
$this->db->join('partner_region rg', 'rg.id = adm.wilayah', 'left');
|
||||
// $this->db->where('amr.id_role', $data['admin_role']);
|
||||
return $this->db->get()->result_array();
|
||||
// return $this->db->get('admin')->result_array();
|
||||
}
|
||||
public function getadminRole()
|
||||
{
|
||||
return $this->db->get('admin_role')->result_array();
|
||||
}
|
||||
|
||||
public function getRegion()
|
||||
{
|
||||
return $this->db->get('partner_region')->result_array();
|
||||
}
|
||||
public function tambahrole($data)
|
||||
{
|
||||
$this->db->insert('admin_role', $data);
|
||||
}
|
||||
|
||||
public function getadminrolegedit($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->get('admin_role')->row_array();
|
||||
}
|
||||
|
||||
public function editrole($data)
|
||||
{
|
||||
$this->db->set('nama_role', $data['nama_role']);
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('admin_role', $data);
|
||||
}
|
||||
|
||||
|
||||
public function getadminRolePrivilage()
|
||||
{
|
||||
return $this->db->get('admin_privilage')->result_array();
|
||||
}
|
||||
|
||||
public function getmenuSubPrifilage()
|
||||
{
|
||||
$url = 'Not';
|
||||
// $this->db->where('menu_utama',$url);
|
||||
// return $this->db->get('admin_privilage')->row_array();
|
||||
$this->db->select('adm.id as id_adm_pri, adm.nama_fitur');
|
||||
$this->db->from('admin_privilage adm');
|
||||
$this->db->where('adm.url', $url);
|
||||
return $this->db->get()->result_array();
|
||||
}
|
||||
public function tambahprifilage($data)
|
||||
{
|
||||
$this->db->insert('admin_privilage', $data);
|
||||
}
|
||||
|
||||
public function getadminPrifilagedit($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->get('admin_privilage')->row_array();
|
||||
}
|
||||
|
||||
public function editprifilage($data)
|
||||
{
|
||||
$this->db->set('url', $data['url']);
|
||||
$this->db->set('nama_fitur', $data['nama_fitur']);
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('admin_privilage', $data);
|
||||
}
|
||||
public function editprifilageSub($data)
|
||||
{
|
||||
$this->db->set('foregn', $data['foregn']);
|
||||
$this->db->set('url', $data['url']);
|
||||
$this->db->set('nama_fitur', $data['nama_fitur']);
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('admin_privilage', $data);
|
||||
}
|
||||
|
||||
|
||||
public function getmenuPrifilage($id)
|
||||
{
|
||||
$this->db->where('id_role',$id);
|
||||
return $this->db->get('admin_menu_role')->result_array();
|
||||
}
|
||||
|
||||
public function deledemenurolprifilage($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('admin_menu_role');
|
||||
}
|
||||
public function tambahmenurolprifilage($data)
|
||||
{
|
||||
$this->db->insert('admin_menu_role', $data);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
class promocode_model extends CI_model
|
||||
{
|
||||
public function getAllpromocode()
|
||||
{
|
||||
$this->db->join('fitur', 'kodepromo.fitur = fitur.id_fitur', 'left');
|
||||
return $this->db->get('kodepromo')->result_array();
|
||||
}
|
||||
|
||||
public function getpromocodebyid($id)
|
||||
{
|
||||
return $this->db->get_where('kodepromo', ['id_promo' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function hapuspromocodebyId($id)
|
||||
{
|
||||
$this->db->where('id_promo', $id);
|
||||
$this->db->delete('kodepromo');
|
||||
}
|
||||
|
||||
public function addpromocode($data)
|
||||
{
|
||||
return $this->db->insert('kodepromo', $data);
|
||||
}
|
||||
|
||||
public function cekpromo($code)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('kodepromo');
|
||||
$this->db->where('kode_promo',$code);
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function getpromobyid($id)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->from('kodepromo');
|
||||
$this->db->where('id_promo',$id);
|
||||
return $this->db->get();
|
||||
}
|
||||
|
||||
public function editpromocode($data)
|
||||
{
|
||||
$this->db->where('id_promo', $data['id_promo']);
|
||||
return $this->db->update('kodepromo', $data);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
class promoslider_model extends CI_model
|
||||
{
|
||||
public function getAllpromo()
|
||||
{
|
||||
// $this->db->select('config_driver.status as status_job');
|
||||
// $this->db->select('driver_job.driver_job');
|
||||
// $this->db->select('driver.*');
|
||||
// $this->db->join('config_driver', 'driver.id = config_driver.id_driver', 'left');
|
||||
$this->db->join('fitur', 'promosi.fitur_promosi = fitur.id_fitur', 'left');
|
||||
return $this->db->get('promosi')->result_array();
|
||||
}
|
||||
|
||||
public function getpromobyid($id)
|
||||
{
|
||||
return $this->db->get_where('promosi', ['id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function tambahdatapromo($data)
|
||||
{
|
||||
return $this->db->insert('promosi', $data);
|
||||
}
|
||||
|
||||
public function hapuspromobyId($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('promosi');
|
||||
}
|
||||
|
||||
public function ubahdatapromo($data)
|
||||
{
|
||||
|
||||
$this->db->set('foto', $data['foto']);
|
||||
$this->db->set('tanggal_berakhir', $data['tanggal_berakhir']);
|
||||
$this->db->set('fitur_promosi', $data['fitur_promosi']);
|
||||
$this->db->set('link_promosi', $data['link_promosi']);
|
||||
$this->db->set('type_promosi', $data['type_promosi']);
|
||||
$this->db->set('is_show', $data['is_show']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
return $this->db->update('promosi', $data);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
class Resetpass_model extends CI_model
|
||||
{
|
||||
|
||||
public function check_token($token, $type)
|
||||
{
|
||||
return $this->db->get_where('forgot_password', ['token' => $token, 'idKey' => $type])->row_array();
|
||||
}
|
||||
|
||||
public function reset_pass($data, $id, $type)
|
||||
{
|
||||
if ($type == '1') {
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('pelanggan', $data);
|
||||
} elseif ($type == '2') {
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('driver', $data);
|
||||
} elseif ($type == '3') {
|
||||
$this->db->where('id_mitra', $id);
|
||||
$this->db->update('mitra', $data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function resetpass()
|
||||
{
|
||||
|
||||
$data = [
|
||||
"password" => sha1($this->input->post('password', true))
|
||||
];
|
||||
if ($this->input->post('type') == '1') {
|
||||
$this->db->where('id', $this->input->post('id'));
|
||||
$this->db->update('pelanggan', $data);
|
||||
} elseif ($this->input->post('type') == '2') {
|
||||
$this->db->where('id', $this->input->post('id'));
|
||||
$this->db->update('driver', $data);
|
||||
} elseif ($this->input->post('type') == '3') {
|
||||
$this->db->where('id_mitra', $this->input->post('id'));
|
||||
$this->db->update('mitra', $data);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deletetoken()
|
||||
{
|
||||
$this->db->delete('forgot_password', ['token' => $this->input->post('token')]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
class Service_model extends CI_model
|
||||
{
|
||||
public function getAllservice()
|
||||
{
|
||||
$this->db->select('voucher.nilai');
|
||||
// $this->db->select('driver_job.*');
|
||||
$this->db->select('fitur.*');
|
||||
$this->db->order_by('id_fitur', 'ASC');
|
||||
$this->db->join('voucher', 'fitur.id_fitur = voucher.untuk_fitur', 'left');
|
||||
|
||||
return $this->db->get('fitur')->result_array();
|
||||
}
|
||||
|
||||
public function getAlldriverjob()
|
||||
{
|
||||
return $this->db->get('driver_job')->result_array();
|
||||
}
|
||||
|
||||
|
||||
public function getcurrency()
|
||||
{
|
||||
$this->db->select('app_currency as duit');
|
||||
$this->db->where('id', '1');
|
||||
return $this->db->get('app_settings')->row_array();
|
||||
}
|
||||
|
||||
public function getfiturbyid($id)
|
||||
{
|
||||
$this->db->select('voucher.nilai');
|
||||
$this->db->select('fitur.*');
|
||||
$this->db->join('voucher', 'fitur.id_fitur = voucher.untuk_fitur', 'left');
|
||||
$this->db->where('id_fitur', $id);
|
||||
return $this->db->get('fitur')->row_array();
|
||||
}
|
||||
|
||||
public function getvoucherbyid($id)
|
||||
{
|
||||
$this->db->select('*');
|
||||
$this->db->where('id', $id);
|
||||
return $this->db->get('voucher')->row_array();
|
||||
}
|
||||
|
||||
public function ubahdatafitur($data)
|
||||
{
|
||||
$this->db->set('icon', $data['icon']);
|
||||
$this->db->set('fitur', $data['fitur']);
|
||||
$this->db->set('home', $data['home']);
|
||||
$this->db->set('biaya', $data['biaya']);
|
||||
$this->db->set('keterangan_biaya', $data['keterangan_biaya']);
|
||||
$this->db->set('komisi', $data['komisi']);
|
||||
$this->db->set('driver_job', $data['driver_job']);
|
||||
$this->db->set('biaya_minimum', $data['biaya_minimum']);
|
||||
$this->db->set('jarak_minimum', $data['jarak_minimum']);
|
||||
$this->db->set('maks_distance', $data['maks_distance']);
|
||||
$this->db->set('wallet_minimum', $data['wallet_minimum']);
|
||||
$this->db->set('keterangan', $data['keterangan']);
|
||||
$this->db->set('active', $data['active']);
|
||||
|
||||
$this->db->where('id_fitur', $data['id_fitur']);
|
||||
$this->db->update('fitur');
|
||||
|
||||
$this->db->set('nilai', $data['nilai']);
|
||||
$this->db->where('untuk_fitur', $data['id_fitur']);
|
||||
$this->db->update('voucher');
|
||||
}
|
||||
|
||||
public function tambahdatafitur($data, $datanilai)
|
||||
{
|
||||
$this->db->insert('fitur', $data);
|
||||
|
||||
$id = $this->db->insert_id();
|
||||
$datavocher = [
|
||||
'untuk_fitur' => $id,
|
||||
'nilai' => $datanilai['nilai'],
|
||||
'voucher' => 'DISKON',
|
||||
'tipe_voucher' => '1',
|
||||
'tanggal_expired' => '2020-01-31',
|
||||
'keterangan' => 'Discount',
|
||||
'count_to_use' => '0',
|
||||
'is_valid' => 'yes'
|
||||
|
||||
];
|
||||
$this->db->insert('voucher', $datavocher);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function hapusservicebyId($id)
|
||||
{
|
||||
$this->db->where('id_fitur', $id);
|
||||
$this->db->delete('fitur');
|
||||
|
||||
$this->db->where('untuk_fitur', $id);
|
||||
$this->db->delete('voucher');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
|
||||
class Users_model extends CI_model
|
||||
{
|
||||
public function getAllusers()
|
||||
{
|
||||
return $this->db->get('pelanggan')->result_array();
|
||||
}
|
||||
|
||||
public function getusersbyid($id)
|
||||
{
|
||||
// $this->db->select('kendaraan.*');
|
||||
$this->db->select('saldo.saldo');
|
||||
// $this->db->select('fitur.*');
|
||||
// $this->db->select('driver_job.driver_job');
|
||||
$this->db->select('pelanggan.*');
|
||||
// $this->db->join('kendaraan', 'driver.kendaraan = kendaraan.id_k', 'left');
|
||||
$this->db->join('saldo', 'pelanggan.id = saldo.id_user', 'left');
|
||||
// $this->db->join('config_driver', 'driver.id = config_driver.id_driver', 'left');
|
||||
// $this->db->join('fitur', 'pelanggan.order_fitur = fitur.id_fitur', 'left');
|
||||
return $this->db->get_where('pelanggan', ['pelanggan.id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function getcurrency()
|
||||
{
|
||||
$this->db->select('app_currency as duit');
|
||||
$this->db->where('id', '1');
|
||||
return $this->db->get('app_settings')->row_array();
|
||||
}
|
||||
|
||||
public function wallet($id)
|
||||
{
|
||||
$this->db->order_by('wallet.id', 'DESC');
|
||||
return $this->db->get_where('wallet', ['id_user' => $id])->result_array();
|
||||
}
|
||||
|
||||
public function countorder($id)
|
||||
{
|
||||
|
||||
$this->db->select('status_transaksi.*');
|
||||
$this->db->select('history_transaksi.*');
|
||||
$this->db->select('fitur.*');
|
||||
$this->db->select('transaksi.*');
|
||||
$this->db->join('history_transaksi', 'transaksi.id = history_transaksi.id_transaksi', 'left');
|
||||
$this->db->join('status_transaksi', 'history_transaksi.status = status_transaksi.id', 'left');
|
||||
$this->db->join('fitur', 'transaksi.order_fitur = fitur.id_fitur', 'left');
|
||||
$this->db->where('history_transaksi.status != 1');
|
||||
$this->db->order_by('transaksi.id', 'DESC');
|
||||
$query = $this->db->get_where('transaksi', ['id_pelanggan' => $id])->result_array();
|
||||
return $query;
|
||||
}
|
||||
|
||||
public function blockusersbyid($id)
|
||||
{
|
||||
$this->db->set('status', '0');
|
||||
$this->db->where('id', $id);
|
||||
$this->db->Update('pelanggan');
|
||||
}
|
||||
|
||||
public function unblockusersbyid($id)
|
||||
{
|
||||
$this->db->set('status', '1');
|
||||
$this->db->where('id', $id);
|
||||
$this->db->Update('pelanggan');
|
||||
}
|
||||
|
||||
public function ubahdataid($data)
|
||||
{
|
||||
$this->db->set('fullnama', $data['fullnama']);
|
||||
$this->db->set('no_telepon', $data['no_telepon']);
|
||||
$this->db->set('email', $data['email']);
|
||||
$this->db->set('countrycode', $data['countrycode']);
|
||||
$this->db->set('phone', $data['phone']);
|
||||
$this->db->set('tgl_lahir', $data['tgl_lahir']);
|
||||
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('pelanggan', $data);
|
||||
}
|
||||
|
||||
public function ubahdatafoto($data)
|
||||
{
|
||||
$this->db->set('fotopelanggan', $data['fotopelanggan']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('pelanggan', $data);
|
||||
}
|
||||
|
||||
public function ubahdatapassword($data)
|
||||
{
|
||||
$this->db->set('password', $data['password']);
|
||||
|
||||
$this->db->where('id', $data['id']);
|
||||
$this->db->update('pelanggan', $data);
|
||||
}
|
||||
|
||||
public function blockuserbyid($id)
|
||||
{
|
||||
$this->db->set('status', 0);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('pelanggan');
|
||||
}
|
||||
|
||||
public function unblockuserbyid($id)
|
||||
{
|
||||
$this->db->set('status', 1);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('pelanggan');
|
||||
}
|
||||
|
||||
public function tambahdatausers($data)
|
||||
{
|
||||
$this->db->insert('pelanggan', $data);
|
||||
$data2 = [
|
||||
'id_user' => $data['id'],
|
||||
'saldo' => 0,
|
||||
];
|
||||
$this->db->insert('saldo', $data2);
|
||||
}
|
||||
|
||||
public function hapusdatauserbyid($id)
|
||||
{
|
||||
$this->db->where('id', $id);
|
||||
$this->db->delete('pelanggan');
|
||||
|
||||
$this->db->where('id_pelanggan', $id);
|
||||
$this->db->delete('transaksi');
|
||||
|
||||
$this->db->where('id_user', $id);
|
||||
$this->db->delete('saldo');
|
||||
|
||||
$this->db->where('userid', $id);
|
||||
$this->db->delete('forgot_password');
|
||||
|
||||
$this->db->where('id_pelanggan', $id);
|
||||
$this->db->delete('rating_driver');
|
||||
|
||||
$this->db->where('id_user', $id);
|
||||
$this->db->delete('wallet');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,326 @@
|
||||
<?php
|
||||
|
||||
|
||||
class wallet_model extends CI_model
|
||||
{
|
||||
public function getwallet()
|
||||
{
|
||||
$this->db->select('mitra.nama_mitra');
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('wallet.*');
|
||||
$this->db->join('mitra', 'wallet.id_user = mitra.id_mitra', 'left');
|
||||
$this->db->join('driver', 'wallet.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'wallet.id_user = pelanggan.id', 'left');
|
||||
$this->db->order_by('wallet.id', 'DESC');
|
||||
return $this->db->get('wallet')->result_array();
|
||||
}
|
||||
|
||||
public function gettokenmerchant($id_user)
|
||||
|
||||
{
|
||||
$this->db->select('mitra.*');
|
||||
$this->db->select('merchant.token_merchant');
|
||||
$this->db->join('merchant', 'mitra.id_merchant = merchant.id_merchant', 'left');
|
||||
$this->db->where('mitra.id_mitra', $id_user);
|
||||
return $this->db->get('mitra')->row_array();
|
||||
}
|
||||
|
||||
public function ubahsaldotopup($id_user, $amount, $saldo)
|
||||
{
|
||||
// $this->db->where('id_user', $dataC['id_pelanggan']);
|
||||
// $upd = $this->db->update('saldo', array('saldo' => ($saldo - $dataC['biaya_akhir'])));
|
||||
$this->db->set('saldo', $saldo['saldo'] + $amount);
|
||||
$this->db->where('id_user', $id_user);
|
||||
$this->db->update('saldo');
|
||||
}
|
||||
|
||||
public function getwalletbyid($id)
|
||||
{
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('wallet.*');
|
||||
$this->db->join('driver', 'wallet.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'wallet.id_user = pelanggan.id', 'left');
|
||||
return $this->db->get_where('wallet', ['wallet.id' => $id])->row_array();
|
||||
}
|
||||
|
||||
public function getallsaldo()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function getjumlahdiskon()
|
||||
{
|
||||
$this->db->select('SUM(kredit_promo) as diskon');
|
||||
return $this->db->get('transaksi')->row_array();
|
||||
}
|
||||
|
||||
public function getallsaldouser()
|
||||
{
|
||||
$this->db->select('mitra.nama_mitra');
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('saldo.*');
|
||||
$this->db->join('mitra', 'saldo.id_user = mitra.id_mitra', 'left');
|
||||
$this->db->join('driver', 'saldo.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'saldo.id_user = pelanggan.id', 'left');
|
||||
return $this->db->get('saldo')->result_array();
|
||||
}
|
||||
|
||||
public function gettotaltopup()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
$this->db->where('status', 1);
|
||||
$this->db->where('type', 'topup');
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function gettotalwithdraw()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
$this->db->where('type', 'withdraw');
|
||||
$this->db->where('status', 1);
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function gettotalorderplus()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
$this->db->where('type', 'Order+');
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function gettotalordermin()
|
||||
{
|
||||
$this->db->select('SUM(jumlah)as total');
|
||||
$this->db->where('type', 'Order-');
|
||||
return $this->db->get('wallet')->row_array();
|
||||
}
|
||||
|
||||
public function ubahstatuswithdrawbyid($id)
|
||||
{
|
||||
$this->db->set('status', 1);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('wallet');
|
||||
}
|
||||
|
||||
public function cancelstatuswithdrawbyid($id)
|
||||
{
|
||||
$this->db->set('status', 2);
|
||||
$this->db->where('id', $id);
|
||||
$this->db->update('wallet');
|
||||
}
|
||||
|
||||
public function gettoken($id_user)
|
||||
|
||||
{
|
||||
$this->db->select('token');
|
||||
$this->db->where('id', $id_user);
|
||||
return $this->db->get('pelanggan')->row_array();
|
||||
}
|
||||
|
||||
public function getregid($id_user)
|
||||
{
|
||||
$this->db->select('reg_id');
|
||||
$this->db->where('id', $id_user);
|
||||
return $this->db->get('driver')->row_array();
|
||||
}
|
||||
|
||||
public function getsaldo($id_user)
|
||||
{
|
||||
$this->db->select('saldo');
|
||||
$this->db->where('id_user', $id_user);
|
||||
return $this->db->get('saldo')->row_array();
|
||||
}
|
||||
|
||||
public function ubahsaldo($id_user, $amount, $saldo)
|
||||
{
|
||||
// $this->db->where('id_user', $dataC['id_pelanggan']);
|
||||
// $upd = $this->db->update('saldo', array('saldo' => ($saldo - $dataC['biaya_akhir'])));
|
||||
$this->db->set('saldo', $saldo['saldo'] - $amount);
|
||||
$this->db->where('id_user', $id_user);
|
||||
$this->db->update('saldo');
|
||||
}
|
||||
|
||||
public function send_notif($title, $message, $topic)
|
||||
{
|
||||
|
||||
$data = array(
|
||||
'title' => $title,
|
||||
'message' => $message,
|
||||
'type' => 3
|
||||
);
|
||||
$senderdata = array(
|
||||
'data' => $data,
|
||||
'to' => $topic
|
||||
);
|
||||
|
||||
$headers = array(
|
||||
'Content-Type : application/json',
|
||||
'Authorization: key=' . keyfcm
|
||||
);
|
||||
$curl = curl_init();
|
||||
|
||||
curl_setopt_array($curl, array(
|
||||
CURLOPT_URL => "https://fcm.googleapis.com/fcm/send",
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_ENCODING => "",
|
||||
CURLOPT_MAXREDIRS => 10,
|
||||
CURLOPT_TIMEOUT => 30,
|
||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||
CURLOPT_CUSTOMREQUEST => "POST",
|
||||
CURLOPT_POSTFIELDS => json_encode($senderdata),
|
||||
CURLOPT_HTTPHEADER => $headers,
|
||||
));
|
||||
|
||||
$response = curl_exec($curl);
|
||||
$err = curl_error($curl);
|
||||
|
||||
curl_close($curl);
|
||||
}
|
||||
|
||||
public function updatesaldowallet($data)
|
||||
{
|
||||
|
||||
|
||||
$this->db->select('mitra.nama_mitra');
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('saldo.saldo as saldolama');
|
||||
$this->db->join('mitra', 'saldo.id_user = mitra.id_mitra', 'left');
|
||||
$this->db->join('driver', 'saldo.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'saldo.id_user = pelanggan.id', 'left');
|
||||
$this->db->where('id_user', $data['id_user']);
|
||||
$saldolama = $this->db->get('saldo')->row_array();
|
||||
|
||||
$saldobaru = $saldolama['saldolama'] + $data['saldo'];
|
||||
|
||||
$this->db->set('saldo', $saldobaru);
|
||||
$this->db->where('id_user', $data['id_user']);
|
||||
$this->db->update('saldo');
|
||||
|
||||
if ($data['type_user'] == 'pelanggan') {
|
||||
$nama = $saldolama['fullnama'];
|
||||
} elseif ($data['type_user'] == 'mitra') {
|
||||
$nama = $saldolama['nama_mitra'];
|
||||
} else {
|
||||
$nama = $saldolama['nama_driver'];
|
||||
}
|
||||
|
||||
|
||||
$this->db->set('status', '1');
|
||||
$this->db->set('type', 'topup');
|
||||
$this->db->set('rekening', 'admin');
|
||||
$this->db->set('bank', 'admin');
|
||||
$this->db->set('nama_pemilik', $nama);
|
||||
$this->db->set('jumlah', $data['saldo']);
|
||||
$this->db->set('id_user', $data['id_user']);
|
||||
$this->db->insert('wallet');
|
||||
}
|
||||
|
||||
public function updatesaldowalletwithdraw($data, $data2)
|
||||
{
|
||||
$this->db->select('mitra.nama_mitra');
|
||||
$this->db->select('driver.nama_driver');
|
||||
$this->db->select('pelanggan.fullnama');
|
||||
$this->db->select('saldo.saldo as saldolama');
|
||||
$this->db->join('mitra', 'saldo.id_user = mitra.id_mitra', 'left');
|
||||
$this->db->join('driver', 'saldo.id_user = driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'saldo.id_user = pelanggan.id', 'left');
|
||||
$this->db->where('id_user', $data['id_user']);
|
||||
$saldolama = $this->db->get('saldo')->row_array();
|
||||
|
||||
$saldobaru = $saldolama['saldolama'] - $data['saldo'];
|
||||
if ($saldobaru < 0) {
|
||||
$this->session->set_flashdata('salah', 'Not enaugh Balances');
|
||||
redirect('wallet/tambahwithdraw');
|
||||
} else {
|
||||
$this->db->set('saldo', $saldobaru);
|
||||
$this->db->where('id_user', $data['id_user']);
|
||||
$this->db->update('saldo');
|
||||
|
||||
if ($data['type_user'] == 'pelanggan') {
|
||||
$nama = $saldolama['fullnama'];
|
||||
} elseif ($data['type_user'] == 'mitra') {
|
||||
$nama = $saldolama['nama_mitra'];
|
||||
} else {
|
||||
$nama = $saldolama['nama_driver'];
|
||||
}
|
||||
|
||||
$this->db->set('status', '1');
|
||||
$this->db->set('type', 'withdraw');
|
||||
$this->db->set('rekening', $data2['rekening']);
|
||||
$this->db->set('bank', $data2['bank']);
|
||||
$this->db->set('nama_pemilik', $data2['nama_pemilik']);
|
||||
$this->db->set('jumlah', $data['saldo']);
|
||||
$this->db->set('id_user', $data['id_user']);
|
||||
$this->db->insert('wallet');
|
||||
}
|
||||
}
|
||||
|
||||
public function getwalletall()
|
||||
{
|
||||
$this->db->select('wallet.*');
|
||||
$this->db->select('merchant.token_merchant');
|
||||
$this->db->select('driver.reg_id');
|
||||
$this->db->select('pelanggan.token');
|
||||
$this->db->select('pelanggan.id,driver.id,mitra.id_mitra,merchant.id_merchant');
|
||||
$this->db->join('mitra', 'wallet.id_user=mitra.id_mitra', 'left');
|
||||
$this->db->join('merchant', 'mitra.id_merchant=merchant.id_merchant', 'left');
|
||||
$this->db->join('driver', 'wallet.id_user=driver.id', 'left');
|
||||
$this->db->join('pelanggan', 'wallet.id_user=pelanggan.id', 'left');
|
||||
return $this->db->get('wallet')->result_array();
|
||||
}
|
||||
|
||||
public function updatekadaluarsa()
|
||||
{
|
||||
$this->load->model('Notification_model');
|
||||
|
||||
$wallet = $this->getwalletall();
|
||||
|
||||
|
||||
|
||||
|
||||
foreach ($wallet as $wl) {
|
||||
|
||||
|
||||
|
||||
$date1 = date_create($wl['expired']);
|
||||
$date = new DateTime('now', new DateTimeZone('Asia/Jakarta'));
|
||||
|
||||
|
||||
$tanggal = date_format($date1, "YmdHis");
|
||||
|
||||
$tanggal2 = date_format($date, "YmdHis");
|
||||
// var_dump($tanggal);
|
||||
// var_dump($tanggal2);
|
||||
// die();
|
||||
|
||||
if ($tanggal <= $tanggal2 && $wl['status'] == 0 && $wl['expired'] != "") {
|
||||
// var_dump($tanggal);
|
||||
// var_dump($tanggal2);
|
||||
// die();
|
||||
$this->db->set('status', '2');
|
||||
|
||||
$this->db->Where('status', '0');
|
||||
$this->db->Where('invoice', $wl['invoice']);
|
||||
$this->db->update('wallet');
|
||||
|
||||
$id = substr($wl['id_user'], '0', '1');
|
||||
if ($id == 'M') {
|
||||
$token = $wl['token_merchant'];
|
||||
} else if ($id == 'P') {
|
||||
$token = $wl['token'];
|
||||
} else {
|
||||
$token = $wl['reg_id'];
|
||||
}
|
||||
|
||||
$title = 'Dibatalkan';
|
||||
$desc = 'Pembayaran Kamu telah Dibatalkan';
|
||||
$this->Notification_model->send_notif_topup($title, $wl['id_user'], $desc, $wl['invoice'], $token);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>403 Forbidden</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<p>Directory access is forbidden.</p>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
defined('BASEPATH') or exit('No direct script access allowed');
|
||||
|
||||
class Mitra_model extends CI_model
|
||||
{
|
||||
public function topup_pulsa($data)
|
||||
{
|
||||
$this->db->insert('topup_pulsaMP', $data)->result_array();
|
||||
return $this->db->affected_rows();
|
||||
}
|
||||
|
||||
public function postCallback()
|
||||
{
|
||||
$this->db->insert('mp_callback')->result_array();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user