123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- <?php
- /**
- * 易优CMS
- * ============================================================================
- * 版权所有 2016-2028 海南赞赞网络科技有限公司,并保留所有权利。
- * 网站地址: http://www.eyoucms.com
- * ----------------------------------------------------------------------------
- * 如果商业用途务必到官方购买正版授权, 以免引起不必要的法律纠纷.
- * ============================================================================
- * Author: 小虎哥 <1105415366@qq.com>
- * Date: 2018-06-28
- */
-
- namespace weapp\Baidushoulu\controller;
-
- use think\Db;
- use app\common\controller\Weapp;
- use weapp\Baidushoulu\model\BaidushouluModel;
-
- /**
- * 插件的控制器
- */
- class Baidushoulu extends Weapp
- {
- /**
- * 实例化模型
- */
- private $model;
-
- /**
- * 插件基本信息
- */
- private $weappInfo;
-
- /**
- * 构造方法
- */
- public function __construct(){
- parent::__construct();
- $this->model = new BaidushouluModel;
-
- /*插件基本信息*/
- $this->weappInfo = $this->getWeappInfo();
- $this->assign('weappInfo', $this->weappInfo);
- /*--end*/
- }
-
- /**
- * show
- */
- /**
- * 插件前台展示 - show钩子方法
- * @param mixed $params 传入的参数
- */
- public function show($params = null)
- {
- $seo_pseudo = tpCache('seo.seo_pseudo');
- if ($seo_pseudo == 1) {
- $seo = '&';
- }
- if ($seo_pseudo == 2) {
- $seo = '?';
- }
- if ($seo_pseudo == 3) {
- $seo = '?';
- }
- $this->assign('seo', $seo);
- $baidushoulu = $this->model->getWeappData();
- $this->assign('baidushoulu', $baidushoulu);
- echo $this->fetch('show');
- }
- /**
- * 插件配置
- */
- public function index()
- {
- $baidushoulu = $this->model->getWeappData();
- $this->assign('baidushoulu', $baidushoulu);
- return $this->fetch('index');
- }
-
- /**
- * 插件后台管理 - 编辑
- */
- public function save()
- {
- if (IS_POST) {
- $data = I('post.');
- if (!empty($data['code'])) {
- $saveData = array(
- 'data' => serialize($data),
- 'tag_weapp' => $data['tag_weapp'],
- 'update_time' => getTime(),
- );
- $r = Db::name('weapp')->where(array('code' => $data['code']))->update($saveData);
- if ($r) {
- adminLog('编辑' . $this->weappInfo['name'] . '成功'); // 写入操作日志
- $this->success("操作成功!", weapp_url('Baidushoulu/Baidushoulu/index'));
- }
- }
- }
- $this->error("操作失败");
- }
- }
|