Browse Source

Merge remote-tracking branch 'origin/master'

# Conflicts:
#	app/common/model/User.php
goldzhang814 1 year ago
parent
commit
782cb2fcc6

+ 6 - 4
app/api/service/order/PaySuccess.php

@@ -104,16 +104,18 @@ class PaySuccess extends BaseService
 
         //积分不足
         if ($payType == OrderPayTypeEnum::EXCHANGE) {
-            if ($this->user['accumulate_points'] < $this->model['total_price']) {
+            $rate = SettingModel::getItem('points_rate')['points_2_money'];
+
+            $points = bcmul($this->model['total_price'],$rate,0);
+
+            if ($this->user['accumulate_points'] < $points) {
                 $this->error = '用户积分不足,无法兑换成功';
                 return false;
             }
-            $this->model->transaction(function () use ($payType, $payData) {
+            $this->model->transaction(function () use ($payType, $payData, $points) {
                 // 更新订单状态
                 $this->updateOrderInfo($payType, $payData);
                 //扣除用户积分
-                $rate = SettingModel::getItem('points_rate')['points_2_money'];
-                $points = bcmul($this->model['total_price'],$rate,0);
                 UserModel::setDecAccumulatePoints($this->user['user_id'], $points,AccumulatePointsScene::CONSUME,'兑换商品');
                 // 记录订单支付信息
                 $this->updatePayInfo($payType);

+ 1 - 3
app/common/model/User.php

@@ -317,10 +317,8 @@ class User extends BaseModel
      * @throws \think\db\exception\DbException
      * @throws \think\db\exception\ModelNotFoundException
      */
-    public static function setDecAccumulatePoints(int $userId, string $payMoney, int $scene = AccumulatePointsScene::RECHARGE, string $describe = '')
+    public static function setDecAccumulatePoints(int $userId, string $points, int $scene = AccumulatePointsScene::RECHARGE, string $describe = '')
     {
-        $rate = SettingModel::getItem('points_rate')['points_2_money'];
-        $points = bcmul(strval($payMoney),$rate,0);
         // 新增积分变动明细
         AccumulatePointsLog::add([
             'user_id' => $userId,

+ 2 - 2
app/store/controller/Shop.php

@@ -114,8 +114,8 @@ class Shop extends Controller
         $list = $model->detail($id);
         $list['boss_nick_name'] = $list['bossUser']['nick_name'];
         $list['boss_mobile'] = $list['bossUser']['mobile'];
-        $list['manager_nick_name'] = $list['mgUser']['nick_name'];
-        $list['manager_mobile'] = $list['mgUser']['mobile'];
+        $list['manager_nick_name'] = $list['mgUser']['nick_name'] ?? '';
+        $list['manager_mobile'] = $list['mgUser']['mobile'] ?? '';
         unset($list['bossUser'],$list['mgUser']);
         $list['regionArr'] = [$list->province_id,$list->city_id,$list->region_id];
         // 门店身份用户