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,190 @@
<?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\agent;
use app\controller\admin\AuthController;
use app\services\agent\AgentLevelServices;
use app\services\agent\AgentLevelTaskServices;
use FormBuilder\Exception\FormBuilderException;
use think\annotation\Inject;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
/**
* Class AgentLevel
* @package app\controller\admin\v1\agent
*/
class AgentLevel extends AuthController
{
/**
* @var AgentLevelServices
*/
#[Inject]
protected AgentLevelServices $services;
/**
* 显示资源列表
*
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function index()
{
$where = $this->request->getMore([
['status', ''],
['keyword', '']
]);
return $this->success($this->services->getLevelList($where));
}
/**
* 显示创建资源表单页.
*
* @return Response
* @throws FormBuilderException
*/
public function create()
{
return $this->success($this->services->createForm());
}
/**
* 保存新建的资源
*
* @return Response
*/
public function save()
{
$data = $this->request->postMore([
['name', ''],
['grade', 0],
['image', ''],
['color', ''],
['one_brokerage', 0],
['two_brokerage', 0],
['status', 0]]);
$data['name'] = trim($data['name']);
if (!$data['name']) return $this->fail('请输入等级名称');
if (!$data['grade']) return $this->fail('请输入等级');
if (!$data['image']) return $this->fail('请选择等级背景图');
if (!$data['color']) return $this->fail('请选择字体颜色');
if ((int)$data['two_brokerage'] > (int)$data['one_brokerage']) {
return $this->fail('二级上浮整体返佣比例不能大于一级');
}
$grade = $this->services->get(['grade' => $data['grade'], 'is_del' => 0]);
if ($grade) {
return $this->fail('当前等级已存在');
}
$data['add_time'] = time();
$this->services->save($data);
return $this->success('添加等级成功!');
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return Response
* @throws FormBuilderException
*/
public function edit($id)
{
return $this->success($this->services->editForm((int)$id));
}
/**
* 保存更新的资源
*
* @param int $id
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function update($id)
{
$data = $this->request->postMore([
['name', ''],
['grade', 0],
['image', ''],
['color', ''],
['one_brokerage', 0],
['two_brokerage', 0],
['status', 0]]);
$data['name'] = trim($data['name']);
if (!$data['name']) return $this->fail('请输入等级名称');
if (!$data['grade']) return $this->fail('请输入等级');
if (!$data['image']) return $this->fail('请选择等级背景图');
if (!$data['color']) return $this->fail('请选择字体颜色');
if ((int)$data['two_brokerage'] > (int)$data['one_brokerage']) {
return $this->fail('二级上浮整体返佣比例不能大于一级');
}
if (!$levelInfo = $this->services->getLevelInfo((int)$id)) return $this->fail('编辑的等级不存在!');
$grade = $this->services->get(['grade' => $data['grade'], 'is_del' => 0]);
if ($grade && $grade['id'] != $id) {
return $this->fail('当前等级已存在');
}
$levelInfo->name = $data['name'];
$levelInfo->grade = $data['grade'];
$levelInfo->image = $data['image'];
$levelInfo->color = $data['color'];
$levelInfo->one_brokerage = $data['one_brokerage'];
$levelInfo->two_brokerage = $data['two_brokerage'];
$levelInfo->status = $data['status'];
$levelInfo->save();
return $this->success('修改成功!');
}
/**
* 删除指定资源
* @param $id
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function delete($id)
{
if (!$id) return $this->fail('参数错误,请重新打开');
$levelInfo = $this->services->getLevelInfo((int)$id);
if ($levelInfo) {
$res = $this->services->update($id, ['is_del' => 1]);
if (!$res)
return $this->fail('删除失败,请稍候再试!');
/** @var AgentLevelTaskServices $agentLevelTaskServices */
$agentLevelTaskServices = app()->make(AgentLevelTaskServices::class);
$agentLevelTaskServices->update(['level_id' => $id], ['is_del' => 1]);
}
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, ['status' => $status]);
return $this->success($status == 0 ? '隐藏成功' : '显示成功');
}
}

View File

