Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
token
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
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
wallet
token
Commits
8a9bbf4d
Commit
8a9bbf4d
authored
6 years ago
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app上传
parent
a11223f7
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
53 additions
and
17 deletions
+53
-17
AppController.php
backend/controllers/AppController.php
+15
-0
list.php
backend/views/app/list.php
+8
-0
index.js
backend/web/js/app/index.js
+17
-0
016eeec45869d0830993dd19b71cc2c6.jpg
backend/web/upload/016eeec45869d0830993dd19b71cc2c6.jpg
+0
-0
1
backend/web/upload/1
+0
-2
24bd8be4ade57eb6ca27014d05751254.jpg
backend/web/upload/24bd8be4ade57eb6ca27014d05751254.jpg
+0
-0
5558fcd4eee4ed2650ae1306f07bc4b0.jpg
backend/web/upload/5558fcd4eee4ed2650ae1306f07bc4b0.jpg
+0
-0
74fe3396d43ff581114c1aba21f73475.jpg
backend/web/upload/74fe3396d43ff581114c1aba21f73475.jpg
+0
-0
bc395f560c91a3c7cdaa556961d82e6e.jpg
backend/web/upload/bc395f560c91a3c7cdaa556961d82e6e.jpg
+0
-0
d5c11e9740d2fdf85f4422f344a9f430.jpg
backend/web/upload/d5c11e9740d2fdf85f4422f344a9f430.jpg
+0
-0
Uploader.php
common/components/uploader/Uploader.php
+13
-15
No files found.
backend/controllers/AppController.php
View file @
8a9bbf4d
...
...
@@ -10,6 +10,7 @@ namespace backend\controllers;
use
Yii
;
use
common\models\pwallet\AppVersion
;
use
yii\web\UploadedFile
;
class
AppController
extends
BaseController
...
...
@@ -88,4 +89,17 @@ class AppController extends BaseController
}
return
[
'code'
=>
1
,
'msg'
=>
'failed'
];
}
public
function
actionUpload
()
{
Yii
::
$app
->
response
->
format
=
'json'
;
$apk
=
UploadedFile
::
getInstanceByName
(
'apk'
);
try
{
$filepath
=
Yii
::
$app
->
uploader
->
upload
(
$apk
);
return
[
'code'
=>
0
,
'msg'
=>
'succeed'
,
'path'
=>
$filepath
];
}
catch
(
\Exception
$e
)
{
return
[
'code'
=>
$e
->
getCode
(),
'msg'
=>
$e
->
getMessage
()];
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/views/app/list.php
View file @
8a9bbf4d
...
...
@@ -82,6 +82,14 @@ $this->registerJsFile('@web/js/app/index.js');
<input
type=
"text"
name=
"download_url"
placeholder=
""
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
<div
class=
"layui-form-item"
>
<label
class=
"layui-form-label"
style=
"width: 100px;"
>
上传APP
</label>
<div
class=
"layui-input-block"
>
<button
type=
"button"
class=
"layui-btn"
id=
"upload1"
>
<i
class=
"layui-icon"
>

</i>
上传
</button>
</div>
</div>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
style=
"width: 100px;"
>
更新日志
</label>
<div
class=
"layui-input-block"
>
...
...
This diff is collapsed.
Click to expand it.
backend/web/js/app/index.js
View file @
8a9bbf4d
var
table1
=
layui
.
table
;
var
table2
=
layui
.
table
;
var
form
=
layui
.
form
;
var
upload
=
layui
.
upload
;
var
type
=
[
{
code
:
0
,
name
:
''
},
{
code
:
1
,
name
:
'安卓稳定版'
},
...
...
@@ -61,6 +62,22 @@ table2.render({
]]
});
form
.
render
();
upload
.
render
({
elem
:
'#upload1'
,
url
:
'/admin/app/upload'
,
accept
:
'file'
,
field
:
'apk'
,
data
:
{
_csrf
:
$
(
'input[name="_csrf"]'
).
val
()},
before
:
function
(
obj
)
{
},
done
:
function
(
res
)
{
if
(
0
==
res
.
code
)
{
$
(
'input[name="download_url"]'
).
val
(
res
.
path
);
layer
.
msg
(
res
.
msg
);
}
}
});
layui
.
table
.
on
(
'tool(table)'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
var
event
=
obj
.
event
;
...
...
This diff is collapsed.
Click to expand it.
backend/web/upload/016eeec45869d0830993dd19b71cc2c6.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
This diff is collapsed.
Click to expand it.
backend/web/upload/1
deleted
100755 → 0
View file @
a11223f7
123
\ No newline at end of file
This diff is collapsed.
Click to expand it.
backend/web/upload/24bd8be4ade57eb6ca27014d05751254.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
This diff is collapsed.
Click to expand it.
backend/web/upload/5558fcd4eee4ed2650ae1306f07bc4b0.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
This diff is collapsed.
Click to expand it.
backend/web/upload/74fe3396d43ff581114c1aba21f73475.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
This diff is collapsed.
Click to expand it.
backend/web/upload/bc395f560c91a3c7cdaa556961d82e6e.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
This diff is collapsed.
Click to expand it.
backend/web/upload/d5c11e9740d2fdf85f4422f344a9f430.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
This diff is collapsed.
Click to expand it.
common/components/uploader/Uploader.php
View file @
8a9bbf4d
...
...
@@ -49,24 +49,22 @@ class Uploader extends Component
}
$this
->
absolute
=
rtrim
(
str_replace
(
'\\'
,
'/'
,
$this
->
absolute
),
'/'
)
.
'/'
;
try
{
if
(
empty
(
$this
->
upload_class
))
{
//默认保存到本地
$uploaded_file
->
saveAs
(
$this
->
absolute
.
$savename
);
if
(
empty
(
$this
->
upload_class
))
{
//默认保存到本地
if
(
$uploaded_file
->
saveAs
(
$this
->
absolute
.
$savename
))
{
return
rtrim
(
$this
->
baseuri
,
'/'
)
.
'/'
.
$savename
;
}
else
{
if
(
class_exists
(
$this
->
upload_class
))
{
if
(
method_exists
(
$this
->
upload_class
,
$this
->
upload_method
))
{
$this
->
upload_params
=
array_push
(
$this
->
upload_params
,
$savename
,
$uploaded_file
->
tempName
);
call_user_func_array
([
$this
->
upload_class
,
$this
->
upload_method
],
$this
->
upload_params
);
return
$this
->
baseuri
.
$savename
;
}
throw
new
Exception
(
2
,
'upload method not exists.'
)
;
}
throw
new
Exception
(
3
,
'保存文件失败'
);
}
else
{
if
(
class_exists
(
$this
->
upload_class
))
{
if
(
method_exists
(
$this
->
upload_class
,
$this
->
upload_method
))
{
$this
->
upload_params
=
array_push
(
$this
->
upload_params
,
$savename
,
$uploaded_file
->
tempName
)
;
call_user_func_array
([
$this
->
upload_class
,
$this
->
upload_method
],
$this
->
upload_params
);
return
$this
->
baseuri
.
$savename
;
}
throw
new
Exception
(
1
,
'upload class
not exists.'
);
throw
new
Exception
(
2
,
'upload method
not exists.'
);
}
}
catch
(
Exception
$exception
)
{
throw
$exception
;
throw
new
Exception
(
1
,
'upload class not exists.'
);
}
}
...
...
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