Initial commit: queue workspace

Made-with: Cursor
This commit is contained in:
apple
2026-03-21 02:55:24 +08:00
commit 78de918c37
12388 changed files with 1840126 additions and 0 deletions

View File

@@ -0,0 +1,92 @@
<?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\product\shipping;
use app\dao\BaseDao;
use app\model\product\shipping\ShippingTemplates;
/**
* 运费模版
* Class ShippingTemplatesDao
* @package app\dao\product\shipping
*/
class ShippingTemplatesDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return ShippingTemplates::class;
}
/**
* 获取运费模版
* @param int $type
* @param int $relation_id
* @return array
*/
public function getTemp(int $type = 0, int $relation_id = 0)
{
return $this->search(['type' => $type, 'relation_id' => $relation_id])->order('sort DESC,id DESC')->column('id,name');
}
/**
* 获取选择模板列表
* @param array $where
* @return array
*/
public function getSelectList(array $where = [])
{
return $this->search($where)->order('sort DESC,id DESC')->column('id,name');
}
/**
* 获取
* @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 getShippingList(array $where, int $page, int $limit)
{
return $this->search($where)->order('sort DESC,id DESC')->page($page, $limit)->select()->toArray();
}
/**
* 插入数据返回主键id
* @param array $data
* @return int|string
*/
public function insertGetId(array $data)
{
return $this->getModel()->insertGetId($data);
}
/**
* 获取运费模板指定条件下的数据
* @param array $where
* @param string $field
* @param string $key
* @return array
*/
public function getShippingColumn(array $where, string $field, string $key)
{
return $this->search($where)->column($field, $key);
}
}

View File

@@ -0,0 +1,84 @@
<?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\product\shipping;
use app\dao\BaseDao;
use app\model\product\shipping\ShippingTemplatesFree;
use app\model\other\SystemCity;
/**
* Class ShippingTemplatesFreeCityDao
* @package app\dao\product\shipping
*/
class ShippingTemplatesFreeCityDao extends BaseDao
{
/**
* 主表别名
* @var string
*/
protected string $alias = 'a';
/**
* 附表别名
* @var string
*/
protected string $joinAlis = 'c';
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return ShippingTemplatesFree::class;
}
/**
* 设置join连表模型
* @return string
*/
protected function setJoinModel(): string
{
return SystemCity::class;
}
/**
* 关联模型
* @param string $alias
* @param string $join_alias
* @return \crmeb\basic\BaseModel
*/
protected function getModel(string $key = 'province_id', string $join = 'LEFT')
{
/** @var SystemCity $city */
$city = app()->make($this->setJoinModel());
$name = $city->getName();
return parent::getModel()->join($name . ' ' . $this->joinAlis, $this->alias . '.' . $key . ' = ' . $this->joinAlis . '.city_id', $join)->alias($this->alias);
}
/**
* 获取指定条件下的包邮列表
* @param array $where
* @return mixed
*/
public function getUniqidList(array $where, bool $group = true)
{
return $this->getModel($group ? 'province_id' : 'city_id')->when(isset($where['uniqid']), function ($query) use ($where) {
$query->where($this->alias . '.uniqid', $where['uniqid']);
})->when(isset($where['province_id']), function ($query) use ($where) {
$query->where($this->alias . '.province_id', $where['province_id']);
})->when($group, function ($query) {
$query->group($this->alias . '.province_id');
})->field($this->alias . '.province_id,' . $this->joinAlis . '.name,' . $this->alias . '.city_id')->select()->toArray();
}
}

View File

