|
@@ -632,10 +632,17 @@ class Dispatch extends Common
|
|
|
$this->error(__('账户资金异常,请联系管理员!'),[],105);
|
|
|
}
|
|
|
$res1 = $userModel->where($where)->setDec("frozen",$money);//下单用户
|
|
|
- $res2 = $userModel->where($where)->setInc("jewel",$money);//下单用户
|
|
|
+ $res2 = true;//下单用户
|
|
|
// 添加用户余额变动记录
|
|
|
- $userjewellogModel = new \app\common\model\UserJewelLog();
|
|
|
- $res3 = $userjewellogModel->addUserJewelLog($orderInfo["user_id"], $money, "+", $userInfo["jewel"], "拒绝订单返还余额", 7);
|
|
|
+ $res3 = true;
|
|
|
+
|
|
|
+ //增加用户钻石余额
|
|
|
+ $rs_wallet = model('wallet')->lockChangeAccountRemain($orderInfo["user_id"], $money, "+", 0, "拒绝订单返还余额", 7,'jewel');
|
|
|
+ if($rs_wallet['status'] == false){
|
|
|
+ Db::rollback();
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
+ }
|
|
|
+
|
|
|
// 更新订单状态
|
|
|
$data = [];
|
|
|
$data["status"] = $status;
|
|
@@ -675,27 +682,21 @@ class Dispatch extends Common
|
|
|
$userModel = new \app\common\model\User();
|
|
|
$money = $orderInfo["price"] * $orderInfo["num"];
|
|
|
// 增加用户余额
|
|
|
+ $res1 = true;
|
|
|
+ //
|
|
|
$where = [];
|
|
|
- $where["id"] = $orderInfo["recive_id"];
|
|
|
- $userInfo = $userModel->where($where)->find();
|
|
|
- //$res1 = $userModel->where($where)->setInc("jewel",$money);
|
|
|
- $jewelMoneyRate = config('site.money_to_jewel');//1人民币兑换钻石数
|
|
|
- $moneyRmb = bcdiv($money,$jewelMoneyRate);
|
|
|
- $res1 = $userModel->where($where)->setInc("money",$moneyRmb);
|
|
|
- $where = [];
|
|
|
- $where["id"] = $this->auth->id;
|
|
|
+ $where["id"] = $orderInfo['user_id'];
|
|
|
$res2 = $userModel->where($where)->setDec("frozen",$money);
|
|
|
// 添加用户余额变动记录
|
|
|
- /*$userjewellogModel = new \app\common\model\UserJewelLog();
|
|
|
- $res3 = $userjewellogModel->addUserJewelLog($orderInfo["recive_id"], $money, "+", $userInfo["jewel"], "完成用户订单获得收益", 8);*/
|
|
|
+ $res3 = true;
|
|
|
+
|
|
|
$remark = $orderInfo['skill_name'].'服务';
|
|
|
- $rs_wallet = model('wallet')->lockChangeAccountRemain($orderInfo["recive_id"],$moneyRmb,'+',$userInfo['money'],$remark,106,'money');
|
|
|
- $res3 = false;
|
|
|
+ $jewelMoneyRate = config('site.money_to_jewel');//1人民币兑换钻石数
|
|
|
+ $moneyRmb = bcdiv($money,$jewelMoneyRate);
|
|
|
+ $rs_wallet = model('wallet')->lockChangeAccountRemain($orderInfo["recive_id"],$moneyRmb,'+',0,$remark,106,'money');
|
|
|
if($rs_wallet['status'] == false){
|
|
|
- $this->error($rs_wallet['msg']);
|
|
|
Db::rollback();
|
|
|
- } else {
|
|
|
- $res3 = true;
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
}
|
|
|
// 更新订单状态
|
|
|
$data = [];
|
|
@@ -739,16 +740,22 @@ class Dispatch extends Common
|
|
|
$money = $orderInfo["price"] * $orderInfo["num"];
|
|
|
// 解冻用户余额
|
|
|
$where = [];
|
|
|
- $where["id"] = $this->auth->id;
|
|
|
+ $where["id"] = $orderInfo['user_id'];
|
|
|
$userInfo = $userModel->where($where)->find();
|
|
|
if($userInfo["frozen"] - $money < 0) {
|
|
|
$this->error(__('账户资金异常,请联系管理员!'),[],105);
|
|
|
}
|
|
|
$res1 = $userModel->where($where)->setDec("frozen",$money);
|
|
|
- $res2 = $userModel->where($where)->setInc("jewel",$money);
|
|
|
+ $res2 = true;
|
|
|
// 添加用户余额变动记录
|
|
|
- $userjewellogModel = new \app\common\model\UserJewelLog();
|
|
|
- $res3 = $userjewellogModel->addUserJewelLog($orderInfo["user_id"], $money, "+", $userInfo["jewel"], "取消订单返还余额", 7);
|
|
|
+ $res3 = true;
|
|
|
+
|
|
|
+ $rs_wallet = model('wallet')->lockChangeAccountRemain($orderInfo["user_id"], $money, "+", 0, "取消订单返还余额", 7,'money');
|
|
|
+ if($rs_wallet['status'] == false){
|
|
|
+ Db::rollback();
|
|
|
+ $this->error($rs_wallet['msg']);
|
|
|
+ }
|
|
|
+
|
|
|
// 更新订单状态
|
|
|
$data = [];
|
|
|
$data["status"] = $status;
|