new files

This commit is contained in:
panchengyong
2026-03-07 22:29:07 +08:00
parent cd7e80b502
commit 7acbf45ff7
12516 changed files with 1808447 additions and 194 deletions

View File

@@ -0,0 +1,138 @@
<?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\controller\admin\v1\other;
use app\controller\admin\AuthController;
use app\services\other\CityAreaServices;
use think\annotation\Inject;
use crmeb\services\CacheService;
/**
* 城市数据
* Class CityArea
* @package app\controller\admin\v1\setting
*/
class CityArea extends AuthController
{
/**
* @var CityAreaServices
*/
#[Inject]
protected CityAreaServices $services;
/**
* 城市列表
* @return string
* @throws \Exception
*/
public function index()
{
[$parent_id] = $this->request->getMore([
[['parent_id', 'd'], 0]
], true);
return $this->success($this->services->getCityTreeList((int)$parent_id));
}
/**
* 添加城市
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function add()
{
[$parentId] = $this->request->getMore([
[['parent_id', 'd'], 0]
], true);
return $this->success($this->services->createCityForm((int)$parentId));
}
/**
* 保存
*/
public function save()
{
$data = $this->request->postMore([
[['id', 'd'], 0],
[['name', 's'], ''],
[['level', 'd'], 0],
[['parent_id', 'd'], 0],
]);
if ($data['id'] == 0) {
if ($data['parent_id']) {
$parent = $this->services->get($data['parent_id']);
if ($parent) {
$data['path'] = $parent['path'] . $parent['id'] .'/';
}
} else {
$data['path'] = '/';
}
unset($data['id']);
$data['level'] = $data['level'] + 1;
$data['type'] = $this->services->type[$data['level']] ?? '';
$data['create_time'] = date('Y-m-d H:i:s');
$this->services->save($data);
$this->services->bcInc($data['parent_id'], 'snum', 1);
return $this->success('添加城市成功!');
} else {
unset($data['level']);
unset($data['parent_id']);
$this->services->update($data['id'], $data);
return $this->success('修改城市成功!');
}
}
/**
* 修改城市
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit()
{
[$id] = $this->request->getMore([
[['id', 'd'], 0]
], true);
return $this->success($this->services->updateCityForm((int)$id));
}
/**
* 删除城市
* @throws \Exception
*/
public function delete()
{
[$id] = $this->request->getMore([
[['city_id', 'd'], 0]
], true);
$city = $this->services->get((int)$id);
if ($city) {
$this->services->deleteCity($id);
if ($city['parent_id']) $this->services->bcDec($city['parent_id'], 'snum', 1);
}
return $this->success('删除成功!');
}
/**
* 清除城市缓存
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function clean_cache()
{
CacheService::delete('CITY_LIST');
return $this->success('清除成功!');
}
}

View File

@@ -0,0 +1,164 @@
<?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\controller\admin\v1\other;
use app\controller\admin\AuthController;
use app\services\other\ExpressServices;
use think\annotation\Inject;
/**
* 物流
* Class Express
* @package app\controller\admin\v1\freight
*/
class Express extends AuthController
{
/**
* @var ExpressServices
*/
#[Inject]
protected ExpressServices $services;
/**
* 显示资源列表
*
* @return \think\Response
*/
public function index()
{
$where = $this->request->getMore([
['keyword', '']
]);
return $this->success($this->services->getExpressList($where));
}
/**
* 显示创建资源表单页.
*
* @return \think\Response
*/
public function create()
{
return $this->success($this->services->createForm());
}
/**
* 保存新建的资源
*
* @return \think\Response
*/
public function save()
{
$data = $this->request->postMore([
'name',
'code',
['sort', 0],
['is_show', 0]]);
if (!$data['name']) return $this->fail('请输入公司名称');
$this->services->save($data);
return $this->success('添加公司成功!');
}
/**
* 显示指定的资源
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
//
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return \think\Response
*/
public function edit($id)
{
return $this->success($this->services->updateForm((int)$id));
}
/**
* 保存更新的资源
*
* @param int $id
* @return \think\Response
*/
public function update($id)
{
$data = $this->request->postMore([
['account', ''],
['key', ''],
['net_name', ''],
['sort', 0],
['is_show', 0]]);
if (!$expressInfo = $this->services->get($id)) return $this->fail('编辑的记录不存在!');
if ($expressInfo['partner_id'] == 1 && !$data['account']) {
return $this->fail('请输入月结账号');
}
if ($expressInfo['partner_key'] == 1 && !$data['key']) {
return $this->fail('请输入月结密码');
}
if ($expressInfo['net'] == 1 && !$data['net_name']) {
return $this->fail('请输入取件网点');
}
$expressInfo->account = $data['account'];
$expressInfo->key = $data['key'];
$expressInfo->net_name = $data['net_name'];
$expressInfo->sort = $data['sort'];
$expressInfo->is_show = $data['is_show'];
$expressInfo->status = 1;
$expressInfo->save();
return $this->success('修改成功!');
}
/**
* 删除指定资源
*
* @param int $id
* @return \think\Response
*/
public function delete($id)
{
if (!$id) return $this->fail('参数错误,请重新打开');
$res = $this->services->delete($id);
if (!$res)
return $this->fail('删除失败,请稍候再试!');
else
return $this->success('删除成功!');
}
/**
* 修改状态
* @param int $id
* @param string $status
* @return mixed
*/
public function set_status($id = 0, $status = '')
{
if ($status == '' || $id == 0) return $this->fail('参数错误');
$this->services->update($id, ['is_show' => $status]);
return $this->success($status == 0 ? '隐藏成功' : '显示成功');
}
/**
* 同步平台快递公司
* @return mixed
*/
public function syncExpress()
{
$this->services->syncExpress();
return $this->success('同步成功');
}
}

View File

@@ -0,0 +1,135 @@
<?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\controller\admin\v1\other;
use app\controller\admin\AuthController;
use app\services\other\SystemCityServices;
use think\annotation\Inject;
use crmeb\services\CacheService;
/**
* 城市数据
* Class SystemCity
* @package app\controller\admin\v1\setting
*/
class SystemCity extends AuthController
{
/**
* @var SystemCityServices
*/
#[Inject]
protected SystemCityServices $services;
/**
* 城市列表
* @return string
* @throws \Exception
*/
public function index()
{
$where = $this->request->getMore([
[['parent_id', 'd'], 0]
]);
return $this->success($this->services->getCityList($where));
}
/**
* 添加城市
* @return mixed
* @throws \FormBuilder\Exception\FormBuilderException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function add()
{
[$parentId] = $this->request->getMore([
[['parent_id', 'd'], 0]
], true);
return $this->success($this->services->createCityForm($parentId));
}
/**
* 保存
*/
public function save()
{
$data = $this->request->postMore([
[['id', 'd'], 0],
[['name', 's'], ''],
[['merger_name', 's'], ''],
[['area_code', 's'], ''],
[['lng', 's'], ''],
[['lat', 's'], ''],
[['level', 'd'], 0],
[['parent_id', 'd'], 0],
]);
$this->validate($data, \app\validate\admin\setting\SystemCityValidate::class, 'save');
if ($data['parent_id'] == 0) {
$data['merger_name'] = $data['name'];
} else {
$data['merger_name'] = $this->services->value(['id' => $data['parent_id']], 'name') . ',' . $data['name'];
}
CacheService::delete($this->services->tree_city_key);
if ($data['id'] == 0) {
unset($data['id']);
$data['level'] = $data['level'] + 1;
$data['city_id'] = intval($this->services->getCityIdMax() + 1);
$this->services->save($data);
return $this->success('添加城市成功!');
} else {
unset($data['level']);
unset($data['parent_id']);
$this->services->update($data['id'], $data);
return $this->success('修改城市成功!');
}
}
/**
* 修改城市
* @return string
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function edit()
{
[$id] = $this->request->getMore([
[['id', 'd'], 0]
], true);
return $this->success($this->services->updateCityForm($id));
}
/**
* 删除城市
* @throws \Exception
*/
public function delete()
{
[$id] = $this->request->getMore([
[['city_id', 'd'], 0]
], true);
$this->services->deleteCity($id);
CacheService::delete($this->services->tree_city_key);
return $this->success('删除成功!');
}
/**
* 清除城市缓存
* @throws \Psr\SimpleCache\InvalidArgumentException
*/
public function clean_cache()
{
CacheService::delete($this->services->tree_city_key);
CacheService::delete('CITY_LIST');
return $this->success('清除成功!');
}
}

View File

@@ -0,0 +1,745 @@
<?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\controller\admin\v1\other\export;
use app\controller\admin\AuthController;
use app\services\activity\card\CardCodeServices;
use app\services\activity\integral\StoreIntegralOrderServices;
use app\services\activity\bargain\StoreBargainServices;
use app\services\activity\combination\StoreCombinationServices;
use app\services\activity\combination\StorePinkServices;
use app\services\activity\seckill\StoreSeckillServices;
use app\services\agent\AgentManageServices;
use app\services\agent\DivisionServices;
use app\services\order\StoreOrderInvoiceServices;
use app\services\other\export\ExportServices;
use app\services\order\StoreOrderServices;
use app\services\other\Import\ImportRecordErrorServices;
use app\services\other\queue\QueueAuxiliaryServices;
use app\services\other\queue\QueueServices;
use app\services\product\product\StoreProductServices;
use app\services\other\ExpressServices;
use app\services\product\stock\StockInventoryServices;
use app\services\product\stock\StockRecordServices;
use app\services\store\SystemStoreServices;
use app\services\supplier\finance\SupplierFlowingWaterServices;
use app\services\system\form\SystemFormDataServices;
use app\services\user\member\MemberCardServices;
use app\services\user\UserBillServices;
use app\services\user\UserBrokerageServices;
use app\services\user\UserMoneyServices;
use app\services\user\UserRechargeServices;
use app\services\user\UserServices;
use app\services\wechat\WechatUserServices;
use think\annotation\Inject;
use think\facade\App;
/**
* 导出excel类
* Class ExportExcel
* @package app\controller\admin\v1\export
*/
class ExportExcel extends AuthController
{
/**
* @var ExportServices
*/
#[Inject]
protected ExportServices $service;
/**
* 用户列表导出
* @param UserServices $services
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* @author wuhaotian
* @email 442384644@qq.com
* @date 2025/3/11
*/
public function user(UserServices $services)
{
$where = $this->request->getMore([
['page', 1],
['limit', 1000],
['nickname', ''],
['status', ''],
['pay_count', ''],
['is_promoter', ''],
['order', ''],
['data', ''],
['user_type', ''],
['country', ''],
['province', ''],
['city', ''],
['user_time_type', ''],
['user_time', ''],
['sex', ''],
[['level', 0], 0],
[['group_id', 'd'], 0],
[['label_id', 'd'], 0],
['now_money', 'normal'],
['field_key', ''],
['isMember', ''],
['label_ids', ''],
['ids', '', '', 'uid'],
]);
if ($where['label_ids']) {
$where['label_id'] = stringToIntArray($where['label_ids']);
unset($where['label_ids']);
}
$where['user_time_type'] = $where['user_time_type'] == 'all' ? '' : $where['user_time_type'];
if ($where['uid'] !== '') {
$where['uid'] = stringToIntArray($where['uid']);
} else {
unset($where['uid']);
}
$data = $services->index($where);
return $this->success($this->service->user($data['list'] ?? []));
}
/**
* 保存用户资金监控的excel表格
* @param UserMoneyServices $services
* @return mixed
*/
public function userFinance(UserMoneyServices $services)
{
$where = $this->request->getMore([
['start_time', ''],
['end_time', ''],
['nickname', ''],
['type', ''],
]);
$data = $services->getMoneyList($where, '*', $this->service->limit);
return $this->success($this->service->userFinance($data['data'] ?? []));
}
/**
* 用户佣金
* @param UserBrokerageServices $services
* @return mixed
*/
public function userCommission(UserBrokerageServices $services)
{
$where = $this->request->getMore([
['page', 1],
['limit', 20],
['nickname', ''],
['price_max', ''],
['price_min', ''],
['excel', '1'],
['date', '', '', 'time']
]);
$data = $services->getCommissionList($where, $this->service->limit);
return $this->success($this->service->userCommission($data['list'] ?? []));
}
/**
* 用户积分
* @param UserBillServices $services
* @return mixed
*/
public function userPoint(UserBillServices $services)
{
$where = $this->request->getMore([
['start_time', ''],
['end_time', ''],
['nickname', ''],
['excel', '1'],
]);
$data = $services->getPointList($where, '*', $this->service->limit);
return $this->success($this->service->userPoint($data['list'] ?? []));
}
/**
* 用户充值
* @param UserRechargeServices $services
* @return mixed
*/
public function userRecharge(UserRechargeServices $services)
{
$where = $this->request->getMore([
['data', ''],
['paid', ''],
['page', 1],
['limit', 20],
['nickname', ''],
['excel', '1'],
]);
$data = $services->getRechargeList($where, '*', $this->service->limit);
return $this->success($this->service->userRecharge($data['list'] ?? []));
}
/**
* 分销管理 用户推广
* @param AgentManageServices $services
* @return mixed
*/
public function userAgent(AgentManageServices $services)
{
$where = $this->request->getMore([
['nickname', ''],
['data', ''],
['excel', '1'],
]);
$data = $services->agentSystemPage($where, $this->service->limit);
return $this->success($this->service->userAgent($data['list']));
}
/**
* 微信用户导出
* @param WechatUserServices $services
* @return mixed
*/
public function wechatUser(WechatUserServices $services)
{
$where = $this->request->getMore([
['page', 1],
['limit', 20],
['nickname', ''],
['data', ''],
['tagid_list', ''],
['groupid', '-1'],
['sex', ''],
['export', '1'],
['subscribe', '']
]);
$tagidList = explode(',', $where['tagid_list']);
foreach ($tagidList as $k => $v) {
if (!$v) {
unset($tagidList[$k]);
}
}
$tagidList = array_unique($tagidList);
$where['tagid_list'] = implode(',', $tagidList);
$data = $services->exportData($where);
return $this->success($this->service->wechatUser($data));
}
/**
* 商铺砍价活动导出
* @param StoreBargainServices $services
* @return mixed
*/
public function storeBargain(StoreBargainServices $services)
{
$where = $this->request->getMore([
['start_status', ''],
['status', ''],
['store_name', ''],
['page', 0]
]);
$where['is_del'] = 0;
$page = $where['page'];
unset($where['page']);
$data = $services->getList($where, $page, $this->service->limit);
return $this->success($this->service->storeBargain($data));
}
/**
* 商铺拼团导出
* @param StoreCombinationServices $services
* @return mixed
*/
public function storeCombination(StoreCombinationServices $services)
{
$where = $this->request->getMore([
['start_status', ''],
['is_show', ''],
['store_name', ''],
['page', 0]
]);
$where['is_del'] = 0;
$page = $where['page'];
unset($where['page']);
$data = $services->getList($where, $page, $this->service->limit);
/** @var StorePinkServices $storePinkServices */
$storePinkServices = app()->make(StorePinkServices::class);
$countAll = $storePinkServices->getPinkCount([]);
$countTeam = $storePinkServices->getPinkCount(['k_id' => 0, 'status' => 2]);
$countPeople = $storePinkServices->getPinkCount(['k_id' => 0]);
foreach ($data as &$item) {
$item['count_people'] = $countPeople[$item['id']] ?? 0;//拼团数量
$item['count_people_all'] = $countAll[$item['id']] ?? 0;//参与人数
$item['count_people_pink'] = $countTeam[$item['id']] ?? 0;//成团数量
}
return $this->success($this->service->storeCombination($data));
}
/**
* 商铺秒杀导出
* @param StoreSeckillServices $services
* @return mixed
*/
public function storeSeckill(StoreSeckillServices $services)
{
$where = $this->request->getMore([
['start_status', ''],
['status', ''],
['store_name', ''],
['page', 0]
]);
$where['is_del'] = 0;
$page = $where['page'];
unset($where['page']);
$data = $services->getList($where, $page, $this->service->limit);
return $this->success($this->service->storeSeckill($data));
}
/**
* 导出商品卡号、卡密模版
* @return mixed
*/
public function storeProductCardTemplate()
{
return $this->success($this->service->storeProductCardTemplate());
}
/**
* 商铺产品导出
* @param StoreProductServices $services
* @return mixed
*/
public function storeProduct(StoreProductServices $services)
{
$where = $this->request->getMore([
['store_name', ''],
['cate_id', ''],
['type', '', '', 'status'],
['store_id', ''],
['supplier_id', ''],
['sales', 'normal'],
['store_label_id', ''],
['brand_id', ''],
['ids', ''],
['all', 0]
]);
if (!$where['ids'] && $where['all'] == 0) return $this->fail('请选择批处理商品');
if ($where['supplier_id']) {
$where['relation_id'] = $where['supplier_id'];
$where['type'] = 2;
} else {
$where['pid'] = 0;
}
$where['ids'] = stringToIntArray($where['ids']);
unset($where['supplier_id'], $where['store_id'], $where['all']);
$data = $services->searchList($where, true, $this->service->limit);
return $this->success($this->service->storeProduct($data['list'] ?? []));
}
/**
* 订单列表导出
* @param StoreOrderServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function storeOrder(StoreOrderServices $services)
{
$where_tmp = $this->request->getMore([
['status', ''],
['real_name', ''],
['is_del', ''],
['data', '', '', 'time'],
['type', ''],
['export_type', ''],
['pay_type', ''],
['plat_type', -1],
['order', ''],
['field_key', ''],
['store_id', ''],
['supplier_id', ''],
['ids', '']
]);
$type = $where_tmp['export_type'];
unset($where_tmp['export_type']);
$with = [];
if ($where_tmp['ids']) {
$where['id'] = stringToIntArray($where_tmp['ids']);
} else {
$where['pid'] = 0;
}
if ($type) {
$where['status'] = 1;
$where['paid'] = 1;
$where['is_del'] = 0;
$where['shipping_type'] = 1;
$where['is_system_del'] = 0;
$with = ['pink', 'refund' => function ($query) {
$query->whereIn('refund_type', [0, 1, 2, 4, 5])->where('is_cancel', 0)->where('is_del', 0)->field('id,store_order_id');
}];
}
if (!$where_tmp['ids'] && !$type) {
unset($where_tmp['ids']);
$where = $where_tmp;
}
$where['is_system_del'] = 0;
$where['plat_type'] = $where_tmp['plat_type'];
$where['store_id'] = $where_tmp['store_id'];
if ($this->supplierId) {
$where['supplier_id'] = $this->supplierId;
} else {
$where['supplier_id'] = $where_tmp['supplier_id'];
}
$data = $services->getExportList($where, $with, $this->service->limit);
return $this->success($this->service->storeOrder($data, $type));
}
/**
* 获取提货点
* @return mixed
*/
public function storeMerchant(SystemStoreServices $services)
{
$where = $this->request->getMore([
[['keywords', 's'], ''],
[['type', 'd'], 0],
]);
$data = $services->getExportData($where);
return $this->success($this->service->storeMerchant($data));
}
/**
* 会员卡导出
* @param int $id
* @param MemberCardServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function memberCard(int $id, MemberCardServices $services)
{
$data = $services->getExportData(['batch_card_id' => $id], $this->service->limit);
return $this->success($this->service->memberCard($data));
}
/**
* 导出批量任务发货的记录
* @param int $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function batchOrderDelivery($id, $queueType, $cacheType)
{
/** @var QueueAuxiliaryServices $auxiliaryService */
$auxiliaryService = app()->make(QueueAuxiliaryServices::class);
/** @var QueueServices $queueService */
$queueService = app()->make(QueueServices::class);
$queueInfo = $queueService->getQueueOne(['id' => $id]);
if (!$queueInfo) $this->fail("数据不存在");
$queueValue = json_decode($queueInfo['queue_in_value'], true);
if (!$queueValue || !isset($queueValue['cacheType'])) $this->fail("数据参数缺失");
$data = $auxiliaryService->getExportData(['binding_id' => $id, 'type' => $cacheType], $this->service->limit);
return $this->success($this->service->batchOrderDelivery($data, $queueType));
}
/**
* 物流公司表导出
* @return mixed
*/
public function expressList()
{
/** @var ExpressServices $expressService */
$expressService = app()->make(ExpressServices::class);
$data = $expressService->apiExpressList();
return $this->success($this->service->expressList($data));
}
/**
* 导出积分兑换订单
* @param StoreIntegralOrderServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function storeIntegralOrder(StoreIntegralOrderServices $services)
{
$where = $this->request->getMore([
['status', ''],
['real_name', ''],
['data', '', '', 'time'],
['order', ''],
['field_key', ''],
['product_id', '']
]);
$where['is_system_del'] = 0;
$data = $services->getExportList($where, $this->service->limit);
return $this->success($this->service->storeIntegralOrder($data));
}
/**
* 供应商资金流水导出
* @param SupplierFlowingWaterServices $services
* @return mixed
*/
public function waterExport(SupplierFlowingWaterServices $services)
{
$where = $this->request->getMore([
['supplier_id', 0],
['keyword', ''],
['data', '', '', 'time'],
]);
$where['is_del'] = 0;
$data = $services->getList($where);
return $this->success($this->service->SupplierFinanceRecord($data['list'] ?? [], '供应商资金流水导出'));
}
/**
* 供应商账单下载
* @param SupplierFlowingWaterServices $services
* @return mixed
*/
public function waterRecord(SupplierFlowingWaterServices $services)
{
[$ids] = $this->request->getMore([
['ids', ''],
['supplier_id', 0]
], true);
$where['id'] = stringToIntArray($ids);
$where['is_del'] = 0;
$data = $services->getList($where);
return $this->success($this->service->SupplierFinanceRecord($data['list'] ?? []));
}
/**
* 发票导出
* @param StoreOrderInvoiceServices $services
* @return mixed
*/
public function invoiceExport(StoreOrderInvoiceServices $services)
{
$where = $this->request->getMore([
['status', 0],
['real_name', ''],
['header_type', ''],
['type', ''],
['data', '', '', 'time'],
['field_key', ''],
]);
$data = $services->getList($where);
return $this->success($this->service->invoiceRecord($data['list'] ?? []));
}
/**
* 系统表单收集数据导出
* @param SystemFormDataServices $systemFormDataServices
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException'
*/
public function systemFormDataExport(SystemFormDataServices $systemFormDataServices, $id)
{
$where = $this->request->postMore([
['data', '', '', 'time']
]);
$data = $systemFormDataServices->getFormDataList((int)$id, $where);
return $this->success($this->service->systemFormData($data['list'] ?? []));
}
public function divisionOrderExport()
{
$where = $this->request->getMore([
['time', '',],
['field_key', ''],
['real_name', ''],
['division_id', ''],
['division_agent_id', ''],
]);
$adminInfo = $this->request->adminInfo();
$data = app()->make(DivisionServices::class)->divisionOrder($adminInfo, $where)['data'];
$divisionIds = array_unique(array_column($data, 'division_id'));
$agentIds = array_unique(array_column($data, 'division_agent_id'));
$staffIds = array_unique(array_column($data, 'division_staff_id'));
$userServices = app()->make(UserServices::class);
$divisionInfos = array_column($userServices->getUserInfoList(['uids' => $divisionIds], 'uid,division_name'), 'division_name', 'uid');
$agentInfos = array_column($userServices->getUserInfoList(['uids' => $agentIds], 'uid,division_name'), 'division_name', 'uid');
$staffInfos = array_column($userServices->getUserInfoList(['uids' => $staffIds], 'uid,nickname'), 'nickname', 'uid');
foreach ($data as &$item) {
$item['division_name'] = $divisionInfos[$item['division_id']] ?? '';
$item['division_agent_name'] = $agentInfos[$item['division_agent_id']] ?? '';
$item['division_staff_name'] = $staffInfos[$item['division_staff_id']] ?? '';
}
return $this->success($this->service->divisionOrder($data, 1));
}
/**
* 导入用户错误记录导出
* @return \think\Response
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* User: liusl
* DateTime: 2024/12/19 下午5:34
*/
public function importUserExport()
{
$where = $this->request->getMore([
['record_id', '',],
]);
if (!$where['record_id']) {
return $this->fail('参数错误');
}
$data = app()->make(ImportRecordErrorServices::class)->getErrorList($where);
return $this->success($this->service->importUser($data['list'] ?? []));
}
/**
* 商品迁移数据导出
* @param StoreProductServices $services
* @return \think\Response
* User: liusl
* DateTime: 2025/1/6 下午5:10
*/
public function storeProductImport(StoreProductServices $services)
{
$where = $this->request->getMore([
['store_name', ''],
['cate_id', ''],
['type', '', '', 'status'],
['store_id', ''],
['supplier_id', ''],
['sales', 'normal'],
['store_label_id', ''],
['brand_id', ''],
['ids', ''],
['all', 0]
]);
if (!$where['ids'] && $where['all'] == 0) return $this->fail('请选择批处理商品');
if ($where['supplier_id']) {
$where['relation_id'] = $where['supplier_id'];
$where['type'] = 2;
} else {
$where['pid'] = 0;
}
$where['ids'] = stringToIntArray($where['ids']);
unset($where['supplier_id'], $where['store_id'], $where['all']);
$data = $services->searchList($where, true, $this->service->limit);
return $this->success($this->service->storeProductImport($data['list'] ?? []));
}
/**
* 礼品卡导出
* @param CardCodeServices $services
* @return \think\Response
* User: liusl
* DateTime: 2025/5/28 16:21
*/
public function cardCodeExport(CardCodeServices $services)
{
$where = $this->request->getMore([
['field_key', ''],//卡号card_number,用户名nickname,uid
['keyword', ''],//关键字
['card_id', ''],//礼品卡 id
['batch_id', ''],//批次id
['status', ''],//状态: 0-未使用 1-已使用 2-已过期
['active_time', ''],//active_time
]);
$data = $services->getList($where);
return $this->success($this->service->cardCodeExport($data['list'] ?? []));
}
/**
* 出入库导出
* @param StockRecordServices $services
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* User: liusl
* DateTime: 2025/10/10 18:33
*/
public function stockExport(StockRecordServices $services)
{
$where = $this->request->getMore([
['record_no', ''],//单据编号
['type', ''],//类型: 1-入库 2-出库
['stock_type', ''],//类型
['record_date', ''],//出库时间
['create_time', ''],//创建时间
['ids', ''],
['all', 0]
]);
if (!$where['ids'] && $where['all'] == 0) return $this->fail('请选择批处理');
$where['id'] = stringToIntArray($where['ids']);
$data = $services->getStockRecordList($where, ['items'], $this->service->limit);
return $this->success($this->service->stockExport($data['list'] ?? [], 1, $where['type']));
}
/**
* 出入库明细导出
* @param StockRecordServices $services
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* User: liusl
* DateTime: 2025/10/10 18:36
*/
public function stockDetailsExport(StockRecordServices $services)
{
$where = $this->request->getMore([
['record_no', ''],//单据编号
['stock_type', ''],//类型
['create_time', ''],//创建时间
['unique', ''],
['type', ''],//类型: 1-入库 2-出库
['record_date', ''],//创建时间
]);
$data = $services->getStockDetailsList($where,$this->service->limit);
return $this->success($this->service->stockDetailsExport($data));
}
/**
* 盘点导出
* @param StockInventoryServices $services
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* User: liusl
* DateTime: 2025/10/10 18:34
*/
public function inventoryExport(StockInventoryServices $services)
{
$where = $this->request->getMore([
['record_no', ''],
['create_time', ''],
['status', ''],
['ids', ''],
['all', 0]
]);
if (!$where['ids'] && $where['all'] == 0) return $this->fail('请选择批处理');
$where['id'] = stringToIntArray($where['ids']);
$data = $services->getStockRecordList($where, ['items'], $this->service->limit);
return $this->success($this->service->inventoryExport($data['list'] ?? []));
}
}

