120 lines
3.1 KiB
PHP
120 lines
3.1 KiB
PHP
<?php
|
|
|
|
/**
|
|
* @author Any
|
|
* @description KISS
|
|
* @date 2020-11-5
|
|
* @version 1.0.0
|
|
*
|
|
* _____LOG_____
|
|
*
|
|
*/
|
|
namespace app\modules\admin\models;
|
|
|
|
use app\models\Option;
|
|
use app\components\Utils;
|
|
|
|
class ThemeCustomiseForm extends AdminModel
|
|
{
|
|
//域名
|
|
public $siteDomain;
|
|
//域名
|
|
public $siteWapDomain;
|
|
//站点名称
|
|
public $siteName;
|
|
//站点简称
|
|
public $siteShortName;
|
|
//一句话介绍站点
|
|
public $siteBriefIntro;
|
|
//站点描述
|
|
public $siteDescription;
|
|
//站点关键词
|
|
public $siteKeywords;
|
|
//站点logo
|
|
public $siteLogo;
|
|
//站点mini logo 正方形
|
|
public $siteMiniLogo;
|
|
//favicon.ico
|
|
public $siteIco;
|
|
//站点ICP备案号
|
|
public $siteIcp;
|
|
//站点联系电话
|
|
public $siteTel;
|
|
//站点地址
|
|
public $siteAddress;
|
|
//站点联系邮箱
|
|
public $siteEmail;
|
|
//站点联系邮编
|
|
public $sitePostcode;
|
|
//公司介绍
|
|
public $siteCompanyIntro;
|
|
|
|
|
|
public $cx_mch_id;
|
|
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function rules()
|
|
{
|
|
return [
|
|
[['siteName','siteLogo','siteMiniLogo','siteIco','siteIcp','siteTel','siteAddress','siteEmail','sitePostcode','siteCompanyIntro'],'required'],
|
|
[['siteDomain','siteWapDomain','siteShortName','siteBriefIntro','siteDescription','siteKeywords','siteCompanyIntro'],'string'],
|
|
[['cx_mch_id'], 'integer'],
|
|
];
|
|
}
|
|
|
|
/**
|
|
* @inheritdoc
|
|
*/
|
|
public function attributeLabels()
|
|
{
|
|
return [
|
|
'domain' => '域名',
|
|
'siteName' => '站点名称',
|
|
'siteShortName' => '站点简称',
|
|
'siteDomain' => '站点域名',
|
|
'siteWapDomain' => '移动站点域名',
|
|
'siteBriefIntro' => '一句话介绍站点',
|
|
'siteDescription' => '站点描述',
|
|
'siteKeywords' => '站点关键词',
|
|
'siteLogo' => '站点LOGO',
|
|
'siteMiniLogo' => '站点正方形LOGO',
|
|
'siteIco' => '站点icon',
|
|
'siteIcp' => '站点ICP备案号',
|
|
'siteTel' => '站点联系电话',
|
|
'siteAddress' => '站点联系地址',
|
|
'siteEmail' => '站点联系邮箱',
|
|
'sitePostcode' => '站点联系邮编',
|
|
'siteCompanyIntro' => '公司介绍',
|
|
];
|
|
}
|
|
|
|
public function save()
|
|
{
|
|
if($this->validate()){
|
|
$attrs = $this->attributes;
|
|
foreach ($attrs as $key => $value){
|
|
if(empty($value))
|
|
continue;
|
|
$key = Utils::hump2underline($key);
|
|
$key = strtoupper($key);
|
|
$f = Option::setOption($key, $value, $this->cx_mch_id);
|
|
if(!$f){
|
|
return [
|
|
'code' => 1,
|
|
'msg' => $key . '保存失败'
|
|
];
|
|
}
|
|
}
|
|
return [
|
|
'code' => 0,
|
|
'msg' => '保存成功'
|
|
];
|
|
} else {
|
|
return $this->getModelError();
|
|
}
|
|
}
|
|
|
|
} |