3.5 KiB
Backend panel files modified (from ordering workflow & fixes)
All paths below are relative to backendpanel/.
1. application/controllers/api/Notification.php
Change: Load FCM v1 helper before calling the notification model so send_generic works.
- Added:
$this->load->helper('fcm_v1_helper');at the start ofsend_generic_post(), before reading$decoded.
Reason: User and Driver apps send FCM via POST api/notification/send_generic. The controller calls send_generic_to_token / send_generic_to_topic, which use fcm_v1_send() from the helper.
2. application/models/Notification_model.php
Change: Implemented generic FCM send methods used by the API.
-
Added:
send_generic_to_token($target, $data, $options)
Flattens$data(string values for FCM), loadsfcm_v1_helperif needed, callsfcm_v1_send($target, $flat, false, $options). Returnstrue/false. -
Added:
send_generic_to_topic($target, $data, $options)
Same as above but callsfcm_v1_send(..., true, $options)for topic.
Reason: The API was calling these methods but they did not exist. Without them, ordering FCM from User/Driver apps would fail.
3. application/config/config.php
Change: Documented the test backend URL.
- Added comment in the base_url block:
| Test backend API: apitest.semestaterpadu.my.id - No change to the actual
$config['base_url']value (alreadyhttps://apitest.semestaterpadu.my.id/).
Reason: Clarify that the test backend endpoint is apitest.semestaterpadu.my.id.
4. application/models/Pelanggan_model.php
Changes:
-
get_driver_ride($lat, $lng, $fitur)
- Logic: Replaced
HAVING distance <= f.jarak_minimum
with
HAVING distance <= GREATEST(COALESCE(f.jarak_minimum, 10), 10)
so the search radius is at least 10 km (still uses real GPS fromconfig_driverand user lat/lng; no region). - Docblock: Added comment that matching is purely by GPS, no region/wilayah; radius =
jarak_minimumwith minimum 10 km.
- Logic: Replaced
-
get_driver_car($lat, $lng, $fitur)
- Docblock only: Added comment that matching is purely by GPS, no region; radius 10 km.
- Query unchanged (already used a fixed 10 km radius).
-
merchantnearby($long, $lat)
- Docblock only: Added comment that matching is purely by GPS (merchant lat/long vs user), no region; distance <=
fitur.jarak_minimum.
- Docblock only: Added comment that matching is purely by GPS (merchant lat/long vs user), no region; distance <=
-
merchantpromo($long, $lat)
- Docblock only: “Merchant promo nearby: purely GPS, no region.”
-
allmerchantnearby($long, $lat, $fitur)
- Docblock only: “All merchant nearby by fitur: purely GPS (merchant lat/long vs user), no region.”
Reason:
- Minimum 10 km radius for ride so “tidak ada pengemudi” is less likely when drivers are close.
- Explicit documentation that driver and merchant nearby use only real GPS and
jarak_minimum, with no region involvement.
Summary table
| File | Type of change |
|---|---|
application/controllers/api/Notification.php |
Load fcm_v1_helper in send_generic_post() |
application/models/Notification_model.php |
New send_generic_to_token, send_generic_to_topic |
application/config/config.php |
Comment: test backend API = apitest.semestaterpadu.my.id |
application/models/Pelanggan_model.php |
Min radius 10 km in get_driver_ride; docblocks (purely GPS, no region) on driver & merchant nearby functions |
No other files under backendpanel were modified for these modifications (no views, no other controllers, no other models).