Initial commit: queue workspace
Made-with: Cursor
This commit is contained in:
64
pro_v3.5.1/app/jobs/activity/AutoUpdateLiveJob.php
Normal file
64
pro_v3.5.1/app/jobs/activity/AutoUpdateLiveJob.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
namespace app\jobs\activity;
|
||||
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
use think\facade\Log;
|
||||
use app\services\activity\live\LiveGoodsServices;
|
||||
use app\services\activity\live\LiveRoomServices;
|
||||
|
||||
/**
|
||||
* 自动更新直播间状态和直播间产品状态
|
||||
* Class AutoUpdateLiveJob
|
||||
* @package app\jobs\live
|
||||
*/
|
||||
class AutoUpdateLiveJob extends BaseJobs
|
||||
{
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected static function queueName()
|
||||
{
|
||||
return 'CRMEB_PRO_TASK';
|
||||
}
|
||||
|
||||
public function doJob()
|
||||
{
|
||||
//更新直播商品状态
|
||||
try {
|
||||
/** @var LiveGoodsServices $liveGoods */
|
||||
$liveGoods = app()->make(LiveGoodsServices::class);
|
||||
$liveGoods->syncGoodStatus();
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '更新直播商品状态失败,失败原因:[' . class_basename($this) . ']' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
//更新直播间状态
|
||||
try {
|
||||
/** @var LiveRoomServices $liveRoom */
|
||||
$liveRoom = app()->make(LiveRoomServices::class);
|
||||
$liveRoom->syncRoomStatus();
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '更新直播间状态失败,失败原因:[' . class_basename($this) . ']' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
74
pro_v3.5.1/app/jobs/activity/HolidayGiftJob.php
Normal file
74
pro_v3.5.1/app/jobs/activity/HolidayGiftJob.php
Normal file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity;
|
||||
|
||||
use app\services\activity\holiday\HolidayGiftPushServices;
|
||||
use app\services\activity\holiday\HolidayGiftRecordServices;
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 节日有礼用户权益处理队列
|
||||
* Class HolidayGiftJob
|
||||
* @package app\jobs\activity
|
||||
*/
|
||||
class HolidayGiftJob extends BaseJobs
|
||||
{
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* 处理单个用户的节日有礼权益
|
||||
* @param int $uid 用户ID
|
||||
* @param array $giftInfo 活动信息
|
||||
* @return bool
|
||||
*/
|
||||
public function doJob(int $uid, array $giftInfo)
|
||||
{
|
||||
try {
|
||||
/** @var HolidayGiftPushServices $holidayGiftPushServices */
|
||||
$holidayGiftPushServices = app()->make(HolidayGiftPushServices::class);
|
||||
$holidayGiftRecordServices = app()->make(HolidayGiftRecordServices::class);
|
||||
|
||||
//检查是否需要提前推送或当天推送
|
||||
if (!$holidayGiftPushServices->checkAdvancePush($giftInfo, true, $uid)) {
|
||||
return true;
|
||||
}
|
||||
// 检查用户是否符合活动条件
|
||||
if (!$holidayGiftPushServices->checkUserCondition($uid, $giftInfo)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 检查是否可以推送(频次限制)
|
||||
if ($holidayGiftRecordServices->checkUserCanPush($uid, $giftInfo['id'])) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// 执行赠送权益
|
||||
$grantResults = $holidayGiftPushServices->grantUserBenefits($uid, $giftInfo);
|
||||
|
||||
// 记录推送记录(无论成功失败都要记录)
|
||||
$holidayGiftPushServices->recordPushLog($uid, $giftInfo);
|
||||
|
||||
if ($grantResults) {
|
||||
Log::info("用户{$uid}节日有礼处理成功,活动ID:{$giftInfo['id']}");
|
||||
} else {
|
||||
Log::warning("用户{$uid}节日有礼权益赠送失败,活动ID:{$giftInfo['id']},详情:" . json_encode($grantResults['details']));
|
||||
}
|
||||
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Log::error("用户{$uid}节日有礼处理失败: " . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
61
pro_v3.5.1/app/jobs/activity/LuckLotteryJob.php
Normal file
61
pro_v3.5.1/app/jobs/activity/LuckLotteryJob.php
Normal file
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity;
|
||||
|
||||
|
||||
use app\services\activity\lottery\LuckLotteryRecordServices;
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
use think\facade\Log;
|
||||
|
||||
/**
|
||||
* 营销:抽奖活动
|
||||
* Class LuckLotteryJob
|
||||
* @package app\jobs\activity
|
||||
*/
|
||||
class LuckLotteryJob extends BaseJobs
|
||||
{
|
||||
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* @param $oid
|
||||
* @param $orderInfo
|
||||
* @return bool|void
|
||||
*/
|
||||
public function updateLotteryRecord($oid, $orderInfo)
|
||||
{
|
||||
if (!$oid) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
/** @var LuckLotteryRecordServices $lotteryRecordServices */
|
||||
$lotteryRecordServices = app()->make(LuckLotteryRecordServices::class);
|
||||
$data['oid'] = $orderInfo['id'];
|
||||
$data['is_receive'] = 1;
|
||||
$data['receive_time'] = time();
|
||||
$receive_info['name'] = $orderInfo['real_name'];
|
||||
$receive_info['phone'] = $orderInfo['user_phone'];
|
||||
if ($orderInfo['shipping_type'] == 2) {
|
||||
$receive_info['address'] = '';
|
||||
} else {
|
||||
$receive_info['address'] = $orderInfo['user_address'];
|
||||
}
|
||||
$data['receive_info'] = $receive_info;
|
||||
$lotteryRecordServices->update($orderInfo['activity_id'], $data, 'id');
|
||||
} catch (\Throwable $e) {
|
||||
Log::error('抽奖订单处理中奖记录失败,失败原因:' . $e->getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
72
pro_v3.5.1/app/jobs/activity/StoreBargainJob.php
Normal file
72
pro_v3.5.1/app/jobs/activity/StoreBargainJob.php
Normal file
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity;
|
||||
|
||||
|
||||
use app\services\activity\bargain\StoreBargainServices;
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
|
||||
/**
|
||||
* 营销:砍价
|
||||
* Class StoreBargainJob
|
||||
* @package app\jobs\activity
|
||||
*/
|
||||
class StoreBargainJob extends BaseJobs
|
||||
{
|
||||
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* 增加砍价统计(查看、分享)
|
||||
* @param $bargainId
|
||||
* @param string $field
|
||||
* @return bool
|
||||
*/
|
||||
public function setBargainCount($bargainId, string $field = 'look')
|
||||
{
|
||||
try {
|
||||
/** @var StoreBargainServices $bargainServices */
|
||||
$bargainServices = app()->make(StoreBargainServices::class);
|
||||
$bargainServices->addBargain((int)$bargainId, $field);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '增加砍价统计(查看、分享)失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 下单成功修改砍价状态
|
||||
* @param int $uid
|
||||
* @param int $bargainId
|
||||
* @return bool
|
||||
*/
|
||||
public function setBargainUserStatus(int $uid, int $bargainId)
|
||||
{
|
||||
try {
|
||||
/** @var StoreBargainServices $bargainServices */
|
||||
$bargainServices = app()->make(StoreBargainServices::class);
|
||||
$bargainServices->setBargainUserStatus($bargainId, $uid);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '下单成功修改砍价状态失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
92
pro_v3.5.1/app/jobs/activity/StoreCouponJob.php
Normal file
92
pro_v3.5.1/app/jobs/activity/StoreCouponJob.php
Normal file
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity;
|
||||
|
||||
|
||||
use app\services\activity\coupon\StoreCouponIssueServices;
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
|
||||
/**
|
||||
* 营销:优惠券
|
||||
* Class StoreCouponJob
|
||||
* @package app\jobs\user
|
||||
*/
|
||||
class StoreCouponJob extends BaseJobs
|
||||
{
|
||||
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* 新人礼赠送优惠券
|
||||
* @param $uid
|
||||
* @return bool
|
||||
*/
|
||||
public function newcomerGiveCoupon($uid)
|
||||
{
|
||||
try {
|
||||
/**@var StoreCouponIssueServices $storeCoupon */
|
||||
$storeCoupon = app()->make(StoreCouponIssueServices::class);
|
||||
$storeCoupon->newcomerGiveCoupon((int)$uid);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '赠送新人礼优惠券失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 会员卡激活赠送优惠券
|
||||
* @param $uid
|
||||
* @return bool
|
||||
*/
|
||||
public function levelGiveCoupon($uid)
|
||||
{
|
||||
try {
|
||||
/**@var StoreCouponIssueServices $storeCoupon */
|
||||
$storeCoupon = app()->make(StoreCouponIssueServices::class);
|
||||
$storeCoupon->levelGiveCoupon((int)$uid);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '会员卡激活赠送优惠券,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 增加新人券
|
||||
* @param $uid
|
||||
* @return bool
|
||||
*/
|
||||
public function newUserGiveCoupon($uid)
|
||||
{
|
||||
try {
|
||||
/**@var StoreCouponIssueServices $storeCoupon */
|
||||
$storeCoupon = app()->make(StoreCouponIssueServices::class);
|
||||
$storeCoupon->userFirstSubGiveCoupon((int)$uid);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '赠送新人券失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
189
pro_v3.5.1/app/jobs/activity/StorePromotionsJob.php
Normal file
189
pro_v3.5.1/app/jobs/activity/StorePromotionsJob.php
Normal file
@@ -0,0 +1,189 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity;
|
||||
|
||||
use app\services\user\UserServices;
|
||||
use app\services\user\UserBillServices;
|
||||
use app\services\user\label\UserLabelRelationServices;
|
||||
use app\services\activity\coupon\StoreCouponIssueServices;
|
||||
use app\services\activity\promotions\StorePromotionsAuxiliaryServices;
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
|
||||
/**
|
||||
* 营销:优惠活动
|
||||
* Class StorePromotionsJob
|
||||
* @package app\jobs\activity
|
||||
*/
|
||||
class StorePromotionsJob extends BaseJobs
|
||||
{
|
||||
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* 赠送
|
||||
* @param $orderInfo
|
||||
* @return bool
|
||||
*/
|
||||
public function give($orderInfo)
|
||||
{
|
||||
$uid = (int)$orderInfo['uid'];
|
||||
$promotions_give = [];
|
||||
if (isset($orderInfo['promotions_give']) && $orderInfo['promotions_give']) {
|
||||
$promotions_give = is_string($orderInfo['promotions_give']) ? json_decode($promotions_give, true) : $orderInfo['promotions_give'];
|
||||
}
|
||||
$give_integral = $promotions_give['give_integral'] ?? 0;
|
||||
if ($give_integral) {
|
||||
try {
|
||||
/** @var UserServices $userServices */
|
||||
$userServices = app()->make(UserServices::class);
|
||||
$userInfo = $userServices->getUserInfo($uid);
|
||||
/** @var UserBillServices $userBillServices */
|
||||
$userBillServices = app()->make(UserBillServices::class);
|
||||
$balance = bcadd((string)$userInfo['integral'], (string)$give_integral, 0);
|
||||
$userServices->update(['uid' => $userInfo['uid']], ['integral' => $balance]);
|
||||
$userBillServices->income('order_promotions_give_integral', $uid, (int)$give_integral, (int)$balance, $orderInfo['id']);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '优惠活动下单赠送积分失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
$give_coupon = $promotions_give['give_coupon'] ?? [];
|
||||
$this->giveCoupon($uid, $give_coupon);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 赠送优惠券
|
||||
* @param int $uid
|
||||
* @param array $give_coupon
|
||||
* @return bool
|
||||
*/
|
||||
public function giveCoupon(int $uid, array $give_coupon)
|
||||
{
|
||||
if ($give_coupon) {
|
||||
try {
|
||||
/** @var StoreCouponIssueServices $storeCoupon */
|
||||
$storeCoupon = app()->make(StoreCouponIssueServices::class);
|
||||
$storeCoupon->orderPayGiveCoupon($uid, $give_coupon);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '优惠活动下单赠送优惠券失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 扣除优惠活动赠品限量
|
||||
* @param array $promotions_give
|
||||
* @param bool $isDec
|
||||
* @rerunt bool
|
||||
*/
|
||||
public function changeGiveLimit(array $promotions_give, bool $isDec = true)
|
||||
{
|
||||
if ($promotions_give){
|
||||
try {
|
||||
$promotionsArr = $promotions_give['promotions'] ?? [];
|
||||
if ($promotionsArr) {
|
||||
/** @var StorePromotionsAuxiliaryServices $storePromotionsAuxiliaryServices */
|
||||
$storePromotionsAuxiliaryServices = app()->make(StorePromotionsAuxiliaryServices::class);
|
||||
$giveCoupon = $promotions_give['give_coupon'] ?? [];
|
||||
$getPromotionsId = function($id, $key) use ($promotionsArr) {
|
||||
$pid = 0;
|
||||
foreach($promotionsArr as $promotions) {
|
||||
$k = $key == 'coupon_id' ? 'giveCoupon' : 'giveProducts';
|
||||
$arr = $promotions[$k] ?? [];
|
||||
$ids = [];
|
||||
if ($arr) $ids = array_column($arr, $key);
|
||||
if ($ids && in_array($id, $ids)) $pid = $promotions['id'] ?? $promotionsArr['id'] ?? 0;
|
||||
}
|
||||
return $pid;
|
||||
};
|
||||
if ($giveCoupon) {
|
||||
foreach ($giveCoupon as $coupon_id) {
|
||||
$promotions_id = $getPromotionsId($coupon_id, 'coupon_id');
|
||||
if ($promotions_id) $storePromotionsAuxiliaryServices->updateLimit([$promotions_id], 2, (int)$coupon_id, $isDec);
|
||||
}
|
||||
}
|
||||
$giveProduct = $promotions_give['give_product'] ?? [];
|
||||
if ($giveProduct) {
|
||||
foreach ($giveProduct as $give) {
|
||||
$promotions_id = (int)$give['promotions_id'] ?? 0;
|
||||
$product_id = (int)$give['product_id'] ?? 0;
|
||||
$unique = $give['unique'] ?? '';
|
||||
$cart_num = (int)$give['cart_num'] ?? 1;
|
||||
if ($promotions_id && $product_id && $unique) $storePromotionsAuxiliaryServices->updateLimit([$promotions_id], 3, (int)$product_id, $isDec, $unique, $cart_num);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '订单创建优惠活动赠品限量扣除失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设置用户购买的标签
|
||||
* @param $orderInfo
|
||||
*/
|
||||
public function setUserLabel($orderInfo)
|
||||
{
|
||||
try {
|
||||
$promotions_give = [];
|
||||
if (isset($orderInfo['promotions_give']) && $orderInfo['promotions_give']) {
|
||||
$promotions_give = is_string($orderInfo['promotions_give']) ? json_decode($promotions_give, true) : $orderInfo['promotions_give'];
|
||||
}
|
||||
$promotions = $promotions_give['promotions'] ?? [];
|
||||
if (!$promotions) {
|
||||
return true;
|
||||
}
|
||||
$labelIds = [];
|
||||
foreach ($promotions as $key => $value) {
|
||||
$label_id = is_string($value['label_id']) ? explode(',', $value['label_id']) : $value['label_id'];
|
||||
$labelIds = array_merge($labelIds, $label_id);
|
||||
}
|
||||
if (!$labelIds) {
|
||||
return true;
|
||||
}
|
||||
$labelIds = array_unique($labelIds);
|
||||
$store_id = $orderInfo['store_id'] ?? 0;
|
||||
$type = $store_id ? 1 : 0;
|
||||
/** @var UserLabelRelationServices $labelServices */
|
||||
$labelServices = app()->make(UserLabelRelationServices::class);
|
||||
$labelServices->setUserLable([$orderInfo['uid']], $labelIds, $type, $store_id);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '用户标签添加失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
53
pro_v3.5.1/app/jobs/activity/VideoJob.php
Normal file
53
pro_v3.5.1/app/jobs/activity/VideoJob.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity;
|
||||
|
||||
use app\services\activity\video\VideoServices;use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
|
||||
/**
|
||||
* 营销:短视频
|
||||
* Class VideoJob
|
||||
* @package app\jobs\activity
|
||||
*/
|
||||
class VideoJob extends BaseJobs
|
||||
{
|
||||
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* 增加短视频浏览播放量
|
||||
* @param array $ids
|
||||
* @param int $num
|
||||
* @return bool
|
||||
*/
|
||||
public function setVideoPlayNum(array $ids, int $uid = 0, int $num = 1)
|
||||
{
|
||||
if (!$ids) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
/** @var VideoServices $videoServices */
|
||||
$videoServices = app()->make(VideoServices::class);
|
||||
foreach ($ids as $id) {
|
||||
$videoServices->userRelationVideo($uid, (int)$id, 'play', $num);
|
||||
}
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '增加短视频浏览播放量失败,失败原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
71
pro_v3.5.1/app/jobs/activity/card/CardJob.php
Normal file
71
pro_v3.5.1/app/jobs/activity/card/CardJob.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity\card;
|
||||
|
||||
|
||||
use app\services\activity\card\CardBatchServices;
|
||||
use app\services\activity\card\CardCodeServices;
|
||||
use app\services\activity\card\CardGiftServices;
|
||||
use app\services\activity\coupon\StoreCouponIssueServices;
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
|
||||
/**
|
||||
* 营销:礼品卡
|
||||
* Class CardJob
|
||||
* @package app\jobs\user
|
||||
*/
|
||||
class CardJob extends BaseJobs
|
||||
{
|
||||
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* 卡密分配数量矫正
|
||||
* @param $id
|
||||
* @return bool
|
||||
*/
|
||||
public function allocationCode($id)
|
||||
{
|
||||
try {
|
||||
app()->make(CardBatchServices::class)->allocationCode($id);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '卡密分配数量统计失败:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验使用数量
|
||||
* @param $id
|
||||
* @return true
|
||||
* User: liusl
|
||||
* DateTime: 2025/5/24 10:57
|
||||
*/
|
||||
public function allocationCardGift($id)
|
||||
{
|
||||
try {
|
||||
app()->make(CardGiftServices::class)->allocationCardGift($id);
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '卡密分配数量统计失败:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
52
pro_v3.5.1/app/jobs/activity/pink/AuthPinkFail.php
Normal file
52
pro_v3.5.1/app/jobs/activity/pink/AuthPinkFail.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity\pink;
|
||||
|
||||
|
||||
use app\services\activity\combination\StorePinkServices;
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
use think\db\exception\DataNotFoundException;
|
||||
use think\db\exception\ModelNotFoundException;
|
||||
|
||||
/**
|
||||
* 分页处理拼团
|
||||
* Class AuthPinkFail
|
||||
* @package app\jobs\pink
|
||||
*/
|
||||
class AuthPinkFail extends BaseJobs
|
||||
{
|
||||
use QueueTrait;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
protected static function queueName()
|
||||
{
|
||||
return 'CRMEB_PRO_TASK';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $page
|
||||
* @param $limit
|
||||
* @return bool
|
||||
* @throws DataNotFoundException
|
||||
* @throws ModelNotFoundException
|
||||
*/
|
||||
public function doJob($page, $limit)
|
||||
{
|
||||
/** @var StorePinkServices $service */
|
||||
$service = app()->make(StorePinkServices::class);
|
||||
return $service->statusPink((int)$page, (int)$limit);
|
||||
}
|
||||
|
||||
}
|
||||
81
pro_v3.5.1/app/jobs/activity/pink/PinkJob.php
Normal file
81
pro_v3.5.1/app/jobs/activity/pink/PinkJob.php
Normal file
@@ -0,0 +1,81 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2016~2026 https://www.crmeb.com All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: CRMEB Team <admin@crmeb.com>
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\jobs\activity\pink;
|
||||
|
||||
|
||||
use app\services\activity\combination\StorePinkServices;
|
||||
use app\services\order\StoreOrderRefundServices;
|
||||
use app\services\order\StoreOrderServices;
|
||||
use crmeb\basic\BaseJobs;
|
||||
use crmeb\traits\QueueTrait;
|
||||
|
||||
/**
|
||||
* 拼团失败
|
||||
* Class PinkJob
|
||||
* @package app\jobs
|
||||
*/
|
||||
class PinkJob extends BaseJobs
|
||||
{
|
||||
use QueueTrait;
|
||||
|
||||
public function doJob($pinkId)
|
||||
{
|
||||
try {
|
||||
/** @var StorePinkServices $pinkService */
|
||||
$pinkService = app()->make(StorePinkServices::class);
|
||||
$info = $pinkService->get((int)$pinkId);
|
||||
if (!$info) {
|
||||
return true;
|
||||
}
|
||||
//已经成功 || 失败处理
|
||||
if (in_array($info['status'], [2, 3])) {
|
||||
return true;
|
||||
}
|
||||
[$pinkAll, $pinkT, $count, $idAll, $uidAll] = $pinkService->getPinkMemberAndPinkK($info);
|
||||
$pinkService->pinkFail($pinkAll, $pinkT, 0);
|
||||
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '拼团超时处理失败,原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建拼团
|
||||
* @param $orderInfo
|
||||
* @return bool
|
||||
*/
|
||||
public function createPink($orderInfo)
|
||||
{
|
||||
if (!$orderInfo) {
|
||||
return true;
|
||||
}
|
||||
try {
|
||||
/** @var StorePinkServices $pinkServices */
|
||||
$pinkServices = app()->make(StorePinkServices::class);
|
||||
/** @var StoreOrderServices $orderServices */
|
||||
$orderServices = app()->make(StoreOrderServices::class);
|
||||
$pinkServices->createPink($orderServices->tidyOrder($orderInfo, true));//创建拼团
|
||||
} catch (\Throwable $e) {
|
||||
response_log_write([
|
||||
'message' => '创建拼团失败失败,原因:' . $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine()
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user