@@ -0,0 +1,124 @@
<?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\product\shipping;
use app\dao\BaseDao;
use app\model\product\shipping\ShippingTemplatesFree;
/**
* 包邮
* Class ShippingTemplatesFreeDao
* @package app\dao\product\shipping
*/
class ShippingTemplatesFreeDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return ShippingTemplatesFree::class;
}
/**
* 获取运费模板列表并按照指定字段进行分组
* @param array $where
* @param string $group
* @param string $field
* @param string $key
* @return mixed
*/
public function getShippingGroupArray(array $where, string $group, string $field, string $key)
{
return $this->search($where)->group($group)->column($field, $key);
}
/**
* 获取列表
* @param array $where
* @param array|string[] $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getShippingList(array $where, array $field = ['*'])
{
return $this->search($where)->field($field)->select()->toArray();
}
/**
* 获取运费模板列表
* @param array $where
* @param string $field
* @param string $key
* @return array
*/
public function getShippingArray(array $where, string $field, string $key)
{
return $this->search($where)->column($field, $key);
}
/**
* 是否可以满足包邮
* @param $tempId
* @param $cityid
* @param $number
* @param $price
* @param $type
* @return int
*/
public function isFree($tempId, $cityid, $number, $price, $type = 0)
{
return $this->getModel()->where('temp_id', $tempId)
->where('city_id', $cityid)
->when($type, function ($query) use ($type, $number) {
if ($type == 1) {//数量
$query->where('number', '<=', $number);
} else {//重量、体积
$query->where('number', '>=', $number);
}
})->where('price', '<=', $price)->count();
}
/**
* 是否包邮模版数据列表
* @param $tempId
* @param $cityid
* @param int $price
* @param string $field
* @param string $key
* @return array
*/
public function isFreeList($tempId, $cityid, $price = 0, string $field = '*', string $key = '')
{
return $this->getModel()
->when($cityid, function ($query) use ($cityid) {
if (is_array($cityid)) {
$query->whereIn('city_id', $cityid);
} else {
$query->where('city_id', $cityid);
}
})->when($tempId, function ($query) use ($tempId) {
if (is_array($tempId)) {
$query->whereIn('temp_id', $tempId);
} else {
$query->where('temp_id', $tempId);
}
})->when($price, function ($query) use ($price) {
$query->where('price', '<=', $price);
})->column($field, $key);
}
}

View File

@@ -0,0 +1,84 @@
<?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\product\shipping;
use app\dao\BaseDao;
use app\model\product\shipping\ShippingTemplatesNoDelivery;
use app\model\other\SystemCity;
/**
* Class ShippingTemplatesNoDeliveryCityDao
* @package app\dao\product\shipping
*/
class ShippingTemplatesNoDeliveryCityDao extends BaseDao
{
/**
* 主表别名
* @var string
*/
protected string $alias = 'a';
/**
* 附表别名
* @var string
*/
protected string $joinAlis = 'c';
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return ShippingTemplatesNoDelivery::class;
}
/**
* 设置join连表模型
* @return string
*/
protected function setJoinModel(): string
{
return SystemCity::class;
}
/**
* 关联模型
* @param string $alias
* @param string $join_alias
* @return \crmeb\basic\BaseModel
*/
protected function getModel(string $key = 'province_id', string $join = 'LEFT')
{
/** @var SystemCity $city */
$city = app()->make($this->setJoinModel());
$name = $city->getName();
return parent::getModel()->join($name . ' ' . $this->joinAlis, $this->alias . '.' . $key . ' = ' . $this->joinAlis . '.city_id', $join)->alias($this->alias);
}
/**
* 获取指定条件下的包邮列表
* @param array $where
* @return mixed
*/
public function getUniqidList(array $where, bool $group = true)
{
return $this->getModel($group ? 'province_id' : 'city_id')->when(isset($where['uniqid']), function ($query) use ($where) {
$query->where($this->alias . '.uniqid', $where['uniqid']);
})->when(isset($where['province_id']), function ($query) use ($where) {
$query->where($this->alias . '.province_id', $where['province_id']);
})->when($group, function ($query) {
$query->group($this->alias . '.province_id');
})->field($this->alias . '.province_id,' . $this->joinAlis . '.name,' . $this->alias . '.city_id')->select()->toArray();
}
}

View File

@@ -0,0 +1,99 @@
<?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\product\shipping;
use app\dao\BaseDao;
use app\model\product\shipping\ShippingTemplatesNoDelivery;
/**
* 不送达
* Class ShippingTemplatesNoDeliveryDao
* @package app\dao\shipping
*/
class ShippingTemplatesNoDeliveryDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return ShippingTemplatesNoDelivery::class;
}
/**
* 获取运费模板列表并按照指定字段进行分组
* @param array $where
* @param string $group
* @param string $field
* @param string $key
* @return mixed
*/
public function getShippingGroupArray(array $where, string $group, string $field, string $key)
{
return $this->search($where)->group($group)->column($field, $key);
}
/**
* 获取列表
* @param array $where
* @param array|string[] $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getShippingList(array $where, array $field = ['*'])
{
return $this->search($where)->field($field)->select()->toArray();
}
/**
* 获取运费模板列表
* @param array $where
* @param string $field
* @param string $key
* @return array
*/
public function getShippingArray(array $where, string $field, string $key)
{
return $this->search($where)->column($field, $key);
}
/**
* 是否不送达
* @param $tempId
* @param $cityid
* @param string $field
* @param string $key
* @return array
*/
public function isNoDelivery($tempId, $cityid, string $field = 'temp_id', string $key = '')
{
return $this->getModel()
->when($cityid, function ($query) use ($cityid) {
if (is_array($cityid)) {
$query->whereIn('city_id', $cityid);
} else {
$query->where('city_id', $cityid);
}
})->when($tempId, function ($query) use ($tempId) {
if (is_array($tempId)) {
$query->whereIn('temp_id', $tempId);
} else {
$query->where('temp_id', $tempId);
}
})->column($field, $key);
}
}

