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

100 lines
3.2 KiB
PHTML

5 years ago
<?php
namespace Sdk\Controller;
use Think\Controller;
use Think\Log;
5 years ago
class UserHController extends Controller
5 years ago
{
5 years ago
public $userId;
// public function _initialize()
// {
// $userToken = I("request.user_token");
// if (!$userToken) {
// re_msg(11, "参数有误,请重新登入获取!");
// }
// $this->userId = M("user", "tab_")->where(['user_token' => $userToken])->getField("id");
// $this->userToken = $userToken;
// if (!$this->userId) {
// re_msg(12, $userToken."Token失效");
// }
// }
5 years ago
5 years ago
/**
* 获取用户平台币充值记录绑币余额
* @return [type] [description]
*/
5 years ago
public function get_user_money()
5 years ago
{
$data['user_token'] = I('user_token');
5 years ago
5 years ago
$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();
5 years ago
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"));
5 years ago
$user_play[$k]['cover'] = $cover;
}
$deposit = M('deposit','tab_')->where(['user_id' => $user_info['id'],'pay_status' => 1])
5 years ago
->field('user_account,create_time,pay_amount')->order('id DESC')->select();
5 years ago
foreach($deposit as $k => $v)
{
$deposit[$k]['create_time'] = date('Y-m-d',$v['create_time']);
}
5 years ago
$this->assign('game_id', I('game_id', 0));
5 years ago
$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();
5 years ago
}
/**
* 平台币充值
5 years ago
*/
public function platform_pay_show()
5 years ago
{
5 years ago
$u = M('user', 'tab_')->where(['id' => $this->userId])->find();
$this->assign("account", $u['account']);
$this->assign("user_token", $u['user_token']);
5 years ago
$this->assign('game_id', I('game_id', 0));
$this->display();
5 years ago
}
/**
* 平台币充值展示
*/
public function platform_pay()
5 years ago
{
5 years ago
$u = M('user', 'tab_')->where(['id' => $this->userId])->find();
5 years ago
$money = I('money', 0);
5 years ago
$api_ver = I('api_ver', 0);
5 years ago
if(!$money) {
5 years ago
$this->error('金额不能为空');
}
// if(!is_int($post['money'])) {
// $this->error('金额不能小于1');
// }
5 years ago
$this->assign('api_ver', $api_ver);
5 years ago
$this->assign("account", $u['account']);
$this->assign("user_id", $u['id']);
$this->assign('money', $money);
5 years ago
$this->assign('game_id', I('game_id', 0));
$this->display();
5 years ago
}
}