当前位置: 首页>>代码示例>>PHP>>正文


PHP DateUtil::buildDateTime方法代码示例

本文整理汇总了PHP中DateUtil::buildDateTime方法的典型用法代码示例。如果您正苦于以下问题:PHP DateUtil::buildDateTime方法的具体用法?PHP DateUtil::buildDateTime怎么用?PHP DateUtil::buildDateTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在DateUtil的用法示例。


在下文中一共展示了DateUtil::buildDateTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: number_format

">
                </a>

                <a>
                    <h3 class="F14 FN"><?php 
echo $order['project_name'];
?>
</h3>
                </a>
                <p>门店:<span class="F11"><?php 
echo $shop;
?>
</span></p>
                <strong
                    class="FN colorH">预约时间: <?php 
echo DateUtil::buildDateTime($order['appointment_day'], $order['appointment_start_time']);
?>
</strong>
                <strong class="add FN colorH">美容师:<?php 
echo $order['beautician_name'];
?>
</strong>
                <i class="order_list_i"> </i>
            </div>
            </dt>
            <dd>
                <a class="colorW pay-click">马上支付</a>
                <i class="colorH">总金额:<strong
                        class="F18 colorR">¥<?php 
echo number_format($order['total_fee'], 2);
?>
开发者ID:guohao214,项目名称:xinya,代码行数:31,代码来源:pay.php

示例2: notice

 /**
  * 微信支付后的异步回调
  */
 public function notice()
 {
     $weixin = new WeixinPayUtil();
     //通知微信
     $notice = $weixin->notifyData();
     // 签名成功, 返回数组, 否则返回xml数据
     if (!is_array($notice) || !isset($notice['transaction_id'])) {
         exit($notice);
     }
     //签名成功,处理数据
     /**
      * 返回的数据
      * 'appid' => string 'wxf5b5e87a6a0fde94' (length=18)
      * 'bank_type' => string 'CFT' (length=3)
      * 'fee_type' => string 'CNY' (length=3)
      * 'is_subscribe' => string 'N' (length=1)
      * 'mch_id' => string '10000097' (length=8)
      * 'nonce_str' => string 'dz8nirk7gmxhhxn38zgib28yx14ul2gf' (length=32)
      * 'openid' => string 'ozoKAt-MmA74zs7MBafCix6Dg8o0' (length=28)
      * 'out_trade_no' => string 'wxf5b5e87a6a0fde941409708791' (length=28)
      * 'result_code' => string 'SUCCESS' (length=7)
      * 'return_code' => string 'SUCCESS' (length=7)
      * 'sign' => string 'EDACA525F6C675337B2DAC25B7145028' (length=32)
      * 'sub_mch_id' => string '10000097' (length=8)
      * 'time_end' => string '20140903094659' (length=14)
      * 'total_fee' => string '1' (length=1)
      * 'trade_type' => string 'NATIVE' (length=6)
      * 'transaction_id' => string '1004400737201409030005091526' (length=28)  //微信支付单号
      */
     //        $notice  = array(
     //            'out_trade_no' => '201512271710391206225994',
     //            'transaction_id' => '1004400737201409030005091526'
     //        );
     $orderNo = $notice['out_trade_no'];
     $wxOrderNo = $notice['transaction_id'];
     $openId = $notice['openid'];
     $orderModel = new OrderModel();
     // 获得订单
     $orders = $orderModel->orders(array('order_no' => $orderNo));
     if (!$orders || !$orders[0]) {
         exit($weixin->notifyFailure());
     }
     // 判断是否已经支付
     $order = $orders[0];
     if ($order['order_sign'] == OrderModel::ORDER_PAYED) {
         exit($weixin->notifyPayed());
     }
     // 更新订单信息
     $this->db->trans_start();
     $orderModel->payed($orderNo, $wxOrderNo);
     // 更新积分
     $customerModel = new CustomerModel();
     $score = $order['total_fee'];
     $customer = $customerModel->readOne($openId);
     if ($customer) {
         $customerModel->addCredits($openId, $score);
     }
     // 事物完成
     $this->db->trans_complete();
     if ($this->db->trans_status() === FALSE) {
         $this->db->trans_rollback();
         exit($weixin->notifyFailure());
     } else {
         $this->db->trans_commit();
         // 获得access token
         $weixinUtil = new WeixinUtil();
         $token = $weixinUtil->getToken();
         if ($token) {
             //foreach ($orders as $order) {
             $orderNo = $order['order_no'];
             $appointmentDay = DateUtil::buildDateTime($order['appointment_day'], $order['appointment_start_time']);
             $shops = (new ShopModel())->getAllShops();
             $shop = $shops[$order['shop_id']];
             $beautician = (new BeauticianModel())->readOne($order['beautician_id']);
             $beauticianName = $beautician['name'];
             $project = (new CurdUtil(new OrderProjectModel()))->readOne(array('order_id' => $order['order_id']));
             $projectName = $project['project_name'];
             // 计算总积分
             $totalCredits = $customer['credits'] + $score;
             // 发送模板消息
             // $orderNo, $appointmentDay, $shop, $beautician, $projectName
             $weixinUtil->sendOrderMessage($orderNo, $appointmentDay, $shop, $beauticianName, $projectName, $openId, $token, $totalCredits);
             //}
         }
         exit($weixin->notifySuccess());
     }
 }
