Commit 0ba3f372 by 杨树贤

修复各种bug

parent 61edcda0
...@@ -36,12 +36,17 @@ class LogFilter ...@@ -36,12 +36,17 @@ class LogFilter
$departmentService = new DepartmentService(); $departmentService = new DepartmentService();
//下属用户id(结果包括自己的id) //下属用户id(结果包括自己的id)
$subordinateUserIds = $departmentService->getSubordinateUserIds($adminId); $subordinateUserIds = $departmentService->getSubordinateUserIds($adminId);
// 系统操作日志(admin_id=0)对所有用户可见
$subordinateUserIds[] = 0;
$query->whereIn('admin_id', $subordinateUserIds); $query->whereIn('admin_id', $subordinateUserIds);
} else { } else {
//剩下的就只是看自己相关的 //剩下的就只是看自己相关的
$query->where('admin_id', $adminId); // 加上系统操作日志(admin_id=0)对所有用户可见
$query->where(function ($q) use ($adminId) {
$q->where('admin_id', $adminId)->orWhere('admin_id', 0);
});
} }
} }
return $query; return $query;
} }
} }
\ No newline at end of file
...@@ -29,15 +29,17 @@ class SupplierLogFilter ...@@ -29,15 +29,17 @@ class SupplierLogFilter
//可以查看所有的话,默认不做任何限制 //可以查看所有的话,默认不做任何限制
} elseif ($canViewSubordinateLog) { } elseif ($canViewSubordinateLog) {
//如果能看部下的,那需要判断的地方就多了不少 //如果能看部下的,那需要判断的地方就多了不少
if ($canViewSubordinateLog) { $departmentService = new DepartmentService();
$departmentService = new DepartmentService(); //下属用户id(结果包括自己的id)
//下属用户id(结果包括自己的id) $subordinateUserIds = $departmentService->getSubordinateUserIds($adminId);
$subordinateUserIds = $departmentService->getSubordinateUserIds($adminId); // 系统操作日志(admin_id=0)对所有用户可见
$query->whereIn('admin_id', $subordinateUserIds); $subordinateUserIds[] = 0;
} else { $query->whereIn('admin_id', $subordinateUserIds);
//剩下的就只是看自己相关的 } else {
$query->where('admin_id', $adminId); // 剩下的就只是看自己相关的,加上系统操作日志
} $query->where(function ($q) use ($adminId) {
$q->where('admin_id', $adminId)->orWhere('admin_id', 0);
});
} }
return $query; return $query;
} }
......
...@@ -512,7 +512,6 @@ class SupplierSyncController extends BaseSyncController ...@@ -512,7 +512,6 @@ class SupplierSyncController extends BaseSyncController
} }
$supplierId = $supplier['supplier_id']; $supplierId = $supplier['supplier_id'];
try { try {
// 更新逆向采购员 // 更新逆向采购员
$extend = SupplierExtendModel::where('supplier_id', $supplierId)->first(); $extend = SupplierExtendModel::where('supplier_id', $supplierId)->first();
...@@ -541,4 +540,4 @@ class SupplierSyncController extends BaseSyncController ...@@ -541,4 +540,4 @@ class SupplierSyncController extends BaseSyncController
$this->syncResponse(-1, '更新失败: ' . $e->getMessage()); $this->syncResponse(-1, '更新失败: ' . $e->getMessage());
} }
} }
} }
\ No newline at end of file
...@@ -14,8 +14,8 @@ class LogService ...@@ -14,8 +14,8 @@ class LogService
//添加日志 //添加日志
public function AddLog($supplierId, $type, $action, $content, $remark = '') public function AddLog($supplierId, $type, $action, $content, $remark = '')
{ {
$adminId = isset(request()->user->userId) ? request()->user->userId : 0; $adminId = isset(request()->user->userId) ? request()->user->userId : 1000;
$adminName = isset(request()->user->name) ? request()->user->name : ''; $adminName = isset(request()->user->name) ? request()->user->name : 'admin';
$data = [ $data = [
'supplier_id' => $supplierId, 'supplier_id' => $supplierId,
'type' => $type, 'type' => $type,
......
...@@ -658,12 +658,13 @@ class SupplierAuditService ...@@ -658,12 +658,13 @@ class SupplierAuditService
]; ];
if (!empty($channelUid)) { if (!empty($channelUid)) {
$updateData['channel_uid'] = $channelUid; $updateData['channel_uid'] = $channelUid;
// 同步更新联系人表的 can_check_uids
SupplierContactModel::where('supplier_id', $supplierId)
->where('channel_user_type', SupplierContactModel::CHANNEL_USER_TYPE_LIEXIN)
->update(['can_check_uids' => $channelUid]);
} }
SupplierChannelModel::where('supplier_id', $supplierId)->update($updateData); SupplierChannelModel::where('supplier_id', $supplierId)->update($updateData);
SupplierContactModel::where('supplier_id', $supplierId)->update([
'can_check_uids' => $channelUid,
]);
// 回传CRM系统:转化供应商状态更新为完成 // 回传CRM系统:转化供应商状态更新为完成
$supplierName = SupplierChannelModel::where('supplier_id', $supplierId)->value('supplier_name'); $supplierName = SupplierChannelModel::where('supplier_id', $supplierId)->value('supplier_name');
CrmService::confirmCrmSupplier($supplierId, $supplierName, $approverName, 1, $remark); CrmService::confirmCrmSupplier($supplierId, $supplierName, $approverName, 1, $remark);
...@@ -731,4 +732,4 @@ class SupplierAuditService ...@@ -731,4 +732,4 @@ class SupplierAuditService
); );
return $flowInfo; return $flowInfo;
} }
} }
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment