作者 lyh

Merge branch 'master' of http://47.244.231.31:8099/zhl/globalso-v6 into lyh-server

@@ -982,17 +982,17 @@ class RelayInquiry extends Command @@ -982,17 +982,17 @@ class RelayInquiry extends Command
982 $inquiry_date = Carbon::make($inquiry_date); 982 $inquiry_date = Carbon::make($inquiry_date);
983 //当天的 983 //当天的
984 if($inquiry_date->isToday()){ 984 if($inquiry_date->isToday()){
985 - //广告投放日(周一、二、三) 第一封询盘100%及时推送  
986 - $is_first = false;  
987 - if(in_array($inquiry_date->weekday(), [1,2,3])) { 985 + //广告投放日(周一、二、三、四) 第一封询盘100%及时推送
  986 + $is_timely = true; //是否及时推送
  987 + if(in_array($inquiry_date->weekday(), [1,2,3,4])) {
988 //是否今天的第一封询盘 988 //是否今天的第一封询盘
989 $detail = ReInquiryDetail::where('re_website', $domain)->where('start_at', '>=', $inquiry_date->startOfDay()->toDatetimeString())->first(); 989 $detail = ReInquiryDetail::where('re_website', $domain)->where('start_at', '>=', $inquiry_date->startOfDay()->toDatetimeString())->first();
990 - if(!$detail){  
991 - $is_first = true; 990 + if($detail){
  991 + $is_timely = false; //只有周一到周四的非第一封询盘 根据概率及时推送
992 } 992 }
993 } 993 }
994 - //非广告投放日第一封询盘  
995 - if(!$is_first && $task->second_push_rate != 100){ 994 + //概率及时推送
  995 + if(!$is_timely && $task->second_push_rate != 100){
996 //按概率 996 //按概率
997 $res = $this->get_rand([$task->second_push_rate, 100 - $task->second_push_rate]); 997 $res = $this->get_rand([$task->second_push_rate, 100 - $task->second_push_rate]);
998 if($res == 1){ 998 if($res == 1){
@@ -97,7 +97,7 @@ class SyncSubmitTask extends Command @@ -97,7 +97,7 @@ class SyncSubmitTask extends Command
97 } 97 }
98 $task_info->save(); 98 $task_info->save();
99 Log::channel('inquiry')->error($task_id . '处理失败', [$e->getMessage(), $e->getFile(), $e->getLine()]); 99 Log::channel('inquiry')->error($task_id . '处理失败', [$e->getMessage(), $e->getFile(), $e->getLine()]);
100 - $this->output('任务失败:' . $e->getMessage()); 100 + $this->output('任务失败:' . $e->getMessage() . $e->getFile() . $e->getLine());
101 } 101 }
102 102
103 $use_time = time() - $time; 103 $use_time = time() - $time;
@@ -245,4 +245,41 @@ class Arr extends \Illuminate\Support\Arr @@ -245,4 +245,41 @@ class Arr extends \Illuminate\Support\Arr
245 }, $arr)); 245 }, $arr));
246 return json_encode(array_values(array_unique(array_filter($array)))); 246 return json_encode(array_values(array_unique(array_filter($array))));
247 } 247 }
  248 +
  249 +
  250 + /**
  251 + * 数组转文本html数组
  252 + * @param $array
  253 + * @param $indentLevel
  254 + * @return array
  255 + * @author zbj
  256 + * @date 2025/9/26
  257 + */
  258 + public static function formatForHtml($array, $indentLevel = 0) {
  259 + $result = [];
  260 + $indent = str_repeat('    ', $indentLevel);
  261 +
  262 + foreach ($array as $key => $value) {
  263 + $isNumericKey = is_numeric($key);
  264 +
  265 + if (is_array($value)) {
  266 + if (!$isNumericKey) {
  267 + $result[] = "{$indent}{$key}:<br/>";
  268 + $nestedResult = self::formatForHtml($value, $indentLevel + 1);
  269 + } else {
  270 + $key && $result[] = '<br/>';
  271 + $nestedResult = self::formatForHtml($value, $indentLevel);
  272 + }
  273 + $result = array_merge($result, $nestedResult);
  274 + } else {
  275 + if ($isNumericKey) {
  276 + $result[] = "{$indent}{$value}<br/>";
  277 + } else {
  278 + $result[] = "{$indent}{$key}: {$value}<br/>";
  279 + }
  280 + }
  281 + }
  282 +
  283 + return $result;
  284 + }
