ArticleModel.class.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 ArticleModel{
  16. public function update($data)
  17. {
  18. $ins_data = array();
  19. $ins_data['title'] = $data['title'];
  20. $ins_data['content'] = $data['content'];
  21. $ins_data['displayorder'] = $data['displayorder'];
  22. $ins_data['enabled'] = $data['enabled'];
  23. $ins_data['addtime'] = time();
  24. $id = $data['id'];
  25. if( !empty($id) && $id > 0 )
  26. {
  27. unset($ins_data['addtime']);
  28. M('lionfish_comshop_article')->where( array('id' => $id) )->save( $ins_data );
  29. $id = $data['id'];
  30. }else{
  31. $id = M('lionfish_comshop_article')->where( array('id' => $id) )->add( $ins_data );
  32. }
  33. }
  34. }
  35. ?>