Ejemplo n.º 1
0
function dlr($uid, $del, $op_id, $callback)
{
    // 0: not delivered  // 1:accepted  // 2: faild
    // 1: delivery success      // 2: delivery failure  // 4: message buffered  // 8: smsc submit  // 16: smsc reject  // 32: Kannek reject
    $log_obj = new Payment();
    $log_obj->update_log_del_status($uid, $del);
    $sucess_del_array = array(1);
    //jawwal
    if ($op_id == 1) {
        $sucess_del_array = array(1);
    }
    $fp = fopen("dlrs.txt", "a+");
    fwrite($fp, $del . "\n");
    fclose($fp);
    if (in_array($del, $sucess_del_array)) {
        //$user_obj = new User();
        $db_funtions_obj = new DbFunctions();
        $helper_obj = new Helper();
        $payment_log_details = $db_funtions_obj->get_payment_log_by_uid($uid);
        $db_funtions_obj->activate_user($uid);
        $ope_details = $db_funtions_obj->get_operator_by_id($payment_log_details['operator_id']);
        $period = $ope_details['period'];
        $now = time();
        $end = $now + $period;
        // pr($payment_log_details);
        $country_id = $ope_details['country_id'];
        $phone = $payment_log_details['phone'];
        $email = $payment_log_details['email'];
        $db_funtions_obj->update_payment($uid, $now, $end);
        $response = '{"success":"1","message":"success"}';
        $json = $callback . '({
                        "proposals": 
                    ';
        $json .= $response;
        $json .= '})';
        return $json;
        /*$log_id = $log_obj->insert($uid, $payment_log_details['country_id'], $payment_log_details['client_id'], $payment_log_details['operator_id'], 
            "لقد تم تفعيل اشتراكك بنجاح", $op_details['free_shortcode'], $payment_log_details['mobile'], 0);
          */
        //$root = "http://arh:8080/appstreamig/streaming/";
        //$dlr_url = $root . 'index.php?action=dlr&par=%d_' . $log_id;
        // $helper_obj->send_sms($op_details['free_shortcode'], $payment_log_details['mobile'], "لقد تم تفعيل اشتراكك بنجاح",
        //         $payment_log_details['free_smsc'], $dlr_url, $op_details['port']);
    }
}
Ejemplo n.º 2
0
Archivo: index.php Proyecto: arh922/ain
 if (in_array($del, $success_array)) {
     $user_obj = new User();
     $user_details = $user_obj->user_load($uid);
     $cid = $user_details->cid;
     $phone_details = $db_fuctions_obj->get_phone_details($phone, $cid);
     //   pr($phone_details);
     $country_id = $ope_details[0]['country_id'];
     $end_date = $phone_details[0]['end_date'];
     //$uid = $phone_details[0]['uid'];
     $email = $phone_details[0]['email'];
     $now = time();
     //with period and he want to add new payment
     if ($now < $end_date) {
         $start_date = $phone_details[0]['date_added'];
         $end_date += $period;
         $db_fuctions_obj->update_payment($uid, $start_date, $end_date);
         $db_fuctions_obj->reset_payment_count($uid);
     } else {
         if ($now >= $end_date) {
             $end_date = $now + $period;
             $db_fuctions_obj->update_payment($uid, $now, $end_date);
             $db_fuctions_obj->reset_payment_count($uid);
         }
     }
     $db_fuctions_obj->activate_user($uid);
     $json = $callback . '({
         "proposals": 
         ';
     $json .= '{"success":"1","message":"success"}';
     $json .= '})';
     echo $json;