添加其它技术分类
This commit is contained in:
@@ -179,11 +179,15 @@ class Common extends Api
|
||||
'key' => $key == 0 ? '-1' : $key,
|
||||
];
|
||||
}
|
||||
// 过滤空值,避免配置项为空时返回空字符串标签
|
||||
$toLabels = function ($value) {
|
||||
return array_values(array_filter(array_map('trim', explode(',', $value ?? ''))));
|
||||
};
|
||||
$config = [
|
||||
'languageLabels' => explode(',', $code_languages),
|
||||
'frontLabels' => explode(',', $front_techs),
|
||||
'backendLabels' => explode(',', $back_techs),
|
||||
'otherLabels' => explode(',', $other_techs),
|
||||
'languageLabels' => $toLabels($code_languages),
|
||||
'frontLabels' => $toLabels($front_techs),
|
||||
'backendLabels' => $toLabels($back_techs),
|
||||
'otherLabels' => $toLabels($other_techs),
|
||||
'developTypes' => $developTypes,
|
||||
];
|
||||
|
||||
|
||||
@@ -20,6 +20,10 @@ class Developer extends Api
|
||||
* @param array $images 图片数组
|
||||
* @param array $files 文件数组
|
||||
* @param string $contact 联系方式
|
||||
* @param array $languageSelected 选中的编程语言
|
||||
* @param array $frontSelected 选中的前端技术
|
||||
* @param array $backendSelected 选中的后端技术
|
||||
* @param array $otherSelected 选中的其它技术
|
||||
*/
|
||||
public function submit()
|
||||
{
|
||||
@@ -46,7 +50,16 @@ class Developer extends Api
|
||||
if (DeveloperService::getOne(['user_id' => $userId])) {
|
||||
exception('您已经申请入驻,请勿重复申请!');
|
||||
}
|
||||
$params['tags'] = array_filter(array_merge($params['languageSelected'], $params['frontSelected'], $params['backendSelected']));
|
||||
// 合并各技术分类选中的标签(编程语言/前端技术/后端技术/其它技术)
|
||||
$params['tags'] = array_values(array_unique(array_filter(array_merge(
|
||||
(array)($params['languageSelected'] ?? []),
|
||||
(array)($params['frontSelected'] ?? []),
|
||||
(array)($params['backendSelected'] ?? []),
|
||||
(array)($params['otherSelected'] ?? [])
|
||||
))));
|
||||
if (empty($params['tags'])) {
|
||||
$this->error('技能标签不能为空');
|
||||
}
|
||||
DeveloperService::instance()->create($params, $userId);
|
||||
$this->success('申请已提交,等待审核通过即可接单');
|
||||
} catch (\Exception $e) {
|
||||
|
||||
Reference in New Issue
Block a user