Ejemplo n.º 1
0
 function LoginAction()
 {
     $User = array('esalonshop01' => 'salon01', 'esalonshop02' => 'salon02', 'esalonshop03' => 'salon03', 'esalonshop04' => 'salon04', 'esalonshop05' => 'salon05');
     $UserName = \LfRequest::inStr("UserName");
     $Password = \LfRequest::inStr("Password");
     if (!isset($User[$UserName])) {
         $this->error("用户名或密码错误!");
         exit;
     }
     if ($User[$UserName] != $Password) {
         $this->error("用户名或密码错误!");
         exit;
     }
     session("used_shop", $UserName);
     cookie("used_shop", $UserName);
     $this->redirect("Coupon/Index");
 }
Ejemplo n.º 2
0
 public function useCoupon()
 {
     $id = \LfRequest::inNum('id');
     $uid = \LfRequest::inNum('user_id');
     $sid = \LfRequest::inNum('salon_id');
     $address = \LfRequest::inStr('address');
     //        $password = \LfRequest::inStr('password');
     //        $hash = 'UESTC_ESALON_80';
     //        if(md5($password)!= md5($hash)) {
     //            $this->error("密码错误,请重试!");
     //            exit();
     //        }
     $coupon = M('coupons')->find($id);
     if ($coupon['user_id'] != $uid) {
         $this->error('代金劵信息不符合,请确认');
     }
     if ($coupon['salon_id'] != $sid) {
         $this->error('代金劵信息不符合,请确认');
     }
     if ($coupon['is_used']) {
         $this->error('代金劵已经使用!');
     }
     $data['is_used'] = 1;
     $data['used_at'] = time();
     $data['used_where'] = $address;
     if (!empty(session('used_shop'))) {
         $used_shop = session('used_shop');
     }
     if (!empty(cookie('used_shop'))) {
         $used_shop = cookie('used_shop');
     }
     if (empty($used_shop)) {
         $this->error("商家未登录");
         die;
     }
     $data['used_shop'] = $used_shop;
     $res = M('coupons')->where(['id' => $id])->save($data);
     if ($res) {
         $this->success("使用成功", U("Coupon/Index"));
     }
 }
Ejemplo n.º 3
0
 function Summary()
 {
     //e_auth();
     $isSalon = \LfRequest::inStr('salon');
     if (IS_POST) {
         $e_id = \LfRequest::inNum('e_id');
         $summary = M('e_summary');
         $summary->user_id = session('user_id');
         $summary->e_id = $e_id;
         $isSummary = M('e_summary')->where(array('e_id' => $e_id, 'is_iteam' => 0, 'user_id' => session('user_id')))->find();
         if (!empty($isSummary)) {
             $this->error("你已总结该活动");
             exit;
         }
         $summary->stars = \LfRequest::inNum('stars');
         $summary->comment = \LfRequest::inStr('comment');
         if (strlen($summary->comment) > 900) {
             $this->error('总结字数需在300字以内');
             exit;
         }
         if ($isSalon == '1') {
             $summary->is_iteam = 0;
         } else {
             $summary->is_iteam = 1;
         }
         if ($_FILES['file']['size'] / (1024 * 1024) > 3) {
             $this->error('图片大小在3M以内');
             exit;
         }
         $upload = new \LfUpload('/Picture');
         $path = $upload->upload('file');
         if (!$path) {
             $this->error("图片上传错误 " . $upload->getErr());
             exit;
         }
         $summary->picture = '/Uploads' . $path;
         $res = $summary->add();
         if ($res) {
             /*
              * 当所有人都总结后设置iteam为已总结
             $SummaryNumber = $summary->where('e_id = '.$e_id)->count();
             $iteam = M('e_iteam')->find($e_id);
             if($iteam['participated_number'] == $SummaryNumber) {
             	M('e_iteam')->where('id ='.$e_id)->save(array('summary'=>1));
             }
             */
             /*
              * 暂定为有一人总结则该iteam为已总结
              */
             M('e_salon')->where('id =' . $e_id)->save(array('summary' => 1));
             $url = addons_url('Salon://Salon/CheckSalon', array('id' => $e_id));
             $this->success('总结成功,审核通过后可显示', $url);
             exit;
         } else {
             $this->error('总结失败');
             exit;
         }
     } else {
         $id = \LfRequest::inNum('e_id');
         $iteam = M('e_iteam')->find($id);
         $this->e_id = $id;
         $this->assign('iteam', $iteam);
         $this->title = "活动总结";
         $this->display();
     }
 }
Ejemplo n.º 4
0
 function GetSalonWith()
 {
     $status = \LfRequest::inStr('status');
     $type = \LfRequest::inStr('type');
     $day = \LfRequest::inStr('day');
     $space = \LfRequest::inStr('space');
     $param = array('type' => I('type', ''), 'day' => I('day', ''), 'space' => I('space', ''));
     $data = '';
     if (empty($type) && empty($day) && empty($space)) {
         redirect(addons_url('Salon://Salon/SalonSquare', array('status' => $status)));
     }
     if ($type != null) {
         if (!empty($space) || !empty($day)) {
             $data .= 'type = ' . "'" . $type . "'" . ' AND ';
         } else {
             $data .= 'type = ' . "'" . $type . "'";
         }
     }
     if ($space != null) {
         if (!empty($day)) {
             $data .= 'space = ' . "'" . $space . "'" . ' AND ';
         } else {
             $data .= 'space = ' . "'" . $space . "'";
         }
     }
     $today = date('Y-m-d', time());
     if ($day == 1) {
         $data .= 'start_date >= ' . strtotime($today) . ' AND start_date <= ' . (strtotime($today) + 24 * 3600);
     }
     if (!empty($day) && $day != 1) {
         if ($day >= 0) {
             $data .= 'start_date >= ' . strtotime($today) . ' AND start_date <= ' . (strtotime($today) + 24 * 3600 * $day) . ' AND end_date >= ' . time();
         } else {
             $data .= 'start_date >= ' . (strtotime($today) + 24 * 3600 * $day) . ' AND start_date <= ' . strtotime($today) . ' AND end_date <' . time();
         }
     }
     $map2 = $data . ' AND end_date < ' . time();
     $end_salons = M('e_salon')->where($map2)->select();
     $EndPage = \LfPageData::Page($end_salons, addons_url('Salon://Salon/GetSalonWith/status/end', $param));
     $this->end_salons = M('e_salon')->where($map2)->order('id desc')->limit($EndPage['offset'], $EndPage['perpagenum'])->select();
     $map1 = $data . ' AND end_date >= ' . time();
     $salons = M('e_salon')->where($map1)->select();
     $SignPage = \LfPageData::Page($salons, addons_url('Salon://Salon/GetSalonWith/status/sign', $param));
     $this->salons = M('e_salon')->where($map1)->order('id desc')->limit($SignPage['offset'], $SignPage['perpagenum'])->select();
     $this->assign('status', $status);
     $this->assign('EndPage', $EndPage);
     $this->assign('SignPage', $SignPage);
     $this->assign('url', 'Salon://Salon/CheckSalon');
     $this->assign('type', I('type', ''));
     $this->assign('day', I('day', ''));
     $this->assign('space', I('space', ''));
     $this->assign('title', '查询结果');
     $this->display('Salon/SalonSquare');
 }