徐总多门店
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

89 lines
2.9 KiB

<?php
// +----------------------------------------------------------------------
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
// +----------------------------------------------------------------------
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
namespace app\controller\api\pc;
use app\Request;
use app\services\pc\UserServices;
use app\services\user\UserRelationServices;
use app\services\user\UserBrokerageServices;
use app\services\user\UserMoneyServices;
/**
* pc端用户信息类
* Class User
* @package app\controller\api\pc
*/
class User
{
protected $services;
public function __construct(UserServices $services)
{
$this->services = $services;
}
/**
* 用户记录0:所有余额1:余额消费2:余额充值3:佣金4:提现
* @param Request $request
* @param $type
* @return mixed
*/
public function getBalanceRecord(Request $request, $type)
{
$data = $request->getMore([
['start', 0],
['stop', 0],
['keyword', ''],
]);
$uid = (int)$request->uid();
switch ((int)$type) {
case 0:
case 1:
case 2:
/** @var UserMoneyServices $services */
$services = app()->make(UserMoneyServices::class);
$data = $services->userMoneyList($uid, (int)$type);
break;
case 3:
/** @var UserBrokerageServices $services */
$services = app()->make(UserBrokerageServices::class);
$data = $services->userBrokerageList($uid, $data);
break;
case 4:
/** @var UserBrokerageServices $services */
$services = app()->make(UserBrokerageServices::class);
$data = $services->userExtractList($uid);
break;
default:
$data = [];
}
return app('json')->successful($data);
}
/**
* 获取收藏列表
* @param Request $request
* @param UserRelationServices $services
* @return mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
* @throws \think\db\exception\ModelNotFoundException
*/
public function getCollectList(Request $request, UserRelationServices $services)
{
$uid = (int)$request->uid();
$list = $services->getUserRelationList($uid);
$count = $services->getUserCount($uid);
return app('json')->successful(compact('list', 'count'));
}
}