View File

@@ -0,0 +1,115 @@
<?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\controller\admin\v1\other\queue;
use app\controller\admin\AuthController;
use app\services\other\queue\QueueAuxiliaryServices;
use app\services\other\queue\QueueServices;
use think\annotation\Inject;
/**
* Class Queue
* @package app\controller\admin\v1\queue
*/
class Queue extends AuthController
{
/**
* @var QueueServices
*/
#[Inject]
protected QueueServices $services;
/**
* 队列任务列表
* @return mixed
*/
public function index()
{
$where = $this->request->getMore([
['data', '', '', 'time'],
['type', [6, 7, 8, 9, 10]],
['status', [0, 1, 2, 3]],
['page', 1],
['limit', 20],
]);
$data = $this->services->getList($where);
return $this->success($data);
}
/**
* 批量发货记录
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function delivery_log($id, $type)
{
/** @var QueueAuxiliaryServices $auxiliaryService */
$auxiliaryService = app()->make(QueueAuxiliaryServices::class);
$data = $auxiliaryService->deliveryLogList(['binding_id' => $id, 'type' => $type]);
return $this->success($data);
}
/**
* 再次执行批量任务
* @param $id
* @param $type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function again_do_queue($id, $type)
{
if (!$id || !$type) return $this->fail("参数缺失");
$this->services->againDoQueue($id, $type);
return $this->success("后台程序已再次执行此批量任务");
}
/**
* 清除异常任务
* @param $id
* @param $type
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function del_wrong_queue($id, $type)
{
if (!$id || !$type) return $this->fail("参数缺失");
$res = $this->services->delWrongQueue($id, $type);
return $this->success($res ? "异常任务清除成功" : "数据无异常");
}
/**
* 任务停止
* @param $id
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function stop_wrong_queue($id)
{
if (!$id) return $this->fail("参数缺失");
$queueInfo = $this->services->getQueueOne(['id' => $id]);
if (!$queueInfo) $this->fail('任务不存在');
$this->services->delWrongQueue($id, $queueInfo['type'], false);
return $this->success("任务停止成功");
}
}