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
8 months ago
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
97e375f2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
24 additions
and
8 deletions
+24
-8
app/Admin/Controllers/UploadController.php
+4
-1
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()
{
$ossPath
=
request
()
->
post
(
'key'
)
??
''
;
$aliOss
=
new
AilOss
();
if
(
strstr
(
$ossPath
,
'aliyuncs'
)
!==
false
)
{
$res
=
$aliOss
->
delete
(
$ossPath
);
//, 'OSS_BUCKET'
return
$res
?
$this
->
responseDeleted
()
:
$this
->
responseDeleteFailed
(
'文件删除失败'
);
}
else
{
return
$this
->
deleteFileAndResponse
();
}
}
public
function
merchantUpload
()
...
...
This diff is collapsed.
Click to expand it.
app/Handlers/AilOss.php
View file @
830899a9
...
...
@@ -34,6 +34,7 @@ public function upload($object, $filepath, $bucket = 'OSS_BUCKET')
{
$res
=
false
;
$bucket
=
env
(
$bucket
);
//获取阿里云oss的bucket
if
(
self
::
$oss
->
uploadFile
(
$bucket
,
$object
,
$filepath
))
{
//调用uploadFile方法把服务器文件上传到阿里云oss
$res
=
true
;
}
...
...
This diff is collapsed.
Click to expand it.
app/Helper/functions.php
View file @
830899a9
...
...
@@ -31,3 +31,14 @@ function generateRandomString($length = 10)
}
return
$randomString
;
}
function
togetherFilePath
(
$path
=
''
)
{
if
(
$path
)
{
if
(
strstr
(
$path
,
'aliyuncs'
)
===
false
)
{
$path
=
env
(
'IMAGE_URL'
)
.
$path
;
}
}
return
$path
;
}
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/GoodController.php
View file @
830899a9
...
...
@@ -127,7 +127,7 @@ public function getList(Request $request)
'market_price'
=>
sprintf
(
"%.2f"
,
$market_price
),
'goods_price'
=>
$mer_id
?
sprintf
(
"%.2f"
,
$cg_price
)
:
sprintf
(
"%.2f"
,
$market_price
),
'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)
}
//标签
$tags
=
$datum
->
tags
?
json_decode
(
$datum
->
tags
,
true
)
:
[];
$data
[
'list'
][]
=
[
'id'
=>
$datum
->
id
,
'goods_name'
=>
$datum
->
goods_name
,
...
...
@@ -193,7 +194,7 @@ public function getIndexGoods(Request $request)
'market_price'
=>
floor
(
$market_price
),
'goods_price'
=>
$mer_id
?
floor
(
$dg_price
)
:
floor
(
$market_price
),
'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)
$cover
=
[];
if
(
!
empty
(
$cover_arr
))
{
foreach
(
$cover_arr
as
$item
)
{
$cover
[]
=
env
(
'IMAGE_URL'
)
.
$item
;
$cover
[]
=
togetherFilePath
(
$item
)
;
}
}
...
...
@@ -321,7 +322,7 @@ public function getAttrKey(Request $request)
// 'dg_price' => sprintf('%.2f', $cg_price),
'goods_price'
=>
$mer_id
?
sprintf
(
'%.2f'
,
$cg_price
)
:
sprintf
(
'%.2f'
,
$market_price
),
'stock'
=>
$stock
,
'pic'
=>
$attrObj
->
pic
?
env
(
'IMAGE_URL'
)
.
$attrObj
->
pic
:
''
'pic'
=>
$attrObj
->
pic
?
togetherFilePath
(
$attrObj
->
pic
)
:
''
];
return
$this
->
JsonResponse
(
$data
);
}
...
...
This diff is collapsed.
Click to expand it.
app/Http/Controllers/Api/UserCollectController.php
View file @
830899a9
...
...
@@ -70,7 +70,7 @@ public function collectList(Request $request)
'attr'
=>
$attrRowObj
?
$attrRowObj
->
attr_val
:
''
,
'tags'
=>
$tags
,
'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
))
];
}
...
...
This diff is collapsed.
Click to expand it.
config/admin.php
View file @
830899a9
...
...
@@ -262,8 +262,8 @@
'upload'
=>
[
// 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.
'directory'
=>
[
'image'
=>
'images'
,
...
...
This diff is collapsed.
Click to expand it.
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