From 8dbd6143bf60613c802fb79663f2c6f940244349 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Sat, 30 Oct 2021 10:09:31 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=BE=AE=E4=BF=A1=E5=B0=8F?= =?UTF-8?q?=E7=A8=8B=E5=BA=8F=E7=9A=84=E7=99=BB=E9=99=86=E7=9A=84=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mini-program-test/.eslintrc.js | 31 +++++++ mini-program-test/README.md | 1 + mini-program-test/app.js | 19 ++++ mini-program-test/app.json | 14 +++ mini-program-test/app.wxss | 10 ++ mini-program-test/pages/index/index.js | 91 +++++++++++++++++++ mini-program-test/pages/index/index.json | 3 + mini-program-test/pages/index/index.wxml | 29 ++++++ mini-program-test/pages/index/index.wxss | 19 ++++ mini-program-test/pages/logs/logs.js | 18 ++++ mini-program-test/pages/logs/logs.json | 4 + mini-program-test/pages/logs/logs.wxml | 6 ++ mini-program-test/pages/logs/logs.wxss | 8 ++ mini-program-test/project.config.json | 75 +++++++++++++++ mini-program-test/sitemap.json | 7 ++ mini-program-test/utils/common.js | 3 + mini-program-test/utils/util.js | 19 ++++ .../vo/auth/SysAuthSocialUnbindReqVO.java | 2 +- .../user/SysUserProfileController.java | 7 +- .../system/convert/user/SysUserConvert.java | 2 +- .../service/auth/SysAuthServiceImplTest.java | 2 +- .../service/social/SysSocialServiceTest.java | 21 +++-- .../service/social/SysSocialService.java | 2 +- .../social/impl/SysSocialServiceImpl.java | 2 +- .../src/main/resources/application-local.yaml | 5 +- 更新日志.md | 1 + 26 files changed, 381 insertions(+), 20 deletions(-) create mode 100755 mini-program-test/.eslintrc.js create mode 100644 mini-program-test/README.md create mode 100755 mini-program-test/app.js create mode 100755 mini-program-test/app.json create mode 100755 mini-program-test/app.wxss create mode 100755 mini-program-test/pages/index/index.js create mode 100755 mini-program-test/pages/index/index.json create mode 100755 mini-program-test/pages/index/index.wxml create mode 100755 mini-program-test/pages/index/index.wxss create mode 100755 mini-program-test/pages/logs/logs.js create mode 100755 mini-program-test/pages/logs/logs.json create mode 100755 mini-program-test/pages/logs/logs.wxml create mode 100755 mini-program-test/pages/logs/logs.wxss create mode 100755 mini-program-test/project.config.json create mode 100755 mini-program-test/sitemap.json create mode 100755 mini-program-test/utils/common.js create mode 100755 mini-program-test/utils/util.js diff --git a/mini-program-test/.eslintrc.js b/mini-program-test/.eslintrc.js new file mode 100755 index 0000000000..115cc02b04 --- /dev/null +++ b/mini-program-test/.eslintrc.js @@ -0,0 +1,31 @@ +/* + * Eslint config file + * Documentation: https://eslint.org/docs/user-guide/configuring/ + * Install the Eslint extension before using this feature. + */ +module.exports = { + env: { + es6: true, + browser: true, + node: true, + }, + ecmaFeatures: { + modules: true, + }, + parserOptions: { + ecmaVersion: 2018, + sourceType: 'module', + }, + globals: { + wx: true, + App: true, + Page: true, + getCurrentPages: true, + getApp: true, + Component: true, + requirePlugin: true, + requireMiniProgram: true, + }, + // extends: 'eslint:recommended', + rules: {}, +} diff --git a/mini-program-test/README.md b/mini-program-test/README.md new file mode 100644 index 0000000000..4e5737ccbc --- /dev/null +++ b/mini-program-test/README.md @@ -0,0 +1 @@ +临时项目,作为测试微信小程序登陆之用 diff --git a/mini-program-test/app.js b/mini-program-test/app.js new file mode 100755 index 0000000000..1ed57c47fc --- /dev/null +++ b/mini-program-test/app.js @@ -0,0 +1,19 @@ +// app.js +App({ + onLaunch() { + // 展示本地存储能力 + const logs = wx.getStorageSync('logs') || [] + logs.unshift(Date.now()) + wx.setStorageSync('logs', logs) + + // 登录 + wx.login({ + success: res => { + // 发送 res.code 到后台换取 openId, sessionKey, unionId + } + }) + }, + globalData: { + userInfo: null + } +}) diff --git a/mini-program-test/app.json b/mini-program-test/app.json new file mode 100755 index 0000000000..3d7616ff47 --- /dev/null +++ b/mini-program-test/app.json @@ -0,0 +1,14 @@ +{ + "pages":[ + "pages/index/index", + "pages/logs/logs" + ], + "window":{ + "backgroundTextStyle":"light", + "navigationBarBackgroundColor": "#fff", + "navigationBarTitleText": "Weixin", + "navigationBarTextStyle":"black" + }, + "style": "v2", + "sitemapLocation": "sitemap.json" +} diff --git a/mini-program-test/app.wxss b/mini-program-test/app.wxss new file mode 100755 index 0000000000..06c6fc9ce3 --- /dev/null +++ b/mini-program-test/app.wxss @@ -0,0 +1,10 @@ +/**app.wxss**/ +.container { + height: 100%; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + padding: 200rpx 0; + box-sizing: border-box; +} diff --git a/mini-program-test/pages/index/index.js b/mini-program-test/pages/index/index.js new file mode 100755 index 0000000000..eadb684cfe --- /dev/null +++ b/mini-program-test/pages/index/index.js @@ -0,0 +1,91 @@ +// index.js + +const common=require('../../utils/common.js') +// 获取应用实例 +const app = getApp() + +Page({ + data: { + motto: 'Hello World', + userInfo: {}, + hasUserInfo: false, + canIUse: wx.canIUse('button.open-type.getUserInfo'), + canIUseGetUserProfile: false, + canIUseOpenData: wx.canIUse('open-data.type.userAvatarUrl') && wx.canIUse('open-data.type.userNickName'), // 如需尝试获取用户信息可改为false + holderText: 'to be auth' + }, + // 事件处理函数 + bindViewTap() { + wx.navigateTo({ + url: '../logs/logs' + }) + }, + onLoad() { + if (wx.getUserProfile) { + this.setData({ + canIUseGetUserProfile: true + }) + } + }, + getUserProfile(e) { + // 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个人信息均需用户确认,开发者妥善保管用户快速填写的头像昵称,避免重复弹窗 + wx.getUserProfile({ + desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写 + success: (res) => { + console.log(res) + this.setData({ + userInfo: res.userInfo, + hasUserInfo: true + }) + } + }) + }, + getUserInfo(e) { + // 不推荐使用getUserInfo获取用户信息,预计自2021年4月13日起,getUserInfo将不再弹出弹窗,并直接返回匿名的用户个人信息 + console.log(e) + this.setData({ + userInfo: e.detail.userInfo, + hasUserInfo: true + }) + }, + // 小程序登录 https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html + wxLogin(e){ + let page=this; + wx.login({ + success (res) { + console.log("res:") + console.log(res) + if (res.code) { + //发起网络请求 + console.log('发起网络请求'+common.baseurl) + wx.request({ + url: common.baseurl+'/api/social-login2', + method: "POST", + data: { + code: res.code, + state: 'empty', + type: 33, + username: '15601691300', + password: 'admin123' + }, + header: { + 'content-type': 'application/json' // 默认值 + }, + success: function(res) { + console.log(res.data) + let holder="auth success, token:"+res.data.data.token + page.setData({holderText: holder}) + }, + fail: function(data){ + console.error("请求出错"); + console.error(data) + } + + }) + } else { + console.log('登录失败!' + res.errMsg) + } + } + }) + } +}) diff --git a/mini-program-test/pages/index/index.json b/mini-program-test/pages/index/index.json new file mode 100755 index 0000000000..8835af0699 --- /dev/null +++ b/mini-program-test/pages/index/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} \ No newline at end of file diff --git a/mini-program-test/pages/index/index.wxml b/mini-program-test/pages/index/index.wxml new file mode 100755 index 0000000000..e3243c3e04 --- /dev/null +++ b/mini-program-test/pages/index/index.wxml @@ -0,0 +1,29 @@ + + + + + + + + + + + 请使用1.4.4及以上版本基础库 + + + + {{userInfo.nickName}} + + + + + + + + + 授权登录测试1024 + + + + {{holderText}} + diff --git a/mini-program-test/pages/index/index.wxss b/mini-program-test/pages/index/index.wxss new file mode 100755 index 0000000000..eb642035f7 --- /dev/null +++ b/mini-program-test/pages/index/index.wxss @@ -0,0 +1,19 @@ +/**index.wxss**/ +.userinfo { + display: flex; + flex-direction: column; + align-items: center; + color: #aaa; +} + +.userinfo-avatar { + overflow: hidden; + width: 128rpx; + height: 128rpx; + margin: 20rpx; + border-radius: 50%; +} + +.usermotto { + margin-top: 200px; +} \ No newline at end of file diff --git a/mini-program-test/pages/logs/logs.js b/mini-program-test/pages/logs/logs.js new file mode 100755 index 0000000000..85f6aac5ab --- /dev/null +++ b/mini-program-test/pages/logs/logs.js @@ -0,0 +1,18 @@ +// logs.js +const util = require('../../utils/util.js') + +Page({ + data: { + logs: [] + }, + onLoad() { + this.setData({ + logs: (wx.getStorageSync('logs') || []).map(log => { + return { + date: util.formatTime(new Date(log)), + timeStamp: log + } + }) + }) + } +}) diff --git a/mini-program-test/pages/logs/logs.json b/mini-program-test/pages/logs/logs.json new file mode 100755 index 0000000000..3ee76c183c --- /dev/null +++ b/mini-program-test/pages/logs/logs.json @@ -0,0 +1,4 @@ +{ + "navigationBarTitleText": "查看启动日志", + "usingComponents": {} +} \ No newline at end of file diff --git a/mini-program-test/pages/logs/logs.wxml b/mini-program-test/pages/logs/logs.wxml new file mode 100755 index 0000000000..0b6b6456f7 --- /dev/null +++ b/mini-program-test/pages/logs/logs.wxml @@ -0,0 +1,6 @@ + + + + {{index + 1}}. {{log.date}} + + diff --git a/mini-program-test/pages/logs/logs.wxss b/mini-program-test/pages/logs/logs.wxss new file mode 100755 index 0000000000..94d4b88a27 --- /dev/null +++ b/mini-program-test/pages/logs/logs.wxss @@ -0,0 +1,8 @@ +.log-list { + display: flex; + flex-direction: column; + padding: 40rpx; +} +.log-item { + margin: 10rpx; +} diff --git a/mini-program-test/project.config.json b/mini-program-test/project.config.json new file mode 100755 index 0000000000..2fbe955c6f --- /dev/null +++ b/mini-program-test/project.config.json @@ -0,0 +1,75 @@ +{ + "description": "项目配置文件", + "packOptions": { + "ignore": [ + { + "type": "file", + "value": ".eslintrc.js" + } + ] + }, + "setting": { + "bundle": false, + "userConfirmedBundleSwitch": false, + "urlCheck": true, + "scopeDataCheck": false, + "coverView": true, + "es6": true, + "postcss": true, + "compileHotReLoad": false, + "lazyloadPlaceholderEnable": false, + "preloadBackgroundData": false, + "minified": true, + "autoAudits": false, + "newFeature": false, + "uglifyFileName": false, + "uploadWithSourceMap": true, + "useIsolateContext": true, + "nodeModules": false, + "enhance": true, + "useMultiFrameRuntime": true, + "useApiHook": true, + "useApiHostProcess": true, + "showShadowRootInWxmlPanel": true, + "packNpmManually": false, + "enableEngineNative": false, + "packNpmRelationList": [], + "minifyWXSS": true, + "showES6CompileOption": false, + "minifyWXML": true + }, + "compileType": "miniprogram", + "libVersion": "2.19.4", + "appid": "wx44d047d87e6284d8", + "appid1": "wx63c280fe3248a3e7", + "projectname": "mini-program-test", + "debugOptions": { + "hidedInDevtools": [] + }, + "scripts": {}, + "staticServerOptions": { + "baseURL": "", + "servePath": "" + }, + "isGameTourist": false, + "condition": { + "search": { + "list": [] + }, + "conversation": { + "list": [] + }, + "game": { + "list": [] + }, + "plugin": { + "list": [] + }, + "gamePlugin": { + "list": [] + }, + "miniprogram": { + "list": [] + } + } +} \ No newline at end of file diff --git a/mini-program-test/sitemap.json b/mini-program-test/sitemap.json new file mode 100755 index 0000000000..ca02add20b --- /dev/null +++ b/mini-program-test/sitemap.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/mini-program-test/utils/common.js b/mini-program-test/utils/common.js new file mode 100755 index 0000000000..a52d725204 --- /dev/null +++ b/mini-program-test/utils/common.js @@ -0,0 +1,3 @@ +module.exports = { + baseurl: "http://127.0.0.1:28080" +} diff --git a/mini-program-test/utils/util.js b/mini-program-test/utils/util.js new file mode 100755 index 0000000000..764bc2ce26 --- /dev/null +++ b/mini-program-test/utils/util.js @@ -0,0 +1,19 @@ +const formatTime = date => { + const year = date.getFullYear() + const month = date.getMonth() + 1 + const day = date.getDate() + const hour = date.getHours() + const minute = date.getMinutes() + const second = date.getSeconds() + + return `${[year, month, day].map(formatNumber).join('/')} ${[hour, minute, second].map(formatNumber).join(':')}` +} + +const formatNumber = n => { + n = n.toString() + return n[1] ? n : `0${n}` +} + +module.exports = { + formatTime +} diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/vo/auth/SysAuthSocialUnbindReqVO.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/vo/auth/SysAuthSocialUnbindReqVO.java index 71cdc6fbb6..096164ed70 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/vo/auth/SysAuthSocialUnbindReqVO.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/auth/vo/auth/SysAuthSocialUnbindReqVO.java @@ -1,6 +1,6 @@ package cn.iocoder.yudao.adminserver.modules.system.controller.auth.vo.auth; -import cn.iocoder.yudao.adminserver.modules.system.enums.social.SysSocialTypeEnum; +import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; import cn.iocoder.yudao.framework.common.validation.InEnum; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/user/SysUserProfileController.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/user/SysUserProfileController.java index 523359b086..48236a7abf 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/user/SysUserProfileController.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/controller/user/SysUserProfileController.java @@ -8,15 +8,16 @@ import cn.iocoder.yudao.adminserver.modules.system.convert.user.SysUserConvert; import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO; import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysRoleDO; -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.social.SysSocialUserDO; import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysDeptService; import cn.iocoder.yudao.adminserver.modules.system.service.dept.SysPostService; import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService; import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysRoleService; -import cn.iocoder.yudao.adminserver.modules.system.service.social.SysSocialService; import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; +import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; +import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialService; import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; +import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil; import cn.iocoder.yudao.framework.common.pojo.CommonResult; import io.swagger.annotations.Api; @@ -77,7 +78,7 @@ public class SysUserProfileController { resp.setPosts(SysUserConvert.INSTANCE.convertList02(posts)); } // 获得社交用户信息 - List socialUsers = socialService.getSocialUserList(user.getId()); + List socialUsers = socialService.getSocialUserList(user.getId(), UserTypeEnum.ADMIN); resp.setSocialUsers(SysUserConvert.INSTANCE.convertList03(socialUsers)); return success(resp); } diff --git a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/convert/user/SysUserConvert.java b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/convert/user/SysUserConvert.java index dbe5b365fb..d25ce02add 100644 --- a/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/convert/user/SysUserConvert.java +++ b/yudao-admin-server/src/main/java/cn/iocoder/yudao/adminserver/modules/system/convert/user/SysUserConvert.java @@ -7,7 +7,7 @@ import cn.iocoder.yudao.adminserver.modules.system.controller.user.vo.user.*; import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysDeptDO; import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.dept.SysPostDO; import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.permission.SysRoleDO; -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/SysAuthServiceImplTest.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/SysAuthServiceImplTest.java index 51e59dc0aa..c09a194aa8 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/SysAuthServiceImplTest.java +++ b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/auth/SysAuthServiceImplTest.java @@ -7,11 +7,11 @@ import cn.iocoder.yudao.adminserver.modules.system.enums.logger.SysLoginResultEn import cn.iocoder.yudao.adminserver.modules.system.service.auth.impl.SysAuthServiceImpl; import cn.iocoder.yudao.adminserver.modules.system.service.common.SysCaptchaService; import cn.iocoder.yudao.adminserver.modules.system.service.permission.SysPermissionService; -import cn.iocoder.yudao.adminserver.modules.system.service.social.SysSocialService; import cn.iocoder.yudao.adminserver.modules.system.service.user.SysUserService; import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.user.SysUserDO; import cn.iocoder.yudao.coreservice.modules.system.service.auth.SysUserSessionCoreService; import cn.iocoder.yudao.coreservice.modules.system.service.logger.SysLoginLogCoreService; +import cn.iocoder.yudao.coreservice.modules.system.service.social.SysSocialService; import cn.iocoder.yudao.coreservice.modules.system.service.user.SysUserCoreService; import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; import cn.iocoder.yudao.framework.security.core.LoginUser; diff --git a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/social/SysSocialServiceTest.java b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/social/SysSocialServiceTest.java index badaf0e760..cec84c1ed6 100644 --- a/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/social/SysSocialServiceTest.java +++ b/yudao-admin-server/src/test/java/cn/iocoder/yudao/adminserver/modules/system/service/social/SysSocialServiceTest.java @@ -1,11 +1,11 @@ package cn.iocoder.yudao.adminserver.modules.system.service.social; import cn.iocoder.yudao.adminserver.BaseDbAndRedisUnitTest; -import cn.iocoder.yudao.adminserver.modules.system.dal.dataobject.social.SysSocialUserDO; -import cn.iocoder.yudao.adminserver.modules.system.dal.mysql.social.SysSocialUserMapper; -import cn.iocoder.yudao.adminserver.modules.system.dal.redis.social.SysSocialAuthUserRedisDAO; -import cn.iocoder.yudao.adminserver.modules.system.enums.social.SysSocialTypeEnum; -import cn.iocoder.yudao.adminserver.modules.system.service.social.impl.SysSocialServiceImpl; +import cn.iocoder.yudao.coreservice.modules.system.dal.dataobject.social.SysSocialUserDO; +import cn.iocoder.yudao.coreservice.modules.system.dal.mysql.social.SysSocialUserMapper; +import cn.iocoder.yudao.coreservice.modules.system.dal.redis.social.SysSocialAuthUserRedisDAO; +import cn.iocoder.yudao.coreservice.modules.system.enums.social.SysSocialTypeEnum; +import cn.iocoder.yudao.coreservice.modules.system.service.social.impl.SysSocialServiceImpl; import cn.iocoder.yudao.framework.common.enums.UserTypeEnum; import com.xkcoding.justauth.AuthRequestFactory; import me.zhyd.oauth.model.AuthUser; @@ -23,6 +23,7 @@ import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomLongId import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; import static org.junit.jupiter.api.Assertions.assertEquals; +// TODO @timfruit:这个单元测试,挪到 yudao-core-service /** * {@link SysSocialServiceImpl} 的单元测试类 * @@ -53,7 +54,7 @@ public class SysSocialServiceTest extends BaseDbAndRedisUnitTest { // mock 方法 // 调用 - socialService.bindSocialUser(userId, type, authUser); + socialService.bindSocialUser(userId, type, authUser, UserTypeEnum.ADMIN); // 断言 List socialUsers = socialUserMapper.selectList("user_id", userId); assertEquals(1, socialUsers.size()); @@ -78,7 +79,7 @@ public class SysSocialServiceTest extends BaseDbAndRedisUnitTest { // mock 方法 // 调用 - socialService.bindSocialUser(userId, type, authUser); + socialService.bindSocialUser(userId, type, authUser, UserTypeEnum.ADMIN); // 断言 List socialUsers = socialUserMapper.selectList("user_id", userId); assertEquals(1, socialUsers.size()); @@ -103,7 +104,7 @@ public class SysSocialServiceTest extends BaseDbAndRedisUnitTest { // mock 方法 // 调用 - socialService.bindSocialUser(userId, type, authUser); + socialService.bindSocialUser(userId, type, authUser, UserTypeEnum.ADMIN); // 断言 List socialUsers = socialUserMapper.selectList("user_id", userId); assertEquals(1, socialUsers.size()); @@ -140,7 +141,7 @@ public class SysSocialServiceTest extends BaseDbAndRedisUnitTest { String newUnionId = oldSocialUser.getUnionId(); // 调用 - socialService.unbindOldSocialUser(userId, type, newUnionId); + socialService.unbindOldSocialUser(userId, type, newUnionId, UserTypeEnum.ADMIN); // 断言 assertEquals(1L, socialUserMapper.selectCount(null).longValue()); } @@ -163,7 +164,7 @@ public class SysSocialServiceTest extends BaseDbAndRedisUnitTest { String newUnionId = randomString(10); // 调用 - socialService.unbindOldSocialUser(userId, type, newUnionId); + socialService.unbindOldSocialUser(userId, type, newUnionId, UserTypeEnum.ADMIN); // 断言 assertEquals(0L, socialUserMapper.selectCount(null).longValue()); } diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialService.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialService.java index ad72a57805..8a8df27d65 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialService.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/SysSocialService.java @@ -59,7 +59,7 @@ public interface SysSocialService { * @param userId 用户编号 * @return 社交用户列表 */ - List getSocialUserList(Long userId,UserTypeEnum userTypeEnum); + List getSocialUserList(Long userId, UserTypeEnum userTypeEnum); /** * 绑定社交用户 diff --git a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/impl/SysSocialServiceImpl.java b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/impl/SysSocialServiceImpl.java index d1419c44f8..bde40c3c4c 100644 --- a/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/impl/SysSocialServiceImpl.java +++ b/yudao-core-service/src/main/java/cn/iocoder/yudao/coreservice/modules/system/service/social/impl/SysSocialServiceImpl.java @@ -87,7 +87,7 @@ public class SysSocialServiceImpl implements SysSocialService { @Override @Transactional - public void bindSocialUser(Long userId, Integer type, AuthUser authUser,UserTypeEnum userTypeEnum) { + public void bindSocialUser(Long userId, Integer type, AuthUser authUser, UserTypeEnum userTypeEnum) { // 获得 unionId 对应的 SysSocialUserDO 列表 String unionId = getAuthUserUnionId(authUser); List socialUsers = this.getAllSocialUserList(type, unionId, userTypeEnum); diff --git a/yudao-user-server/src/main/resources/application-local.yaml b/yudao-user-server/src/main/resources/application-local.yaml index 1e904c3ee8..c39a7cb1b5 100644 --- a/yudao-user-server/src/main/resources/application-local.yaml +++ b/yudao-user-server/src/main/resources/application-local.yaml @@ -156,7 +156,6 @@ yudao: pay-notify-url: http://niubi.natapp1.cc/api/pay/order/notify refund-notify-url: http://niubi.natapp1.cc/api/pay/refund/notify - justauth: enabled: true type: @@ -169,10 +168,12 @@ justauth: extend: enum-class: cn.iocoder.yudao.coreservice.modules.system.compent.justauth.AuthExtendSource config: - WECHAT_MINI_PROGRAM: # 微信小程序 扩展 + WECHAT_MINI_PROGRAM: # 微信小程序 https://www.yuque.com/docs/share/88e3d30a-6830-45fc-8c25-dae485aef3aa?#%20%E3%80%8A%E5%B0%8F%E7%A8%8B%E5%BA%8F%E6%8E%88%E6%9D%83%E7%99%BB%E5%BD%95%E3%80%8B request-class: cn.iocoder.yudao.coreservice.modules.system.compent.justauth.AuthWeChatMiniProgramRequest client-id: wx44d047d87e6284d8 client-secret: 21c3b7a8a51ee1b8f5cf875848ed4466 +# client-id: wx63c280fe3248a3e7 # TODO 芋艿:自己的测试,后续可以删除 +# client-secret: 6f270509224a7ae1296bbf1c8cb97aed ignore-check-redirect-uri: true ignore-check-state: true cache: diff --git a/更新日志.md b/更新日志.md index f66a804cda..cd0c940069 100644 --- a/更新日志.md +++ b/更新日志.md @@ -15,6 +15,7 @@ TODO * 支付 * 用户前台的社交登陆 +* 用户前台的修改手机、修改密码、忘记密码 ## [v1.1.0] 2021.10.25