S50controller


java类

trunk_zhouyou\WEB-INF\classes\ttmy\module\s50\controller\S50controller.java


jsp页面


trunk_zhouyou\jsp\login.jsp




package ttmy.module.s50.controller;


import java.text.SimpleDateFormat;

import java.util.ArrayList;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.servlet.ModelAndView;

import org.springframework.web.servlet.view.RedirectView;

import ttmy.framework.base.controller.BaseController;

import ttmy.framework.context.UserContext;

import ttmy.framework.util.SessionUtils;

import ttmy.module.s50.model.Active;

import ttmy.module.s50.model.PhonePrize;

import ttmy.module.s50.service.IS50service;

import ttmy.module.s50.service.IS50service.TodayOverException;


@Controller

public class S50controller extends BaseController

{


  @Resource(name="s50service")

  private IS50service s50service;


  @RequestMapping({"loginPage.htm"})

  public ModelAndView toLogin()

  {

    if (this.s50service.activeIsOver()) {

      return new ModelAndView(new RedirectView("resshow.htm"));

    }


    Active a = this.s50service.getActive();

    SimpleDateFormat sdf = new SimpleDateFormat("MM月dd日");

    return new ModelAndView("login", "tmd", sdf.format(a.getFromDt()) + "到" + sdf.format(a.getToDt()) + "抢红包");

  }


  @RequestMapping({"actionrulePage.htm"})

  public String toActionRole()

  {

    return "actionrule";

  }


  @RequestMapping({"login.htm"})

  public ModelAndView login(String phone)

  {

    if (this.s50service.activeIsOver())

      return new ModelAndView(new RedirectView("resshow.htm"));


    if (phone != null)

      phone = phone.trim();

    if ((phone == null) || (!(phone.matches("^\\d{11}$"))))

      return new ModelAndView("loginfail", "msg", "请输入正确的手机号码,才可以参与活动!");

    UserContext.setUserId(2L);

    UserContext.setRoleId(6345653681207115777L);

    SessionUtils.setAttribute("phone", phone);

    if (this.s50service.hasGift(phone))

      return new ModelAndView("loginfail_hasPhone", "msg", "该号码已领取过奖励,不可以再次参与活动!");


    return new ModelAndView("openpkg");

  }


  @RequestMapping({"openpkgPage.htm"})

  public ModelAndView openPkgPage() {

    return new ModelAndView("openpkg");

  }


  @RequestMapping({"openpkg.htm"})

  public ModelAndView openpkg() {

    if (this.s50service.activeIsOver())

      return new ModelAndView(new RedirectView("resshow.htm"));


    String phone = (String)SessionUtils.getAttribute("phone");

    try {

      String gift = this.s50service.getGift(phone);

      if (gift == null)

        return new ModelAndView("wzj","msg",this.s50service.loadTimes(phone));

      return new ModelAndView("zj", "msg", "恭喜您获得" + gift); } catch (IS50service.TodayOverException e) {

    }

    return new ModelAndView("todayover");

  }


  @RequestMapping({"ljPage.htm"})

  public ModelAndView ljPage()

  {

    String phone = (String)SessionUtils.getAttribute("phone");

    return new ModelAndView("lj", "msg", phone);

  }


  @RequestMapping({"tijiao.htm"})

  public ModelAndView tijiao(String name, String phone, String city) {

    this.s50service.saveZjjl(name, phone, city);

    SessionUtils.setAttribute("phone", phone);

    return new ModelAndView("tjover");

  }


  @RequestMapping({"zjjl.htm"})

  public ModelAndView zjjl() {

    String phone = (String)SessionUtils.getAttribute("phone");

    PhonePrize pp = this.s50service.loadPhonePrize(phone);

    return new ModelAndView("zjjl", "pp", pp);

  }


  @RequestMapping({"resshow.htm"})

  public ModelAndView resshow() {

    List ppl = this.s50service.loadAllPP();

    List res = new ArrayList(ppl.size());

    for (int i = 1; i <= ppl.size(); ++i) {

      PhonePrize pp = (PhonePrize)ppl.get(i - 1);

      res.add(new PP(i, pp.getName(), pp.getPhone(), pp.getPz(), "two"));

    }

    return new ModelAndView("resshow", "res", res);

  }


  @RequestMapping({"share.htm"})

  public ModelAndView share() {

    this.s50service.share();

    return new ModelAndView("share");

  }

}


---login.jsp

<%@ page contentType="text/html; charset=utf-8"%>

<!doctype html>

<html xml:lang="zh_CN">

<head>

    <meta charset="utf-8" />

    <title>景逸S50幸福红包抢不停</title>

    <meta name="description" content="景逸S50幸福红包抢不停" />

    <meta name="author" content="liangluo" />

    <meta name="viewport" content="target-densitydpi=device-dpi, initial-scale=1.0, width=device-width, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />

    <meta name="format-detection" content="telephone=no" />

    <meta name="apple-mobile-web-app-capable" content="yes">

    <link href="css/touch.css" rel="stylesheet" media="all" />

</head>

<body>

 <div>

  <p><img src="img/title.png" alt="" /></p>

  <p><img src="img/car.png" alt="" /></p>

  <P><span>${tmd}</span></P>

  <p>快来参与吧!</p>

  <p><label>电话:</label><input id="phonei" type="text" name="userphone"/></p>

  <p class="c_yellow mt1">请 输 入 您 的 手 机 号 码,一 定 要 输 入 正 确,</p>

  <p>不 然 有 可 能 领 不 到 奖 励 !</p>

  <a href="javascript:fun1();" class="btn_hb mt1"></a>

  <a href="javascript:fun2();" class="btn_act mt5"></a>

 </div>

 <script src="js/zepto.min.js"></script>

 <script>

 function fun1() {

var phone = document.getElementById("phonei").value;

window.location.href="login.htm?phone="+phone;

}

function fun2() {

window.location.href='actionrulePage.htm';

}

$(document).ready(function(){

     var winH=$(window).height();

     var docH=$(document).height();

      if(winH>docH){

        $('.mod-wrap').css('height',winH);

      }else{

        $('.mod-wrap').css('height',docH);

      }

});

 </script>

<script type="text/javascript">

(function() {

var $$ = function(id) {

return document.getElementById(id);

}

function setHtmlFontSize() {

var baseWidth = 640,

baseFontSize = 40,

newSize;

   newSize = parseInt( ((window.innerWidth) / baseWidth) * 10000 * baseFontSize ) / 10000;

document.documentElement.style.fontSize = newSize + "px";

}

setHtmlFontSize();

window.onload = function() {

setTimeout(setHtmlFontSize,0);

}

})();

</script>

</body>

</html>



转载于:https://my.oschina.net/u/3052/blog/348929

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值