chore: 添加静态资源文件和版本配置文件
添加大量图片、字体、音频等静态资源文件,包括用户界面图片、模板文件和安装界面素材 添加系统版本配置文件(.version)和常量定义文件(.constant) 更新供应商依赖文件,包括Symfony VarDumper组件和相关许可证文件 添加验证码配置文件(captcha.php)和.gitignore规则
This commit is contained in:
211
app/dao/order/OtherOrderDao.php
Normal file
211
app/dao/order/OtherOrderDao.php
Normal file
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\OtherOrder;
|
||||
use crmeb\basic\BaseModel;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\DbException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
use think\Model;
|
||||
|
||||
class OtherOrderDao extends BaseDao
|
||||
{
|
||||
/**
|
||||
* 设置模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return OtherOrder::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 重写搜索器
|
||||
* @param array $where
|
||||
* @param bool $search
|
||||
* @return BaseModel
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
return parent::search($where, $search)->when(isset($where['name']) && $where['name'], function ($query) use ($where) {
|
||||
$query->where('uid', 'in', function ($que) use ($where) {
|
||||
$que->name('user')->where('nickname|real_name|phone', 'like', '%' . trim($where['name']) . '%')->field(['uid'])->select();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取某个时间点一共有多少用户是付费会员状态
|
||||
* @param int $time
|
||||
* @param string $channel_type
|
||||
* @return array
|
||||
*/
|
||||
public function getPayUserCount(int $time, string $channel_type = ''): array
|
||||
{
|
||||
return $this->getModel()->when($channel_type != '', function ($query) use ($channel_type) {
|
||||
$query->where('channel_type', $channel_type);
|
||||
})->field('distinct(uid),add_time')
|
||||
->group('uid')->having('add_time < ' . $time)
|
||||
->order('add_time desc')
|
||||
->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取VIP曲线
|
||||
* @param $time
|
||||
* @param $type
|
||||
* @param $timeType
|
||||
* @param string $str
|
||||
* @return array
|
||||
*/
|
||||
public function getTrendData($time, $type, $timeType, string $str = 'count(uid)'): array
|
||||
{
|
||||
return $this->getModel()->where("member_type", "<>", 0)->when($type != '', function ($query) use ($type) {
|
||||
$query->where('channel_type', $type);
|
||||
})->where(function ($query) use ($time) {
|
||||
if ($time[0] == $time[1]) {
|
||||
$query->whereDay('add_time', $time[0]);
|
||||
} else {
|
||||
$time[1] = date('Y-m-d', strtotime($time[1]) + 86400);
|
||||
$query->whereTime('add_time', 'between', $time);
|
||||
}
|
||||
})->field("FROM_UNIXTIME(add_time,'$timeType') as days," . $str . " as num")
|
||||
->group('days')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 合计某字段值
|
||||
* @param array $where
|
||||
* @param string $sumField
|
||||
* @return float
|
||||
*/
|
||||
public function getWhereSumField(array $where, string $sumField): float
|
||||
{
|
||||
return $this->search($where)
|
||||
->when(isset($where['timeKey']), function ($query) use ($where) {
|
||||
$query->whereBetweenTime('pay_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']);
|
||||
})
|
||||
->sum($sumField);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据某字段分组查询
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @param string $group
|
||||
* @return array
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function getGroupField(array $where, string $field, string $group): array
|
||||
{
|
||||
return $this->search($where)
|
||||
->when(isset($where['timeKey']), function ($query) use ($where, $field, $group) {
|
||||
$query->whereBetweenTime('pay_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']);
|
||||
if ($where['timeKey']['days'] == 1) {
|
||||
$timeUinx = "%H";
|
||||
} elseif ($where['timeKey']['days'] == 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] == 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} elseif ($where['timeKey']['days'] > 1 && $where['timeKey']['days'] < 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] > 30 && $where['timeKey']['days'] < 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} else {
|
||||
$timeUinx = "%Y-%m";
|
||||
}
|
||||
$query->field("sum($field) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
|
||||
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
|
||||
})
|
||||
->order('add_time ASC')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件获取单条信息
|
||||
* @param array $where
|
||||
* @return Model
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function getOneByWhere(array $where)
|
||||
{
|
||||
return $this->getModel()->where($where)->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 收银订单
|
||||
* @param array $where
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @param string $order
|
||||
* @return array
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function getScanOrderList(array $where = [], int $page = 0, int $limit = 0, string $order = ''): array
|
||||
{
|
||||
foreach ($where as $k => $v) {
|
||||
if ($v == "") unset($where[$k]);
|
||||
}
|
||||
return $this->search($where)
|
||||
->order(($order ? $order . ' ,' : '') . 'id desc')
|
||||
->page($page, $limit)->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取会员记录
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @param array|string[] $with
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @param string $order
|
||||
* @return array
|
||||
* @throws DataNotFoundException
|
||||
* @throws DbException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function getMemberRecord(array $where = [], string $field = '*', array $with = ['user'], int $page = 0, int $limit = 0, string $order = ''): array
|
||||
{
|
||||
return $this->search($where)->field($field)
|
||||
->when($with, function ($query) use ($with) {
|
||||
$query->with($with);
|
||||
})->order(($order ? $order . ' ,' : '') . 'id desc')
|
||||
->when($page && $limit, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 店员统计
|
||||
* @param array $where
|
||||
* @param string $countField
|
||||
* @param string $sumField
|
||||
* @param string $groupField
|
||||
* @return array
|
||||
*/
|
||||
public function preStaffTotal(array $where, string $countField = 'uid', string $sumField = 'pay_price', string $groupField = 'staff_id'): array
|
||||
{
|
||||
return $this->search($where)
|
||||
->field($groupField . ",count(" . $countField . ") as count,sum(`" . $sumField . "`) as price")
|
||||
->group($groupField)
|
||||
->select()->toArray();
|
||||
}
|
||||
}
|
||||
50
app/dao/order/OtherOrderStatusDao.php
Normal file
50
app/dao/order/OtherOrderStatusDao.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\OtherOrderStatus;
|
||||
|
||||
/**订单状态
|
||||
* Class OtherOrderStatusDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class OtherOrderStatusDao extends BaseDao
|
||||
{
|
||||
/**
|
||||
* 设置模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return OtherOrderStatus::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单状态列表
|
||||
* @param array $where
|
||||
* @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 getStatusList(array $where, int $page, int $limit)
|
||||
{
|
||||
return $this->search($where)->when($page && $limit, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->select()->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
180
app/dao/order/StoreCartDao.php
Normal file
180
app/dao/order/StoreCartDao.php
Normal file
@@ -0,0 +1,180 @@
|
||||
<?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\StoreCart;
|
||||
use crmeb\basic\BaseModel;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class StoreCartDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreCartDao extends BaseDao
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreCart::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
* @param array $where
|
||||
* @param bool $search
|
||||
* @return BaseModel
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
return parent::search($where, $search)->when(isset($where['id']) && $where['id'], function ($query) use ($where) {
|
||||
$query->whereIn('id', $where['id']);
|
||||
})->when(isset($where['status']), function ($query) use ($where) {
|
||||
$query->where('status', $where['status']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @param array $unique
|
||||
* @return array
|
||||
*/
|
||||
public function getUserCartNums(array $where, array $unique)
|
||||
{
|
||||
return $this->search($where)->whereIn('product_attr_unique', $unique)->column('cart_num', 'product_attr_unique');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据商品id获取购物车数量
|
||||
* @param array $ids
|
||||
* @param int $uid
|
||||
* @return mixed
|
||||
*/
|
||||
public function productIdByCartNum(array $ids, int $uid)
|
||||
{
|
||||
return $this->search([
|
||||
'product_id' => $ids,
|
||||
'is_pay' => 0,
|
||||
'is_del' => 0,
|
||||
'is_new' => 0,
|
||||
'uid' => $uid,
|
||||
])->group('product_attr_unique')->column('id,cart_num,product_id', 'product_attr_unique');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取购物车列表
|
||||
* @param array $where
|
||||
* @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 getCartList(array $where, int $page = 0, int $limit = 0, array $with = [])
|
||||
{
|
||||
return $this->search($where)->when($page && $limit, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->when(count($with), function ($query) use ($with, $where) {
|
||||
$query->with($with);
|
||||
})->when(isset($where['is_cashier']), function ($query) use ($where) {
|
||||
$query->where('is_cashier', $where['is_cashier']);
|
||||
})->order('add_time DESC')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改购物车数据未已删除
|
||||
* @param array $id
|
||||
* @param array $data
|
||||
* @return BaseModel
|
||||
*/
|
||||
public function updateDel(array $id)
|
||||
{
|
||||
return $this->getModel()->whereIn('id', $id)->update(['is_del' => 1]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除购物车
|
||||
* @param int $uid
|
||||
* @param array $ids
|
||||
* @return bool
|
||||
*/
|
||||
public function removeUserCart(int $uid, array $ids)
|
||||
{
|
||||
return $this->getModel()->where('uid', $uid)->whereIn('id', $ids)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户购物车统计数据
|
||||
* @param int $uid
|
||||
* @param string $field
|
||||
* @param array $with
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getUserCartList(array $where, string $field = '*', array $with = [])
|
||||
{
|
||||
return $this->getModel()->where(array_merge($where, ['is_pay' => 0, 'is_new' => 0, 'is_del' => 0]))
|
||||
->when(count($with), function ($query) use ($with) {
|
||||
$query->with($with);
|
||||
})->order('add_time DESC')->field($field)->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改购物车数量
|
||||
* @param $cartId
|
||||
* @param $cartNum
|
||||
* @param $uid
|
||||
*/
|
||||
public function changeUserCartNum(array $where, int $carNum)
|
||||
{
|
||||
return $this->getModel()->update(['cart_num' => $carNum], $where);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改购物车状态
|
||||
* @param $cartIds
|
||||
* @return bool
|
||||
*/
|
||||
public function deleteCartStatus($cartIds)
|
||||
{
|
||||
return $this->getModel()->where('id', 'IN', $cartIds)->delete();
|
||||
}
|
||||
|
||||
/**
|
||||
* 购物车趋势
|
||||
* @param $time
|
||||
* @param $timeType
|
||||
* @param $str
|
||||
* @return mixed
|
||||
*/
|
||||
public function getProductTrend($time, $timeType, $str)
|
||||
{
|
||||
return $this->getModel()->where(function ($query) use ($time) {
|
||||
if ($time[0] == $time[1]) {
|
||||
$query->whereDay('add_time', $time[0]);
|
||||
} else {
|
||||
$time[1] = date('Y-m-d', strtotime($time[1]) + 86400);
|
||||
$query->whereTime('add_time', 'between', $time);
|
||||
}
|
||||
})->field("FROM_UNIXTIME(add_time,'$timeType') as days,$str as num")->group('days')->select()->toArray();
|
||||
}
|
||||
}
|
||||
57
app/dao/order/StoreDeliveryOrderDao.php
Normal file
57
app/dao/order/StoreDeliveryOrderDao.php
Normal file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreDeliveryOrder;
|
||||
|
||||
/**
|
||||
* 发货订单
|
||||
* Class StoreDeliveryOrderDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreDeliveryOrderDao extends BaseDao
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreDeliveryOrder::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取列表
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @param array $with
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getList(array $where, string $field = '*', int $page = 0, int $limit = 0, array $with = [])
|
||||
{
|
||||
return $this->search($where)->field($field)->when($with, function($query) use ($with) {
|
||||
$query->with($with);
|
||||
})->when($page && $limit, function($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->order('id desc')->select()->toArray();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
66
app/dao/order/StoreHangOrderDao.php
Normal file
66
app/dao/order/StoreHangOrderDao.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreHangOrder;
|
||||
|
||||
/**
|
||||
* Class StoreHangOrderDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreHangOrderDao extends BaseDao
|
||||
{
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreHangOrder::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @param int $limit
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getHang(array $where, int $limit = 50)
|
||||
{
|
||||
return $this->search($where)->with('user')->limit($limit)->order('add_time desc')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取挂单分页
|
||||
* @param array $where
|
||||
* @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 getHangPage(array $where, int $page, int $limit)
|
||||
{
|
||||
return $this->search($where)->when(isset($where['search']) && $where['search'] !== '', function ($query) use ($where) {
|
||||
$query->whereIn('uid', function ($query) use ($where) {
|
||||
$query->name('user')->whereIn('uid', function ($query) use ($where) {
|
||||
$query->name('store_user')->where('store_id', $where['store_id'])->field('uid');
|
||||
})->where('phone|nickname', 'like', "%" . $where['search'] . "%")->field('uid');
|
||||
});
|
||||
})->with('user')->page($page, $limit)->order('add_time desc')->select()->toArray();
|
||||
}
|
||||
}
|
||||
108
app/dao/order/StoreOrderCartInfoDao.php
Normal file
108
app/dao/order/StoreOrderCartInfoDao.php
Normal file
@@ -0,0 +1,108 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreOrderCartInfo;
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
* Class StoreOrderCartInfoDao
|
||||
* @package app\dao\order
|
||||
* @method saveAll(array $data)
|
||||
*/
|
||||
class StoreOrderCartInfoDao extends BaseDao
|
||||
{
|
||||
/**
|
||||
* 设置模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrderCartInfo::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取购物车详情列表
|
||||
* @param array $where
|
||||
* @param array $field
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getCartInfoList(array $where, array $field = ['*'])
|
||||
{
|
||||
return $this->search($where)->field($field)->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取购物车信息以数组返回
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @param string $key
|
||||
*/
|
||||
public function getCartColunm(array $where, string $field, string $key = '')
|
||||
{
|
||||
return $this->search($where)->order('id asc')->column($field, $key);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $cart_ids
|
||||
* @return array
|
||||
*/
|
||||
public function getSplitCartNum($cart_ids)
|
||||
{
|
||||
$res = $this->getModel()->whereIn('old_cart_id', $cart_ids)->field('sum(cart_num) as num,old_cart_id')->group('old_cart_id')->select()->toArray();
|
||||
$data = [];
|
||||
foreach ($res as $value) {
|
||||
$data[$value['old_cart_id']] = $value['num'];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 临期 卡次
|
||||
* @param int $writeEndTime
|
||||
* @param int $writeTime
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getAdventCartInfoList(int $time = 0, int $writeTime = 0)
|
||||
{
|
||||
$list = $this->getModel()->where(['is_writeoff' => 0, 'is_advent_sms' => 0])->where('write_start', '>', 0)->where('write_end', '>', 0)
|
||||
->where('write_end', '>', $time)->where('write_end', '<=', $writeTime)
|
||||
->field('id,oid,product_id,write_times,write_surplus_times,write_start,write_end,cart_info')->select();
|
||||
$list = count($list) > 0 ? $list->toArray() : [];
|
||||
return $list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 过期 卡次
|
||||
* @param int $writeTime
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getExpireCartInfoList(int $writeTime = 0)
|
||||
{
|
||||
$list = $this->getModel()->where(['is_writeoff' => 0, 'is_expire_sms' => 0])->where('write_start', '>', 0)->where('write_end', '>', 0)
|
||||
->where('write_end', '<', $writeTime)
|
||||
->field('id,oid,product_id,write_times,write_surplus_times,write_start,write_end,cart_info')->select();
|
||||
$list = count($list) > 0 ? $list->toArray() : [];
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
1292
app/dao/order/StoreOrderDao.php
Normal file
1292
app/dao/order/StoreOrderDao.php
Normal file
File diff suppressed because it is too large
Load Diff
42
app/dao/order/StoreOrderEconomizeDao.php
Normal file
42
app/dao/order/StoreOrderEconomizeDao.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreOrderEconomize;
|
||||
|
||||
/**
|
||||
* Class StoreOrderEconomizeDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreOrderEconomizeDao extends BaseDao
|
||||
{
|
||||
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrderEconomize::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $where
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getList(array $where)
|
||||
{
|
||||
return $this->getModel()->where($where)->select()->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
56
app/dao/order/StoreOrderPromotionsDao.php
Normal file
56
app/dao/order/StoreOrderPromotionsDao.php
Normal file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreOrderPromotions;
|
||||
|
||||
/**
|
||||
* 订单详情
|
||||
* Class StoreOrderPtomotionsDao
|
||||
* @package app\dao\order
|
||||
* @method saveAll(array $data)
|
||||
*/
|
||||
class StoreOrderPromotionsDao extends BaseDao
|
||||
{
|
||||
/**
|
||||
* 设置模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrderPromotions::class;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取购物车详情列表
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @param array $with
|
||||
* @param string $group
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getPromotionsDetailList(array $where, string $field = '*', array $with = [], string $group = '')
|
||||
{
|
||||
return $this->search($where)->field($field)->when($with, function($query) use($with) {
|
||||
$query->with($with);
|
||||
})->when($group, function($query) use($group) {
|
||||
$query->group($group);
|
||||
})->select()->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
224
app/dao/order/StoreOrderRefundDao.php
Normal file
224
app/dao/order/StoreOrderRefundDao.php
Normal file
@@ -0,0 +1,224 @@
|
||||
<?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\StoreOrderRefund;
|
||||
use crmeb\basic\BaseModel;
|
||||
use think\Model;
|
||||
|
||||
/**
|
||||
* 退款订单
|
||||
* Class StoreOrderInvoiceDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreOrderRefundDao extends BaseDao
|
||||
{
|
||||
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrderRefund::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索器
|
||||
* @param array $where
|
||||
* @param bool $search
|
||||
* @return BaseModel
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
$realName = $where['real_name'] ?? '';
|
||||
$fieldKey = $where['field_key'] ?? '';
|
||||
$fieldKey = $fieldKey == 'all' ? '' : $fieldKey;
|
||||
return parent::search($where, $search)
|
||||
// ->when(isset($where['refund_type']) && $where['refund_type'] !== '', function ($query) use ($where) {
|
||||
// if ($where['refund_type'] == 0) {
|
||||
// $query->where('refund_type', '>', 0);
|
||||
// } else {
|
||||
// if (is_array($where['refund_type'])) {
|
||||
// $query->whereIn('refund_type', $where['refund_type']);
|
||||
// } else {
|
||||
// $query->where('refund_type', $where['refund_type']);
|
||||
// }
|
||||
// }
|
||||
// })
|
||||
->when(isset($where['refund_type']) && $where['refund_type'] !== '', function ($query) use ($where) {
|
||||
if (is_array($where['refund_type'])) {
|
||||
$query->whereIn('refund_type', $where['refund_type']);
|
||||
} else {
|
||||
$query->where('refund_type', $where['refund_type']);
|
||||
}
|
||||
})->when(isset($where['apply_type']) && $where['apply_type'] !== '', function ($query) use ($where) {
|
||||
$query->where('apply_type', $where['apply_type']);
|
||||
})->when(isset($where['order_id']) && $where['order_id'] != '', function ($query) use ($where) {
|
||||
$query->where(function ($q) use ($where) {
|
||||
$q->whereLike('order_id|refund_express', '%' . $where['order_id'] . '%')->whereOr(function ($q) use ($where) {
|
||||
$q->whereOr('uid', 'in', function ($q) use ($where) {
|
||||
$q->name('user')->whereLike('nickname|uid|phone', '%' . $where['order_id'] . '%')->field(['uid'])->select();
|
||||
})->whereOr('store_order_id', 'in', function ($que) use ($where) {
|
||||
$que->name('store_order_cart_info')->whereIn('product_id', function ($q) use ($where) {
|
||||
$q->name('store_product')->whereLike('store_name|keyword', '%' . $where['order_id'] . '%')->field(['id'])->select();
|
||||
})->field(['oid'])->select();
|
||||
})->whereOr('store_order_id', 'in', function ($orderModel) use ($where) {
|
||||
$orderModel->name('store_order')->field('id')->whereLike('order_id|uid|user_phone', '%' . $where['order_id'] . '%');
|
||||
});
|
||||
});
|
||||
});
|
||||
})->when($realName && !$fieldKey, function ($query) use ($where) {
|
||||
$query->where(function ($que) use ($where) {
|
||||
$que->whereLike('order_id|refund_express', '%' . $where['real_name'] . '%')->whereOr(function ($q) use ($where) {
|
||||
$q->whereOr('uid', 'in', function ($q) use ($where) {
|
||||
$q->name('user')->whereLike('nickname|uid|phone', '%' . $where['real_name'] . '%')->field(['uid'])->select();
|
||||
})->whereOr('store_order_id', 'in', function ($que) use ($where) {
|
||||
$que->name('store_order_cart_info')->whereIn('product_id', function ($q) use ($where) {
|
||||
$q->name('store_product')->whereLike('store_name|keyword', '%' . $where['real_name'] . '%')->field(['id'])->select();
|
||||
})->field(['oid'])->select();
|
||||
})->whereOr('store_order_id', 'in', function ($orderModel) use ($where) {
|
||||
$orderModel->name('store_order')->field('id')->whereLike('order_id', '%' . $where['real_name'] . '%');
|
||||
});
|
||||
});
|
||||
});
|
||||
})->when(isset($where['refundTypes']) && $where['refundTypes'] !== '', function ($query) use ($where) {
|
||||
switch ((int)$where['refundTypes']) {
|
||||
case 0://未处理
|
||||
$query->where('refund_type', 1);
|
||||
break;
|
||||
case 1://申请中
|
||||
$query->whereIn('refund_type', [1, 2]);
|
||||
break;
|
||||
case 2://待退货
|
||||
$query->whereIn('refund_type', [4, 5]);
|
||||
break;
|
||||
case 3://退款中
|
||||
$query->where('refund_type', 5);
|
||||
break;
|
||||
case 4://已退款
|
||||
$query->where('refund_type', 6);
|
||||
break;
|
||||
case 5://处理中
|
||||
$query->whereIn('refund_type', [0, 1, 2, 4, 5]);
|
||||
break;
|
||||
case 6://已完成
|
||||
$query->whereIn('refund_type', [3, 6]);
|
||||
break;
|
||||
}
|
||||
})->when(isset($where['supplier']) && $where['supplier'] !== '', function ($query) use ($where) {
|
||||
$query->where('supplier_id', '>', 0);
|
||||
})->when(isset($where['refund_reason']) && $where['refund_reason'] != '', function ($query) use ($where) {
|
||||
$query->whereLike('refund_reason', '%' .$where['refund_reason']. '%');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询退款订单
|
||||
* @param $where
|
||||
* @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 getRefundList($where, string $file = '*', array $with = [], int $page = 0, int $limit = 0)
|
||||
{
|
||||
return $this->search($where)->field($file)->with(array_merge(['user'], $with))
|
||||
->when($page != 0 && $limit != 0, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->order('add_time desc')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取退款金额按照时间分组
|
||||
* @param array $time
|
||||
* @param string $timeType
|
||||
* @param string $field
|
||||
* @param string $str
|
||||
* @return mixed
|
||||
*/
|
||||
public function getUserRefundPriceList(array $time, string $timeType, string $str, string $field = 'add_time')
|
||||
{
|
||||
return $this->getModel()->where('is_cancel', 0)->where(function ($query) use ($time, $field) {
|
||||
if ($time[0] == $time[1]) {
|
||||
$query->whereDay($field, $time[0]);
|
||||
} else {
|
||||
$time[1] = date('Y-m-d', strtotime($time[1]) + 86400);
|
||||
$query->whereTime($field, 'between', $time);
|
||||
}
|
||||
})->field("FROM_UNIXTIME($field,'$timeType') as days,$str as num,GROUP_CONCAT(store_order_id) as link_ids")->group('days')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据时间获取
|
||||
* @param array $where
|
||||
* @return float|int
|
||||
*/
|
||||
public function getOrderRefundMoneyByWhere(array $where, string $sum_field, string $selectType, string $group = "")
|
||||
{
|
||||
|
||||
switch ($selectType) {
|
||||
case "sum" :
|
||||
return $this->getDayTotalMoney($where, $sum_field);
|
||||
case "group" :
|
||||
return $this->getDayGroupMoney($where, $sum_field, $group);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 按照支付时间统计支付金额
|
||||
* @param array $where
|
||||
* @param string $sumField
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDayTotalMoney(array $where, string $sumField)
|
||||
{
|
||||
return $this->search($where)
|
||||
->when(isset($where['timeKey']), function ($query) use ($where) {
|
||||
$query->whereBetweenTime('add_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']);
|
||||
})
|
||||
->sum($sumField);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 时间分组订单付款金额统计
|
||||
* @param array $where
|
||||
* @param string $sumField
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDayGroupMoney(array $where, string $sumField, string $group)
|
||||
{
|
||||
return $this->search($where)
|
||||
->when(isset($where['timeKey']), function ($query) use ($where, $sumField, $group) {
|
||||
$query->whereBetweenTime('add_time', $where['timeKey']['start_time'], $where['timeKey']['end_time']);
|
||||
if ($where['timeKey']['days'] == 1) {
|
||||
$timeUinx = "%H";
|
||||
} elseif ($where['timeKey']['days'] == 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] == 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} elseif ($where['timeKey']['days'] > 1 && $where['timeKey']['days'] < 30) {
|
||||
$timeUinx = "%Y-%m-%d";
|
||||
} elseif ($where['timeKey']['days'] > 30 && $where['timeKey']['days'] < 365) {
|
||||
$timeUinx = "%Y-%m";
|
||||
} else {
|
||||
$timeUinx = "%Y-%m";
|
||||
}
|
||||
$query->field("sum($sumField) as number,FROM_UNIXTIME($group, '$timeUinx') as time");
|
||||
$query->group("FROM_UNIXTIME($group, '$timeUinx')");
|
||||
})
|
||||
->order('add_time ASC')->select()->toArray();
|
||||
}
|
||||
}
|
||||
52
app/dao/order/StoreOrderStatusDao.php
Normal file
52
app/dao/order/StoreOrderStatusDao.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreOrderStatus;
|
||||
|
||||
/**
|
||||
* 订单状态
|
||||
* Class StoreOrderStatusDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreOrderStatusDao extends BaseDao
|
||||
{
|
||||
/**
|
||||
* 设置模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrderStatus::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取订单状态列表
|
||||
* @param array $where
|
||||
* @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 getStatusList(array $where, int $page = 0, int $limit = 0)
|
||||
{
|
||||
return $this->search($where)
|
||||
->when($page && $limit, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->order('change_time desc')->select()->toArray();
|
||||
}
|
||||
|
||||
}
|
||||
70
app/dao/order/StoreOrderStoreOrderCartInfoDao.php
Normal file
70
app/dao/order/StoreOrderStoreOrderCartInfoDao.php
Normal file
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreOrder;
|
||||
use app\model\order\StoreOrderCartInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* Class StoreOrderStoreOrderCartInfoDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreOrderStoreOrderCartInfoDao extends BaseDao
|
||||
{
|
||||
|
||||
protected string $alias = 'a';
|
||||
|
||||
protected string $joinAlis = 'c';
|
||||
|
||||
/**
|
||||
* 设置主表模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrder::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置链表模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setJoinModel(): string
|
||||
{
|
||||
return StoreOrderCartInfo::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置模型
|
||||
* @return \crmeb\basic\BaseModel
|
||||
*/
|
||||
public function getModel()
|
||||
{
|
||||
$name = app()->make($this->setJoinModel())->getName();
|
||||
return parent::getModel()->alias($this->alias)->join($name . ' ' . $this->joinAlis, $this->alias . '.id =' . $this->joinAlis . '.oid');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户购买过的商品id
|
||||
* @param array $where
|
||||
* @return array
|
||||
*/
|
||||
public function getUserCartProductIds(array $where)
|
||||
{
|
||||
return $this->getModel()->when(isset($where['uid']), function ($query) use ($where) {
|
||||
$query->where($this->alias . '.uid', $where['uid']);
|
||||
})->column($this->joinAlis . '.product_id');
|
||||
}
|
||||
}
|
||||
107
app/dao/order/StoreOrderStoreOrderStatusDao.php
Normal file
107
app/dao/order/StoreOrderStoreOrderStatusDao.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>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreOrder;
|
||||
use app\model\order\StoreOrderStatus;
|
||||
use crmeb\basic\BaseModel;
|
||||
|
||||
/**
|
||||
* Class StoreOrderStoreOrderStatusDao
|
||||
* @package app\dao\order
|
||||
*/
|
||||
class StoreOrderStoreOrderStatusDao extends BaseDao
|
||||
{
|
||||
protected string $alias = 'o';
|
||||
|
||||
protected string $joinAlis = 's';
|
||||
|
||||
/**
|
||||
* 设置模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrder::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置链表模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setJoinModel(): string
|
||||
{
|
||||
return StoreOrderStatus::class;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置模型
|
||||
* @return BaseModel
|
||||
*/
|
||||
protected function getModel()
|
||||
{
|
||||
$name = app()->make($this->setJoinModel())->getName();
|
||||
return parent::getModel()->join($name . ' ' . $this->joinAlis, $this->joinAlis . '.oid = ' . $this->alias . '.id')->alias($this->alias);
|
||||
}
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
* @param array $where
|
||||
* @return BaseModel
|
||||
*/
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
return $this->getModel()->when(isset($where['paid']), function ($query) use ($where) {
|
||||
$query->where($this->alias . '.paid', $where['paid']);
|
||||
})->when(isset($where['status']), function ($query) use ($where) {
|
||||
$query->where($this->alias . '.status', $where['status']);
|
||||
})->when(isset($where['refund_status']), function ($query) use ($where) {
|
||||
$query->where($this->alias . '.refund_status', $where['refund_status']);
|
||||
})->when(isset($where['is_del']), function ($query) use ($where) {
|
||||
$query->where($this->alias . '.is_del', $where['is_del']);
|
||||
})->when(isset($where['change_type']), function ($query) use ($where) {
|
||||
$query->whereIn($this->joinAlis . '.change_type', $where['change_type']);
|
||||
})->when(isset($where['change_time']), function ($query) use ($where) {
|
||||
$query->where($this->joinAlis . '.change_time', '<', $where['change_time']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件获取订单
|
||||
* @param array $where
|
||||
* @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 getOrderIds(array $where, int $page = 0, int $limit = 0)
|
||||
{
|
||||
return $this->search($where)->whereIn('refund_type', [0, 3])->where('pid', '<>', -1)->when($page && $limit, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->field([$this->alias . '.*'])->group($this->alias . '.id')->select()->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据条件获取订单数量
|
||||
* @param array $where
|
||||
* @return int
|
||||
*/
|
||||
public function getOrderCount(array $where)
|
||||
{
|
||||
return $this->search($where)->whereIn('refund_type', [0, 3])->where('pid', '<>', -1)->field([$this->alias . '.*'])->count();
|
||||
}
|
||||
|
||||
}
|
||||
79
app/dao/order/StoreOrderWriteoffDao.php
Normal file
79
app/dao/order/StoreOrderWriteoffDao.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\dao\order;
|
||||
|
||||
|
||||
use app\dao\BaseDao;
|
||||
use app\model\order\StoreOrderWriteoff;
|
||||
|
||||
/**
|
||||
* 订单核销
|
||||
* Class StoreOrderWriteoffDao
|
||||
* @package app\dao\order
|
||||
* @method saveAll(array $data)
|
||||
*/
|
||||
class StoreOrderWriteoffDao extends BaseDao
|
||||
{
|
||||
/**
|
||||
* 设置模型
|
||||
* @return string
|
||||
*/
|
||||
protected function setModel(): string
|
||||
{
|
||||
return StoreOrderWriteoff::class;
|
||||
}
|
||||
|
||||
/**搜索器
|
||||
* @param array $where
|
||||
* @param bool $search
|
||||
* @return \crmeb\basic\BaseModel
|
||||
* @throws \ReflectionException
|
||||
*/
|
||||
public function search(array $where = [], bool $search = false)
|
||||
{
|
||||
return parent::search($where)
|
||||
->when(isset($where['keyword']) && $where['keyword'] , function($query) use ($where) {
|
||||
$query->where(function ($q) use ($where) {
|
||||
$q->whereLike('uid|oid|relation_id|staff_id|product_id', '%' . $where['keyword'] . '%')
|
||||
->whereOr('uid', 'IN', function ($user) use ($where) {
|
||||
$user->name('user')->field('id')->whereLike('uid|phone|nickname', '%' . $where['keyword'] . '%');
|
||||
})->whereOr('product_id', 'IN', function ($product) use ($where) {
|
||||
$product->name('store_product')->field('id')->whereLike('store_name|keyword', '%' . $where['keyword'] . '%');
|
||||
})->whereOr('oid', 'IN', function ($order) use ($where) {
|
||||
$order->name('store_order')->field('id')->whereLike('order_id|uid|user_phone|staff_id', '%' . $where['keyword'] . '%');
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取核销列表
|
||||
* @param array $where
|
||||
* @param string $field
|
||||
* @param int $page
|
||||
* @param int $limit
|
||||
* @param array $with
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getList(array $where, string $field = '*', int $page = 0, int $limit = 0, array $with = [], $order = 'id desc')
|
||||
{
|
||||
return $this->search($where)->field($field)
|
||||
->when($with, function ($query) use ($with) {
|
||||
$query->with($with);
|
||||
})->when($page != 0 && $limit != 0, function ($query) use ($page, $limit) {
|
||||
$query->page($page, $limit);
|
||||
})->order($order)->select()->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user