Commit 0ba3f372 by 杨树贤

修复各种bug

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