View File

@@ -0,0 +1,85 @@
<?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\product\shipping;
use app\dao\BaseDao;
use app\model\product\shipping\ShippingTemplatesRegion;
use app\model\other\SystemCity;
/**
* Class ShippingTemplatesRegionCityDao
* @package app\dao\product\shipping
*/
class ShippingTemplatesRegionCityDao extends BaseDao
{
/**
* 当前表别名
* @var string
*/
protected string $alias = 'a';
/**
* 设置join连表别名
* @var string
*/
protected string $joinAlis = 'c';
/**
* 设置当前模型
* @return string
*/
protected function setModel(): string
{
return ShippingTemplatesRegion::class;
}
/**
* 设置连表模型
* @return string
*/
protected function setJoinModel(): string
{
return SystemCity::class;
}
/**
* 关联模型
* @param string $alias
* @param string $join_alias
* @return \crmeb\basic\BaseModel
*/
protected function getModel(string $key = 'province_id', string $join = 'LEFT')
{
/** @var SystemCity $city */
$city = app()->make($this->setJoinModel());
$name = $city->getName();
return parent::getModel()->join($name . ' ' . $this->joinAlis, $this->alias . '.' . $key . ' = ' . $this->joinAlis . '.city_id', $join)->alias($this->alias);
}
/**
* 获取指定条件下的包邮列表
* @param array $where
* @return mixed
*/
public function getUniqidList(array $where, bool $group = true)
{
return $this->getModel($group ? 'province_id' : 'city_id')->when(isset($where['uniqid']), function ($query) use ($where) {
$query->where($this->alias . '.uniqid', $where['uniqid']);
})->when(isset($where['province_id']), function ($query) use ($where) {
$query->where($this->alias . '.province_id', $where['province_id']);
})->when($group, function ($query) {
$query->group($this->alias . '.province_id');
})->field($this->alias . '.province_id,' . $this->joinAlis . '.name,' . $this->alias . '.city_id')->select()->toArray();
}
}

View File

@@ -0,0 +1,85 @@
<?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\product\shipping;
use app\dao\BaseDao;
use app\model\product\shipping\ShippingTemplatesRegion;
/**
* 指定邮费
* Class ShippingTemplatesRegionDao
* @package app\dao\product\shipping
*/
class ShippingTemplatesRegionDao extends BaseDao
{
/**
* 设置模型
* @return string
*/
protected function setModel(): string
{
return ShippingTemplatesRegion::class;
}
/**
* 获取运费模板列表并按照指定字段进行分组
* @param array $where
* @param string $group
* @param string $field
* @param string $key
* @return mixed
*/
public function getShippingGroupArray(array $where, string $group, string $field, string $key)
{
return $this->search($where)->group($group)->column($field, $key);
}
/**
* 获取运费模板列表
* @param array $where
* @param string $field
* @param string $key
* @return array
*/
public function getShippingArray(array $where, string $field, string $key)
{
return $this->search($where)->column($field, $key);
}
/**
* 根据运费模板id和城市id获得包邮数据列表
* @param array $tempIds
* @param array $cityId
* @param string $field
* @param string $key
* @return array
*/
public function getTempRegionList(array $tempIds, array $cityId, string $field = '*', string $key = '*')
{
return $this->getModel()->whereIn('temp_id', $tempIds)->whereIn('city_id', $cityId)->order('city_id asc')->column($field, $key);
}
/**
* 获取列表
* @param array $where
* @param array|string[] $field
* @return array
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getShippingList(array $where, array $field = ['*'])
{
return $this->search($where)->field($field)->select()->toArray();
}
}