开发者ID:guohao214,项目名称:xinya,代码行数:90,代码来源:Order.php

示例3: appointment

 public function appointment()
 {
     $params = RequestUtil::postParams();
     $userName = urldecode($params['user_name']);
     if (empty($userName)) {
         $this->message('联系人不能为空!');
     }
     $phoneNumber = $params['phone_number'];
     if (empty($phoneNumber)) {
         $this->message('手机号不能为空!');
     }
     $appointmentDay = $params['appointment_day'];
     $appointmentTime = $params['appointment_times'];
     $today = date('Y-m-d');
     if ($appointmentDay < $today) {
         $this->message('错误的预约日期!');
     }
     // 检查时间
     $appointmentTime = explode(',', urldecode($appointmentTime));
     if (!$appointmentTime || count($appointmentTime) < 1) {
         $this->message('错误的预约时间!');
     }
     // 只有30分钟的项目
     if (count($appointmentTime) == 1) {
         array_push($appointmentTime, $appointmentTime[0]);
     }
     // 只保留头和尾的两个数据
     $startTime = array_shift($appointmentTime);
     $endTime = array_pop($appointmentTime);
     if ($endTime < $startTime) {
         $this->message('错误的预约时间!');
     }
     // 预约时间是否小于当前时间
     $now = date('Y-m-d H:i');
     if (DateUtil::buildDateTime($appointmentDay, $startTime) < $now) {
         $this->message('错误的预约开始时间!');
     }
     if (DateUtil::buildDateTime($appointmentDay, $endTime) < $now) {
         $this->message('错误的预约结束时间!');
     }
     $beauticianId = $params['beautician_id'];
     // 判断相同的时间是否已经被预约
     $findHasPayedAppointTimeWhere = array('appointment_day' => $appointmentDay, 'appointment_start_time' => $startTime, 'order_status' => OrderModel::ORDER_PAYED, 'beautician_id' => $beauticianId);
     $findOrder = (new CurdUtil(new OrderModel()))->readOne($findHasPayedAppointTimeWhere);
     if ($findOrder) {
         $this->message('此时间段已被预约!');
     }
     unset($findOrder);
     $findHasPayedAppointTimeWhere['order_status'] = OfflineOrderModel::ORDER_WAIT;
     $findOrder = (new CurdUtil(new OfflineOrderModel()))->readOne($findHasPayedAppointTimeWhere);
     if ($findOrder) {
         $this->message('此时间段已被预约!');
     }
     // 没有问题
     $data = array('project_id' => $params['project_id'], 'project_name' => $params['project_name'], 'use_time' => $params['use_time'], 'shop_id' => $params['shop_id'], 'beautician_id' => $beauticianId, 'appointment_day' => $appointmentDay, 'appointment_start_time' => $startTime, 'appointment_end_time' => $endTime, 'user_name' => $userName, 'phone_number' => $phoneNumber, 'create_time' => DateUtil::now());
     if ((new CurdUtil(new OfflineOrderModel()))->create($data)) {
         $this->message('线下预约成功!', 'offlineOrder/index');
     } else {
         $this->message('线下预约失败!');
     }
 }
