Нет описания

AuthCtrl.java 20KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624
  1. package com.sharemao.web.wx.ctrl;
  2. import java.net.URLEncoder;
  3. import java.util.Arrays;
  4. import java.util.Map;
  5. import javax.servlet.http.HttpSession;
  6. import org.apache.commons.codec.digest.DigestUtils;
  7. import org.apache.commons.logging.Log;
  8. import org.apache.commons.logging.LogFactory;
  9. import com.alibaba.fastjson.JSONArray;
  10. import com.alibaba.fastjson.JSONObject;
  11. import com.nianzai.base.mvc.Context;
  12. import com.nianzai.base.mvc.annotation.Controller;
  13. import com.nianzai.base.mvc.annotation.Path;
  14. import com.nianzai.base.mvc.view.SimpleJsonView;
  15. import com.nianzai.base.mvc.view.TextView;
  16. import com.nianzai.util.CodecUtil;
  17. import com.nianzai.util.DateTimeUtil;
  18. import com.nianzai.util.PropertiesUtil;
  19. import com.nianzai.util.Tools;
  20. import com.sharemao.web.wx.Constants;
  21. import com.sharemao.web.wx.util.GzhUtil;
  22. @Controller("/user")
  23. public class AuthCtrl
  24. {
  25. private static final Log log = LogFactory.getLog(AuthCtrl.class);
  26. /**
  27. * 首页 - 判断用户微信是否已绑定账号,如已绑定,返回我的主页界面,如没有绑定,返回登陆界面
  28. * @param context
  29. * @return
  30. */
  31. @Path(value="/index.do")
  32. public TextView index(Context context)
  33. {
  34. HttpSession session = context.getRequest().getSession();
  35. Map<String, String> para = context.getParas();
  36. log.info("para=="+para);
  37. String cursn=para.get("sn");
  38. session.setAttribute("cursn", cursn);//当前设备编号
  39. String openid = (String) session.getAttribute("openid"); // 获取用户微信openid
  40. String accessToken="";
  41. String wxCode = para.get("code");
  42. if(Tools.isEmpty(openid) && !GzhUtil.isEmpty(wxCode))
  43. {
  44. Map<String,String> m=GzhUtil.getOpenId(wxCode,Constants.appId,Constants.appSecret);
  45. openid=m.get("openId");
  46. accessToken=m.get("accessToken");
  47. session.setAttribute("openid", openid);
  48. session.setAttribute("openidForPay", openid);
  49. session.setAttribute("accessToken", accessToken);
  50. }
  51. log.info("wxCode="+wxCode+",openid="+openid);
  52. para.put("openid", openid);
  53. GzhUtil.toM3Sign(para);
  54. String u=Constants.m3IntAddr + "/user/wxIndex.do";
  55. String result = GzhUtil.sendPost(u, para);
  56. log.info("url="+u+",result="+result);
  57. JSONObject resJson = JSONObject.parseObject(result);
  58. int resCode = resJson.getIntValue("code");
  59. if(resCode == 0)
  60. {
  61. JSONObject dataJson = resJson.getJSONObject("data");
  62. String phonenum=dataJson.getString("phonenum");
  63. if(Tools.isEmpty(phonenum))
  64. {
  65. context.getRequest().setAttribute("sn", cursn);
  66. return new TextView("/activation.jsp");
  67. }
  68. else
  69. {
  70. session.setAttribute("appuid", dataJson.getString("appuid")); // 用户ID
  71. session.setAttribute("phonenum", phonenum); // 用户账户
  72. String defaultdev =dataJson.getString("defaultdev");
  73. if(Tools.isEmpty(defaultdev))
  74. defaultdev=cursn;
  75. session.setAttribute("defaultdev", defaultdev); // 默认设备
  76. /*if(Tools.isEmpty(defaultdev)) {
  77. return new TextView("/device/getDevInfo.do");
  78. } else {
  79. return new TextView("/consumer/getPkgsByDevId.do");
  80. }*/
  81. return new TextView("/device/getDevInfo.do");
  82. }
  83. }
  84. else
  85. {
  86. context.getRequest().setAttribute("sn", cursn);
  87. String lt=DateTimeUtil.longtime();
  88. lt=lt.substring(0,lt.length()-2);
  89. context.getRequest().setAttribute("sign", CodecUtil.str2md5("znz"+cursn+"125226"+lt));
  90. return new TextView("/activation.jsp");
  91. }
  92. }
  93. @Path(value="/indexForOld.do")
  94. public TextView indexForOld(Context context)
  95. {
  96. HttpSession session = context.getRequest().getSession();
  97. Map<String, String> para = context.getParas();
  98. log.info("para=="+para);
  99. String cursn=para.get("sn");
  100. session.setAttribute("cursn", cursn);//当前设备编号
  101. String openid=para.get("openid"); // 获取用户微信openid
  102. String accessToken="";
  103. String wxCode = para.get("code");
  104. if (Tools.isEmpty(openid)) {
  105. para.forEach((k,v)->context.getRequest().setAttribute(k, v));
  106. return new TextView("/auth/index.do");
  107. }
  108. session.setAttribute("openid", openid);
  109. log.info("old openid="+openid);
  110. para.put("openid", openid);
  111. String openidNew="";
  112. if(!GzhUtil.isEmpty(wxCode))
  113. {
  114. Map<String,String> m=GzhUtil.getOpenId(wxCode,Constants.appId,Constants.appSecret);
  115. openidNew=m.get("openId");
  116. accessToken=m.get("accessToken");
  117. session.setAttribute("openidForPay", openidNew);
  118. session.setAttribute("accessToken", accessToken);
  119. }
  120. log.info("wxCode="+wxCode+",openid="+openidNew);
  121. GzhUtil.toM3Sign(para);
  122. String u=Constants.m3IntAddr + "/user/wxIndex.do";
  123. String result = GzhUtil.sendPost(u, para);
  124. log.info("url="+u+",result="+result);
  125. JSONObject resJson = JSONObject.parseObject(result);
  126. int resCode = resJson.getIntValue("code");
  127. if(resCode == 0)
  128. {
  129. JSONObject dataJson = resJson.getJSONObject("data");
  130. String phonenum=dataJson.getString("phonenum");
  131. if(Tools.isEmpty(phonenum))
  132. {
  133. context.getRequest().setAttribute("sn", cursn);
  134. return new TextView("/activation.jsp");
  135. }
  136. else
  137. {
  138. session.setAttribute("appuid", dataJson.getString("appuid")); // 用户ID
  139. session.setAttribute("phonenum", phonenum); // 用户账户
  140. String defaultdev =dataJson.getString("defaultdev");
  141. if(Tools.isEmpty(defaultdev))
  142. defaultdev=cursn;
  143. session.setAttribute("defaultdev", defaultdev); // 默认设备
  144. /*if(Tools.isEmpty(defaultdev)) {
  145. return new TextView("/device/getDevInfo.do");
  146. } else {
  147. return new TextView("/consumer/getPkgsByDevId.do");
  148. }*/
  149. return new TextView("/device/getDevInfo.do");
  150. }
  151. }
  152. else
  153. {
  154. context.getRequest().setAttribute("sn", cursn);
  155. String lt=DateTimeUtil.longtime();
  156. lt=lt.substring(0,lt.length()-2);
  157. context.getRequest().setAttribute("sign", CodecUtil.str2md5("znz"+cursn+"125226"+lt));
  158. return new TextView("/activation.jsp");
  159. }
  160. }
  161. /**
  162. * 用户登陆界面,登陆后将微信号自动绑定到用户账号
  163. * @param context
  164. * @return
  165. */
  166. @Path(value="/login.do")
  167. public SimpleJsonView login(Context context)
  168. {
  169. HttpSession session = context.getRequest().getSession();
  170. Map<String, String> para = context.getParas();
  171. String openid = (String) session.getAttribute("openid"); // 获取用户微信openid
  172. para.put("openid", openid);
  173. GzhUtil.toM3Sign(para);
  174. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/wxLogin.do", para);
  175. JSONObject resJson = JSONObject.parseObject(result);
  176. int resCode = resJson.getIntValue("code");
  177. if(resCode == 0)
  178. {
  179. JSONObject dataJson = resJson.getJSONObject("data");
  180. session.setAttribute("appuid", dataJson.getString("appuid")); // 用户ID
  181. session.setAttribute("phonenum", dataJson.getString("phonenum")); // 用户账户
  182. session.setAttribute("defaultdev", dataJson.getString("defaultdev")); // 默认设备
  183. return new SimpleJsonView("OK");
  184. }
  185. return new SimpleJsonView(resJson.getString("msg"));
  186. }
  187. /**
  188. * 用户注册,注册完成后,微信号将自动绑定该账号
  189. * @param context
  190. * @return
  191. */
  192. @Path(value="/register.do")
  193. public SimpleJsonView register(Context context)
  194. {
  195. HttpSession session = context.getRequest().getSession();
  196. Map<String, String> para = context.getParas();
  197. String openid = (String) session.getAttribute("openid"); // 获取用户微信openid
  198. para.put("openid", openid);
  199. String devid ="";
  200. if(para.get("sn")!=null)
  201. devid=para.get("sn");
  202. else
  203. {
  204. if(session.getAttribute("cursn")!=null)
  205. devid=(String)session.getAttribute("cursn");
  206. }
  207. para.put("devid", devid);
  208. para.put("testval", "5120");
  209. GzhUtil.toM3Sign(para);
  210. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/wxRegister2.do", para);
  211. log.info(result);
  212. JSONObject resJson = JSONObject.parseObject(result);
  213. int resCode = resJson.getIntValue("code");
  214. if(resCode == 0)
  215. {
  216. JSONObject dataJson = resJson.getJSONObject("data");
  217. session.setAttribute("appuid", dataJson.getString("appuid")); // 用户ID
  218. session.setAttribute("phonenum", dataJson.getString("phonenum")); // 用户账户
  219. session.setAttribute("defaultdev", dataJson.getString("defaultdev")); // 默认设备
  220. if(!Tools.isEmpty(devid))
  221. session.setAttribute("defaultdev", devid);
  222. return new SimpleJsonView("OK");
  223. }
  224. return new SimpleJsonView(resJson.getString("msg"));
  225. }
  226. /**
  227. * 忘记密码
  228. * @param context
  229. * @return
  230. */
  231. @Path(value="/forgetPass.do")
  232. public SimpleJsonView forgetPass(Context context)
  233. {
  234. Map<String, String> para = context.getParas();
  235. GzhUtil.toM3Sign(para);
  236. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/upPass.do", para);
  237. JSONObject resJson = JSONObject.parseObject(result);
  238. int resCode = resJson.getIntValue("code");
  239. if(resCode == 0){
  240. return new SimpleJsonView("修改成功!");
  241. }
  242. return new SimpleJsonView(resJson.getString("msg"));
  243. }
  244. /**
  245. * 跳转至我的账户界面
  246. * @param context
  247. * @return
  248. */
  249. @Path(value="/myacc.do")
  250. public TextView myAccount(Context context)
  251. {
  252. HttpSession session = context.getRequest().getSession();
  253. String appuid = String.valueOf(session.getAttribute("appuid"));
  254. if(GzhUtil.isEmpty(appuid))
  255. return new TextView(Constants.loginUrl);
  256. context.getRequest().setAttribute("phonenum", String.valueOf(session.getAttribute("phonenum")));
  257. return new TextView("/wxuser.jsp");
  258. }
  259. /**
  260. * 注销
  261. * @param context
  262. * @return
  263. */
  264. @Path(value="/logout.do")
  265. public TextView logout(Context context)
  266. {
  267. HttpSession session = context.getRequest().getSession();
  268. Map<String, String> para = context.getParas();
  269. GzhUtil.toM3Sign(para);
  270. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/wxLogout.do", para);
  271. JSONObject resJson = JSONObject.parseObject(result);
  272. int resCode = resJson.getIntValue("code");
  273. if(resCode == 0){
  274. session.removeAttribute("appuid");
  275. return new TextView(Constants.loginUrl);
  276. }
  277. return new TextView("/login/login.jsp");
  278. }
  279. /**
  280. * 获取收货地址列表
  281. * @param context
  282. * @return
  283. */
  284. @Path(value="/getAddr.do")
  285. public TextView getAddr(Context context)
  286. {
  287. HttpSession session = context.getRequest().getSession();
  288. Map<String, String> para = context.getParas();
  289. String appuid = (String) session.getAttribute("appuid");
  290. if(GzhUtil.isEmpty(appuid))
  291. return new TextView(Constants.loginUrl);
  292. para.put("appuid", appuid);
  293. GzhUtil.toM3Sign(para);
  294. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/getAddr.do", para);
  295. JSONObject resJson = JSONObject.parseObject(result);
  296. JSONArray addrL = new JSONArray();
  297. int resCode = resJson.getIntValue("code");
  298. if(resCode == 0){
  299. JSONObject dataJson = resJson.getJSONObject("data");
  300. if(dataJson.containsKey("addr")){
  301. addrL = dataJson.getJSONArray("addr");
  302. }
  303. }
  304. context.getRequest().setAttribute("addrs", addrL);
  305. context.getRequest().setAttribute("type", para.get("type"));
  306. return new TextView("/address.jsp");
  307. }
  308. /**
  309. * 获取单条收货地址数据
  310. * @param context
  311. * @return
  312. */
  313. @Path(value="/getSelAddr.do")
  314. public TextView getSelAddr(Context context)
  315. {
  316. Map<String, String> para = context.getParas();
  317. GzhUtil.toM3Sign(para);
  318. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/getAddrById.do", para);
  319. JSONObject resJson = JSONObject.parseObject(result);
  320. int resCode = resJson.getIntValue("code");
  321. JSONObject dataJson = new JSONObject();
  322. if(resCode == 0)
  323. dataJson = resJson.getJSONObject("data");
  324. context.getRequest().setAttribute("addr", dataJson);
  325. return new TextView("/editadd.jsp");
  326. }
  327. /**
  328. * 新增收货地址
  329. * @param context
  330. * @return
  331. */
  332. @Path(value="/addAddr.do")
  333. public SimpleJsonView addAddr(Context context)
  334. {
  335. HttpSession session = context.getRequest().getSession();
  336. String appuid = (String) session.getAttribute("appuid");
  337. if(GzhUtil.isEmpty(appuid))
  338. return new SimpleJsonView(Constants.noLoginMsg);
  339. Map<String, String> para = context.getParas();
  340. para.put("appuid", appuid);
  341. GzhUtil.toM3Sign(para);
  342. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/addAddr.do", para);
  343. JSONObject resJson = JSONObject.parseObject(result);
  344. int resCode = resJson.getIntValue("code");
  345. if(resCode == 0)
  346. return new SimpleJsonView("OK");
  347. return new SimpleJsonView(resJson.getString("msg"));
  348. }
  349. /**
  350. * 编辑收货地址
  351. * @param context
  352. * @return
  353. */
  354. @Path(value="/editAddr.do")
  355. public SimpleJsonView editAddr(Context context)
  356. {
  357. HttpSession session = context.getRequest().getSession();
  358. String appuid = (String) session.getAttribute("appuid");
  359. if(GzhUtil.isEmpty(appuid))
  360. return new SimpleJsonView(Constants.noLoginMsg);
  361. Map<String, String> para = context.getParas();
  362. para.put("appuid", appuid);
  363. GzhUtil.toM3Sign(para);
  364. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/editAddr.do", para);
  365. JSONObject resJson = JSONObject.parseObject(result);
  366. int resCode = resJson.getIntValue("code");
  367. if(resCode == 0)
  368. return new SimpleJsonView("OK");
  369. return new SimpleJsonView(resJson.getString("msg"));
  370. }
  371. /**
  372. * 删除收货地址
  373. * @param context
  374. * @return
  375. */
  376. @Path(value="/delAddr.do")
  377. public SimpleJsonView delAddr(Context context)
  378. {
  379. HttpSession session = context.getRequest().getSession();
  380. String appuid = (String) session.getAttribute("appuid");
  381. if(GzhUtil.isEmpty(appuid))
  382. return new SimpleJsonView(Constants.noLoginMsg);
  383. Map<String, String> para = context.getParas();
  384. para.put("appuid", appuid);
  385. GzhUtil.toM3Sign(para);
  386. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/delAddr.do", para);
  387. JSONObject resJson = JSONObject.parseObject(result);
  388. int resCode = resJson.getIntValue("code");
  389. if(resCode == 0)
  390. return new SimpleJsonView("OK");
  391. return new SimpleJsonView(resJson.getString("msg"));
  392. }
  393. /**
  394. * 修改默认收货地址
  395. * @param context
  396. * @return
  397. */
  398. @Path(value="/setDefAddr.do")
  399. public SimpleJsonView setDefAddr(Context context)
  400. {
  401. HttpSession session = context.getRequest().getSession();
  402. String appuid = (String) session.getAttribute("appuid");
  403. if(GzhUtil.isEmpty(appuid))
  404. return new SimpleJsonView(Constants.noLoginMsg);
  405. Map<String, String> para = context.getParas();
  406. para.put("appuid", appuid);
  407. GzhUtil.toM3Sign(para);
  408. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/setDefAddr.do", para);
  409. JSONObject resJson = JSONObject.parseObject(result);
  410. int resCode = resJson.getIntValue("code");
  411. if(resCode == 0)
  412. return new SimpleJsonView("OK");
  413. return new SimpleJsonView(resJson.getString("msg"));
  414. }
  415. /**
  416. * 获取用户所有订单
  417. * @param context
  418. * @return
  419. */
  420. @Path(value="/getAllOrder.do")
  421. public TextView getAllOrder(Context context)
  422. {
  423. HttpSession session = context.getRequest().getSession();
  424. String appuid = (String) session.getAttribute("appuid");
  425. if(GzhUtil.isEmpty(appuid))
  426. return new TextView(Constants.loginUrl);
  427. Map<String, String> para = context.getParas();
  428. para.put("appuid", appuid);
  429. GzhUtil.toM3Sign(para);
  430. //获取商品订单
  431. String pdtRes = GzhUtil.sendPost(Constants.m3IntAddr + "/device/getOrders.do", para);
  432. JSONObject pdtOrder = JSONObject.parseObject(pdtRes);
  433. if(pdtOrder.getIntValue("code") == 0){
  434. JSONArray pdtOrds = pdtOrder.getJSONArray("data");
  435. context.getRequest().setAttribute("pdtorder", pdtOrds);
  436. }
  437. //获取套餐订单
  438. String pkgRes = GzhUtil.sendPost(Constants.m3IntAddr + "/package/getOrders.do", para);
  439. JSONObject pkgOrder = JSONObject.parseObject(pkgRes);
  440. if(pdtOrder.getIntValue("code") == 0){
  441. JSONArray pkgOrds = pkgOrder.getJSONArray("data");
  442. context.getRequest().setAttribute("pkgorder", pkgOrds);
  443. }
  444. return new TextView("/order/allorder.jsp");
  445. }
  446. /**
  447. * 关于我们
  448. * @param context
  449. * @return
  450. */
  451. @Path(value="/aboutUs.do")
  452. public TextView aboutUs(Context context)
  453. {
  454. Map<String, String> para = context.getParas();
  455. GzhUtil.toM3Sign(para);
  456. String result = GzhUtil.sendPost(Constants.m3IntAddr + "/user/aboutus.do", para);
  457. JSONObject resJson = JSONObject.parseObject(result);
  458. int resCode = resJson.getIntValue("code");
  459. if(resCode == 0){
  460. JSONObject dataJson = resJson.getJSONObject("data");
  461. String content = dataJson.getString("content");
  462. String[] contents = content.split("<br>");
  463. context.getRequest().setAttribute("content", contents);
  464. }
  465. context.getRequest().setAttribute("logo", Constants.LOGO_DOWNLOAD);
  466. return new TextView("/aboutus.jsp");
  467. }
  468. /**
  469. * 检查实名
  470. * @param context
  471. * @return
  472. */
  473. @Path(value="/checksm.do")
  474. public TextView checksm(Context context)
  475. {
  476. String realhost=PropertiesUtil.getValue("wx", "realhost");
  477. Map<String, String> para = context.getParas();
  478. GzhUtil.toM3Sign(para);
  479. HttpSession session = context.getRequest().getSession();
  480. String devid ="";
  481. if(session.getAttribute("cursn")!=null)
  482. devid=(String)session.getAttribute("cursn");
  483. else
  484. devid=(String)session.getAttribute("defaultdev");
  485. if(Tools.isEmpty(devid))
  486. return new TextView(realhost+"/sming.jsp?t=0");
  487. int rmode=0;
  488. String url=Constants.m3IntAddr + "/device/getDevRunMode.do?devid="+devid;
  489. String result = GzhUtil.sendPost(url, para);
  490. log.info(result);
  491. JSONObject resJson = JSONObject.parseObject(result);
  492. int resCode = resJson.getIntValue("code");
  493. if(resCode == 0){
  494. JSONObject dataJson = resJson.getJSONObject("data");
  495. rmode=dataJson.getIntValue("rmode");
  496. }
  497. log.info(devid+url+",rmode="+rmode);
  498. //if(rmode<=2)
  499. {
  500. url=Constants.m3IntAddr + "/device/getIccidBySN2.do?devid="+devid+"&mode="+rmode;
  501. // if(devid.startsWith("86") || devid.startsWith("1004") || devid.startsWith("1502") || devid.startsWith("1606") || devid.startsWith("1616") || devid.startsWith("1302") || devid.startsWith("35") || devid.startsWith("6"))
  502. // {
  503. // url=Constants.m3IntAddr + "/device/getIccidBySN2.do?devid="+devid+"&mode="+rmode;
  504. // }
  505. // else if(devid.startsWith("160"))
  506. // {
  507. // url=Constants.m3IntAddr + "/device/getIccidBySN3.do?devid="+devid;
  508. // }
  509. // else
  510. // {
  511. // url=Constants.m3IntAddr + "/device/getIccidBySN.do?devid="+devid;
  512. // }
  513. log.info(devid+url);
  514. result = GzhUtil.sendPost(url, para);
  515. resJson = JSONObject.parseObject(result);
  516. String path=realhost+"/sming.jsp?t=0";
  517. resCode = resJson.getIntValue("code");
  518. if(resCode == 0)
  519. {
  520. String phonenum=(String)session.getAttribute("phonenum");
  521. JSONObject dataJson = resJson.getJSONObject("data");
  522. String iccid1 = dataJson.getString("iccid1");
  523. String iccid2 = dataJson.getString("iccid2");
  524. String iccid3 = dataJson.getString("iccid3");
  525. String state1 = dataJson.getString("state1");
  526. String state2 = dataJson.getString("state2");
  527. String state3 = dataJson.getString("state3");
  528. context.getRequest().setAttribute("devid", devid);
  529. if(state1.equals("1"))
  530. path=realhost+"/sming.jsp?t=01&phone="+phonenum;
  531. else if(state2.equals("1"))
  532. path=realhost+"/sming.jsp?t=02&phone="+phonenum;
  533. else if(state3.equals("1"))
  534. path=realhost+"/sming.jsp?t=03&phone="+phonenum;
  535. if(state1.equals("0") && !Tools.isEmpty(iccid1))
  536. path=realhost+"/sming.jsp?t=1&devid="+devid+"&phone="+phonenum;
  537. else if(state2.equals("0") && !Tools.isEmpty(iccid2))
  538. path=realhost+"/sming.jsp?t=2&devid="+devid+"&phone="+phonenum;
  539. else if(state3.equals("0") && !Tools.isEmpty(iccid3))
  540. path=realhost+"/sming.jsp?t=3&devid="+devid+"&phone="+phonenum;
  541. }
  542. return new TextView(path);
  543. }
  544. }
  545. @Path(value="/guide.do")
  546. public TextView guide(Context context)
  547. {
  548. Map<String, String> para = context.getParas();
  549. HttpSession session = context.getRequest().getSession();
  550. String appuid = String.valueOf(session.getAttribute("appuid"));
  551. para.put("appuid", appuid);
  552. GzhUtil.sendPost(Constants.m3IntAddr + "/user/upGuidFlag.do", para);
  553. String devid=para.get("devid");
  554. context.getRequest().setAttribute("devid", devid);
  555. return new TextView("/guide.jsp");
  556. }
  557. }