Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zhupu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
zhupu
Commits
b9880737
Commit
b9880737
authored
Nov 27, 2023
by
sugar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://rungit.jxdsy.cn:10000/sugar/zhupu
into dev
parents
cc81e7e2
bf86ab05
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
65 additions
and
1 deletion
+65
-1
application/api/controller/FamilyTree.php
application/api/controller/FamilyTree.php
+3
-1
application/api/model/PaymentLogModel.php
application/api/model/PaymentLogModel.php
+3
-0
application/api/model/UsersModel.php
application/api/model/UsersModel.php
+1
-0
application/lib/service/PaymentService.php
application/lib/service/PaymentService.php
+58
-0
No files found.
application/api/controller/FamilyTree.php
View file @
b9880737
...
...
@@ -594,6 +594,7 @@ class FamilyTree extends Api
$number
=
$this
->
request
->
post
(
"number"
,
''
);
//用户编号
$pay_way
=
$this
->
request
->
post
(
'pay_way'
,
'weixin'
);
//支付方式:weixin=微信,money=钱包,alipay=支付宝
$amount
=
$this
->
request
->
post
(
'amount'
,
0
);
//下单金额
$family_id
=
$this
->
request
->
post
(
'family_id'
);
//族谱id
$peopleinfo
=
FamilyPeopleModel
::
dataInfo
([
'number'
=>
$number
]);
if
(
$peopleinfo
&&
$peopleinfo
[
'is_pay'
]
>
0
){
$this
->
error
(
"该成员已支付过认证费"
);
...
...
@@ -615,13 +616,14 @@ class FamilyTree extends Api
$recharge_data
=
[
'tree_id'
=>
$treeinfo
[
'id'
],
'people_id'
=>
$peopleinfo
[
'id'
],
'family_id'
=>
$family_id
,
'user_id'
=>
$uid
,
'amount'
=>
$amount
,
'payamount'
=>
$amount
,
'ip'
=>
$this
->
request
->
ip
(),
'createtime'
=>
time
(),
'memo'
=>
'加入族谱认证费用'
,
'is_certification'
=>
1
'is_certification'
=>
1
,
];
$res
=
RechargeModel
::
create
(
$recharge_data
);
//创建订单
$pay_data
=
[
...
...
application/api/model/PaymentLogModel.php
View file @
b9880737
...
...
@@ -20,6 +20,7 @@ namespace app\api\model;
use
app\admin\model\worship\Worshipgoodsmodel
;
use
app\lib\model\FamilyPeopleModel
;
use
app\lib\model\FamilyTreeModel
;
use
app\lib\service\PaymentService
;
use
app\lib\service\WorshipService
;
use
think\Config
;
use
think\Db
;
...
...
@@ -95,6 +96,8 @@ class PaymentLogModel extends Model
//贡品订单支付回调
WorshipService
::
conductWorship
(
$pay_log
[
'id'
]);
}
//分佣机制
PaymentService
::
agentCommission
(
$pay_log
);
Db
::
commit
();
}
catch
(
Exception
$e
)
{
Db
::
rollback
();
...
...
application/api/model/UsersModel.php
View file @
b9880737
...
...
@@ -66,6 +66,7 @@ class UsersModel extends BaseModel {
*/
public
static
function
addCommission
(
$user_id
,
$num
,
$msgtype
=
0
,
$detail_type
=
0
,
$intro
=
''
,
$status
=
0
,
$logs_id
=
null
,
$order_type
=
null
,
$pay_way
=
null
,
$order_id
=
null
,
$remark
=
null
,
$admin_id
=
null
){
$model
=
new
static
();
if
(
$num
==
0
)
return
false
;
if
(
$model
->
updateCount
(
$user_id
,
'commission'
,
$num
))
{
// MsgService::messageTemplate($msgtype,$user_id,$num,$intro);
return
UsersDetailMoneyModel
::
insertData
(
$user_id
,
$num
,
3
,
$detail_type
,
$intro
,
$logs_id
,
$order_type
,
$pay_way
,
$order_id
,
$status
,
$remark
,
$admin_id
);
...
...
application/lib/service/PaymentService.php
0 → 100644
View file @
b9880737
<?php
namespace
app\lib\service
;
use
app\api\model\RechargeModel
;
use
app\api\model\UsersModel
;
use
app\lib\model\AgentModel
;
use
app\lib\model\FamilyModel
;
class
PaymentService
{
/**
* 代理分佣模式
*/
public
static
function
agentCommission
(
$pay_log
){
if
(
strcmp
(
$pay_log
[
'order_type'
],
'recharge'
)
==
0
)
{
//加入族谱
$rechargeinfo
=
RechargeModel
::
where
([
'id'
=>
$pay_log
[
'order_id'
]])
->
find
();
//已支付
$family
=
FamilyModel
::
dataInfo
([
'id'
=>
$rechargeinfo
[
'family_id'
]]);
//族谱信息
$inheritor
=
AgentModel
::
dataList
([
'family_id'
=>
$rechargeinfo
[
'family_id'
],
'status'
=>
1
]);
//族长,传承人
}
else
if
(
strcmp
(
$pay_log
[
'order_type'
],
'goods'
)
==
0
){
return
false
;
}
foreach
(
$inheritor
as
$key
=>
$val
){
//族长,传承人分佣
UsersModel
::
addCommission
(
$val
[
'user_id'
],
$pay_log
[
'need_pay'
]
*
$val
[
'rate'
],
50
,
2
,
"加入族谱分佣"
,
0
,
$pay_log
[
'id'
],
$pay_log
[
'order_type'
],
$pay_log
[
'pay_way'
],
$pay_log
[
'order_id'
],
null
,
null
);
}
//区县代理分佣
$area
=
AgentModel
::
dataInfo
([
'area_id'
=>
$family
[
'area_id'
],
'type'
=>
3
,
'status'
=>
1
]);
if
(
$area
){
UsersModel
::
addCommission
(
$area
[
'user_id'
],
$pay_log
[
'need_pay'
]
*
$area
[
'rate'
],
50
,
2
,
"加入族谱区县代理分佣"
,
0
,
$pay_log
[
'id'
],
$pay_log
[
'order_type'
],
$pay_log
[
'pay_way'
],
$pay_log
[
'order_id'
],
null
,
null
);
}
//市级代理分佣
$city
=
AgentModel
::
dataInfo
([
'city_id'
=>
$family
[
'city_id'
],
'type'
=>
4
,
'status'
=>
1
]);
if
(
$city
){
UsersModel
::
addCommission
(
$city
[
'user_id'
],
$pay_log
[
'need_pay'
]
*
$city
[
'rate'
],
50
,
2
,
"加入族谱市级代理分佣"
,
0
,
$pay_log
[
'id'
],
$pay_log
[
'order_type'
],
$pay_log
[
'pay_way'
],
$pay_log
[
'order_id'
],
null
,
null
);
}
//省级代理分佣
$province
=
AgentModel
::
dataInfo
([
'province_id'
=>
$family
[
'province_id'
],
'type'
=>
5
,
'status'
=>
1
]);
if
(
$province
){
UsersModel
::
addCommission
(
$province
[
'user_id'
],
$pay_log
[
'need_pay'
]
*
$province
[
'rate'
],
50
,
2
,
"加入族谱省级代理分佣"
,
0
,
$pay_log
[
'id'
],
$pay_log
[
'order_type'
],
$pay_log
[
'pay_way'
],
$pay_log
[
'order_id'
],
null
,
null
);
}
return
true
;
}
}
\ No newline at end of file
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