0
0

DinnerConfig.php 884 B

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