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
Jul 24, 2018
by
rlgy
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
app上传
parent
a11223f7
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
43 additions
and
8 deletions
+43
-8
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
+3
-6
No files found.
backend/controllers/AppController.php
View file @
8a9bbf4d
...
@@ -10,6 +10,7 @@ namespace backend\controllers;
...
@@ -10,6 +10,7 @@ namespace backend\controllers;
use
Yii
;
use
Yii
;
use
common\models\pwallet\AppVersion
;
use
common\models\pwallet\AppVersion
;
use
yii\web\UploadedFile
;
class
AppController
extends
BaseController
class
AppController
extends
BaseController
...
@@ -88,4 +89,17 @@ class AppController extends BaseController
...
@@ -88,4 +89,17 @@ class AppController extends BaseController
}
}
return
[
'code'
=>
1
,
'msg'
=>
'failed'
];
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
backend/views/app/list.php
View file @
8a9bbf4d
...
@@ -82,6 +82,14 @@ $this->registerJsFile('@web/js/app/index.js');
...
@@ -82,6 +82,14 @@ $this->registerJsFile('@web/js/app/index.js');
<input
type=
"text"
name=
"download_url"
placeholder=
""
autocomplete=
"off"
class=
"layui-input"
>
<input
type=
"text"
name=
"download_url"
placeholder=
""
autocomplete=
"off"
class=
"layui-input"
>
</div>
</div>
</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"
>
<div
class=
"layui-form-item layui-form-text"
>
<label
class=
"layui-form-label"
style=
"width: 100px;"
>
更新日志
</label>
<label
class=
"layui-form-label"
style=
"width: 100px;"
>
更新日志
</label>
<div
class=
"layui-input-block"
>
<div
class=
"layui-input-block"
>
...
...
backend/web/js/app/index.js
View file @
8a9bbf4d
var
table1
=
layui
.
table
;
var
table1
=
layui
.
table
;
var
table2
=
layui
.
table
;
var
table2
=
layui
.
table
;
var
form
=
layui
.
form
;
var
form
=
layui
.
form
;
var
upload
=
layui
.
upload
;
var
type
=
[
var
type
=
[
{
code
:
0
,
name
:
''
},
{
code
:
0
,
name
:
''
},
{
code
:
1
,
name
:
'安卓稳定版'
},
{
code
:
1
,
name
:
'安卓稳定版'
},
...
@@ -61,6 +62,22 @@ table2.render({
...
@@ -61,6 +62,22 @@ table2.render({
]]
]]
});
});
form
.
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
)
{
layui
.
table
.
on
(
'tool(table)'
,
function
(
obj
)
{
var
data
=
obj
.
data
;
var
data
=
obj
.
data
;
var
event
=
obj
.
event
;
var
event
=
obj
.
event
;
...
...
backend/web/upload/016eeec45869d0830993dd19b71cc2c6.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
backend/web/upload/1
deleted
100755 → 0
View file @
a11223f7
123
\ No newline at end of file
backend/web/upload/24bd8be4ade57eb6ca27014d05751254.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
backend/web/upload/5558fcd4eee4ed2650ae1306f07bc4b0.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
backend/web/upload/74fe3396d43ff581114c1aba21f73475.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
backend/web/upload/bc395f560c91a3c7cdaa556961d82e6e.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
backend/web/upload/d5c11e9740d2fdf85f4422f344a9f430.jpg
deleted
100644 → 0
View file @
a11223f7
252 KB
common/components/uploader/Uploader.php
View file @
8a9bbf4d
...
@@ -49,11 +49,12 @@ class Uploader extends Component
...
@@ -49,11 +49,12 @@ class Uploader extends Component
}
}
$this
->
absolute
=
rtrim
(
str_replace
(
'\\'
,
'/'
,
$this
->
absolute
),
'/'
)
.
'/'
;
$this
->
absolute
=
rtrim
(
str_replace
(
'\\'
,
'/'
,
$this
->
absolute
),
'/'
)
.
'/'
;
try
{
if
(
empty
(
$this
->
upload_class
))
{
if
(
empty
(
$this
->
upload_class
))
{
//默认保存到本地
//默认保存到本地
$uploaded_file
->
saveAs
(
$this
->
absolute
.
$savename
);
if
(
$uploaded_file
->
saveAs
(
$this
->
absolute
.
$savename
))
{
return
rtrim
(
$this
->
baseuri
,
'/'
)
.
'/'
.
$savename
;
return
rtrim
(
$this
->
baseuri
,
'/'
)
.
'/'
.
$savename
;
}
throw
new
Exception
(
3
,
'保存文件失败'
);
}
else
{
}
else
{
if
(
class_exists
(
$this
->
upload_class
))
{
if
(
class_exists
(
$this
->
upload_class
))
{
if
(
method_exists
(
$this
->
upload_class
,
$this
->
upload_method
))
{
if
(
method_exists
(
$this
->
upload_class
,
$this
->
upload_method
))
{
...
@@ -65,9 +66,6 @@ class Uploader extends Component
...
@@ -65,9 +66,6 @@ class Uploader extends Component
}
}
throw
new
Exception
(
1
,
'upload class not exists.'
);
throw
new
Exception
(
1
,
'upload class not exists.'
);
}
}
}
catch
(
Exception
$exception
)
{
throw
$exception
;
}
}
}
}
}
\ No newline at end of file
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