shish 2 yıl önce
ebeveyn
işleme
2b985529d0
1 değiştirilmiş dosya ile 10 ekleme ve 2 silme
  1. 10 2
      app-ghs/controllers/ExpendController.php

+ 10 - 2
app-ghs/controllers/ExpendController.php

@@ -180,14 +180,22 @@ class ExpendController extends BaseController
 
             }
             $remark = $post['remark'] ?? '';
-            $staffName = $this->shopAdmin->name ?? '';
+            $getStaffId = $post['getStaffId'] ?? 0;
+            $staff = ShopAdminClass::getById($getStaffId, true);
+            if (empty($staff)) {
+                util::fail('没有找到员工');
+            }
+            if ($staff->mainId != $this->mainId) {
+                util::fail('没有员工');
+            }
+            $staffName = $staff->name ?? '';
             $ptStyle = dict::getDict('ptStyle', 'ghs');
             $expendData = [
                 'type' => $type,
                 'amount' => $amount,
                 'remark' => $remark,
                 'mainId' => $this->mainId,
-                'staffId' => $this->shopAdminId,
+                'staffId' => $getStaffId,
                 'staffName' => $staffName,
                 'ptStyle' => $ptStyle,
                 'payWay' => $payWay,