57 lines
1.5 KiB
PHP
57 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace app\controller\api;
|
|
|
|
|
|
use app\common\repositories\marketing\AgentRepository;
|
|
use crmeb\basic\BaseController;
|
|
use think\App;
|
|
|
|
|
|
class Agent extends BaseController{
|
|
|
|
protected $repository;
|
|
|
|
public function __construct(App $app, AgentRepository $repository){
|
|
parent::__construct($app);
|
|
$this->repository = $repository;
|
|
}
|
|
/**
|
|
* Common: 获取代理列表
|
|
* Author: wu-hui
|
|
* Time: 2024/01/29 16:00
|
|
* @return mixed
|
|
*/
|
|
public function agentList(){
|
|
// 参数处理
|
|
[$page, $limit] = $this->getPage();
|
|
$params = $this->request->params(['is_get_self','not_page']);
|
|
if((int)$params['is_get_self'] > 0) $params['uid'] = $this->request->uid();
|
|
// 信息列表获取
|
|
if((int)$params['not_page'] > 0) $data = app()->make(AgentRepository::class)->getAllList((array)$params);
|
|
else $data = app()->make(AgentRepository::class)->getList((array)$params,(int)$page,(int)$limit);
|
|
|
|
return app('json')->success($data);
|
|
}
|
|
/**
|
|
* Common: 二维码 - 供应商入驻二维码
|
|
* Author: wu-hui
|
|
* Time: 2024/01/29 17:40
|
|
* @return mixed
|
|
*/
|
|
public function qrCodeInviteSupplier(){
|
|
// 参数获取
|
|
$agentId = (int)$this->request->param('agent_id');
|
|
if((int)$agentId > 0){
|
|
$qrcode = $this->repository->createQrCode(['agent_id'=>$agentId]);
|
|
|
|
return app('json')->success(['qr_code' => $qrcode]);
|
|
}
|
|
|
|
return app('json')->fail('小程序码生成失败!');
|
|
}
|
|
|
|
|
|
|
|
}
|