Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
loveisland
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
刘小敏
loveisland
Commits
9353698a
Commit
9353698a
authored
May 07, 2026
by
刘小敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
AI试戴接口优化
parent
89218a74
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
1 deletion
+35
-1
AiTryon.php
addons/shopro/controller/user/AiTryon.php
+10
-0
Order.php
addons/shopro/listener/Order.php
+1
-0
User.php
addons/shopro/service/user/User.php
+24
-1
No files found.
addons/shopro/controller/user/AiTryon.php
View file @
9353698a
...
@@ -135,6 +135,7 @@ class AiTryon extends Common
...
@@ -135,6 +135,7 @@ class AiTryon extends Common
// 'goods_title' => $params['goods_title'],
// 'goods_title' => $params['goods_title'],
// 'goods_subtitle' => $params['goods_subtitle'],
// 'goods_subtitle' => $params['goods_subtitle'],
// 'goods_image' => $params['jewelry_image'],
// 'goods_image' => $params['jewelry_image'],
// 'person_image' => $params['person_image'],
// 'ai_task_id' => '',
// 'ai_task_id' => '',
// 'ai_type' => 0,
// 'ai_type' => 0,
// ];
// ];
...
@@ -161,6 +162,10 @@ class AiTryon extends Common
...
@@ -161,6 +162,10 @@ class AiTryon extends Common
// $tryonData['ai_status'] = 1;
// $tryonData['ai_status'] = 1;
// $tryonData['ai_url'] = config('shopro.api_host') . $attachment['data'];
// $tryonData['ai_url'] = config('shopro.api_host') . $attachment['data'];
// $tryonModel->save($tryonData);
// $tryonModel->save($tryonData);
// //试戴次数+1
// $userService = new User();
// $res = $userService->addTryTimes($user->id);
//
//
// $this->success($res['msg'], config('shopro.api_host') . $attachment['data']);
// $this->success($res['msg'], config('shopro.api_host') . $attachment['data']);
// }
// }
...
@@ -227,6 +232,7 @@ class AiTryon extends Common
...
@@ -227,6 +232,7 @@ class AiTryon extends Common
// 'goods_title' => $params['goods_title'],
// 'goods_title' => $params['goods_title'],
// 'goods_subtitle' => $params['goods_subtitle'],
// 'goods_subtitle' => $params['goods_subtitle'],
// 'goods_image' => $params['jewelry_image'],
// 'goods_image' => $params['jewelry_image'],
// 'person_image' => $params['person_image'],
// 'ai_type' => 1,
// 'ai_type' => 1,
// ];
// ];
//
//
...
@@ -245,6 +251,10 @@ class AiTryon extends Common
...
@@ -245,6 +251,10 @@ class AiTryon extends Common
// $tryonData['ai_task_id'] = isset($res['data']) ? $res['data'] : '';
// $tryonData['ai_task_id'] = isset($res['data']) ? $res['data'] : '';
// $tryonModel->save($tryonData);
// $tryonModel->save($tryonData);
// $id = $tryonModel->id;
// $id = $tryonModel->id;
// //试戴次数+1
// $userService = new User();
// $res = $userService->addTryTimes($user->id);
//
//
// // 推送队列
// // 推送队列
// \think\Queue::push('\addons\shopro\job\AiVideoGen@save', ['taskid' => $res['data'], 'user' => $user], 'shopro-high');
// \think\Queue::push('\addons\shopro\job\AiVideoGen@save', ['taskid' => $res['data'], 'user' => $user], 'shopro-high');
...
...
addons/shopro/listener/Order.php
View file @
9353698a
...
@@ -101,6 +101,7 @@ class Order
...
@@ -101,6 +101,7 @@ class Order
if
(
$order
->
type
==
'goods'
&&
$order
->
deduct_score
){
if
(
$order
->
type
==
'goods'
&&
$order
->
deduct_score
){
// 这里会自动检测订单支付状态
// 这里会自动检测订单支付状态
$order
=
$payOper
->
score
(
$order
,
$order
->
deduct_score
);
$order
=
$payOper
->
score
(
$order
,
$order
->
deduct_score
);
}
}
// 删除购物车
// 删除购物车
...
...
addons/shopro/service/user/User.php
View file @
9353698a
...
@@ -53,9 +53,32 @@ class User
...
@@ -53,9 +53,32 @@ class User
}
else
{
}
else
{
$ai_count
=
intval
(
$res
->
ai_count
)
+
1
;
$ai_count
=
intval
(
$res
->
ai_count
)
+
1
;
}
}
userModel
::
where
(
'id'
,
$user_id
)
->
update
([
'ai_count'
=>
$ai_count
,
'ai_time'
=>
time
()]);
//
userModel::where('id', $user_id)->update(['ai_count' => $ai_count, 'ai_time' => time()]);
return
1
;
// 可以试戴
return
1
;
// 可以试戴
}
}
}
}
/**
* @name 试戴次数+1
* @param int|object $user 会员对象或会员ID
* @return int
*/
public
function
addTryTimes
(
$user_id
)
{
// 查询我的试戴列表
$res
=
userModel
::
where
(
'id'
,
$user_id
)
->
find
();
if
(
$res
->
ai_count
>
4
&&
$res
->
ai_time
>
Time
::
today
()[
0
])
{
return
0
;
// 不可以试戴
}
else
{
if
(
$res
->
ai_time
<
Time
::
today
()[
0
])
{
$ai_count
=
1
;
}
else
{
$ai_count
=
intval
(
$res
->
ai_count
)
+
1
;
}
userModel
::
where
(
'id'
,
$user_id
)
->
update
([
'ai_count'
=>
$ai_count
,
'ai_time'
=>
time
()]);
return
1
;
// 可以试戴
}
}
}
}
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