12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 |
- <?php
- // +----------------------------------------------------------------------
- // | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ]
- // +----------------------------------------------------------------------
- // | Copyright (c) 2017~2021 https://www.yiovo.com All rights reserved.
- // +----------------------------------------------------------------------
- // | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行
- // +----------------------------------------------------------------------
- // | Author: 萤火科技 <admin@yiovo.com>
- // +----------------------------------------------------------------------
- declare (strict_types=1);
- namespace app\common\model\enterprise;
- use app\common\model\BaseModel;
- /**
- * 商家后台菜单模型
- * Class Menu
- * @package app\common\model\admin
- */
- class EnterpriseSite extends BaseModel
- {
- // 定义表名
- protected $name = 'enterprise_site';
- // 定义表主键
- protected $pk = 'id';
- protected $CTYPE = ['HONORS'=>1,'COOPERATE'=>2,'HOME_SEO'=>3,'PRODUCT_SEO'=>4,'CONTACT_SEO'=>5];
- public function getContentsAttr($data){
- return htmlspecialchars_decode($data);
- }
- /**
- * 获取官网配置
- * @param $ctype
- * @return \app\enterprise\model\EnterpriseSite|array|\think\Model|null
- * @throws \think\db\exception\DataNotFoundException
- * @throws \think\db\exception\DbException
- * @throws \think\db\exception\ModelNotFoundException
- */
- public function getSetting($ctype){
- return $this->where('ctype',$ctype)->field('id,title,keywords,desc,contents,ctype')->find();
- }
- public function getSettingBacth(){
- return $this->where('ctype','>',2)->field('id,title,keywords,desc,contents,ctype')
- ->select()->each(function (&$item){
- if ($item['ctype'] == 3){
- $item['i'] = 1;
- $item['t'] = '首页SEO';
- }
- if ($item['ctype'] == 4){
- $item['i'] = 2;
- $item['t'] = '产品介绍SEO';
- }
- if ($item['ctype'] == 5){
- $item['i'] = 3;
- $item['t'] = '联系我们SEO';
- }
- });
- }
- }
|