lan = $this->request->getLan(); } /** * 获取用户信息 * @return void */ public function userInfo(UserArea $userArea,UserModel $userModel, LedgerWalletModel $ledgerWalletModel) { $user = $this->auth->getUser(); // if (empty($user['is_super'] ) && !empty($user['address_level'])) { // $user['address_level'] = $userModel::updateUserAddresLevel($user['id'], $user['parent_id']); // } $resp = [ 'id' => $user['id'], 'nickname' => $user['nickname'], 'heading' => $user['heading'], 'address' => $user['address'],// 地址 'usdt' => '0', //USDT余额 'token' => '0', // 平台币余额 'name' => $user['name'], // 姓名 'phone' => $user['phone'], // 手机号 'rental_power' => '0', // 自己购买的算力 'team_power' => '0', // 团队总算里 'balance' => $ledgerWalletModel::getWalletChaBao($this->auth->id), // 余额 'rwa_num' => $user['rwa_num'], // 总茶权 'parent_id' => $user['parent_id'], // 上级ID 'is_super' => $user['is_super'], // 新人福利标识 'direct_super' => ['one'=>3, 'two'=>10,'direct_super'=>$user['direct_super'], 'address_level'=>$user['address_level']], // 推广新人福等级标识 'is_ecology' => $user['is_ecology'], // 生态标识 'avatar' => isHttpOrHttps($user['avatar'])? $user['avatar']: $this->request->domain().'/assets/img/logo.png', // 头像 'parent_address' => '', // 上级的地址 'team_level_id' => $user['team_level_id'], // 团队等级 'invite_link' => config('rental.invite_domain') . '/?inviteCode=' . $user['address'], 'take_address' => $userArea::getUserDefaultAdders($user['id']), // 用户地址 ]; $this->success('', $resp); } /** * 获取我的查询列表 * param int $type_id 0总览 1转让中 2已转让 3存储中 4已赠送 5已提货 * @return void */ public function getNftList(ProductOrder $productOrder, ProductTransfer $productTransfer, UserLogic $userLogic) { $typeId = $this->request->post('type_id/d', 0); $productId = $this->request->post('product_id/d', 0); //搜索条件 $where = $userLogic::getNftWhere($typeId, $productId, $productOrder); //查询 $list = $userLogic::getUserNftList($productOrder, $productTransfer, $this->lan, $this->auth->id, $this->pageSize, $where); $this->success('', $list); } /** * 获取我的查询详情 * param int $type_id 0总览 1转让中 2已转让 3存储中 4已赠送 5已提货 * @return void */ public function getMyNftList(ProductOrder $productOrder, UserLogic $userLogic) { $typeId = $this->request->post('type_id/d', 0); //搜索条件 $where = $userLogic::getNftWhere($typeId, 0, $productOrder); //查询 $list = $userLogic::getMyUserNftList($productOrder, $this->auth->id, $this->lan, $where, $this->pageSize); $this->success('', $list); } /** * 余额记录信息 * @return void */ public function getUserBalanceLog(LedgerTokenChangeModel $ledgerTokenChangeModel, UserLogic $userLogic) { $list = $userLogic::getUserBalanceLog($ledgerTokenChangeModel, $this->auth->id, $this->pageSize); $this->success('', $list); } /** * 我的茶友 * @return void */ public function getChaList(UserModel $userModel, UserLogic $userLogic) { $list = $userLogic::getUserChaList($userModel, $this->auth->id, $this->pageSize); $this->success('', $list); } //求购列表 public function getBuyingList(ProductBuying $productBuying) { $this->success('ok', $productBuying::getUserBuyingList($this->auth->id, $this->lan, $this->pageSize)); } /** * 修改个人信息 * @return void */ public function setUserInfo(UserModel $userModel, UserArea $userArea) { // 启动事务 Db::startTrans(); try { $param = $this->request->post(); $validate = \think\Loader::validate('User'); if(!$validate->scene(key($param))->check($param) || count($param) > 2 || empty($param)) $this->error(__("Invalid parameters")); //手机号修改 if(isset($param['phone']) && UserInfoLogic::checkUserByInfo('phone', $this->auth->id, $param['phone']) == false) $this->error(__("手机号已存在")); //地址时候去重 if(!isset($param['area_code']) && isset($param['address']) && UserInfoLogic::checkUserByInfo('address', $this->auth->id, $param['address']) == false) $this->error(__("钱包地址已存在不能修改")); if(isset($param['area_code']) && isset($param['area_name'])){ $resp = $userArea::setUserAddress($this->auth->id, $param['area_code'], $param['area_name']); }else{ $resp = $userModel::where('id', $this->auth->id)->update($param); } // 提交事务 Db::commit(); } catch (Exception $e) { // 回滚事务 Db::rollback(); $this->error( $e->getMessage()); } $this->success('', $resp); } /** * 获取操作信息 购买、赠送、提货、转让 * @return void */ public function getOperateLog(ProductOrder $productOrder, UserLogic $userLogic) { $typeId = $this->request->post('type_id/d', 0); $status = $this->request->post('status/d', 0); $areaId = $this->request->post('area_id/s', 0); //搜索条件 $where = $userLogic::getOperateWhere($typeId, $status, $areaId); //查询 $list = $userLogic::getUserOperateLog($productOrder, $this->lan, $this->auth->id, $this->pageSize, $where); $this->success('', $list); } //获取用户待支付订单数量 public function getWaitPayOrderCount(OrderLogic $orderLogic) { $count = $orderLogic::getWaitPayOrderCount($this->auth->id, config('market_transfer.lock_time')); $this->success('', $count); } //获取用户待支付订单 public function getWaitPayOrderList(OrderLogic $orderLogic) { $list = $orderLogic::getWaitPayOrderList($this->auth->id, config('market_transfer.lock_time'), $this->pageSize, $this->lan); $this->success('', $list); } //取消用户待支付订单 public function setCancelWaitPayOrder(OrderLogic $orderLogic) { $transfer_id = $this->request->post('transfer_id/d', 0); if(empty($transfer_id)) $this->error(__('Invalid parameters')); $list = $orderLogic::setCancelWaitPayOrder($this->auth->id, $transfer_id); $this->success('ok', $list); } }