NoticeModel.class.php 961 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. <?php
  2. /**
  3. * 小梦科技资源nanodreamtech.com
  4. *
  5. * ==========================================================================
  6. * @link https://www.nanodreamtech.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license https://www.nanodreamtech.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Seller\Model;
  15. class NoticeModel{
  16. public function update($data)
  17. {
  18. $ins_data = array();
  19. $ins_data['content'] = $data['content'];
  20. $ins_data['displayorder'] = $data['displayorder'];
  21. $ins_data['enabled'] = $data['enabled'];
  22. $ins_data['addtime'] = time();
  23. $id = $data['id'];
  24. if( !empty($id) && $id > 0 )
  25. {
  26. unset($ins_data['addtime']);
  27. M('lionfish_comshop_notice')->where( array('id' => $id) )->save( $ins_data );
  28. $id = $data['id'];
  29. }else{
  30. $id = M('lionfish_comshop_notice')->add($ins_data);
  31. }
  32. }
  33. }
  34. ?>