hasOne('ClosureCategory', 'id', 'cid'); } public function category2() { return $this->hasOne('IndustryCategory', 'id', 'yid'); } public function setContentAttr($value,$data) { $content = $data['content']; if (!empty($content)) { $content = HtmlSetImage($content); } return $content; } public function getContentAttr($value,$data) { $content = $data['content']; if (!empty($content)) { $content = HtmlGetImage($content); } return $content; } private function replaceContent($content) { // 替换空格 $content = preg_replace("/\s+/", "", $content); // var_dump(111, $content); str_replace("|", '|', $content); $arr = explode('|', $content); $arr = array_filter($arr); return implode('|', $arr); } private function replaceContent2($content) { // 替换空格 $content = preg_replace("/\s+/", "", $content); // str_replace("-", '-', $content); $arr = explode('-', $content); $arr = array_filter($arr); if (count($arr) > 3) { throw new \Exception('匹配词不能超过3个'); } if (count($arr) <= 0) { throw new \Exception('匹配词选项填写错误'); } return implode('-', $arr); } /* * 处理表达数据 */ public function postDataHandle($post=[]){ //处理操作总数 $post['a3'] = $post['a2'] ?? 0; $post['a3'] = intval($post['a3'] / 10); // var_dump(123, $post['b3']); $post['b3'] = $this->replaceContent($post['b3']); // var_dump(456, $post['b3']); // return true; $post['a7'] = $this->replaceContent($post['a7']); $post['e7'] = $this->replaceContent($post['e7']); $post['f10'] = $this->replaceContent($post['f10']); $post['f11'] = $this->replaceContent($post['f11']); $post['f12'] = $this->replaceContent($post['f12']); $post['f13'] = $this->replaceContent($post['f13']); $post['f14'] = $this->replaceContent($post['f14']); $post['f15'] = $this->replaceContent($post['f15']); $post['f17'] = $this->replaceContent($post['f17']); $post['f19'] = $this->replaceContent($post['f19']); $post['f20'] = $this->replaceContent($post['f20']); $post['f24'] = $this->replaceContent($post['f24']); $post['k6'] = $this->replaceContent($post['k6']); //处理b2 $str = []; foreach ($post['b2_1'] as $k => $v) { if(!empty($v)) { $v_str = $this->replaceContent2($v); $str[] = $v . '_' . $post['b2_2'][$k] . '-' . $post['b2_3'][$k] . '-' . $post['b2_4'][$k]; } } $str_l = ''; foreach ($str as $k => $v) { if(!empty($v)) { if ($k > 0) { $str_l .= '|' . $v; } else { $str_l .= $v; } } } $min_a = $post['b2_2'][0]; foreach ($post['b2_2'] as $k => $v) { if(!empty($v)) { if ($k > 0) { if ((int)$v < (int)$min_a) { $min_a = (int)$v; } } } } //笔记评论数处理 $str2 = []; foreach ($post['c1_1'] as $k => $v) { if(!empty($v)) { $str2[$v] = [ "start_num" => (int)$post['c1_2'][$k], "end_num" => (int)$post['c1_3'][$k] ]; } } //视频评论数处理 $str3 = []; foreach ($post['d1_1'] as $k => $v) { if(!empty($v)) { $str3[$v] = [ "start_num" => (int)$post['d1_2'][$k], "end_num" => (int)$post['d1_3'][$k] ]; } } //截流独立互动设置 $str4 = [ "每浏览几个点赞_data_num" => (int)$post['e3_1'][0], "每浏览几个点赞多少个_data_start" => (int)$post['e3_1'][1], "每浏览几个点赞多少个_data_end" => (int)$post['e3_1'][2], "每浏览几个收藏_data_num" => (int)$post['e3_2'][0], "每浏览几个收藏多少个_data_start" => (int)$post['e3_2'][1], "每浏览几个收藏多少个_data_end" => (int)$post['e3_2'][2], "每浏览几个评论_data_num" => (int)$post['e3_3'][0], "每浏览几个评论多少个_data_start" => (int)$post['e3_3'][1], "每浏览几个评论多少个_data_end" => (int)$post['e3_3'][2], "每浏览几个关注_data_num" => (int)$post['e3_4'][0], "每浏览几个关注多少个_data_start" => (int)$post['e3_4'][1], "每浏览几个关注多少个_data_end" => (int)$post['e3_4'][2], "每浏览几个访问用户_data_num" => (int)$post['e3_5'][0], "每浏览几个访问用户多少个_data_start" => (int)$post['e3_5'][1], "每浏览几个访问用户多少个_data_end" => (int)$post['e3_5'][2], "每访问几个用户进行关注_data_num" => (int)$post['e3_6'][0], "每访问几个用户进行关注多少个_data_start" => (int)$post['e3_6'][1], "每访问几个用户进行关注多少个_data_end" => (int)$post['e3_6'][2], ]; //非截流互动设置 $str5 = [ "每浏览几个点赞_data_num" => (int)$post['e4_1'][0], "每浏览几个点赞多少个_data_start" => (int)$post['e4_1'][1], "每浏览几个点赞多少个_data_end" => (int)$post['e4_1'][2], "每浏览几个收藏_data_num" => (int)$post['e4_2'][0], "每浏览几个收藏多少个_data_start" => (int)$post['e4_2'][1], "每浏览几个收藏多少个_data_end" => (int)$post['e4_2'][2], "每浏览几个评论_data_num" => (int)$post['e4_3'][0], "每浏览几个评论多少个_data_start" => (int)$post['e4_3'][1], "每浏览几个评论多少个_data_end" => (int)$post['e4_3'][2], "每浏览几个关注_data_num" => (int)$post['e4_4'][0], "每浏览几个关注多少个_data_start" => (int)$post['e4_4'][1], "每浏览几个关注多少个_data_end" => (int)$post['e4_4'][2], "每浏览几个访问用户_data_num" => (int)$post['e4_5'][0], "每浏览几个访问用户多少个_data_start" => (int)$post['e4_5'][1], "每浏览几个访问用户多少个_data_end" => (int)$post['e4_5'][2], "每访问几个用户进行关注_data_num" => (int)$post['e4_6'][0], "每访问几个用户进行关注多少个_data_start" => (int)$post['e4_6'][1], "每访问几个用户进行关注多少个_data_end" => (int)$post['e4_6'][2], ]; //默认互动参数 $str6 = [ "每浏览几个点赞_data_num" => (int)$post['e5_1'][0], "每浏览几个点赞多少个_data_start" => (int)$post['e5_1'][1], "每浏览几个点赞多少个_data_end" => (int)$post['e5_1'][2], "每浏览几个收藏_data_num" => (int)$post['e5_2'][0], "每浏览几个收藏多少个_data_start" => (int)$post['e5_2'][1], "每浏览几个收藏多少个_data_end" => (int)$post['e5_2'][2], "每浏览几个评论_data_num" => (int)$post['e5_3'][0], "每浏览几个评论多少个_data_start" => (int)$post['e5_3'][1], "每浏览几个评论多少个_data_end" => (int)$post['e5_3'][2], "每浏览几个关注_data_num" => (int)$post['e5_4'][0], "每浏览几个关注多少个_data_start" => (int)$post['e5_4'][1], "每浏览几个关注多少个_data_end" => (int)$post['e5_4'][2], "每浏览几个访问用户_data_num" => (int)$post['e5_5'][0], "每浏览几个访问用户多少个_data_start" => (int)$post['e5_5'][1], "每浏览几个访问用户多少个_data_end" => (int)$post['e5_5'][2], "每访问几个用户进行关注_data_num" => (int)$post['e5_6'][0], "每访问几个用户进行关注多少个_data_start" => (int)$post['e5_6'][1], "每访问几个用户进行关注多少个_data_end" => (int)$post['e5_6'][2], ]; //评论随机语句 $str7 = []; foreach ($post['f21_1'] as $k => $v) { if(!empty($v)) { $str7[$v] = $this->replaceContent($post['f21_2'][$k]); } } //私信随机语句 $str8 = []; foreach ($post['f25_1'] as $k => $v) { if(!empty($v)) { $str8[$v] = $this->replaceContent($post['f25_2'][$k]); } } //替换 $post['f16'] = str_replace("|", ",", $post['f15']); $post['f18'] = str_replace("|", ",", $post['f17']); //处理数据 $json = [ "数据入口_type" => $post['a1'], "是否组合" => (int)$post['a4'], "推荐转搜索_start" => (int)$post['a5'][0], "推荐转搜索_end" => (int)$post['a5'][1], "搜索转推荐_start" => (int)$post['a6'][0], "搜索转推荐_end" => (int)$post['a6'][1], "切换搜索词" => $post['a7'], "切换方式" => (int)$post['a8'], "搜索筛选" => (int)$post['a9'], "排序依据" => $post['a10'], "笔记类型" => $post['a11'], "发布时间" => $post['a12'], "搜索范围" => $post['a13'], "运行时长_time" => (int)$post['a2'], "操作总数_data_num" => (int)$post['a3'], "是否分类_is_type" => (int)$post['b1'], "数据分类_default_type_list" => $str_l, "数据分类_type_list" => $str_l, "最小范围数_data_num" => (int)$min_a, "列表标题过滤词列表_data_list" => $post['b3'], "列表翻页随机来回滑动屏幕次数_data_start" => (int)$post['b4'][0], "列表翻页随机来回滑动屏幕次数_data_end" => (int)$post['b4'][1], "浏览内容详情返回列表随机滑动屏幕次数_data_start" => (int)$post['b5'][0], "浏览内容详情返回列表随机滑动屏幕次数_data_end" => (int)$post['b5'][1], "列表每次循环至少滑动多少次_data_num" => (int)$post['b6'], "是否忽略直播的内容对象_data_num" => (int)$post['b7'], "浏览内容笔记类型指定评论数判断观看时长_data_list" => $str2, "浏览内容笔记类型随机往上滑动次数_data_start" => (int)$post['c2'][0], "浏览内容笔记类型随机往上滑动次数_data_end" => (int)$post['c2'][1], "浏览内容笔记类型随机往上滑动次数等待秒数_data_start" => (int)$post['c3'][0], "浏览内容笔记类型随机往上滑动次数等待秒数_data_end" => (int)$post['c3'][1], "浏览内容笔记类型评论总数与滑动次数比例_data_num" => (int)$post['c4'], "浏览内容笔记类型评论区展开回复次数_data_start" => (int)$post['c5'][0], "浏览内容笔记类型评论区展开回复次数_data_end" => (int)$post['c5'][1], "浏览内容笔记类型评论区展开回复随机概率_data_start" => (int)$post['c6'][0], "浏览内容笔记类型评论区展开回复随机概率_data_end" => (int)$post['c6'][1], "浏览内容笔记类型评论区展开更多回复随机概率_data_start" => (int)$post['c7'][0], "浏览内容笔记类型评论区展开更多回复随机概率_data_end" => (int)$post['c7'][1], "浏览内容笔记类型随机来回观看概率_data_start" => (int)$post['c8'][0], "浏览内容笔记类型随机来回观看概率_data_end" => (int)$post['c8'][1], "浏览内容笔记类型随机来回观看向上滑动次数_data_start" => (int)$post['c9'][0], "浏览内容笔记类型随机来回观看向上滑动次数_data_end" => (int)$post['c9'][1], "浏览内容笔记类型随机来回观看向下滑动次数_data_start" => (int)$post['c10'][0], "浏览内容笔记类型随机来回观看向下滑动次数_data_end" => (int)$post['c10'][1], "浏览内容视频类型不互动观看时长_data_start" => (int)$post['d2'][0], "浏览内容视频类型不互动观看时长_data_end" => (int)$post['d2'][1], "浏览内容视频类型指定评论数判断观看时长_data_list" => $str3, "浏览内容视频类型后往下浏览视频个数_data_start" => (int)$post['d3'][0], "浏览内容视频类型后往下浏览视频个数_data_end" => (int)$post['d3'][1], "浏览内容视频类型评论区最多滑动次数_data_start" => (int)$post['d4'][0], "浏览内容视频类型评论区最多滑动次数_data_end" => (int)$post['d4'][1], "浏览内容视频类型评论区展开回复次数_data_start" => (int)$post['d5'][0], "浏览内容视频类型评论区展开回复次数_data_end" => (int)$post['d5'][1], "浏览内容视频类型评论区展开回复随机概率_data_start" => (int)$post['d6'][0], "浏览内容视频类型评论区展开回复随机概率_data_end" => (int)$post['d6'][1], "每浏览几个视频完整观看_data_num" => (int)$post['d7'][0], "每浏览几个视频完整观看多少个_data_start" => (int)$post['d7'][1], "每浏览几个视频完整观看多少个_data_end" => (int)$post['d7'][2], "每浏览用户几个视频完整观看_data_num" => (int)$post['d8'][0], "每浏览用户几个视频完整观看多少个_data_start" => (int)$post['d8'][1], "每浏览用户几个视频完整观看多少个_data_end" => (int)$post['d8'][2], "每浏览截流几个视频完整观看_data_num" => (int)$post['d9'][0], "每浏览截流几个视频完整观看多少个_data_start" => (int)$post['d9'][1], "每浏览截流几个视频完整观看多少个_data_end" => (int)$post['d9'][2], "是否开启互动" => (int)$post['e1'], "互动场景" => $post['e2'], "场景1_是否开启全局默认互动" => 1, "场景2_是否开启截流与非截流独立互动" => 1, "截流互动独立设置_list" => $str4, "非截流互动独立设置_list" => $str5, "默认互动参数" => $str6, "进入用户主页观看多少个内容_data_num" => (int)$post['e6'], "互动评论随机语句" => $post['e7'], "是否开启强制截流模式" => (int)$post['f1'], "截流对象是否进行互动行为_data_num" => (int)$post['f2'], "截流用户是否进行关注_01或随机_2" => (int)$post['f3'], "截流用户是否进行关注随机概率_百分比" => (int)$post['f4'], "截流笔记内容对象评论区最多滑动多少次_data_num" => (int)$post['f5'], "截流视频内容对象评论区最多滑动多少次_data_num" => (int)$post['f6'], "截流进入用户存在内容可评论总数_data_num" => (int)$post['f7'], "截流笔记内容最多成功匹配多少个评论_data_start" => (int)$post['f8'][0], "截流笔记内容最多成功匹配多少个评论_data_end" => (int)$post['f8'][1], "截流视频内容最多成功匹配多少个评论_data_start" => (int)$post['f9'][0], "截流视频内容最多成功匹配多少个评论_data_end" => (int)$post['f9'][1], "截流指定账号列表_data_list" => $post['f10'], "截流账号关键词列表_data_list" => $post['f11'], "截流账号过滤词列表_data_list" => $post['f12'], "截流内容名称关键词" => $post['f13'], "截流内容名称过滤词" => $post['f14'], "截流笔记内容满足时间条件的关键词正则" => $post['f15'], "截流笔记内容满足时间条件的关键词" => $post['f16'], //原 $post['f16'] 替换成逗号即可 "截流视频内容满足时间条件的关键词正则" => $post['f17'], "截流视频内容满足时间条件的关键词" => $post['f18'], //原 $post['f18'] 替换成逗号即可 "截流评论账号过滤词" => $post['f19'], "截流评论名称关键词" => $post['f20'], "截流评论随机语句" => $str7, "截流评论是否开启" => (int)$post['f22'], "截流私信名称关键词" => $post['f24'], "截流私信随机语句" => $str8, "截流私信是否开启" => (int)$post['f23'], "截流私信条数" => (int)$post['f26'], "截流是否开启" => (int)$post['f27'], "评论转为私信" => (int)$post['f28'], "私信转为评论" => (int)$post['f29'], "评论钩子是否开启" => (int)$post['k1'], "评论钩子是否互动评论" => (int)$post['k2'], "点赞数条件" => (int)$post['k3'], "收藏数条件" => (int)$post['k4'], "评论数条件" => (int)$post['k5'], "评论钩子内容" => $post['k6'] ]; return [$json, $post]; } }