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
8b105e87
Commit
8b105e87
authored
Nov 05, 2024
by
lizhilin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
更新
parent
830899a9
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
5 deletions
+13
-5
app/Handlers/AilOss.php
+8
-0
app/Http/Controllers/Api/GoodController.php
+1
-1
app/Http/Controllers/Api/OrderController.php
+4
-4
No files found.
app/Handlers/AilOss.php
View file @
8b105e87
...
...
@@ -2,7 +2,9 @@
namespace
App\Handlers
;
use
Exception
;
use
OSS\OssClient
;
use
OSS\Core\OssException
;
require_once
'../vendor/aliyuncs/oss-sdk-php/autoload.php'
;
...
...
@@ -35,6 +37,12 @@ public function upload($object, $filepath, $bucket = 'OSS_BUCKET')
$res
=
false
;
$bucket
=
env
(
$bucket
);
//获取阿里云oss的bucket
try
{
self
::
$oss
->
uploadFile
(
$bucket
,
$object
,
$filepath
);
}
catch
(
OssException
$e
)
{
print_r
(
$e
->
getMessage
());
die
;
}
if
(
self
::
$oss
->
uploadFile
(
$bucket
,
$object
,
$filepath
))
{
//调用uploadFile方法把服务器文件上传到阿里云oss
$res
=
true
;
}
...
...
app/Http/Controllers/Api/GoodController.php
View file @
8b105e87
...
...
@@ -63,7 +63,7 @@ public function getCatGoodList(Request $request)
'goods_name'
=>
$datum
->
goods_name
,
'goods_price'
=>
$datum
->
goods_price
,
'goods_brief'
=>
$datum
->
goods_brief
,
'cover_img'
=>
$datum
->
cover_img
?
env
(
'IMAGE_URL'
)
.
$datum
->
cover_img
:
''
,
'cover_img'
=>
$datum
->
cover_img
?
togetherFilePath
(
$datum
->
cover_img
)
:
''
,
];
}
}
...
...
app/Http/Controllers/Api/OrderController.php
View file @
8b105e87
...
...
@@ -47,7 +47,7 @@ public function CheckoutBuyOrder(Request $request)
$data
=
[];
$data
[
'goods_id'
]
=
$goods_id
;
$data
[
'goods_name'
]
=
$goodsObj
->
goods_name
;
$data
[
'goods_img'
]
=
$goodsObj
->
cover_img
?
env
(
'IMAGE_URL'
)
.
$goodsObj
->
cover_img
:
''
;
$data
[
'goods_img'
]
=
$goodsObj
->
cover_img
?
togetherFilePath
(
$goodsObj
->
cover_img
)
:
''
;
$data
[
'num'
]
=
$num
;
$data
[
'attr_id'
]
=
$attr_id
;
$data
[
'goods_price'
]
=
$goods_price
;
...
...
@@ -350,7 +350,7 @@ public function orderList(Request $request)
$tmp
[
'goods_number'
]
=
$valObj
->
goods_number
;
$tmp
[
'goods_attr'
]
=
$valObj
->
goods_attr
;
$tmp
[
'goods_price'
]
=
$valObj
->
goods_price
;
$tmp
[
'goods_img'
]
=
$valObj
->
goods_img
?
env
(
'IMAGE_URL'
)
.
$valObj
->
goods_img
:
''
;
$tmp
[
'goods_img'
]
=
$valObj
->
goods_img
?
togetherFilePath
(
$valObj
->
goods_img
)
:
''
;
$tmp
[
'is_comment'
]
=
$valObj
->
is_comment
;
array_push
(
$order_goods
,
$tmp
);
}
...
...
@@ -610,7 +610,7 @@ private function getOrderGoods($oid)
$tmp
[
'goods_attr'
]
=
$valObj
->
goods_attr
;
$tmp
[
'goods_price'
]
=
$valObj
->
goods_price
;
$tmp
[
'is_comment'
]
=
$valObj
->
is_comment
;
$tmp
[
'goods_img'
]
=
$valObj
->
goods_img
?
env
(
'IMAGE_URL'
)
.
$valObj
->
goods_img
:
''
;
$tmp
[
'goods_img'
]
=
$valObj
->
goods_img
?
togetherFilePath
(
$valObj
->
goods_img
)
:
''
;
array_push
(
$order_goods
,
$tmp
);
}
return
$order_goods
;
...
...
@@ -639,7 +639,7 @@ public function CheckoutCartOrder(Request $request)
$tmp
[
'num'
]
=
$item
[
'num'
];
$tmp
[
'goods_price'
]
=
sprintf
(
'%.2f'
,
$item
[
'goods_price'
]);
$tmp
[
'attr_name'
]
=
$item
[
'attr_txt'
];
$tmp
[
'goods_img'
]
=
$goodsObj
->
cover_img
?
env
(
'IMAGE_URL'
)
.
$goodsObj
->
cover_img
:
''
;
$tmp
[
'goods_img'
]
=
$goodsObj
->
cover_img
?
togetherFilePath
(
$goodsObj
->
cover_img
)
:
''
;
$tmp
[
'attr_id'
]
=
$item
[
'attr_id'
];
array_push
(
$data
,
$tmp
);
...
...
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