chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
107
app/dao/order/StoreOrderInvoiceDao.php
Normal file
107
app/dao/order/StoreOrderInvoiceDao.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
declare (strict_types=1);
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreOrderInvoice;
|
||||
use crmeb\basic\BaseModel;
|
||||
|
||||
/**
|
||||
* Class StoreOrderInvoiceDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreOrderInvoiceDao extends BaseDao
|
||||
{
|
||||
/**
|
||||
* 限制精确查询字段
|
||||
* @var string[]
|
||||
*/
|
||||
protected array $withField = ['uid', 'order_id', 'real_name', 'user_phone'];
|
||||
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrderInvoice::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @param bool $search
|
||||
* @return BaseModel
|
||||
* @throws \ReflectionException
|
||||
* @author 等风来
|
||||
* @email 136327134@qq.com
|
||||
* @date 2023/10/7
|
||||
*/
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
$realName = $where['real_name'] ?? '';
|
||||
$fieldKey = $where['field_key'] ?? '';
|
||||
$fieldKey = $fieldKey == 'all' ? '' : $fieldKey;
|
||||
$type = $where['type'] ?? '';
|
||||
unset($where['type']);
|
||||
return parent::search($where, $search)->when($type, function ($query) use ($type) {
|
||||
switch ($type) {
|
||||
case 1://待开
|
||||
$query->where('is_invoice', 0)->where('invoice_time', 0)->where('is_refund', 0);
|
||||
break;
|
||||
case 2://已开
|
||||
$query->where('is_invoice', 1)->where('is_refund', 0);
|
||||
break;
|
||||
case 3://退款
|
||||
$query->where('is_refund', 1);
|
||||
break;
|
||||
case 4://未开
|
||||
$query->where('is_invoice', 0)->where('invoice_time', 0)->where('is_refund', 0);
|
||||
break;
|
||||
}
|
||||
})->when($realName && $fieldKey && in_array($fieldKey, $this->withField), function ($query) use ($realName, $fieldKey) {
|
||||
$query->where('order_id', 'IN', function ($que) use ($fieldKey, $realName) {
|
||||
$que->name('store_order')->where(trim($fieldKey), trim($realName))->field(['id'])->select();
|
||||
});
|
||||
})->when($realName && !$fieldKey, function ($query) use ($where) {
|
||||
$query->where(function ($que) use ($where) {
|
||||
$que->whereLike('order_id|invoice_id|name|drawer_phone|email|tell|address|bank', "%{$where['real_name']}%")
|
||||
->whereOr('order_id', 'IN', function ($order) use ($where) {
|
||||
$order->name('store_order')->where('uid|real_name|order_id', 'LIKE', "%{$where['real_name']}%")->field('id')->select();
|
||||
})
|
||||
->whereOr('uid', 'in', function ($q) use ($where) {
|
||||
$q->name('user')->whereLike('nickname|uid|phone', '%' . $where['real_name'] . '%')->field(['uid'])->select();
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @param array|string[] $with
|
||||
* @param string $order
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getList(array $where, string $field = '*', array $with = ['order'], string $order = '', int $page = 0, int $limit = 0)
|
||||
{
|
||||
return $this->search($where)->field($field)->when(count($with), function ($query) use ($with) {
|
||||
$query->with($with);
|
||||
})->when($order != '', function ($query) use ($order) {
|
||||
$query->order($order);
|
||||
})->when($page && $limit, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->select()->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user