PlugInAction.class.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 PlugInAction extends CommonAction{
  10. public function index()
  11. {
  12. if(strim($_REQUEST['name'])!=''){
  13. $map['name'] = array('like','%'.strim($_REQUEST['name']).'%');
  14. }
  15. $model = D ("plugin");
  16. $in =array();
  17. //付费直播
  18. if((defined('OPEN_LIVE_PAY') && OPEN_LIVE_PAY == 1)&&(defined('LIVE_PAY_TIME')&&LIVE_PAY_TIME==1)) {
  19. $in[]="'live_pay'";
  20. }
  21. if((defined('OPEN_LIVE_PAY') && OPEN_LIVE_PAY == 1)&&(defined('LIVE_PAY_SCENE')&&LIVE_PAY_SCENE==1)) {
  22. $in[]="'live_pay_scene'";
  23. }
  24. if(defined('OPEN_PAI_MODULE') && OPEN_PAI_MODULE == 1) {
  25. $in[]="'pai'";
  26. }
  27. if(defined('SHOPPING_GOODS') && SHOPPING_GOODS == 1) {
  28. $in[]="'shop'";
  29. }
  30. if(defined('OPEN_GAME_MODULE') && OPEN_GAME_MODULE == 1) {
  31. $in[]="'game'";
  32. }
  33. if(defined('OPEN_PODCAST_GOODS') && OPEN_PODCAST_GOODS == 1) {
  34. $in[]="'podcast_goods'";
  35. }
  36. if($in){
  37. $map['class'] = array('in',implode(',',$in));
  38. if (! empty ( $model )) {
  39. $this->_list ( $model, $map );
  40. }
  41. }
  42. $this->display();
  43. }
  44. public function edit() {
  45. $id = intval($_REQUEST ['id']);
  46. $condition['id'] = $id;
  47. $vo = M("plugin")->where($condition)->find();
  48. $this->assign ('vo',$vo );
  49. $this->display ();
  50. }
  51. public function update() {
  52. B('FilterString');
  53. $data = M("plugin")->create();
  54. //clear_auto_cache("prop_list");
  55. $log_info = M("plugin")->where("id=".intval($data['id']))->getField("name");
  56. //开始验证有效性
  57. $this->assign("jumpUrl",u("GamesPlug"."/edit",array("id"=>$data['id'])));
  58. if(!check_empty($data['name']))
  59. {
  60. $this->error("请输入名称");
  61. }
  62. if(!check_empty($data['image']))
  63. {
  64. $this->error("请输入图标");
  65. }
  66. // 更新数据
  67. $list=M("plugin")->save ($data);
  68. if (false !== $list) {
  69. //成功提示
  70. save_log($log_info.L("UPDATE_SUCCESS"),1);
  71. clear_auto_cache("prop_id",array('id'=>$data['id']));
  72. $this->success(L("UPDATE_SUCCESS"));
  73. } else {
  74. //错误提示
  75. save_log($log_info.L("UPDATE_FAILED"),0);
  76. $this->error(L("UPDATE_FAILED"),0,$log_info.L("UPDATE_FAILED"));
  77. }
  78. }
  79. }
  80. ?>