package com.iamberry.wechat.handles.wx; import java.io.IOException; import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.apache.commons.lang.StringUtils; import com.iamberry.wechat.core.entity.WechatUtils; import com.iamberry.wechat.core.entity.member.Member; import com.iamberry.wechat.face.member.MemberService; import com.iamberry.wechat.tools.NameUtils; /** * 微代理 跳转 * 2016年4月28日 * @author 穆再兴 * */ @Controller @RequestMapping("/wechat/agentWechat") public class AgentWechatHandler { @Autowired private MemberService memberService; /** * 2016年4月26日 * 微代理订单页面跳转 * @author 穆再兴 * @return * @throws IOException * @throws ServletException */ @RequestMapping("/order") public void toAgentOrder(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{ req.getRequestDispatcher("/WEB-INF/views/wechat/daili_order_list.html").forward(req,res); } @RequestMapping("/reback") public void toAgentReback(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{ req.getRequestDispatcher("/WEB-INF/views/wechat/daili_rebackOrder_list.html").forward(req,res); } /** * 会员<或微代理>中心页面跳转 * 2016年4月26日 * @author 穆再兴 * @param req * @param res * @throws IOException * @throws ServletException */ @RequestMapping("/member") public void toAgentMemberPage(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{ req.getRequestDispatcher("/WEB-INF/views/wechat/vip_center.html").forward(req,res); } /** * 微代理分销规则页面 跳转 * 2016年4月26日 * @author 穆再兴 * @throws IOException * @throws ServletException */ @RequestMapping("/fxRule") public void toAgentFXRule(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{ req.getRequestDispatcher("/WEB-INF/views/wechat/fenxiao_guize.html").forward(req,res); } /** * 我的下线页面跳转 * 2016年4月28日 * @author 穆再兴 * @param req * @param res * @throws IOException * @throws ServletException */ @RequestMapping("/agentNext") public void toAgentNext(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{ req.getRequestDispatcher("/WEB-INF/views/wechat/xiaxian_list.html").forward(req,res); } /** * 微代理规则 * 2016年4月28日 * @author 穆再兴 * @param req * @param res * @throws IOException * @throws ServletException */ @RequestMapping("/agentRule") public void toAgentRule(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{ req.getRequestDispatcher("/WEB-INF/views/wechat/daili_guize.html").forward(req,res); } /** * 冲奶机宣传片页面 * 2016年4月28日 * @author 穆再兴 * @param req * @param res */ @RequestMapping("/goPublicity") public void toPublicity(HttpServletRequest req,HttpServletResponse res){ //如果是分享 则绑定关系 try { Member member = WechatUtils.getUserBySession(req); String shareOpenid = req.getParameter("shareOpenid"); String userType = req.getParameter("userType"); //分享人的类型 1:会员 2:代理商 String isDrp = req.getParameter("isDrp"); //代理商第一次分享后 将分享来源改为会员 if(StringUtils.isNotEmpty(shareOpenid) && StringUtils.isNotEmpty(userType)){ memberService.buildChildUser(shareOpenid, member,Integer.parseInt(userType),1); } req.getRequestDispatcher("/WEB-INF/views/wechat/iamberry_video.html?userType=" + userType + "&isDrp=" + isDrp).forward(req,res); } catch (Exception e) { e.printStackTrace(); } } /** * 用户可用金额提现 * 2016年5月5日 * @author 穆再兴 * @param req * @param res * @throws IOException * @throws ServletException */ @RequestMapping("/withdrawCashLog") public void goWithdrawCashLog(HttpServletRequest req,HttpServletResponse res) throws ServletException, IOException{ req.getRequestDispatcher(NameUtils.getConfig("WECHAT_WITHDRAW_CASH_LOG_LIST")).forward(req,res); } }