Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
data-collect
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
0
Merge Requests
0
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
汪伟伟
data-collect
Commits
3c4ab42e
Commit
3c4ab42e
authored
Jan 19, 2024
by
汪伟伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
图片点击放大预览
parent
c17597a1
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
17 deletions
+65
-17
app/Admin/Controllers/AlreadyDoneTaskController.php
+12
-4
app/Admin/Controllers/NoDoneTaskController.php
+9
-1
app/Admin/Controllers/TaskController.php
+41
-12
app/Models/Task.php
+1
-0
database/migrations/2024_01_11_104249_create_tasks_table.php
+2
-0
No files found.
app/Admin/Controllers/AlreadyDoneTaskController.php
View file @
3c4ab42e
...
...
@@ -5,6 +5,7 @@ namespace App\Admin\Controllers;
use
App\Admin\Extensions\Tools\BackAction
;
use
App\Admin\Repositories\TasksReceive
;
use
App\Admin\Services\CityAreaService
;
use
App\Models\TasksCollect
;
use
Dcat\Admin\Admin
;
use
Dcat\Admin\Form
;
use
Dcat\Admin\Grid
;
...
...
@@ -130,7 +131,8 @@ class AlreadyDoneTaskController extends AdminController
$show
->
field
(
'collects.value'
,
'指标值'
);
$show
->
field
(
'collects.reality_refer'
,
'实际信源'
);
$show
->
field
(
'collects.refer_level'
,
'信源等级'
);
$show
->
field
(
'collects.net_img'
,
'网页截图'
)
->
unescape
();
// $show->field('collects.net_img', '网页截图')->unescape();
$show
->
field
(
'collects.net_img'
,
'网页截图'
)
->
image
();
$show
->
field
(
'collects.remark'
,
'备注信息'
);
}
...
...
@@ -187,7 +189,7 @@ class AlreadyDoneTaskController extends AdminController
// // 在表单提交前调用
// $form->submitted(function (Form $form) {
//
//...
//
// });
// //保存前回调
// $form->saving(function (Form $form) {
...
...
@@ -195,8 +197,14 @@ class AlreadyDoneTaskController extends AdminController
//
// });
//保存后回调
// $form->saved(function (Form $form) {
// });
$form
->
saved
(
function
(
Form
$form
)
{
$start
=
'src="'
;
$end
=
'" alt'
;
$pattern
=
'/'
.
preg_quote
(
$start
)
.
'(.*?)'
.
preg_quote
(
$end
)
.
'/'
;
preg_match_all
(
$pattern
,
$form
->
input
(
'collects.net_img'
),
$matches
);
$images
=
implode
(
','
,
$matches
[
1
]);
TasksCollect
::
query
()
->
where
(
'receive_id'
,
$this
->
id
)
->
update
([
'net_img'
=>
$images
]);
//更新
});
$form
->
disableDeleteButton
();
});
...
...
app/Admin/Controllers/NoDoneTaskController.php
View file @
3c4ab42e
...
...
@@ -201,7 +201,7 @@ class NoDoneTaskController extends AdminController
// // 在表单提交前调用
// $form->submitted(function (Form $form) {
//
//...
//
// });
// //保存前回调
// $form->saving(function (Form $form) {
...
...
@@ -210,6 +210,14 @@ class NoDoneTaskController extends AdminController
// });
//保存后回调
$form
->
saved
(
function
(
Form
$form
)
{
$start
=
'src="'
;
$end
=
'" alt'
;
$pattern
=
'/'
.
preg_quote
(
$start
)
.
'(.*?)'
.
preg_quote
(
$end
)
.
'/'
;
preg_match_all
(
$pattern
,
$form
->
input
(
'collects.net_img'
),
$matches
);
$images
=
implode
(
','
,
$matches
[
1
]);
TasksCollect
::
query
()
->
where
(
'receive_id'
,
$this
->
id
)
->
update
([
'net_img'
=>
$images
]);
//更新
if
(
$this
->
status
==
0
)
{
// dd($this->id);
\App\Models\TasksReceive
::
query
()
->
where
(
'id'
,
$this
->
id
)
->
update
([
'status'
=>
1
]);
//状态更新成已完成
...
...
app/Admin/Controllers/TaskController.php
View file @
3c4ab42e
...
...
@@ -111,7 +111,12 @@ class TaskController extends AdminController
$show
->
field
(
'year'
);
$show
->
field
(
'refer'
);
$show
->
guide
()
->
unescape
();
//不 转义html内容
$res
=
\App\Models\Task
::
query
()
->
find
(
$id
);
if
(
$res
->
images
){
$show
->
field
(
'images'
,
'参考指南'
)
->
image
();
}
else
{
$show
->
field
(
'guide'
,
'参考指南'
)
->
unescape
();
//不 转义html内容
}
// $show->field('status');
// $show->field('created_at');
...
...
@@ -126,12 +131,10 @@ class TaskController extends AdminController
*
* @return Grid
*/
protected
function
grid
(
$tab
=
0
)
protected
function
grid
()
{
return
Grid
::
make
(
new
Task
(),
function
(
Grid
$grid
)
use
(
$tab
)
{
if
(
$tab
)
{
$grid
->
model
()
->
where
(
'status'
,
$tab
);
}
return
Grid
::
make
(
new
Task
(),
function
(
Grid
$grid
)
{
$grid
->
model
()
->
orderBy
(
'created_at'
,
'desc'
);
// dd(trans('admin.view'));//查看
// 在 display 回调中使用
...
...
@@ -190,7 +193,12 @@ class TaskController extends AdminController
$show
->
field
(
'year'
);
$show
->
field
(
'refer'
);
$show
->
guide
()
->
unescape
();
//不 转义html内容
$res
=
\App\Models\Task
::
query
()
->
find
(
$id
);
if
(
$res
->
images
){
$show
->
field
(
'images'
,
'参考指南'
)
->
image
();
}
else
{
$show
->
field
(
'guide'
,
'参考指南'
)
->
unescape
();
//不 转义html内容
}
// $show->field('status');
// $show->field('created_at');
...
...
@@ -254,6 +262,7 @@ class TaskController extends AdminController
})
->
value
(
2024
)
->
required
();
$form
->
text
(
'refer'
,
'参考信源'
)
->
required
();
$form
->
editor
(
'guide'
,
'收集指南'
)
->
required
();
$form
->
hidden
(
'images'
);
// $form->text('status');
// $form->display('created_at');
...
...
@@ -261,17 +270,29 @@ class TaskController extends AdminController
// // 在表单提交前调用
// $form->submitted(function (Form $form) {
// //...
// });
$form
->
submitted
(
function
(
Form
$form
)
{
$start
=
'src="'
;
$end
=
'" alt'
;
$pattern
=
'/'
.
preg_quote
(
$start
)
.
'(.*?)'
.
preg_quote
(
$end
)
.
'/'
;
preg_match_all
(
$pattern
,
$form
->
input
(
'guide'
),
$matches
);
$images
=
implode
(
','
,
$matches
[
1
]);
$form
->
images
=
$images
;
//...
});
// //保存前回调
// $form->saving(function (Form $form) {
// dump($form->year);
//
// });
//保存后回调
// $form->saved(function (Form $form) {
// dump($form->name);
// $form->saved(function (Form $form,$id) {
//
// $form->images = 12;
// dd($id,$form->guide);
//
// });
...
...
@@ -300,6 +321,13 @@ class TaskController extends AdminController
// dd($request->input());
$param
=
$request
->
input
();
$start
=
'src="'
;
$end
=
'" alt'
;
$pattern
=
'/'
.
preg_quote
(
$start
)
.
'(.*?)'
.
preg_quote
(
$end
)
.
'/'
;
preg_match_all
(
$pattern
,
$param
[
'guide'
],
$matches
);
$images
=
implode
(
','
,
$matches
[
1
]);
$query
=
\App\Models\Task
::
query
();
foreach
(
$param
[
'city_id'
]
as
$city
)
{
if
(
$city
)
{
...
...
@@ -313,6 +341,7 @@ class TaskController extends AdminController
'year'
=>
[
$y
],
'refer'
=>
$param
[
'refer'
],
'guide'
=>
$param
[
'guide'
],
'images'
=>
$images
,
];
$query
->
create
(
$insertData
);
}
...
...
app/Models/Task.php
View file @
3c4ab42e
...
...
@@ -33,6 +33,7 @@ class Task extends Model
'price'
,
'status'
,
'num'
,
'images'
,
'created_at'
,
'updated_at'
,
];
...
...
database/migrations/2024_01_11_104249_create_tasks_table.php
View file @
3c4ab42e
...
...
@@ -25,6 +25,8 @@ class CreateTasksTable extends Migration
$table
->
decimal
(
'price'
)
->
default
(
'0.00'
)
->
comment
(
'单价'
);
$table
->
tinyInteger
(
'status'
)
->
default
(
'0'
)
->
comment
(
'任务状态'
);
$table
->
unsignedInteger
(
'num'
)
->
default
(
'2'
)
->
comment
(
'可以被领取次数'
);
$table
->
longText
(
'images'
)
->
nullable
()
->
comment
(
'图片地址url 多个逗号隔开'
);
$table
->
timestamps
();
});
}
...
...
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