Beispiel #1
0
 public function index($projectId)
 {
     $project = (new ProjectModel())->readOne($projectId + 0);
     if (!$project) {
         $this->message('项目不存在!');
     }
     $shops = (new ShopModel())->getAllShops();
     $beauticians = (new BeauticianModel())->getAllBeauticians();
     $days = DateUtil::buildDays();
     $this->view('offline/appointment', array('beauticians' => $beauticians, 'shops' => $shops, 'days' => $days, 'project' => $project));
 }
Beispiel #2
0
 /**
  * 展示预约页面
  * 选择美容师与预约时间
  * 此处要验证授权
  *
  * @param $shopId 店铺ID
  */
 public function index($shopId)
 {
     $weixinUtil = new WeixinUtil();
     // 验证是否已授权
     $weixinUtil->authorize("appointment/index/{$shopId}");
     // 获得预约项目
     $projectId = (new CartUtil())->cart();
     $projectId += 0;
     if (!$projectId) {
         $this->message('预约项目不存在!');
     }
     $openId = $weixinUtil->getOpenId();
     if ((new ProjectPropertyModel())->projectOnlyForNewUser($projectId, $openId)) {
         $this->message('此美容项目只针对新用户!');
     }
     //是否已经选择了店铺,并且店铺是有效的
     $shops = (new ShopModel())->getAllShops();
     if (is_numeric($shopId) && array_key_exists($shopId, $shops)) {
         // 获得项目信息
         $project = (new ProjectModel())->readOne($projectId);
         if (!$project) {
             $this->message('预约项目不存在!');
         }
         // 跳转到 选择 美容师
         $beauticians = (new BeauticianModel())->getAllBeauticians();
         $lastOrder = (new OrderModel())->getLastOrder($openId);
         $days = DateUtil::buildDays();
         $coupons = array();
         if ($project['can_use_coupon']) {
             // 查询优惠券
             $coupons = (new CustomerCouponModel())->getCustomerNotUseCouponList($openId);
         }
         $this->load->view('frontend/appointment/beautician', array('beauticians' => $beauticians, 'project' => $project, 'shopId' => $shopId, 'days' => $days, 'lastOrder' => $lastOrder, 'coupons' => $coupons));
     } else {
         // 跳转到选择店铺
         $returnUrl = urlencode(UrlUtil::createUrl('appointment/index'));
         ResponseUtil::redirect(UrlUtil::createUrl("shop/index?returnUrl={$returnUrl}"));
     }
 }