Files
huangjingfen/pro_v3.5.1/app/controller/supplier/user/User.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

85 lines
2.3 KiB
PHP

<?php
// +----------------------------------------------------------------------
// | Author: ScottPan Team
// +----------------------------------------------------------------------
namespace app\controller\supplier\user;
use app\services\user\UserSpreadServices;
use think\annotation\Inject;
use app\services\user\UserServices;
use app\controller\supplier\AuthController;
use app\services\product\product\StoreProductLogServices;
class User extends AuthController
{
/**
* @var UserServices
*/
#[Inject]
protected UserServices $services;
/**
* 显示用户信息
*
* @param int $id
* @return \think\Response
*/
public function read($id)
{
if (is_string($id)) {
$id = (int)$id;
}
return $this->success($this->services->read($id));
}
/**
* 获取单个用户信息
* @param $id 用户id
* @return mixed
*/
public function oneUserInfo($id)
{
$data = $this->request->getMore([
['type', ''],
]);
$id = (int)$id;
if ($data['type'] == '') return $this->fail('缺少参数');
return $this->success($this->services->oneUserInfo($id, $data['type']));
}
/**
* 商品浏览记录
* @param $id
* @param StoreProductLogServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function visitList($id, StoreProductLogServices $services)
{
$where['uid'] = (int)$id;
$where['type'] = 'visit';
return app('json')->success($services->getList($where, 'product_id'));
}
/**
* 获取推广人记录
* @param $id
* @param UserSpreadServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function spreadList($id, UserSpreadServices $services)
{
$where['store_id'] = 0;
$where['staff_id'] = 0;
$where['uid'] = $id;
return app('json')->success($services->getSpreadList($where, '*', ['spreadUser', 'admin'], false));
}
}