* @version : Huosdk 8.0 */ namespace api\accountdeal\controller; use api\common\controller\V2ApiBaseController; use huoAccountDeal\controller\AccountOut; use huoAccountDeal\controller\MemGameOut; use think\Lang; class AccountController extends V2ApiBaseController { public function _initialize() { parent::_initialize(); $langSet = $this->request->langset(); Lang::load([APP_PATH.'accountdeal'.DS.'lang'.DS.$langSet.DS.'account'.EXT,]); } /** * 小号交易首页 * http://doc.huosdk.com/138?page_id=3434 * 【域名】/account/deal/index */ public function index() { $this->checkLogin(); $_mem_id = $this->getMemId(); $_rdata = (new AccountOut())->getHomeIndex($_mem_id); $this->returnData($_rdata); } /** * 卖号-游戏列表 * http://doc.huosdk.com/138?page_id=3427 * 【域名】/user/account/game/list */ public function getMyGameList() { $this->checkLogin(); $_page = $this->request->param('page/d', 1); $_offset = $this->request->param('offset/d', 10); $_page = $_page.','.$_offset; $_rdata = (new MemGameOut())->getMyGameList($this->mem_id, $_page); $this->returnData($_rdata); } /** * 卖号-小号列表 * http://doc.huosdk.com/138?page_id=3428 * 【域名】/user/account/list */ public function getAccountList() { $this->checkLogin(); $_app_id = $this->request->param('game_id/d', 0); $_page = $this->request->param('page/d', 1); $_offset = $this->request->param('offset/d', 10); $_page = $_page.','.$_offset; $_rdata = (new MemGameOut())->getAccountList($this->mem_id, $_app_id, $_page); $this->returnData($_rdata); } /** * 卖号-小号区服列表 * http://doc.huosdk.com/138?page_id=3429 * 【域名】/user/server/list */ public function getServerList() { $this->checkLogin(); $_mem_id = $this->getMemId(); $_mg_mem_id = $this->request->param('mg_mem_id/d', 0); $_page = $this->request->param('page/d', 1); $_offset = $this->request->param('offset/d', 10); $_page = $_page.','.$_offset; $_rdata = (new MemGameOut())->getMgRoleList($_mem_id, $_mg_mem_id, $_page); $this->returnData($_rdata); } /** * 添加小号 * http://doc.huosdk.com/138?page_id=3393 * 【域名】/user/account/add */ public function add() { $this->checkLogin(); $_param = $this->request->param(); $_result = $this->validate($_param, 'Account.add'); if ($_result !== true) { $this->error($_result); } $_mem_id = $this->mem_id; $_app_id = $this->request->param('app_id/d'); $_nickname = $this->request->param('nickname/s'); $_rs = (new MemGameOut())->addAccount($_mem_id, $_app_id, $_nickname); $this->returnData($_rs); } /** * 切换小号 * http://doc.huosdk.com/138?page_id=3394 * 【域名】/user/account/change */ public function change() { $this->checkLogin(); $_param = $this->request->param(); $_result = $this->validate($_param, 'Account.change'); if ($_result !== true) { $this->error($_result); } $_mem_id = $this->mem_id; $_app_id = $this->request->param('app_id/d'); $_account_id = $this->request->param('account_id/d', 0); $_rs = (new MemGameOut())->changeAccount($_mem_id, $_app_id, $_account_id); $this->returnData($_rs); } // // // // /** // * 小号列表 // * http://doc.huosdk.com/138?page_id=3392 // * 【域名】/user/account/list // */ // public function getAccountList() { // $this->checkLogin(); // $_param = $this->request->param(); // $_result = $this->validate($_param, 'Account.list'); // if ($_result !== true) { // $this->error($_result); // } // $_page = $this->request->param('page/d', 1); /* 页码 默认为1 代表第一页 1 */ // $_offset = $this->request->param('offset/d', 10); /* 每页显示数量 默认为10 */ // $_app_id = $this->request->param('app_id/d', 0); // $_page = $_page.','.$_offset; // $_account_list = (new MemGameOut())->getMemGameList($this->mem_id, $_app_id, $_page); // $this->returnData($_account_list); // } // // // /** // * 添加出售小号商品 // * http://doc.huosdk.com/138?page_id=3430 // * 【域名】/account/sell // */ // public function sell() { // $this->checkLogin(); // $_param = $this->request->param(); // $_result = $this->validate($_param, 'Account.sell'); // if ($_result !== true) { // $this->error($_result); // } // $_mem_id = $this->mem_id; // $_mg_role_id = $this->request->param('mg_role_id/d'); // $_title = $this->request->param('title/s'); // $_description = $this->request->param('description/s'); // $_price = $this->request->param('price'); // $_image = $this->request->param('image', '', 'htmlspecialchars_decode'); // $_smscode = $this->request->param('sms-code'); // $_rs = (new AccountOut())->sell($_mem_id, $_mg_role_id, $_title, $_description, $_price, $_image, $_smscode); // $this->returnData($_rs); // } // // /** // * 小号商品列表 // * http://doc.huosdk.com/138?page_id=3426 // * 【域名】/account/goods/list // */ // public function getGoodsList() { // $_sort_type = $this->request->param('sort_type/d', 1); // $_app_id = $this->request->param('app_id/d', 0); // $_keyword = $this->request->param('keyword/s', ''); // $_is_like = $this->request->param('is_like/d', 0); // TODO: luowei 2018/6/12 未实现筛选 // $_status = $this->request->param('status/d', 0); // $_is_me_sell = $this->request->param('is_me_sell/d', 0); // $_page = $this->request->param('page/d', 1); // $_offset = $this->request->param('offset/d', 10); // $_where = []; // !empty($_keyword) && $_where['keyword'] = $_keyword; // !empty($_app_id) && $_where['app_id'] = $_app_id; // !empty($_status) && $_where['status'] = $_status; // ($_is_me_sell == 2) && $_where['mem_id'] = $this->mem_id; // $_rs = (new AccountOut())->goodsList($_where, $_sort_type, $_page.','.$_offset); // $this->returnData($_rs); // } // // /** // * 收藏/取消收藏小号商品 // * http://doc.huosdk.com/138?page_id=3431 // * 【域名】/account/like // */ // public function like() { // $this->checkLogin(); // $_param = $this->request->param(); // $_result = $this->validate($_param, 'Account.like'); // if ($_result !== true) { // $this->error($_result); // } // $_mem_id = $this->getMemId(); // $_ags_id = $this->request->param('ags_id/d'); // $_rs = (new AccountOut())->like($_mem_id, $_ags_id); // if ($_rs) { // $_code = CommonStatus::NO_ERROR; // $this->success(CommonStatus::getMsg($_code), [], $_code); // } else { // $_code = CommonStatus::INNER_ERROR; // $this->error(CommonStatus::getMsg($_code), [], $_code); // } // } // // /** // * 购买小号商品 + 预下单 // * http://doc.huosdk.com/138?page_id=3435 // * 【域名】/account/buy // */ // public function buy() { // $_param = $this->request->param(); // $_result = $this->validate($_param, 'Account.buy'); // if ($_result !== true) { // $this->error($_result); // } // $this->checkLogin(); // $_mem_id = $this->getMemId(); // $_ags_id = $this->request->param('ags_id/d'); // $_payway = $this->request->param('payway'); // $_rdata = (new AccountOrder())->preorder($_mem_id, $_ags_id, $_payway); // if (CommonStatus::NO_ERROR != $_rdata['code']) { // $this->returnData($_rdata); // } // $_order_id = $_rdata['data']['order_id']; // $_amount = $_rdata['data']['amount']; // $_product_name = $_rdata['data']['product_name']; // $_product_desc = $_rdata['data']['product_desc']; // try { // $_pay_class = Pay::ins()->get($_payway); // $_func = $this->getFunc($this->device_type); // $_show_url = url('wapapp/'.$_payway.'/show', ['order_id' => $_order_id], false, APISITE); // $_return_url = url( // 'wapapp/'.$_payway.'/return', ['order_id' => $_order_id], false, APISITE // ); // $_pay_class->setReturnUrl($_return_url); // $_pay_class->setShowUrl($_show_url); // $_pay_class->setOrderId($_order_id); // $_pay_class->setProductName($_product_name); // $_pay_class->setProductDesc($_product_desc); // $_pay_class->setRealAmount($_amount); // $_pay_class->setProductId(WalletConst::WALLET_PRODUCT_ACCOUNT); // $_pay_class->setIp($this->request->ip()); // $_pay_class->setOpenId(HuoSession::getOpenId()); // $_pay_rs = $_pay_class->$_func(); // if (empty($_pay_rs)) { // $_code = OrderStatus::PAYWAY_PREORDER_ERROR; // $this->error(OrderStatus::getMsg($_code), [], $_code); // } // $_code = OrderStatus::NO_ERROR; // $this->success(OrderStatus::getMsg($_code), $_pay_rs, $_code); // } catch (Exception $e) { // $_code = OrderStatus::PAYWAY_NOT_EXISTS; // $this->error(OrderStatus::getMsg($_code), [], $_code); // } // } // // /** // * 取消购买订单 // * http://doc.huosdk.com/138?page_id=3550 // * 【域名】/order/cancel // */ // public function cancelOrder() { // $_param = $this->request->param(); // $_result = $this->validate($_param, 'Account.cancelOrder'); // if ($_result !== true) { // $this->error($_result); // } // $this->checkLogin(); // $_mem_id = $this->getMemId(); // $_order_id = $this->request->param('order_id'); // $_rs = (new AccountOrder())->cancel($_mem_id, $_order_id); // $this->returnData($_rs); // } // // /** // * 玩家小号商品交易订单列表 // * http://doc.huosdk.com/138?page_id=3433 // * 【域名】/user/order/list // */ // public function orderList() { // $_status = $this->request->param('status/d', 0); // $_page = $this->request->param('page/d', 1); // $_offset = $this->request->param('offset/d', 10); // $_map = ['buy_mem_id' => $this->getMemId()]; // !empty($_status) && $_map['status'] = $_status; // $_rs = (new AccountOrder())->getOrderList($_map, $_page.','.$_offset); // $this->returnData($_rs); // } // // /** // * 小号区服列表 // * http://doc.huosdk.com/138?page_id=3429 // * 【域名】/account/role_server/list // */ // public function serverList() { // $_param = $this->request->param(); // $_result = $this->validate($_param, 'Account.serverList'); // if ($_result !== true) { // $this->error($_result); // } // $_page = $this->request->param('page/d', 1); // $_offset = $this->request->param('offset/d', 10); // $_account_id = $this->request->param('account_id/d'); // $_page = $_page.','.$_offset; // $_mem_id = $this->getMemId(); // $_data = (new AccountLogic())->getMgServerList($_mem_id, $_account_id, $_page); // if (is_numeric($_data)) { // $this->error(AccountStatus::getMsg($_data), [], $_data); // } // $_code = CommonStatus::NO_ERROR; // $this->success(CommonStatus::getMsg($_code), $_data, $_code); // } // // /** // * 小号游戏列表 // * http://doc.huosdk.com/138?page_id=3427 // * 【域名】/account/game/list // */ // public function gameList() { // $_page = $this->request->param('page/d', 1); // $_offset = $this->request->param('offset/d', 10); // $_page = $_page.','.$_offset; // $_mem_id = $this->getMemId(); // $_data = (new MemGameLogic())->getMgAccountList($_mem_id, $_page); // $_code = CommonStatus::NO_ERROR; // $this->success(CommonStatus::getMsg($_code), $_data, $_code); // } // // /** // * 游戏的小号列表 // * http://doc.huosdk.com/138?page_id=3428 // * 【域名】/game/account/list // */ // public function gameAccountList() { // $this->checkLogin(); // $_param = $this->request->param(); // $_result = $this->validate($_param, 'Account.gameAccountList'); // if ($_result !== true) { // $this->error($_result); // } // $_page = $this->request->param('page/d', 1); /* 页码 默认为1 代表第一页 1 */ // $_offset = $this->request->param('offset/d', 10); /* 每页显示数量 默认为10 */ // $_app_id = $this->request->param('game_id/d'); // $_page = $_page.','.$_offset; // $_account_list = (new MemGame())->getMemGameList($this->mem_id, $_app_id, $_page); // $this->returnData($_account_list); // } // // /** // * 出售账号玩过游戏列表 // * http://doc.huosdk.com/138?page_id=3543 // * 【域名】/account/goods/game/list // */ // public function sellListByMyGame() { // $this->checkLogin(); // $_page = $this->request->param('page/d', 1); /* 页码 默认为1 代表第一页 1 */ // $_offset = $this->request->param('offset/d', 10); /* 每页显示数量 默认为10 */ // $_page = $_page.','.$_offset; // $_account_list = (new AccountLogic())->getMgSellAccountList($this->mem_id, $_page); // $_code = CommonStatus::NO_ERROR; // $this->success(CommonStatus::getMsg($_code), $_account_list, $_code); // } // // }