PlugIn_bmAction.class.php 3.2 KB

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