NutzCN Logo
问答 uploadifive上传提示成功但是,路径没写入数据库
发布于 1777天前 作者 wx_o374j2qp4gae3dbu5kbe 1488 次浏览 复制 上一个帖子 下一个帖子
标签:

求大神解决我这个显示修改成功,但是图片路径没写入库,别的都能正常更新,就图片不能更新

[DEBUG] 2020-01-10 12:22:36,683 org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3877) - ClusterManager: Check-in complete.
[DEBUG] 2020-01-10 12:22:40,764 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/open/file/upload/image : UploadController.image(UploadController.java:38)
[DEBUG] 2020-01-10 12:22:40,764 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'uploadController'<class cn.wizzer.app.web.modules.controllers.open.file.UploadController>
[DEBUG] 2020-01-10 12:22:40,765 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:192) - 	 >> Load definition name=uploadController
[DEBUG] 2020-01-10 12:22:40,765 org.nutz.ioc.loader.combo.ComboIocLoader.printFoundIocBean(ComboIocLoader.java:226) - Found IocObject(uploadController) in AnnotationIocLoader(packages=[cn.wizzer])
[DEBUG] 2020-01-10 12:22:40,765 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:223) - 	 >> Make...'uploadController'<class cn.wizzer.app.web.modules.controllers.open.file.UploadController>
[DEBUG] 2020-01-10 12:22:40,765 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:65) - Save object 'uploadController' to [app] 
[DEBUG] 2020-01-10 12:22:40,766 cn.wizzer.app.web.commons.plugin.PluginAopConfigure.getInterceptorPairList(PluginAopConfigure.java:33) - skip -- cn.wizzer.app.web.modules.controllers.open.file.UploadController
[DEBUG] 2020-01-10 12:22:40,766 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:76) - Load class cn.wizzer.app.web.modules.controllers.open.file.UploadController without AOP
[DEBUG] 2020-01-10 12:22:40,847 org.nutz.mvc.upload.UploadAdaptor.getReferObject(UploadAdaptor.java:184) - Select Html4 Form upload parser --> /open/file/upload/image
[DEBUG] 2020-01-10 12:22:40,874 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:39) - FastUpload : /open/file/upload/image
[DEBUG] 2020-01-10 12:22:40,922 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:54) - info created
[DEBUG] 2020-01-10 12:22:40,923 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:60) - Params map created - 0 params
[DEBUG] 2020-01-10 12:22:40,998 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:77) - boundary: 
------WebKitFormBoundaryta2CGoxkXsWd1xjf
[DEBUG] 2020-01-10 12:22:41,021 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:100) - skip first boundary
[DEBUG] 2020-01-10 12:22:41,022 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:111) - Reading...
[DEBUG] 2020-01-10 12:22:41,028 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:133) - Upload File info: FilePath=[TIM截图20200110121134.png],fieldName=[Filedata]
[DEBUG] 2020-01-10 12:22:41,044 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:137) - Upload Info: name=TIM截图20200110121134.png,content_type=image/png
[DEBUG] 2020-01-10 12:22:41,145 org.nutz.mvc.upload.FastUploading.parse(FastUploading.java:231) - ...Done 21706 bytes readed
[DEBUG] 2020-01-10 12:22:41,680 cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [POST]URI=/open/file/upload/image 915ms
[DEBUG] 2020-01-10 12:22:44,886 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/platform/cust/user/editDo : CustUserController.editDo(CustUserController.java:154)
[DEBUG] 2020-01-10 12:22:44,887 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'custUserController'<class cn.wizzer.app.web.modules.controllers.platform.cust.CustUserController>
[DEBUG] 2020-01-10 12:22:44,897 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - UPDATE cust_user SET opBy=?,opAt=?  WHERE id=?
    |                                1 |          2 |    3 |
    |----------------------------------|------------|------|
    | b1fa9dd0a6074aa588942082e479fcab | 1578630164 | NULL |
  For example:> "UPDATE cust_user SET opBy='b1fa9dd0a6074aa588942082e479fcab',opAt=1578630164  WHERE id=NULL"
[DEBUG] 2020-01-10 12:22:44,907 cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [POST]URI=/platform/cust/user/editDo 21ms
[DEBUG] 2020-01-10 12:22:46,033 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [GET] path=/platform/cust/user : CustUserController.index(CustUserController.java:49)
[DEBUG] 2020-01-10 12:22:46,034 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'custUserController'<class cn.wizzer.app.web.modules.controllers.platform.cust.CustUserController>
[DEBUG] 2020-01-10 12:22:46,037 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_dict  WHERE parentId=?
    |                                1 |
    |----------------------------------|
    | 5f126495584b4b7db788a3ae8b31fef8 |
  For example:> "SELECT * FROM sys_dict  WHERE parentId='5f126495584b4b7db788a3ae8b31fef8'"
