$params['name'], 'value' => $params['value'], 'sort' => $params['sort'] ?? 0, 'status' => $params['status'], 'remark' => $params['remark'] ?? '', ]; if (!empty($params['id'])) { return DictData::where(['id' => $params['id']])->update($data); } else { $dictType = DictType::findOrEmpty($params['type_id']); $data['type_id'] = $params['type_id']; $data['type_value'] = $dictType['type']; return DictData::create($data); } } /** * @notes 删除字典数据 * @param array $params * @return bool * @author 段誉 * @date 2022/6/20 17:01 */ public static function delete(array $params) { return DictData::destroy($params['id']); } /** * @notes 获取字典数据详情 * @param $params * @return array * @author 段誉 * @date 2022/6/20 17:01 */ public static function detail($params): array { return DictData::findOrEmpty($params['id'])->toArray(); } public static function getContractPartyACompanyTypeList() { return DictData::whereIn('id', [30,16,41])->order('sort')->select()->toArray(); } public static function getTaskApproveTypeList() { return DictData::where(['type_value' => 'task_approve_type', 'status' => 1])->column('value'); } public static function getShareholderMoneyTaskApproveTypeList() { return DictData::where(['type_value' => 'shareholder_money_task_approve_type', 'status' => 1])->column('value'); } }