|
|
@ -435,30 +435,31 @@ class ContentController extends BaseController |
|
|
return jsonReturn(-2,lang('请求方法错误')); |
|
|
return jsonReturn(-2,lang('请求方法错误')); |
|
|
} |
|
|
} |
|
|
$param = input('post.'); |
|
|
$param = input('post.'); |
|
|
var_dump($param); |
|
|
|
|
|
exit(); |
|
|
|
|
|
|
|
|
|
|
|
// try{
|
|
|
|
|
|
// validate(ContentValidate::class)->scene('save')->check($param);
|
|
|
|
|
|
// }catch (ValidateException $e){
|
|
|
|
|
|
// return jsonReturn(422, $e->getError());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// $param['admin'] = $this->admin;
|
|
|
|
|
|
// unset($param['main_content']['id']);//添加接口以防冲突不需要id
|
|
|
|
|
|
// unset($param['sub_content']['id']);//添加接口以防冲突不需要id
|
|
|
|
|
|
// if(empty($param['sub_content']['publish_time'])){
|
|
|
|
|
|
// $param['sub_content']['publish_time'] = date('Y-m-d H:i:s',time());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// if(!isset($param['main_content'])){
|
|
|
|
|
|
// $param['main_content'] = [];
|
|
|
|
|
|
// }
|
|
|
|
|
|
// try {
|
|
|
|
|
|
// $res = $contentService->saveContent($param);
|
|
|
|
|
|
// } catch (ModelEmptyException | ModelException $e) {
|
|
|
|
|
|
// return jsonReturn(-3,$e->getMessage());
|
|
|
|
|
|
// }
|
|
|
|
|
|
// CacheService::clear();
|
|
|
|
|
|
// return json($res);
|
|
|
|
|
|
|
|
|
// var_dump($param);
|
|
|
|
|
|
// exit();
|
|
|
|
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
validate(ContentValidate::class)->scene('save')->check($param); |
|
|
|
|
|
}catch (ValidateException $e){ |
|
|
|
|
|
return jsonReturn(422, $e->getError()); |
|
|
|
|
|
} |
|
|
|
|
|
$param['admin'] = $this->admin; |
|
|
|
|
|
unset($param['main_content']['id']);//添加接口以防冲突不需要id
|
|
|
|
|
|
unset($param['sub_content']['id']);//添加接口以防冲突不需要id
|
|
|
|
|
|
if(empty($param['sub_content']['publish_time'])){ |
|
|
|
|
|
$param['sub_content']['publish_time'] = date('Y-m-d H:i:s',time()); |
|
|
|
|
|
} |
|
|
|
|
|
if(!isset($param['main_content'])){ |
|
|
|
|
|
$param['main_content'] = []; |
|
|
|
|
|
} |
|
|
|
|
|
try { |
|
|
|
|
|
$res = $contentService->saveContent($param); |
|
|
|
|
|
} catch (ModelEmptyException | ModelException $e) { |
|
|
|
|
|
return jsonReturn(-3,$e->getMessage()); |
|
|
|
|
|
} |
|
|
|
|
|
CacheService::clear(); |
|
|
|
|
|
return json($res); |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|