|
@@ -38,7 +38,15 @@ class Money extends Common
|
|
|
*/
|
|
|
public function getUserMoney()
|
|
|
{
|
|
|
- $this->success("获取成功!", \app\common\model\User::field("money,rebate_money,score,jewel,sound_coin,hammer")->find($this->auth->id));
|
|
|
+
|
|
|
+ $rs = Db::name('user')->field("rebate_money,score,sound_coin,hammer")->where('id',$this->auth->id)->find();
|
|
|
+
|
|
|
+ //用户钱包
|
|
|
+ $userwallet = Db::name('user_wallet')->where('user_id',$this->auth->id)->find();
|
|
|
+ $rs['money'] = $userwallet['money'];
|
|
|
+ $rs['jewel'] = $userwallet['jewel'];
|
|
|
+
|
|
|
+ $this->success("获取成功!", $rs);
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -393,9 +401,9 @@ class Money extends Common
|
|
|
// 查询资金余额
|
|
|
$userModel = new \app\common\model\User();
|
|
|
$userInfo = $userModel->where('id',$user_id)->lock(true)->find();
|
|
|
- if (bcsub($money, $userInfo["money"], 2) > 0) {
|
|
|
+ /* if (bcsub($money, $userInfo["money"], 2) > 0) {
|
|
|
$this->error("资金余额不足!", [], 100);
|
|
|
- }
|
|
|
+ }*/
|
|
|
|
|
|
// 增加提现收益记录
|
|
|
$withdrawRate = (100 - config("site.withdrawRate")) / 100;
|
|
@@ -456,7 +464,7 @@ class Money extends Common
|
|
|
try {
|
|
|
$withdrawallogModel = new \app\common\model\UserWithdrawalLog();
|
|
|
// 减去用户可用资金余额
|
|
|
- $res1 = $userModel->where(["id" => $user_id])->setDec("money", $money);
|
|
|
+// $res1 = $userModel->where(["id" => $user_id])->setDec("money", $money);
|
|
|
// 增加用户冻结资金余额
|
|
|
$res2 = $userModel->where(["id" => $user_id])->setInc("frozen", $money);
|
|
|
// 新增用户提现记录申请
|
|
@@ -930,7 +938,7 @@ class Money extends Common
|
|
|
// 减去用户声币余额
|
|
|
$res4 = $userModel->where(["id" => $this->auth->id])->setDec("sound_coin", $scoin);
|
|
|
// 增加用户资金余额
|
|
|
- $res5 = $userModel->where(["id" => $this->auth->id])->setInc("money", $exchangeMoney);
|
|
|
+// $res5 = $userModel->where(["id" => $this->auth->id])->setInc("money", $exchangeMoney);
|
|
|
if ($res1 && $res2 && $res3 && $res4 && $res5) {
|
|
|
Db::commit();
|
|
|
$this->success("兑换成功!");
|
|
@@ -1108,8 +1116,8 @@ class Money extends Common
|
|
|
|
|
|
// 查询资金余额
|
|
|
$userModel = new \app\common\model\User();
|
|
|
- $userInfo = $userModel->get($this->auth->id);
|
|
|
- if ($money > $userInfo["money"]) {
|
|
|
+ $user_wallet = Db::name('user_wallet')->where(['user_id'=>$this->auth->id])->find();
|
|
|
+ if ($money > $user_wallet["money"]) {
|
|
|
$this->error("资金余额不足!", [], 100);
|
|
|
}
|
|
|
|
|
@@ -1117,7 +1125,13 @@ class Money extends Common
|
|
|
try {
|
|
|
$withdrawallogModel = new \app\common\model\UserWithdrawalLog();
|
|
|
// 减去用户可用资金余额
|
|
|
- $res1 = $userModel->where(["id" => $this->auth->id])->setDec("money", $money);
|
|
|
+ $res1 = true;
|
|
|
+ //扣余额
|
|
|
+ $rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id,$money,'-',0,'申请提现',104,'money');
|
|
|
+ if($rs_wallet['status'] === false){
|
|
|
+ Db::rollback();
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
+ }
|
|
|
// 增加用户冻结资金余额
|
|
|
$res2 = $userModel->where(["id" => $this->auth->id])->setInc("frozen", $money);
|
|
|
// 新增用户提现记录申请
|
|
@@ -1417,7 +1431,7 @@ class Money extends Common
|
|
|
$withdraw = \app\common\model\UserWithdrawalLog::where(["user_id" => $user_id, "status" => ["in", [0, 1]]])->sum("money");
|
|
|
$withdraw = bcdiv($withdraw, 100,2);
|
|
|
$sum = bcsub($moneylog, $withdraw,2);
|
|
|
- $usermoney = \app\common\model\User::where(["id" => $user_id])->value("money");
|
|
|
+// $usermoney = \app\common\model\User::where(["id" => $user_id])->value("money");
|
|
|
if ($usermoney == $sum) {
|
|
|
return true;
|
|
|
} else {
|