Commit 0ec097af128af84b2f4fa122466d281bc4632a35
Merge branch 'dev'
Showing
14 changed files
with
912 additions
and
92 deletions
src/main/java/com/cnlive/shenhe/controller/UsersController.java
| 1 | package com.cnlive.shenhe.controller; | 1 | package com.cnlive.shenhe.controller; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSONObject; | 3 | import com.alibaba.fastjson.JSONObject; |
| 4 | +import com.cnlive.shenhe.bean.ErrorEnum; | ||
| 5 | +import com.cnlive.shenhe.bean.ResponseBean; | ||
| 4 | import com.cnlive.shenhe.bean.SessionUser; | 6 | import com.cnlive.shenhe.bean.SessionUser; |
| 5 | import com.cnlive.shenhe.entity.ShySites; | 7 | import com.cnlive.shenhe.entity.ShySites; |
| 6 | import com.cnlive.shenhe.entity.ShyUsers; | 8 | import com.cnlive.shenhe.entity.ShyUsers; |
| 9 | +import com.cnlive.shenhe.entity.ShyUsersfree; | ||
| 7 | import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; | 10 | import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; |
| 8 | import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | 11 | import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; |
| 9 | import com.cnlive.shenhe.utils.CommonConst; | 12 | import com.cnlive.shenhe.utils.CommonConst; |
| @@ -16,6 +19,7 @@ import org.springframework.stereotype.Controller; | @@ -16,6 +19,7 @@ import org.springframework.stereotype.Controller; | ||
| 16 | import org.springframework.ui.Model; | 19 | import org.springframework.ui.Model; |
| 17 | import org.springframework.web.bind.annotation.GetMapping; | 20 | import org.springframework.web.bind.annotation.GetMapping; |
| 18 | import org.springframework.web.bind.annotation.PathVariable; | 21 | import org.springframework.web.bind.annotation.PathVariable; |
| 22 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 19 | import org.springframework.web.bind.annotation.RequestMapping; | 23 | import org.springframework.web.bind.annotation.RequestMapping; |
| 20 | import org.springframework.web.bind.annotation.ResponseBody; | 24 | import org.springframework.web.bind.annotation.ResponseBody; |
| 21 | 25 | ||
| @@ -106,5 +110,5 @@ public class UsersController { | @@ -106,5 +110,5 @@ public class UsersController { | ||
| 106 | model.addAttribute("pageSize", pageSize); | 110 | model.addAttribute("pageSize", pageSize); |
| 107 | return "page/users.html"; | 111 | return "page/users.html"; |
| 108 | } | 112 | } |
| 109 | - | 113 | + |
| 110 | } | 114 | } |
src/main/java/com/cnlive/shenhe/controller/UsersFreeController.java
0 → 100644
| 1 | +package com.cnlive.shenhe.controller; | ||
| 2 | + | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.cnlive.shenhe.bean.ErrorEnum; | ||
| 5 | +import com.cnlive.shenhe.bean.ResponseBean; | ||
| 6 | +import com.cnlive.shenhe.bean.SessionUser; | ||
| 7 | +import com.cnlive.shenhe.entity.ShySites; | ||
| 8 | +import com.cnlive.shenhe.entity.ShyUsers; | ||
| 9 | +import com.cnlive.shenhe.entity.ShyUsersfree; | ||
| 10 | +import com.cnlive.shenhe.serviceImpl.SitesServiceImpl; | ||
| 11 | +import com.cnlive.shenhe.serviceImpl.UsersServiceImpl; | ||
| 12 | +import com.cnlive.shenhe.serviceImpl.UsersfreeServiceImpl; | ||
| 13 | +import com.cnlive.shenhe.utils.CommonConst; | ||
| 14 | +import com.cnlive.shenhe.utils.CommonUtils; | ||
| 15 | +import com.github.pagehelper.PageInfo; | ||
| 16 | + | ||
| 17 | +import org.jasig.cas.client.authentication.AttributePrincipal; | ||
| 18 | +import org.springframework.beans.factory.annotation.Autowired; | ||
| 19 | +import org.springframework.stereotype.Controller; | ||
| 20 | +import org.springframework.ui.Model; | ||
| 21 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 22 | +import org.springframework.web.bind.annotation.PathVariable; | ||
| 23 | +import org.springframework.web.bind.annotation.PostMapping; | ||
| 24 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 25 | +import org.springframework.web.bind.annotation.ResponseBody; | ||
| 26 | + | ||
| 27 | +import java.util.List; | ||
| 28 | + | ||
| 29 | +import javax.servlet.http.HttpServletRequest; | ||
| 30 | +import javax.servlet.http.HttpSession; | ||
| 31 | + | ||
| 32 | +/** | ||
| 33 | + * @Auther: liwei | ||
| 34 | + * @Date: 2019/08/20 14:22 | ||
| 35 | + * @Description: | ||
| 36 | + */ | ||
| 37 | +@Controller | ||
| 38 | +@RequestMapping("/usersFree") | ||
| 39 | +public class UsersFreeController { | ||
| 40 | + | ||
| 41 | + @Autowired | ||
| 42 | + UsersfreeServiceImpl usersfreeService; | ||
| 43 | + @Autowired | ||
| 44 | + SitesServiceImpl sitesService; | ||
| 45 | + | ||
| 46 | + @GetMapping(value = "/page") | ||
| 47 | + public String wangjiajiaPage(Model model, Integer page, Integer pageSize, String orderByClause, | ||
| 48 | + String userId, String mobile, HttpSession session) { | ||
| 49 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | ||
| 50 | + if(CommonUtils.isNull(sessionUser)){ | ||
| 51 | + return "redirect:/users/login"; | ||
| 52 | + } | ||
| 53 | + Integer spid = sessionUser.getSpid(); | ||
| 54 | + if (!sessionUser.isMaster() && spid != 0) { | ||
| 55 | + return "page/error.html"; | ||
| 56 | + } | ||
| 57 | + if (spid == 0) spid = null; | ||
| 58 | + if (CommonUtils.isNull(page)) page = 1; | ||
| 59 | + if (CommonUtils.isNull(pageSize)) pageSize = 10; | ||
| 60 | + PageInfo<ShyUsersfree> usersPage = usersfreeService.getpage(page, pageSize, orderByClause, userId,mobile); | ||
| 61 | + List<ShyUsersfree> list = usersPage.getList(); | ||
| 62 | + JSONObject category = CommonConst.CATEGORY; | ||
| 63 | + if (!list.isEmpty()) { | ||
| 64 | + for (ShyUsersfree users : list) { | ||
| 65 | + //显示spid简称 | ||
| 66 | + ShySites shySites = sitesService.findspidDescByspid(users.getSp_id()); | ||
| 67 | + if (CommonUtils.isNotNull(shySites)) { | ||
| 68 | + users.setSp_desc(shySites.getName()); | ||
| 69 | + } | ||
| 70 | + | ||
| 71 | + //获取栏目名称 | ||
| 72 | + String category_name=users.getCategory(); | ||
| 73 | + if(CommonUtils.isNotEmpty(category_name)){ | ||
| 74 | + for (String bkey : category.keySet()) { | ||
| 75 | + category_name = category_name.replace(bkey, category.getString(bkey)); | ||
| 76 | + } | ||
| 77 | + }else{ | ||
| 78 | + category_name="无"; | ||
| 79 | + } | ||
| 80 | + users.setCategory_name(category_name); | ||
| 81 | + | ||
| 82 | + } | ||
| 83 | + } | ||
| 84 | + model.addAttribute("usersPage", usersPage); | ||
| 85 | + model.addAttribute("pageSize", pageSize); | ||
| 86 | + model.addAttribute("category", category); | ||
| 87 | + return "page/usersFree.html"; | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @PostMapping("/updateState") | ||
| 91 | + @ResponseBody | ||
| 92 | + public ResponseBean updateState(Integer id, Boolean isEnable, HttpSession session) { | ||
| 93 | + Integer n = usersfreeService.updateState(id, isEnable); | ||
| 94 | + if(n>0){ | ||
| 95 | + return new ResponseBean(ErrorEnum.SUCCESS.getErrorCode(), "当前用户"+(isEnable==true?"启用":"禁用")+"成功"); | ||
| 96 | + } | ||
| 97 | + return new ResponseBean(ErrorEnum.ERROR.getErrorCode(), "操作失败,请重试"); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + | ||
| 101 | + | ||
| 102 | + @PostMapping(value = "/write") | ||
| 103 | + public String write(String userId,String userMobile,Integer spId, String[] write_business, HttpSession session, String redirect_url) { | ||
| 104 | + if(CommonUtils.isEmpty(userId)&&CommonUtils.isEmpty(userMobile)){ | ||
| 105 | + return "error.html"; | ||
| 106 | + } | ||
| 107 | + if(CommonUtils.isNull(write_business)){ | ||
| 108 | + return "error.html"; | ||
| 109 | + } | ||
| 110 | + SessionUser sessionUser = (SessionUser) session.getAttribute(SessionUser.getSessionKey()); | ||
| 111 | + String write = ""; | ||
| 112 | + if (CommonUtils.isNotNull(write_business) && write_business.length > 0) { | ||
| 113 | + for (String w : write_business) { | ||
| 114 | + write = write + "," + w; | ||
| 115 | + } | ||
| 116 | + write = write.substring(1); | ||
| 117 | + } | ||
| 118 | + boolean success = usersfreeService.update(userId,userMobile,write,spId,sessionUser.getUserId()); | ||
| 119 | + if (success) { | ||
| 120 | + return "redirect:" + redirect_url; | ||
| 121 | + } else { | ||
| 122 | + return "error.html"; | ||
| 123 | + } | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | +} |
src/main/java/com/cnlive/shenhe/entity/ShyUsersfree.java
| 1 | package com.cnlive.shenhe.entity; | 1 | package com.cnlive.shenhe.entity; |
| 2 | 2 | ||
| 3 | +import java.util.Date; | ||
| 3 | import javax.persistence.*; | 4 | import javax.persistence.*; |
| 4 | 5 | ||
| 5 | @Table(name = "shy_usersfree") | 6 | @Table(name = "shy_usersfree") |
| @@ -13,6 +14,21 @@ public class ShyUsersfree { | @@ -13,6 +14,21 @@ public class ShyUsersfree { | ||
| 13 | private String user_id; | 14 | private String user_id; |
| 14 | 15 | ||
| 15 | /** | 16 | /** |
| 17 | + * 用户昵称 | ||
| 18 | + */ | ||
| 19 | + private String user_name; | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 用户手机号 | ||
| 23 | + */ | ||
| 24 | + private String mobile; | ||
| 25 | + | ||
| 26 | + /** | ||
| 27 | + * 用户邮箱 | ||
| 28 | + */ | ||
| 29 | + private String email; | ||
| 30 | + | ||
| 31 | + /** | ||
| 16 | * spid | 32 | * spid |
| 17 | */ | 33 | */ |
| 18 | private Integer sp_id; | 34 | private Integer sp_id; |
| @@ -25,7 +41,33 @@ public class ShyUsersfree { | @@ -25,7 +41,33 @@ public class ShyUsersfree { | ||
| 25 | /** | 41 | /** |
| 26 | * 是否启用,0:未启用,1:启用 | 42 | * 是否启用,0:未启用,1:启用 |
| 27 | */ | 43 | */ |
| 28 | - private Integer is_enable; | 44 | + private Boolean is_enable; |
| 45 | + | ||
| 46 | + @Transient | ||
| 47 | + private String sp_desc; | ||
| 48 | + | ||
| 49 | + @Transient | ||
| 50 | + private String category_name; | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 是否删除,0:未删除,1:已删除 | ||
| 54 | + */ | ||
| 55 | + private Boolean is_delete; | ||
| 56 | + | ||
| 57 | + /** | ||
| 58 | + * 更新人 | ||
| 59 | + */ | ||
| 60 | + private String updater; | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 创建时间 | ||
| 64 | + */ | ||
| 65 | + private Date created_at; | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 更新时间 | ||
| 69 | + */ | ||
| 70 | + private Date updated_at; | ||
| 29 | 71 | ||
| 30 | /** | 72 | /** |
| 31 | * @return id | 73 | * @return id |
| @@ -60,6 +102,60 @@ public class ShyUsersfree { | @@ -60,6 +102,60 @@ public class ShyUsersfree { | ||
| 60 | } | 102 | } |
| 61 | 103 | ||
| 62 | /** | 104 | /** |
| 105 | + * 获取用户昵称 | ||
| 106 | + * | ||
| 107 | + * @return user_name - 用户昵称 | ||
| 108 | + */ | ||
| 109 | + public String getUser_name() { | ||
| 110 | + return user_name; | ||
| 111 | + } | ||
| 112 | + | ||
| 113 | + /** | ||
| 114 | + * 设置用户昵称 | ||
| 115 | + * | ||
| 116 | + * @param user_name 用户昵称 | ||
| 117 | + */ | ||
| 118 | + public void setUser_name(String user_name) { | ||
| 119 | + this.user_name = user_name; | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + /** | ||
| 123 | + * 获取用户手机号 | ||
| 124 | + * | ||
| 125 | + * @return mobile - 用户手机号 | ||
| 126 | + */ | ||
| 127 | + public String getMobile() { | ||
| 128 | + return mobile; | ||
| 129 | + } | ||
| 130 | + | ||
| 131 | + /** | ||
| 132 | + * 设置用户手机号 | ||
| 133 | + * | ||
| 134 | + * @param mobile 用户手机号 | ||
| 135 | + */ | ||
| 136 | + public void setMobile(String mobile) { | ||
| 137 | + this.mobile = mobile; | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | + /** | ||
| 141 | + * 获取用户邮箱 | ||
| 142 | + * | ||
| 143 | + * @return email - 用户邮箱 | ||
| 144 | + */ | ||
| 145 | + public String getEmail() { | ||
| 146 | + return email; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 设置用户邮箱 | ||
| 151 | + * | ||
| 152 | + * @param email 用户邮箱 | ||
| 153 | + */ | ||
| 154 | + public void setEmail(String email) { | ||
| 155 | + this.email = email; | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | + /** | ||
| 63 | * 获取spid | 159 | * 获取spid |
| 64 | * | 160 | * |
| 65 | * @return sp_id - spid | 161 | * @return sp_id - spid |
| @@ -100,7 +196,7 @@ public class ShyUsersfree { | @@ -100,7 +196,7 @@ public class ShyUsersfree { | ||
| 100 | * | 196 | * |
| 101 | * @return is_enable - 是否启用,0:未启用,1:启用 | 197 | * @return is_enable - 是否启用,0:未启用,1:启用 |
| 102 | */ | 198 | */ |
| 103 | - public Integer getIs_enable() { | 199 | + public Boolean getIs_enable() { |
| 104 | return is_enable; | 200 | return is_enable; |
| 105 | } | 201 | } |
| 106 | 202 | ||
| @@ -109,7 +205,96 @@ public class ShyUsersfree { | @@ -109,7 +205,96 @@ public class ShyUsersfree { | ||
| 109 | * | 205 | * |
| 110 | * @param is_enable 是否启用,0:未启用,1:启用 | 206 | * @param is_enable 是否启用,0:未启用,1:启用 |
| 111 | */ | 207 | */ |
| 112 | - public void setIs_enable(Integer is_enable) { | 208 | + public void setIs_enable(Boolean is_enable) { |
| 113 | this.is_enable = is_enable; | 209 | this.is_enable = is_enable; |
| 114 | } | 210 | } |
| 211 | + | ||
| 212 | + public String getSp_desc() { | ||
| 213 | + return sp_desc; | ||
| 214 | + } | ||
| 215 | + /** | ||
| 216 | + * 获取是否删除,0:未删除,1:已删除 | ||
| 217 | + * | ||
| 218 | + * @return is_delete - 是否删除,0:未删除,1:已删除 | ||
| 219 | + */ | ||
| 220 | + public Boolean getIs_delete() { | ||
| 221 | + return is_delete; | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + /** | ||
| 225 | + * 设置是否删除,0:未删除,1:已删除 | ||
| 226 | + * | ||
| 227 | + * @param is_delete 是否删除,0:未删除,1:已删除 | ||
| 228 | + */ | ||
| 229 | + public void setIs_delete(Boolean is_delete) { | ||
| 230 | + this.is_delete = is_delete; | ||
| 231 | + } | ||
| 232 | + | ||
| 233 | + /** | ||
| 234 | + * 获取更新人 | ||
| 235 | + * | ||
| 236 | + * @return updater - 更新人 | ||
| 237 | + */ | ||
| 238 | + public String getUpdater() { | ||
| 239 | + return updater; | ||
| 240 | + } | ||
| 241 | + | ||
| 242 | + /** | ||
| 243 | + * 设置更新人 | ||
| 244 | + * | ||
| 245 | + * @param updater 更新人 | ||
| 246 | + */ | ||
| 247 | + public void setUpdater(String updater) { | ||
| 248 | + this.updater = updater; | ||
| 249 | + } | ||
| 250 | + | ||
| 251 | + /** | ||
| 252 | + * 获取创建时间 | ||
| 253 | + * | ||
| 254 | + * @return created_at - 创建时间 | ||
| 255 | + */ | ||
| 256 | + public Date getCreated_at() { | ||
| 257 | + return created_at; | ||
| 258 | + } | ||
| 259 | + | ||
| 260 | + public void setSp_desc(String sp_desc) { | ||
| 261 | + this.sp_desc = sp_desc; | ||
| 262 | + } | ||
| 263 | + | ||
| 264 | + /** | ||
| 265 | + * 设置创建时间 | ||
| 266 | + * | ||
| 267 | + * @param created_at 创建时间 | ||
| 268 | + */ | ||
| 269 | + public void setCreated_at(Date created_at) { | ||
| 270 | + this.created_at = created_at; | ||
| 271 | + } | ||
| 272 | + | ||
| 273 | + /** | ||
| 274 | + * 获取更新时间 | ||
| 275 | + * | ||
| 276 | + * @return updated_at - 更新时间 | ||
| 277 | + */ | ||
| 278 | + public Date getUpdated_at() { | ||
| 279 | + return updated_at; | ||
| 280 | + } | ||
| 281 | + | ||
| 282 | + /** | ||
| 283 | + * 设置更新时间 | ||
| 284 | + * | ||
| 285 | + * @param updated_at 更新时间 | ||
| 286 | + */ | ||
| 287 | + public void setUpdated_at(Date updated_at) { | ||
| 288 | + this.updated_at = updated_at; | ||
| 289 | + } | ||
| 290 | + | ||
| 291 | + public String getCategory_name() { | ||
| 292 | + return category_name; | ||
| 293 | + } | ||
| 294 | + | ||
| 295 | + public void setCategory_name(String category_name) { | ||
| 296 | + this.category_name = category_name; | ||
| 297 | + } | ||
| 298 | + | ||
| 299 | + | ||
| 115 | } | 300 | } |
| 116 | \ No newline at end of file | 301 | \ No newline at end of file |
src/main/java/com/cnlive/shenhe/serviceImpl/UsersServiceImpl.java
| 1 | package com.cnlive.shenhe.serviceImpl; | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | ||
| 3 | -import com.cnlive.shenhe.entity.ShySites; | ||
| 4 | import com.cnlive.shenhe.entity.ShyUsers; | 3 | import com.cnlive.shenhe.entity.ShyUsers; |
| 5 | import com.cnlive.shenhe.mapper.ShyUsersMapper; | 4 | import com.cnlive.shenhe.mapper.ShyUsersMapper; |
| 6 | import com.cnlive.shenhe.utils.CommonUtils; | 5 | import com.cnlive.shenhe.utils.CommonUtils; |
src/main/java/com/cnlive/shenhe/serviceImpl/UsersfreeServiceImpl.java
| 1 | package com.cnlive.shenhe.serviceImpl; | 1 | package com.cnlive.shenhe.serviceImpl; |
| 2 | 2 | ||
| 3 | +import com.alibaba.fastjson.JSONObject; | ||
| 4 | +import com.cnlive.shenhe.entity.ShyUsers; | ||
| 3 | import com.cnlive.shenhe.entity.ShyUsersfree; | 5 | import com.cnlive.shenhe.entity.ShyUsersfree; |
| 4 | import com.cnlive.shenhe.mapper.ShyUsersfreeMapper; | 6 | import com.cnlive.shenhe.mapper.ShyUsersfreeMapper; |
| 7 | +import com.cnlive.shenhe.utils.AuditPass; | ||
| 8 | +import com.cnlive.shenhe.utils.CommonUtils; | ||
| 9 | +import com.github.pagehelper.PageHelper; | ||
| 10 | +import com.github.pagehelper.PageInfo; | ||
| 5 | 11 | ||
| 12 | +import tk.mybatis.mapper.entity.Example; | ||
| 13 | + | ||
| 14 | +import java.util.List; | ||
| 15 | + | ||
| 16 | +import org.slf4j.Logger; | ||
| 17 | +import org.slf4j.LoggerFactory; | ||
| 6 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
| 19 | +import org.springframework.beans.factory.annotation.Value; | ||
| 7 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
| 8 | 21 | ||
| 9 | /** | 22 | /** |
| @@ -13,9 +26,12 @@ import org.springframework.stereotype.Service; | @@ -13,9 +26,12 @@ import org.springframework.stereotype.Service; | ||
| 13 | */ | 26 | */ |
| 14 | @Service | 27 | @Service |
| 15 | public class UsersfreeServiceImpl { | 28 | public class UsersfreeServiceImpl { |
| 29 | + private static Logger logger = LoggerFactory.getLogger(UsersfreeServiceImpl.class); | ||
| 16 | @Autowired | 30 | @Autowired |
| 17 | ShyUsersfreeMapper shyUsersfreeMapper; | 31 | ShyUsersfreeMapper shyUsersfreeMapper; |
| 18 | - | 32 | + @Autowired |
| 33 | + AuditPass Pass; | ||
| 34 | + | ||
| 19 | public ShyUsersfree get(Integer id) { | 35 | public ShyUsersfree get(Integer id) { |
| 20 | return shyUsersfreeMapper.selectByPrimaryKey(id); | 36 | return shyUsersfreeMapper.selectByPrimaryKey(id); |
| 21 | } | 37 | } |
| @@ -23,6 +39,34 @@ public class UsersfreeServiceImpl { | @@ -23,6 +39,34 @@ public class UsersfreeServiceImpl { | ||
| 23 | public ShyUsersfree select(ShyUsersfree shyUsersfree) { | 39 | public ShyUsersfree select(ShyUsersfree shyUsersfree) { |
| 24 | return shyUsersfreeMapper.selectOne(shyUsersfree); | 40 | return shyUsersfreeMapper.selectOne(shyUsersfree); |
| 25 | } | 41 | } |
| 42 | + | ||
| 43 | + public Integer updateState(Integer id, Boolean isEnable) { | ||
| 44 | + ShyUsersfree shyUsersfree=get(id); | ||
| 45 | + shyUsersfree.setIs_enable(isEnable); | ||
| 46 | + return shyUsersfreeMapper.updateByPrimaryKeySelective(shyUsersfree); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + public PageInfo<ShyUsersfree> getpage(Integer page, Integer pageSize, String orderByClause, | ||
| 50 | + String userId,String mobile) { | ||
| 51 | + Example example = new Example(ShyUsers.class); | ||
| 52 | + Example.Criteria criteria = example.createCriteria(); | ||
| 53 | + if (CommonUtils.isNotEmpty(orderByClause)) { | ||
| 54 | + example.setOrderByClause(orderByClause); | ||
| 55 | + }else{ | ||
| 56 | + example.setOrderByClause("created_at desc"); | ||
| 57 | + } | ||
| 58 | + if (CommonUtils.isNotEmpty(userId)) { | ||
| 59 | + criteria.andEqualTo("user_id", userId ); | ||
| 60 | + } | ||
| 61 | + if(CommonUtils.isNotEmpty(mobile)){ | ||
| 62 | + criteria.andLike("mobile", "%" + mobile + "%" ); | ||
| 63 | + } | ||
| 64 | + PageHelper.startPage(page, pageSize, true); | ||
| 65 | + List<ShyUsersfree> ShyUsersList = shyUsersfreeMapper.selectByExample(example); | ||
| 66 | + PageInfo<ShyUsersfree> pageInfo = new PageInfo<ShyUsersfree>(ShyUsersList); | ||
| 67 | + return pageInfo; | ||
| 68 | + } | ||
| 69 | + | ||
| 26 | /** | 70 | /** |
| 27 | * 通过spid、栏目、用户id来查看是否是免审 | 71 | * 通过spid、栏目、用户id来查看是否是免审 |
| 28 | * @param sp_id | 72 | * @param sp_id |
| @@ -33,9 +77,79 @@ public class UsersfreeServiceImpl { | @@ -33,9 +77,79 @@ public class UsersfreeServiceImpl { | ||
| 33 | public ShyUsersfree selectUser(Integer sp_id,String category,String user_id) { | 77 | public ShyUsersfree selectUser(Integer sp_id,String category,String user_id) { |
| 34 | ShyUsersfree shyUserfree=new ShyUsersfree(); | 78 | ShyUsersfree shyUserfree=new ShyUsersfree(); |
| 35 | shyUserfree.setSp_id(sp_id); | 79 | shyUserfree.setSp_id(sp_id); |
| 36 | - shyUserfree.setCategory(category); | 80 | +// shyUserfree.setCategory(category); |
| 37 | shyUserfree.setUser_id(user_id); | 81 | shyUserfree.setUser_id(user_id); |
| 38 | - shyUserfree.setIs_enable(1); | ||
| 39 | - return shyUsersfreeMapper.selectOne(shyUserfree); | 82 | + shyUserfree.setIs_enable(true); |
| 83 | + shyUserfree.setIs_delete(false); | ||
| 84 | + ShyUsersfree shyUserfree1 = shyUsersfreeMapper.selectOne(shyUserfree); | ||
| 85 | + if(shyUserfree1 != null && shyUserfree1.getCategory().contains(category)){ | ||
| 86 | + return shyUserfree1; | ||
| 87 | + } | ||
| 88 | + return null; | ||
| 40 | } | 89 | } |
| 90 | + | ||
| 91 | + public boolean update(String userId, String userMobile, String write,Integer spId,String updater) { | ||
| 92 | + JSONObject result = new JSONObject(); | ||
| 93 | + try { | ||
| 94 | + result = Pass.queryUser(userId,userMobile); | ||
| 95 | + } catch (Exception e) { | ||
| 96 | + logger.error("用户白名单获取失败,userId:{},userMobile:{}", userId,userMobile); | ||
| 97 | + return false; | ||
| 98 | + } | ||
| 99 | + if (result == null) { | ||
| 100 | + logger.error("用户白名单返回无结果,userId:{},userMobile:{}", userId,userMobile); | ||
| 101 | + return false; | ||
| 102 | + } else { | ||
| 103 | + Integer code = result.getInteger("errorCode"); | ||
| 104 | + if (code != 0) { | ||
| 105 | + logger.error("用户白名单返回code值为,errorCode:{},errorMessage:{},userId:{},userMobile:{}", code, result.getString("errorMessage"), userId,userMobile); | ||
| 106 | + return false; | ||
| 107 | + } | ||
| 108 | + JSONObject jsonData =result.getJSONObject("data"); | ||
| 109 | + String mobile=jsonData.getString("mobile"); | ||
| 110 | + String user_id=jsonData.getString("uid"); | ||
| 111 | + String user_name=jsonData.getString("nickName"); | ||
| 112 | + String email=jsonData.getString("email"); | ||
| 113 | + | ||
| 114 | + ShyUsersfree shyUserfree=new ShyUsersfree(); | ||
| 115 | + shyUserfree.setUser_id(user_id); | ||
| 116 | + ShyUsersfree shyUserfree1 = shyUsersfreeMapper.selectOne(shyUserfree); | ||
| 117 | + | ||
| 118 | + if(shyUserfree1 != null){ | ||
| 119 | + shyUserfree1.setMobile(mobile); | ||
| 120 | + shyUserfree1.setCategory(write); | ||
| 121 | + shyUserfree1.setUser_name(user_name); | ||
| 122 | + shyUserfree1.setEmail(email); | ||
| 123 | + shyUserfree1.setSp_id(spId); | ||
| 124 | + shyUserfree1.setUpdated_at(CommonUtils.getCurrentTime()); | ||
| 125 | + shyUserfree1.setUpdater(updater); | ||
| 126 | + shyUserfree1.setIs_delete(false); | ||
| 127 | + shyUserfree1.setIs_enable(true); | ||
| 128 | + int re = shyUsersfreeMapper.updateByPrimaryKeySelective(shyUserfree1); | ||
| 129 | + if (re != 1) { | ||
| 130 | + return false; | ||
| 131 | + } | ||
| 132 | + }else{ | ||
| 133 | + shyUserfree.setMobile(mobile); | ||
| 134 | + shyUserfree.setCategory(write); | ||
| 135 | + shyUserfree.setUser_name(user_name); | ||
| 136 | + shyUserfree.setEmail(email); | ||
| 137 | + shyUserfree.setSp_id(spId); | ||
| 138 | + shyUserfree.setCreated_at(CommonUtils.getCurrentTime()); | ||
| 139 | + shyUserfree.setUpdated_at(CommonUtils.getCurrentTime()); | ||
| 140 | + shyUserfree.setUpdater(updater); | ||
| 141 | + shyUserfree.setIs_delete(false); | ||
| 142 | + shyUserfree.setIs_enable(true); | ||
| 143 | + | ||
| 144 | + int re = shyUsersfreeMapper.insertSelective(shyUserfree); | ||
| 145 | + if (re != 1) { | ||
| 146 | + return false; | ||
| 147 | + } | ||
| 148 | + } | ||
| 149 | + } | ||
| 150 | + | ||
| 151 | + return true; | ||
| 152 | + } | ||
| 153 | + | ||
| 154 | + | ||
| 41 | } | 155 | } |
src/main/java/com/cnlive/shenhe/utils/AuditPass.java
| @@ -25,6 +25,12 @@ public class AuditPass { | @@ -25,6 +25,12 @@ public class AuditPass { | ||
| 25 | private String platformValue;//点播platformValue | 25 | private String platformValue;//点播platformValue |
| 26 | @Value("${live_url}") | 26 | @Value("${live_url}") |
| 27 | private String live_url;//直播同步信息 | 27 | private String live_url;//直播同步信息 |
| 28 | + | ||
| 29 | + @Value("${queryUserByMobile}") | ||
| 30 | + private String queryUserByMobile;//用户云查网家家用户信息(通过手机号) | ||
| 31 | + | ||
| 32 | + @Value("${queryUserByUserId}") | ||
| 33 | + private String queryUserByUserId;//用户云查网家家用户信息(通过用户id) | ||
| 28 | 34 | ||
| 29 | /** | 35 | /** |
| 30 | * 点播视频回调 | 36 | * 点播视频回调 |
| @@ -151,4 +157,16 @@ public class AuditPass { | @@ -151,4 +157,16 @@ public class AuditPass { | ||
| 151 | JSONObject result = JSONObject.parseObject(httpUtilResult); | 157 | JSONObject result = JSONObject.parseObject(httpUtilResult); |
| 152 | return result; | 158 | return result; |
| 153 | } | 159 | } |
| 160 | + public JSONObject queryUser(String userId, String userMobile) { | ||
| 161 | + logger.info("用户云查询用户:userId:{},userMobile:{}", userId, userMobile); | ||
| 162 | + HttpUtil httpUtil = HttpUtil.init(); | ||
| 163 | + String URL = ""; | ||
| 164 | + if(CommonUtils.isNotEmpty(userId)){ | ||
| 165 | + URL = queryUserByUserId + userId; | ||
| 166 | + }else{ | ||
| 167 | + URL = queryUserByMobile + userMobile; | ||
| 168 | + } | ||
| 169 | + Map<String, String> post = httpUtil.post(URL); | ||
| 170 | + return JSONObject.parseObject(post.get("result")); | ||
| 171 | + } | ||
| 154 | } | 172 | } |
src/main/java/com/cnlive/shenhe/utils/CommonConst.java
| @@ -117,7 +117,7 @@ public class CommonConst { | @@ -117,7 +117,7 @@ public class CommonConst { | ||
| 117 | */ | 117 | */ |
| 118 | public static String CATEGORY_WITNESS = "witness"; | 118 | public static String CATEGORY_WITNESS = "witness"; |
| 119 | /** | 119 | /** |
| 120 | - * 栏目分类,用户 | 120 | + * 栏目分类,朋友圈 |
| 121 | */ | 121 | */ |
| 122 | public static String CATEGORY_MOMENT = "moment"; | 122 | public static String CATEGORY_MOMENT = "moment"; |
| 123 | /** | 123 | /** |
| @@ -133,6 +133,8 @@ public class CommonConst { | @@ -133,6 +133,8 @@ public class CommonConst { | ||
| 133 | */ | 133 | */ |
| 134 | public static String CATEGORY_AVIATION = "aviation"; | 134 | public static String CATEGORY_AVIATION = "aviation"; |
| 135 | 135 | ||
| 136 | + | ||
| 137 | + public static JSONObject CATEGORY = JSONObject.parseObject("{\"witness\":\"目击者\",\"moment\":\"朋友圈\",\"sub\":\"达人\",\"snow\":\"上冰雪\",\"aviation\":\"航空节\"}"); | ||
| 136 | /** | 138 | /** |
| 137 | * 数美过滤器尺度状态:用户 | 139 | * 数美过滤器尺度状态:用户 |
| 138 | */ | 140 | */ |
src/main/resources/application.properties
| @@ -44,6 +44,10 @@ spring.application.home=/usr/local/cnlive_shenhe/log | @@ -44,6 +44,10 @@ spring.application.home=/usr/local/cnlive_shenhe/log | ||
| 44 | sync_users_api=http://api.cnlive.com/open/api2/inner2/shenhe/getuser | 44 | sync_users_api=http://api.cnlive.com/open/api2/inner2/shenhe/getuser |
| 45 | sync_users_app_key=314a9dd4-a9b7-4c12-bbbe-1150a36491ae | 45 | sync_users_app_key=314a9dd4-a9b7-4c12-bbbe-1150a36491ae |
| 46 | 46 | ||
| 47 | +#\u7528\u6237\u4e91\u8bf7\u6c42\u67e5\u8be2\u7528\u6237\u4fe1\u606f | ||
| 48 | +queryUserByMobile=http://120.92.63.227/CnliveM2/user/readUserByUserName.action?userName= | ||
| 49 | +queryUserByUserId=http://120.92.63.227/CnliveM2/user/readUserByUid.action?uid= | ||
| 50 | + | ||
| 47 | #\u70b9\u64ad\u4e91\u9700\u8981\u7684\u5e38\u91cf | 51 | #\u70b9\u64ad\u4e91\u9700\u8981\u7684\u5e38\u91cf |
| 48 | url=http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify | 52 | url=http://mam.innerapi.cnlive.com/v1/inner/ShenHeInfo/shenheNotify |
| 49 | platformKey =AUDIT | 53 | platformKey =AUDIT |
src/main/resources/mapper/ShyUsersfreeMapper.xml
| @@ -7,8 +7,15 @@ | @@ -7,8 +7,15 @@ | ||
| 7 | --> | 7 | --> |
| 8 | <id column="id" jdbcType="INTEGER" property="id" /> | 8 | <id column="id" jdbcType="INTEGER" property="id" /> |
| 9 | <result column="user_id" jdbcType="VARCHAR" property="user_id" /> | 9 | <result column="user_id" jdbcType="VARCHAR" property="user_id" /> |
| 10 | + <result column="user_name" jdbcType="VARCHAR" property="user_name" /> | ||
| 11 | + <result column="mobile" jdbcType="VARCHAR" property="mobile" /> | ||
| 12 | + <result column="email" jdbcType="VARCHAR" property="email" /> | ||
| 10 | <result column="sp_id" jdbcType="INTEGER" property="sp_id" /> | 13 | <result column="sp_id" jdbcType="INTEGER" property="sp_id" /> |
| 11 | <result column="category" jdbcType="VARCHAR" property="category" /> | 14 | <result column="category" jdbcType="VARCHAR" property="category" /> |
| 12 | - <result column="is_enable" jdbcType="INTEGER" property="is_enable" /> | 15 | + <result column="is_enable" jdbcType="BIT" property="is_enable" /> |
| 16 | + <result column="is_delete" jdbcType="BIT" property="is_delete" /> | ||
| 17 | + <result column="updater" jdbcType="VARCHAR" property="updater" /> | ||
| 18 | + <result column="created_at" jdbcType="TIMESTAMP" property="created_at" /> | ||
| 19 | + <result column="updated_at" jdbcType="TIMESTAMP" property="updated_at" /> | ||
| 13 | </resultMap> | 20 | </resultMap> |
| 14 | </mapper> | 21 | </mapper> |
| 15 | \ No newline at end of file | 22 | \ No newline at end of file |
src/main/resources/templates/common/frame.html
| @@ -81,8 +81,9 @@ line-height: 2em; margin: 0 auto;font-size: 2em" th:text="${session.sessionUser. | @@ -81,8 +81,9 @@ line-height: 2em; margin: 0 auto;font-size: 2em" th:text="${session.sessionUser. | ||
| 81 | <span class="menu-item-top">系统管理</span> | 81 | <span class="menu-item-top">系统管理</span> |
| 82 | </a> | 82 | </a> |
| 83 | <ul class="treeview-menu"> | 83 | <ul class="treeview-menu"> |
| 84 | - <li><a href="/users/page" id="/users/page"> 审核用户管理</a></li> | ||
| 85 | - <li><a href="/sites/page" id="/sites/page"> 白名单管理</a></li> | 84 | + <li><a href="/users/page" id="/users/page"> 审核云用户管理</a></li> |
| 85 | + <li><a href="/sites/page" id="/sites/page"> SP白名单管理</a></li> | ||
| 86 | + <li><a href="/usersFree/page" id="/usersFree/page"> 用户白名单管理</a></li> | ||
| 86 | </ul> | 87 | </ul> |
| 87 | </li> | 88 | </li> |
| 88 | </ul> | 89 | </ul> |
src/main/resources/templates/logging/logging.html deleted
100644 → 0
| 1 | -<!DOCTYPE> | ||
| 2 | -<!--解决idea thymeleaf 表达式模板报红波浪线--> | ||
| 3 | -<!--suppress ALL --> | ||
| 4 | -<html xmlns:th="http://www.thymeleaf.org"> | ||
| 5 | -<head> | ||
| 6 | - <meta charset="UTF-8"> | ||
| 7 | - <title>实时日志</title> | ||
| 8 | - <!-- jquery --> | ||
| 9 | - <script th:src="@{../../static/js/jquery.min.js}"></script> | ||
| 10 | -<!-- <script src="../../static/js/jquery-1.9.1.min.js"></script> --> | ||
| 11 | -</head> | ||
| 12 | -<body> | ||
| 13 | -<!-- 标题 --> | ||
| 14 | -<h1 style="text-align: center;">实时日志</h1> | ||
| 15 | - | ||
| 16 | -<!-- 显示区 --> | ||
| 17 | -<div id="loggingText" contenteditable="true" | ||
| 18 | - style="width:100%;height: 600px;background-color: ghostwhite; overflow: auto;"></div> | ||
| 19 | - | ||
| 20 | -<!-- 操作栏 --> | ||
| 21 | -<div style="text-align: center;"> | ||
| 22 | - <button onclick="$('#loggingText').text('')" style="color: green; height: 35px;">清屏</button> | ||
| 23 | - <button onclick="$('#loggingText').animate({scrollTop:$('#loggingText')[0].scrollHeight});" | ||
| 24 | - style="color: green; height: 35px;">滚动至底部 | ||
| 25 | - </button> | ||
| 26 | - <button onclick="if(window.loggingAutoBottom){$(this).text('开启自动滚动');}else{$(this).text('关闭自动滚动');};window.loggingAutoBottom = !window.loggingAutoBottom" | ||
| 27 | - style="color: green; height: 35px; ">开启自动滚动 | ||
| 28 | - </button> | ||
| 29 | -</div> | ||
| 30 | -</body> | ||
| 31 | -<script th:inline="javascript"> | ||
| 32 | - //websocket对象 | ||
| 33 | - let websocket = null; | ||
| 34 | - var re=location.origin.replace("http://", ""); | ||
| 35 | - console.log(re); | ||
| 36 | - //判断当前浏览器是否支持WebSocket | ||
| 37 | - if ('WebSocket' in window) { | ||
| 38 | - websocket = new WebSocket("ws://"+re+"/logging/websocket"); | ||
| 39 | - } else { | ||
| 40 | - console.error("不支持WebSocket"); | ||
| 41 | - } | ||
| 42 | - | ||
| 43 | - //连接发生错误的回调方法 | ||
| 44 | - websocket.onerror = function (e) { | ||
| 45 | - console.error("WebSocket连接发生错误"); | ||
| 46 | - }; | ||
| 47 | - | ||
| 48 | - //连接成功建立的回调方法 | ||
| 49 | - websocket.onopen = function () { | ||
| 50 | - console.log("WebSocket连接成功") | ||
| 51 | - }; | ||
| 52 | - | ||
| 53 | - //接收到消息的回调方法 | ||
| 54 | - websocket.onmessage = function (event) { | ||
| 55 | - //追加 | ||
| 56 | - if (event.data) { | ||
| 57 | - | ||
| 58 | - //日志内容 | ||
| 59 | - let $loggingText = $("#loggingText"); | ||
| 60 | - $loggingText.append(event.data); | ||
| 61 | - | ||
| 62 | - //是否开启自动底部 | ||
| 63 | - if (window.loggingAutoBottom) { | ||
| 64 | - //滚动条自动到最底部 | ||
| 65 | - $loggingText.scrollTop($loggingText[0].scrollHeight); | ||
| 66 | - } | ||
| 67 | - } | ||
| 68 | - } | ||
| 69 | - | ||
| 70 | - //连接关闭的回调方法 | ||
| 71 | - websocket.onclose = function () { | ||
| 72 | - console.log("WebSocket连接关闭") | ||
| 73 | - }; | ||
| 74 | -</script> | ||
| 75 | -</html> | ||
| 76 | \ No newline at end of file | 0 | \ No newline at end of file |
src/main/resources/templates/page/site.html
| @@ -16,12 +16,12 @@ | @@ -16,12 +16,12 @@ | ||
| 16 | <div class="content-wrapper" style="min-height: 788px;"> | 16 | <div class="content-wrapper" style="min-height: 788px;"> |
| 17 | <section class="content-header"> | 17 | <section class="content-header"> |
| 18 | <h1> | 18 | <h1> |
| 19 | - 白名单管理 | 19 | + 站点白名单管理 |
| 20 | </h1> | 20 | </h1> |
| 21 | <ol class="breadcrumb"> | 21 | <ol class="breadcrumb"> |
| 22 | <li>首页</li> | 22 | <li>首页</li> |
| 23 | <li>系统管理</li> | 23 | <li>系统管理</li> |
| 24 | - <li class="active">白名单管理</li> | 24 | + <li class="active">站点白名单管理</li> |
| 25 | </ol> | 25 | </ol> |
| 26 | </section> | 26 | </section> |
| 27 | <section class="content"> | 27 | <section class="content"> |
src/main/resources/templates/page/users.html
| @@ -16,12 +16,12 @@ | @@ -16,12 +16,12 @@ | ||
| 16 | <div class="content-wrapper" style="min-height: 788px;"> | 16 | <div class="content-wrapper" style="min-height: 788px;"> |
| 17 | <section class="content-header"> | 17 | <section class="content-header"> |
| 18 | <h1> | 18 | <h1> |
| 19 | - 审核用户管理 | 19 | + 审核云用户管理 |
| 20 | </h1> | 20 | </h1> |
| 21 | <ol class="breadcrumb"> | 21 | <ol class="breadcrumb"> |
| 22 | <li>首页</li> | 22 | <li>首页</li> |
| 23 | <li>系统管理</li> | 23 | <li>系统管理</li> |
| 24 | - <li class="active">审核用户管理</li> | 24 | + <li class="active">审核云用户管理</li> |
| 25 | </ol> | 25 | </ol> |
| 26 | </section> | 26 | </section> |
| 27 | <section class="content"> | 27 | <section class="content"> |
src/main/resources/templates/page/usersFree.html
0 → 100644
| 1 | +<!DOCTYPE html> | ||
| 2 | +<html lang="zh" xmlns:th="http://www.thymeleaf.org"> | ||
| 3 | + | ||
| 4 | +<head th:replace="../templates/common/head::head"></head> | ||
| 5 | +<style type="text/css"> | ||
| 6 | + .fixed-table-toolbar .bs-bars, .fixed-table-toolbar .columns, .fixed-table-toolbar .search{margin-top: 0px;} | ||
| 7 | + .table{margin-bottom:0;} | ||
| 8 | + | ||
| 9 | + | ||
| 10 | + .switch { | ||
| 11 | + position: relative; | ||
| 12 | + display: inline-block; | ||
| 13 | + width: 60px; | ||
| 14 | + height: 34px; | ||
| 15 | +} | ||
| 16 | + | ||
| 17 | +.switch input {display:none;} | ||
| 18 | + | ||
| 19 | +.slider { | ||
| 20 | + position: absolute; | ||
| 21 | + cursor: pointer; | ||
| 22 | + top: 0; | ||
| 23 | + left: 0; | ||
| 24 | + right: 0; | ||
| 25 | + bottom: 0; | ||
| 26 | + background-color: red; | ||
| 27 | + -webkit-transition: .4s; | ||
| 28 | + transition: .4s; | ||
| 29 | +} | ||
| 30 | + | ||
| 31 | +.slider:before { | ||
| 32 | + position: absolute; | ||
| 33 | + content: ""; | ||
| 34 | + height: 26px; | ||
| 35 | + width: 26px; | ||
| 36 | + left: 4px; | ||
| 37 | + bottom: 4px; | ||
| 38 | + background-color: white; | ||
| 39 | + -webkit-transition: .4s; | ||
| 40 | + transition: .4s; | ||
| 41 | +} | ||
| 42 | + | ||
| 43 | +input:checked + .slider { | ||
| 44 | + background-color: #2196F3; | ||
| 45 | +} | ||
| 46 | + | ||
| 47 | +input:focus + .slider { | ||
| 48 | + box-shadow: 0 0 1px #2196F3; | ||
| 49 | +} | ||
| 50 | + | ||
| 51 | +input:checked + .slider:before { | ||
| 52 | + -webkit-transform: translateX(26px); | ||
| 53 | + -ms-transform: translateX(26px); | ||
| 54 | + transform: translateX(26px); | ||
| 55 | +} | ||
| 56 | + | ||
| 57 | +/* Rounded sliders */ | ||
| 58 | +.slider.round { | ||
| 59 | + border-radius: 34px; | ||
| 60 | +} | ||
| 61 | + | ||
| 62 | +.slider.round:before { | ||
| 63 | + border-radius: 50%; | ||
| 64 | +} | ||
| 65 | + | ||
| 66 | +</style> | ||
| 67 | +<body class="skin-blue sidebar-mini"> | ||
| 68 | + | ||
| 69 | +<div class="wrapper"> | ||
| 70 | + | ||
| 71 | + <div th:replace="../templates/common/frame::frame"></div> | ||
| 72 | + | ||
| 73 | + <div class="content-wrapper" style="min-height: 788px;"> | ||
| 74 | + <section class="content-header"> | ||
| 75 | + <h1> | ||
| 76 | + 用户白名单管理 | ||
| 77 | + </h1> | ||
| 78 | + <ol class="breadcrumb"> | ||
| 79 | + <li>首页</li> | ||
| 80 | + <li>系统管理</li> | ||
| 81 | + <li class="active">用户白名单管理</li> | ||
| 82 | + </ol> | ||
| 83 | + </section> | ||
| 84 | + <section class="content"> | ||
| 85 | + <div class="row"> | ||
| 86 | + <div class="col-xs-12"> | ||
| 87 | + <div class="box box-info"> | ||
| 88 | + <div class="box-body"> | ||
| 89 | + <div class="btn-group margin-bottom " style="padding: 0; width: 98%; float: right;"> | ||
| 90 | + <div class="columns columns-right btn-group "> | ||
| 91 | + <button class="btn btn-success" onclick="javascript:add()" type="button" name="refresh" title="添加" id="users_addS">添加</button> | ||
| 92 | + </div> | ||
| 93 | + <div class="col-md-6 pull-right" style="padding: 0; width: 5%;"> | ||
| 94 | + <button class="btn btn-default" type="button" name="refresh" | ||
| 95 | + title="搜索" id="users_query">搜索</button> | ||
| 96 | + </div> | ||
| 97 | + <div class="col-md-6 pull-right" style="padding: 0; width: 20%;"> | ||
| 98 | + <label for="mobile" class="control-label cb-toolbar" | ||
| 99 | + style="font-size: 15px; top: 8px; font-weight: 100;">手机号:</label> | ||
| 100 | + <div class="col-sm-7" style="padding: 0;"> | ||
| 101 | + <input class="form-control" type="text" th:value="${param.mobile}" id="mobile"> | ||
| 102 | + </div> | ||
| 103 | + </div> | ||
| 104 | + <div class="col-md-5 pull-right" style="padding: 0; width: 15%;"> | ||
| 105 | + <label for="sp_id" class="control-label cb-toolbar" | ||
| 106 | + style="font-size: 15px; top: 8px; font-weight: 100;">用户ID:</label> | ||
| 107 | + <div class="col-sm-7" style="padding: 0;"> | ||
| 108 | + <input class="form-control" type="text" th:value="${param.userId}" id="user_id"> | ||
| 109 | + </div> | ||
| 110 | + </div> | ||
| 111 | + </div> | ||
| 112 | + | ||
| 113 | + | ||
| 114 | + | ||
| 115 | + <div class="fixed-table-container" style="padding-bottom: 0px;"> | ||
| 116 | + <div class="fixed-table-body"> | ||
| 117 | + <table data-toggle="table" data-pagination="true" data-search="false" data-show-refresh="true" | ||
| 118 | + data-show-toggle="true" data-show-columns="true" data-toolbar="#toolbar" class="table table-hover"> | ||
| 119 | + <thead> | ||
| 120 | + <tr> | ||
| 121 | + <th style="text-align: center; width: 5%;" data-field="sp_id" tabindex="0"> | ||
| 122 | + <div class="th-inner ">用户ID</div> | ||
| 123 | + <div class="fht-cell"></div> | ||
| 124 | + </th> | ||
| 125 | + <th style="text-align: center; width: 12%;" data-field="sp_id_brief" tabindex="0"> | ||
| 126 | + <div class="th-inner ">用户昵称</div> | ||
| 127 | + <div class="fht-cell"></div> | ||
| 128 | + </th> | ||
| 129 | + <th style="text-align: center; width: 8%;" data-field="type" tabindex="0"> | ||
| 130 | + <div class="th-inner ">手机号</div> | ||
| 131 | + <div class="fht-cell"></div> | ||
| 132 | + </th> | ||
| 133 | + <th style="text-align: center; width: 12%;" data-field="type" tabindex="0"> | ||
| 134 | + <div class="th-inner ">邮箱</div> | ||
| 135 | + <div class="fht-cell"></div> | ||
| 136 | + </th> | ||
| 137 | + <th style="text-align: center; width: 10%;" data-field="type" tabindex="0"> | ||
| 138 | + <div class="th-inner ">sp昵称</div> | ||
| 139 | + <div class="fht-cell"></div> | ||
| 140 | + </th> | ||
| 141 | + <th style="text-align: center; width: 6%;" data-field="type" tabindex="0"> | ||
| 142 | + <div class="th-inner ">栏目分类</div> | ||
| 143 | + <div class="fht-cell"></div> | ||
| 144 | + </th> | ||
| 145 | + <th style="text-align: center; width: 6%;" data-field="type" tabindex="0"> | ||
| 146 | + <div class="th-inner ">使用状态</div> | ||
| 147 | + <div class="fht-cell"></div> | ||
| 148 | + </th> | ||
| 149 | + <th style="text-align: center; width: 12%;" data-field="upload_time" tabindex="0"> | ||
| 150 | + <div class="th-inner ">创建时间</div> | ||
| 151 | + <div class="fht-cell"></div> | ||
| 152 | + </th> | ||
| 153 | + <th style="text-align: center; width: 12%;" data-field="updated_at" tabindex="0"> | ||
| 154 | + <div class="th-inner ">更新时间</div> | ||
| 155 | + <div class="fht-cell"></div> | ||
| 156 | + </th> | ||
| 157 | + <th style="text-align: center; width: 10%;" data-field="action" tabindex="0"> | ||
| 158 | + <div class="th-inner ">操作</div> | ||
| 159 | + <div class="fht-cell"></div> | ||
| 160 | + </th> | ||
| 161 | + </tr> | ||
| 162 | + </thead> | ||
| 163 | + <tbody> | ||
| 164 | + <tr th:data-index="${usersStat.index}" th:each="users : ${usersPage.list}"> | ||
| 165 | + <td style="text-align: center; width: 5%;" th:text="${users.user_id}">82</td> | ||
| 166 | + <td style="text-align: center; width: 12%;" th:text="${users.user_name}">视讯中国</td> | ||
| 167 | + <td style="text-align: center; width: 8%;" th:text="${users.mobile}">用户名</td> | ||
| 168 | + <td style="text-align: center; width: 12%;" th:text="${users.email}">邮箱</td> | ||
| 169 | + <td style="text-align: center; width: 10%;" th:text="${users.sp_desc}">手机号</td> | ||
| 170 | + <td style="text-align: center; width: 6%;" th:text="${users.category_name}"></td> | ||
| 171 | +<!-- <td style="text-align: center; width: 6%;" th:if="${users.is_enable==true}"> --> | ||
| 172 | +<!-- <span class="label label-success">正常</span></td> --> | ||
| 173 | +<!-- <td style="text-align: center; width: 6%;" th:if="${users.is_enable==false}"> --> | ||
| 174 | +<!-- <span class="label label-danger">禁用</span></td> --> | ||
| 175 | + <td style="text-align: center; width: 6%;" th:if="${users.is_enable==true}"> | ||
| 176 | + <label class="switch"><input type="checkbox" checked th:id="'id'+${users.id}"><span class="slider round" th:id="${users.id}"></span></label> | ||
| 177 | + </td> | ||
| 178 | + <td style="text-align: center; width: 6%;" th:if="${users.is_enable!=true}"> | ||
| 179 | + <label class="switch"><input type="checkbox" th:id="'id'+${users.id}"><span class="slider round" th:id="${users.id}"></span></label> | ||
| 180 | + </td> | ||
| 181 | + <td style="text-align: center; width: 12%;" th:text="${#dates.format(users.created_at, 'yyyy-MM-dd HH:mm:ss')}">2018-11-22 | ||
| 182 | + 23:08:48</td> | ||
| 183 | + <td style="text-align: center; width: 12%;" th:text="${#dates.format(users.updated_at, 'yyyy-MM-dd HH:mm:ss')}">2016-08-03 | ||
| 184 | + 14:27:17</td> | ||
| 185 | + <td style="text-align: center; width: 10%;"> | ||
| 186 | + <span> </span> | ||
| 187 | + <a class="edit" th:href="'javascript:edit('+${users.user_id}+',\''+${users.mobile}+'\',\''+${users.sp_id}+'\',\''+${users.category} +'\')'"> | ||
| 188 | + <button class="btn btn-primary btn-xs">修改</button> | ||
| 189 | + </a><span> </span><span> </span></td> | ||
| 190 | + </tr> | ||
| 191 | + | ||
| 192 | + </tbody> | ||
| 193 | + </table> | ||
| 194 | + </div> | ||
| 195 | + | ||
| 196 | + <div class="fixed-table-pagination" style="display: block;"> | ||
| 197 | + <div class="pull-left pagination-detail"> | ||
| 198 | + <span class="pagination-info" | ||
| 199 | + th:text="'共 '+${usersPage.total}+' 条记录,每页显示'">共 0 条记录</span> | ||
| 200 | + <select class="" id="pageSize" name="pageSize" | ||
| 201 | + onchange="selectPageSize()"> | ||
| 202 | + <option value="10" th:selected="${pageSize==10}">10</option> | ||
| 203 | + <option value="20" th:selected="${pageSize==20}">20</option> | ||
| 204 | + <option value="50" th:selected="${pageSize==50}">50</option> | ||
| 205 | + <option value="100" th:selected="${pageSize==100}">100</option> | ||
| 206 | + </select> <span class="pagination-info">条记录</span> | ||
| 207 | + </div> | ||
| 208 | + <div class="pull-right pagination"> | ||
| 209 | + <ul class="pagination" th:if="${usersPage.pages>1}"> | ||
| 210 | + <li class="page-pre"><a | ||
| 211 | + th:href="'javascript:fanye(1);'">‹‹</a></li> | ||
| 212 | + <li class="page-pre" th:if="${!usersPage.isFirstPage}"><a | ||
| 213 | + th:onclick="'javascript:fanye(\''+${usersPage.pageNum-1}+'\');'">‹</a> | ||
| 214 | + </li> | ||
| 215 | + | ||
| 216 | + <li class="page-number" th:if="${usersPage.pageNum-3>=1}"><a | ||
| 217 | + th:onclick="'javascript:fanye(\''+${usersPage.pageNum-3}+'\');'" | ||
| 218 | + th:text="${usersPage.pageNum-3}">2</a></li> | ||
| 219 | + <li class="page-number" th:if="${usersPage.pageNum-2>=1}"><a | ||
| 220 | + th:onclick="'javascript:fanye(\''+${usersPage.pageNum-2}+'\');'" | ||
| 221 | + th:text="${usersPage.pageNum-2}">2</a></li> | ||
| 222 | + <li class="page-number" th:if="${usersPage.pageNum-1>=1}"><a | ||
| 223 | + th:onclick="'javascript:fanye(\''+${usersPage.pageNum-1}+'\');'" | ||
| 224 | + th:text="${usersPage.pageNum-1}">2</a></li> | ||
| 225 | + <li class="page-number active"><a | ||
| 226 | + href="javaScript:void(0);" th:text="${usersPage.pageNum}">2</a></li> | ||
| 227 | + <li class="page-number" | ||
| 228 | + th:if="${usersPage.pageNum+1<=usersPage.pages}"><a | ||
| 229 | + th:onclick="'javascript:fanye(\''+${usersPage.pageNum+1}+'\');'" | ||
| 230 | + th:text="${usersPage.pageNum+1}">2</a></li> | ||
| 231 | + <li class="page-number" | ||
| 232 | + th:if="${usersPage.pageNum+2<=usersPage.pages}"><a | ||
| 233 | + th:onclick="'javascript:fanye(\''+${usersPage.pageNum+2}+'\');'" | ||
| 234 | + th:text="${usersPage.pageNum+2}">2</a></li> | ||
| 235 | + <li class="page-number" | ||
| 236 | + th:if="${usersPage.pageNum+3<=usersPage.pages}"><a | ||
| 237 | + th:onclick="'javascript:fanye(\''+${usersPage.pageNum+3}+'\');'" | ||
| 238 | + th:text="${usersPage.pageNum+3}">2</a></li> | ||
| 239 | + | ||
| 240 | + <li class="page-next" th:if="${!usersPage.isLastPage}"><a | ||
| 241 | + th:onclick="'javascript:fanye(\''+${usersPage.pageNum+1}+'\');'">›</a> | ||
| 242 | + </li> | ||
| 243 | + <li class="page-next"><a | ||
| 244 | + th:onclick="'javascript:fanye(\''+${usersPage.pages}+'\');'">››</a> | ||
| 245 | + </li> | ||
| 246 | + </ul> | ||
| 247 | + </div> | ||
| 248 | + </div> | ||
| 249 | + </div> | ||
| 250 | + </div> | ||
| 251 | + <div class="clearfix"></div> | ||
| 252 | + </div> | ||
| 253 | + </div> | ||
| 254 | + </div> | ||
| 255 | + </section> | ||
| 256 | + </div> | ||
| 257 | + | ||
| 258 | +<!-- 模态框(Modal) --> | ||
| 259 | +<div class="modal fade" id="editModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"> | ||
| 260 | + <div class="modal-dialog"> | ||
| 261 | + <div class="modal-content" style="margin-top: 30%;"> | ||
| 262 | + <div class="modal-header"> | ||
| 263 | + <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button> | ||
| 264 | + <h4 class="modal-title" id="myModalLabel">编辑免审用户</h4> | ||
| 265 | + </div> | ||
| 266 | + <div class="modal-body"> | ||
| 267 | + <form action="/usersFree/write" method="post" id="editWrite"> | ||
| 268 | + <input type="text" name="redirect_url" value="" class="hide" id="redirect_url"/> | ||
| 269 | + <div class="form-group hide"> | ||
| 270 | + <label class="control-label col-sm-3" style="font-size: 15px;" >用户Id:</label> | ||
| 271 | + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> | ||
| 272 | + <input class="form-control" style="width:30%;" type="text" value="" id="userId" name="userId"> | ||
| 273 | + </div> | ||
| 274 | + </div> | ||
| 275 | + <div class="form-group"> | ||
| 276 | + <label class="control-label col-sm-3" style="font-size: 15px;">用户手机号:</label> | ||
| 277 | + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> | ||
| 278 | + <input class="form-control" style="width:40%;" type="text" value="" id="userMobile" name="userMobile"> | ||
| 279 | + </div> | ||
| 280 | + </div> | ||
| 281 | + <div class="form-group"> | ||
| 282 | + <label class="control-label col-sm-3" style="font-size: 15px;">站点Id:</label> | ||
| 283 | + <div class="col-sm-9" style="margin-top: -5px;margin-bottom: 20px;"> | ||
| 284 | + <input class="form-control" style="width:20%;" type="text" value="" id="spId" name="spId"> | ||
| 285 | + </div> | ||
| 286 | + </div> | ||
| 287 | + | ||
| 288 | + <div class="form-group"> | ||
| 289 | + <label class="control-label col-sm-3" style="font-size: 15px;">免审业务:</label> | ||
| 290 | + <div class="col-sm-9" style="float: left"> | ||
| 291 | + <div th:each="bu:${category}" style="padding-right: 30px;" class="write_check"> | ||
| 292 | + <span th:text="${bu.value}" style="font-size: 15px"></span> | ||
| 293 | + <input type="checkbox" name="write_business" th:value="${bu.key}" th:id="'write_check_'+${bu.key}"> | ||
| 294 | + </div> | ||
| 295 | + </div> | ||
| 296 | + </div> | ||
| 297 | + | ||
| 298 | + </form> | ||
| 299 | + </div> | ||
| 300 | + <div class="modal-footer"> | ||
| 301 | + <button type="button" class="btn btn-primary" onclick="javascript:$('#editWrite').submit();">提交</button> | ||
| 302 | + <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button> | ||
| 303 | + </div> | ||
| 304 | + </div><!-- /.modal-content --> | ||
| 305 | + </div><!-- /.modal-dialog --> | ||
| 306 | +</div> | ||
| 307 | +<!-- /.modal --> | ||
| 308 | + <script> | ||
| 309 | + //打开编辑窗口 | ||
| 310 | + function edit(userId,mobile,spId,write_business){ | ||
| 311 | + $("#myModalLabel").text("修改免审用户"); | ||
| 312 | + $("#userId").val(userId); | ||
| 313 | + $("#userMobile").val(mobile); | ||
| 314 | + $("#userMobile").attr("readonly","true"); | ||
| 315 | + $("#spId").val(spId); | ||
| 316 | + $("#redirect_url").val(location.pathname+location.search); | ||
| 317 | + $(".write_check input").prop("checked",false); | ||
| 318 | + if($.trim(write_business)!=''){ | ||
| 319 | + var array = write_business.split(",") | ||
| 320 | + for (var i=0;i<array.length;i++){ | ||
| 321 | + $("#write_check_"+array[i]).prop("checked",true); | ||
| 322 | + } | ||
| 323 | + } | ||
| 324 | + $('#editModal').modal('show'); | ||
| 325 | + } | ||
| 326 | + | ||
| 327 | + //添加免审用户 | ||
| 328 | + function add(){ | ||
| 329 | + $("#userId").val(""); | ||
| 330 | + $("#userMobile").val(""); | ||
| 331 | + $("#userMobile").removeAttr("readonly"); | ||
| 332 | + $("#spId").val(""); | ||
| 333 | + $(".write_check input").prop("checked",false); | ||
| 334 | + | ||
| 335 | + $("#redirect_url").val(location.pathname+location.search); | ||
| 336 | + $("#myModalLabel").text("添加免审用户"); | ||
| 337 | + $('#editModal').modal('show'); | ||
| 338 | + } | ||
| 339 | + | ||
| 340 | + | ||
| 341 | + | ||
| 342 | + //开关的点击事件 | ||
| 343 | + $(".slider").on('click',function(e){ | ||
| 344 | + var myId=$(this).prop("id"); | ||
| 345 | + // var myIndex = $(".slider").index($(this)); | ||
| 346 | + var checked=$("#id"+myId).prop("checked");//获取当前状态,下一个状态用!checked表示 | ||
| 347 | + $.post("/usersFree/updateState?id=" + myId+"&isEnable="+!checked, function (data) { | ||
| 348 | + if (data.errorCode == 0) { | ||
| 349 | + alert(data.errorMessage); | ||
| 350 | +// location.href = location.href; | ||
| 351 | + } else { | ||
| 352 | + alert(data.errorMessage); | ||
| 353 | + } | ||
| 354 | + }) | ||
| 355 | + }) | ||
| 356 | + | ||
| 357 | + //翻页函数 | ||
| 358 | + function fanye(page) { | ||
| 359 | + var param = location.search; | ||
| 360 | + if (param.indexOf("page=") != -1) { | ||
| 361 | + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连 | ||
| 362 | + var split = se.split("&"); | ||
| 363 | + var h = ""; | ||
| 364 | + for (var i = 0; i < split.length; i++) { | ||
| 365 | + var s = split[i]; | ||
| 366 | + if (s.indexOf("page=") < 0) h = h + "&" + split[i]; | ||
| 367 | + } | ||
| 368 | + h = h.substring(1, h.length); | ||
| 369 | + window.location.href = "/usersFree/page?" + h + "&page=" + page; | ||
| 370 | + } else { | ||
| 371 | + param = param.substring(1, param.length); | ||
| 372 | + window.location.href = "/usersFree/page?" + param + "&page=" + page; | ||
| 373 | + } | ||
| 374 | + } | ||
| 375 | + | ||
| 376 | + //选择每页数量触发函数 | ||
| 377 | + function selectPageSize(){ | ||
| 378 | + var pageSize=$("#pageSize").val(); | ||
| 379 | + var param = location.search; | ||
| 380 | + if (param.indexOf("pageSize=") != -1) { | ||
| 381 | + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连 | ||
| 382 | + var split = se.split("&"); | ||
| 383 | + var h = ""; | ||
| 384 | + for (var i = 0; i < split.length; i++) { | ||
| 385 | + var s = split[i]; | ||
| 386 | + if (s.indexOf("pageSize=") < 0 &&s.indexOf("page=") < 0) h = h + "&" + split[i]; | ||
| 387 | + } | ||
| 388 | + h = h.substring(1, h.length); | ||
| 389 | + window.location.href = "/usersFree/page?" + h + "&pageSize=" + pageSize; | ||
| 390 | + } else { | ||
| 391 | + var se = param.replace("?", "");//去掉问号,防止问号和要去掉的参数相连 | ||
| 392 | + var split = se.split("&"); | ||
| 393 | + var h = ""; | ||
| 394 | + for (var i = 0; i < split.length; i++) { | ||
| 395 | + var s = split[i]; | ||
| 396 | + if (s.indexOf("page=") < 0) h = h + "&" + split[i]; | ||
| 397 | + } | ||
| 398 | + h = h.substring(1, h.length); | ||
| 399 | + window.location.href = "/usersFree/page?" + h + "&pageSize=" + pageSize; | ||
| 400 | + } | ||
| 401 | + } | ||
| 402 | + | ||
| 403 | + //搜索 | ||
| 404 | + $('#users_query').click(function () { | ||
| 405 | + var userId = $("#user_id").val(); | ||
| 406 | + var mobile = $("#mobile").val(); | ||
| 407 | + var pageSize = $("#pageSize").val(); | ||
| 408 | + window.location.href = "/usersFree/page?userId=" + userId + "&mobile=" + mobile+ "&pageSize=" + pageSize; | ||
| 409 | + }); | ||
| 410 | + | ||
| 411 | + </script> | ||
| 412 | + | ||
| 413 | + <footer th:replace="../templates/common/foot::foot" ></footer> | ||
| 414 | + | ||
| 415 | + | ||
| 416 | + <!-- Add the sidebar's background. This div must be placed | ||
| 417 | + immediately after the control sidebar --> | ||
| 418 | + <div class="control-sidebar-bg" style="position: fixed; height: auto;"></div> | ||
| 419 | + | ||
| 420 | +</div><!-- ./wrapper --> | ||
| 421 | + | ||
| 422 | + | ||
| 423 | +<!-- Resolve conflict in jQuery UI tooltip with Bootstrap tooltip --> | ||
| 424 | +<script type="text/javascript"> | ||
| 425 | + $('div.alert').not('.alert-danger').delay(3000).slideUp(300); | ||
| 426 | +</script> | ||
| 427 | + | ||
| 428 | +<!-- AdminLTE App --> | ||
| 429 | +<script src="../../static/js/app.min.js"></script> | ||
| 430 | +<!-- AdminLTE for demo purposes --> | ||
| 431 | +<script src="../../static/js/sidebar.js"></script> | ||
| 432 | + | ||
| 433 | + | ||
| 434 | +</body> | ||
| 435 | +</html> | ||
| 0 | \ No newline at end of file | 436 | \ No newline at end of file |