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

后台问卷调查

@@ -63,13 +63,44 @@ class QuestionController extends AdminBaseController @@ -63,13 +63,44 @@ class QuestionController extends AdminBaseController
63 $param=$this->request->param(); 63 $param=$this->request->param();
64 $validate = new Validate([ 64 $validate = new Validate([
65 'name' => 'require', 65 'name' => 'require',
  66 + 'sex' => 'require',
  67 + 'birthday' => 'require',
  68 + 'area' => 'require',
  69 + 'family_num' => 'require',
  70 + 'occupation' => 'require',
  71 + 'smoke_drink' => 'require',
  72 + 'going' => 'require',
  73 + 'social' => 'require',
  74 + 'year_income' => 'require',
  75 + 'personage_year_income' => 'require',
  76 + 'liabilities' => 'require',
  77 + 'not_return' => 'require',
  78 + 'family_disease' => 'require',
  79 + 'safeguard' => 'require',
  80 + 'phone' => 'require',
66 ]); 81 ]);
67 $validate->message([ 82 $validate->message([
68 'name' => '姓名不能为空!', 83 'name' => '姓名不能为空!',
  84 + 'sex' => '请选择性别!',
  85 + 'birthday' => '年龄不能为空!',
  86 + 'area' => '所在地不能为空!',
  87 + 'family_num' => '请选择家庭结构!',
  88 + 'occupation' => '请选择职业!',
  89 + 'smoke_drink' => '请选择有误吸烟酗酒史!',
  90 + 'going' => '请选择出行方式!',
  91 + 'social' => '请选择有无社保!',
  92 + 'year_income' => '请选择家庭年收入!',
  93 + 'personage_year_income' => '请选择个人年收入!',
  94 + 'liabilities' => '请选择有无负债!',
  95 + 'not_return' => '请选择大约未还负债!',
  96 + 'family_disease' => '请选择有无家族病史!',
  97 + 'safeguard' => '请选择更关心的保障!',
  98 + 'phone' => '手机号不能为空!',
69 ]); 99 ]);
70 if (!$validate->check($param)) { 100 if (!$validate->check($param)) {
71 $this->error($validate->getError()); 101 $this->error($validate->getError());
72 } 102 }
  103 + $param['safeguard'] = implode(',',$param['safeguard']);
73 Db::name('question') 104 Db::name('question')
74 ->where('id',$id) 105 ->where('id',$id)
75 ->update($param); 106 ->update($param);