0
0

DinnerAddress.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <?php
  2. namespace app\common\model;
  3. use think\Db;
  4. class DinnerAddress extends Base
  5. {
  6. public function updates(){
  7. $data = request()->post();
  8. $data['org_id'] = cur_org_id();
  9. $result = validate('DinnerAddress')->check($data,[],'');
  10. if(true !== $result){
  11. $this->error = validate('DinnerAddress')->getError();
  12. return false;
  13. }
  14. $id = $data['id'];
  15. unset($data['id']);
  16. if($id > 0){
  17. $data['update_time'] = date('Y-m-d H:i:s');
  18. $ret = $this->allowField(true)->save($data,['id'=>$id]);
  19. }else{
  20. $data['create_time'] = date('Y-m-d H:i:s');
  21. $ret = $this->allowField(true)->save($data);
  22. }
  23. if(!$ret){
  24. $this->error = '操作失败';
  25. return false;
  26. }
  27. $name = '科室地址';
  28. $content = $name.':新增';
  29. if($id > 0){
  30. $content = $name.':编辑';
  31. $data['id'] = $id;
  32. }else{
  33. $data['id'] = $this->id;
  34. }
  35. return true;
  36. }
  37. }