|
@@ -119,7 +119,7 @@ class Notify extends Api
|
|
|
$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();
|
|
|
+ $userwallet = Db::name('user_wallet')->where('user_id',$orderInfo["user_id"])->find();
|
|
|
$time = time();
|
|
|
// 修改订单状态
|
|
|
$res1 = $orderModel->update(["status" => 1,'transaction_id' => $trade_no,'paytime'=>$time], ["order_no" => $out_trade_no]);
|
|
@@ -208,18 +208,27 @@ class Notify extends Api
|
|
|
$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',$orderInfo["user_id"])->find();
|
|
|
// 修改订单状态
|
|
|
$res1 = $orderModel->update(["status" => 1], ["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);
|
|
|
+ $detail = "钻石充值";
|
|
|
+ $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;
|
|
|
$platformArr = ["wx_app_pay" => 1, "ali_wap_pay" => 2, "wx_public_pay" => 3];
|
|
|
- $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userInfo["jewel"], $orderInfo["jewel"], 2), $userInfo["money"], $orderInfo["platform"], $platformArr[$pay_channel], $isFirstRecharge, $userInfo["pre_userid"]);
|
|
|
+ $res4 = $rechargelogModel->addRecord($userInfo["id"], $orderInfo["jewel"], $payamount, bcadd($userwallet["jewel"], $orderInfo["jewel"], 2), $userwallet["money"], $orderInfo["platform"], $platformArr[$pay_channel], $isFirstRecharge, $userInfo["pre_userid"]);
|
|
|
if ($res1 && $res2 && $res3 && $res4) {
|
|
|
// 添加统计
|
|
|
$time = time();
|