GoodsSettingClass.php 1.3 KB

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