|
@@ -387,10 +387,7 @@ class Dispatch extends Common
|
|
}
|
|
}
|
|
|
|
|
|
// 判断用户余额
|
|
// 判断用户余额
|
|
- $userModel = new \app\common\model\User();
|
|
|
|
- $where = [];
|
|
|
|
- $where["id"] = $this->auth->id;
|
|
|
|
- $jewel = $userModel->where($where)->value("jewel");
|
|
|
|
|
|
+ $jewel = Db::name('user_wallet')->where('user_id',$this->auth->id)->value('jewel');
|
|
$price = 0;
|
|
$price = 0;
|
|
$authInfo["price"] >= 0 || $price = 0;
|
|
$authInfo["price"] >= 0 || $price = 0;
|
|
$authInfo["price"] >= 0 && $price = $authInfo["price"];
|
|
$authInfo["price"] >= 0 && $price = $authInfo["price"];
|
|
@@ -431,14 +428,7 @@ class Dispatch extends Common
|
|
$data["createtime"] = time();
|
|
$data["createtime"] = time();
|
|
$res = $orderModel->insertGetId($data);
|
|
$res = $orderModel->insertGetId($data);
|
|
if($res) {
|
|
if($res) {
|
|
- //冻结用户钻石
|
|
|
|
- $userWhere['id'] = $this->auth->id;
|
|
|
|
- $money = bcmul($authInfo["price"],$num);
|
|
|
|
- $res1 = model('User')->where($userWhere)->setDec("jewel",$money);//用户扣减金额
|
|
|
|
- $res2 = model('User')->where($userWhere)->setInc("frozen",$money);//用户冻结金额
|
|
|
|
- if (!$res1 || !$res2) {
|
|
|
|
- throw new Exception('用户扣减金额失败');
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
\app\common\model\Message::addMessage($authInfo["user_id"],"派单通知","您的技能:".$skillInfo["name"]."有人下单啦,请注意查看!");
|
|
\app\common\model\Message::addMessage($authInfo["user_id"],"派单通知","您的技能:".$skillInfo["name"]."有人下单啦,请注意查看!");
|
|
Db::commit();
|
|
Db::commit();
|
|
$this->success('订单创建成功!',["order_no"=>$out_trade_no]);
|
|
$this->success('订单创建成功!',["order_no"=>$out_trade_no]);
|
|
@@ -525,7 +515,7 @@ class Dispatch extends Common
|
|
$userModel = new \app\common\model\User();
|
|
$userModel = new \app\common\model\User();
|
|
$where = [];
|
|
$where = [];
|
|
$where["id"] = $this->auth->id;
|
|
$where["id"] = $this->auth->id;
|
|
- $jewel = $userModel->where($where)->value("jewel");
|
|
|
|
|
|
+ $jewel = Db::name('user_wallet')->where('user_id',$this->auth->id)->value('jewel');
|
|
$money = $orderInfo["price"] * $orderInfo["num"];
|
|
$money = $orderInfo["price"] * $orderInfo["num"];
|
|
if($money > $jewel) {
|
|
if($money > $jewel) {
|
|
$this->error(__('钻石余额不足,请先充值!'),[],100);
|
|
$this->error(__('钻石余额不足,请先充值!'),[],100);
|