Ver código fonte

优化查询字段,提高查询效率

shizhongqi 1 ano atrás
pai
commit
5376a006ba
1 arquivos alterados com 2 adições e 2 exclusões
  1. 2 2
      biz-hd/staff/services/StaffService.php

+ 2 - 2
biz-hd/staff/services/StaffService.php

@@ -26,14 +26,14 @@ class StaffService extends BaseService
         $staff->save();
 
         // 检查管理员是否有自己的门店
-        $shops = ShopClass::getAllByCondition(['adminId' => $admin->id], null, '*', 'id');
+        $shops = ShopClass::getAllByCondition(['adminId' => $admin->id], null, 'id', 'id');
         if (empty($shops)) {
             // 情况1:自己没有店,在别人那边当员工
             $admin->currentShopId = 0;
         } else {
             // 情况2:自己有店,也在其他店当员工
             $ptStyle = dict::getDict('ptStyle', 'hd');
-            $shop = ShopClass::getByCondition(['adminId' => $admin->id, 'ptStyle' => $ptStyle]);
+            $shop = ShopClass::getByCondition(['adminId' => $admin->id, 'ptStyle' => $ptStyle], 'id');
             if (empty($shop)) {
                 util::fail('没有找到有效的门店信息');
             }