Files
mier-php/application/api/model/UserWallet.php
2025-08-11 10:22:05 +08:00

49 lines
1.5 KiB
PHP

<?php
namespace app\api\model;
use think\Db;
use think\Model;
class UserWallet extends Model
{
public function create_data($uid)
{
$insert_data = ['uid' => $uid];
return Db::name('user_wallet')->insert($insert_data);
}
//获取用户钱包数据
public function get_user_wallet($uid, $money, $integral)
{
$map = [];
$map[] = ['uid', '=', $uid];
$wallet_info = Db::name('user_wallet')->where('uid', $uid)->find();
if($wallet_info) {
if($wallet_info['user_integral'] != $integral) {
return ['code' => 201, 'msg' =>'请联系客服!', 'data' => null];
}
if($wallet_info['user_money'] != $money) {
return ['code' => 201, 'msg' =>'请联系客服!', 'data' => null];
}
return ['code' => 200, 'msg' =>'验证通过', 'data' => null];
} else {
return ['code' => 201, 'msg' =>'请联系客服!', 'data' => null];
}
}
// public function tong_bu_user()
// {
// $user_list = Db::name('user')->field('uid,money,integral')->select();
// foreach($user_list as $v) {
// $info = Db::name('user_wallet')->where('uid', $v['uid'])->find();
// if(empty($info)) {
// $insert_data = ['uid' => $v['uid'], 'user_integral' => $v['integral'], 'user_money' => $v['money']];
// Db::name('user_wallet')->insert($insert_data);
// }
// }
// }
}