package com.ideabobo.action;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;
import javax.annotation.Resource;
import javax.swing.*;
import org.springframework.stereotype.Controller;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.ideabobo.model.Message;
import com.ideabobo.model.Posts;
import com.ideabobo.model.Qunzu;
import com.ideabobo.model.Replay;
import com.ideabobo.model.User;
import com.ideabobo.model.Yzmessage;
import com.ideabobo.service.BaseService;
import com.ideabobo.service.PostsService;
import com.ideabobo.service.ReplayService;
import com.ideabobo.service.UserService;
import com.ideabobo.util.GetNowTime;
import com.ideabobo.util.HttpClientTools;
import com.ideabobo.util.IdeaAction;
@Controller
public class WehallAction extends IdeaAction {
@Resource
private BaseService baseService;
@Resource
private UserService userService;
@Resource
private PostsService postsService;
@Resource
private ReplayService replayService;
public Gson gson = new Gson();
private static final long serialVersionUID = -3218238026025256103L;
public String wehall(){
// String openid = request.getParameter("openid");
// session.put("openid", openid);
return SUCCESS;
}
public void login(){
String username = request.getParameter("username");
String passwd = request.getParameter("passwd");
User user = new User();
user.setPasswd(passwd);
user.setUsername(encodeGet(username));
User r = userService.find(user);
if(r!=null){
renderJsonpObj(r);
}else{
renderJsonpString("fail");
}
}
public void resetPasswd(){
String username = request.getParameter("username");
username = encodeGet(username);
List<User> users = baseService.list("from User t where t.username='"+username+"'");
if(users!=null){
User user = users.get(0);
user.setPasswd(request.getParameter("passwd"));
baseService.update(user);
renderJsonpObj(user);
}else{
renderJsonpString("");
}
}
public void checkUser(){
User u = new User();
String username = request.getParameter("username");
u.setUsername(username);
User r = userService.find(u);
if(r!=null){
renderJsonpString("fail");
}else{
renderJsonpString("success");
}
}
public void updateUser(){
String tel = request.getParameter("tel");
String qq = request.getParameter("qq");
String wechat = request.getParameter("wechat");
String email = request.getParameter("email");
String birth = request.getParameter("birth");
String sex = request.getParameter("sex");
String fname = request.getParameter("fname");
String yuanxi = request.getParameter("yuanxi");
String zhuanye = request.getParameter("zhuanye");
String nianji = request.getParameter("nianji");
String xuehao = request.getParameter("xuehao");
String id = request.getParameter("id");
User user = userService.find(id);
user.setId(Integer.parseInt(id));
user.setTel(tel);
user.setWechat(wechat);
user.setQq(qq);
user.setEmail(email);
user.setBirth(birth);
user.setSex(encodeGet(sex));
user.setFname(encodeGet(fname));
user.setYuanxi(encodeGet(yuanxi));
user.setXuehao(xuehao);
user.setNianji(encodeGet(nianji));
user.setZhuanye(encodeGet(zhuanye));
userService.update(user);
renderJsonpString("success");
}
public void changePasswd(){
String passwd = request.getParameter("passwd");
String id = request.getParameter("id");
User user = userService.find(id);
user.setPasswd(passwd);
userService.update(user);
renderJsonpString("success");
}
public void register(){
User user = (User) getByRequest(new User(), true);
userService.save(user);
renderJsonpString("success");
}
public void getUser(){
String id = request.getParameter("id");
User u = (User) baseService.find(Integer.parseInt(id), User.class);
renderJsonpObj(u);
}
public void addPosts(){
String uid = request.getParameter("uid");
String title = encodeGet(request.getParameter("title"));
String note = encodeGet(request.getParameter("note"));
String username = encodeGet(request.getParameter("username"));
String img = request.getParameter("img");
String ndate = GetNowTime.getNowTimeEn();
Posts p = new Posts();
p.setUid(uid);
p.setTitle(title);
p.setUsername(username);
p.setNote(note);
p.setNdate(ndate);
p.setImg(img);
postsService.save(p);
renderJsonpString("success");
}
public void listPosts(){
renderJsonpObj(postsService.list());
}
public void listReplay(){
String pid = request.getParameter("pid");
Replay r = new Replay();
r.setPid(pid);
renderJsonpObj(replayService.list(r));
}
public void deletePosts(){
String id = request.getParameter("id");
postsService.delete(Integer.parseInt(id));
renderJsonpString("success");
}
public void addReplay(){
String uid = request.getParameter("uid");
String pid = request.getParameter("pid");
String note = encodeGet(request.getParameter("note"));
String username = encodeGet(request.getParameter("username"));
String ndate = GetNowTime.getNowTimeEn();
Replay m = new Replay();
m.setUid(uid);
m.setPid(pid);
m.setUsername(username);
m.setNote(note);
m.setNdate(ndate);
replayService.save(m);
renderJsonpString("success");
}
public void delPosts(){
String id = request.getParameter("id");
baseService.delete(Integer.parseInt(id), Posts.class);
renderJsonpString("success");
}
public void listQunzu(){
String hql = "from Qunzu t where 1=1";
String type = request.getParameter("type");
if(type!=null && !type.equals("")){
type = encodeGet(type);
hql+=" and t.type like '%"+type+"%'";
}
renderJsonpObj(baseService.list(hql));
}
public void listMyQunzu(){
String uid = request.getParameter("uid");
User u = (User) baseService.find(Integer.parseInt(uid), User.class);
if(u.getQids()==null || u.getQids().equals("")){
renderJsonpObj(null);
}else{
List<Qunzu> list = baseService.list("from Qunzu t where t.id in ("+u.getQids()+")");
renderJsonpObj(list);
}
}
public void checkIsMyQunzu(){
String uid = request.getParameter("uid");
String qid = request.getParameter("qid");
User u = (User) baseService.find(Integer.parseInt(uid), User.class);
String qids = u.getQids();
String info = "0";
if(qids!=null && !qids.equals("")){
String[] qidsarray = qids.split(",");
for(int i=0;i<qidsarray.length;i++){
if(qidsarray[i].equals(qid)){
info = "1";
break;
}
}
renderJsonpString(info);
}else{
renderJsonpString(info);
}
}
public void saveQunzu(){
Qunzu info = (Qunzu) getByRequest(new Qunzu(), true);
baseService.save(info);
renderJsonpObj(info);
}
public void delQunzu(){
String id = request.ge
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~ 本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~ 本人十余年JAVA架构设计经验,擅长JAVA高可用、分布式、高并发系统架构设计。有志于做JAVA系统性的技术提升的同学可与我联系,交个朋友哦~
资源推荐
资源详情
资源评论
收起资源包目录
《毕业设计&代码复用》--安卓Android活动社交仿QQ聊天app设计毕业源码案例设计.zip (1935个子文件)
b9808f5d-80e2-4542-a09f-c5224e14d317.aac 43KB
c019bf1a-88f3-4f01-abea-e0b7f9f30b86.aac 17KB
resources.ap_ 1.93MB
HuodongchatClient.apk 2.5MB
jarlist.cache 120B
MyObj.class 11KB
Plugs.class 7KB
FileTool.class 6KB
BaiduLocation.class 3KB
BaiduLocation$MyLocationListener.class 2KB
Command.class 2KB
MainActivity.class 2KB
MyObj$1.class 1017B
SessionStorage.class 950B
R.class 471B
R$string.class 466B
R$drawable.class 394B
R$xml.class 381B
BuildConfig.class 341B
R$attr.class 334B
.classpath 737B
.classpath 475B
org.eclipse.wst.common.component 479B
org.eclipse.wst.jsdt.ui.superType.container 49B
jquery.mobile-1.4.5.css 234KB
jquery.mobile-1.4.5.css 234KB
jquery.mobile.inline-svg-1.4.5.css 222KB
jquery.mobile.inline-svg-1.4.5.css 222KB
jquery.mobile.min.css 216KB
jquery.mobile-1.4.5.min.css 203KB
jquery.mobile-1.4.5.min.css 203KB
jquery.mobile-1.4.5.min.css 203KB
jquery.mobile-1.4.5.min.css 203KB
jquery.mobile-1.4.3.min.css 202KB
jquery.mobile-1.4.3.min.css 202KB
jquery.mobile.inline-svg-1.4.5.min.css 191KB
jquery.mobile.inline-svg-1.4.5.min.css 191KB
jquery.mobile.flatui.css 163KB
jquery.mobile.flatui.css 163KB
jquery.mobile.flatui.css 163KB
jquery.mobile.inline-png-1.4.5.css 146KB
jquery.mobile.inline-png-1.4.5.css 146KB
jquery.mobile.icons-1.4.5.css 126KB
jquery.mobile.icons-1.4.5.css 126KB
jquery.mobile.icons.min.css 124KB
jquery.mobile.icons-1.4.5.min.css 124KB
jquery.mobile.icons.min.css 124KB
jquery.mobile.icons-1.4.5.min.css 124KB
jquery.mobile.skyd-1.4.5.css 120KB
jquery.mobile.skyd-1.4.5.css 120KB
jquery.mobile.external-png-1.4.5.css 119KB
jquery.mobile.external-png-1.4.5.css 119KB
jquery.mobile.inline-png-1.4.5.min.css 115KB
jquery.mobile.inline-png-1.4.5.min.css 115KB
jquery.mobile.structure-1.4.5.css 89KB
jquery.mobile.structure-1.4.5.css 89KB
jquery.mobile.external-png-1.4.5.min.css 89KB
jquery.mobile.external-png-1.4.5.min.css 89KB
jquery.mobile.skyd-1.4.5.min.css 80KB
jquery.mobile.skyd-1.4.5.min.css 80KB
jquery.mobile.structure-1.4.5.min.css 67KB
jquery.mobile.structure-1.4.5.min.css 67KB
theme-classic.css 67KB
theme-classic.css 67KB
easyui.css 34KB
easyui.css 34KB
easyui.css 34KB
easyui.css 32KB
easyui.css 32KB
easyui.css 29KB
jquery.mobile.theme-1.4.5.css 19KB
jquery.mobile.theme-1.4.5.css 19KB
jquery.mobile.theme-1.4.5.min.css 12KB
jquery.mobile.theme-1.4.5.min.css 12KB
index.css 10KB
index.css 10KB
datagrid.css 5KB
datagrid.css 5KB
datagrid.css 5KB
datagrid.css 4KB
datagrid.css 4KB
datagrid.css 4KB
tabs.css 4KB
tabs.css 4KB
tabs.css 4KB
tabs.css 4KB
tabs.css 4KB
tree.css 4KB
tree.css 4KB
tree.css 4KB
tree.css 4KB
tree.css 4KB
tree.css 4KB
tabs.css 3KB
calendar.css 3KB
calendar.css 3KB
calendar.css 3KB
calendar.css 3KB
calendar.css 3KB
calendar.css 3KB
共 1935 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
季风泯灭的季节
- 粉丝: 1542
- 资源: 3407
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功