Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
youjj
cloud-platform
Commits
7bf449e9
Commit
7bf449e9
authored
Jul 16, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加code
parent
63c74fec
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
45 additions
and
15 deletions
+45
-15
AppUserDetail.java
...m/github/wxiaoqi/security/admin/entity/AppUserDetail.java
+1
-1
AppUserDetailBiz.java
...m/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
+16
-0
AppUserRelationBiz.java
...github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
+5
-5
AppUserRest.java
...va/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
+6
-4
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+17
-5
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppUserDetail.java
View file @
7bf449e9
...
@@ -73,5 +73,5 @@ public class AppUserDetail {
...
@@ -73,5 +73,5 @@ public class AppUserDetail {
@ApiModelProperty
(
value
=
"邀请人账号:"
)
@ApiModelProperty
(
value
=
"邀请人账号:"
)
@Column
(
name
=
"inviter_account"
)
@Column
(
name
=
"inviter_account"
)
private
String
inviterAccount
;
private
Integer
inviterAccount
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
View file @
7bf449e9
...
@@ -53,6 +53,22 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
...
@@ -53,6 +53,22 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
return
null
;
return
null
;
}
}
/**
* 根据用户id获取父id
*
* @param code
* @return
*/
public
Integer
getUserByCode
(
String
code
)
{
Example
example
=
new
Example
(
AppUserDetail
.
class
);
example
.
createCriteria
().
andEqualTo
(
"code"
,
code
).
andEqualTo
(
"isdel"
,
0
);
List
<
AppUserDetail
>
list
=
mapper
.
selectByExample
(
example
);
if
(
list
!=
null
&&
list
.
size
()
!=
0
)
{
return
list
.
get
(
0
).
getUserid
();
}
return
0
;
}
/**
/**
* 获取用户信息
* 获取用户信息
*
*
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
View file @
7bf449e9
...
@@ -37,7 +37,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
...
@@ -37,7 +37,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
* @param userId
* @param userId
* @param parentId
* @param parentId
*/
*/
public
void
bindRelation
(
Integer
userId
,
Integer
parentId
){
public
void
bindRelation
(
Integer
userId
,
Integer
parentId
,
Integer
type
){
AppUserRelation
relation
=
getMyBiz
().
getRelationByUserId
(
parentId
);
AppUserRelation
relation
=
getMyBiz
().
getRelationByUserId
(
parentId
);
if
(
relation
==
null
){
if
(
relation
==
null
){
relation
=
new
AppUserRelation
();
relation
=
new
AppUserRelation
();
...
@@ -50,13 +50,13 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
...
@@ -50,13 +50,13 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
relation
=
new
AppUserRelation
();
relation
=
new
AppUserRelation
();
relation
.
setUserId
(
userId
);
relation
.
setUserId
(
userId
);
relation
.
setParentId
(
parentId
);
relation
.
setParentId
(
parentId
);
relation
.
setBindType
(
2
);
relation
.
setBindType
(
type
);
relation
.
setBindTime
(
time
);
relation
.
setBindTime
(
time
);
insertSelective
(
relation
);
insertSelective
(
relation
);
}
else
{
}
else
{
if
(
relation
.
getParentId
()==
null
||
relation
.
getParentId
()==
0
||(
relation
.
getIsForever
()!=
1
&&(
time
-
relation
.
getBindTime
())>
3600
)){
if
(
relation
.
getParentId
()==
null
||
relation
.
getParentId
()==
0
||(
relation
.
getIsForever
()!=
1
&&(
time
-
relation
.
getBindTime
())>
3600
)){
relation
.
setParentId
(
parentId
);
relation
.
setParentId
(
parentId
);
relation
.
setBindType
(
2
);
relation
.
setBindType
(
type
);
relation
.
setBindTime
(
time
);
relation
.
setBindTime
(
time
);
getMyBiz
().
updRelation
(
relation
);
getMyBiz
().
updRelation
(
relation
);
}
}
...
@@ -80,7 +80,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
...
@@ -80,7 +80,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
if
(
userVo
==
null
){
if
(
userVo
==
null
){
upRelationTemp
(
pid
,
userid
);
upRelationTemp
(
pid
,
userid
);
}
else
{
}
else
{
bindRelation
(
platform_userid
,
pid
);
bindRelation
(
platform_userid
,
pid
,
2
);
}
}
}
}
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
...
@@ -125,7 +125,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
...
@@ -125,7 +125,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
return
;
return
;
}
}
Integer
parentId
=
relationTemp
.
getUserId
();
Integer
parentId
=
relationTemp
.
getUserId
();
bindRelation
(
platform_userid
,
parentId
);
bindRelation
(
platform_userid
,
parentId
,
2
);
}
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
View file @
7bf449e9
...
@@ -84,12 +84,13 @@ public class AppUserRest {
...
@@ -84,12 +84,13 @@ public class AppUserRest {
JSONObject
register
(
JSONObject
register
(
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecode
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecode
,
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
,
@RequestParam
(
value
=
"code"
,
defaultValue
=
""
)
String
code
){
){
//默认昵称
//默认昵称
String
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
String
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
return
appPermissionService
.
register
(
username
,
password
,
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
nickname
,
return
appPermissionService
.
register
(
username
,
password
,
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
nickname
,
mobilecode
,
null
,
null
,
0
);
mobilecode
,
null
,
null
,
0
,
code
);
}
}
...
@@ -116,7 +117,8 @@ public class AppUserRest {
...
@@ -116,7 +117,8 @@ public class AppUserRest {
@RequestParam
(
value
=
"openid"
,
defaultValue
=
""
)
String
openid
,
@RequestParam
(
value
=
"openid"
,
defaultValue
=
""
)
String
openid
,
@RequestParam
(
value
=
"unionid"
,
defaultValue
=
""
)
String
unionid
,
@RequestParam
(
value
=
"unionid"
,
defaultValue
=
""
)
String
unionid
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"0"
)
Integer
type
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"0"
)
Integer
type
,
@RequestParam
(
value
=
"isQQ"
,
defaultValue
=
"0"
)
Integer
isQQ
@RequestParam
(
value
=
"isQQ"
,
defaultValue
=
"0"
)
Integer
isQQ
,
@RequestParam
(
value
=
"code"
,
defaultValue
=
""
)
String
code
){
){
if
(
StringUtils
.
isBlank
(
headimgurl
)){
if
(
StringUtils
.
isBlank
(
headimgurl
)){
headimgurl
=
SystemConfig
.
USER_HEADER_URL_DEFAULT
;
headimgurl
=
SystemConfig
.
USER_HEADER_URL_DEFAULT
;
...
@@ -124,7 +126,7 @@ public class AppUserRest {
...
@@ -124,7 +126,7 @@ public class AppUserRest {
if
(
StringUtils
.
isBlank
(
nickname
)){
if
(
StringUtils
.
isBlank
(
nickname
)){
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
}
}
return
appPermissionService
.
weCahtRegister
(
username
,
password
,
openid
,
unionid
,
nickname
,
headimgurl
,
type
,
mobilecode
,
isQQ
);
return
appPermissionService
.
weCahtRegister
(
username
,
password
,
openid
,
unionid
,
nickname
,
headimgurl
,
type
,
mobilecode
,
isQQ
,
code
);
}
}
/**
/**
* 手机号码检测是否已绑定
* 手机号码检测是否已绑定
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
7bf449e9
...
@@ -204,7 +204,7 @@ public class AppPermissionService {
...
@@ -204,7 +204,7 @@ public class AppPermissionService {
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JSONObject
register
(
String
username
,
String
password
,
String
headimgurl
,
public
JSONObject
register
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
)
{
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
,
String
code
)
{
// 判断参数和验证码
// 判断参数和验证码
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
...
@@ -257,12 +257,22 @@ public class AppPermissionService {
...
@@ -257,12 +257,22 @@ public class AppPermissionService {
rsUserDetail
.
setIsdel
(
0
);
rsUserDetail
.
setIsdel
(
0
);
rsUserDetail
.
setCrtHost
(
getIp
());
rsUserDetail
.
setCrtHost
(
getIp
());
setCreateIPInfo
(
rsUserDetail
);
setCreateIPInfo
(
rsUserDetail
);
//邀请人id关系绑定
Integer
parentId
=
0
;
if
(
StringUtils
.
isNotBlank
(
code
)){
parentId
=
appUserDetailBiz
.
getUserByCode
(
code
);
}
if
(
parentId
!=
null
&&
parentId
>
0
){
rsUserDetail
.
setInviterAccount
(
parentId
);
}
//生成邀请码 长度改为8 不然重复率太高
//生成邀请码 长度改为8 不然重复率太高
rsUserDetail
.
setCode
(
UUIDUtils
.
genCodes
(
8
));
rsUserDetail
.
setCode
(
UUIDUtils
.
genCodes
(
8
));
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//临时会员绑定
//绑定上下线关系
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
if
(
parentId
!=
null
&&
parentId
>
0
){
relationBiz
.
bindRelation
(
userid
,
parentId
,
1
);
}
//参加新人活动
//参加新人活动
jionActivity
(
userid
);
jionActivity
(
userid
);
//创建钱包
//创建钱包
...
@@ -324,6 +334,7 @@ public class AppPermissionService {
...
@@ -324,6 +334,7 @@ public class AppPermissionService {
data
.
put
(
"username"
,
StringUtils
.
isNotEmpty
(
username
)
?
username
:
userVo
.
getUsername
());
data
.
put
(
"username"
,
StringUtils
.
isNotEmpty
(
username
)
?
username
:
userVo
.
getUsername
());
data
.
put
(
"userId"
,
userid
);
data
.
put
(
"userId"
,
userid
);
data
.
put
(
"imUserId"
,
userVo
.
getImUserid
());
data
.
put
(
"imUserId"
,
userVo
.
getImUserid
());
data
.
put
(
"code"
,
userVo
.
getCode
());
//更新登录时间 和 ip
//更新登录时间 和 ip
String
clientIp
=
getIp
();
String
clientIp
=
getIp
();
appUserLoginBiz
.
updateLoginInfo
(
userid
,
clientIp
);
appUserLoginBiz
.
updateLoginInfo
(
userid
,
clientIp
);
...
@@ -353,7 +364,7 @@ public class AppPermissionService {
...
@@ -353,7 +364,7 @@ public class AppPermissionService {
*/
*/
@Transactional
@Transactional
public
JSONObject
weCahtRegister
(
String
username
,
String
password
,
String
openId
,
public
JSONObject
weCahtRegister
(
String
username
,
String
password
,
String
openId
,
String
unionid
,
String
nickname
,
String
headimgurl
,
int
type
,
String
mobilecode
,
Integer
isQQ
)
{
String
unionid
,
String
nickname
,
String
headimgurl
,
int
type
,
String
mobilecode
,
Integer
isQQ
,
String
code
)
{
// 校验参数和验证码
// 校验参数和验证码
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
...
@@ -435,7 +446,7 @@ public class AppPermissionService {
...
@@ -435,7 +446,7 @@ public class AppPermissionService {
}
}
}
else
if
(
type
==
2
)
{
// 新增
}
else
if
(
type
==
2
)
{
// 新增
JSONObject
register
=
register
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
JSONObject
register
=
register
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
openId
,
unionid
,
isQQ
);
openId
,
unionid
,
isQQ
,
code
);
if
(
register
.
getInteger
(
"status"
)
!=
ResultCode
.
SUCCESS_CODE
)
{
if
(
register
.
getInteger
(
"status"
)
!=
ResultCode
.
SUCCESS_CODE
)
{
if
(
register
.
getInteger
(
"status"
)
==
ResultCode
.
EXIST_CODE
)
{
if
(
register
.
getInteger
(
"status"
)
==
ResultCode
.
EXIST_CODE
)
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXIST_CODE
,
"用户已存在"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXIST_CODE
,
"用户已存在"
);
...
@@ -959,4 +970,5 @@ public class AppPermissionService {
...
@@ -959,4 +970,5 @@ public class AppPermissionService {
public
static
final
String
BASE_DATA
=
"data"
;
public
static
final
String
BASE_DATA
=
"data"
;
public
static
final
String
CITY_NAME
=
"city"
;
public
static
final
String
CITY_NAME
=
"city"
;
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment