GoodsSettingClass.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. namespace bizMall\goods\classes;
  3. use bizMall\saas\classes\FestClass;
  4. use bizMall\saas\classes\FestRiseClass;
  5. use common\components\util;
  6. use bizMall\base\classes\BaseClass;
  7. class GoodsSettingClass extends BaseClass
  8. {
  9. public static $baseFile = '\bizMall\goods\models\GoodsSetting';
  10. //获取商品涨价比例或金额 ssh 2020.5.20
  11. public static function getRise($mainId)
  12. {
  13. // $festRise = FestRiseClass::getAllByCondition(['mainId' => $mainId], null, 'festId', 'festId');
  14. // if (empty($festRise)) {
  15. // return [];
  16. // }
  17. // $festId = array_keys($festRise);
  18. // $fest = FestClass::getByIds($festId);
  19. // $today = date("Y-n-j");
  20. // $arr = [];
  21. // foreach ($fest as $single) {
  22. // $current = date("Y") . '-' . $single['month'] . '-' . $single['day'];
  23. // $past = date("Y-n-j", (strtotime($current) - 86400));
  24. // $arr = array_merge($arr, [$current, $past]);
  25. // }
  26. // if (in_array($today, $arr) == false) {
  27. // return [];
  28. // }
  29. $set = self::getByCondition(['mainId' => $mainId]);
  30. if (empty($set)) {
  31. util::fail('没有找到涨价需求');
  32. }
  33. if ($set['riseSwitch'] == 0) {
  34. return [];
  35. }
  36. $riseType = $set['riseType'];
  37. $riseAmount = $set['riseAmount'];
  38. return ['riseType' => $riseType, 'riseAmount' => $riseAmount];
  39. }
  40. }