截流自动化的商城平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Closure.php 16KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. <?php
  2. namespace app\common\model\content;
  3. use app\common\basics\Models;
  4. class Closure extends Models
  5. {
  6. /**
  7. * @Notes: 关联文章分类模型
  8. * @Author: 张无忌
  9. */
  10. public function category()
  11. {
  12. return $this->hasOne('ClosureCategory', 'id', 'cid');
  13. }
  14. public function category2()
  15. {
  16. return $this->hasOne('IndustryCategory', 'id', 'yid');
  17. }
  18. public function setContentAttr($value,$data)
  19. {
  20. $content = $data['content'];
  21. if (!empty($content)) {
  22. $content = HtmlSetImage($content);
  23. }
  24. return $content;
  25. }
  26. public function getContentAttr($value,$data)
  27. {
  28. $content = $data['content'];
  29. if (!empty($content)) {
  30. $content = HtmlGetImage($content);
  31. }
  32. return $content;
  33. }
  34. /*
  35. * 处理表达数据
  36. */
  37. public function postDataHandle($post=[]){
  38. //处理b2
  39. $str = [];
  40. foreach ($post['b2_1'] as $k => $v) {
  41. if(!empty($v)) {
  42. $str[] = $v . '_' . $post['b2_2'][$k] . '-' . $post['b2_3'][$k] . '-' . $post['b2_4'][$k];
  43. }
  44. }
  45. $str_l = '';
  46. foreach ($str as $k => $v) {
  47. if(!empty($v)) {
  48. if ($k > 0) {
  49. $str_l .= '|' . $v;
  50. } else {
  51. $str_l .= $v;
  52. }
  53. }
  54. }
  55. $min_a = $post['b2_2'][0];
  56. foreach ($post['b2_2'] as $k => $v) {
  57. if(!empty($v)) {
  58. if ($k > 0) {
  59. if ((int)$v < (int)$min_a) {
  60. $min_a = (int)$v;
  61. }
  62. }
  63. }
  64. }
  65. //笔记评论数处理
  66. $str2 = [];
  67. foreach ($post['c1_1'] as $k => $v) {
  68. if(!empty($v)) {
  69. $str2[$v] = [
  70. "start_num" => (int)$post['c1_2'][$k],
  71. "end_num" => (int)$post['c1_3'][$k]
  72. ];
  73. }
  74. }
  75. //视频评论数处理
  76. $str3 = [];
  77. foreach ($post['d1_1'] as $k => $v) {
  78. if(!empty($v)) {
  79. $str3[$v] = [
  80. "start_num" => (int)$post['d1_2'][$k],
  81. "end_num" => (int)$post['d1_3'][$k]
  82. ];
  83. }
  84. }
  85. //截流独立互动设置
  86. $str4 = [
  87. "每浏览几个点赞_data_num" => (int)$post['e3_1'][0],
  88. "每浏览几个点赞多少个_data_start" => (int)$post['e3_1'][1],
  89. "每浏览几个点赞多少个_data_end" => (int)$post['e3_1'][2],
  90. "每浏览几个收藏_data_num" => (int)$post['e3_2'][0],
  91. "每浏览几个收藏多少个_data_start" => (int)$post['e3_2'][1],
  92. "每浏览几个收藏多少个_data_end" => (int)$post['e3_2'][2],
  93. "每浏览几个评论_data_num" => (int)$post['e3_3'][0],
  94. "每浏览几个评论多少个_data_start" => (int)$post['e3_3'][1],
  95. "每浏览几个评论多少个_data_end" => (int)$post['e3_3'][2],
  96. "每浏览几个关注_data_num" => (int)$post['e3_4'][0],
  97. "每浏览几个关注多少个_data_start" => (int)$post['e3_4'][1],
  98. "每浏览几个关注多少个_data_end" => (int)$post['e3_4'][2],
  99. "每浏览几个访问用户_data_num" => (int)$post['e3_5'][0],
  100. "每浏览几个访问用户多少个_data_start" => (int)$post['e3_5'][1],
  101. "每浏览几个访问用户多少个_data_end" => (int)$post['e3_5'][2],
  102. "每访问几个用户进行关注_data_num" => (int)$post['e3_6'][0],
  103. "每访问几个用户进行关注多少个_data_start" => (int)$post['e3_6'][1],
  104. "每访问几个用户进行关注多少个_data_end" => (int)$post['e3_6'][2],
  105. ];
  106. //非截流互动设置
  107. $str5 = [
  108. "每浏览几个点赞_data_num" => (int)$post['e4_1'][0],
  109. "每浏览几个点赞多少个_data_start" => (int)$post['e4_1'][1],
  110. "每浏览几个点赞多少个_data_end" => (int)$post['e4_1'][2],
  111. "每浏览几个收藏_data_num" => (int)$post['e4_2'][0],
  112. "每浏览几个收藏多少个_data_start" => (int)$post['e4_2'][1],
  113. "每浏览几个收藏多少个_data_end" => (int)$post['e4_2'][2],
  114. "每浏览几个评论_data_num" => (int)$post['e4_3'][0],
  115. "每浏览几个评论多少个_data_start" => (int)$post['e4_3'][1],
  116. "每浏览几个评论多少个_data_end" => (int)$post['e4_3'][2],
  117. "每浏览几个关注_data_num" => (int)$post['e4_4'][0],
  118. "每浏览几个关注多少个_data_start" => (int)$post['e4_4'][1],
  119. "每浏览几个关注多少个_data_end" => (int)$post['e4_4'][2],
  120. "每浏览几个访问用户_data_num" => (int)$post['e4_5'][0],
  121. "每浏览几个访问用户多少个_data_start" => (int)$post['e4_5'][1],
  122. "每浏览几个访问用户多少个_data_end" => (int)$post['e4_5'][2],
  123. "每访问几个用户进行关注_data_num" => (int)$post['e4_6'][0],
  124. "每访问几个用户进行关注多少个_data_start" => (int)$post['e4_6'][1],
  125. "每访问几个用户进行关注多少个_data_end" => (int)$post['e4_6'][2],
  126. ];
  127. //默认互动参数
  128. $str6 = [
  129. "每浏览几个点赞_data_num" => (int)$post['e5_1'][0],
  130. "每浏览几个点赞多少个_data_start" => (int)$post['e5_1'][1],
  131. "每浏览几个点赞多少个_data_end" => (int)$post['e5_1'][2],
  132. "每浏览几个收藏_data_num" => (int)$post['e5_2'][0],
  133. "每浏览几个收藏多少个_data_start" => (int)$post['e5_2'][1],
  134. "每浏览几个收藏多少个_data_end" => (int)$post['e5_2'][2],
  135. "每浏览几个评论_data_num" => (int)$post['e5_3'][0],
  136. "每浏览几个评论多少个_data_start" => (int)$post['e5_3'][1],
  137. "每浏览几个评论多少个_data_end" => (int)$post['e5_3'][2],
  138. "每浏览几个关注_data_num" => (int)$post['e5_4'][0],
  139. "每浏览几个关注多少个_data_start" => (int)$post['e5_4'][1],
  140. "每浏览几个关注多少个_data_end" => (int)$post['e5_4'][2],
  141. "每浏览几个访问用户_data_num" => (int)$post['e5_5'][0],
  142. "每浏览几个访问用户多少个_data_start" => (int)$post['e5_5'][1],
  143. "每浏览几个访问用户多少个_data_end" => (int)$post['e5_5'][2],
  144. "每访问几个用户进行关注_data_num" => (int)$post['e5_6'][0],
  145. "每访问几个用户进行关注多少个_data_start" => (int)$post['e5_6'][1],
  146. "每访问几个用户进行关注多少个_data_end" => (int)$post['e5_6'][2],
  147. ];
  148. //评论随机语句
  149. $str7 = [];
  150. foreach ($post['f21_1'] as $k => $v) {
  151. if(!empty($v)) {
  152. $str7[$v] = $post['f21_2'][$k];
  153. }
  154. }
  155. //私信随机语句
  156. $str8 = [];
  157. foreach ($post['f25_1'] as $k => $v) {
  158. if(!empty($v)) {
  159. $str8[$v] = $post['f25_2'][$k];
  160. }
  161. }
  162. //替换
  163. $post['f16'] = str_replace("|", ",", $post['f15']);
  164. $post['f18'] = str_replace("|", ",", $post['f17']);
  165. //处理数据
  166. $json = [
  167. "数据入口_type" => $post['a1'],
  168. "是否组合" => (int)$post['a4'],
  169. "推荐转搜索_start" => (int)$post['a5'][0],
  170. "推荐转搜索_end" => (int)$post['a5'][1],
  171. "搜索转推荐_start" => (int)$post['a6'][0],
  172. "搜索转推荐_end" => (int)$post['a6'][1],
  173. "切换搜索词" => $post['a7'],
  174. "切换方式" => (int)$post['a8'],
  175. "搜索筛选" => (int)$post['a9'],
  176. "排序依据" => $post['a10'],
  177. "笔记类型" => $post['a11'],
  178. "发布时间" => $post['a12'],
  179. "搜索范围" => $post['a13'],
  180. "运行时长_time" => (int)$post['a2'],
  181. "操作总数_data_num" => (int)$post['a3'],
  182. "是否分类_is_type" => (int)$post['b1'],
  183. "数据分类_default_type_list" => $str_l,
  184. "数据分类_type_list" => $str_l,
  185. "最小范围数_data_num" => (int)$min_a,
  186. "列表标题过滤词列表_data_list" => $post['b3'],
  187. "列表翻页随机来回滑动屏幕次数_data_start" => (int)$post['b4'][0],
  188. "列表翻页随机来回滑动屏幕次数_data_end" => (int)$post['b4'][1],
  189. "浏览内容详情返回列表随机滑动屏幕次数_data_start" => (int)$post['b5'][0],
  190. "浏览内容详情返回列表随机滑动屏幕次数_data_end" => (int)$post['b5'][1],
  191. "列表每次循环至少滑动多少次_data_num" => (int)$post['b6'],
  192. "是否忽略直播的内容对象_data_num" => (int)$post['b7'],
  193. "浏览内容笔记类型指定评论数判断观看时长_data_list" => $str2,
  194. "浏览内容笔记类型随机往上滑动次数_data_start" => (int)$post['c2'][0],
  195. "浏览内容笔记类型随机往上滑动次数_data_end" => (int)$post['c2'][1],
  196. "浏览内容笔记类型随机往上滑动次数等待秒数_data_start" => (int)$post['c3'][0],
  197. "浏览内容笔记类型随机往上滑动次数等待秒数_data_end" => (int)$post['c3'][1],
  198. "浏览内容笔记类型评论总数与滑动次数比例_data_num" => (int)$post['c4'],
  199. "浏览内容笔记类型评论区展开回复次数_data_start" => (int)$post['c5'][0],
  200. "浏览内容笔记类型评论区展开回复次数_data_end" => (int)$post['c5'][1],
  201. "浏览内容笔记类型评论区展开回复随机概率_data_start" => (int)$post['c6'][0],
  202. "浏览内容笔记类型评论区展开回复随机概率_data_end" => (int)$post['c6'][1],
  203. "浏览内容笔记类型评论区展开更多回复随机概率_data_start" => (int)$post['c7'][0],
  204. "浏览内容笔记类型评论区展开更多回复随机概率_data_end" => (int)$post['c7'][1],
  205. "浏览内容笔记类型随机来回观看概率_data_start" => (int)$post['c8'][0],
  206. "浏览内容笔记类型随机来回观看概率_data_end" => (int)$post['c8'][1],
  207. "浏览内容笔记类型随机来回观看向上滑动次数_data_start" => (int)$post['c9'][0],
  208. "浏览内容笔记类型随机来回观看向上滑动次数_data_end" => (int)$post['c9'][1],
  209. "浏览内容笔记类型随机来回观看向下滑动次数_data_start" => (int)$post['c10'][0],
  210. "浏览内容笔记类型随机来回观看向下滑动次数_data_end" => (int)$post['c10'][1],
  211. "浏览内容视频类型不互动观看时长_data_start" => (int)$post['d2'][0],
  212. "浏览内容视频类型不互动观看时长_data_end" => (int)$post['d2'][1],
  213. "浏览内容视频类型指定评论数判断观看时长_data_list" => $str3,
  214. "浏览内容视频类型后往下浏览视频个数_data_start" => (int)$post['d3'][0],
  215. "浏览内容视频类型后往下浏览视频个数_data_end" => (int)$post['d3'][1],
  216. "浏览内容视频类型评论区最多滑动次数_data_start" => (int)$post['d4'][0],
  217. "浏览内容视频类型评论区最多滑动次数_data_end" => (int)$post['d4'][1],
  218. "浏览内容视频类型评论区展开回复次数_data_start" => (int)$post['d5'][0],
  219. "浏览内容视频类型评论区展开回复次数_data_end" => (int)$post['d5'][1],
  220. "浏览内容视频类型评论区展开回复随机概率_data_start" => (int)$post['d6'][0],
  221. "浏览内容视频类型评论区展开回复随机概率_data_end" => (int)$post['d6'][1],
  222. "每浏览几个视频完整观看_data_num" => (int)$post['d7'][0],
  223. "每浏览几个视频完整观看多少个_data_start" => (int)$post['d7'][1],
  224. "每浏览几个视频完整观看多少个_data_end" => (int)$post['d7'][2],
  225. "每浏览用户几个视频完整观看_data_num" => (int)$post['d8'][0],
  226. "每浏览用户几个视频完整观看多少个_data_start" => (int)$post['d8'][1],
  227. "每浏览用户几个视频完整观看多少个_data_end" => (int)$post['d8'][2],
  228. "每浏览截流几个视频完整观看_data_num" => (int)$post['d9'][0],
  229. "每浏览截流几个视频完整观看多少个_data_start" => (int)$post['d9'][1],
  230. "每浏览截流几个视频完整观看多少个_data_end" => (int)$post['d9'][2],
  231. "是否开启互动" => (int)$post['e1'],
  232. "互动场景" => $post['e2'],
  233. "场景1_是否开启全局默认互动" => 1,
  234. "场景2_是否开启截流与非截流独立互动" => 1,
  235. "截流互动独立设置_list" => $str4,
  236. "非截流互动独立设置_list" => $str5,
  237. "默认互动参数" => $str6,
  238. "进入用户主页观看多少个内容_data_num" => (int)$post['e6'],
  239. "互动评论随机语句" => $post['e7'],
  240. "是否开启强制截流模式" => (int)$post['f1'],
  241. "截流对象是否进行互动行为_data_num" => (int)$post['f2'],
  242. "截流用户是否进行关注_01或随机_2" => (int)$post['f3'],
  243. "截流用户是否进行关注随机概率_百分比" => (int)$post['f4'],
  244. "截流笔记内容对象评论区最多滑动多少次_data_num" => (int)$post['f5'],
  245. "截流视频内容对象评论区最多滑动多少次_data_num" => (int)$post['f6'],
  246. "截流进入用户存在内容可评论总数_data_num" => (int)$post['f7'],
  247. "截流笔记内容最多成功匹配多少个评论_data_start" => (int)$post['f8'][0],
  248. "截流笔记内容最多成功匹配多少个评论_data_end" => (int)$post['f8'][1],
  249. "截流视频内容最多成功匹配多少个评论_data_start" => (int)$post['f9'][0],
  250. "截流视频内容最多成功匹配多少个评论_data_end" => (int)$post['f9'][1],
  251. "截流指定账号列表_data_list" => $post['f10'],
  252. "截流账号关键词列表_data_list" => $post['f11'],
  253. "截流账号过滤词列表_data_list" => $post['f12'],
  254. "截流内容名称关键词" => $post['f13'],
  255. "截流内容名称过滤词" => $post['f14'],
  256. "截流笔记内容满足时间条件的关键词正则" => $post['f15'],
  257. "截流笔记内容满足时间条件的关键词" => $post['f16'], //原 $post['f16'] 替换成逗号即可
  258. "截流视频内容满足时间条件的关键词正则" => $post['f17'],
  259. "截流视频内容满足时间条件的关键词" => $post['f18'], //原 $post['f18'] 替换成逗号即可
  260. "截流评论账号过滤词" => $post['f19'],
  261. "截流评论名称关键词" => $post['f20'],
  262. "截流评论随机语句" => $str7,
  263. "截流评论是否开启" => (int)$post['f22'],
  264. "截流私信名称关键词" => $post['f24'],
  265. "截流私信随机语句" => $str8,
  266. "截流私信是否开启" => (int)$post['f23'],
  267. "截流私信条数" => (int)$post['f26'],
  268. "截流是否开启" => (int)$post['f27'],
  269. "评论转为私信" => (int)$post['f28'],
  270. "私信转为评论" => (int)$post['f29'],
  271. "评论钩子是否开启" => (int)$post['k1'],
  272. "评论钩子是否互动评论" => (int)$post['k2'],
  273. "点赞数条件" => (int)$post['k3'],
  274. "收藏数条件" => (int)$post['k4'],
  275. "评论数条件" => (int)$post['k5'],
  276. "评论钩子内容" => $post['k6']
  277. ];
  278. return $json;
  279. }
  280. }