Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
workbiu-admin
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gxx
workbiu-admin
Commits
f4380957
Commit
f4380957
authored
Nov 09, 2017
by
gxx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化项目中现有的代码 以count 判断的 数据
parent
1161bafb
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
4 additions
and
237 deletions
+4
-237
GroupController.php
app/Http/Controllers/GroupController.php
+3
-3
ProjectController.php
app/Http/Controllers/ProjectController.php
+1
-2
Board.php
app/Models/Board.php
+0
-10
BroadcastServiceProvider.php
app/Providers/BroadcastServiceProvider.php
+0
-21
EmailServiceProvider.php
app/Providers/EmailServiceProvider.php
+0
-33
EmailService.php
app/Services/EmailService.php
+0
-113
UploadPhoto.php
app/Util/UploadPhoto.php
+0
-54
app.php
config/app.php
+0
-1
No files found.
app/Http/Controllers/GroupController.php
View file @
f4380957
...
@@ -33,8 +33,8 @@ class GroupController extends Controller
...
@@ -33,8 +33,8 @@ class GroupController extends Controller
{
{
$id
=
$request
->
id
;
$id
=
$request
->
id
;
$groups
=
$this
->
mGroup
->
get
(
$id
);
$groups
=
$this
->
mGroup
->
get
(
$id
);
if
(
count
(
$groups
)
>
0
){
if
(
$groups
){
return
view
(
'admin/group/groupinformation'
,
compact
(
'groups'
));
return
view
(
'admin/group/groupinformation'
,
compact
(
'groups'
));
}
}
...
@@ -55,7 +55,7 @@ class GroupController extends Controller
...
@@ -55,7 +55,7 @@ class GroupController extends Controller
}
else
{
}
else
{
$id
=
$request
->
id
;
$id
=
$request
->
id
;
$group
=
$this
->
mGroup
->
get
(
$id
);
$group
=
$this
->
mGroup
->
get
(
$id
);
if
(
count
(
$group
)
>
0
){
if
(
$group
){
return
view
(
'admin/group/update'
,
compact
(
'group'
));
return
view
(
'admin/group/update'
,
compact
(
'group'
));
}
}
return
Message
::
makeError
(
'查找失败'
);
return
Message
::
makeError
(
'查找失败'
);
...
@@ -109,7 +109,7 @@ class GroupController extends Controller
...
@@ -109,7 +109,7 @@ class GroupController extends Controller
}
else
{
}
else
{
$id
=
$request
->
id
;
$id
=
$request
->
id
;
$group
=
$this
->
mGroup
->
get
(
$id
);
$group
=
$this
->
mGroup
->
get
(
$id
);
if
(
count
(
$group
)
>
0
){
if
(
$group
){
return
view
(
'admin/group/transfer'
,
compact
(
'group'
));
return
view
(
'admin/group/transfer'
,
compact
(
'group'
));
}
}
return
Message
::
makeError
(
'获取失败请重试!'
);
return
Message
::
makeError
(
'获取失败请重试!'
);
...
...
app/Http/Controllers/ProjectController.php
View file @
f4380957
...
@@ -21,7 +21,7 @@ class ProjectController extends Controller
...
@@ -21,7 +21,7 @@ class ProjectController extends Controller
{
{
$projectid
=
$request
->
id
;
$projectid
=
$request
->
id
;
$project
=
$this
->
mProject
->
get
(
$projectid
);
$project
=
$this
->
mProject
->
get
(
$projectid
);
if
(
project
){
if
(
$
project
){
return
view
(
'admin/project/projectinformation'
,
compact
(
'project'
));
return
view
(
'admin/project/projectinformation'
,
compact
(
'project'
));
}
else
{
}
else
{
echo
'项目查不到!'
;
echo
'项目查不到!'
;
...
@@ -88,7 +88,6 @@ class ProjectController extends Controller
...
@@ -88,7 +88,6 @@ class ProjectController extends Controller
if
(
count
(
$projects
)
>
0
){
if
(
count
(
$projects
)
>
0
){
return
view
(
'admin/project/projecliketables'
,
compact
(
'projects'
));
return
view
(
'admin/project/projecliketables'
,
compact
(
'projects'
));
}
}
return
Message
::
makeError
(
'错误'
);
return
Message
::
makeError
(
'错误'
);
...
...
app/Models/Board.php
deleted
100644 → 0
View file @
1161bafb
<?php
namespace
App\Models
;
use
Illuminate\Database\Eloquent\Model
;
class
Board
extends
Model
{
//
}
app/Providers/BroadcastServiceProvider.php
deleted
100644 → 0
View file @
1161bafb
<?php
namespace
App\Providers
;
use
Illuminate\Support\ServiceProvider
;
use
Illuminate\Support\Facades\Broadcast
;
class
BroadcastServiceProvider
extends
ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public
function
boot
()
{
Broadcast
::
routes
();
require
base_path
(
'routes/channels.php'
);
}
}
app/Providers/EmailServiceProvider.php
deleted
100644 → 0
View file @
1161bafb
<?php
namespace
App\Providers
;
use
App\Services\EmailService
;
use
Illuminate\Support\ServiceProvider
;
class
EmailServiceProvider
extends
ServiceProvider
{
/**
* Bootstrap the application services.
*
* @return void
*/
public
function
boot
()
{
//
}
/**
* Register the application services.
*
* @return void
*/
public
function
register
()
{
//绑定关系
$this
->
app
->
singleton
(
"App\Contracts\EmailServiceContract"
,
function
(){
//return new EmailCheckService();
return
new
EmailService
();
});
}
}
app/Services/EmailService.php
deleted
100644 → 0
View file @
1161bafb
<?php
namespace
App\Services
;
use
App\Contracts\EmailServiceContract
;
use
App\Models\EmailCheck
;
use
App\Models\User
;
use
App\Util\Message
;
use
Illuminate\Support\Facades\Mail
;
class
EmailService
implements
EmailServiceContract
{
public
$token
=
''
;
public
function
sendEmail
(
$email_address
,
$view
,
$subject
)
{
//生成唯一验证码3
$this
->
token
=
md5
(
time
())
.
md5
(
rand
())
.
uniqid
();
//对应数据存入数据库
$result
=
$this
->
saveData
(
$email_address
,
$this
->
token
);
if
(
$result
){
return
$this
->
send
(
$email_address
,
$view
,
$subject
);
}
else
{
return
false
;
}
}
//邮件数据存入数据库
public
function
saveData
(
$email_address
,
$token
)
{
$user_email
=
new
EmailCheck
();
$user_email
->
email
=
$email_address
;
$user_email
->
token
=
$token
;
$user_email
->
status
=
0
;
$result
=
$user_email
->
save
();
if
(
$result
){
return
true
;
}
else
{
return
false
;
}
}
// 发送
public
function
send
(
$email_address
,
$view
,
$subject
)
{
$result
=
false
;
try
{
//获取绝对路径
Mail
::
send
(
$view
,
[
'user'
=>
$email_address
,
'token'
=>
$this
->
token
],
function
(
$m
)
use
(
$subject
,
$email_address
)
{
$m
->
to
(
$email_address
)
->
subject
(
$subject
);
});
$result
=
true
;
}
catch
(
Exception
$exception
){
return
$result
;
}
return
$result
;
}
// 邮件校验
public
function
checkEmail
(
$token
)
{
//接收到验证码
$token
=
$token
;
$EmailCheck
=
EmailCheck
::
where
(
'token'
,
$token
)
->
get
();
if
(
count
(
$EmailCheck
))
{
$id
=
$EmailCheck
[
0
][
'id'
];
$EmailToken
=
$EmailCheck
[
0
][
'token'
];
// 获取表中 token 生成时间
$tokenTime
=
strtotime
(
$EmailCheck
[
0
][
'updated_at'
]);
$time
=
time
();
if
(
$time
-
$tokenTime
>
1800
){
return
false
;
}
if
(
$token
!=
$EmailToken
){
return
false
;
}
if
(
$EmailCheck
[
0
][
'status'
]
==
1
){
return
false
;
}
else
{
$EmailChecks
=
EmailCheck
::
find
(
15
);
$EmailChecks
->
status
=
1
;
$result
=
$EmailChecks
->
update
();
if
(
$result
){
return
true
;
}
else
{
return
false
;
}
}
}
else
{
return
false
;
}
}
}
\ No newline at end of file
app/Util/UploadPhoto.php
deleted
100644 → 0
View file @
1161bafb
<?php
/**
* Created by PhpStorm.
* User: Aladin
* Date: 2017/9/27
* Time: 17:28
*/
namespace
App\Util
;
use
Illuminate\Support\Facades\Storage
;
class
UploadPhoto
{
public
function
upload
(
$head_icon
)
{
// 获取上传文件的大小
$size
=
$head_icon
->
getSize
();
if
(
$size
>
2
*
1024
*
1024
){
return
back
()
->
with
(
'上传文件不能超过2M'
);
}
// 文件类型
$mimeType
=
$head_icon
->
getMimeType
();
// 扩展文件名
$ext
=
$head_icon
->
getClientOriginalExtension
();
// 判断是否通过HTTP POST 上传
$realPath
=
$head_icon
->
getRealPath
();
if
(
!
$realPath
){
return
'操作非法'
;
}
$today
=
date
(
'Y-m-d'
);
$dir
=
storage_path
()
.
'\app\public\uploads\\'
.
$today
;
if
(
!
$dir
){
mkdir
(
$dir
);
}
// 新文件名
$newFilename
=
uniqid
()
.
'.'
.
$ext
;
if
(
Storage
::
disk
(
'uploads'
)
->
put
(
$today
.
'/'
.
$newFilename
,
file_get_contents
(
$realPath
))){
$head_icon
=
'storage/'
.
$today
.
'/'
.
$newFilename
;
return
$head_icon
;
}
else
{
return
false
;
}
}
}
\ No newline at end of file
config/app.php
View file @
f4380957
...
@@ -178,7 +178,6 @@ return [
...
@@ -178,7 +178,6 @@ return [
App\Providers\EmailServiceProvider
::
class
,
App\Providers\GroupServiceProvider
::
class
,
App\Providers\GroupServiceProvider
::
class
,
App\Providers\ProjectServiceProvider
::
class
,
App\Providers\ProjectServiceProvider
::
class
,
App\Providers\ScheduleServiceProvider
::
class
,
App\Providers\ScheduleServiceProvider
::
class
,
...
...
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