========todo=======
1.与微信号绑定
2.项目上线前应该在shopManagementController中的getShopList方法中注释掉测试时用的硬编码的username和id
但是暂时如果注释掉会出错
相关模块:
localAuth相关类及personInfo相关类
-
知识点
1. MD5加密:参考https://blog.csdn.net/javaxingzhe/article/details/90722875
-
遇到的问题:
- 在测试LocalAuth的插入时,报错:
org.springframework.dao.DataIntegrityViolationException:
### Error updating database. Cause: java.sql.SQLException: Field 'user_id' doesn't have a default value
### The error may involve com.sxd.o2o.dao.ILocalAuthDao.insertUserAuth-Inline
### The error occurred while setting parameters
### SQL: INSERT INTO tb_local_auth(username,password,create_time,last_edit_time) VALUES (?,?,?,?)
### Cause: java.sql.SQLException: Field 'user_id' doesn't have a default value
; SQL []; Field 'user_id' doesn't have a default value; nested exception is java.sql.SQLException: Field 'user_id' doesn't have a default value
解决:在localAuthdao.xml的insert方法中没有写user_id字段。
<insert id="insertUserAuth" parameterType="com.sxd.o2o.bean.LocalAuth"
useGeneratedKeys="true" keyProperty="localAuthId" keyColumn="local_auth_id">
INSERT INTO
tb_local_auth(username,password,user_id,create_time,last_edit_time)
VALUES
(#{username},#{password},#{personInfo.userId},#{createTime},#{lastEditTime})
</insert>
2. test localAuthService时,一直提示空指针异常(LocalAuthService注入失败)
解决:test类没有继承baseTest
3. 前端输入密码时,是显式的而不是隐藏的点:
解决:<input type="password" ......>
4. 登录页面中的username读取不到(debug的时候发现是null)
解决:在js文件中,data中的名称必须和controller中的key的名称一样
在这里,我们在js中的data中(这个就是json串的key)写的是username,而在localAuthController中的logincheck中的key是userName(大小写不同),改成一样的即可。