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
830899a9
Commit
830899a9
authored
Nov 05, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
97e375f2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
26 additions
and
10 deletions
+26
-10
app/Admin/Controllers/UploadController.php
+6
-3
app/Handlers/AilOss.php
+1
-0
app/Helper/functions.php
+11
-0
app/Http/Controllers/Api/GoodController.php
+5
-4
app/Http/Controllers/Api/UserCollectController.php
+1
-1
config/admin.php
+2
-2
No files found.
app/Admin/Controllers/UploadController.php
View file @
830899a9
...
@@ -32,9 +32,12 @@ public function deletePublicOssFile()
...
@@ -32,9 +32,12 @@ public function deletePublicOssFile()
{
{
$ossPath
=
request
()
->
post
(
'key'
)
??
''
;
$ossPath
=
request
()
->
post
(
'key'
)
??
''
;
$aliOss
=
new
AilOss
();
$aliOss
=
new
AilOss
();
if
(
strstr
(
$ossPath
,
'aliyuncs'
)
!==
false
)
{
$res
=
$aliOss
->
delete
(
$ossPath
);
//, 'OSS_BUCKET'
$res
=
$aliOss
->
delete
(
$ossPath
);
//, 'OSS_BUCKET'
return
$res
?
$this
->
responseDeleted
()
:
$this
->
responseDeleteFailed
(
'文件删除失败'
);
return
$res
?
$this
->
responseDeleted
()
:
$this
->
responseDeleteFailed
(
'文件删除失败'
);
}
else
{
return
$this
->
deleteFileAndResponse
();
}
}
}
public
function
merchantUpload
()
public
function
merchantUpload
()
...
...
app/Handlers/AilOss.php
View file @
830899a9
...
@@ -34,6 +34,7 @@ public function upload($object, $filepath, $bucket = 'OSS_BUCKET')
...
@@ -34,6 +34,7 @@ public function upload($object, $filepath, $bucket = 'OSS_BUCKET')
{
{
$res
=
false
;
$res
=
false
;
$bucket
=
env
(
$bucket
);
//获取阿里云oss的bucket
$bucket
=
env
(
$bucket
);
//获取阿里云oss的bucket
if
(
self
::
$oss
->
uploadFile
(
$bucket
,
$object
,
$filepath
))
{
//调用uploadFile方法把服务器文件上传到阿里云oss
if
(
self
::
$oss
->
uploadFile
(
$bucket
,
$object
,
$filepath
))
{
//调用uploadFile方法把服务器文件上传到阿里云oss
$res
=
true
;
$res
=
true
;
}
}
...
...
app/Helper/functions.php
View file @
830899a9
...
@@ -31,3 +31,14 @@ function generateRandomString($length = 10)
...
@@ -31,3 +31,14 @@ function generateRandomString($length = 10)
}
}
return
$randomString
;
return
$randomString
;
}
}
function
togetherFilePath
(
$path
=
''
)
{
if
(
$path
)
{
if
(
strstr
(
$path
,
'aliyuncs'
)
===
false
)
{
$path
=
env
(
'IMAGE_URL'
)
.
$path
;
}
}
return
$path
;
}
app/Http/Controllers/Api/GoodController.php
View file @
830899a9
...
@@ -127,7 +127,7 @@ public function getList(Request $request)
...
@@ -127,7 +127,7 @@ public function getList(Request $request)
'market_price'
=>
sprintf
(
"%.2f"
,
$market_price
),
'market_price'
=>
sprintf
(
"%.2f"
,
$market_price
),
'goods_price'
=>
$mer_id
?
sprintf
(
"%.2f"
,
$cg_price
)
:
sprintf
(
"%.2f"
,
$market_price
),
'goods_price'
=>
$mer_id
?
sprintf
(
"%.2f"
,
$cg_price
)
:
sprintf
(
"%.2f"
,
$market_price
),
'tags'
=>
$tags
,
'tags'
=>
$tags
,
'cover_img'
=>
(
isset
(
$goodsObj
->
cover_img
)
?
env
(
'IMAGE_URL'
)
.
$goodsObj
->
cover_img
:
''
),
'cover_img'
=>
(
isset
(
$goodsObj
->
cover_img
)
?
togetherFilePath
(
$goodsObj
->
cover_img
)
:
''
),
];
];
}
}
}
}
...
@@ -185,6 +185,7 @@ public function getIndexGoods(Request $request)
...
@@ -185,6 +185,7 @@ public function getIndexGoods(Request $request)
}
}
//标签
//标签
$tags
=
$datum
->
tags
?
json_decode
(
$datum
->
tags
,
true
)
:
[];
$tags
=
$datum
->
tags
?
json_decode
(
$datum
->
tags
,
true
)
:
[];
$data
[
'list'
][]
=
[
$data
[
'list'
][]
=
[
'id'
=>
$datum
->
id
,
'id'
=>
$datum
->
id
,
'goods_name'
=>
$datum
->
goods_name
,
'goods_name'
=>
$datum
->
goods_name
,
...
@@ -193,7 +194,7 @@ public function getIndexGoods(Request $request)
...
@@ -193,7 +194,7 @@ public function getIndexGoods(Request $request)
'market_price'
=>
floor
(
$market_price
),
'market_price'
=>
floor
(
$market_price
),
'goods_price'
=>
$mer_id
?
floor
(
$dg_price
)
:
floor
(
$market_price
),
'goods_price'
=>
$mer_id
?
floor
(
$dg_price
)
:
floor
(
$market_price
),
'tags'
=>
$tags
,
'tags'
=>
$tags
,
'cover_img'
=>
(
$datum
->
cover_img
)
?
env
(
'IMAGE_URL'
)
.
$datum
->
cover_img
:
''
,
'cover_img'
=>
togetherFilePath
(
$datum
->
cover_img
)
,
];
];
}
}
}
}
...
@@ -228,7 +229,7 @@ public function getDetail(Request $request)
...
@@ -228,7 +229,7 @@ public function getDetail(Request $request)
$cover
=
[];
$cover
=
[];
if
(
!
empty
(
$cover_arr
))
{
if
(
!
empty
(
$cover_arr
))
{
foreach
(
$cover_arr
as
$item
)
{
foreach
(
$cover_arr
as
$item
)
{
$cover
[]
=
env
(
'IMAGE_URL'
)
.
$item
;
$cover
[]
=
togetherFilePath
(
$item
)
;
}
}
}
}
...
@@ -321,7 +322,7 @@ public function getAttrKey(Request $request)
...
@@ -321,7 +322,7 @@ public function getAttrKey(Request $request)
// 'dg_price' => sprintf('%.2f', $cg_price),
// 'dg_price' => sprintf('%.2f', $cg_price),
'goods_price'
=>
$mer_id
?
sprintf
(
'%.2f'
,
$cg_price
)
:
sprintf
(
'%.2f'
,
$market_price
),
'goods_price'
=>
$mer_id
?
sprintf
(
'%.2f'
,
$cg_price
)
:
sprintf
(
'%.2f'
,
$market_price
),
'stock'
=>
$stock
,
'stock'
=>
$stock
,
'pic'
=>
$attrObj
->
pic
?
env
(
'IMAGE_URL'
)
.
$attrObj
->
pic
:
''
'pic'
=>
$attrObj
->
pic
?
togetherFilePath
(
$attrObj
->
pic
)
:
''
];
];
return
$this
->
JsonResponse
(
$data
);
return
$this
->
JsonResponse
(
$data
);
}
}
...
...
app/Http/Controllers/Api/UserCollectController.php
View file @
830899a9
...
@@ -70,7 +70,7 @@ public function collectList(Request $request)
...
@@ -70,7 +70,7 @@ public function collectList(Request $request)
'attr'
=>
$attrRowObj
?
$attrRowObj
->
attr_val
:
''
,
'attr'
=>
$attrRowObj
?
$attrRowObj
->
attr_val
:
''
,
'tags'
=>
$tags
,
'tags'
=>
$tags
,
'goods_price'
=>
$merchant_id
?
sprintf
(
"%.2f"
,
$attrRowObj
->
cg_price
)
:
sprintf
(
"%.2f"
,
$attrRowObj
->
market_price
),
'goods_price'
=>
$merchant_id
?
sprintf
(
"%.2f"
,
$attrRowObj
->
cg_price
)
:
sprintf
(
"%.2f"
,
$attrRowObj
->
market_price
),
'cover_img'
=>
(
$goodObj
->
cover_img
?
env
(
'IMAGE_URL'
)
.
$goodObj
->
cover_img
:
''
),
'cover_img'
=>
(
$goodObj
->
cover_img
?
togetherFilePath
(
$goodObj
->
cover_img
)
:
''
),
'addtime'
=>
date
(
'Y-m-d H:i:s'
,
strtotime
(
$datum
->
created_at
))
'addtime'
=>
date
(
'Y-m-d H:i:s'
,
strtotime
(
$datum
->
created_at
))
];
];
}
}
...
...
config/admin.php
View file @
830899a9
...
@@ -262,8 +262,8 @@
...
@@ -262,8 +262,8 @@
'upload'
=>
[
'upload'
=>
[
// Disk in `config/filesystem.php`.
// Disk in `config/filesystem.php`.
'disk'
=>
'
public_oss
'
,
//admin
'disk'
=>
'
admin
'
,
//admin
'extra_disk'
=>
'public_oss'
,
//扩展oss,原系统不兼容
// Image and file upload path under the disk above.
// Image and file upload path under the disk above.
'directory'
=>
[
'directory'
=>
[
'image'
=>
'images'
,
'image'
=>
'images'
,
...
...
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