$params['fence_house_id'], 'animal_info_id' => $params['animal_info_id']??0, 'type' => 4, 'type_text'=>'疫苗', 'detail' => json_encode([ 'fence_house_id' => $params['fence_house_id'], 'animal_info_id' => $params['animal_info_id']??0, 'vaccine_name' => $params['vaccine_name'], 'vaccine_manufacturers' => $params['vaccine_manufacturers'], 'vaccine_batch' => $params['vaccine_batch'], 'vaccination_method' => $params['vaccination_method'], 'vaccination_site' => $params['vaccination_site'], 'immune_validity_period' => $params['immune_validity_period'], 'operator' => $params['operator'], 'pic' => $params['pic'], 'remark' => $params['remark'], ]) ]); // OperationVaccinumLog::create([ // 'fence_house_id' => $params['fence_house_id'], // 'animal_info_id' => $params['animal_info_id']??0, // 'vaccine_name' => $params['vaccine_name'], // 'vaccine_manufacturers' => $params['vaccine_manufacturers'], // 'vaccine_batch' => $params['vaccine_batch'], // 'vaccination_method' => $params['vaccination_method'], // 'vaccination_site' => $params['vaccination_site'], // 'immune_validity_period' => $params['immune_validity_period'], // 'operator' => $params['operator'], // 'pic' => $params['pic'], // 'remark' => $params['remark'], // ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑 * @param array $params * @return bool * @author likeadmin * @date 2024/01/15 10:11 */ public static function edit(array $params): bool { Db::startTrans(); try { AnimalOperateAction::create([ 'fence_house_id' => $params['fence_house_id'], 'animal_info_id' => $params['animal_info_id']??0, 'type' => 4, 'type_text'=>'疫苗', 'detail' => json_encode([ 'fence_house_id' => $params['fence_house_id'], 'animal_info_id' => $params['animal_info_id']??0, 'vaccine_name' => $params['vaccine_name'], 'vaccine_manufacturers' => $params['vaccine_manufacturers'], 'vaccine_batch' => $params['vaccine_batch'], 'vaccination_method' => $params['vaccination_method'], 'vaccination_site' => $params['vaccination_site'], 'immune_validity_period' => $params['immune_validity_period'], 'operator' => $params['operator'], 'pic' => $params['pic'], 'remark' => $params['remark'], ]) ]); // OperationVaccinumLog::where('id', $params['id'])->update([ // 'fence_house_id' => $params['fence_house_id'], // 'animal_info_id' => $params['animal_info_id']??0, // 'vaccine_name' => $params['vaccine_name'], // 'vaccine_manufacturers' => $params['vaccine_manufacturers'], // 'vaccine_batch' => $params['vaccine_batch'], // 'vaccination_method' => $params['vaccination_method'], // 'vaccination_site' => $params['vaccination_site'], // 'immune_validity_period' => $params['immune_validity_period'], // 'operator' => $params['operator'], // 'pic' => $params['pic'], // 'remark' => $params['remark'], // ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除 * @param array $params * @return bool * @author likeadmin * @date 2024/01/15 10:11 */ public static function delete(array $params): bool { return OperationVaccinumLog::destroy($params['id']); } /** * @notes 获取详情 * @param $params * @return array * @author likeadmin * @date 2024/01/15 10:11 */ public static function detail($params): array { return OperationVaccinumLog::findOrEmpty($params['id'])->toArray(); } }