|
@@ -994,15 +994,15 @@ class Money extends Common
|
|
|
//减去用户余额
|
|
|
$rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id,$exchangeMoney,'-',0,$detail,114,'money');
|
|
|
if($rs_wallet['status'] == false){
|
|
|
- $this->error($rs_wallet['msg']);
|
|
|
Db::rollback();
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
}
|
|
|
|
|
|
//增加用户钻石余额
|
|
|
$rs_wallet = model('wallet')->lockChangeAccountRemain($this->auth->id, $scoin, '+', 0, $detail, 14,'jewel');
|
|
|
if($rs_wallet['status'] == false){
|
|
|
- $this->error($rs_wallet['msg']);
|
|
|
Db::rollback();
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
}
|
|
|
|
|
|
// 添加兑换记录
|
|
@@ -1600,21 +1600,29 @@ class Money extends Common
|
|
|
try {
|
|
|
$orderModel = new \app\common\model\RecharOrder();
|
|
|
$userModel = new \app\common\model\User();
|
|
|
- $jewellogModel = new \app\common\model\UserJewelLog();
|
|
|
$rechargelogModel = new \app\common\model\UserRechargeLog();
|
|
|
$orderInfo = $orderModel->where(["order_no" => $out_trade_no])->find();
|
|
|
$userInfo = $userModel->where(["id" => $orderInfo["user_id"]])->find();
|
|
|
+ $userwallet = Db::name('user_wallet')->where('user_id',$this->auth->id)->find();
|
|
|
// 修改订单状态
|
|
|
$res1 = $orderModel->update(["status" => 1, 'platform' => 2], ["order_no" => $out_trade_no]);
|
|
|
// 修改用户钻石余额
|
|
|
- $res2 = $userModel->where(["id" => $orderInfo["user_id"]])->setInc("jewel", $orderInfo["jewel"]);
|
|
|
+ $res2 = true;
|
|
|
// 添加钻石流水记录
|
|
|
$detail = "充值";
|
|
|
- $res3 = $jewellogModel->addUserJewelLog($userInfo["id"], $orderInfo["jewel"], "+", $userInfo["jewel"], $detail, 1);
|
|
|
+ $res3 = true;
|
|
|
+ //增加用户钻石余额
|
|
|
+ $rs_wallet = model('wallet')->lockChangeAccountRemain($userInfo["id"], $orderInfo["jewel"], "+", 0, $detail, 1,'jewel');
|
|
|
+ if($rs_wallet['status'] == false){
|
|
|
+ Db::rollback();
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
+ }
|
|
|
+
|
|
|
+ //
|
|
|
$rechargeCount = $rechargelogModel->where('user_id',$orderInfo["user_id"])->count();
|
|
|
$isFirstRecharge = $rechargeCount > 0 ? 0 : 1;
|
|
|
// 添加充值记录
|
|
|
- $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], 2, 4, $isFirstRecharge, $userInfo["pre_userid"]);
|
|
|
+ $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userwallet["jewel"], $orderInfo["jewel"], 2), $userwallet["money"], 2, 4, $isFirstRecharge, $userInfo["pre_userid"]);
|
|
|
if ($res1 && $res2 && $res3 && $res4) {
|
|
|
// 添加统计
|
|
|
$time = time();
|