{
<script type=”text/javascript”>
function checkall(options)
var arr=new Array();
var obj = document.getElementsByName(“getmid”);
for(var i=0;i<obj.length;i++){
if(obj[i].checked==true){
arr.push(obj[i].value);
}
}
bootbox.confirm(“确定提交操作?”, function(result) {
for(var j=0;j<arr.length;j++){
var id=arr[j];
if(result) {
$.ajax({
type: “post”,
url:”${ctx}/applyCUD?oper=checks”,
data:{id:id},
dataType:”json”,
async: false,
error: function(request) {
$.gritter.add({title: “提示!”,text: “操作失败.请刷新后重试.”,class_name: “gritter-warning”});
},
success: function(data) {
if(data==”success”){
$.gritter.add({title: “提示!”,text: “操作成功.”,class_name: “gritter-success”});
location.reload();
} }
});
}}
});
}
</script>
////////////////////////////////////后台Controller///////////////////////////////////////////
@RequestMapping(value = “/applyCUD”)
@ResponseBody
public String applyCUD(@ModelAttribute Apply apply, String oper,Model model, HttpSession session) {
if (Constant.OPER_CHECKS.equalsIgnoreCase(oper)) {
Apply _apply = applyService.get(apply.getId());
if (_apply.getApplyStatus() == 1) {
_apply.setApplyStatus(2l);
Long sysUserId = (Long) session
.getAttribute(Global.SESSION_CURRENT_USER_ID);
SysUser sysUser = sysUserService.get(sysUserId);
_apply.setSysUser(sysUser);
// 系统生成邀请码
List<Invitation> invitations = invitationService
.invitation(null, sysUserService.get(Long
.parseLong(session.getAttribute(
Global.SESSION_CURRENT_USER_ID)
.toString())), 1,-1);
try {
httpClientManager.send(_apply.getPhone(),
“感谢您对G客的关注;您的申请已获通过,您的邀请码是”
+ invitations.get(0).getCode()
+ “,请尽快注册并登录到G客APP,谢谢!”);
} catch (UnsupportedEncodingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} else if (_apply.getApplyStatus() == 2) {
_apply.setApplyStatus(1l);
}
applyService.save(_apply);
return “success”;
}
40