Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
U
uc_card
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhoujun
uc_card
Commits
17dfde88
Commit
17dfde88
authored
Jun 09, 2021
by
zhoujun
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test'
parents
7631dbec
4573e02b
Pipeline
#1600
passed with stage
in 0 seconds
Changes
8
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
217 additions
and
117 deletions
+217
-117
src/app/Console/Commands/UploadOOSImg.php
src/app/Console/Commands/UploadOOSImg.php
+65
-0
src/app/Console/Kernel.php
src/app/Console/Kernel.php
+2
-3
src/app/Http/Controllers/Admin/AdminController.php
src/app/Http/Controllers/Admin/AdminController.php
+11
-1
src/app/Http/Controllers/Card/CardController.php
src/app/Http/Controllers/Card/CardController.php
+116
-100
src/app/Services/AldGmService.php
src/app/Services/AldGmService.php
+4
-4
src/app/Services/UploadServer.php
src/app/Services/UploadServer.php
+4
-6
src/config/filesystems.php
src/config/filesystems.php
+1
-1
src/resources/views/admin/img.blade.php
src/resources/views/admin/img.blade.php
+14
-2
No files found.
src/app/Console/Commands/UploadOOSImg.php
0 → 100644
View file @
17dfde88
<?php
namespace
App\Console\Commands
;
use
Carbon\Carbon
;
use
Illuminate\Console\Command
;
use
App\Models\WxUserImg
;
use
App\Services\UploadServer
;
use
Illuminate\Support\Facades\Cache
;
use
Illuminate\Support\Facades\DB
;
class
UploadOOSImg
extends
Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected
$signature
=
'UploadOOSImg'
;
/**
* The console command description.
*
* @var string
*/
protected
$description
=
'上传云图片'
;
/**
* @var ActivityOrder
*/
/**
* Create a new command instance.
* @param ProductOrder $productOrder
* @param ScoreDetail $scoreDetail
*/
public
function
__construct
()
{
parent
::
__construct
();
}
/**
* Execute the console command.
*
* @return mixed
*/
public
function
handle
()
{
set_time_limit
(
0
);
$this
->
line
(
'开始'
);
$imgs
=
WxUserImg
::
where
(
'is_upload'
,
0
)
->
where
(
'status'
,
1
)
->
select
(
'id'
,
'loacl_url'
,
'img_url'
,
'is_upload'
)
->
limit
(
300
)
->
get
();
foreach
(
$imgs
as
$img
){
if
(
$img
->
loacl_url
!=
''
){
$url
=
UploadServer
::
getUploadAliyun
(
'aldzn-img'
,
$img
->
loacl_url
,
public_path
()
.
'/'
.
$img
->
loacl_url
);
if
(
$url
){
$img
->
is_upload
=
1
;
$img
->
img_url
=
$url
;
$img
->
save
();
if
(
$img
->
loacl_url
!=
''
&&
file_exists
(
public_path
()
.
'/'
.
$img
->
loacl_url
))
unlink
(
public_path
()
.
'/'
.
$img
->
loacl_url
);
}
}
}
$this
->
line
(
'结束'
);
}
}
\ No newline at end of file
src/app/Console/Kernel.php
View file @
17dfde88
...
...
@@ -13,7 +13,7 @@ class Kernel extends ConsoleKernel
* @var array
*/
protected
$commands
=
[
//
'App\Console\Commands\UploadOOSImg'
,
];
/**
...
...
@@ -24,8 +24,7 @@ class Kernel extends ConsoleKernel
*/
protected
function
schedule
(
Schedule
$schedule
)
{
// $schedule->command('inspire')
// ->hourly();
$schedule
->
command
(
'UploadOOSImg'
)
->
everyMinute
()
->
withoutOverlapping
(
5
);
}
/**
...
...
src/app/Http/Controllers/Admin/AdminController.php
View file @
17dfde88
...
...
@@ -95,7 +95,7 @@ class AdminController extends Controller
return
$query
->
where
(
'updated_at'
,
'<'
,
$endTime
);
})
->
when
(
$status
==
0
,
function
(
$query
)
use
(
$status
)
{
return
$query
->
orderBy
(
'status'
,
'ASC'
);
})
->
orderBy
(
'updated_at'
,
'DESC'
)
->
select
(
'id'
,
'uid'
,
'
img_url'
,
'status
'
,
'updated_at'
)
->
paginate
(
$pageNum
);
})
->
orderBy
(
'updated_at'
,
'DESC'
)
->
select
(
'id'
,
'uid'
,
'
loacl_url'
,
'img_url'
,
'status'
,
'is_upload
'
,
'updated_at'
)
->
paginate
(
$pageNum
);
if
(
$startTime
!=
''
)
$paginateAppends
[
'startTime'
]
=
$startTime
;
if
(
$endTime
!=
''
)
$paginateAppends
[
'endTime'
]
=
$endTime
;
if
(
$userName
!=
''
)
$paginateAppends
[
'user'
]
=
$userName
;
...
...
@@ -144,6 +144,16 @@ class AdminController extends Controller
$ids
=
explode
(
'#'
,
$postData
[
'ids'
]);
$status
=
$postData
[
'status'
];
if
(
!
in_array
(
$status
,[
1
,
2
])
||
empty
(
$ids
))
return
$this
->
getErrorMsg
(
'10060'
,
'参数错误'
);
// $imgs = WxUserImg::whereIn('id',$ids)->select('id','loacl_url','status')->get();
// $result = true;
// foreach($imgs as $img){
// $img->status = 1;
// if($img->save()){
// if($status == 2) unlink(storage_path('app').'/'.$img->loacl_url);
// }else{
// $result = false;
// }
// }
$result
=
WxUserImg
::
whereIn
(
'id'
,
$ids
)
->
update
([
'status'
=>
$status
]);
if
(
$result
)
return
$this
->
getSuccessMsg
([]);
return
$this
->
getErrorMsg
(
'10063'
,
'审核失败'
);
...
...
src/app/Http/Controllers/Card/CardController.php
View file @
17dfde88
This diff is collapsed.
Click to expand it.
src/app/Services/AldGmService.php
View file @
17dfde88
...
...
@@ -141,8 +141,8 @@ class AldGmService {
curl_setopt
(
$curl
,
CURLOPT_CUSTOMREQUEST
,
"POST"
);
curl_setopt
(
$curl
,
CURLOPT_POST
,
count
(
$submitData
));
curl_setopt
(
$curl
,
CURLOPT_POSTFIELDS
,
$submitData
);
curl_setopt
(
$curl
,
CURLOPT_CONNECTTIMEOUT
,
30
);
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
30
);
curl_setopt
(
$curl
,
CURLOPT_CONNECTTIMEOUT
,
5
);
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
5
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
$result
=
curl_exec
(
$curl
);
curl_close
(
$curl
);
...
...
@@ -160,8 +160,8 @@ class AldGmService {
$url
.=
"?"
.
http_build_query
(
$submitData
);
curl_setopt
(
$curl
,
CURLOPT_URL
,
$url
);
curl_setopt
(
$curl
,
CURLOPT_CUSTOMREQUEST
,
"GET"
);
curl_setopt
(
$curl
,
CURLOPT_CONNECTTIMEOUT
,
30
);
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
30
);
curl_setopt
(
$curl
,
CURLOPT_CONNECTTIMEOUT
,
5
);
curl_setopt
(
$curl
,
CURLOPT_TIMEOUT
,
5
);
curl_setopt
(
$curl
,
CURLOPT_RETURNTRANSFER
,
1
);
$result
=
curl_exec
(
$curl
);
curl_close
(
$curl
);
...
...
src/app/Services/UploadServer.php
View file @
17dfde88
...
...
@@ -38,7 +38,7 @@ class UploadServer
return
$array
;
}
$originName
=
$file
->
getClientOriginalName
();
self
::
getCheckDir
(
storage_path
(
'app'
),
'card'
);
self
::
getCheckDir
(
public_path
(
),
'card'
);
$fileUrl
=
self
::
getUploadFile
(
$file
,
'card'
,
'aldzn-img'
,
$originName
);
if
(
$fileUrl
[
'error'
]
!=
''
){
$array
[
'code'
]
=
10059
;
...
...
@@ -102,7 +102,8 @@ class UploadServer
$realPath
=
$file
->
getRealPath
();
if
(
Storage
::
disk
(
'upload'
)
->
put
(
$path
.
'/'
.
$fileName
,
file_get_contents
(
$realPath
))){
$imgUrl
[
'url'
]
=
$folder
.
'/'
.
date
(
'Ym'
)
.
'/'
.
date
(
'd'
)
.
'/'
.
$fileName
;
$imgUrl
[
'yunUrl'
]
=
self
::
getUploadAliyun
(
$bucket
,
$folder
.
'/'
.
date
(
'Ym'
)
.
'/'
.
date
(
'd'
)
.
'/'
.
$fileName
,
storage_path
(
'app'
)
.
'/'
.
$imgUrl
[
'url'
]);
$imgUrl
[
'yunUrl'
]
=
''
;
//$imgUrl['yunUrl'] = self::getUploadAliyun($bucket, $folder.'/'.date('Ym').'/'.date('d').'/'.$fileName,storage_path('app').'/'.$imgUrl['url']);
}
else
{
$imgUrl
[
'error'
]
=
'文件上传失败!'
;
}
...
...
@@ -128,10 +129,7 @@ class UploadServer
$client
=
$manager
->
init
(
$aliyunConfig
);
$result
=
$client
->
uploadFile
(
$object
,
$fileUrl
);
if
(
$result
==
false
){
exit
(
$client
->
getError
());
}
if
(
$result
==
false
)
return
false
;
unset
(
$result
,
$manager
,
$client
);
return
config
(
'sign.OSS_CDN'
)
.
$object
;
}
...
...
src/config/filesystems.php
View file @
17dfde88
...
...
@@ -50,7 +50,7 @@ return [
'upload'
=>
[
'driver'
=>
'local'
,
'root'
=>
storage_path
(
'app'
),
'root'
=>
public_path
(
),
],
'public'
=>
[
...
...
src/resources/views/admin/img.blade.php
View file @
17dfde88
...
...
@@ -67,9 +67,21 @@
@
if
(
$li
->
status
==
1
)
审核通过
@
endif
@
if
(
$li
->
status
==
2
)
审核拒绝
@
endif
</
td
>
<
td
><
img
src
=
"{{
$li->img_url
}}"
width
=
"50px"
height
=
"30px"
></
td
>
<
td
>
@
if
(
$li
->
status
==
1
&&
$li
->
is_upload
)
<
img
src
=
"{{
$li->img_url
}}"
width
=
"50px"
height
=
"30px"
>
@
else
<
img
src
=
"/{{
$li->loacl_url
}}"
width
=
"50px"
height
=
"30px"
>
@
endif
</
td
>
<
td
>
{{
@
$li
->
updated_at
}}
</
td
>
<
td
>
<
button
type
=
"button"
class
=
"btn btn-default"
onclick
=
"return showImg('{{
$li->img_url
}}');"
>
查看
</
button
></
td
>
<
td
>
@
if
(
$li
->
status
==
1
&&
$li
->
is_upload
)
<
button
type
=
"button"
class
=
"btn btn-default"
onclick
=
"return showImg('{{
$li->img_url
}}');"
>
查看
</
button
>
@
else
<
button
type
=
"button"
class
=
"btn btn-default"
onclick
=
"return showImg('/{{
$li->loacl_url
}}');"
>
查看
</
button
>
@
endif
</
td
>
</
tr
>
@
endforeach
...
...
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