12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <?php
- namespace app\common\model;
- use think\Db;
- class DinnerAddress extends Base
- {
- public function updates(){
- $data = request()->post();
- $data['org_id'] = cur_org_id();
- $result = validate('DinnerAddress')->check($data,[],'');
- if(true !== $result){
- $this->error = validate('DinnerAddress')->getError();
- return false;
- }
- $id = $data['id'];
- unset($data['id']);
- if($id > 0){
- $data['update_time'] = date('Y-m-d H:i:s');
- $ret = $this->allowField(true)->save($data,['id'=>$id]);
- }else{
- $data['create_time'] = date('Y-m-d H:i:s');
- $ret = $this->allowField(true)->save($data);
- }
- if(!$ret){
- $this->error = '操作失败';
- return false;
- }
- $name = '科室地址';
- $content = $name.':新增';
- if($id > 0){
- $content = $name.':编辑';
- $data['id'] = $id;
- }else{
- $data['id'] = $this->id;
- }
- return true;
- }
- }
|