@@ -0,0 +1,181 @@
<?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\agent;
use app\controller\admin\AuthController;
use app\services\agent\AgentLevelTaskServices;
use FormBuilder\Exception\FormBuilderException;
use think\annotation\Inject;
use think\db\exception\DataNotFoundException;
use think\db\exception\DbException;
use think\db\exception\ModelNotFoundException;
use think\Response;
/**
* Class AgentLevelTask
* @package app\controller\admin\v1\agent
*/
class AgentLevelTask extends AuthController
{
/**
* @var AgentLevelTaskServices
*/
#[Inject]
protected AgentLevelTaskServices $services;
/**
* 显示资源列表
*
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function index()
{
$where = $this->request->getMore([
['id', 0],
['status', ''],
['keyword', '']
]);
if (!$where['id']) {
return $this->fail('缺少参数ID');
}
$where['level_id'] = $where['id'];
unset($where['id']);
return $this->success($this->services->getLevelTaskList($where));
}
/**
* 显示创建资源表单页.
*
* @return Response
* @throws FormBuilderException
*/
public function create()
{
[$level_id] = $this->request->postMore([
['level_id', 0]], true);
if (!$level_id) {
return $this->fail('缺少等级ID');
}
return $this->success($this->services->createForm((int)$level_id));
}
/**
* 保存新建的资源
*
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function save()
{
$data = $this->request->postMore([
['level_id', 0],
['name', ''],
['type', ''],
['number', 0],
['desc', 0],
['sort', 0],
['status', 0]]);
if (!$data['level_id']) return $this->fail('缺少等级ID');
if (!$data['name']) return $this->fail('请输入等级名称');
if (!$data['type']) return $this->fail('请选择任务类型');
if (!$data['number']) return $this->fail('请输入限定数量');
$this->services->checkTypeTask(0, $data);
$data['add_time'] = time();
$this->services->save($data);
return $this->success('添加等级任务成功!');
}
/**
* 显示编辑资源表单页.
*
* @param int $id
* @return Response
* @throws FormBuilderException
*/
public function edit($id)
{
return $this->success($this->services->editForm((int)$id));
}
/**
* 保存更新的资源
*
* @param int $id
* @return Response
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function update($id)
{
$data = $this->request->postMore([
['name', ''],
['type', ''],
['number', 0],
['desc', 0],
['sort', 0],
['status', 0]]);
if (!$data['name']) return $this->fail('请输入等级名称');
if (!$data['type']) return $this->fail('请选择任务类型');
if (!$data['number']) return $this->fail('请输入限定数量');
if (!$levelTaskInfo = $this->services->getLevelTaskInfo((int)$id)) return $this->fail('编辑的任务不存在!');
$this->services->checkTypeTask((int)$id, $data);
$levelTaskInfo->name = $data['name'];
$levelTaskInfo->type = $data['type'];
$levelTaskInfo->number = $data['number'];
$levelTaskInfo->desc = $data['desc'];
$levelTaskInfo->sort = $data['sort'];
$levelTaskInfo->status = $data['status'];
$levelTaskInfo->save();
return $this->success('修改成功!');
}
/**
* 删除指定资源
* @param $id
* @return mixed
* @throws DataNotFoundException
* @throws DbException
* @throws ModelNotFoundException
*/
public function delete($id)
{
if (!$id) return $this->fail('参数错误,请重新打开');
$levelTaskInfo = $this->services->getLevelTaskInfo((int)$id);
if ($levelTaskInfo) {
$res = $this->services->update($id, ['is_del' => 1]);
if (!$res)
return $this->fail('删除失败,请稍候再试!');
}
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, ['status' => $status]);
return $this->success($status == 0 ? '隐藏成功' : '显示成功');
}
}

View File

