切换导航条
此项目
正在载入...
登录
李涵
/
integral
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
lihan
6 years ago
提交
cc99413676b65ccefc198b868fbf40e0882441db
1 个父辈
45a83e84
1 个管道 的构建
通过
耗费 0 秒
赠送积分模块
变更
3
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
11 行增加
和
5 行删除
app/integral/controller/IntegralController.php
app/integral/model/IntegralModel.php
app/pay/controller/PayController.php
app/integral/controller/IntegralController.php
查看文件 @
cc99413
...
...
@@ -15,10 +15,14 @@ class IntegralController extends HomeBaseController
{
public
function
autoExecute
()
{
$model
=
new
IntegralModel
;
$give
=
Db
::
name
(
'zj_integral_give'
)
->
where
([
'balance'
=>
[
'neq'
,
0
]])
->
field
(
'id,uid,balance,ratio'
)
->
select
();
$give
=
Db
::
name
(
'zj_integral_give'
)
->
where
([
'balance'
=>
[
'neq'
,
0
]])
->
field
(
'id,uid,balance,
total,
ratio'
)
->
select
();
foreach
(
$give
as
$item
)
{
$give_balance
=
(
int
)(
$item
[
'
balance
'
]
*
$item
[
'ratio'
]
/
100
);
$give_balance
=
(
int
)(
$item
[
'
total
'
]
*
$item
[
'ratio'
]
/
100
);
$remain_balance
=
$item
[
'balance'
]
-
$give_balance
;
if
(
$remain_balance
<=
$give_balance
)
{
$give_balance
=
$remain_balance
;
$remain_balance
=
0
;
}
Db
::
name
(
'user'
)
->
where
([
'id'
=>
$item
[
'uid'
]])
->
setInc
(
'balance'
,
$give_balance
);
$model
->
insertIntegralLog
(
$item
[
'id'
],
$item
[
'uid'
],
time
(),
$give_balance
,
1
);
$model
->
updateIntegralGive
(
$item
[
'id'
],
$remain_balance
);
...
...
app/integral/model/IntegralModel.php
查看文件 @
cc99413
...
...
@@ -38,15 +38,17 @@ class IntegralModel extends Model
* @param $uid
* @param $ratio
* @param $balance
* @param $total
* @param $create_time
* @return bool
* @return bool
|string
*/
public
function
insertIntegralGive
(
$uid
,
$ratio
,
$balance
,
$create_time
)
public
function
insertIntegralGive
(
$uid
,
$ratio
,
$balance
,
$
total
,
$
create_time
)
{
$data
=
[
'uid'
=>
$uid
,
'create_time'
=>
$create_time
,
'balance'
=>
$balance
,
'total'
=>
$total
,
'ratio'
=>
$ratio
];
if
(
Db
::
name
(
'zj_integral_give'
)
->
insert
(
$data
))
{
...
...
app/pay/controller/PayController.php
查看文件 @
cc99413
...
...
@@ -261,7 +261,7 @@ class PayController extends HomeBaseController
//插入配送计划表,先将此积分的一半立刻给用户,剩余一半每日按固定百分比给用户,直到发完为止
$integral_half
=
$integral
/
2
;
Db
::
startTrans
();
$integral_give_id
=
$model
->
insertIntegralGive
(
session
(
'user.id'
),
$ratio
,
$integral_half
,
time
());
$integral_give_id
=
$model
->
insertIntegralGive
(
session
(
'user.id'
),
$ratio
,
$integral_half
,
$integral
,
time
());
if
(
$integral_give_id
)
{
if
(
$model
->
insertIntegralLog
(
$integral_give_id
,
session
(
'user.id'
),
time
(),
$integral_half
,
1
))
{
if
(
Db
::
name
(
'user'
)
->
where
([
'id'
=>
session
(
'user.id'
)])
->
setInc
(
'balance'
,
$integral_half
))
{
...
...
请
注册
或
登录
后发表评论