Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tl_estate
Project
Project
Details
Activity
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
hujun
tl_estate
Commits
7c3d874c
Commit
7c3d874c
authored
Mar 13, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
确认分佣-红包列表
parent
6cd5f736
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
17 deletions
+84
-17
CouponService.php
application/api/service/CouponService.php
+6
-13
RegisterService.php
application/api/service/RegisterService.php
+9
-0
Finance.php
application/index/controller/Finance.php
+68
-4
Basic.php
application/index/extend/Basic.php
+1
-0
No files found.
application/api/service/CouponService.php
View file @
7c3d874c
...
...
@@ -53,21 +53,13 @@ class CouponService{
}
try
{
$user_data
=
$this
->
m_user
->
getUserById
(
'id
,first_login_time
'
,
$user_id
,
[
'status'
=>
0
]);
$user_data
=
$this
->
m_user
->
getUserById
(
'id'
,
$user_id
,
[
'status'
=>
0
]);
if
(
empty
(
$user_data
[
'id'
]))
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'该用户不存在'
;
return
$result
;
}
//该笔订单的收意向金时间48小时前 才给成交人和邀请人的返现红包兑现
$time
=
time
()
-
172800
;
if
(
$type
==
0
&&
strtotime
(
$user_data
[
'first_login_time'
])
<
$time
)
{
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'该用户首次登陆时间未超过48小时'
;
return
$result
;
}
$activity_data
=
$this
->
checkUserCoupon
(
$user_id
,
$type
,
$order_id
);
if
(
empty
(
$activity_data
))
{
$result
[
'status'
]
=
'fail'
;
...
...
@@ -111,15 +103,14 @@ class CouponService{
/**
* 查询奖励动作
*
* @param string $field
* @param $return_action @奖励动作 0首次登陆 1邀请登陆 2邀请成交
* @return false|\PDOStatement|string|\think\Collection
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
selectActivity
(
$return_action
)
{
$field
=
'id,return_type,money,activity_start_time,activity_end_time,use_period,total,available,total'
;
$field
.=
',available,get_number'
;
public
function
selectActivity
(
$field
=
'id'
,
$return_action
)
{
$where
[
'total'
]
=
[
'>'
,
0
];
if
(
is_array
(
$return_action
))
{
...
...
@@ -150,7 +141,9 @@ class CouponService{
{
$return_activity
=
[];
$time
=
time
();
$activity_data
=
$this
->
selectActivity
(
$type
);
$field
=
'id,return_type,money,activity_start_time,activity_end_time,use_period,total,available,total'
;
$field
.=
',available,get_number,create_time'
;
$activity_data
=
$this
->
selectActivity
(
$field
,
$type
);
$count_where
[
'user_id'
]
=
$user_id
;
foreach
(
$activity_data
as
$k
=>
$v
)
{
if
(
$v
[
'total'
]
-
$v
[
'get_number'
]
<=
0
)
{
...
...
application/api/service/RegisterService.php
View file @
7c3d874c
...
...
@@ -123,6 +123,15 @@ class RegisterService
$jwt_data
[
'userNick'
]
=
$user_nick
;
$jwt_data
[
'phone'
]
=
$phone
;
$coupon_service
=
new
CouponService
();
if
(
!
empty
(
$first_login_time
))
{
$coupon_service
->
sendCoupon
((
int
)
$id
,
0
);
}
if
(
!
empty
(
$registration_time
)
&&
$referrer_source
==
10
&&
$referrer_id
)
{
$coupon_service
->
sendCoupon
((
int
)
$referrer_id
,
2
);
}
$jwt
=
new
JwtUntils
();
$AuthToken
=
$jwt
->
createToken
(
$jwt_data
);
...
...
application/index/controller/Finance.php
View file @
7c3d874c
...
...
@@ -9,6 +9,8 @@
namespace
app\index\controller
;
use
app\api\service\ConvertCouponService
;
use
app\api\service\CouponService
;
use
app\api_broker\service\OrderLogService
;
use
app\api_broker\service\PayLogService
;
use
app\api_broker\service\VipService
;
...
...
@@ -694,14 +696,67 @@ class Finance extends Basic
$m_report
=
new
OReportModel
();
$m_user
=
new
Users
();
$user_id
=
$m_report
->
getFieldValue
(
'user_id'
,
[
'id'
=>
$report_id
]);
$
referrer_id
=
$m_user
->
getUserByWhereValue
(
'referrer_id'
,
[
'id'
=>
$user_id
,
'referrer_source'
=>
1
0
]);
$
id
=
$m_user
->
getUserByWhereValue
(
'id'
,
[
'id'
=>
$user_id
,
'referrer_source'
=>
10
,
'status'
=>
0
]);
$is_show
=
0
;
if
(
$
referrer_
id
)
{
if
(
$id
)
{
$is_show
=
1
;
}
return
$this
->
response
(
200
,
''
,
[
'is_show'
=>
$is_show
]);
}
/**
* 确认分佣红包列表
*
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public
function
getActivityCoupon
()
{
$report_id
=
$this
->
params
[
'report_id'
];
$report_id
=
359
;
if
(
empty
(
$report_id
))
{
return
$this
->
response
(
101
,
'参数错误'
);
}
$referrer_data
=
[];
$m_report
=
new
OReportModel
();
$m_user
=
new
Users
();
$user_id
=
$m_report
->
getFieldValue
(
'user_id'
,
[
'id'
=>
$report_id
]);
$user_data
=
$m_user
->
getUserById
(
'id,user_phone,referrer_id,referrer_source'
,
$user_id
,
[
'status'
=>
0
]);
//被邀请人
if
(
$user_data
)
{
if
(
$user_data
[
'referrer_source'
]
==
10
)
{
$referrer_data
=
$m_user
->
getUserById
(
'id,user_phone'
,
$user_data
[
'referrer_id'
],
[
'status'
=>
0
]);
//邀请人
}
$server
=
new
CouponService
();
$activity_data
=
$server
->
selectActivity
(
'title,use_period,money'
,[
0
,
2
]);
foreach
(
$activity_data
as
$k
=>
$v
)
{
if
(
$v
[
'return_action'
]
==
0
)
{
$data
[
0
][
'id'
]
=
$user_data
[
'id'
];
$data
[
0
][
'title'
]
=
$v
[
'title'
];
$data
[
0
][
'money'
]
=
$v
[
'money'
];
$validity
=
time
()
+
$v
[
'use_period'
]
*
86400
;
$data
[
0
][
'validity'
]
=
date
(
'Y.m.d'
)
.
'-'
.
date
(
'Y.m.d'
,
$validity
);
$data
[
0
][
'phone'
]
=
substr_replace
(
$user_data
[
'user_phone'
],
'****'
,
3
,
4
);
$data
[
0
][
'user_type'
]
=
'成交人'
;
}
if
(
$v
[
'return_action'
]
==
0
&&
$referrer_data
)
{
$data
[
1
][
'id'
]
=
$referrer_data
[
'id'
];
$data
[
1
][
'title'
]
=
$v
[
'title'
];
$data
[
1
][
'money'
]
=
$v
[
'money'
];
$validity
=
time
()
+
$v
[
'use_period'
]
*
86400
;
$data
[
1
][
'validity'
]
=
date
(
'Y.m.d'
)
.
'-'
.
date
(
'Y.m.d'
,
$validity
);
$data
[
1
][
'phone'
]
=
substr_replace
(
$referrer_data
[
'user_phone'
],
'****'
,
3
,
4
);
$data
[
1
][
'user_type'
]
=
'邀请人'
;
}
}
}
return
$this
->
response
(
200
,
''
,
$data
);
}
/**
* 收款记录
*
...
...
@@ -1372,7 +1427,7 @@ class Finance extends Basic
return
$this
->
response
(
101
,
'请求参数错误'
);
}
$bargain_data
=
$this
->
m_bargain
->
getCheckBargain
(
'a.id,a.agent_id,a.role,a.create_time,d.store_id,d.district_id'
,
$this
->
params
[
'bargain_id'
]);
$bargain_data
=
$this
->
m_bargain
->
getCheckBargain
(
'a.id,a.agent_id,a.role,a.create_time,d.store_id,d.district_id
,a.report_id
'
,
$this
->
params
[
'bargain_id'
]);
//排除成交报告其它状态
if
(
empty
(
$bargain_data
[
'id'
]))
{
...
...
@@ -1382,10 +1437,11 @@ class Finance extends Basic
$m_partial
=
new
OPartialCommission
();
$check
=
new
VipService
();
$m_report
=
new
OReportModel
();
$data
=
$this
->
params
[
"commission_date"
];
$add_arr
=
$update_arr
=
$log_data
=
$real_income_id
=
$real_income_old
=
[];
$i
=
$j
=
0
;
$i
=
$j
=
$user_id
=
0
;
foreach
(
$data
as
$item
)
{
if
(
!
isset
(
$item
[
'practical_fee'
])
||
!
isset
(
$item
[
'cash'
])
||
!
isset
(
$item
[
'service_charge'
])
||
!
isset
(
$item
[
'charity_fund'
])
||
!
isset
(
$item
[
'real_fee'
]))
{
...
...
@@ -1412,6 +1468,14 @@ class Finance extends Basic
if
(
empty
(
$partial_data
[
'confirm_date'
]))
{
$update_arr
[
$i
][
'confirm_date'
]
=
date
(
"Y-m-d H:i:s"
,
time
());
$update_arr
[
$i
][
'confirm_status'
]
=
1
;
if
(
empty
(
$user_id
)
&&
$item
[
'report_id'
])
{
$user_id
=
$m_report
->
getFieldValue
(
'user_id'
,[
'id'
=>
$item
[
'report_id'
]]);
if
(
$user_id
)
{
$service
=
new
ConvertCouponService
();
$service
->
convertCoupon
(
$user_id
);
//核销红包
}
}
}
}
$i
++
;
...
...
application/index/extend/Basic.php
View file @
7c3d874c
...
...
@@ -86,6 +86,7 @@ class Basic extends Controller
'index/saveActivity'
,
'index/getActivityList'
,
'index/checkReferrer'
,
'index/getActivityCoupon'
,
);
/**
...
...
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