NutzCN Logo
问答 update更新返回值报错
发布于 10天前 作者 tomcat 51 次浏览 复制 上一个帖子 下一个帖子
标签: nutzwk

log

[DEBUG] 2017-08-11 17:13:23,546 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_member_user  WHERE id=? LIMIT 0, 1 
    |                                1 |
    |----------------------------------|
    | 67dd6805293a41c898978286bc9f78ee |
  For example:> "SELECT * FROM sys_member_user  WHERE id='67dd6805293a41c898978286bc9f78ee' LIMIT 0, 1 "
[DEBUG] 2017-08-11 17:13:26,351 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3877) - ClusterManager: Check-in complete.
[DEBUG] 2017-08-11 17:13:27,766 cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [POST]URI=/nutzwk/platform/app/user/updatePwd/67dd6805293a41c898978286bc9f78ee 16494ms
[WARN ] 2017-08-11 17:13:27,767 org.nutz.mvc.impl.processor.FailProcessor.process(FailProcessor.java:28) - Error@/platform/app/user/updatePwd/67dd6805293a41c898978286bc9f78ee :
org.nutz.lang.InvokingException: Don't know how to invoke [java.lang.String].getAttribute() by args:
 loginname
	at org.nutz.lang.Invoking.<init>(Invoking.java:159)
	at org.nutz.lang.Mirror.getInvoking(Mirror.java:1023)
	at org.nutz.lang.Mirror.invoke(Mirror.java:1100)
	at org.nutz.el.opt.object.AccessOpt.run(AccessOpt.java:71)
	at org.nutz.el.opt.object.MethodOpt.calculate(MethodOpt.java:48)
	at org.nutz.el.opt.object.InvokeMethodOpt.calculate(InvokeMethodOpt.java:22)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:55)
	at org.nutz.el.arithmetic.RPN.calculate(RPN.java:38)
	at org.nutz.el.El.eval(El.java:33)
	at cn.wizzer.app.web.commons.slog.SLogAopInterceptor.doLog(SLogAopInterceptor.java:81)
	at cn.wizzer.app.web.commons.slog.SLogAopInterceptor.filter(SLogAopInterceptor.java:63)
	at org.nutz.aop.InterceptorChain.doChain(InterceptorChain.java:60)
	at cn.wizzer.app.web.modules.controllers.platform.app.AppUserController$$NUTZAOP.updatePwd(AppUserController.java:1)
	at cn.wizzer.app.web.modules.controllers.platform.app.AppUserController$FM$updatePwd$c73ab321662a1a6ff4ab3fea2c1256f3.invoke(AppUserController.java)
	at org.nutz.mvc.impl.processor.MethodInvokeProcessor.process(MethodInvokeProcessor.java:31)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.AdaptorProcessor.process(AdaptorProcessor.java:33)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:58)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.XssSqlFilterProcessor.process(XssSqlFilterProcessor.java:35)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.NutShiroProcessor.process(NutShiroProcessor.java:52)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.GlobalsSettingProcessor.process(GlobalsSettingProcessor.java:36)
	at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44)
	at cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:21)
	at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44)
	at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:67)
	at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31)
	at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:202)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at cn.wizzer.app.web.commons.filter.RouteFilter.doFilter(RouteFilter.java:31)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
	at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
	at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
	at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
	at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
	at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
	at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
	at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
	at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:94)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:504)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
	at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1533)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1489)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:748)

代码

@At("/updatePwd/?")
	@Ok("json")
	@RequiresPermissions("app.user.list")
	@SLog(tag = "更新用户密码", msg = "用户名:${args[1].getAttribute('loginname')}")
	public Object updatePwd(String userId,String pwd,String newpwd, HttpServletRequest req) {
		try {
			String loginname = AppUserService.fetch(userId).getName();
			if ("superadmin".equals(loginname)) {
				return Result.error("system.not.allow");
			}
			if (CheckUtils.isNotBlank(pwd, newpwd)) {
				pwd = Util.GetMD5Code(pwd);
				AppUser api = AppUserService.fetch(Cnd.where("id", "=", userId));
				if (CheckUtils.isNotBlank(api)) {
					if (pwd.equals(api.getPwd())) {
						req.setAttribute("loginname", AppUserService.fetch(userId).getName());
						System.out.println(req.getAttribute("loginname"));
						newpwd = Util.GetMD5Code(newpwd);
						AppUserService.update(Chain.make("pwd", newpwd), Cnd.where("id", "=", userId));
					} else {
						return Result.error("system.pwd.notnewpwd");
					}
				}
			} else {
				return Result.error("system.pwd.null");
			}
			System.out.println(Result.success("system.success"));
			return Result.success("system.success");
		} catch (Exception e) {
			return Result.error("system.error");
		}
	}

syetem.properties

system.pwd.null=新密码与旧密码不能为空
system.pwd.notnewpwd=新密码与旧密码不一致

js

<script language="JavaScript">
$("#save").on('click', function () {
	var pwd = $("#pwd").val();
	var newpwd = $("#newpwd").val();
	$.post("${base}/platform/app/user/updatePwd/${obj.id}", {pwd:pwd,newpwd:newpwd}, function (data) {
		alert(data);
		alert(data.code);
		alert(data.msg);
         if (data.code == 0) {
        	 Toast.success(data.msg);
        	 var el=document.getElementById('retrun');
     		el.click();
        } else {
            Toast.error(data.msg);
        }
		
    }, "json"); 
});
</script>
2 回复

是你的@Slog里面的表达式错误

@admin 谢谢大佬! 已解决

添加回复
请先登陆
回到顶部