userId = M("user", "tab_")->where(['user_token' => $userToken])->getField("id"); // $this->userToken = $userToken; // if (!$this->userId) { // re_msg(12, $userToken."Token失效"); // } // } /** * 获取用户平台币充值记录绑币余额 * @return [type] [description] */ public function get_user_money() { $data['user_token'] = I('user_token'); $user_info = M('user','tab_')->where(['user_token' => $data['user_token']])->field('id,account,balance')->find(); $user_play = M('user_play','tab_')->alias('user') ->join('tab_game as game on user.game_id = game.id') ->where(['user_id' => $user_info['id']]) ->field('user.game_name,user.bind_balance,game.icon')->select(); foreach($user_play as $k => $v) { $cover = (substr($v['icon'], 0, 7) == "http://" || substr($v['icon'], 0, 8) == "https://" ) ? get_cover($v['icon'],"path") : (is_https() ? 'https://' : 'http://' . $_SERVER['HTTP_HOST'] . get_cover($v['icon'],"path")); $user_play[$k]['cover'] = $cover; } $deposit = M('deposit','tab_')->where(['user_id' => $user_info['id'],'pay_status' => 1]) ->field('user_account,create_time,pay_amount')->order('id DESC')->select(); foreach($deposit as $k => $v) { $deposit[$k]['create_time'] = date('Y-m-d',$v['create_time']); } $this->assign('game_id', I('game_id', 0)); $this->assign('account', $user_info['account']); $this->assign('balance', $user_info['balance']?:0); $this->assign('deposit', $deposit); $this->assign('user_play', $user_play); $this->assign('user_token', $data['user_token']); $this->display(); } /** * 平台币充值 */ public function platform_pay_show() { $u = M('user', 'tab_')->where(['id' => $this->userId])->find(); $this->assign("account", $u['account']); $this->assign("user_token", $u['user_token']); $this->assign('game_id', I('game_id', 0)); $this->display(); } /** * 平台币充值展示 */ public function platform_pay() { $u = M('user', 'tab_')->where(['id' => $this->userId])->find(); $money = I('money', 0); $api_ver = I('api_ver', 0); if(!$money) { $this->error('金额不能为空'); } // if(!is_int($post['money'])) { // $this->error('金额不能小于1'); // } $this->assign('api_ver', $api_ver); $this->assign("account", $u['account']); $this->assign("user_id", $u['id']); $this->assign('money', $money); $this->assign('game_id', I('game_id', 0)); $this->display(); } }