| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- <?php
- namespace addons\CloudStock\common\logic\reward;
- use addons\CloudStock\common\models\CloudStockAgent;
- use app\plugins\cloud_stock\helpers\BonusMessage;
- use app\plugins\cloud_stock\helpers\SmsConfig;
- use common\enums\AddonsEnum;
- use common\enums\UserWalletEnum;
- use Overtrue\EasySms\EasySms;
- class FillRewardLogic extends Reward
- {
- /**
- * 记录奖励
- */
- public function addRewardLog()
- {
- $this->getRewardUnitPrice();
- //奖励金额,不记录
- if (empty($this->reward_unit_price)) return 0;
- //扣库存数量为0;没有奖励
- if (empty($this->goods_num)) return 0;
- if($this->is_job) return $this->reward_unit_price;
- //投递到资产队列
- $insert_wallet = $this->getInsertWallet(UserWalletEnum::FILL);
- if ($insert_wallet) CloudStockAgent::sendUserWalletQueue($insert_wallet);
- return $this->reward_unit_price;
- }
- /**
- * 获取对应等级商品奖励金额单价
- */
- protected function getRewardUnitPrice()
- {
- $fill_level_list = json_decode($this->stock_goods['fill_level_list'], true);
- if (!empty($fill_level_list)) {
- foreach ($fill_level_list as $value) {
- if ($value['level'] == $this->bonus_agent['level']) {
- $this->reward_unit_price = !empty($value['price']) ? $value['price'] : 0;
- return;
- }
- }
- }
- $this->reward_unit_price = 0;
- }
- }
|