AdvimgModel.class.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. /**
  3. * lionfish 商城系统
  4. *
  5. * ==========================================================================
  6. * @link http://www.liofis.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license http://www.liofis.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author J_da
  12. *
  13. */
  14. namespace Seller\Model;
  15. class AdvimgModel{
  16. public function update($_GPC)
  17. {
  18. $data = $_GPC['data'];
  19. $pos = $_GPC['pos'];
  20. if($data['linktype']==3 || $data['linktype']==4){
  21. $data['link'] = $data['cid'];
  22. }
  23. $ins_data = array();
  24. $id = $data['id'];
  25. $ins_data['thumb'] = save_media($data['thumb']);
  26. $ins_data['link'] = $data['link'];
  27. $ins_data['linktype'] = $data['linktype'];
  28. $ins_data['appid'] = $data['appid'];
  29. $ins_data['displayorder'] = $data['displayorder'];
  30. $ins_data['enabled'] = $data['enabled'];
  31. $ins_data['pos'] = implode(',', $pos);
  32. $ins_data['addtime'] = time();
  33. if( !empty($id) && $id > 0 )
  34. {
  35. M('lionfish_comshop_advimg')->where( array('id' => $id) )->save( $ins_data );
  36. }else{
  37. M('lionfish_comshop_advimg')->add($ins_data);
  38. }
  39. }
  40. }
  41. ?>