Initial commit: queue workspace
Made-with: Cursor
This commit is contained in:
62
pro_v3.5.1/app/controller/api/v2/agent/Agent.php
Normal file
62
pro_v3.5.1/app/controller/api/v2/agent/Agent.php
Normal file
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2022 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\controller\api\v2\agent;
|
||||
|
||||
use app\Request;
|
||||
use app\services\other\AgreementServices;
|
||||
use app\services\user\UserBrokerageServices;
|
||||
use app\services\user\UserServices;
|
||||
|
||||
class Agent
|
||||
{
|
||||
/**
|
||||
* 获取用户推广用户列表
|
||||
* @param Request $request
|
||||
* @param UserServices $userServices
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function agentUserList(Request $request, UserServices $userServices)
|
||||
{
|
||||
[$type] = $request->getMore([
|
||||
['type', 0]
|
||||
], true);
|
||||
$uid = $request->uid();
|
||||
return app('json')->successful($userServices->agentUserList($uid, $type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户推广获得收益,佣金轮播,分销规则
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function agentInfo(Request $request)
|
||||
{
|
||||
/** @var AgreementServices $agreementService */
|
||||
$agreementService = app()->make(AgreementServices::class);
|
||||
/** @var UserBrokerageServices $userBrokerageServices */
|
||||
$userBrokerageServices = app()->make(UserBrokerageServices::class);
|
||||
$data['agreement'] = $agreementService->getAgreementBytype(2)['content'] ?? '';
|
||||
$data['price'] = $userBrokerageServices->sum(['uid' => $request->uid(), 'pm' => 1, 'not_type' => ['extract_fail', 'refund']], 'number', true);
|
||||
$list = $userBrokerageServices->getList(['pm' => 1, 'not_type' => ['extract_fail', 'refund']], '*', 1, 10, [], ['user']);
|
||||
foreach ($list as $item) {
|
||||
$data['list'][] = [
|
||||
'nickname' => $item['user']['nickname'] ?? '',
|
||||
'price' => $item['number']
|
||||
];
|
||||
}
|
||||
return app('json')->successful($data);
|
||||
}
|
||||
}
|
||||
77
pro_v3.5.1/app/controller/api/v2/agent/AgentLevel.php
Normal file
77
pro_v3.5.1/app/controller/api/v2/agent/AgentLevel.php
Normal file
@@ -0,0 +1,77 @@
|
||||
<?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\api\v2\agent;
|
||||
|
||||
|
||||
use app\Request;
|
||||
use app\services\agent\AgentLevelServices;
|
||||
use app\services\agent\AgentLevelTaskServices;
|
||||
use think\annotation\Inject;
|
||||
|
||||
/**
|
||||
* Class AgentLevel
|
||||
* @package app\controller\api\v2\agent
|
||||
*/
|
||||
class AgentLevel
|
||||
{
|
||||
|
||||
/**
|
||||
* @var AgentLevelServices
|
||||
*/
|
||||
#[Inject]
|
||||
protected AgentLevelServices $services;
|
||||
|
||||
/**
|
||||
* 检测用户是否可以成为会员
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function detection(Request $request)
|
||||
{
|
||||
return app('json')->successful($this->services->detection((int)$request->uid()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分销员等级列表
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function levelList(Request $request)
|
||||
{
|
||||
return app('json')->successful($this->services->getUserlevelList((int)$request->uid()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取等级任务
|
||||
* @param Request $request
|
||||
* @param AgentLevelTaskServices $services
|
||||
* @param $id
|
||||
* @return mixed
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function levelTaskList(Request $request, AgentLevelTaskServices $services, $id)
|
||||
{
|
||||
return app('json')->successful($services->getUserLevelTaskList((int)$request->uid(), (int)$id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员详情
|
||||
* @param Request $request
|
||||
* @return mixed
|
||||
*/
|
||||
public function userLevelInfo(Request $request)
|
||||
{
|
||||
return app('json')->successful($this->services->getUserLevelInfo((int)$request->uid()));
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user