parent
ee5942fcb5
commit
9100c67361
@ -0,0 +1,78 @@ |
||||
<?php |
||||
|
||||
declare (strict_types=1); |
||||
|
||||
namespace app\common\model; |
||||
use cores\BaseModel; |
||||
use think\facade\Db; |
||||
use app\common\model\UploadFile; |
||||
|
||||
use function Qcloud\Cos\encodeKey; |
||||
|
||||
class OpenShop extends BaseModel |
||||
{ |
||||
protected $name = 'open_shop'; |
||||
|
||||
protected $pk = 'id'; |
||||
|
||||
public function add(array $data) |
||||
{ |
||||
return $this->save($data); |
||||
} |
||||
|
||||
public function select888() |
||||
{ |
||||
return self::select(); |
||||
} |
||||
|
||||
public function getList(array $param = []) |
||||
{ |
||||
$filter = $this->getQueryFilter($param); |
||||
// 商品信息查询 |
||||
$list = $this->where($filter)->order('create_time', 'desc')->paginate($param['pageSize'] ?? 15)->toArray(); |
||||
|
||||
foreach ($list['data'] as &$value) { |
||||
$value['card_front_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['id_card_front_id'])->select(); |
||||
$value['card_back_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['id_card_back_id'])->select(); |
||||
$value['business_license_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['business_license_id'])->select(); |
||||
$value['photo_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['photo_id'])->select(); |
||||
$value['qr_code_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['qr_code_id'])->select(); |
||||
$value['merchant_name_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['merchant_name_id'])->select(); |
||||
} |
||||
|
||||
return $list; |
||||
} |
||||
|
||||
public function getQueryFilter(array $param) |
||||
{ |
||||
// 设置默认的检索数据 |
||||
$params = $this->setQueryDefaultValue($param, [ |
||||
'name' =>"", // 查询内容 |
||||
'mobile' => "", // 手机号 |
||||
'betweenTime' => [] // 起止时间 |
||||
]); |
||||
// 检索查询条件 |
||||
$filter = []; |
||||
|
||||
// 起止时间 |
||||
if (!empty($params['betweenTime'])) { |
||||
$times = between_time($params['betweenTime']); |
||||
if (isset($times['start_time']) && isset($times['end_time'])) { |
||||
$filter[] = ['create_time', '>=', $times['start_time']]; |
||||
$filter[] = ['create_time', '<', $times['end_time'] + 86400]; |
||||
} |
||||
} |
||||
|
||||
// 渠道名称 |
||||
if (!empty($params['name'])) { |
||||
$filter[] = ['name', 'like', "%{$params['name']}%"]; |
||||
} |
||||
|
||||
// 查询内容 |
||||
if (!empty($params['mobile'])) { |
||||
$filter[] = ['mobile', 'like', "%{$params['mobile']}%"]; |
||||
} |
||||
|
||||
return $filter; |
||||
} |
||||
} |
Loading…
Reference in new issue