Merge branch 'master' of http://git.njrzwl.cn:3000/wangmingchuan/yanzong
commit
a96c80364f
@ -0,0 +1,110 @@ |
||||
<?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; |
||||
} |
||||
} |
@ -0,0 +1,92 @@ |
||||
<?php |
||||
|
||||
declare (strict_types=1); |
||||
|
||||
namespace app\common\model; |
||||
|
||||
use cores\BaseModel; |
||||
use app\common\service\Jd; |
||||
use app\store\model\Goods as GoodsModel; |
||||
|
||||
class Tipoff extends BaseModel |
||||
{ |
||||
|
||||
protected $name = 'tipoff'; |
||||
|
||||
protected $pk = 'id'; |
||||
|
||||
public function add(array $data) |
||||
{ |
||||
return $this->save($data); |
||||
} |
||||
|
||||
public function getList(array $param = []) |
||||
{ |
||||
$filter = $this->getQueryFilter($param); |
||||
$jd = new Jd(); |
||||
$list = $this->where($filter)->order('create_time', 'desc')->paginate($param['pageSize'] ?? 150)->toArray(); |
||||
|
||||
foreach ($list['data'] as &$value) { |
||||
if (isset($value['goods_id'])) { |
||||
// 确保 $value['goods_id'] 是一个数组 |
||||
$value['goods'] = Goods::where('goods_id','in', $value['goods_id'])->select(); |
||||
} |
||||
|
||||
// foreach ( $value['goods'] as $key => $val) { |
||||
// //京东短链 |
||||
// $jd_short_url = $jd->getJdShortLink($val->goods_no); |
||||
// $val['jd_short_url'] = $jd_short_url; |
||||
// } |
||||
|
||||
} |
||||
|
||||
return $list; |
||||
} |
||||
|
||||
public function getQueryFilter(array $param) |
||||
{ |
||||
// 设置默认的检索数据 |
||||
$params = $this->setQueryDefaultValue($param, [ |
||||
'header_content' => "", // 查询内容 |
||||
'channel_name' => "", // 渠道 |
||||
'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['channel_name'])) { |
||||
$filter[] = ['channel_name', 'like', "%{$params['channel_name']}%"]; |
||||
} |
||||
|
||||
// 查询内容 |
||||
if (!empty($params['header_content'])) { |
||||
$filter[] = ['header_content', 'like', "%{$params['header_content']}%"]; |
||||
} |
||||
|
||||
return $filter; |
||||
} |
||||
|
||||
public function deleteTipoff($ids) |
||||
{ |
||||
// 检查 $ids 是否为空或 null |
||||
if (empty($ids)) { |
||||
return false; // 或者抛出一个异常,具体取决于业务需求 |
||||
} |
||||
|
||||
return $this->where('id', 'in', $ids)->delete(); |
||||
|
||||
} |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue