GamesPlugAction.class.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  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 GamesPlugAction 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. //付费直播
  17. if(!defined('OPEN_LIVE_PAY') || OPEN_LIVE_PAY != 1) {
  18. $map['class'] = array('neq','live_pay');
  19. }
  20. if (! empty ( $model )) {
  21. $this->_list ( $model, $map );
  22. }
  23. $this->display();
  24. }
  25. public function edit() {
  26. $id = intval($_REQUEST ['id']);
  27. $condition['id'] = $id;
  28. $vo = M("plugin")->where($condition)->find();
  29. $this->assign ('vo',$vo );
  30. $this->display ();
  31. }
  32. public function update() {
  33. B('FilterString');
  34. $data = M("plugin")->create();
  35. //clear_auto_cache("prop_list");
  36. $log_info = M("plugin")->where("id=".intval($data['id']))->getField("name");
  37. //开始验证有效性
  38. $this->assign("jumpUrl",u("GamesPlug"."/edit",array("id"=>$data['id'])));
  39. if(!check_empty($data['name']))
  40. {
  41. $this->error("请输入名称");
  42. }
  43. if(!check_empty($data['image']))
  44. {
  45. $this->error("请输入图标");
  46. }
  47. // 更新数据
  48. $list=M("plugin")->save ($data);
  49. if (false !== $list) {
  50. //成功提示
  51. save_log($log_info.L("UPDATE_SUCCESS"),1);
  52. clear_auto_cache("prop_id",array('id'=>$data['id']));
  53. $this->success(L("UPDATE_SUCCESS"));
  54. } else {
  55. //错误提示
  56. save_log($log_info.L("UPDATE_FAILED"),0);
  57. $this->error(L("UPDATE_FAILED"),0,$log_info.L("UPDATE_FAILED"));
  58. }
  59. }
  60. }
  61. ?>