Files
yusheng-php/application/api/controller/UserWallet.php

92 lines
3.4 KiB
PHP
Raw Normal View History

2025-08-07 20:21:47 +08:00
<?php
namespace app\api\controller;
use app\common\controller\BaseCom;
use think\Db;
class UserWallet extends BaseCom
{
//钱包
public function wallet()
{
$reslut = model('UserWallet')->wallet($this->uid);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
// //给前端的类型组装一个
// public function gift_type()
// {
// // 1.系统调节 2.充值 3.提现 4.金币转增(送出) 5.每日任务奖励 6.充值返利 7.购买装扮
// // 8.礼盒奖励 9.房间补贴 10.购买礼物 11.收礼增加收益 12.工会补贴 13.转赠金币(接收) 14.收益兑换
// $data = [
//// ['id' => 1, 'name' => '系统调节'],
// ['id' => 2, 'name' => '充值'],
// ['id' => 3, 'name' => '提现'],
// ['id' => 4, 'name' => '金币转增'],
// ['id' => 5, 'name' => '每日任务奖励'],
// ['id' => 6, 'name' => '充值返利'],
// ['id' => 7, 'name' => '购买装扮'],
// ['id' => 8, 'name' => '礼盒奖励'],
// ['id' => 9, 'name' => '房间补贴'],
// ['id' => 10, 'name' => '购买礼物'],
// ['id' => 11, 'name' => '收礼增加收益'],
// ['id' => 12, 'name' => '工会补贴'],
// ['id' => 13, 'name' => '金币转增'],
// ['id' => 14, 'name' => '收益兑换'],
// ['id' => 15, 'name' => '送礼'],
// ];
// return V(1, '获取成功', $data);
// }
//金币(钻石)明细
public function log_list()
{
$page = input('page', 1);
$page_limit = input('page_limit', 30);
$in_out_type = input('in_out_type', 1);//1收入2支出
$gift_type = input('gift_type', 1);//1金币2收益钻石
//开始时间
$start_time = input('start_time', '');
$end_time = input('end_time', '');
$reslut = model('UserWallet')->log_list($this->uid, $page, $page_limit,$in_out_type,$start_time,$end_time,$gift_type);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
//收益(钻石)兑换金币
public function exchange_coin()
{
$earnings_num = input('earnings_num', 0);
$reslut = model('UserWallet')->exchange_coin($this->uid,$earnings_num);
return V($reslut['code'], $reslut['msg'], $reslut['data']);
}
//收益(钻石)兑换金币汇率
public function exchange_coin_rate()
{
$reslut['data'] = get_system_config()['coin_exchange_rate'];
return V(1, '获取成功', $reslut['data']);
}
/*
* 可选充值金额列表
*/
public function can_recharge_list(){
$reslut = db::name("vs_can_recharge")->where("status",1)->where("delete_time",0)->order('money asc')->select();
$reslut_data = [];
foreach ($reslut as $k=>$v){
$reslut_data[$k]['money'] = $v['money'];
$reslut_data[$k]['coins'] = $v['coins'];
}
return V(1, '获取成功', $reslut_data);
}
/*
* 钻石兑换金币比例
*/
public function get_wallet_config(){
$reslut['coin_exchange_rate'] = get_system_config_value('coin_exchange_rate');
$reslut['withdrawal_service_fee'] = get_system_config_value('withdrawal_service_fee');
$reslut['rmb_coin_ratio'] = get_system_config_value('rmb_coin_ratio');
return V(1, '获取成功', $reslut);
}
}