DistAdminDistributor.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. <?php
  2. namespace App\Distributor\Repositories;
  3. use App\Models\DistAdminDistributor as Model;
  4. use Dcat\Admin\Repositories\EloquentRepository;
  5. class DistAdminDistributor extends EloquentRepository
  6. {
  7. /**
  8. * Model.
  9. *
  10. * @var string
  11. */
  12. protected $eloquentClass = Model::class;
  13. /*
  14. * 得到分销商信息
  15. */
  16. public static function getInfo()
  17. {
  18. $id = getDistributorId();
  19. $row = Model::find($id);
  20. return $row;
  21. }
  22. /*
  23. * 修改域名名称
  24. */
  25. public static function updateDomain($domainType,$customDomain)
  26. {
  27. $id = getDistributorId();
  28. $row = Model::find($id);
  29. $row->domain_type = $domainType;
  30. if ($domainType == 1) {
  31. $row->custom_domain = $customDomain;
  32. }
  33. $row->save();
  34. }
  35. public static function updateInfo($info)
  36. {
  37. $id = getDistributorId();
  38. $row = Model::find($id);
  39. $row->logo = $info['logo'];
  40. $row->site_name = $info['site_name'];
  41. $row->company_name = $info['company_name'];
  42. $row->company_address = $info['company_address'];
  43. $row->contact_number = $info['contact_number'];
  44. $row->service_hotline = $info['service_hotline'];
  45. $row->whats_app = $info['whats_app'];
  46. $row->facebook = $info['facebook'];
  47. $row->instagram = $info['instagram'];
  48. $row->youtube = $info['youtube'];
  49. $row->linkedin = $info['linkedin'];
  50. $row->tiktok = $info['tiktok'];
  51. $row->seo_title = $info['seo_title'];//seo_title
  52. $row->seo_keywords = $info['seo_keywords'];//seo_keywords
  53. $row->seo_description = $info['seo_description'];//seo_description
  54. $row->save();
  55. }
  56. /*
  57. * 分销商切换主题
  58. */
  59. public static function enableTheme($appearanceId)
  60. {
  61. $appearanceId = intval($appearanceId);
  62. $distId = getDistributorId();
  63. $distAppearance = new DistAppearance();
  64. $appearanceRow = $distAppearance->model()->find($appearanceId);
  65. if ($appearanceRow && $appearanceRow->enabled == 1) {
  66. //修改分销商主题
  67. $row = Model::find($distId);
  68. $row->appearance_id = $appearanceId;
  69. $row->save();
  70. //切换主题
  71. DistAppearance::switchTheme($appearanceId, $distId);
  72. return true;
  73. }
  74. return false;
  75. }
  76. }