DistAppearanceVariable.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <?php
  2. namespace App\Admin\Repositories;
  3. use App\Models\DistAppearanceVariable as Model;
  4. use Dcat\Admin\Form;
  5. use Dcat\Admin\Repositories\EloquentRepository;
  6. use App\Models\SiteAppearanceVariable;
  7. use Illuminate\Support\Carbon;
  8. class DistAppearanceVariable extends EloquentRepository
  9. {
  10. /**
  11. * Model.
  12. *
  13. * @var string
  14. */
  15. protected $eloquentClass = Model::class;
  16. public static function getVariableRow($distId,$appearanceId,$templateId)
  17. {
  18. $model = new Model();
  19. $variable = $model->where('dist_id',$distId)->where('appearance_id',$appearanceId)->whereIn('template_id',[0,$templateId])->get();
  20. if($variable){
  21. return $variable;
  22. }else{
  23. return '';
  24. }
  25. }
  26. /*
  27. * 把原始变量复制给分销商
  28. */
  29. public static function copyAppearanceVariable($appearanceId, $distId){
  30. Model::copyAppearanceVariable($appearanceId, $distId);
  31. }
  32. /*
  33. * 删除分销商主题变量
  34. */
  35. public static function deleteVariable($appearanceId,$distId)
  36. {
  37. return Model::deleteVariable($appearanceId, $distId);
  38. }
  39. /*
  40. * 同步变量到正式表
  41. */
  42. public static function syncAppearanceVariables($appearanceId,$distId) {
  43. $model = new Model();
  44. return $model->syncAppearanceVariables($appearanceId,$distId);
  45. }
  46. }