| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- namespace app\jobs;
- use app\models\Option;
- use app\modules\admin\models\PlatformForm;
- use yii\base\BaseObject;
- use yii\queue\JobInterface;
- //云仓营销策略设置
- class SetProfitStrategyJob extends BaseObject implements JobInterface
- {
- public function execute($queue)
- {
- $platform_profit_strategy = Option::get('platform_profit_strategy', 0, 'store')['value'];
- $platform_profit_strategy = json_decode($platform_profit_strategy, true);
- if (!empty($platform_profit_strategy)) {
- //服务收费start
- if (intval($platform_profit_strategy['service_charge_model'])) {
- //平台溢价
- $service_charge_rate = $platform_profit_strategy['service_charge_rate'];
- } else {
- //供货商抽成
- $service_charge_rate = 0;
- }
- $form = new PlatformForm();
- $result = $form->setPlatformNegotiatedPrice($service_charge_rate);
- debug_log($result, 'set_platform_negotiated_price.log');
- //服务收费end
- //风控规则start
- if (intval($platform_profit_strategy['is_risk_control'])) {
- $id = \Yii::$app->cache->get('risk_control_model_id');
- if ($id && !\Yii::$app->queue->isDone($id)) {
- \Yii::$app->queue->remove($id);
- }
- $id = \queue_push(new \app\jobs\RiskControlModelJob());
- \Yii::$app->cache->set('risk_control_model_id', $id);
- }
- //风控规则end
- //加价保护start
- // if (intval($platform_profit_strategy['is_markup_protection'])) {
- //如果开启 就在保存商品时判断 不使用消息队列判断
- // }
- //加价保护end
- }
- }
- }
|