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


PHP DateUtil::now方法代码示例

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


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

示例1: index

 public function index()
 {
     $error = '';
     if (RequestUtil::isPost()) {
         $validate = new ValidateUtil();
         $validate->required('user_name');
         $validate->required('password');
         $validate->required('verify_code');
         $params = RequestUtil::postParams();
         if ($params['verify_code'] != UserUtil::getVerifyCode()) {
             $error = '验证码错误!';
         } else {
             if ($validate->run()) {
                 $userModel = new UserModel();
                 $params['password'] = $userModel->encodePassword($params['password']);
                 $where = array('user_name' => $params['user_name'], 'password' => $params['password']);
                 $user = (new CurdUtil($userModel))->readOne($where, 'user_id desc', '*, user_type+0 as type');
                 if (!$user) {
                     $error = '登录失败,账号或者密码错误,请重试!';
                 } else {
                     (new CurdUtil($userModel))->update($where, array('last_login_time' => DateUtil::now()));
                     UserUtil::saveUser($user);
                     if (UserUtil::isAdmin()) {
                         ResponseUtil::redirect(UrlUtil::createBackendUrl('project/index'));
                     } else {
                         ResponseUtil::redirect(UrlUtil::createBackendUrl('beautician/index'));
                     }
                 }
             }
         }
     }
     $this->load->view('backend/login', array('error' => $error));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:33,代码来源:Login.php

示例2: payed

 /**
  * 设置订单为已支付
  * @param $orderNo
  * @param $openId
  * @param $wxOrderNo 微信订单号
  */
 public function payed($orderNo, $wxOrderNo)
 {
     $where = array('order_no' => $orderNo);
     $updateData = array('pay_time' => DateUtil::now(), 'order_status' => self::ORDER_PAYED, 'transaction_id' => $wxOrderNo);
     $this->db->where($where);
     $this->db->update($this->table, $updateData);
     return $this->db->affected_rows();
 }
开发者ID:guohao214,项目名称:xinya,代码行数:14,代码来源:OrderModel.php

示例3: log

 public static function log($mainTitle, $message, $file = 'log')
 {
     $saveFile = APPPATH . DIRECTORY_SEPARATOR . 'logs';
     $saveFile = $saveFile . DIRECTORY_SEPARATOR . $file . date('Y-m-d');
     if (!is_string($message)) {
         $message = json_encode($message);
     }
     $mainTitle = DateUtil::now() . ' ' . $mainTitle;
     file_put_contents($saveFile, $mainTitle . $message . "\n\n" . str_repeat('-', 80) . "\n", FILE_APPEND);
 }
开发者ID:guohao214,项目名称:xinya,代码行数:10,代码来源:LogUtil.php

示例4: backup

 /**
  * 数据库备份
  */
 public function backup()
 {
     $this->load->dbutil();
     $backup = $this->dbutil->backup();
     $this->load->helper('file');
     $filePath = MAIN_ROOT . 'backup' . DS . date('YmdHis') . '.gz';
     if (write_file($filePath, $backup)) {
         (new CurdUtil($this->backupModel))->create(array('file_path' => $filePath, 'create_time' => DateUtil::now()));
         $this->message('备份成功', 'tool/index');
     } else {
         $this->message('备份失败,请重试!');
     }
 }
开发者ID:guohao214,项目名称:xinya,代码行数:16,代码来源:Tool.php

示例5: addCategory

 public function addCategory()
 {
     if (RequestUtil::isPost()) {
         if ($this->categoryModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $insertId = (new CurdUtil($this->categoryModel))->create(array('category_name' => $params['category_name'], 'order_sort' => $params['order_sort'], 'create_time' => DateUtil::now()));
             if ($insertId) {
                 $this->message('新增分类成功!', 'category/index');
             } else {
                 $this->message('新增分类失败!', 'category/index');
             }
         }
     }
     $this->view('category/addCategory');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:15,代码来源:Category.php

示例6: addCouponCode

 /**
  * 新增优惠码
  */
 public function addCouponCode()
 {
     if (RequestUtil::isPost()) {
         if ($this->couponCodeModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $insertId = (new CurdUtil($this->couponCodeModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增优惠码成功!', 'couponCode/index');
             } else {
                 $this->message('新增优惠码失败!', 'couponCode/index');
             }
         }
     }
     $this->view('couponCode/addCouponCode');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:18,代码来源:CouponCode.php

示例7: addShop

 /**
  * 添加店铺
  */
 public function addShop()
 {
     if (RequestUtil::isPost()) {
         if ($this->shopModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $params['shop_logo'] = UploadUtil::commonUpload(array('upload/resize_200x200', 'upload/resize_100x100'));
             $insertId = (new CurdUtil($this->shopModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增店铺成功!', 'shop/index');
             } else {
                 $this->message('新增店铺失败!', 'shop/index');
             }
         }
     }
     $this->view('shop/addShop');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:19,代码来源:Shop.php

示例8: addCoupon

 /**
  * 新增优惠券
  */
 public function addCoupon()
 {
     if (RequestUtil::isPost()) {
         if ($this->couponModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $params['remain_number'] = $params['total_number'];
             $insertId = (new CurdUtil($this->couponModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增优惠券成功!', 'coupon/index');
             } else {
                 $this->message('新增优惠券失败!', 'coupon/index');
             }
         }
     }
     $this->view('coupon/addCoupon');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:19,代码来源:coupon.php

示例9: addUser

 public function addUser()
 {
     if (RequestUtil::isPost()) {
         if ($this->userModel->rules()->run()) {
             $params = RequestUtil::postParams();
             unset($params['re_password']);
             $params['password'] = $this->userModel->encodePassword($params['password']);
             $insertId = (new CurdUtil($this->userModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增账户成功!', 'user/index');
             } else {
                 $this->message('新增账户失败!', 'user/index');
             }
         }
     }
     $this->view('user/addUser');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:17,代码来源:User.php

示例10: addExchangeGoods

 /**
  * 新增优惠券
  */
 public function addExchangeGoods()
 {
     if (RequestUtil::isPost()) {
         if ($this->exchangeGoodsModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $params['remain_number'] = $params['total_number'];
             $params['exchange_goods_pic'] = UploadUtil::commonUpload(array('upload/resize_200x200', 'upload/resize_600x600', 'upload/resize_100x100'));
             $insertId = (new CurdUtil($this->exchangeGoodsModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增兑换商品成功!', 'exchangeGoods/index');
             } else {
                 $this->message('新增兑换商品失败!', 'exchangeGoods/index');
             }
         }
     }
     $this->view('exchangeGoods/addExchangeGoods');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:20,代码来源:ExchangeGoods.php

示例11: addSlider

 public function addSlider()
 {
     if (RequestUtil::isPost()) {
         $this->sliderModel->deleteSliderCache();
         $params = RequestUtil::postParams();
         // href
         if (!preg_match('~^http[s]?://~', $params['href'])) {
             $params['href'] = 'http://' . $params['href'];
         }
         if ($this->sliderModel->rules()->run()) {
             $params['pic'] = UploadUtil::commonUpload(array('upload/resize_200x200', 'upload/resize_100x100', 'upload/resize_600x600'));
             $insertId = (new CurdUtil($this->sliderModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增成功!', 'slider/index');
             } else {
                 $this->message('新增失败!', 'slider/index');
             }
         }
     }
     $this->view('slider/addSlider');
 }
开发者ID:guohao214,项目名称:xinya,代码行数:21,代码来源:Slider.php

示例12: CancelOrder

 /**
  * 取消订单
  * @param string $order_id
  */
 public function CancelOrder($order_id = '')
 {
     if (!$order_id) {
         $this->message('订单ID不能为空!');
     }
     $orderModel = new OrderModel();
     // 获得订单
     $order = $orderModel->readOne($order_id);
     if (!$order) {
         ResponseUtil::failure('取消订单失败!');
     }
     // 获得积分ID
     $couponId = $order['use_coupon_id'];
     if ($couponId) {
         (new CustomerCouponModel())->refundCoupon($couponId, $order['open_id']);
     }
     if ((new CurdUtil($this->orderModel))->update(array('order_id' => $order_id), array('order_status' => OrderModel::ORDER_CANCEL, 'complete_time' => DateUtil::now()))) {
         $this->message('订单已取消!');
     } else {
         $this->message('处理失败!');
     }
 }
开发者ID:guohao214,项目名称:xinya,代码行数:26,代码来源:Order.php

示例13: addBeauticianRest

 public function addBeauticianRest($beautician_id)
 {
     $beautician = (new BeauticianModel())->readOne($beautician_id);
     if (!$beautician) {
         $this->message('美容师记录不存在!');
     }
     $beauticianRestModel = new BeauticianRestModel();
     if (RequestUtil::isPost()) {
         if ($beauticianRestModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $insertId = (new CurdUtil($beauticianRestModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             if ($insertId) {
                 $this->message('新增请假记录成功!', 'beautician/rest?beautician_id=' . $beautician_id);
             } else {
                 $this->message('新增请假记录失败!', 'beautician/rest?beautician_id=' . $beautician_id);
             }
         }
     }
     $this->view('beautician/addBeauticianRest', array('beautician_id' => $beautician_id, 'beautician' => $beautician));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:20,代码来源:Beautician.php

示例14: 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

示例15: addProject

 public function addProject()
 {
     if (RequestUtil::isPost()) {
         if ($this->projectModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $mainProjectId = $params['main_project_id'];
             unset($params['main_project_id']);
             $params['project_cover'] = UploadUtil::commonUpload(array('upload/resize_200x200', 'upload/resize_600x600', 'upload/resize_100x100'));
             $insertId = (new CurdUtil($this->projectModel))->create(array_merge($params, array('create_time' => DateUtil::now())));
             // 关联项目
             if ($mainProjectId) {
                 (new CurdUtil(new ProjectRelationModel()))->create(array('main_project_id' => $mainProjectId, 'relation_project_id' => $insertId));
             }
             if ($insertId) {
                 $this->message('新增项目成功!', 'project/index');
             } else {
                 $this->message('新增项目失败!', 'project/index');
             }
         }
     }
     $categories = (new CategoryModel())->getAllCategories();
     $shops = (new ShopModel())->getAllShops();
     $this->view('project/addProject', array('categories' => $categories, 'shops' => $shops));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:24,代码来源:Project.php


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