$data['platform'], 'product_name' => $data['product_name'], 'product_specs' => $data['product_specs'], 'store_scope' => $data['store_scope'], 'insert_time' => time(), ]; $ControlGoods_id = $this->insertGetId($insert_data); return $ControlGoods_id; } /** * 写入数据 * @author 唐远望 * @version 1.0 * @date 2025-12-03 * @param $data * @return bool */ public function addControlGoods($data) { DB::beginTransaction(); try { $this->addControlGoods_content($data); DB::commit(); return true; // 成功处理... } catch (\Exception $e) { DB::rollBack(); // 错误处理... return false; } } /** * 编辑内容 * @author 唐远望 * @version 1.0 * @date 2025-12-03 * @param $data * @return bool */ public function editControlGoods_content($where, $data) { $ControlGoods = $this->where($where)->first(); if (!$ControlGoods) { return false; } $ControlGoods->platform = $data['platform']; $ControlGoods->product_name = $data['product_name']; $ControlGoods->product_specs = $data['product_specs']; $ControlGoods->store_scope = $data['store_scope']; $ControlGoods->update_time = time(); $ControlGoods->save(); return true; } /** * 更新数据 * @author 唐远望 * @version 1.0 * @date 2025-12-03 * @param $data * @return bool */ public function updateControlGoods($where, $data) { DB::beginTransaction(); try { $this->editControlGoods_content($where, $data); DB::commit(); return true; // 成功处理... } catch (\Exception $e) { DB::rollBack(); // 错误处理... return false; } } /** * 修改状态 * @author 唐远望 * @version 1.0 * @date 2025-12-03 * @param $id * @param $status * @return bool */ public function changeStatus($where, $status) { $ControlGoods = $this->where($where)->first(); if (!$ControlGoods) { return false; } $ControlGoods->status = $status; $ControlGoods->update_time = time(); $ControlGoods->save(); return true; } /** * 删除数据 * @author 唐远望 * @version 1.0 * @date 2025-12-03 * @param $id * @return bool */ public function deleteControlGoods($where) { $ControlGoods = $this->where($where)->first(); if (!$ControlGoods) { return false; } $ControlGoods->delete(); return true; } }