作者 赵彬吉

update

@@ -8,6 +8,7 @@ use App\Models\ProjectAssociation\ProjectAssociation; @@ -8,6 +8,7 @@ use App\Models\ProjectAssociation\ProjectAssociation;
8 use App\Services\ProjectServer; 8 use App\Services\ProjectServer;
9 use App\Utils\LogUtils; 9 use App\Utils\LogUtils;
10 use Illuminate\Database\Eloquent\SoftDeletes; 10 use Illuminate\Database\Eloquent\SoftDeletes;
  11 +use Illuminate\Support\Facades\Log;
11 12
12 /** 13 /**
13 * Class MessagePush 14 * Class MessagePush
@@ -51,6 +52,7 @@ class MessagePush extends Base @@ -51,6 +52,7 @@ class MessagePush extends Base
51 ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT) 52 ->where('binding_app', ProjectAssociation::ENTERPRISE_WECHAT)
52 ->value('friend_id'); 53 ->value('friend_id');
53 if(!$friend_id){ 54 if(!$friend_id){
  55 + Log::channel('inquiry')->info($project_id . '没有绑定企微群', [$id]);
54 return false; 56 return false;
55 } 57 }
56 58
@@ -93,5 +95,7 @@ class MessagePush extends Base @@ -93,5 +95,7 @@ class MessagePush extends Base
93 } 95 }
94 } 96 }
95 $model->save(); 97 $model->save();
  98 +
  99 + Log::channel('inquiry')->info($project_id . '通知消息', [$model->id]);
96 } 100 }
97 } 101 }
@@ -14,6 +14,7 @@ use App\Models\Visit\Visit; @@ -14,6 +14,7 @@ use App\Models\Visit\Visit;
14 use App\Models\Workchat\MessagePush; 14 use App\Models\Workchat\MessagePush;
15 use App\Utils\LogUtils; 15 use App\Utils\LogUtils;
16 use Illuminate\Support\Facades\Http; 16 use Illuminate\Support\Facades\Http;
  17 +use Illuminate\Support\Facades\Log;
17 use Illuminate\Support\Facades\URL; 18 use Illuminate\Support\Facades\URL;
18 use Illuminate\Support\Str; 19 use Illuminate\Support\Str;
19 use function Symfony\Component\String\s; 20 use function Symfony\Component\String\s;
@@ -79,7 +80,7 @@ class SyncSubmitTaskService @@ -79,7 +80,7 @@ class SyncSubmitTaskService
79 } 80 }
80 81
81 $handler = new self(); 82 $handler = new self();
82 - return $handler->$action($data, $date); 83 + return $handler->$action($data, $date, $task['id']);
83 } 84 }
84 85
85 86
@@ -110,7 +111,7 @@ class SyncSubmitTaskService @@ -110,7 +111,7 @@ class SyncSubmitTaskService
110 * @author zbj 111 * @author zbj
111 * @date 2024/8/27 112 * @date 2024/8/27
112 */ 113 */
113 - public function subscribe($data, $date){ 114 + public function subscribe($data, $date, $task_id){
114 $email = $data['data']['email']; 115 $email = $data['data']['email'];
115 if (filter_var($email, FILTER_VALIDATE_EMAIL)) { 116 if (filter_var($email, FILTER_VALIDATE_EMAIL)) {
116 $model = new Email(); 117 $model = new Email();
@@ -129,7 +130,7 @@ class SyncSubmitTaskService @@ -129,7 +130,7 @@ class SyncSubmitTaskService
129 * @author zbj 130 * @author zbj
130 * @date 2023/12/4 131 * @date 2023/12/4
131 */ 132 */
132 - public function inquiry($data, $date) 133 + public function inquiry($data, $date, $task_id)
133 { 134 {
134 //数组key转为小写 135 //数组key转为小写
135 $data['data'] = array_change_key_case($data['data'], CASE_LOWER); 136 $data['data'] = array_change_key_case($data['data'], CASE_LOWER);
@@ -160,14 +161,17 @@ class SyncSubmitTaskService @@ -160,14 +161,17 @@ class SyncSubmitTaskService
160 Visit::isInquiry($data['ip']); 161 Visit::isInquiry($data['ip']);
161 162
162 //推送企微消息 163 //推送企微消息
  164 + Log::channel('inquiry')->info($task_id . '询盘结果', [$id]);
163 if($id){ 165 if($id){
164 try { 166 try {
165 $name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name']; 167 $name = empty($data['data']['name']) ? '' : ' ' . $data['data']['name'];
166 MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']); 168 MessagePush::addInquiryMessage($id, $data['project_id'], $data['country'], $name, $data['submit_at']);
167 }catch (\Exception $e){ 169 }catch (\Exception $e){
  170 + Log::channel('inquiry')->info($task_id . '询盘失败', [$e->getMessage(), $e->getFile(), $e->getLine()]);
168 LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage()); 171 LogUtils::error('询盘消息'.$id.'写入企微消息队列失败' . $e->getMessage());
169 } 172 }
170 } 173 }
  174 + Log::channel('inquiry')->info($task_id . '询盘完成');
171 175
172 return true; 176 return true;
173 } 177 }
@@ -180,7 +184,7 @@ class SyncSubmitTaskService @@ -180,7 +184,7 @@ class SyncSubmitTaskService
180 * @author zbj 184 * @author zbj
181 * @date 2023/12/4 185 * @date 2023/12/4
182 */ 186 */
183 - public function visit($data, $date) 187 + public function visit($data, $date, $task_id)
184 { 188 {
185 189
186 $visit_data = $data['data']; 190 $visit_data = $data['data'];
@@ -179,6 +179,12 @@ return [ @@ -179,6 +179,12 @@ return [
179 'level' => 'debug', 179 'level' => 'debug',
180 'days' => 14, 180 'days' => 14,
181 ], 181 ],
  182 + 'inquiry' => [
  183 + 'driver' => 'daily',
  184 + 'path' => storage_path('logs/inquiry/laravel.log'),
  185 + 'level' => 'debug',
  186 + 'days' => 14,
  187 + ],
182 ], 188 ],
183 //操作日志 189 //操作日志
184 'operator_log' =>[ 190 'operator_log' =>[