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
1ce55c68
Commit
1ce55c68
authored
Jun 21, 2026
by
刘小敏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
管理后台3D试戴优化
parent
dc00f927
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
64 additions
and
13 deletions
+64
-13
AiTryon.php
addons/shopro/controller/user/AiTryon.php
+22
-2
aityron.js
public/assets/js/backend/shopro/aityron.js
+42
-11
No files found.
addons/shopro/controller/user/AiTryon.php
View file @
1ce55c68
...
...
@@ -112,8 +112,18 @@ class AiTryon extends Common
// 查询商品信息,获取 image 字段
$goods
=
Goods
::
where
(
'id'
,
$params
[
'goods_id'
])
->
find
();
if
(
!
$goods
)
{
$this
->
error
(
'商品不存在'
);
}
// 校验 image_3d 字段值
if
(
empty
(
$goods
[
'image_3d'
]))
{
custom_log
(
'[AI生成图片接口] 商品缺少3D图 user_id:'
.
$user
->
id
.
' goods_id:'
.
$params
[
'goods_id'
],
$user
->
id
,
'gen_ai'
);
$this
->
error
(
'商品缺少3D图,无法试戴'
);
}
$config
=
get_addon_config
(
'hwobs'
);
$goodsImage
=
$
goods
?
$config
[
'cdnurl'
]
.
$goods
->
image
:
''
;
$goodsImage
=
$
config
[
'cdnurl'
]
.
$goods
->
image
;
// 我的试戴
$tryonModel
=
new
AiTryOnModel
();
...
...
@@ -210,8 +220,18 @@ class AiTryon extends Common
// 查询商品信息,获取 image 字段
$goods
=
Goods
::
where
(
'id'
,
$params
[
'goods_id'
])
->
find
();
if
(
!
$goods
)
{
$this
->
error
(
'商品不存在'
);
}
// 校验 image_3d 字段值
if
(
empty
(
$goods
[
'image_3d'
]))
{
custom_log
(
'[AI生成视频接口] 商品缺少3D图 user_id:'
.
$user
->
id
.
' goods_id:'
.
$params
[
'goods_id'
],
$user
->
id
,
'gen_ai'
);
$this
->
error
(
'商品缺少3D图,无法试戴'
);
}
$config
=
get_addon_config
(
'hwobs'
);
$goodsImage
=
$
goods
?
$config
[
'cdnurl'
]
.
$goods
->
image
:
''
;
$goodsImage
=
$
config
[
'cdnurl'
]
.
$goods
->
image
;
// 保存一条 我的试戴
$tryonModel
=
new
AiTryOnModel
();
...
...
public/assets/js/backend/shopro/aityron.js
View file @
1ce55c68
...
...
@@ -21,9 +21,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'bootstrap-daterangep
return
'<span class="text-muted">-</span>'
;
}
return
'<a href="'
+
value
+
'" target="_blank">'
+
'<img src="'
+
value
+
'" style="width:48px;height:48px;object-fit:cover;border-radius:6px;border:1px solid #eee;">'
+
'</a>'
;
return
'<img src="'
+
value
+
'" data-url="'
+
value
+
'" class="img-preview" style="width:48px;height:48px;object-fit:cover;border-radius:6px;border:1px solid #eee;cursor:pointer;" title="点击查看原图">'
;
}
function
renderResultMedia
(
value
,
row
)
{
...
...
@@ -42,7 +40,8 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'bootstrap-daterangep
'</div>'
;
}
return
renderImage
(
value
);
// AI结果图片:点击弹窗显示原图
return
'<img src="'
+
value
+
'" data-url="'
+
value
+
'" class="img-preview" style="width:48px;height:48px;object-fit:cover;border-radius:6px;border:1px solid #eee;cursor:pointer;" title="点击查看原图">'
;
}
function
renderStatus
(
value
,
row
)
{
...
...
@@ -117,7 +116,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'bootstrap-daterangep
formatter
:
function
(
value
)
{
if
(
value
&&
value
.
nickname
)
{
return
'<div class="text-left">'
+
(
value
.
avatar
?
'<img src="'
+
value
.
avatar
+
'" style="width:30px;height:30px;border-radius:50%;vertical-align:middle;margin-right:5px;">'
:
''
)
+
(
value
.
avatar
?
'<img src="'
+
Fast
.
api
.
cdnurl
(
value
.
avatar
)
+
'" style="width:30px;height:30px;border-radius:50%;vertical-align:middle;margin-right:5px;">'
:
''
)
+
'<span style="vertical-align:middle;">'
+
value
.
nickname
+
(
value
.
mobile
?
' ('
+
value
.
mobile
+
')'
:
''
)
+
'</span>'
+
'</div>'
;
}
...
...
@@ -229,6 +228,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'bootstrap-daterangep
table
.
bootstrapTable
(
tableOptions
);
Table
.
api
.
bindevent
(
table
);
// 点击图片弹窗显示大图
$
(
document
).
on
(
'click'
,
'.img-preview'
,
function
()
{
var
url
=
$
(
this
).
data
(
'url'
);
if
(
url
)
{
Layer
.
open
({
type
:
1
,
title
:
false
,
closeBtn
:
1
,
shadeClose
:
true
,
area
:
[
'auto'
,
'auto'
],
content
:
'<img src="'
+
url
+
'" style="max-width:90vw;max-height:90vh;display:block;" />'
});
}
});
// 时间范围选择器
if
(
$
.
fn
.
daterangepicker
)
{
$
(
'#createtime_range'
).
daterangepicker
({
...
...
@@ -324,7 +338,7 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'bootstrap-daterangep
if
(
data
.
user_info
)
{
html
+=
'<tr><th>用户</th><td>'
;
if
(
data
.
user_info
.
avatar
)
{
html
+=
'<img src="'
+
data
.
user_info
.
avatar
+
'" style="width:40px;height:40px;border-radius:50%;vertical-align:middle;margin-right:10px;">'
;
html
+=
'<img src="'
+
Fast
.
api
.
cdnurl
(
data
.
user_info
.
avatar
)
+
'" style="width:40px;height:40px;border-radius:50%;vertical-align:middle;margin-right:10px;">'
;
}
html
+=
'<span style="vertical-align:middle;">'
+
(
data
.
user_info
.
nickname
||
'未知'
)
+
'</span>'
;
if
(
data
.
user_info
.
mobile
)
{
...
...
@@ -339,14 +353,16 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'bootstrap-daterangep
// 图片信息
if
(
data
.
ai_type
==
0
)
{
html
+=
'<tr><th>人物图片</th><td><a href="'
+
data
.
person_image
+
'" target="_blank"><img src="'
+
data
.
person_image
+
'" style="max-width:300px;max-height:300px;"></a></td></tr>'
;
html
+=
'<tr><th>商品图片</th><td><a href="'
+
data
.
goods_image
+
'" target="_blank"><img src="'
+
data
.
goods_image
+
'" style="max-width:300px;max-height:300px;"></a></td></tr>'
;
html
+=
'<tr><th>人物图片</th><td><img src="'
+
data
.
person_image
+
'" data-url="'
+
data
.
person_image
+
'" class="img-preview" style="max-width:300px;max-height:300px;cursor:pointer;" title="点击查看原图"></td></tr>'
;
html
+=
'<tr><th>商品图片</th><td><img src="'
+
data
.
goods_image
+
'" data-url="'
+
data
.
goods_image
+
'" class="img-preview" style="max-width:300px;max-height:300px;cursor:pointer;" title="点击查看原图"></td></tr>'
;
html
+=
'<tr><th>3D图片</th><td><img src="'
+
data
.
image_3d
+
'" data-url="'
+
data
.
image_3d
+
'" class="img-preview" style="max-width:300px;max-height:300px;cursor:pointer;" title="点击查看原图"></td></tr>'
;
if
(
data
.
ai_url
)
{
html
+=
'<tr><th>AI 生成结果</th><td><
a href="'
+
data
.
ai_url
+
'" target="_blank"><img src="'
+
data
.
ai_url
+
'" style="max-width:300px;max-height:300px;"></a
></td></tr>'
;
html
+=
'<tr><th>AI 生成结果</th><td><
img src="'
+
data
.
ai_url
+
'" data-url="'
+
data
.
ai_url
+
'" class="img-preview" style="max-width:300px;max-height:300px;cursor:pointer;" title="点击查看原图"
></td></tr>'
;
}
}
else
{
html
+=
'<tr><th>人物图片</th><td><a href="'
+
data
.
person_image
+
'" target="_blank"><img src="'
+
data
.
person_image
+
'" style="max-width:300px;max-height:300px;"></a></td></tr>'
;
html
+=
'<tr><th>商品图片</th><td><a href="'
+
data
.
goods_image
+
'" target="_blank"><img src="'
+
data
.
goods_image
+
'" style="max-width:300px;max-height:300px;"></a></td></tr>'
;
html
+=
'<tr><th>人物图片</th><td><img src="'
+
data
.
person_image
+
'" data-url="'
+
data
.
person_image
+
'" class="img-preview" style="max-width:300px;max-height:300px;cursor:pointer;" title="点击查看原图"></td></tr>'
;
html
+=
'<tr><th>商品图片</th><td><img src="'
+
data
.
goods_image
+
'" data-url="'
+
data
.
goods_image
+
'" class="img-preview" style="max-width:300px;max-height:300px;cursor:pointer;" title="点击查看原图"></td></tr>'
;
html
+=
'<tr><th>3D图片</th><td><img src="'
+
data
.
image_3d
+
'" data-url="'
+
data
.
image_3d
+
'" class="img-preview" style="max-width:300px;max-height:300px;cursor:pointer;" title="点击查看原图"></td></tr>'
;
if
(
data
.
ai_url
)
{
html
+=
'<tr><th>AI 生成视频</th><td><div style="position:relative;max-width:600px;max-height:400px;border-radius:6px;overflow:hidden;background:#000;">'
+
'<video src="'
+
data
.
ai_url
+
'" controls preload="none" style="width:100%;height:100%;" onclick="this.play()">'
+
...
...
@@ -379,6 +395,21 @@ define(['jquery', 'bootstrap', 'backend', 'table', 'form', 'bootstrap-daterangep
html
+=
'</div>'
;
$
(
'.panel-body'
).
html
(
html
);
// 详情页点击图片弹窗显示大图
$
(
document
).
on
(
'click'
,
'.img-preview'
,
function
()
{
var
url
=
$
(
this
).
data
(
'url'
);
if
(
url
)
{
Layer
.
open
({
type
:
1
,
title
:
false
,
closeBtn
:
1
,
shadeClose
:
true
,
area
:
[
'auto'
,
'auto'
],
content
:
'<img src="'
+
url
+
'" style="max-width:90vw;max-height:90vh;display:block;" />'
});
}
});
}
return
false
;
});
...
...
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