Browse Source

[智价云] 编辑信息日志展示更新

tangyuanwang 2 tháng trước cách đây
mục cha
commit
afe4d86c59

+ 2 - 1
app/Http/Controllers/Manager/Personnel/Department.php

@@ -149,6 +149,7 @@ class Department extends Controller
         $where = ['id' => $id];
         $Department = $DepartmentModel->where($where)->first();
         if (!$Department) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $Department->toArray();
         //查询是否存在
         $map = ['name' => $all_data['name']];
         $data = $DepartmentModel->where($map)->where('id', '!=', $id)->first();
@@ -161,7 +162,7 @@ class Department extends Controller
         $admin_id   = request('access_token.uid', 0); //用户ID
         $table_name = $DepartmentModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $table_name, $notes_type, $Department->toArray(), $all_data, '修改了部门' . $Department->name . '信息');
+        $this->addAdminHistory('人员信息管理-部门管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了部门' . $oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }

+ 2 - 1
app/Http/Controllers/Manager/Personnel/Employee.php

@@ -275,6 +275,7 @@ class Employee extends Controller
         $where = ['id' => $id];
         $Employee = $EmployeeModel->where($where)->first();
         if (!$Employee) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $Employee->toArray();
         //查询是否存在
         $map = ['name' => $all_data['name']];
         $data = $EmployeeModel->where($map)->where('id', '!=', $id)->first();
@@ -290,7 +291,7 @@ class Employee extends Controller
         $admin_id   = request('access_token.uid', 0); //用户ID
         $table_name = $EmployeeModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $table_name, $notes_type, $Employee->toarray(), $all_data, '修改了员工' . $Employee->name . '信息');
+        $this->addAdminHistory('人员信息管理-员工管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了员工' .$oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }

+ 3 - 4
app/Http/Controllers/Manager/Personnel/Roles.php

@@ -152,9 +152,8 @@ class Roles extends Controller
         // 更新数据表
         $where = ['id' => $id];
         $Roles = $RolesModel->where($where)->first();
-        if (!$Roles) {
-            return json_send(['code' => 'error', 'msg' => '记录不存在']);;
-        }
+        if (!$Roles) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $Roles->toArray();
         $result =  $RolesModel->editRoles_content($Roles, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -162,7 +161,7 @@ class Roles extends Controller
         $admin_id   = request('access_token.uid', 0); //用户ID
         $table_name = $RolesModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $table_name, $notes_type, $Roles->toarray(), $all_data, '修改了角色' . $Roles->name . '信息');
+        $this->addAdminHistory('人员信息管理-角色管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了角色' . $oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }

+ 2 - 1
app/Http/Controllers/Manager/WashConfig/CompanyCategory.php

@@ -153,6 +153,7 @@ class CompanyCategory extends Controller
         $where = ['id' => $id];
         $CompanyCategory = $CompanyCategoryModel->where($where)->first();
         if (!$CompanyCategory) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $CompanyCategory->toArray();
         $result =  $CompanyCategoryModel->editCompanyCategory_content($CompanyCategory, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -160,7 +161,7 @@ class CompanyCategory extends Controller
         $admin_id   = request('access_token.uid', 0); //用户ID
         $table_name = $CompanyCategoryModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $table_name, $notes_type,$CompanyCategory->toarray(),$all_data, '修改了分类' .$CompanyCategory->name . '信息');
+        $this->addAdminHistory('清洗配置-公司分类管理', $admin_id, $table_name, $notes_type,$oldData,$all_data, '修改了分类' .$oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }

+ 2 - 1
app/Http/Controllers/Manager/WashConfig/LowPriceGoods.php

