Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
service
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
aimeiyue
service
Commits
3342603a
Commit
3342603a
authored
Oct 09, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
eb09e88e
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
90 additions
and
10 deletions
+90
-10
app/Admin/Forms/VerifierCodeForm.php
+1
-0
app/Http/Controllers/Api/CommentController.php
+9
-3
app/Http/Controllers/Api/IncomeController.php
+6
-1
app/Http/Controllers/Api/SystemController.php
+58
-0
app/Http/Controllers/Api/UserController.php
+11
-6
app/Models/OrderDivideRecord.php
+1
-0
routes/api.php
+4
-0
No files found.
app/Admin/Forms/VerifierCodeForm.php
View file @
3342603a
...
@@ -30,6 +30,7 @@ public function handle(array $input)
...
@@ -30,6 +30,7 @@ public function handle(array $input)
$order
=
OrderInfo
::
find
(
$this
->
payload
[
'id'
]);
$order
=
OrderInfo
::
find
(
$this
->
payload
[
'id'
]);
$order
->
order_status
=
2
;
//待领取状态
$order
->
order_status
=
2
;
//待领取状态
$order
->
verification_code
=
$code
;
$order
->
verification_code
=
$code
;
$order
->
verifi_code_at
=
date
(
"Y-m-d H:i:s"
);
$order
->
save
();
$order
->
save
();
return
$this
->
response
()
->
success
(
'确认成功'
)
->
refresh
();
return
$this
->
response
()
->
success
(
'确认成功'
)
->
refresh
();
}
}
...
...
app/Http/Controllers/Api/CommentController.php
View file @
3342603a
...
@@ -44,14 +44,20 @@ public function add(Request $request)
...
@@ -44,14 +44,20 @@ public function add(Request $request)
$ogObj
->
is_comment
=
1
;
$ogObj
->
is_comment
=
1
;
$ogObj
->
save
();
$ogObj
->
save
();
}
}
DB
::
commit
();
//2分钟执行订单分佣
//2分钟执行订单分佣
$count
=
OrderGoods
::
where
(
'order_id'
,
$oid
)
->
where
(
'is_comment'
,
0
)
->
count
();
$count
=
OrderGoods
::
where
(
'order_id'
,
$oid
)
->
where
(
'is_comment'
,
0
)
->
count
();
Log
::
add
(
'订单商品评论'
.
$og_id
,
[
'num'
=>
$count
]);
Log
::
add
(
'订单商品评论'
.
$og_id
,
[
'num'
=>
$count
]);
if
(
$count
==
0
)
{
if
(
$count
==
0
)
{
Log
::
add
(
'调用分佣'
,
$orderObj
->
toArray
());
if
(
$useObj
->
spuid
||
$useObj
->
merchant_id
)
{
$this
->
dispatch
(
new
AutoCompleteOrder
(
$orderObj
,
10
));
$orderObj
->
is_commission
=
1
;
$orderObj
->
order_status
=
4
;
$orderObj
->
save
();
}
// Log::add('调用分佣', $orderObj->toArray());
// $this->dispatch(new AutoCompleteOrder($orderObj, 10));
}
}
DB
::
commit
();
return
$this
->
JsonResponse
(
''
);
return
$this
->
JsonResponse
(
''
);
}
catch
(
\Exception
$exception
)
{
}
catch
(
\Exception
$exception
)
{
Log
::
add
(
'添加评论失败'
,
$exception
->
getMessage
());
Log
::
add
(
'添加评论失败'
,
$exception
->
getMessage
());
...
...
app/Http/Controllers/Api/IncomeController.php
View file @
3342603a
...
@@ -72,7 +72,12 @@ public function add(Request $request)
...
@@ -72,7 +72,12 @@ public function add(Request $request)
if
(
$balance
<
$money
)
{
if
(
$balance
<
$money
)
{
return
$this
->
JsonResponse
(
''
,
'余额不足'
,
500
);
return
$this
->
JsonResponse
(
''
,
'余额不足'
,
500
);
}
}
$exist
=
Income
::
where
([
'user_type'
=>
$type
,
'um_id'
=>
$um_id
])
->
orderBy
(
'id'
,
'DESC'
)
->
first
();
if
(
$exist
)
{
return
$this
->
JsonResponse
(
''
,
'提现审核中!'
,
500
);
}
DB
::
beginTransaction
();
DB
::
beginTransaction
();
try
{
try
{
$comObj
=
new
Income
();
$comObj
=
new
Income
();
...
...
app/Http/Controllers/Api/SystemController.php
View file @
3342603a
...
@@ -3,6 +3,8 @@
...
@@ -3,6 +3,8 @@
namespace
App\Http\Controllers\Api
;
namespace
App\Http\Controllers\Api
;
use
App\Command\Log
;
use
App\Command\Log
;
use
App\Models\OrderInfo
as
OrderInfoModel
;
use
App\Models\OrderDivideRecord
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
...
@@ -22,4 +24,60 @@ public function update(Request $request)
...
@@ -22,4 +24,60 @@ public function update(Request $request)
return
$this
->
JsonResponse
(
''
);
return
$this
->
JsonResponse
(
''
);
}
}
//定时任务--待领取状态下七天未领取,自动到待评价状态
public
function
autoChangeReceiveStatus
()
{
$chunkSize
=
50
;
// 每次处理的订单数量
$orders
=
OrderInfoModel
::
where
([
"order_status"
=>
2
])
->
whereNull
(
'verification_at'
)
->
whereNotNull
(
'verifi_code_at'
)
->
orderBy
(
'id'
)
->
take
(
$chunkSize
);
while
(
$orders
->
count
()
>
0
)
{
$orders
->
chunk
(
$chunkSize
,
function
(
$batch
)
{
foreach
(
$batch
as
$order
)
{
$nowtime
=
time
();
if
(
$order
->
verifi_code_at
)
{
$wait_time
=
strtotime
(
$order
->
verifi_code_at
);
$diff_time
=
$nowtime
-
$wait_time
;
$d
=
$diff_time
/
86400
;
if
(
$d
>=
7
)
{
$order
->
order_status
=
3
;
$order
->
save
();
}
}
}
});
// 移动游标到下一批
$orders
->
skip
(
$chunkSize
);
$orders
=
$orders
->
getQuery
();
sleep
(
2
);
}
return
'--ok--'
;
}
//定时任务--订单分佣
public
function
autoOrderCommission
()
{
$chunkSize
=
50
;
// 每次处理的订单数量
$orders
=
OrderInfoModel
::
where
([
"order_status"
=>
4
,
'is_commission'
=>
1
])
->
orderBy
(
'id'
)
->
take
(
$chunkSize
);
while
(
$orders
->
count
()
>
0
)
{
$orders
->
chunk
(
$chunkSize
,
function
(
$batch
)
{
foreach
(
$batch
as
$order
)
{
//佣金分配
$res
=
OrderDivideRecord
::
divide
(
$order
->
id
);
if
(
$res
)
{
$order
->
is_commission
=
2
;
$order
->
save
();
}
}
});
// 移动游标到下一批
$orders
->
skip
(
$chunkSize
);
$orders
=
$orders
->
getQuery
();
sleep
(
3
);
}
return
'--ok--'
;
}
}
}
app/Http/Controllers/Api/UserController.php
View file @
3342603a
...
@@ -369,14 +369,19 @@ public function share(Request $request)
...
@@ -369,14 +369,19 @@ public function share(Request $request)
if
(
!
$spObj
)
{
if
(
!
$spObj
)
{
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
return
$this
->
JsonResponse
(
''
,
'参数错误'
,
201
);
}
}
//分享人注册时间
$sp_time
=
strtotime
(
$spObj
->
created_at
);
$userObj
=
$request
->
user
();
$userObj
=
$request
->
user
();
$user_id
=
$userObj
->
id
;
$user_time
=
strtotime
(
$userObj
->
created_at
);
$spuid
=
$userObj
->
spuid
;
//是否已有推荐人
if
(
$user_time
>
$sp_time
)
{
if
(
!
$spuid
&&
$user_id
!=
$shuid
)
{
$user_id
=
$userObj
->
id
;
$userObj
->
spuid
=
$shuid
;
//直推
$spuid
=
$userObj
->
spuid
;
//是否已有推荐人
$userObj
->
second_spuid
=
$spObj
->
spuid
;
//间推
if
(
!
$spuid
&&
$user_id
!=
$shuid
)
{
$userObj
->
save
();
$userObj
->
spuid
=
$shuid
;
//直推
$userObj
->
second_spuid
=
$spObj
->
spuid
;
//间推
$userObj
->
save
();
}
}
}
return
$this
->
JsonResponse
(
''
);
return
$this
->
JsonResponse
(
''
);
}
}
...
...
app/Models/OrderDivideRecord.php
View file @
3342603a
...
@@ -69,6 +69,7 @@ public static function divide($order_id)
...
@@ -69,6 +69,7 @@ public static function divide($order_id)
self
::
addRecord
(
$item
->
id
,
$order_id
,
$goods_amount
,
$divide_price
,
$merchant_commission
,
$merchant_id
,
$user_id
,
3
);
self
::
addRecord
(
$item
->
id
,
$order_id
,
$goods_amount
,
$divide_price
,
$merchant_commission
,
$merchant_id
,
$user_id
,
3
);
}
}
}
}
return
true
;
}
}
public
static
function
addRecord
(
$og_id
,
$order_id
,
$goods_amount
,
$divide_price
,
$commission
,
$um_id
,
$user_id
,
$sh_type
)
public
static
function
addRecord
(
$og_id
,
$order_id
,
$goods_amount
,
$divide_price
,
$commission
,
$um_id
,
$user_id
,
$sh_type
)
...
...
routes/api.php
View file @
3342603a
...
@@ -74,6 +74,10 @@
...
@@ -74,6 +74,10 @@
Route
::
get
(
'send/config/update'
,
'SystemController@update'
);
Route
::
get
(
'send/config/update'
,
'SystemController@update'
);
Route
::
get
(
'auto-to-commentstatus'
,
'SystemController@autoChangeReceiveStatus'
);
//定时任务--待领取状态下七天未领取,自动到待评价状态
Route
::
get
(
'auto-order-commission'
,
'SystemController@autoOrderCommission'
);
//定时完成--订单完成后分佣
Route
::
middleware
(
'auth:sanctum'
)
->
group
(
function
()
{
Route
::
middleware
(
'auth:sanctum'
)
->
group
(
function
()
{
Route
::
get
(
'user-info'
,
'UserController@info'
);
//获取小程序端用户资料
Route
::
get
(
'user-info'
,
'UserController@info'
);
//获取小程序端用户资料
...
...
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