|
@@ -5,10 +5,11 @@ namespace App\Models\Manager\WashConfig;
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
use Illuminate\Support\Facades\DB;
|
|
use Illuminate\Support\Facades\DB;
|
|
|
|
|
+use App\Models\Manager\WashConfig\ViolationCompanyMember as ViolationCompanyMemberModel;
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 清洗配置-违规店铺
|
|
|
|
|
|
|
+ * 清洗配置-违规店铺(公司)
|
|
|
* @author: 唐远望
|
|
* @author: 唐远望
|
|
|
* @version: 1.0
|
|
* @version: 1.0
|
|
|
* @date: 2025-12-03
|
|
* @date: 2025-12-03
|
|
@@ -57,7 +58,27 @@ class ViolationStore extends Model
|
|
|
{
|
|
{
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
try {
|
|
try {
|
|
|
- $this->addViolationStore_content($data);
|
|
|
|
|
|
|
+ $ViolationCompanyMemberModel = new ViolationCompanyMemberModel();
|
|
|
|
|
+ $insert_data = [
|
|
|
|
|
+ 'company_name' => $data['company_name'],
|
|
|
|
|
+ 'social_credit_code' => $data['social_credit_code'],
|
|
|
|
|
+ 'store_type' => $data['store_type'],
|
|
|
|
|
+ 'employee_ids' => $data['employee_ids'],
|
|
|
|
|
+ 'insert_time' => time(),
|
|
|
|
|
+ ];
|
|
|
|
|
+ $ViolationStore_id = $this->insertGetId($insert_data);
|
|
|
|
|
+
|
|
|
|
|
+ if ($data['employee_ids'] != '') {
|
|
|
|
|
+ $insert_company_data = [];
|
|
|
|
|
+ $employee_ids = explode(',', $data['employee_ids']);
|
|
|
|
|
+ foreach ($employee_ids as $employee_id) {
|
|
|
|
|
+ $insert_company_data[] = [
|
|
|
|
|
+ 'company_logid' => $ViolationStore_id,
|
|
|
|
|
+ 'company_id' => $employee_id,
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationCompanyMemberModel->insert($insert_company_data);
|
|
|
|
|
+ }
|
|
|
DB::commit();
|
|
DB::commit();
|
|
|
return true;
|
|
return true;
|
|
|
// 成功处理...
|
|
// 成功处理...
|
|
@@ -105,7 +126,30 @@ class ViolationStore extends Model
|
|
|
{
|
|
{
|
|
|
DB::beginTransaction();
|
|
DB::beginTransaction();
|
|
|
try {
|
|
try {
|
|
|
- $this->editViolationStore_content($where, $data);
|
|
|
|
|
|
|
+ $ViolationCompanyMemberModel = new ViolationCompanyMemberModel();
|
|
|
|
|
+ $ViolationStore = $this->where($where)->first();
|
|
|
|
|
+ if (!$ViolationStore) {
|
|
|
|
|
+ return false;
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationStore->company_name = $data['company_name'];
|
|
|
|
|
+ $ViolationStore->social_credit_code = $data['social_credit_code'];
|
|
|
|
|
+ $ViolationStore->store_type = $data['store_type'];
|
|
|
|
|
+ $ViolationStore->employee_ids = $data['employee_ids'];
|
|
|
|
|
+ $ViolationStore->update_time = time();
|
|
|
|
|
+ $ViolationStore->save();
|
|
|
|
|
+
|
|
|
|
|
+ $ViolationCompanyMemberModel->where('company_logid', $ViolationStore->id)->delete();
|
|
|
|
|
+ if ($data['employee_ids'] != '') {
|
|
|
|
|
+ $insert_company_data = [];
|
|
|
|
|
+ $employee_ids = explode(',', $data['employee_ids']);
|
|
|
|
|
+ foreach ($employee_ids as $employee_id) {
|
|
|
|
|
+ $insert_company_data[] = [
|
|
|
|
|
+ 'company_logid' => $ViolationStore->id,
|
|
|
|
|
+ 'company_id' => $employee_id,
|
|
|
|
|
+ ];
|
|
|
|
|
+ }
|
|
|
|
|
+ $ViolationCompanyMemberModel->insert($insert_company_data);
|
|
|
|
|
+ }
|
|
|
DB::commit();
|
|
DB::commit();
|
|
|
return true;
|
|
return true;
|
|
|
// 成功处理...
|
|
// 成功处理...
|