Esempio n. 1
0
	public function __construct(){
		parent::__construct();
		$agent = $_SERVER['HTTP_USER_AGENT']; 
		if (!strpos($agent, "MicroMessenger")) {
			//echo '此功能只能在微信浏览器中使用';exit;
		}
		
		//$this->token = isset($_REQUEST['token']) ? htmlspecialchars($_REQUEST['token']) : '';//$this->_get('token');
		
		//$this->assign('token', $this->token);
		//$this->wecha_id	= isset($_REQUEST['wecha_id']) ? $_REQUEST['wecha_id'] : '';
		
		//$this->assign('wecha_id', $this->wecha_id);
		$this->wecha_id = isset($_REQUEST['wecha_id']) ? htmlspecialchars($_REQUEST['wecha_id']) :  '';//$this->wecha_id;
		$this->token = isset($_REQUEST['token']) ? htmlspecialchars($_REQUEST['token']) :  '';//$this->_get('token');
		$this->_rid = isset($_REQUEST['reid']) ? intval($_REQUEST['reid']) :  0;
		if ($this->_research = M('Research')->where(array('id' => $this->_rid, 'token' => $this->token))->find()) {
			$this->assign('research', $this->_research);
			$this->assign('rid', $this->_rid);
			$this->assign('metaTitle', $this->_research['title']);
		} else {
			exit('调研不存在');
		}
		
	}
Esempio n. 2
0
 public function __construct()
 {
     parent::_initialize();
     $id = (int) $this->_get('id');
     if (!$id) {
         $this->error('不存在的活动');
     }
     $wecha_id = $this->wecha_id;
     $token = $this->_get('token');
     $Lottery = M('Lottery')->field('statdate,enddate,canrqnums,aginfo,title')->where(array('id' => $id, 'token' => $token, 'type' => 8))->find();
     if (!$Lottery) {
         $this->error('不存在的活动');
     }
     $record = M('Lottery_record')->field('usenums')->where(array('token' => $token, 'wecha_id' => $wecha_id, 'lid' => $id))->find();
     if ($Lottery['statdate'] > time()) {
         //活动未开始
         $this->error('活动未开始,请在' . date('Y-m-d H:i:s', $Lottery['statdate']) . '后再来参加活动!');
     }
     $mpName = M('Wxuser')->where(array('token' => $token))->getField('weixin');
     $keyword = M('Keyword')->where(array('token' => $token, 'module' => 'Lottery', 'pid' => $id))->getField('keyword');
     $this->assign('mpName', $mpName);
     $this->assign('keyword', $keyword);
     $this->assign('canrqnums', $Lottery['canrqnums']);
     $this->assign('aginfo', $Lottery['aginfo']);
     $this->assign('title', $Lottery['title']);
 }
 public function __construct(){
     parent :: _initialize();
     $id = (int)$this -> _get('id');
     if(!$id) $this -> error('不存在的活动');
     $wecha_id = $this -> _get('wecha_id');
     $token = $this -> _get('token');
     $Lottery = M('Lottery') -> field('statdate,enddate,canrqnums,aginfo,title') -> where(array('id' => $id, 'token' => $token, 'type' => 7)) -> find();
     if(!$Lottery) $this -> error('不存在的活动');
     $record = M('Lottery_record') -> field('usenums') -> where(array('token' => $token, 'wecha_id' => $wecha_id, 'lid' => $id)) -> find();
     if ($Lottery['statdate'] > time()){
         $this -> error('活动未开始,请在' . date('Y-m-d H:i:s', $Lottery['statdate']) . '后再来参加活动!');
     }
     $this -> assign('canrqnums', $Lottery['canrqnums']);
     $this -> assign('aginfo', $Lottery['aginfo']);
     $this -> assign('title', $Lottery['title']);
 }
Esempio n. 4
0
 public function _initialize()
 {
     parent::_initialize();
     $id = $this->_get('id', 'intval');
     $bid = M('Lottery')->where(array('id' => $id, 'token' => $this->token))->getField('zjpic');
     if (!$id) {
         $this->error('不存在的活动');
     }
     $Activity = M('Activity')->field('statdate,enddate,canrqnums,aginfo,title')->where(array('id' => $bid, 'token' => $this->token, 'type' => 10))->find();
     if (!$Activity) {
         $this->error('不存在的活动');
     }
     if ($Activity['statdate'] > time()) {
         $this->error('活动未开始,请在' . date('Y-m-d H:i:s', $Activity['statdate']) . '后再来参加活动!');
     }
     $mpName = M('Wxuser')->where(array('token' => $this->token))->getField('weixin');
     $keyword = M('Keyword')->where(array('token' => $this->token, 'module' => 'Activity', 'pid' => $bid))->getField('keyword');
     $this->assign('mpName', $mpName);
     $this->assign('keyword', $keyword);
     $this->assign('canrqnums', $Activity['canrqnums']);
     $this->assign('aginfo', $Activity['aginfo']);
     $this->assign('title', $Activity['title']);
 }
