作者 王晓刚
1 个管道 的构建 通过 耗费 2 秒

后台问卷调查

... ... @@ -63,13 +63,44 @@ class QuestionController extends AdminBaseController
$param=$this->request->param();
$validate = new Validate([
'name' => 'require',
'sex' => 'require',
'birthday' => 'require',
'area' => 'require',
'family_num' => 'require',
'occupation' => 'require',
'smoke_drink' => 'require',
'going' => 'require',
'social' => 'require',
'year_income' => 'require',
'personage_year_income' => 'require',
'liabilities' => 'require',
'not_return' => 'require',
'family_disease' => 'require',
'safeguard' => 'require',
'phone' => 'require',
]);
$validate->message([
'name' => '姓名不能为空!',
'sex' => '请选择性别!',
'birthday' => '年龄不能为空!',
'area' => '所在地不能为空!',
'family_num' => '请选择家庭结构!',
'occupation' => '请选择职业!',
'smoke_drink' => '请选择有误吸烟酗酒史!',
'going' => '请选择出行方式!',
'social' => '请选择有无社保!',
'year_income' => '请选择家庭年收入!',
'personage_year_income' => '请选择个人年收入!',
'liabilities' => '请选择有无负债!',
'not_return' => '请选择大约未还负债!',
'family_disease' => '请选择有无家族病史!',
'safeguard' => '请选择更关心的保障!',
'phone' => '手机号不能为空!',
]);
if (!$validate->check($param)) {
$this->error($validate->getError());
}
$param['safeguard'] = implode(',',$param['safeguard']);
Db::name('question')
->where('id',$id)
->update($param);
... ...