diff --git a/app/common/dao/store/consumption/StoreConsumptionUserDao.php b/app/common/dao/store/consumption/StoreConsumptionUserDao.php index 60ed0518..e088f138 100755 --- a/app/common/dao/store/consumption/StoreConsumptionUserDao.php +++ b/app/common/dao/store/consumption/StoreConsumptionUserDao.php @@ -236,7 +236,7 @@ class StoreConsumptionUserDao extends BaseDao */ public function send($consumption, float $rate, int $userId, string $groupOrderIds, float $amount, $status = -2, $type = 1) { - $title = $type == StoreConsumptionUser::TYPE_TWO ? '现金抵扣补贴' : '无门槛实物通用补贴'; + $title = $type == StoreConsumptionUser::TYPE_TWO ? '春耕采购补贴' : '春耕采购余额'; $model = StoreConsumptionUser::where('uid', $userId)->where('type', StoreConsumptionUser::TYPE_TWO)->find(); $couponPrice = bcmul($amount, $rate, 2); if (!empty($model) && $model['type'] == $type) { @@ -271,7 +271,7 @@ class StoreConsumptionUserDao extends BaseDao } $userBillRepository->incBill($userId, 'red_pack', "red_pack_{$type}", [ 'link_id' => $model['coupon_user_id'], - 'status' => 1, + 'status' => $status == -1 ?: 1, 'title' => '获得' . $title, 'number' => $couponPrice, 'mark' => '获得' . $title . $couponPrice . ",订单金额:{$amount}", diff --git a/app/common/repositories/store/order/StoreOrderCreateRepository.php b/app/common/repositories/store/order/StoreOrderCreateRepository.php index 28710270..86fd4309 100755 --- a/app/common/repositories/store/order/StoreOrderCreateRepository.php +++ b/app/common/repositories/store/order/StoreOrderCreateRepository.php @@ -186,11 +186,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository $presellType = 0; $consumption_coupon_id = 0; $fn = []; - if (in_array($source, [0, 2, 103])) { - $enabledPlatformCoupon = true; - } else { - $enabledPlatformCoupon = false; - } + $enabledPlatformCoupon = true; $order_total_postage = 0; $platformCoupon = []; if ($isPlatformCard) { @@ -549,22 +545,19 @@ class StoreOrderCreateRepository extends StoreOrderRepository // if ($total_true_price > 0) { $StoreCouponUser = app()->make(StoreCouponUserRepository::class); $platformCoupon = $StoreCouponUser->validUserPlatformCoupon($uid); - $platformConsumption = []; //消费金 - if ($source == 103) { - $ConsumptionWhere = [ - 'uid' => $uid, - 'status' => 0, - 'is_fail' => 0 - ]; + $ConsumptionWhere = [ + 'uid' => $uid, + 'status' => 0, + 'is_fail' => 0 + ]; - $platformConsumption = Db::name('store_consumption_user')->where($ConsumptionWhere)->limit(100)->order('create_time', 'desc') - ->field('coupon_user_id,uid,coupon_title,coupon_price,balance,start_time,end_time') - ->select()->each(function ($item) { - $item['describe'] = '仅限平台指定商家商品可使用'; - return $item; - }); - } + $platformConsumption = Db::name('store_consumption_user')->where($ConsumptionWhere)->limit(100)->order('create_time', 'desc') + ->field('coupon_user_id,uid,coupon_title,coupon_price,balance,start_time,end_time') + ->select()->each(function ($item) { + $item['describe'] = '仅限平台指定商家商品可使用'; + return $item; + }); // } $usePlatformCouponId = 0; @@ -756,7 +749,7 @@ class StoreOrderCreateRepository extends StoreOrderRepository $order_model = $orderInfo['order_model']; $order_extend = $orderInfo['order_extend']; if ($pay_type == 'balance' && $orderInfo['source'] != 103 && $orderInfo['source'] != 105) { - throw new ValidateException('余额支付只能用于里海云仓'); +// throw new ValidateException('余额支付只能用于里海云仓'); } // 以下判断无意义,v2CartIdByOrderInfo 已经判断过收货地址或自提地址 // if (!$orderInfo['order_delivery_status']) { diff --git a/crmeb/listens/ActivateConsumptionListen.php b/crmeb/listens/ActivateConsumptionListen.php index 32bcc825..aa617db0 100644 --- a/crmeb/listens/ActivateConsumptionListen.php +++ b/crmeb/listens/ActivateConsumptionListen.php @@ -6,6 +6,7 @@ use app\common\model\store\consumption\StoreConsumption; use app\common\model\store\consumption\StoreConsumptionUser; use app\common\model\store\order\StoreOrder; use app\common\model\system\merchant\Merchant; +use app\common\model\user\UserBill; use crmeb\interfaces\ListenerInterface; use crmeb\services\TimerService; @@ -36,6 +37,7 @@ class ActivateConsumptionListen extends TimerService implements ListenerInterfac $item->start_time = date('Y-m-d H:i:s'); $item->end_time = date('Y-m-d H:i:s', strtotime('+1 year')); $item->save(); + UserBill::where('link_id', $item['coupon_user_id'])->where('type', 'red_pack_2')->update(['status', 1]); } } });