| 1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- <?php
- namespace bizMall\goods\classes;
- use common\components\util;
- use bizMall\base\classes\BaseClass;
- class GoodsSettingClass extends BaseClass
- {
- public static $baseFile = '\bizMall\goods\models\GoodsSetting';
- //获取商品涨价比例或金额 ssh 2020.5.20
- public static function getRise($mainId)
- {
- // $festRise = FestRiseClass::getAllByCondition(['mainId' => $mainId], null, 'festId', 'festId');
- // if (empty($festRise)) {
- // return [];
- // }
- // $festId = array_keys($festRise);
- // $fest = FestClass::getByIds($festId);
- // $today = date("Y-n-j");
- // $arr = [];
- // foreach ($fest as $single) {
- // $current = date("Y") . '-' . $single['month'] . '-' . $single['day'];
- // $past = date("Y-n-j", (strtotime($current) - 86400));
- // $arr = array_merge($arr, [$current, $past]);
- // }
- // if (in_array($today, $arr) == false) {
- // return [];
- // }
- $set = self::getByCondition(['mainId' => $mainId]);
- if (empty($set)) {
- util::fail('没有找到涨价需求');
- }
- if ($set['riseSwitch'] == 0) {
- return [];
- }
- $riseType = $set['riseType'];
- $riseAmount = $set['riseAmount'];
- return ['riseType' => $riseType, 'riseAmount' => $riseAmount];
- }
- }
|