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.
110 lines
3.6 KiB
110 lines
3.6 KiB
<?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) {
|
|
if (isset($value['id_card_front_id']) && $value['id_card_front_id'] !== null) {
|
|
$value['card_front_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['id_card_front_id'])->select();
|
|
} else {
|
|
$value['card_front_url'] = null;
|
|
}
|
|
|
|
if (isset($value['id_card_back_id']) && $value['id_card_back_id'] !== null) {
|
|
$value['card_back_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['id_card_back_id'])->select();
|
|
} else {
|
|
$value['card_back_url'] = null;
|
|
}
|
|
|
|
if (isset($value['business_license_id']) && $value['business_license_id'] !== null) {
|
|
$value['business_license_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['business_license_id'])->select();
|
|
} else {
|
|
$value['business_license_url'] = null;
|
|
}
|
|
|
|
if (isset($value['photo_id']) && $value['photo_id'] !== null) {
|
|
$value['photo_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['photo_id'])->select();
|
|
} else {
|
|
$value['photo_url'] = null;
|
|
}
|
|
|
|
if (isset($value['qr_code_id']) && $value['qr_code_id'] !== null) {
|
|
$value['qr_code_url'] = UploadFile::withoutGlobalScope()->where("file_id", $value['qr_code_id'])->select();
|
|
} else {
|
|
$value['qr_code_url'] = null;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return $list;
|
|
}
|
|
|
|
public function getQueryFilter(array $param)
|
|
{
|
|
// 设置默认的检索数据
|
|
$params = $this->setQueryDefaultValue($param, [
|
|
'name' =>"", // 查询内容
|
|
'mobile' => "", // 手机号
|
|
"type"=> "",
|
|
'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']}%"];
|
|
}
|
|
|
|
// 类型
|
|
if (!empty($params['type'])) {
|
|
$filter[] = ['type', '=', $params['type']];
|
|
}
|
|
|
|
|
|
return $filter;
|
|
}
|
|
}
|
|
|