No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Baidushoulu.php 2.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. <?php
  2. /**
  3. * 易优CMS
  4. * ============================================================================
  5. * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
  6. * 网站地址: http://www.eyoucms.com
  7. * ----------------------------------------------------------------------------
  8. * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
  9. * ============================================================================
  10. * Author: 小虎哥 <1105415366@qq.com>
  11. * Date: 2018-06-28
  12. */
  13. namespace weapp\Baidushoulu\controller;
  14. use think\Db;
  15. use app\common\controller\Weapp;
  16. use weapp\Baidushoulu\model\BaidushouluModel;
  17. /**
  18. * 插件的控制器
  19. */
  20. class Baidushoulu extends Weapp
  21. {
  22. /**
  23. * 实例化模型
  24. */
  25. private $model;
  26. /**
  27. * 插件基本信息
  28. */
  29. private $weappInfo;
  30. /**
  31. * 构造方法
  32. */
  33. public function __construct(){
  34. parent::__construct();
  35. $this->model = new BaidushouluModel;
  36. /*插件基本信息*/
  37. $this->weappInfo = $this->getWeappInfo();
  38. $this->assign('weappInfo', $this->weappInfo);
  39. /*--end*/
  40. }
  41. /**
  42. * show
  43. */
  44. /**
  45. * 插件前台展示 - show钩子方法
  46. * @param mixed $params 传入的参数
  47. */
  48. public function show($params = null)
  49. {
  50. $seo_pseudo = tpCache('seo.seo_pseudo');
  51. if ($seo_pseudo == 1) {
  52. $seo = '&';
  53. }
  54. if ($seo_pseudo == 2) {
  55. $seo = '?';
  56. }
  57. if ($seo_pseudo == 3) {
  58. $seo = '?';
  59. }
  60. $this->assign('seo', $seo);
  61. $baidushoulu = $this->model->getWeappData();
  62. $this->assign('baidushoulu', $baidushoulu);
  63. echo $this->fetch('show');
  64. }
  65. /**
  66. * 插件配置
  67. */
  68. public function index()
  69. {
  70. $baidushoulu = $this->model->getWeappData();
  71. $this->assign('baidushoulu', $baidushoulu);
  72. return $this->fetch('index');
  73. }
  74. /**
  75. * 插件后台管理 - 编辑
  76. */
  77. public function save()
  78. {
  79. if (IS_POST) {
  80. $data = I('post.');
  81. if (!empty($data['code'])) {
  82. $saveData = array(
  83. 'data' => serialize($data),
  84. 'tag_weapp' => $data['tag_weapp'],
  85. 'update_time' => getTime(),
  86. );
  87. $r = Db::name('weapp')->where(array('code' => $data['code']))->update($saveData);
  88. if ($r) {
  89. adminLog('编辑' . $this->weappInfo['name'] . '成功'); // 写入操作日志
  90. $this->success("操作成功!", weapp_url('Baidushoulu/Baidushoulu/index'));
  91. }
  92. }
  93. }
  94. $this->error("操作失败");
  95. }
  96. }