| | |
| | | |
| | | namespace app\api\service\order\paysuccess\source; |
| | | |
| | | use app\api\model\plus\bonus\Apply as BonusApplyModel; |
| | | use app\api\model\plus\bonus\Order as BonusOrderModel; |
| | | use app\api\model\plus\vip\Apply as VipApplyModel; |
| | | use app\common\enum\settings\DeliveryTypeEnum; |
| | | use app\common\library\helper; |
| | | use app\api\model\plus\agent\Apply as AgentApplyModel; |
| | | use app\api\model\plus\operations\Apply as OperationsApplyModel; |
| | | use app\common\service\order\OrderCompleteService; |
| | | use app\common\enum\order\OrderTypeEnum; |
| | | |
| | |
| | | $this->becomeAgentUser($order); |
| | | // 消费达到金额成为分销商 |
| | | $this->becomeAgentByOrder($order); |
| | | // 购买指定商品成为分红用户 |
| | | $this->becomeBonusUser($order); |
| | | // 购买指定商品成为VIP用户 |
| | | $this->becomeVipUser($order); |
| | | // 购买指定商品成为运营中心 |
| | | $this->becomeOperationsUser($order); |
| | | // 分红订单 by lyzflash 2023.03.17 复购分红商品也产生奖励 |
| | | BonusOrderModel::createBonusOrder($order); |
| | | // 如果是虚拟商品,则标记为已完成,无需发货 |
| | | if($order['delivery_type']['value'] == DeliveryTypeEnum::NO_EXPRESS && $order['virtual_auto'] == 1){ |
| | | $order->save([ |
| | |
| | | $model = new AgentApplyModel; |
| | | return $model->becomeAgentByOrder($order['user_id'], $order['pay_price'], $order['app_id']); |
| | | } |
| | | /** |
| | | * 购买指定商品成为分红用户 |
| | | */ |
| | | private function becomeBonusUser($order) |
| | | { |
| | | // 整理商品id集 |
| | | $productIds = helper::getArrayColumn($order['product'], 'product_id'); |
| | | $model = new BonusApplyModel; |
| | | return $model->becomeBonusUser($order['user_id'], $productIds, $order['app_id'], $order); |
| | | } |
| | | |
| | | /** |
| | | * 购买指定商品成为VIP用户 |
| | | */ |
| | | private function becomeVipUser($order) |
| | | { |
| | | // 整理商品id集 |
| | | $productIds = helper::getArrayColumn($order['product'], 'product_id'); |
| | | $model = new VipApplyModel; |
| | | return $model->becomeVipUser($order['user_id'], $productIds, $order['app_id'], $order); |
| | | } |
| | | |
| | | /** |
| | | * 购买指定商品生成运营中心入驻申请 |
| | | */ |
| | | private function becomeOperationsUser($order) |
| | | { |
| | | // 整理商品id集 |
| | | $productIds = helper::getArrayColumn($order['product'], 'product_id'); |
| | | $model = new OperationsApplyModel; |
| | | return $model->becomeOperationsUser($order['user_id'], $productIds, $order['app_id']); |
| | | } |
| | | |
| | | } |