auth->id; $data['birthday'] = strtotime($data['birthday']); $id = Db::name('user_member')->insertGetId($data); $this->success('操作成功',$id); } //我的成员列表 public function my_list(){ $list = Db::name('user_member')->field('id,realname,gender,birthday')->where('user_id',$this->auth->id)->order('id desc')->select(); if(!empty($list)){ foreach($list as $key => &$val){ $val['age'] = birthtime_to_age($val['birthday']); $val['avatar'] = localpath_to_netpath('/assets/img/avatar.png'); } } $this->success('success',$list); } //获取详情 public function info(){ $id = input('id',0); $info = Db::name('user_member')->where('id',$id)->find(); if(!empty($info)){ $info['birthday'] = date('Y-m-d',$info['birthday']); } $this->success('success',$info); } //编辑 public function edit_one(){ $id = input('id',0); $field = [ 'realname', 'idcard', 'relation', 'mobile', 'gender', 'birthday', 'marital_status', 'allergies_status', 'allergies_text', 'familymedical_status', 'familymedical_text', 'chronicdisease_status', 'chronicdisease_text', ]; $data = request_post_hub($field); if(isset($data['birthday'])){ $data['birthday'] = strtotime($data['birthday']); } Db::name('user_member')->where('id',$id)->where('user_id',$this->auth->id)->update($data); $this->success('操作成功'); } //删除 public function delete(){ $id = input('id',0); Db::name('user_member')->where('id',$id)->where('user_id',$this->auth->id)->delete(); $this->success('操作成功'); } }