function SalonSquare() { e_auth(); $status = \LfRequest::inStr('status'); if (empty($status)) { $status = 'sign'; } $map1['end_date'] = array('egt', time()); $salons = M('e_salon')->where($map1)->count(); $SignPage = \LfPageData::Page($salons, addons_url('Salon://Salon/SalonSquare/status/sign')); $this->salons = M('e_salon')->where($map1)->order('id desc')->limit($SignPage['offset'], $SignPage['perpagenum'])->select(); $map2['end_date'] = array('lt', time()); $end_salons = M('e_salon')->where($map2)->count(); $EndPage = \LfPageData::Page($end_salons, addons_url('Salon://Salon/SalonSquare/status/end')); $this->end_salons = M('e_salon')->where($map2)->order('id desc')->limit($EndPage['offset'], $EndPage['perpagenum'])->select(); $IteamType = M('e_iteam_type'); $types = $IteamType->select(); $this->assign('types', $types); $this->assign('status', $status); $this->assign('EndPage', $EndPage); $this->assign('SignPage', $SignPage); $this->assign('status', $status); $this->assign('title', 'E沙龙广场'); $this->assign('url', 'Salon://Salon/CheckSalon'); $this->display('Salon/SalonSquare'); }
function SignIteam() { e_auth(); $iteam_id = \LfRequest::inNum('e_id'); $iteam = M('e_iteam')->find($iteam_id); if (empty($iteam)) { $this->error('你要报名的iteam不存在'); } if ($iteam['publish_userid'] == session('user_id')) { $this->error('不能报名自己的iteam哦'); } if ($iteam['participate_number'] == $iteam['participated_number']) { $this->error("报名人数已达上限"); } $isParticipate = M('e_participate')->where('user_id =' . session('user_id') . ' AND e_id = ' . $iteam_id)->find(); if (!empty($isParticipate)) { $this->error('不能重复参加哦'); } $participate = M('e_participate'); $participate->e_id = $iteam_id; $participate->user_id = session('user_id'); $participate->is_iteam = 1; $res = $participate->add(); M('e_iteam')->where('id = ' . $iteam_id)->save(array('participated_number' => $iteam['participated_number'] + 1)); if ($res) { $this->success('报名成功'); } else { $this->error('报名失败'); } }
public function myCoupon() { e_auth(); $sid = \LfRequest::inNum('id'); $uid = session('user_id'); $coupon = M('coupons')->where(['salon_id' => $sid, 'user_id' => $uid])->find(); if (!$coupon) { $this->error("您还没有代金劵"); exit; } $user = M('e_user')->find($coupon['user_id']); $salon = M('e_salon')->find($coupon['salon_id']); if (!$user || !$salon) { $this->error("该代金劵信息有误,请核实!"); } $this->assign('coupon', $coupon); $this->assign('user', $user); $this->assign('salon', $salon); $this->assign('url', addons_url('Coupons://Coupons/showCoupon', ['code' => $coupon['code']])); $this->assign("coupon", $coupon); $this->display(); }