切换导航条
此项目
正在载入...
登录
李涵
/
integral
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
lihan
6 years ago
提交
db3a8950bf37c4036b52ef234688c6ba457df6e0
1 个父辈
cdc10dfc
1 个管道 的构建
通过
耗费 8 秒
赠送积分和角色管理
变更
4
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
4 个修改的文件
包含
708 行增加
和
19 行删除
app/friendship/controller/FriendController.php
public/themes/simpleboot3/friendship/friend_give_log.html
public/themes/simpleboot3/friendship/friend_list.html
public/themes/simpleboot3/user/center/my_balance.html
app/friendship/controller/FriendController.php
查看文件 @
db3a895
...
...
@@ -22,33 +22,144 @@ class FriendController extends HomeBaseController
->
join
(
'user u'
,
'u.id=f.uid'
)
->
where
([
'f.uid'
=>
session
(
'user.id'
)])
->
select
()
->
toArray
();
return
$this
->
fetch
(
':friend_give_log'
,
[
'list'
=>
$data
]);
}
//单纯加好友操作
public
function
addFriend
()
//好友列表(只允许搜索到非代理员)
public
function
friendList
()
{
$request
=
request
();
$list
=
[];
if
(
$request
->
isPost
())
{
$keyword
=
$request
->
param
(
'keyword'
);
if
(
!
empty
(
$keyword
))
{
$where
[
'mobile'
]
=
[
'like'
,
"%
$keyword
%"
];
$list
=
Db
::
name
(
'user'
)
->
field
(
'id as friend_id,avatar,user_nickname'
)
->
where
(
$where
)
->
select
()
->
toArray
();
}
}
if
(
!
empty
(
$list
))
{
return
$this
->
fetch
(
':friend_list'
,
[
'list'
=>
$list
]);
}
else
{
$this
->
error
(
'查无此人'
);
}
}
//赠送积分
public
function
donateIntegral
()
{
$request
=
request
();
if
(
$request
->
isAjax
())
{
$ship
=
[
'uid'
=>
session
(
'user.id'
),
'friend_id'
=>
$request
->
param
(
'friend_id'
),
];
//判断两人是否已经是好友
if
(
Db
::
name
(
'friendship'
)
->
where
(
$ship
)
->
count
())
{
$this
->
success
(
'您已添加过该好友'
,
''
,
false
);
Db
::
startTrans
();
$uid
=
session
(
'user.id'
);
$total
=
$request
->
param
(
'total'
);
//获取赠送者角色、父级和当前积分
$info
=
Db
::
name
(
'user'
)
->
field
(
'role,parent_id,balance'
)
->
where
([
'id'
=>
$uid
])
->
find
();
//判断此人积分是否足够赠送,且是否能被500整除
if
(
$info
[
'balance'
]
<
$total
)
{
echo
json_encode
([
'msg'
=>
'您的积分不足'
,
'status'
=>
false
]);
exit
();
}
else
{
if
(
Db
::
name
(
'friendship'
)
->
insert
(
$ship
))
{
$this
->
success
(
'添加好友成功'
,
''
,
true
);
if
(
$total
%
500
!=
0
)
{
echo
json_encode
([
'msg'
=>
'赠送积分必须是500积分的整数倍'
,
'status'
=>
false
]);
exit
();
}
else
{
$this
->
success
(
'添加好友失败'
,
''
,
false
);
$parent_id
=
(
$info
[
'role'
]
==
2
)
?
$uid
:
$info
[
'parent_id'
];
$tag
=
true
;
$friend_id
=
$request
->
param
(
'friend_id'
);
$friend_parent_id
=
Db
::
name
(
'user'
)
->
where
([
'id'
=>
$friend_id
])
->
value
(
'parent_id'
);
//如果此人有父级id或本身就是代理员,检测被分享人是否有父级id,若没有则绑定关系
if
(
!
empty
(
$parent_id
))
{
if
(
empty
(
$friend_parent_id
))
{
$bind
=
[
'id'
=>
$friend_id
,
'parent_id'
=>
$parent_id
];
if
(
Db
::
name
(
'user'
)
->
update
(
$bind
))
{
$tag
=
true
;
}
else
{
$tag
=
false
;
}
}
}
//判断两人是否首次赠送
if
(
$tag
)
{
$ship
=
[
'uid'
=>
$uid
,
'friend_id'
=>
$friend_id
,
];
//非首次赠送,积分叠加
if
(
Db
::
name
(
'friendship'
)
->
where
(
$ship
)
->
count
())
{
if
(
Db
::
name
(
'friendship'
)
->
where
(
$ship
)
->
setInc
(
'total'
,
$total
))
{
$tag
=
true
;
}
else
{
$tag
=
false
;
}
}
//首次赠送,插入好友表
else
{
$ship
[
'total'
]
=
$total
;
if
(
Db
::
name
(
'friendship'
)
->
insert
(
$ship
))
{
$tag
=
true
;
}
else
{
$tag
=
false
;
}
}
//好友表建立后赠送者减积分,被赠送者加积分
if
(
$tag
)
{
if
(
Db
::
name
(
'user'
)
->
where
([
'id'
=>
$uid
])
->
setDec
(
'balance'
,
$total
))
{
if
(
Db
::
name
(
'user'
)
->
where
([
'id'
=>
$friend_id
])
->
setInc
(
'balance'
,
$total
))
{
//插入赠送记录日志log
$log
=
[
'uid'
=>
$friend_id
,
'create_time'
=>
time
(),
'balance'
=>
$total
,
'type'
=>
3
];
if
(
Db
::
name
(
'zj_integral_log'
)
->
insert
(
$log
))
{
Db
::
commit
();
$tag
=
true
;
}
else
{
Db
::
rollback
();
$tag
=
false
;
}
}
else
{
Db
::
rollback
();
$tag
=
false
;
}
}
else
{
Db
::
rollback
();
$tag
=
false
;
}
}
else
{
Db
::
rollback
();
$tag
=
false
;
}
}
else
{
Db
::
rollback
();
$tag
=
false
;
}
if
(
$tag
)
{
if
(
$total
==
0
)
{
$msg
=
'添加好友成功'
;
}
else
{
$msg
=
'赠送积分成功'
;
}
}
else
{
$msg
=
'未知错误'
;
}
echo
json_encode
([
'msg'
=>
$msg
,
'status'
=>
$tag
]);
exit
();
}
}
}
}
//赠送积分(含加好友操作)
public
function
donateIntegral
()
{
echo
md5
(
123456
);
}
}
\ No newline at end of file
...
...
public/themes/simpleboot3/friendship/friend_give_log.html
0 → 100644
查看文件 @
db3a895
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
/>
<link
rel=
"stylesheet"
href=
"https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css"
>
<link
rel=
"stylesheet"
href=
"__INDEX__/css/base.css"
>
<link
rel=
"stylesheet"
href=
"__INDEX__/css/swiper.min.css"
>
<script
type=
"text/javascript"
src=
"__INDEX__/js/base.js"
></script>
<title>
好友列表
</title>
<style>
body
,
html
{
width
:
100%
;
height
:
100%
;
background
:
#fff
;
}
.fri_list
{
width
:
7.5rem
;
height
:
1.2rem
;
padding
:
0.2rem
0.32rem
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
border-bottom
:
1px
solid
#f5f5f5
;
}
.friend_img
{
font-size
:
0
;
width
:
0.8rem
;
height
:
0.8rem
;
border-radius
:
50%
;
}
.friend_img
img
{
width
:
100%
;
}
.friend_name
{
color
:
#000000
;
font-size
:
0.32rem
;
}
.sendintegral
{
color
:
#000000
;
font-size
:
0.28rem
;
}
.search
{
width
:
4rem
;
height
:
0.88rem
;
background
:
#FE0A01
;
border-radius
:
0.44rem
;
text-align
:
center
;
line-height
:
0.88rem
;
color
:
#fff
;
font-size
:
0.32rem
;
box-shadow
:
0px
15px
30px
0px
rgba
(
254
,
10
,
1
,
0.24
);
margin
:
0
auto
;
margin-top
:
1.49rem
;
}
</style>
</head>
<body>
<div
class=
"container"
>
<div
class=
"friendlist"
>
<div
class=
"fri_list"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
<P
class=
"sendintegral"
>
已赠送2000积分
</P>
</div>
<div
class=
"fri_list"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
<P
class=
"sendintegral"
>
已赠送2000积分
</P>
</div>
<div
class=
"fri_list"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
<P
class=
"sendintegral"
>
已赠送2000积分
</P>
</div>
<div
class=
"fri_list"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
<P
class=
"sendintegral"
>
已赠送2000积分
</P>
</div>
<div
class=
"fri_list"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
<P
class=
"sendintegral"
>
已赠送2000积分
</P>
</div>
</div>
<div
class=
"search"
>
搜索添加好友
</div>
</div>
</body>
<script
type=
"text/javascript"
src=
"__INDEX__/js/jquery.min.js"
></script>
<script>
$
(
".search"
).
click
(
function
(){
window
.
location
.
href
=
"{:url('friendship/Friend/friendList')}"
;
})
</script>
</html>
...
...
public/themes/simpleboot3/friendship/friend_list.html
0 → 100644
查看文件 @
db3a895
<!DOCTYPE html>
<html
lang=
"en"
>
<head>
<meta
charset=
"UTF-8"
>
<meta
name=
"viewport"
content=
"width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"
/>
<link
rel=
"stylesheet"
href=
"https://at.alicdn.com/t/font_834805_0ml90wdq5hzm.css"
>
<link
rel=
"stylesheet"
href=
"https://at.alicdn.com/t/font_750594_itt4qc4xfcg.css"
>
<link
rel=
"stylesheet"
href=
"__INDEX__/css/base.css"
>
<link
rel=
"stylesheet"
href=
"__INDEX__/css/swiper.min.css"
>
<script
type=
"text/javascript"
src=
"__INDEX__/js/base.js"
></script>
<title>
好友列表
</title>
<style>
body
,
html
{
width
:
100%
;
height
:
100%
;
background
:
#fff
;
}
.fri_list
{
width
:
7.5rem
;
height
:
1.2rem
;
padding
:
0.2rem
0.32rem
;
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
border-bottom
:
1px
solid
#f5f5f5
;
}
.friend
{
display
:
flex
;
}
.friend_img
{
font-size
:
0
;
width
:
0.8rem
;
height
:
0.8rem
;
border-radius
:
50%
;
}
.friend_img
img
{
width
:
100%
;
}
.friend_name
{
height
:
0.8rem
;
line-height
:
0.8rem
;
margin-left
:
0.32rem
;
color
:
#000000
;
font-size
:
0.32rem
;
}
.sendintegral
{
display
:
flex
;
color
:
#000000
;
font-size
:
0.28rem
;
}
.inter_img
,
.friend_inter
{
font-size
:
0
;
width
:
0.3rem
;
height
:
0.3rem
;
}
.inter_img
{
margin-right
:
0.48rem
;
}
.inter_img
img
,
.friend_inter
img
{
width
:
100%
;
}
.head
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
padding
:
0.36rem
0.32rem
;
}
.enterword
{
display
:
flex
;
width
:
5.26rem
;
height
:
0.6rem
;
line-height
:
0.6rem
;
border-radius
:
0.3rem
;
border
:
1px
solid
rgba
(
235
,
235
,
235
,
1
);
}
.word
{
width
:
5rem
;
height
:
0.56rem
;
border
:
none
;
outline
:
none
;
margin-left
:
0.1rem
;
}
.icon-sousuo
{
font-size
:
0.4rem
;
margin-left
:
0.31rem
;
}
.search_friend
{
width
:
1.4rem
;
height
:
0.6rem
;
background
:
#FE0A01
;
border-radius
:
0.3rem
;
font-size
:
0.32rem
;
color
:
#fff
;
text-align
:
center
;
line-height
:
0.6rem
;
}
/*赠送积分弹出层*/
.sendwrapper
{
width
:
100%
;
height
:
100%
;
background-color
:
rgba
(
0
,
0
,
0
,
0.5
);
position
:
fixed
;
left
:
0
;
right
:
0
;
z-index
:
5
;
}
.sendpop
{
width
:
5.2rem
;
height
:
4.2rem
;
background
:
#ffffff
;
border-radius
:
10px
;
position
:
absolute
;
z-index
:
6
;
/*left:0.4rem;*/
/*top: 3rem;*/
top
:
40%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
overflow
:
hidden
;
padding-top
:
0.36rem
;
}
.remaininter
{
color
:
#1A1A1A
;
font-size
:
0.28rem
;
margin
:
0
auto
;
}
.give
{
width
:
4.8rem
;
color
:
#1A1A1A
;
font-size
:
0.28rem
;
font-weight
:
bold
;
text-align
:
left
;
margin-top
:
0.35rem
;
}
.enterinter
{
width
:
4.81rem
;
height
:
0.7rem
;
border
:
1px
solid
rgba
(
235
,
235
,
235
,
1
);
border-radius
:
0.05rem
;
font-size
:
0
;
margin-top
:
0.19rem
;
}
.pleaseenter
{
width
:
4.6rem
;
height
:
0.6rem
;
border-radius
:
0.05rem
;
font-size
:
0.28rem
;
color
:
#97A0A8
;
border
:
none
;
outline
:
none
;
padding-left
:
0.23rem
;
}
.attention
{
color
:
#97A0A8
;
font-size
:
0.24rem
;
height
:
0.68rem
;
border-bottom
:
1px
solid
#f5f5f5
;
padding
:
0.1rem
0.18rem
0.24rem
0.18rem
;
margin-top
:
0.1rem
;
}
.sure
{
color
:
#FF0000
;
font-size
:
0.32rem
;
padding
:
0.31rem
1.91rem
;
}
/*输入密码弹出层*/
.passwordwrap
{
width
:
100%
;
height
:
100%
;
background-color
:
rgba
(
0
,
0
,
0
,
0.5
);
position
:
fixed
;
left
:
0
;
right
:
0
;
z-index
:
5
;
}
.passwordpop
{
width
:
5.2rem
;
height
:
2.84rem
;
background
:
#ffffff
;
border-radius
:
10px
;
position
:
absolute
;
z-index
:
6
;
/*left:0.4rem;*/
/*top: 3rem;*/
top
:
40%
;
left
:
50%
;
transform
:
translate
(
-50%
,
-50%
);
display
:
flex
;
flex-direction
:
column
;
align-items
:
center
;
overflow
:
hidden
;
padding-top
:
0.16rem
;
}
.enterpassword
{
display
:
flex
;
justify-content
:
space-between
;
align-items
:
center
;
font-size
:
0
;
margin-top
:
0.48rem
;
}
.enterpassword
li
{
width
:
0.8rem
;
height
:
0.8rem
;
list-style
:
none
;
border
:
1px
solid
rgba
(
153
,
153
,
153
,
1
);
text-align
:
center
;
border-right
:
0
;
}
.enterpassword
li
:last-child
{
border-right
:
1px
solid
rgba
(
153
,
153
,
153
,
1
)
;
}
.enterpassword
li
input
{
width
:
0.77rem
;
height
:
0.76rem
;
list-style
:
none
;
text-align
:
center
;
border
:
none
;
}
.pleaseenterword
{
font-size
:
0.32rem
;
color
:
#1A1A1A
;
}
.icon-quxiao
{
width
:
5rem
;
color
:
#999999
;
font-size
:
0.3rem
;
text-align
:
right
;
}
</style>
</head>
<body>
<!--输入支付密码-->
<div
class=
"passwordwrap"
style=
"display:none"
>
<div
class=
"passwordpop"
>
<p
class=
"iconfont icon-quxiao"
></p>
<p
class=
"pleaseenterword"
>
输入支付密码
</p>
<ul
class=
"enterpassword"
>
<li>
<input
type=
"text"
>
</li>
<li>
<input
type=
"text"
>
</li>
<li>
<input
type=
"text"
>
</li>
<li>
<input
type=
"text"
>
</li>
<li>
<input
type=
"text"
>
</li>
<li>
<input
type=
"text"
>
</li>
</ul>
</div>
</div>
<!--好友弹出层-->
<div
class=
"sendwrapper"
style=
"display:none"
>
<div
class=
"sendpop"
>
<p
class=
"remaininter"
>
您还剩余200积分
</p>
<P
class=
"give"
>
赠送xxx好友积分
</P>
<div
class=
"enterinter"
>
<input
type=
"text"
class=
"pleaseenter"
placeholder=
"输入赠送积分值"
>
</div>
<div
class=
"attention"
>
积分赠送属个人操作,赠送错误平台概不负责
</div>
<div
class=
"sure"
>
确定赠送
</div>
</div>
</div>
<div
class=
"container"
>
<div
class=
"head"
>
<div
class=
"enterword"
>
<p
class=
"iconfont icon-sousuo"
></p>
<input
type=
"text"
class=
"word"
>
</div>
<p
class=
"search_friend"
>
搜索
</p>
</div>
<div
class=
"friendlist"
>
<div
class=
"fri_list"
>
<div
class=
"friend"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
</div>
<div
class=
"sendintegral"
>
<p
class=
"inter_img"
>
<img
src=
"__INDEX__/img/jifen.png"
alt=
""
>
</p>
<P
class=
"friend_inter"
>
<img
src=
"__INDEX__/img/jiahaoyou.png"
alt=
""
>
</P>
</div>
</div>
<div
class=
"fri_list"
>
<div
class=
"friend"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
</div>
<div
class=
"sendintegral"
>
<p
class=
"inter_img"
>
<img
src=
"__INDEX__/img/jifen.png"
alt=
""
>
</p>
<P
class=
"friend_inter"
>
<img
src=
"__INDEX__/img/jiahaoyou.png"
alt=
""
>
</P>
</div>
</div>
<div
class=
"fri_list"
>
<div
class=
"friend"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
</div>
<div
class=
"sendintegral"
>
<p
class=
"inter_img"
>
<img
src=
"__INDEX__/img/jifen.png"
alt=
""
>
</p>
<P
class=
"friend_inter"
>
<img
src=
"__INDEX__/img/jiahaoyou.png"
alt=
""
>
</P>
</div>
</div>
<div
class=
"fri_list"
>
<div
class=
"friend"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
</div>
<div
class=
"sendintegral"
>
<p
class=
"inter_img"
>
<img
src=
"__INDEX__/img/jifen.png"
alt=
""
>
</p>
<P
class=
"friend_inter"
>
<img
src=
"__INDEX__/img/jiahaoyou.png"
alt=
""
>
</P>
</div>
</div>
<div
class=
"fri_list"
>
<div
class=
"friend"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
</div>
<div
class=
"sendintegral"
>
<p
class=
"inter_img"
>
<img
src=
"__INDEX__/img/jifen.png"
alt=
""
>
</p>
<P
class=
"friend_inter"
>
<img
src=
"__INDEX__/img/jiahaoyou.png"
alt=
""
>
</P>
</div>
</div>
<div
class=
"fri_list"
>
<div
class=
"friend"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
</div>
<div
class=
"sendintegral"
>
<p
class=
"inter_img"
>
<img
src=
"__INDEX__/img/jifen.png"
alt=
""
>
</p>
<P
class=
"friend_inter"
>
<img
src=
"__INDEX__/img/jiahaoyou.png"
alt=
""
>
</P>
</div>
</div>
<div
class=
"fri_list"
>
<div
class=
"friend"
>
<p
class=
"friend_img"
>
<img
src=
"__INDEX__/img/head@2x.png"
alt=
""
>
</p>
<p
class=
"friend_name"
>
Vincent
</p>
</div>
<div
class=
"sendintegral"
>
<p
class=
"inter_img"
>
<img
src=
"__INDEX__/img/jifen.png"
alt=
""
>
</p>
<P
class=
"friend_inter"
>
<img
src=
"__INDEX__/img/jiahaoyou.png"
alt=
""
>
</P>
</div>
</div>
</div>
</div>
</body>
<script
type=
"text/javascript"
src=
"__INDEX__/js/jquery.min.js"
></script>
<script>
$
(
".inter_img"
).
click
(
function
(){
$
(
".sendwrapper"
).
css
(
"display"
,
"block"
);
})
$
(
".sendwrapper"
).
click
(
function
(){
$
(
this
).
css
(
"display"
,
"none"
)
})
//确定赠送
$
(
".sure"
).
click
(
function
(){
window
.
event
.
stopPropagation
()
$
(
".sendwrapper"
).
css
(
"display"
,
"none"
);
$
(
".passwordwrap"
).
css
(
"display"
,
"block"
)
})
$
(
".icon-quxiao"
).
click
(
function
(){
window
.
event
.
stopPropagation
()
$
(
".passwordwrap"
).
css
(
"display"
,
"none"
)
})
</script>
</html>
...
...
public/themes/simpleboot3/user/center/my_balance.html
查看文件 @
db3a895
...
...
@@ -69,7 +69,7 @@
<P
class=
"iconfont icon-jinru"
></P>
</div>
<div
class=
"list friend"
>
<p
class=
"record"
>
积分赠送
</p>
<p
class=
"record"
data-url=
"{:url('friendship/Friend/friendGiveLog')}"
>
积分赠送
</p>
<P
class=
"iconfont icon-jinru"
></P>
</div>
<div
class=
"list password"
>
...
...
@@ -89,7 +89,7 @@
})
//赠送好友积分
$
(
".friend"
).
click
(
function
(){
window
.
location
.
href
=
$
(
this
).
attr
(
'data-url'
);
})
$
(
".password"
).
click
(
function
(){
...
...
请
注册
或
登录
后发表评论