You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
2.3 KiB
67 lines
2.3 KiB
3 years ago
|
<?php
|
||
|
/**
|
||
|
* Tender.php
|
||
|
* User: ChenLong
|
||
|
* DateTime: 2020-12-21 15:35:22
|
||
|
*/
|
||
|
|
||
|
namespace app\admin\controller;
|
||
|
|
||
|
use \app\common\controller\Admin;
|
||
|
use think\App;
|
||
|
use think\facade\Db;
|
||
|
|
||
|
|
||
|
/**
|
||
|
* Class Tender
|
||
|
* @package app\admin\controller\Tender
|
||
|
* @author chenlong <vip_chenlong@163.com>
|
||
|
*/
|
||
|
class Tender extends Admin
|
||
|
{
|
||
|
/**
|
||
|
* 列表数据接口
|
||
|
* @return mixed|string|\think\Collection|\think\response\Json
|
||
|
* @throws \app\common\SdException
|
||
|
*/
|
||
|
public function listData()
|
||
|
{
|
||
|
return $this->setJoin([
|
||
|
['member', 'i.member_id = member.id ', 'left'],
|
||
|
['bidding', 'i.bidding_id = bidding.id ', 'left'],
|
||
|
])
|
||
|
->setField('i.id,member.username member_username,member.company,i.member_id,bidding.title bidding_title,i.bidding_id,i.tender_price,i.file_id,i.create_time,i.ip,i.ip_address')
|
||
|
->setSort('create_time,desc')
|
||
|
->setCustomReturn(function ($data){
|
||
|
foreach ($data['data'] as $key => &$value) {
|
||
|
$resource = Db::name('resource')->where('id',$value['file_id'])->find();
|
||
|
if($resource){
|
||
|
$path = '/upload/watermark/'.$resource['md5'].'.jpg';
|
||
|
if(file_exists(\think\facade\App::getRootPath().$path)){
|
||
|
if(strstr($resource['tag'],'.pdf')){
|
||
|
$tag = str_replace('.pdf','.jpg',$resource['tag']);
|
||
|
$data['data'][$key]['file_id'] = '<a href="'.url('bidding/download',['tag'=>$tag,'path'=>$path]).'" >'.$resource['tag'].'</a>';
|
||
|
}else{
|
||
|
$data['data'][$key]['file_id'] = '<a href="'.url('bidding/download',['tag'=>$resource['tag'],'path'=>$path]).'" >'.$resource['tag'].'</a>';
|
||
|
}
|
||
|
}else{
|
||
|
$data['data'][$key]['file_id'] = '无';
|
||
|
}
|
||
|
}else{
|
||
|
$data['data'][$key]['file_id'] = '无';
|
||
|
}
|
||
|
}
|
||
|
|
||
|
return json([
|
||
|
'code' => 0,
|
||
|
'msg' => '成功!',
|
||
|
'count' => $data['total'] ?? 0,
|
||
|
'data' => $data['data']
|
||
|
]);
|
||
|
}
|
||
|
)
|
||
|
->listsRequest();
|
||
|
}
|
||
|
|
||
|
}
|