切换导航条
此项目
正在载入...
登录
景龙
/
feipin
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
景龙
6 years ago
提交
eba0417ec6bfc43602b60a8841bdd3b5bc1c6828
1 个父辈
da0b8f14
1 个管道 的构建
通过
耗费 9 秒
修改分享下线规则
变更
1
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
1 个修改的文件
包含
23 行增加
和
7 行删除
application/api/controller/Person.php
application/api/controller/Person.php
查看文件 @
eba0417
...
...
@@ -329,16 +329,19 @@ class Person extends Api
* @return bool
*/
public
function
getScore
(
$share_uid
,
$type
){
$class
=
''
;
if
(
$type
==
'share_purchase'
){
$scoreRule
=
Db
::
table
(
'gc_sscore'
)
->
where
(
'set_rule'
,
'like'
,
'%购买%'
)
->
field
(
'set_score'
)
->
find
();
$class
=
1
;
}
else
if
(
$type
==
'share_sell'
){
$scoreRule
=
Db
::
table
(
'gc_sscore'
)
->
where
(
'set_rule'
,
'like'
,
'%卖废品%'
)
->
field
(
'set_score'
)
->
find
();
$class
=
0
;
}
// $score = config('site.'.$type);
$score
=
0
;
...
...
@@ -346,16 +349,29 @@ class Person extends Api
$score
=
$scoreRule
[
'set_score'
];
}
$offlineModel
=
new
Line
();
//此处判断不能相互成为下线(你成为我的下线,我就不能成为你的下线)
$offlineModel
->
where
([
'off_uid'
=>
$share_uid
,
'uid'
=>
$this
->
user_id
])
->
find
();
//此处判断分享用户否已有上线,如果有,则不能成为其他的下线
$each_other
=
$offlineModel
->
where
([
'off_uid'
=>
$share_uid
])
->
select
();
//判断本登录用户是否有上线
$other
=
$offlineModel
->
where
([
'off_uid'
=>
$this
->
user_id
])
->
select
();
//分享人是自己无效
if
(
$share_uid
!=
$this
->
user_id
){
if
(
!
$offlineModel
){
//给分享用户增加积分
//分享用户有上线
if
(
$each_other
&&
!
$other
){
$on_uid
=
array_unique
(
array_column
(
$each_other
,
'uid'
))[
0
];
//给上线增加积分
$userModel
=
new
\app\admin\model\User
();
$userModel
->
where
([
'id'
=>
$share_uid
,
'status'
=>
'normal'
])
->
setInc
(
'score'
,
$score
);
//成为分享用户的下线
$offlineModel
->
create
([
'uid'
=>
$share_uid
,
's_score'
=>
$score
,
'off_uid'
=>
$this
->
user_id
]);
$userModel
->
where
([
'id'
=>
$on_uid
,
'status'
=>
'normal'
])
->
setInc
(
'score'
,
$score
);
//创建上线用户的积分记录
$offlineModel
->
create
([
'uid'
=>
$on_uid
,
's_score'
=>
$score
,
'off_uid'
=>
$share_uid
,
'type'
=>
$class
]);
}
else
{
//本登录用户没有上线
if
(
!
$other
){
//给分享用户增加积分
$userModel
=
new
\app\admin\model\User
();
$userModel
->
where
([
'id'
=>
$share_uid
,
'status'
=>
'normal'
])
->
setInc
(
'score'
,
$score
);
//成为分享用户的下线并创建积分记录
$offlineModel
->
create
([
'uid'
=>
$share_uid
,
's_score'
=>
$score
,
'off_uid'
=>
$this
->
user_id
,
'type'
=>
$class
]);
}
}
}
}
...
...
请
注册
或
登录
后发表评论