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
9cb71cbf
Commit
9cb71cbf
authored
Mar 13, 2019
by
hujun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
记录
parent
84647a34
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
23 deletions
+15
-23
CouponService.php
application/api/service/CouponService.php
+11
-19
RegisterService.php
application/api/service/RegisterService.php
+2
-2
Finance.php
application/index/controller/Finance.php
+2
-2
No files found.
application/api/service/CouponService.php
View file @
9cb71cbf
...
@@ -30,14 +30,12 @@ class CouponService{
...
@@ -30,14 +30,12 @@ class CouponService{
* 发券
* 发券
*
*
* @param int $user_id
* @param int $user_id
* @param int $type 奖励动作 0首次登陆 1邀请登陆 2邀请成交
* @param int $referrer_id
* @param int $report_id
* @param int $type
* @param int $bargain_id
* @param int $order_id
* @return mixed
* @return mixed
* @throws \think\exception\PDOException
* @throws \think\exception\PDOException
*/
*/
public
function
sendCoupon
(
int
$user_id
,
int
$
type
,
$report_id
=
0
,
$bargain_id
=
0
,
$order_id
=
0
)
{
public
function
sendCoupon
(
int
$user_id
,
int
$
referrer_id
,
int
$type
)
{
$result
[
'status'
]
=
'successful'
;
$result
[
'status'
]
=
'successful'
;
$result
[
'msg'
]
=
'发券成功'
;
$result
[
'msg'
]
=
'发券成功'
;
$result
[
'data'
]
=
[];
$result
[
'data'
]
=
[];
...
@@ -49,7 +47,7 @@ class CouponService{
...
@@ -49,7 +47,7 @@ class CouponService{
$result
[
'msg'
]
=
'正在发券中,请稍等...'
;
$result
[
'msg'
]
=
'正在发券中,请稍等...'
;
return
$result
;
return
$result
;
}
else
{
}
else
{
$this
->
redis_
->
set
(
$key
,
$user_id
,
3
);
//上线后改为120
$this
->
redis_
->
set
(
$key
,
$user_id
,
3
);
}
}
try
{
try
{
...
@@ -60,7 +58,7 @@ class CouponService{
...
@@ -60,7 +58,7 @@ class CouponService{
return
$result
;
return
$result
;
}
}
$activity_data
=
$this
->
checkUserCoupon
(
$user_id
,
$type
,
$
ord
er_id
);
$activity_data
=
$this
->
checkUserCoupon
(
$user_id
,
$type
,
$
referr
er_id
);
if
(
empty
(
$activity_data
))
{
if
(
empty
(
$activity_data
))
{
$result
[
'status'
]
=
'fail'
;
$result
[
'status'
]
=
'fail'
;
$result
[
'msg'
]
=
'没有可参加的活动'
;
$result
[
'msg'
]
=
'没有可参加的活动'
;
...
@@ -68,14 +66,8 @@ class CouponService{
...
@@ -68,14 +66,8 @@ class CouponService{
}
}
$save_data
=
[];
$save_data
=
[];
$save_data
[
'user_id'
]
=
$user_id
;
$save_data
[
'user_id'
]
=
$user_id
;
if
(
$report_id
)
{
if
(
$referrer_id
)
{
$save_data
[
'report_id'
]
=
$report_id
;
$save_data
[
'referrer_id'
]
=
$referrer_id
;
}
if
(
$bargain_id
)
{
$save_data
[
'bargain_id'
]
=
$bargain_id
;
}
if
(
$order_id
)
{
$save_data
[
'order_id'
]
=
$order_id
;
}
}
$save_data
[
'status'
]
=
0
;
$save_data
[
'status'
]
=
0
;
$save_data
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
);
$save_data
[
'create_time'
]
=
date
(
'Y-m-d H:i:s'
);
...
@@ -137,7 +129,7 @@ class CouponService{
...
@@ -137,7 +129,7 @@ class CouponService{
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
* @throws \think\exception\DbException
*/
*/
public
function
checkUserCoupon
(
int
$user_id
,
int
$type
,
$
ord
er_id
)
public
function
checkUserCoupon
(
int
$user_id
,
int
$type
,
$
referr
er_id
)
{
{
$return_activity
=
[];
$return_activity
=
[];
$time
=
time
();
$time
=
time
();
...
@@ -145,14 +137,14 @@ class CouponService{
...
@@ -145,14 +137,14 @@ class CouponService{
$field
.=
',available,get_number,create_time'
;
$field
.=
',available,get_number,create_time'
;
$activity_data
=
$this
->
selectActivity
(
$field
,
$type
);
$activity_data
=
$this
->
selectActivity
(
$field
,
$type
);
$count_where
[
'user_id'
]
=
$user_id
;
$count_where
[
'user_id'
]
=
$user_id
;
foreach
(
$activity_data
as
$k
=>
$v
)
{
foreach
(
$activity_data
as
$k
=>
$v
)
{
if
(
$v
[
'total'
]
-
$v
[
'get_number'
]
<=
0
)
{
if
(
$v
[
'total'
]
-
$v
[
'get_number'
]
<=
0
)
{
continue
;
continue
;
}
}
//单个订单只奖励一次
if
(
$type
==
0
)
{
if
(
$type
==
2
)
{
$count_where
[
'referrer_id'
]
=
$referrer_id
;
$count_where
[
'order_id'
]
=
$order_id
;
$num
=
$this
->
m_coupon
->
getCount
(
$count_where
);
$num
=
$this
->
m_coupon
->
getCount
(
$count_where
);
if
(
$num
>
0
)
{
if
(
$num
>
0
)
{
continue
;
continue
;
...
...
application/api/service/RegisterService.php
View file @
9cb71cbf
...
@@ -125,11 +125,11 @@ class RegisterService
...
@@ -125,11 +125,11 @@ class RegisterService
$coupon_service
=
new
CouponService
();
$coupon_service
=
new
CouponService
();
if
(
!
empty
(
$first_login_time
))
{
if
(
!
empty
(
$first_login_time
))
{
$coupon_service
->
sendCoupon
((
int
)
$id
,
0
);
$coupon_service
->
sendCoupon
((
int
)
$id
,
$user_info
[
0
][
'referrer_id'
],
0
);
}
}
if
(
!
empty
(
$registration_time
)
&&
$referrer_source
==
10
&&
$referrer_id
)
{
if
(
!
empty
(
$registration_time
)
&&
$referrer_source
==
10
&&
$referrer_id
)
{
$coupon_service
->
sendCoupon
((
int
)
$referrer_id
,
2
);
$coupon_service
->
sendCoupon
((
int
)
$referrer_id
,
0
,
2
);
}
}
$jwt
=
new
JwtUntils
();
$jwt
=
new
JwtUntils
();
...
...
application/index/controller/Finance.php
View file @
9cb71cbf
...
@@ -1423,7 +1423,7 @@ class Finance extends Basic
...
@@ -1423,7 +1423,7 @@ class Finance extends Basic
*/
*/
public
function
addRealIncome
()
public
function
addRealIncome
()
{
{
if
(
empty
(
$this
->
params
[
'bargain_id'
])
||
!
isset
(
$this
->
params
[
'is_account_commission'
])
||
!
isset
(
$this
->
params
[
'is_account_commission'
])
)
{
if
(
empty
(
$this
->
params
[
'bargain_id'
])
||
!
isset
(
$this
->
params
[
'is_account_commission'
]))
{
return
$this
->
response
(
101
,
'请求参数错误'
);
return
$this
->
response
(
101
,
'请求参数错误'
);
}
}
...
@@ -1473,7 +1473,7 @@ class Finance extends Basic
...
@@ -1473,7 +1473,7 @@ class Finance extends Basic
$user_id
=
$m_report
->
getFieldValue
(
'user_id'
,[
'id'
=>
$this
->
params
[
'report_id'
]]);
$user_id
=
$m_report
->
getFieldValue
(
'user_id'
,[
'id'
=>
$this
->
params
[
'report_id'
]]);
if
(
$user_id
)
{
if
(
$user_id
)
{
$service
=
new
ConvertCouponService
();
$service
=
new
ConvertCouponService
();
$service
->
convertCoupon
(
$user_id
);
//核销红包
$service
->
convertCoupon
(
$user_id
,
$this
->
params
[
'report_id'
],
$this
->
params
[
'bargain_id'
],
$this
->
params
[
'order_id'
]
);
//核销红包
}
}
}
}
}
}
...
...
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