获取平台币

master
Your Name 5 years ago
parent 83d04c5b00
commit edc75eca44

@ -240,8 +240,8 @@ function getChinaChar($num)
function re_msg($code=200,$msg,$data) function re_msg($code=200,$msg,$data)
{ {
$data['code'] = $code; $ret['code'] = $code;
$data['msg'] = $msg; $ret['msg'] = $msg;
$data['data'] = $data; $ret['data'] = $data;
echo base64_encode(json_encode($data));die(); echo base64_encode(json_encode($ret));die();
} }

@ -3144,10 +3144,42 @@ class UserController extends BaseController
public function get_user_money() public function get_user_money()
{ {
$data = json_decode(base64_decode(file_get_contents("php://input"),true); $data = json_decode(base64_decode(file_get_contents("php://input"),true));
$user_info = M('User','tab')->where(['user_token' => $data['user_token']])->find(); if(empty($data['user_token']))
$user_play = M('UserPlay','tab')->where(['']) {
re_msg(1004,'fail','用户不存在');
}
$user_info = M('user','tab_')->where(['user_token' => $data['user_token']])->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.cover')->select();
foreach($user_play as $k => $v)
{
$cover = get_cover($v['cover'],'path');
if(strpos($cover, 'http')!==false){
$cover = $cover;
}else{
$cover = is_https()?'https://':'http://'.$_SERVER['HTTP_HOST'].$cover;
}
$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')->select();
foreach($deposit as $k => $v)
{
$deposit[$k]['create_time'] = date('Y-m-d',$v['create_time']);
}
$data = [
'balance' => $user_info['balance'],
'pay_rank' => $deposit,
'user_play' => $user_play,
];
re_msg(200,'获取成功',$data);
} }
} }

Loading…
Cancel
Save