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)); } }