开发者ID:guohao214,项目名称:xinya,代码行数:61,代码来源:OfflineAppointment.php

示例4: order

 /**
  * 下单
  * @param $shopId
  * @param $beauticianId
  * @param $appointmentDay
  * @param $appointmentTime
  * @param $userName
  * @param $phoneNumber
  */
 public function order($shopId, $beauticianId, $appointmentDay, $appointmentTime, $userName, $phoneNumber)
 {
     $openId = (new WeixinUtil())->getOpenId();
     if (!$openId) {
         $this->message('错误的授权');
     }
     if (!(new ShopModel())->isValidShopId($shopId)) {
         $this->message('门店信息错误,请检查!');
     }
     // 检查美容师
     if (!(new BeauticianModel())->isValidBeautician($beauticianId)) {
         $this->message('美容师信息错误,请检查!');
     }
     $userName = urldecode($userName);
     // 检查用户
     $userName = trim(strip_tags($userName));
     if (empty($userName)) {
         $this->message('联系人不能为空,请检查!');
     }
     if (!preg_match('~^1\\d{10}$~', $phoneNumber)) {
         $this->message('手机号错误,请检查!');
     }
     // 检查日期,日期为今天或者以后
     $today = date('Y-m-d');
     if ($appointmentDay < $today) {
         $this->message('错误的预约日期!');
     }
     // 检查时间
     $appointmentTime = explode(',', urldecode($appointmentTime));
     if (!$appointmentTime || count($appointmentTime) < 1) {
         $this->message('错误的预约时间!');
     }
     // 只有30分钟的项目
     if (count($appointmentTime) == 1) {
         array_push($appointmentTime, $appointmentTime[0]);
     }
     // 只保留头和尾的两个数据
     $startTime = array_shift($appointmentTime);
     $endTime = array_pop($appointmentTime);
     if ($endTime < $startTime) {
         $this->message('错误的预约时间!');
     }
     // 预约时间是否小于当前时间
     $now = date('Y-m-d H:i');
     if (DateUtil::buildDateTime($appointmentDay, $startTime) < $now) {
         $this->message('错误的预约开始时间!');
     }
     if (DateUtil::buildDateTime($appointmentDay, $endTime) < $now) {
         $this->message('错误的预约结束时间!');
     }
     // 结束时间 + 30分钟为真正的结束时间
     //$timeStamp = DateUtil::buildDateTime($appointmentDay, $endTime);
     //$timeStamp += 1800;
     //$endTime = date('H:i', $timeStamp);
     // 处理优惠
     $couponId = $this->input->get('coupon_id', true) + 0;
     $couponCode = $this->input->get('coupon_code', true) + 0;
     $customerCouponModel = new CustomerCouponModel();
     $couponCodeModel = new CouponCodeModel();
     $today = date('Y-m-d');
     if ($couponId) {
         $couponCode = '';
         $coupon = $customerCouponModel->readOneById($couponId);
         // 判断是否能使用
         if ($coupon['is_use'] == 1) {
             $this->message('选择的优惠券已被使用!');
         }
         // 是否到领取时间
         if ($today < $coupon['start_time']) {
             $this->message('优惠券未到使用时间!');
         }
         if ($today > $coupon['expire_time']) {
             $this->message('优惠券已到期!');
         }
     } else {
         if ($couponCode) {
             $couponId = '';
             $queryCouponCode = $couponCodeModel->readOneByCode($couponCode);
             if (!$queryCouponCode) {
                 $this->message('优惠码不存在!');
             }
             // 是否到使用时间
             if ($today < $queryCouponCode['start_time']) {
                 $this->message('优惠码未到使用时间!');
             }
             // 是有已过期
             if ($today > $queryCouponCode['expire_time']) {
                 $this->message('优惠码已到期!');
             }
         } else {
         }
//.........这里部分代码省略.........
开发者ID:guohao214,项目名称:xinya,代码行数:101,代码来源:Cart.php


注:本文中的DateUtil::buildDateTime方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。