小组根据php中的日期内爆礼品券

时间:2018-08-29 16:59:26

标签: php arrays

我需要使用兑换电子邮件来预订约会,单个电子邮件ID包含2个不同的唯一代码,兑换代码信息在下面,

我有2个代码0LB0WYAFZI,LA7I5KSER4兑换代码,与mohamedcse@gmail.com一样具有相同的电子邮件ID,这2个兑换代码的剩余分钟数分别为120分钟和60分钟。

    28.08.2018  - Wash service  - 30 min and Rs:50
    05.09.2018  - Wash service  - 30 min and Rs:50
    12.09.2018  - Wash service  - 30 min and Rs:50
    19.09.2018  - Wash service  - 30 min and Rs:50
    26.09.2018  - Wash service  - 30 min and Rs:50

我的问题是使用兑换电子邮件ID预订约会,同时要预订多个约会,例如

预约名称-洗涤服务预约30分钟,50卢比/-(预订了5个不同的日期)   日期

  foreach($_POST['client_schedule_date'] as $dynamc_dd) 
    {
        $comb_date[] =  $dynamc_dd;
    } 
 $comb_datee = explode(',',implode(',',$comb_date));  

这里正在使用礼券购买约会服务

我的礼品券是:

兑换代码1:0LB0WYAFZI-剩余分钟数:120分钟-电子邮件ID-mohamedcse@gmail.com 兑换代码2:LA7I5KSER4-剩余分钟数:60分钟-电子邮件ID-mohamedcse@gmail.com

我需要在db中存储礼券详细信息(如果我多次使用礼券)

下面显示多个约会日期的代码:

   Array ( [0] => 2018-09-28 [1] => 2018-10-05 [2] => 2018-10-12 [3] => 2018-10-19 [4] => 2018-10-26 )

输出:

       $minutes = 0;
       $rupees = 0;
       $remain_minutes = 0;
       $remain_amount = 0;
       foreach($_POST['booked_random_id'] as $random_val)
        {
          $get_gift_items = $giftorderlist_obj->Get_giftid_bycertificate_code($random_val);
          $booking_services_id =  explode(',',$get_gift_items['pgl_booked_service_id']);

              foreach($booking_services_id as $redeem_book_service_idss)
                {
                    if($redeem_book_service_idss == '')
                    {
                         $minutes = 0;
                         $rupees = 0;
                    }
                    else
                    {
                      $id =  $redeem_book_service_idss.'<br>';
                      $service_info1 = $serv_obj -> getServicesById($id);
                      $minutes = $minutes + $service_info1['duration'];
                      $rupees = $rupees + $service_info1['price'];
                    }

               }

            $redeem_minutes =  $get_gift_items['pgl_redeem_minutes']; 
            $redeem_amount =  $get_gift_items['pgl_redeem_price'];
            $redeemable_for =  $get_gift_items['pgl_redeemable_for']; 
            $remain_minutes = $redeem_minutes - $minutes;
            $remain_amount = $redeem_amount - $rupees; 
            $remain_minutes_arr[] = $remain_minutes;
            $random_val_arr[] = $random_val;
        }

兑换代码程序:

     Array ( [0] => 120 [1] => 60 ) 

输出:

      foreach($comb_datee as $dynamc_dd) 
    {           
        if($remain_minutes >= $service_duration && $redeemable_for == 1)
        {
          echo $dynamc_dd12[] = $dynamc_dd;
          $red_code[] =  $random_val;   
          //echo 'rr';
          //echo $remain_minutes;

        }
    //}  

}

echo implode(',',$dynamc_dd12);
echo implode(',',$red_code);    

我需要使用兑换代码显示日期:

 2018-09-28,2018-10-05,2018-10-12,2018-10-19,2018-10-26
 LA7I5KSER4,LA7I5KSER4,LA7I5KSER4,LA7I5KSER4,LA7I5KSER4

我的输出:

{{1}}

我需要正确获取兑换代码。

需要获得预期的输出:

$ date_val = 2018-09-28,2018-10-05,2018-10-12,2018-10-19,2018-10-26;

$ redeem_code = 0LB0WYAFZI,0LB0WYAFZI,0LB0WYAFZI,0LB0WYAFZI,LA7I5KSER4;

说明:

兑换代码1:0LB0WYAFZI-时长120分钟

兑换代码2:LA7I5KSER4-持续60分钟

请满足我的需求

@谢谢

0 个答案:

没有答案