Commit 9c757215 by 汪伟伟

图片 地址 和base64问题

parent d11cc855
......@@ -26,7 +26,7 @@ class AlreadyApproveController extends AdminController
$grid->addTableClass(['table-text-center']);//设置表格文字居中
$grid->model()->where('status', '>', 0)
->orderBy('updated_at', 'desc')
->orderBy('time', 'desc')
->orderBy('task_id', 'desc');
......@@ -93,7 +93,7 @@ class AlreadyApproveController extends AdminController
*/
protected function detail($id)
{
return Show::make($id, TasksApprove::with(['task', 'collects', 'user']), function (Show $show) {
return Show::make($id, TasksApprove::with(['task', 'collects', 'user']), function (Show $show) use ($id){
$show->field('user.name', '用户');
$show->field('task.name', '指标名称');
......@@ -107,7 +107,15 @@ class AlreadyApproveController extends AdminController
$show->field('collects.value', '指标值');
$show->field('collects.reality_refer', '实际信源');
$show->field('collects.refer_level', '信源等级');
$show->field('collects.net_img', '截图链接')->unescape();
$ap = \App\Models\TasksApprove::query()->find($id);
if ($ap->collects->images){//是链接
$show->field('collects.images', '截图链接')->image();
}else{
$show->field('collects.net_img','截图链接')->unescape();//不 转义html内容
}
$show->field('status', '状态')->as(function ($statusValue) {
// 获取当前行的其他字段
......
......@@ -135,10 +135,9 @@ class AlreadyDoneTaskController extends AdminController
// $show->field('collects.net_img', '网页截图')->unescape();
$res = \App\Models\TasksReceive::query()->find($id);
$img = explode(',',$res->collects->net_img);
if (filter_var($img[0], FILTER_VALIDATE_URL) !== false){//是链接
$show->field('collects.net_img', '网页截图')->image();
if ($res->collects->images){//是链接
$show->field('collects.images', '网页截图')->image();
}else{
$show->field('collects.net_img','网页截图')->unescape();//不 转义html内容
}
......@@ -213,7 +212,13 @@ class AlreadyDoneTaskController extends AdminController
$pattern = '/' . preg_quote($start) . '(.*?)' . preg_quote($end) . '/';
preg_match_all($pattern, $form->input('collects.net_img'), $matches);
$images = implode(',',$matches[1]);
if($images) TasksCollect::query()->where('receive_id', $this->id)->update(['net_img' => $images]);//更新
foreach ($matches[1] as $v) {
if (!(filter_var($v, FILTER_VALIDATE_URL) !== false)) {//不是链接
$images = null;
break;
}
}
TasksCollect::query()->where('receive_id', $this->id)->update(['images' => $images]);//更新
});
$form->disableDeleteButton();
......
......@@ -221,13 +221,18 @@ 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]);
if($images) TasksCollect::query()->where('receive_id', $this->id)->update(['net_img' => $images]);//更新
foreach ($matches[1] as $v) {
if (!(filter_var($v, FILTER_VALIDATE_URL) !== false)) {//不是链接
$images = null;
break;
}
}
TasksCollect::query()->where('receive_id', $this->id)->update(['images' => $images]);//更新
if ($this->status == 0) {
// dd($this->id);
......@@ -256,6 +261,8 @@ class NoDoneTaskController extends AdminController
// var_dump($url);
return $form->response()->success('保存成功')->redirect($url);
}
});
$form->disableDeleteButton();
......
......@@ -266,7 +266,7 @@ class TaskController extends AdminController
})->value(2024)->required();
$form->decimal('price', '单价');
$form->text('refer', '参考信源')->required();
$form->editor('guide', '收集指南')->required();
$form->editor('guide', '收集指南')->options(['pasteImage'=>false])->required();
$form->hidden('images');
// $form->text('status');
......@@ -281,7 +281,12 @@ class TaskController extends AdminController
$end = '" alt';
$pattern = '/' . preg_quote($start) . '(.*?)' . preg_quote($end) . '/';
preg_match_all($pattern, $form->input('guide'), $matches);
foreach ($matches[1] as $v) {
if (!(filter_var($v, FILTER_VALIDATE_URL) !== false)) {//不是链接
$form->images = null;
return;
}
}
$images = implode(',',$matches[1]);
$form->images = $images;
......@@ -332,6 +337,12 @@ class TaskController extends AdminController
$pattern = '/' . preg_quote($start) . '(.*?)' . preg_quote($end) . '/';
preg_match_all($pattern, $param['guide'], $matches);
$images = implode(',',$matches[1]);
foreach ($matches[1] as $v) {
if (!(filter_var($v, FILTER_VALIDATE_URL) !== false)) {//是链接
$images = null;
break;
}
}
$query = \App\Models\Task::query();
foreach ($param['city_id'] as $city) {
......
......@@ -235,6 +235,7 @@ class TasksApproveController extends AdminController
$approve = \App\Models\TasksApprove::query()->where('receive_id', $receiveId)->first();
TasksReceive::query()->where('id', $receiveId)->update(['status' => 3]);//3:审核通过但未结算的任务
$approve->status = 2;//审核通过
$approve->time = date('Y-m-d H:i:s');
$approve->save();
// dd($id,$user->id);
......@@ -251,6 +252,7 @@ class TasksApproveController extends AdminController
TasksReceive::query()->where('id', $receiveId)->update(['status' => 2]);//2:审核不通过的任务
$approve->status = 1;//审核不通过
$approve->msg = $msg;
$approve->time = date('Y-m-d H:i:s');
$approve->save();
return true;
}
......@@ -263,6 +265,7 @@ class TasksApproveController extends AdminController
$approve = \App\Models\TasksApprove::query()->where('receive_id', $receive['id'])->first();
TasksReceive::query()->where('id', $receive['id'])->update(['status' => 3]);//3:审核通过但未结算的任务
$approve->status = 2;//审核通过
$approve->time = date('Y-m-d H:i:s');
$approve->save();
}
}
......@@ -281,6 +284,7 @@ class TasksApproveController extends AdminController
TasksReceive::query()->where('id', $receive['id'])->update(['status' => 2]);//2:审核不通过的任务
$approve->status = 1;//审核不通过
$approve->msg = $msg;
$approve->time = date('Y-m-d H:i:s');
$approve->save();
}
}
......
......@@ -53,6 +53,7 @@ class PassAction extends RowAction
$approve = TasksApprove::query()->find($id);
TasksReceive::query()->where('id', $approve->receive_id)->update(['status' => 3]);//3:审核通过但未结算的任务
$approve->status = 2;//审核通过
$approve->time = date('Y-m-d H:i:s');
$approve->save();
// dd($id,$user->id);
......
......@@ -29,6 +29,7 @@ class MsgSetting extends Form implements LazyRenderable
TasksReceive::query()->where('id', $approve->receive_id)->update(['status' => 2]);//2:审核不通过的任务
$approve->status = 1;//审核不通过
$approve->msg = $msg;
$approve->time = date('Y-m-d H:i:s');
$approve->save();
return $this
......
......@@ -30,6 +30,7 @@ class TasksApprove extends Model
'receive_id',
'status',
'msg',
'time',
'created_at',
'updated_at',
];
......
......@@ -25,6 +25,7 @@ class TasksCollect extends Model
'reality_refer',
'refer_level',
'net_img',
'images',
'is_find',
'remark',
'created_at',
......
......@@ -21,7 +21,8 @@ class CreateTasksCollectsTable extends Migration
$table->string('value')->default('')->comment('指标值');
$table->string('reality_refer')->default('')->comment('实际信源');
$table->string('refer_level')->nullable()->comment('信源等级');
$table->longText('net_img')->nullable()->comment('网页截图');
$table->longText('net_img')->nullable()->comment('网页截图富文本');
$table->longText('images')->nullable()->comment('图片');
$table->unsignedTinyInteger('is_find')->default('0')->comment('是否找到');
$table->string('remark')->nullable()->comment('备注信息');
$table->timestamps();
......
......@@ -151,7 +151,7 @@
</td>
<td>{{$rec['collects']['refer_level']}}</td>
<td>
@foreach(explode(',',$rec['collects']['net_img']) as $url)
@foreach(explode(',',$rec['collects']['images']) as $url)
@if(filter_var($url, FILTER_VALIDATE_URL) !== false)
<a target="_blank" href={{$url}}>点击查看</a><br>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment