$params['org_id'], 'department_id' => $params['department_id'], 'project_id' => $params['project_id'], 'customer_demand_id' => $params['customer_demand_id'], 'competitor_name' => $params['competitor_name'], 'competitor_contacts' => $params['competitor_contacts'], 'competitor_contacts_phone' => $params['competitor_contacts_phone'], 'competitive_power' => $params['competitive_power'], 'competitor_advantages' => $params['competitor_advantages'], 'competitor_disadvantages' => $params['competitor_disadvantages'], 'remark' => $params['remark'], 'annex' => $params['annex'] ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 编辑竞争对手 * @param array $params * @return bool * @author likeadmin * @date 2023/11/24 22:01 */ public static function edit(array $params): bool { Db::startTrans(); try { Competitor::where('id', $params['id'])->update([ 'org_id' => $params['org_id'], 'department_id' => $params['department_id'], 'project_id' => $params['project_id'], 'customer_demand_id' => $params['customer_demand_id'], 'competitor_name' => $params['competitor_name'], 'competitor_contacts' => $params['competitor_contacts'], 'competitor_contacts_phone' => $params['competitor_contacts_phone'], 'competitive_power' => $params['competitive_power'], 'competitor_advantages' => $params['competitor_advantages'], 'competitor_disadvantages' => $params['competitor_disadvantages'], 'remark' => $params['remark'], 'annex' => $params['annex'] ]); Db::commit(); return true; } catch (\Exception $e) { Db::rollback(); self::setError($e->getMessage()); return false; } } /** * @notes 删除竞争对手 * @param array $params * @return bool * @author likeadmin * @date 2023/11/24 22:01 */ public static function delete(array $params): bool { return Competitor::destroy($params['id']); } /** * @notes 获取竞争对手详情 * @param $params * @return array * @author likeadmin * @date 2023/11/24 22:01 */ public static function detail($params): array { return Competitor::findOrEmpty($params['id'])->toArray(); } }