@@ -214,6 +214,7 @@ class LowPriceGoods extends Controller
         $where = ['id' => $id];
         $LowProduct = $LowPriceGoodsModel->where($where)->first();
         if (!$LowProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $LowProduct->toarray();
         //如果修改采集周期,则校验采集时间是否在明天以后
         if ($sampling_cycle != $LowProduct->sampling_cycle) {
             $allow_sampling_time = Carbon::tomorrow()->startOfDay()->getTimestamp(); // 明天的开始时间(允许开始采集时间校验)
@@ -226,7 +227,7 @@ class LowPriceGoods extends Controller
         $admin_id   = request('access_token.uid', 0); //用户ID
         $table_name = $LowPriceGoodsModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $table_name, $notes_type, $LowProduct->toarray(), $all_data, '修改了低价商品' . $LowProduct->product_name . '信息');
+        $this->addAdminHistory('清洗配置-低价商品管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了低价商品' . $oldData['product_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }

+ 2 - 1
app/Http/Controllers/Manager/WashConfig/ProductCategory.php

@@ -153,6 +153,7 @@ class ProductCategory extends Controller
         $where = ['id' => $id];
         $ProductCategory = $ProductCategoryModel->where($where)->first();
         if (!$ProductCategory) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $ProductCategory->toarray();
         $result =  $ProductCategoryModel->editProductCategory_content($ProductCategory, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -160,7 +161,7 @@ class ProductCategory extends Controller
         $admin_id   = request('access_token.uid', 0); //用户ID
         $table_name = $ProductCategoryModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $table_name, $notes_type, $ProductCategory->toarray(), $all_data, '修改了商品分类' . $ProductCategory->name . '信息');
+        $this->addAdminHistory('清洗配置-商品分类管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了商品分类' .$oldData['name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }

+ 2 - 1
app/Http/Controllers/Manager/WashConfig/ViolationProduct.php

@@ -214,6 +214,7 @@ class ViolationProduct extends Controller
         $where = ['id' => $id];
         $ViolationProduct = $ViolationProductModel->where($where)->first();
         if (!$ViolationProduct) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $ViolationProduct->toarray();
         //如果修改采集周期,则校验采集时间是否在明天以后
         if ($sampling_cycle != $ViolationProduct->sampling_cycle) {
             $allow_sampling_time = Carbon::tomorrow()->startOfDay()->getTimestamp(); // 明天的开始时间(允许开始采集时间校验)
@@ -226,7 +227,7 @@ class ViolationProduct extends Controller
         $admin_id   = request('access_token.uid', 0); //用户ID
         $table_name = $ViolationProductModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $table_name, $notes_type, $ViolationProduct->toarray(), $all_data, '修改了禁止商品' . $ViolationProduct->product_name . '信息');
+        $this->addAdminHistory('清洗配置-禁止商品管理', $admin_id, $table_name, $notes_type,$oldData, $all_data, '修改了禁止商品' . $oldData['product_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }

+ 2 - 1
app/Http/Controllers/Manager/WashConfig/ViolationStore.php

@@ -210,6 +210,7 @@ class ViolationStore extends Controller
         $where = ['id' => $id];
         $ViolationStore = $ViolationStoreModel->where($where)->first();
         if (!$ViolationStore) return json_send(['code' => 'error', 'msg' => '记录不存在']);
+        $oldData = $ViolationStore->toarray();
         $result =  $ViolationStoreModel->updateViolationStore($ViolationStore, $all_data);
         // 如果操作失败
         if (!$result)     return json_send(['code' => 'error', 'msg' => '修改失败']);
@@ -217,7 +218,7 @@ class ViolationStore extends Controller
         $admin_id   = request('access_token.uid', 0); //用户ID
         $table_name = $ViolationStoreModel->getTable();
         $notes_type = 2; //操作类型,1添加,2修改,3=删除
-        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $table_name, $notes_type, $ViolationStore->toarray(), $all_data, '修改了公司' . $ViolationStore->company_name . '信息');
+        $this->addAdminHistory('清洗配置-公司管理', $admin_id, $table_name, $notes_type, $oldData, $all_data, '修改了公司' . $oldData['company_name'] . '信息');
         // 告知结果
         return json_send(['code' => 'success', 'msg' => '修改成功']);
     }