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


PHP RequestUtil::postParams方法代码示例

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


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

示例1: index

 public function index()
 {
     $workTime = new WorkTimeUtil();
     if (RequestUtil::isPost()) {
         $params = RequestUtil::postParams();
         $params = array_map(function ($time) {
             if (!preg_match("~^\\d{2}:\\d{2}:\\d{2}\$~", $time)) {
                 return "{$time}:00";
             } else {
                 return $time;
             }
         }, $params);
         $allDay = $workTime->build($params['allDayStart'], $params['allDayEnd']);
         $morningShift = $workTime->build($params['morningShiftStart'], $params['morningShiftEnd']);
         $middayShift = $workTime->build($params['middayShiftStart'], $params['middayShiftEnd']);
         $nightShift = $workTime->build($params['nightShiftStart'], $params['nightShiftEnd']);
         $workTime->saveWorkTime($allDay, $morningShift, $nightShift, $middayShift);
         $workTime->getTime();
     }
     list($allDayStart, $allDayEnd) = $workTime->explode($workTime->getAllDay());
     list($morningShiftStart, $morningShiftEnd) = $workTime->explode($workTime->getMorningShift());
     list($middayShiftStart, $middayShiftEnd) = $workTime->explode($workTime->getMiddayShift());
     list($nightShiftStart, $nightShiftEnd) = $workTime->explode($workTime->getNightShift());
     $setting = array('allDayStart' => $allDayStart, 'allDayEnd' => $allDayEnd, 'morningShiftStart' => $morningShiftStart, 'morningShiftEnd' => $morningShiftEnd, 'nightShiftStart' => $nightShiftStart, 'nightShiftEnd' => $nightShiftEnd, 'middayShiftStart' => $middayShiftStart, 'middayShiftEnd' => $middayShiftEnd);
     $this->view('workTimeSetting', array('setting' => $setting));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:26,代码来源:WorkTime.php

示例2: updateSlider

 public function updateSlider($sliderId)
 {
     if (!$sliderId) {
         $this->message('ID不能为空!');
     }
     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()) {
             $upload = UploadUtil::commonUpload(array('upload/resize_200x200', 'upload/resize_100x100', 'upload/resize_600x600'));
             if ($upload) {
                 $params['pic'] = $upload;
             }
             $returnUrl = 'slider/updateSlider/' . $sliderId;
             if ((new CurdUtil($this->sliderModel))->update(array('slider_id' => $sliderId), $params)) {
                 $this->message('修改成功!', $returnUrl);
             } else {
                 $this->message('修改失败!', $returnUrl);
             }
         }
     }
     $slider = (new CurdUtil($this->sliderModel))->readOne(array('slider_id' => $sliderId, 'disabled' => 0));
     if (!$slider) {
         $this->message('记录不存在或者已被删除!', 'slider/index');
     }
     $this->view('slider/updateSlider', array('slider' => $slider));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:31,代码来源:Slider.php

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

