Files
huangjingfen/pro_v3.5.1/app/controller/api/v1/user/UserBrokerage.php
panchengyong c1e74d8e68 chore(php): 统一 ScottPan 文件头与注释域名替换
- 按 docs/renew-code-comment.md 将 PHP 文件头改为带边框的 Author 注释\n- 注释中的 crmeb.com 替换为 uj345.cn(代码字符串中的外链未改)\n- 新增 docs/renew-code-comment.md 说明

Made-with: Cursor
2026-03-29 11:22:58 +08:00

147 lines
3.8 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | Author: ScottPan Team
// +----------------------------------------------------------------------
namespace app\controller\api\v1\user;
use app\Request;
use app\services\user\UserBrokerageServices;
use think\annotation\Inject;
/**
* 佣金
* Class UserBrokerage
* @package app\controller\api\v1\user
*/
class UserBrokerage
{
/**
* @var UserBrokerageServices
*/
#[Inject]
protected UserBrokerageServices $services;
/**
* 推广数据 昨天的佣金 累计提现金额 当前佣金
* @param Request $request
* @return mixed
*/
public function commission(Request $request)
{
$uid = (int)$request->uid();
return app('json')->successful($this->services->commission($uid));
}
/**
* 推广订单
* @param Request $request
* @return mixed
*/
public function spread_order(Request $request)
{
$orderInfo = $request->postMore([
['page', 1],
['limit', 20],
['category', 'now_money'],
['type', 'brokerage'],
['start', 0],
['stop', 0],
['keyword', '']
]);
$uid = (int)$request->uid();
return app('json')->successful($this->services->spread_order($uid, $orderInfo));
}
/**
* 订单收益明细
* @param Request $request
* @return \think\Response
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* User: liusl
* DateTime: 2024/11/22 上午10:45
*/
public function order_income(Request $request)
{
$where = $request->getMore([
['start', 0],
['stop', 0],
]);
$uid = (int)$request->uid();
return app('json')->successful($this->services->orderIncome($uid, $where));
}
/**
* 数据总览
* @param Request $request
* @return \think\Response
* User: liusl
* DateTime: 2024/11/23 下午12:11
*/
public function overview(Request $request)
{
$where = $request->getMore([
['start', 0],
['stop', 0],
]);
$uid = (int)$request->uid();
return app('json')->successful($this->services->overview($uid, $where));
}
/**
* 用户贡献
* @param $type
* @param Request $request
* @return \think\Response
* @throws \ReflectionException
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
* User: liusl
* DateTime: 2024/11/23 下午2:18
*/
public function contribute($type, Request $request)
{
$uid = (int)$request->uid();
return app('json')->successful($this->services->contribute($uid, $type));
}
/**
* 推广 佣金/提现 总和
* @param Request $request
* @param $type 3 佣金 4 提现
* @return mixed
*/
public function spread_count(Request $request, $type)
{
$uid = (int)$request->uid();
return app('json')->successful(['count' => $this->services->spread_count($uid, $type)]);
}
/**
* 佣金排行
* @param Request $request
* @return mixed
*/
public function brokerage_rank(Request $request)
{
$data = $request->getMore([
['page', ''],
['limit'],
['type']
]);
$uid = (int)$request->uid();
$userInfo = $request->user();
$data = $this->services->brokerage_rank($uid, $data['type']);
$data['nickname'] = $userInfo['nickname'];
$data['avatar'] = $userInfo['avatar'];
return app('json')->success($data);
}
}