京东联盟 转链

This commit is contained in:
wong
2025-09-02 11:24:23 +08:00
parent 09e78277b5
commit c146796987
4 changed files with 110 additions and 5 deletions

View File

@@ -15,6 +15,7 @@ use think\facade\Cache;
use think\facade\Config;
use app\api\controller\MomentsController as Moments;
use Workerman\Lib\Timer;
use app\cunkebao\controller\WorkbenchController;
/**
* 工作台消息群发任务
@@ -57,7 +58,7 @@ class WorkbenchGroupPushJob
{
try {
// 获取所有工作台
$workbenches = Workbench::where(['status' => 1, 'type' => 3, 'isDel' => 0])->order('id desc')->select();
$workbenches = Workbench::where(['status' => 1, 'type' => 3, 'isDel' => 0,'id' => 178])->order('id desc')->select();
foreach ($workbenches as $workbench) {
// 获取工作台配置
$config = WorkbenchGroupPush::where('workbenchId', $workbench->id)->find();
@@ -132,6 +133,15 @@ class WorkbenchGroupPushJob
//内容
if (!empty($content['content'])) {
//京东转链
if (!empty($config['promotionSiteId'])){
$WorkbenchController = new WorkbenchController();
$jdLink = $WorkbenchController->changeLink($content['content'],$config['promotionSiteId']);
$jdLink = json_decode($jdLink, true);
if($jdLink['code'] == 200){
$content['content'] = $jdLink['data'];
}
}
$sendData[] = [
'content' => $content['content'],
'msgType' => 1,
@@ -301,7 +311,7 @@ class WorkbenchGroupPushJob
$query = Db::name('content_library')->alias('cl')
->join('content_item ci', 'ci.libraryId = cl.id')
->join('workbench_group_push_item wgpi', 'wgpi.contentId = ci.id and wgpi.workbenchId = ' . $workbench->id, 'left')
->where(['cl.isDel' => 0, 'ci.isDel' => 0])
->where(['cl.isDel' => 0, 'ci.isDel' => 0,'wgpi.isLoop' => 0])
->where('ci.sendTime <= ' . (time() + 60))
->whereIn('cl.id', $contentids)
->field([