PodcastGoodsAction.class.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | Fanwe 方维p2p借贷系统
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2011 http://www.fanwe.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Author: 云淡风轻(1956838968@qq.com)
  8. // +----------------------------------------------------------------------
  9. class PodcastGoodsAction extends CommonAction{
  10. public function index()
  11. {
  12. if(strim($_REQUEST['name'])!=''){
  13. $map['name'] = array('like','%'.strim($_REQUEST['name']).'%');
  14. }
  15. if(intval($_REQUEST['user_id'])!=''){
  16. $map['user_id'] = intval($_REQUEST['user_id']);
  17. }
  18. //$name=$this->getActionName();
  19. $model = D ('podcast_goods');
  20. if (! empty ( $model )) {
  21. $this->_list ( $model, $map );
  22. }
  23. $list = $this->get('list');
  24. foreach($list as $k => $v){
  25. $list[$k]['url'] = htmlspecialchars_decode($v['url']);
  26. $list[$k]['imgs'] = json_decode($v['imgs'],1)[0];
  27. }
  28. $this->assign("list",$list);
  29. $this->display();
  30. }
  31. public function set_effect()
  32. {
  33. $id = intval($_REQUEST['id']);
  34. $ajax = intval($_REQUEST['ajax']);
  35. $info = M('podcast_goods')->where("id=".$id)->getField("name");
  36. $c_is_effect = M('podcast_goods')->where("id=".$id)->getField("is_effect"); //当前状态
  37. $n_is_effect = $c_is_effect == 0 ? 1 : 0; //需设置的状态
  38. M('podcast_goods')->where("id=".$id)->setField("is_effect",$n_is_effect);
  39. save_log($info.l("SET_EFFECT_".$n_is_effect),1);
  40. $this->ajaxReturn($n_is_effect,l("SET_EFFECT_".$n_is_effect),1) ;
  41. }
  42. }
  43. ?>