12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- <?php
- namespace App\Distributor\Repositories;
- use App\Models\DistAdminDistributor as Model;
- use Dcat\Admin\Repositories\EloquentRepository;
- class DistAdminDistributor extends EloquentRepository
- {
- /**
- * Model.
- *
- * @var string
- */
- protected $eloquentClass = Model::class;
- /*
- * 得到分销商信息
- */
- public static function getInfo()
- {
- $id = getDistributorId();
- $row = Model::find($id);
- return $row;
- }
- /*
- * 修改域名名称
- */
- public static function updateDomain($domainType,$customDomain)
- {
- $id = getDistributorId();
- $row = Model::find($id);
- $row->domain_type = $domainType;
- if ($domainType == 1) {
- $row->custom_domain = $customDomain;
- }
- $row->save();
- }
- public static function updateInfo($info)
- {
- $id = getDistributorId();
- $row = Model::find($id);
- $row->logo = $info['logo'];
- $row->site_name = $info['site_name'];
- $row->company_name = $info['company_name'];
- $row->company_address = $info['company_address'];
- $row->contact_number = $info['contact_number'];
- $row->service_hotline = $info['service_hotline'];
- $row->whats_app = $info['whats_app'];
- $row->seo_title = $info['seo_title'];//seo_title
- $row->seo_keywords = $info['seo_keywords'];//seo_keywords
- $row->seo_description = $info['seo_description'];//seo_description
- $row->save();
- }
- /*
- * 分销商切换主题
- */
- public static function enableTheme($appearanceId)
- {
- $appearanceId = intval($appearanceId);
- $distId = getDistributorId();
- $distAppearance = new DistAppearance();
- $appearanceRow = $distAppearance->model()->find($appearanceId);
- if ($appearanceRow && $appearanceRow->enabled == 1) {
- //修改分销商主题
- $row = Model::find($distId);
- $row->appearance_id = $appearanceId;
- $row->save();
- //切换主题
- DistAppearance::switchTheme($appearanceId, $distId);
- return true;
- }
- return false;
- }
- }
|