@@ -0,0 +1,334 @@
<?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\agent;
use app\controller\admin\AuthController;
use app\jobs\user\UserFriendsJob;
use app\jobs\user\UserSpreadJob;
use app\services\agent\AgentLevelServices;
use app\services\agent\AgentManageServices;
use app\services\other\AgreementServices;
use app\services\user\UserServices;
use think\annotation\Inject;
use function Sodium\compare;
/**
* 分销商管理控制器
* Class AgentManage
* @package app\controller\admin\v1\agent
*/
class AgentManage extends AuthController
{
/**
* @var AgentManageServices
*/
#[Inject]
protected AgentManageServices $services;
/**
* 分销管理列表
* @return mixed
*/
public function index()
{
$where = $this->request->getMore([
['nickname', ''],
['data', ''],
]);
return $this->success($this->services->agentSystemPage($where));
}
/**
* 分销头部统计
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function get_badge()
{
$where = $this->request->getMore([
['data', ''],
['nickname', ''],
]);
return $this->success(['res' => $this->services->getSpreadBadge($where)]);
}
/**
* 推广人列表
* @return mixed
*/
public function get_stair_list()
{
$where = $this->request->getMore([
['uid', 0],
['data', ''],
['nickname', ''],
['type', '']
]);
return $this->success($this->services->getStairList($where));
}
/**
* 推广人列表头部统计
* @return mixed
*/
public function get_stair_badge()
{
$where = $this->request->getMore([
['uid', ''],
['data', ''],
['nickname', ''],
['type', ''],
]);
return $this->success(['res' => $this->services->getSairBadge($where)]);
}
/**
* 统计推广订单列表
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function get_stair_order_list()
{
$where = $this->request->getMore([
['uid', 0],
['data', ''],
['order_id', ''],
['type', ''],
['nickname', '']
]);
return $this->success($this->services->getStairOrderList((int)$where['uid'], $where));
}
/**
* 统计推广订单头部统计
* @return mixed
*/
public function get_stair_order_badge()
{
return $this->success();
}
/**
* 查看公众号推广二维码
* @param int $uid
* @return json
* */
public function look_code($uid = '', $action = '')
{
if (!$uid || !$action) return $this->fail('缺少参数');
try {
if (method_exists($this, $action)) {
$res = $this->$action($uid);
if ($res)
return $this->success($res);
else
return $this->fail(isset($res['msg']) ? $res['msg'] : '获取失败,请稍后再试!');
} else
return $this->fail('暂无此方法');
} catch (\Exception $e) {
return $this->fail('获取推广二维码失败,请检查您的微信配置', ['line' => $e->getLine(), 'messag' => $e->getMessage()]);
}
}
/**
* 获取公众号二维码
* */
public function wechant_code($uid)
{
$qr_code = $this->services->wechatCode((int)$uid);
if (isset($qr_code['url']))
return ['code_src' => $qr_code['url']];
else
return $this->fail('获取失败,请稍后再试!');
}
/**
* 查看小程序推广二维码
* @param string $uid
*/
public function look_xcx_code($uid = '')
{
if (!strlen(trim($uid))) {
return $this->fail('缺少参数');
}
return $this->success($this->services->lookXcxCode((int)$uid));
}
/**
* 查看H5推广二维码
* @param string $uid
* @return mixed|string
*/
public function look_h5_code($uid = '')
{
if (!strlen(trim($uid))) return $this->fail('缺少参数');
return $this->success($this->services->lookH5Code((int)$uid));
}
/**
* 解除单个用户的推广权限
* @param int $uid
* */
public function delete_spread($uid)
{
if (!$uid) $this->fail('缺少参数');
return $this->success($this->services->delSpread((int)$uid) ? '解除成功' : '解除失败');
}
/**
* 修改上级推广人
* @param UserServices $services
* @return mixed
*/
public function editSpread(UserServices $services)
{
[$uid, $spreadUid] = $this->request->postMore([
[['uid', 'd'], 0],
[['spread_uid', 'd'], 0],
], true);
if (!$uid || !$spreadUid) {
return $this->fail('缺少参数');
}
if ($uid == $spreadUid) {
return $this->fail('上级推广人不能为自己');
}
$userInfo = $services->get($uid);
if (!$userInfo) {
return $this->fail('用户不存在');
}
if (!$services->count(['uid' => $spreadUid])) {
return $this->fail('上级用户不存在');
}
if ($userInfo->spread_uid == $spreadUid) {
return $this->fail('当前推广人已经是所选人');
}
$spreadInfo = $services->get($spreadUid);
if ($spreadInfo->spread_uid == $uid) {
return $this->fail('上级推广人不能为自己下级');
}
$userInfo->spread_uid = $spreadUid;
$userInfo->spread_time = time();
$userInfo->division_id = $spreadInfo->division_id;
$userInfo->agent_id = $spreadInfo->agent_id;
$userInfo->staff_id = $spreadInfo->staff_id;
$userInfo->save();
//记录推广绑定关系
UserSpreadJob::dispatch([(int)$uid, (int)$spreadUid]);
//记录好友关系
UserFriendsJob::dispatch([(int)$uid, (int)$spreadUid]);
return $this->success('修改成功');
}
/**
* 取消推广员推广资格
* @param $uid
* @return mixed
*/
public function delete_system_spread($uid)
{
if (!$uid) $this->fail('缺少参数');
return $this->success($this->services->delSystemSpread((int)$uid) ? '取消成功' : '取消失败');
}
/**
* 获取赠送分销等级表单
* @param $uid
* @return mixed
*/
public function getLevelForm(AgentLevelServices $services, $uid)
{
if (!$uid) $this->fail('缺少参数');
return $this->success($services->levelForm((int)$uid));
}
/**
* 赠送分销等级
* @param AgentLevelServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function giveAgentLevel(AgentLevelServices $services)
{
[$uid, $id] = $this->request->postMore([
[['uid', 'd'], 0],
[['id', 'd'], 0],
], true);
if (!$uid || !$id) {
return $this->fail('缺少参数');
}
return $this->success($services->givelevel((int)$uid, (int)$id) ? '赠送成功' : '赠送失败');
}
/**
* 保存分销说明
* @param $id
* @param AgreementServices $agreementServices
* @return mixed
*/
public function setAgentAgreement($id, AgreementServices $agreementServices)
{
$data = $this->request->postMore([
['type', 2],
['title', ""],
['content', ''],
['status', ''],
]);
$data['title'] = $data['title'] ?: '分销说明';
return $this->success($agreementServices->saveAgreement($data, (int)$id));
}
/**
* 获取分销说明
* @param AgreementServices $agreementServices
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getAgentAgreement(AgreementServices $agreementServices)
{
$list = $agreementServices->getAgreementBytype(2);
if ($list && isset($list['title'])) $list['title'] = $list['title'] ?: '分销说明';
return $this->success($list);
}
/**
* 分销方式
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/9/5
*/
public function promoterMode($type = 1)
{
$list = [];
$list[] = ['text' => '全部', 'val' => 0];
$list[] = ['text' => '一级推广人', 'val' => 1];
if (sys_config('brokerage_level') == 2) {
$list[] = ['text' => '二级推广人', 'val' => 2];
}
if ($type == 1 && sys_config('division_open') == 1) {
$list[] = ['text' => '事业部', 'val' => 3];
$list[] = ['text' => '代理商', 'val' => 4];
$list[] = ['text' => '员工', 'val' => 5];
}
return $this->success(compact('list'));
}
}