示例4: addForNewUserProject

 /**
  * 增加新用户专享
  */
 public function addForNewUserProject()
 {
     if (RequestUtil::isPost()) {
         $params = RequestUtil::postParams();
         $insertId = (new CurdUtil($this->projectPropertyModel))->create($params);
         if ($insertId) {
             $this->message('新增成功!', 'ProjectProperty/projectForNewUserList');
         } else {
             $this->message('新增失败!');
         }
     }
     $categories = (new CategoryModel())->getAllCategories();
     $this->view('projectProperty/forNewUser', array('categories' => $categories));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:17,代码来源:ProjectProperty.php

示例5: addArticle

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

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

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

示例8: updateCouponCode

 public function updateCouponCode($couponCodeId, $limit = '')
 {
     if (!$couponCodeId) {
         $this->message('优惠码不能为空!');
     }
     if (RequestUtil::isPost()) {
         if ($this->couponCodeModel->rules()->run()) {
             $params = RequestUtil::postParams();
             if ((new CurdUtil($this->couponCodeModel))->update(array('coupon_code_id' => $couponCodeId), $params)) {
                 $this->message('修改优惠码成功!', 'couponCode/updateCouponCode/' . $couponCodeId . "/{$limit}");
             } else {
                 $this->message('修改优惠码失败!', 'couponCode/updateCouponCode/' . $couponCodeId . "/{$limit}");
             }
         }
     }
     $coupon = $this->couponCodeModel->readOne($couponCodeId);
     $this->view('couponCode/updateCouponCode', array('coupon' => $coupon, 'limit' => $limit));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:18,代码来源:CouponCode.php

示例9: updateCategory

 public function updateCategory($categoryId)
 {
     if (!$categoryId) {
         $this->message('分类ID错误!');
     }
     if (RequestUtil::isPost()) {
         if ($this->categoryModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $affectedRows = (new CurdUtil($this->categoryModel))->update(array('category_id' => $categoryId), array('category_name' => $params['category_name'], 'order_sort' => $params['order_sort']));
             if ($affectedRows > 0) {
                 $this->message('修改分类信息成功!', 'category/index');
             } else {
                 $this->message('修改分类信息失败!', 'category/index');
             }
         }
     }
     $category = (new CurdUtil($this->categoryModel))->readOne(array('category_id' => $categoryId));
     if (!$category) {
         $this->message('分类不存在!', 'category/index');
     }
     $this->view('category/updateCategory', $category);
 }
开发者ID:guohao214,项目名称:xinya,代码行数:22,代码来源:Category.php

示例10: updateExchangeGoods

 public function updateExchangeGoods($exchangeGoodsId, $limit = '')
 {
     if (RequestUtil::isPost()) {
         if ($this->exchangeGoodsModel->rules()->run()) {
             $params = RequestUtil::postParams();
             $upload = UploadUtil::commonUpload(array('upload/resize_200x200', 'upload/resize_600x600', 'upload/resize_100x100'));
             if ($upload) {
                 $params['exchange_goods_pic'] = $upload;
             }
             if ((new CurdUtil($this->exchangeGoodsModel))->update(array('exchange_goods_id' => $exchangeGoodsId), $params)) {
                 $this->message('修改兑换商品成功!', 'exchangeGoods/updateExchangeGoods/' . $exchangeGoodsId . "/{$limit}");
             } else {
                 $this->message('修改兑换商品失败!', 'exchangeGoods/updateExchangeGoods/' . $exchangeGoodsId . "/{$limit}");
             }
         }
     }
     $shops = (new ShopModel())->getAllShops();
     $exchangeGoods = $this->exchangeGoodsModel->readOne($exchangeGoodsId);
     if (!$exchangeGoods) {
         $this->message('兑换商品不存在或者已被删除!', "exchangeGoods/index/{$limit}");
     }
     $this->view('exchangeGoods/updateExchangeGoods', array('exchangeGoods' => $exchangeGoods, 'shops' => $shops, 'limit' => $limit));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:23,代码来源:ExchangeGoods.php

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

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

示例13: updateBeauticianWorkTime

 /**
  * 修改美容师工作时间
  * @param $beauticianId
  */
 public function updateBeauticianWorkTime($beauticianId)
 {
     $workTimeUtil = new WorkTimeUtil();
     $workTime = $workTimeUtil->beauticianWorkTime;
     /**
      * array (size=7)
      * 'work_type_0' => string '5' (length=1)
      * 'work_type_1' => string '2' (length=1)
      * 'work_type_2' => string '5' (length=1)
      * 'work_type_3' => string '3' (length=1)
      * 'work_type_4' => string '3' (length=1)
      * 'work_type_5' => string '2' (length=1)
      * 'work_type_6' => string '2' (length=1)
      */
     if (RequestUtil::isPost()) {
         $post = RequestUtil::postParams();
         $data = array();
         foreach ($post as $key => $value) {
             if (!preg_match('~^work_type_(\\d+)$~', $key, $matches)) {
                 continue;
             } else {
                 $w = $matches[1];
                 $data[$w] = $value;
             }
         }
         // 保持数据
         $workTime[$beauticianId] = $data;
         $workTimeUtil->saveBeauticianWorkTime($workTime);
     }
     $workTime = $workTimeUtil->getBeauticianWorkTime();
     $beauticianWorkTime = $workTime[$beauticianId];
     $timeSetting = $this->timeSetting;
     $beautician = (new BeauticianModel())->readOne($beauticianId);
     $this->view('beautician/updateBeauticianWorkTime', array('beauticianWorkTime' => $beauticianWorkTime, 'timeSetting' => $timeSetting, 'beauticianId' => $beauticianId, 'beautician' => $beautician));
 }
开发者ID:guohao214,项目名称:xinya,代码行数:39,代码来源:Beautician.php


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