[DEBUG] 2020-01-10 12:22:46,042 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM sys_dict  WHERE parentId=?
    |                                1 |
    |----------------------------------|
    | d7e954bfba514b65a955f8774f993a5f |
  For example:> "SELECT * FROM sys_dict  WHERE parentId='d7e954bfba514b65a955f8774f993a5f'"
[DEBUG] 2020-01-10 12:22:46,056 cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [GET ]URI=/platform/cust/user 22ms
[DEBUG] 2020-01-10 12:22:46,357 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) - Found mapping for [POST] path=/platform/cust/user/data : CustUserController.data(CustUserController.java:68)
[DEBUG] 2020-01-10 12:22:46,359 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:166) - Get 'custUserController'<class cn.wizzer.app.web.modules.controllers.platform.cust.CustUserController>
user.isData() ========================== false ==========================
[DEBUG] 2020-01-10 12:22:46,373 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT COUNT(*) FROM cust_user  WHERE opName LIKE ?
    |                                  1 |
    |------------------------------------|
    | %b1fa9dd0a6074aa588942082e479fcab% |
  For example:> "SELECT COUNT(*) FROM cust_user  WHERE opName LIKE '%b1fa9dd0a6074aa588942082e479fcab%'"
[DEBUG] 2020-01-10 12:22:46,382 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) - SELECT * FROM cust_user  WHERE opName LIKE ? ORDER BY username DESC   LIMIT 0, 10 
    |                                  1 |
    |------------------------------------|
    | %b1fa9dd0a6074aa588942082e479fcab% |
  For example:> "SELECT * FROM cust_user  WHERE opName LIKE '%b1fa9dd0a6074aa588942082e479fcab%' ORDER BY username DESC   LIMIT 0, 10 "
[DEBUG] 2020-01-10 12:22:46,389 cn.wizzer.app.web.commons.processor.LogTimeProcessor.process(LogTimeProcessor.java:26) - [POST]URI=/platform/cust/user/data 32ms

    $(document).ready(function () {
        $('#file_upload').uploadifive({
            'auto': true,
            'multi': false,
            'width': '100%',
            'height': '35',
            'buttonText': '请选择图片',
            'fileType': 'image/jpg,image/jpeg,image/png',
            'fileSizeLimit': 1024,
            'queueSizeLimit': 1,
            'formData': {},
            'queueID': 'queue',
            'uploadScript': '${base}/open/file/upload/image',
            'onUploadComplete': function (file, data) {
                data = JSON.parse(data);
                if (data.code == 0) {
                    Toast.success(data.msg);
                    $("#img").html("<img src='" + data.data + "' style='width:150px;height:95px;'>");
                    $("#picurl").val(data.data);
                } else {
                    clearFile();
                    Toast.error(data.msg);
                }
            },
            'onDrop': function (file, fileDropCount) {
                clearFile();
            },
            'onClearQueue': function (queue) {
                clearFile();
            },
            'onCancel': function () {
                clearFile();
            }
        });
        $('#editForm').ajaxForm({
            dataType: 'json',
            beforeSubmit: function (arr, form, options) {
                form.find("button:submit").button("loading");
            },
            success: function (data, statusText, xhr, form) {
                if (data.code == 0) {
                    Toast.success(data.msg);
                    setTimeout(function () {
                        $("#goBack").trigger("click");
                    }, 1000);
                } else {
                    Toast.error(data.msg);
                }
                form.find("button:submit").button("reset");
            }
        });
    });
    @At("/editDo")
    @Ok("json")
    @RequiresPermissions("platform.cust.user.edit")
    public Object editDo(@Param("..")Cust_user custUser, HttpServletRequest req) {
		try {
            custUser.setOpBy(StringUtil.getUid());
			custUser.setOpAt((int) (System.currentTimeMillis() / 1000));
			custUserService.updateIgnoreNull(custUser);
			return Result.success("system.success");
		} catch (Exception e) {
			return Result.error("system.error");
		}
    }

5 回复
"UPDATE cust_user SET opBy='b1fa9dd0a6074aa588942082e479fcab',opAt=1578630164  WHERE id=NULL"

大神指点一下,没看明白,不知道为什么更新图片id是空的。但是更新别的就没事

custUser 的id为null?

为啥只有更新图片才会报id为null,死活不知道为啥。更新别的就没事

这是更新当前用户的头像?从session取用户id呀m没,怎么能从请求参数取

另外,既然从请求参数取,文件上传走的逻辑与普通表单的逻辑可是不一样的,目测前端没处理好,只发了文件,没带其他参数,包括id

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