View File

@@ -0,0 +1,374 @@
<?php
namespace app\controller\admin\v1\agent;
use app\controller\admin\AuthController;
use app\services\agent\DivisionApplyServices;
use app\services\agent\DivisionServices;
use think\annotation\Inject;
class Division extends AuthController
{
#[Inject]
protected DivisionServices $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 2024/8/21
*/
public function divisionList()
{
$where = $this->request->getMore([
['division_type', 0],
['keyword', '', '', 'division_name'],
]);
if (!in_array($where['division_type'], [1, 2, 3])) {
return $this->fail('参数错误');
}
$data = $this->services->getDivisionList($where);
return $this->success($data);
}
/**
* 下级代理商/员工列表
* @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 2024/8/21
*/
public function divisionDownList()
{
$where = $this->request->getMore([
['division_type', 0],
['nickname', ''],
['uid', 0],
]);
if ($where['division_type'] == 2) {
$where['division_id'] = $where['uid'];
} elseif ($where['division_type'] == 3) {
$where['agent_id'] = $where['uid'];
}
unset($where['uid']);
$data = $this->services->getDivisionList($where);
return $this->success($data);
}
/**
* 事业部添加表单
* @param $uid
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function getDivisionForm($uid)
{
return $this->success($this->services->getDivisionForm($uid));
}
/**
* 保存事业部
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function saveDivision()
{
$data = $this->request->postMore([
['uid', 0],
['aid', 0],
['division_percent', 0],
['division_end_time', ''],
['division_status', 1],
['account', ''],
['phone', ''],
['pwd', ''],
['conf_pwd', ''],
['division_name', ''],
['roles', []],
['image', []]
]);
$this->services->saveDivision($data);
return $this->success('保存成功');
}
/**
* 代理商添加表单
* @param $uid
* @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 2024/8/21
*/
public function getDivisionAgentForm($uid)
{
return $this->success($this->services->getDivisionAgentForm($uid));
}
/**
* 保存代理商
* @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 2024/8/21
*/
public function saveDivisionAgent()
{
$data = $this->request->postMore([
['division_name', ''],
['division_id', 0],
['uid', 0],
['image', []],
['division_percent', 0],
['division_end_time', ''],
['division_status', 1],
]);
$this->services->saveDivisionAgent($data);
return $this->success('保存成功');
}
/**
* 员工添加表单
* @param $uid
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function getDivisionStaffForm($uid)
{
return $this->success($this->services->getDivisionStaffForm($uid));
}
/**
* 保存员工
* @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 2024/8/21
*/
public function saveDivisionStaff()
{
$data = $this->request->postMore([
['uid', 0],
['division_percent', 0],
['agent_id', 0],
['image', []],
]);
$this->services->saveDivisionStaff($data);
return $this->success('保存成功');
}
/**
* 删除事业部/代理商/员工
* @param $uid
* @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 2024/8/21
*/
public function deleteDivision($uid)
{
$this->services->deleteDivision($uid);
return $this->success('删除成功');
}
/**
* 设置状态
* @param $uid
* @param $status
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function setStatus($uid, $status)
{
$this->services->setStatus($uid, $status);
return $this->success('设置成功');
}
/**
* 代理商申请列表
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function applyList()
{
$where = $this->request->getMore([
['status', ''],
['keyword', ''],
]);
$where['division_id'] = $this->adminInfo['division_id'];
return $this->success(app()->make(DivisionApplyServices::class)->applyList($where));
}
/**
* 申请审核表单
* @param $id
* @param $type
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function applyExamine($id, $type)
{
return $this->success(app()->make(DivisionApplyServices::class)->applyExamine($id, $type));
}
/**
* 审核保存
* @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 2024/8/21
*/
public function applyExamineSave()
{
$data = $this->request->postMore([
['type', 0],
['id', 0],
['division_percent', ''],
['division_end_time', ''],
['division_status', ''],
['refusal_reason', 0]
]);
app()->make(DivisionApplyServices::class)->applyExamineSave($data);
return $this->success($data['type'] == 1 ? '审核通过' : '拒绝成功');
}
/**
* 申请删除
* @param $id
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function applyDelete($id)
{
app()->make(DivisionApplyServices::class)->applyDelete($id);
return $this->success('删除成功');
}
/**
* 事业部订单
* @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 2024/8/21
*/
public function divisionOrder()
{
$where = $this->request->getMore([
['time', '',],
['field_key', ''],
['real_name', ''],
['division_id', ''],
['division_agent_id', ''],
]);
$adminInfo = $this->request->adminInfo();
return $this->success($this->services->divisionOrder($adminInfo, $where));
}
/**
* 获取事业部选项列表
* @return \think\Response
*/
public function divisionOption()
{
return $this->success($this->services->divisionOption());
}
/**
* 获取代理商选项列表
* @param int $division_id 事业部ID
* @return \think\Response
*/
public function agentOption($division_id)
{
return $this->success($this->services->agentOption($division_id));
}
/**
* 事业部统计基础信息
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function divisionStatistics()
{
$adminInfo = $this->request->adminInfo();
$divisionId = $adminInfo['division_id'];
return $this->success($this->services->divisionStatistics($divisionId));
}
/**
* 事业部统计趋势
* @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 2024/8/21
*/
public function divisionTrend()
{
[$time] = $this->request->getMore([
['time', '']
], true);
$adminInfo = $this->request->adminInfo();
$divisionId = $adminInfo['division_id'];
return $this->success($this->services->divisionTrend($time, $divisionId));
}
/**
* 事业部统计排行
* @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 2024/8/26
*/
public function divisionRanking()
{
$adminInfo = $this->request->adminInfo();
$divisionId = $adminInfo['division_id'];
return $this->success($this->services->divisionRanking($divisionId));
}
}

View File

@@ -0,0 +1,76 @@
<?php
namespace app\controller\admin\v1\agent;
use app\controller\admin\AuthController;
use app\services\agent\PromoterApplyServices;
use think\annotation\Inject;
class PromoterApply extends AuthController
{
/**
* @var PromoterApplyServices
*/
#[Inject]
protected PromoterApplyServices $services;
/**
* 分销员申请列表
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function applyList()
{
$where = $this->request->getMore([
['status', ''],
['keyword', ''],
]);
return $this->success($this->services->applyList($where));
}
/**
* 申请审核
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function applyExamine($id)
{
return $this->success($this->services->applyExamine($id));
}
/**
* 申请审核保存
* @param $id
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2025/7/16
*/
public function applyExamineSave($id)
{
$data = $this->request->postMore([
['status', 0],
['refusal_reason', ''],
]);
$this->services->applyExamineSave($id, $data);
return $this->success($data['status'] == 1 ? '审核通过' : '拒绝申请');
}
/**
* 申请删除
* @param $id
* @return \think\Response
* @author wuhaotian
* @email 442384644@qq.com
* @date 2024/8/21
*/
public function applyDelete($id)
{
$this->services->applyDelete($id);
return $this->success('删除成功');
}
}