Untitled

 avatar
unknown
plain_text
5 months ago
1.7 kB
3
Indexable
 $send_otp               = WatzapLib::sendChat(null, $phone, $template_wa);

                     if (@$send_otp['status'] == 200) {
                        // Cari nilai isSentWA saat ini dari database menggunakan one()
                        $order = (new Query())
                            ->select(['id', 'isSentWA'])
                            ->from('orders')
                            ->where(['id' => $orderId])
                            ->one();

                        if ($order !== null) {
                            // Tambahkan 1 ke isSentWA saat ini
                            $isSentWA = (int)$order['isSentWA'] + 1;

                            // Update nilai isSentWA di database
                            $result = Yii::$app->db->createCommand()
                                ->update('orders', ['isSentWA' => $isSentWA], ['id' => $orderId])
                                ->execute();

                            if ($result) {
                                Yii::error("success update orderId $orderId  $isSentWA");
                            } else {
                                Yii::error("error update order isSentWA orderId $orderId $isSentWA");
                            }
                        }
                         // insety notif
                         $update_notif = $this->updateNotifHistory($id_last_notif_history, $phone, 1, null, null, null, null);
                    }else{
                        $json_res = json_encode($send_otp);
                        $update_notif = $this->updateNotifHistory($id_last_notif_history, $phone, 0, $json_res, null, null, null);
                    }
Editor is loading...
Leave a Comment