Esempio n. 5
0
	public function edit(){
		$rid = isset($_GET['researchid']) ? intval($_GET['researchid']) : 0;
		$data = M('Research')->where(array('id' => $rid, 'token' => $this->token))->find();
		if (empty($data)) {
			$this->redirect(U('Research/index'));
		}
		$this->assign('research', $data);
		parent::edit(6);
	}
Esempio n. 6
0
 public function __construct()
 {
     parent::_initialize();
 }
Esempio n. 7
0
 public function edit()
 {
     parent::edit($this->lotteryType);
 }
Esempio n. 8
0
 public function edit()
 {
     parent::edit(1);
 }
Esempio n. 9
0
	public function edit(){
		$cardid = M('Lottery')->where(array('token'=>$this->token,'id'=>intval($_GET['id'])))->getField('cardid');
		$this->assign('cardid',$cardid);
		$Member_card_set_list = M("member_card_set")->where(array('token'=>$this->token))->field('id,cardname')->select();
		$this->assign("Member_card_set_list",$Member_card_set_list);
		$Member_card_coupon_list = M("member_card_coupon")->where(array('token'=>$this->token,'attr'=>'0','is_delete'=>0,'is_weixin'=>0,'type'=>1,'cardid'=>intval($cardid)))->field('id,title,total')->select();
		$this->assign("Member_card_coupon_list",$Member_card_coupon_list);
		if(IS_POST){
			$thisLottery = M('lottery')->where(array('token'=>$this->token,'id'=>intval($_GET['id'])))->find();
			if($thisLottery['fist'] != ''){
				$lottery_card_coupon_count1 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'fist'=>$thisLottery['fist']))->count();
				$lottery_card_coupon_count2 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'second'=>$thisLottery['fist']))->count();
				$lottery_card_coupon_count3 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'third'=>$thisLottery['fist']))->count();
				$lottery_card_coupon_count4 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'four'=>$thisLottery['fist']))->count();
				$lottery_card_coupon_count5 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'five'=>$thisLottery['fist']))->count();
				$lottery_card_coupon_count6 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'six'=>$thisLottery['fist']))->count();
				$lottery_card_coupon_count = $lottery_card_coupon_count1+$lottery_card_coupon_count2+$lottery_card_coupon_count3+$lottery_card_coupon_count4+$lottery_card_coupon_count5+$lottery_card_coupon_count6;
				if($lottery_card_coupon_count < 2){
					$up_card_coupon_0 = M("member_card_coupon")->where(array('token'=>$this->token,'cardid'=>$thisLottery['cardid'],'id'=>intval($thisLottery['fist'])))->save(array('is_huodong'=>0));
				}
			}
			if($thisLottery['second'] != ''){
				$lottery_card_coupon_count1 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'fist'=>$thisLottery['second']))->count();
				$lottery_card_coupon_count2 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'second'=>$thisLottery['second']))->count();
				$lottery_card_coupon_count3 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'third'=>$thisLottery['second']))->count();
				$lottery_card_coupon_count4 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'four'=>$thisLottery['second']))->count();
				$lottery_card_coupon_count5 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'five'=>$thisLottery['second']))->count();
				$lottery_card_coupon_count6 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'six'=>$thisLottery['second']))->count();
				$lottery_card_coupon_count = $lottery_card_coupon_count1+$lottery_card_coupon_count2+$lottery_card_coupon_count3+$lottery_card_coupon_count4+$lottery_card_coupon_count5+$lottery_card_coupon_count6;
				if($lottery_card_coupon_count < 2){
					$up_card_coupon_0 = M("member_card_coupon")->where(array('token'=>$this->token,'cardid'=>$thisLottery['cardid'],'id'=>intval($thisLottery['second'])))->save(array('is_huodong'=>0));
				}
			}
			if($thisLottery['third'] != ''){
				$lottery_card_coupon_count1 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'fist'=>$thisLottery['third']))->count();
				$lottery_card_coupon_count2 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'second'=>$thisLottery['third']))->count();
				$lottery_card_coupon_count3 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'third'=>$thisLottery['third']))->count();
				$lottery_card_coupon_count4 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'four'=>$thisLottery['third']))->count();
				$lottery_card_coupon_count5 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'five'=>$thisLottery['third']))->count();
				$lottery_card_coupon_count6 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'six'=>$thisLottery['third']))->count();
				$lottery_card_coupon_count = $lottery_card_coupon_count1+$lottery_card_coupon_count2+$lottery_card_coupon_count3+$lottery_card_coupon_count4+$lottery_card_coupon_count5+$lottery_card_coupon_count6;
				if($lottery_card_coupon_count < 2){
					$up_card_coupon_0 = M("member_card_coupon")->where(array('token'=>$this->token,'cardid'=>$thisLottery['cardid'],'id'=>intval($thisLottery['third'])))->save(array('is_huodong'=>0));
				}
			}
			if($thisLottery['four'] != ''){
				$lottery_card_coupon_count1 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'fist'=>$thisLottery['four']))->count();
				$lottery_card_coupon_count2 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'second'=>$thisLottery['four']))->count();
				$lottery_card_coupon_count3 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'third'=>$thisLottery['four']))->count();
				$lottery_card_coupon_count4 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'four'=>$thisLottery['four']))->count();
				$lottery_card_coupon_count5 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'five'=>$thisLottery['four']))->count();
				$lottery_card_coupon_count6 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'six'=>$thisLottery['four']))->count();
				$lottery_card_coupon_count = $lottery_card_coupon_count1+$lottery_card_coupon_count2+$lottery_card_coupon_count3+$lottery_card_coupon_count4+$lottery_card_coupon_count5+$lottery_card_coupon_count6;
				if($lottery_card_coupon_count < 2){
					$up_card_coupon_0 = M("member_card_coupon")->where(array('token'=>$this->token,'cardid'=>$thisLottery['cardid'],'id'=>intval($thisLottery['four'])))->save(array('is_huodong'=>0));
				}
			}
			if($thisLottery['five'] != ''){
				$lottery_card_coupon_count1 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'fist'=>$thisLottery['five']))->count();
				$lottery_card_coupon_count2 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'second'=>$thisLottery['five']))->count();
				$lottery_card_coupon_count3 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'third'=>$thisLottery['five']))->count();
				$lottery_card_coupon_count4 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'four'=>$thisLottery['five']))->count();
				$lottery_card_coupon_count5 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'five'=>$thisLottery['five']))->count();
				$lottery_card_coupon_count6 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'six'=>$thisLottery['five']))->count();
				$lottery_card_coupon_count = $lottery_card_coupon_count1+$lottery_card_coupon_count2+$lottery_card_coupon_count3+$lottery_card_coupon_count4+$lottery_card_coupon_count5+$lottery_card_coupon_count6;
				if($lottery_card_coupon_count < 2){
					$up_card_coupon_0 = M("member_card_coupon")->where(array('token'=>$this->token,'cardid'=>$thisLottery['cardid'],'id'=>intval($thisLottery['five'])))->save(array('is_huodong'=>0));
				}
			}
			if($thisLottery['six'] != ''){
				$lottery_card_coupon_count1 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'fist'=>$thisLottery['six']))->count();
				$lottery_card_coupon_count2 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'second'=>$thisLottery['six']))->count();
				$lottery_card_coupon_count3 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'third'=>$thisLottery['six']))->count();
				$lottery_card_coupon_count4 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'four'=>$thisLottery['six']))->count();
				$lottery_card_coupon_count5 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'five'=>$thisLottery['six']))->count();
				$lottery_card_coupon_count6 = M('lottery')->where(array('token'=>$this->token,'type'=>3,'six'=>$thisLottery['six']))->count();
				$lottery_card_coupon_count = $lottery_card_coupon_count1+$lottery_card_coupon_count2+$lottery_card_coupon_count3+$lottery_card_coupon_count4+$lottery_card_coupon_count5+$lottery_card_coupon_count6;
				if($lottery_card_coupon_count < 2){
					$up_card_coupon_0 = M("member_card_coupon")->where(array('token'=>$this->token,'cardid'=>$thisLottery['cardid'],'id'=>intval($thisLottery['six'])))->save(array('is_huodong'=>0));
				}
			}
			//--------------
			$where_card_coupon['cardid'] = intval($_POST['cardid']);
			$where_card_coupon['token'] = $this->token;
			$save_card_coupon['is_huodong'] = 1;
			if($_POST['fist'] != ''){
				$where_card_coupon['id'] = intval($_POST['fist']);
				$up_card_coupon = M("member_card_coupon")->where($where_card_coupon)->save($save_card_coupon);
			}
			if($_POST['second'] != ''){
				$where_card_coupon['id'] = intval($_POST['second']);
				$up_card_coupon = M("member_card_coupon")->where($where_card_coupon)->save($save_card_coupon);
			}
			if($_POST['third'] != ''){
				$where_card_coupon['id'] = intval($_POST['third']);
				$up_card_coupon = M("member_card_coupon")->where($where_card_coupon)->save($save_card_coupon);
			}
			if($_POST['four'] != ''){
				$where_card_coupon['id'] = intval($_POST['four']);
				$up_card_coupon = M("member_card_coupon")->where($where_card_coupon)->save($save_card_coupon);
			}
			if($_POST['five'] != ''){
				$where_card_coupon['id'] = intval($_POST['five']);
				$up_card_coupon = M("member_card_coupon")->where($where_card_coupon)->save($save_card_coupon);
			}
			if($_POST['six'] != ''){
				$where_card_coupon['id'] = intval($_POST['six']);
				$up_card_coupon = M("member_card_coupon")->where($where_card_coupon)->save($save_card_coupon);
			}
		}
		parent::edit(3);
	}