248 } 285 }
@@ -155,8 +155,8 @@ class RankDataController extends BaseController @@ -155,8 +155,8 @@ class RankDataController extends BaseController
155 'cnt_first' => '排名第一', 155 'cnt_first' => '排名第一',
156 'cnt_home' => '第一页', 156 'cnt_home' => '第一页',
157 'cnt_thirty' => '前三页', 157 'cnt_thirty' => '前三页',
158 - 'cnt_fifty' => '前五页',  
159 - 'cnt_hundred' => '前十页', 158 +// 'cnt_fifty' => '前五页',
  159 +// 'cnt_hundred' => '前十页',
160 'reach' => '是否达标', 160 'reach' => '是否达标',
161 ]; 161 ];
162 } 162 }
@@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
2 2
3 namespace App\Models\Inquiry; 3 namespace App\Models\Inquiry;
4 4
  5 +use App\Helper\Arr;
5 use App\Helper\FormGlobalsoApi; 6 use App\Helper\FormGlobalsoApi;
6 use App\Models\Base; 7 use App\Models\Base;
7 use App\Utils\LogUtils; 8 use App\Utils\LogUtils;
@@ -83,6 +84,12 @@ class InquiryFormData extends Base @@ -83,6 +84,12 @@ class InquiryFormData extends Base
83 $v = getImageUrl($v['path']); 84 $v = getImageUrl($v['path']);
84 $data[$k] = $v; 85 $data[$k] = $v;
85 } 86 }
  87 + if(is_string($v)){
  88 + $arr = json_decode($v, true);
  89 + if(is_array($arr)){
  90 + $v = implode('', Arr::formatForHtml($arr));
  91 + }
  92 + }
86 //其他字段补充到message里 93 //其他字段补充到message里
87 if(!in_array($k, ['name', 'email', 'message', 'phone', 'ip', 'date', 'cname', 'domain', 'edition', 'domain_host_url'])){ 94 if(!in_array($k, ['name', 'email', 'message', 'phone', 'ip', 'date', 'cname', 'domain', 'edition', 'domain_host_url'])){
88 $data['message'].= "<br/>" . $k .': ' . $v; 95 $data['message'].= "<br/>" . $k .': ' . $v;
@@ -9,6 +9,7 @@ use App\Models\Base; @@ -9,6 +9,7 @@ use App\Models\Base;
9 use App\Models\Domain\DomainInfo; 9 use App\Models\Domain\DomainInfo;
10 use App\Models\Project\Project; 10 use App\Models\Project\Project;
11 use App\Models\Task\TaskOwner; 11 use App\Models\Task\TaskOwner;
  12 +use App\Services\DingService;
12 use App\Utils\HttpUtils; 13 use App\Utils\HttpUtils;
13 use Illuminate\Database\Eloquent\Model; 14 use Illuminate\Database\Eloquent\Model;
14 use Illuminate\Support\Facades\Cache; 15 use Illuminate\Support\Facades\Cache;
@@ -68,6 +69,18 @@ class ReInquiryCount extends Base @@ -68,6 +69,18 @@ class ReInquiryCount extends Base
68 $model->task_ids = $model->task_ids + [$task_id]; 69 $model->task_ids = $model->task_ids + [$task_id];
69 $model->num = $model->num + $num; 70 $model->num = $model->num + $num;
70 $model->save(); 71 $model->save();
  72 +
  73 + //数量首次达到100, 给钉钉推送消息
  74 + if($num > 0 && $model->num == 100){
  75 + (new DingService())->handle([
  76 + 'keyword' => '询盘数量通知',
  77 + 'msg' =>
  78 + '项目名称:' . $model->company . PHP_EOL .
  79 + '项目域名:' . $model->domain . PHP_EOL .
  80 + '询盘数量:' . $model->num,
  81 + 'isAtAll' => false, // 是否@所有人
  82 + ], 'https://oapi.dingtalk.com/robot/send?access_token=cd5733d3e6b810a501e3ea20df7c99ecb616aa6754fa048348837d088c1f5b2c');
  83 + }
71 } 84 }
72 85
73 public function setTaskIdsAttribute($value) 86 public function setTaskIdsAttribute($value)