|
@@ -5,7 +5,6 @@ namespace App\Models\Inquiry; |
|
@@ -5,7 +5,6 @@ namespace App\Models\Inquiry; |
|
5
|
use App\Helper\Arr;
|
5
|
use App\Helper\Arr;
|
|
6
|
use App\Helper\FormGlobalsoApi;
|
6
|
use App\Helper\FormGlobalsoApi;
|
|
7
|
use App\Models\Base;
|
7
|
use App\Models\Base;
|
|
8
|
-use App\Utils\LogUtils;
|
|
|
|
9
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
8
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
10
|
use Illuminate\Support\Facades\DB;
|
9
|
use Illuminate\Support\Facades\DB;
|
|
11
|
use Illuminate\Support\Facades\Log;
|
10
|
use Illuminate\Support\Facades\Log;
|
|
@@ -42,7 +41,7 @@ class InquiryFormData extends Base |
|
@@ -42,7 +41,7 @@ class InquiryFormData extends Base |
|
42
|
* @author zbj
|
41
|
* @author zbj
|
|
43
|
* @date 2023/12/4
|
42
|
* @date 2023/12/4
|
|
44
|
*/
|
43
|
*/
|
|
45
|
- public static function saveData($form_id, $domain, $ip, $country, $referer, $user_agent, $submit_at, $data, $traffic = 0){
|
44
|
+ public static function saveData($form_id, $domain, $ip, $country, $referer, $user_agent, $submit_at, $data, $project_id, $traffic = 0){
|
|
46
|
if(!empty($data['email'])){
|
45
|
if(!empty($data['email'])){
|
|
47
|
$data['email'] = str_replace(' ', '', $data['email']);
|
46
|
$data['email'] = str_replace(' ', '', $data['email']);
|
|
48
|
}
|
47
|
}
|
|
@@ -96,6 +95,14 @@ class InquiryFormData extends Base |
|
@@ -96,6 +95,14 @@ class InquiryFormData extends Base |
|
96
|
}
|
95
|
}
|
|
97
|
}
|
96
|
}
|
|
98
|
$res = (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data, $traffic);
|
97
|
$res = (new FormGlobalsoApi())->submitInquiry($ip, $referer, $submit_at, $data, $traffic);
|
|
|
|
98
|
+ //自定义推送
|
|
|
|
99
|
+ if($project_id == 3870) { //走这里发送的,关杰那边也要取消发送邮件
|
|
|
|
100
|
+ list($mobile, $email) = self::SpecialMailPhone($referer);
|
|
|
|
101
|
+ Log::channel('inquiry')->info('自定义推送', [$mobile, $email]);
|
|
|
|
102
|
+ $body = self::specialInquiryTemplate($data['name'], $data['email'], $data['phone'] ?? "", $data['message'], $domain, $ip, $country);
|
|
|
|
103
|
+ (new FormGlobalsoApi())->customizeInquiryEmail($email, '询盘客户<' . $data['name'] . '>', $body, $ip, $referer, $submit_at);
|
|
|
|
104
|
+ (new FormGlobalsoApi())->customizeInquirySms($mobile, $country, $domain);
|
|
|
|
105
|
+ }
|
|
99
|
Log::channel('inquiry')->info('询盘发送邮件', [$data, $res]);
|
106
|
Log::channel('inquiry')->info('询盘发送邮件', [$data, $res]);
|
|
100
|
if(!$res){
|
107
|
if(!$res){
|
|
101
|
throw new \Exception('询盘发送邮件失败');
|
108
|
throw new \Exception('询盘发送邮件失败');
|
|
@@ -118,6 +125,119 @@ class InquiryFormData extends Base |
|
@@ -118,6 +125,119 @@ class InquiryFormData extends Base |
|
118
|
}
|
125
|
}
|
|
119
|
|
126
|
|
|
120
|
/**
|
127
|
/**
|
|
|
|
128
|
+ * 获取推送邮箱和手机号
|
|
|
|
129
|
+ * 邮件地址和手机号 根据链接匹配,没匹配到随机取一个邮件和手机号
|
|
|
|
130
|
+ * @param $referer
|
|
|
|
131
|
+ * @author zbj
|
|
|
|
132
|
+ * @date 2025/10/25
|
|
|
|
133
|
+ */
|
|
|
|
134
|
+ public static function SpecialMailPhone($referer)
|
|
|
|
135
|
+ {
|
|
|
|
136
|
+ $mail_mobile_map = [
|
|
|
|
137
|
+ 'luchfitness' => [15262817624, 'Sales02@luchfitness.com'],
|
|
|
|
138
|
+ 'modernsporting' => [13073258707,'sales@modernsporting.com'],
|
|
|
|
139
|
+ 'liveupsports' => [18355892630,'sales@liveupsports.com'],
|
|
|
|
140
|
+ 'topflor' => [13912296731,'alan@topflor.cn'],
|
|
|
|
141
|
+ ];
|
|
|
|
142
|
+ $url_map = [
|
|
|
|
143
|
+ 'luchfitness' => [
|
|
|
|
144
|
+ 'https://www.ntsportgoods.com/supplier/nantong-luch-fitness-co-ltd',
|
|
|
|
145
|
+ 'https://www.ntsportgoods.com/benches-machines-luch-fitness/',
|
|
|
|
146
|
+ 'https://www.ntsportgoods.com/free-weight-luch-fitness/',
|
|
|
|
147
|
+ 'https://www.ntsportgoods.com/functional-training-luch-fitness/s/',
|
|
|
|
148
|
+ 'https://www.ntsportgoods.com/studio-exercise-luch-fitness/',
|
|
|
|
149
|
+ 'https://www.ntsportgoods.com/commercial-gym-half-power-rack-for-strength-training-product',
|
|
|
|
150
|
+ 'https://www.ntsportgoods.com/heavy-duty-fitness-flat-bench-for-home-commercial-gym-product',
|
|
|
|
151
|
+ 'https://www.ntsportgoods.com/durable-gym-dumbbell-flat-bench-for-weight-training-product',
|
|
|
|
152
|
+ 'https://www.ntsportgoods.com/rubber-colored-bumper-plate-for-olympic-weightlifting-product',
|
|
|
|
153
|
+ 'https://www.ntsportgoods.com/urethane-competition-bumper-plate-for-strength-training-product',
|
|
|
|
154
|
+ 'https://www.ntsportgoods.com/10-pair-dumbbell-storage-rack-for-commercial-gyms-product',
|
|
|
|
155
|
+ 'https://www.ntsportgoods.com/tpu-coated-dumbbells-for-home-and-commercial-fitness-product',
|
|
|
|
156
|
+ 'https://www.ntsportgoods.com/urethane-weight-plate-for-powerlifting-strength-gym-product',
|
|
|
|
157
|
+ 'https://www.ntsportgoods.com/iphifun-cpu-weight-plate-for-professional-training-product',
|
|
|
|
158
|
+ 'https://www.ntsportgoods.com/men-s-weightlifting-barbell-bar-for-strength-training-product',
|
|
|
|
159
|
+ 'https://www.ntsportgoods.com/women-s-weightlifting-barbell-bar-for-olympic-lifts-product',
|
|
|
|
160
|
+ 'https://www.ntsportgoods.com/steel-competition-kettlebell-for-functional-training-product',
|
|
|
|
161
|
+ 'https://www.ntsportgoods.com/adjustable-strength-jump-plyo-boxes-for-gym-training-product',
|
|
|
|
162
|
+ 'https://www.ntsportgoods.com/commercial-soft-plyo-box-for-functional-gym-training-product',
|
|
|
|
163
|
+ 'https://www.ntsportgoods.com/power-training-weight-bull-bag-for-strength-workout-product',
|
|
|
|
164
|
+ 'https://www.ntsportgoods.com/pu-leather-power-bag-for-functional-strength-training-product',
|
|
|
|
165
|
+ 'https://www.ntsportgoods.com/abdominal-muscle-mat-for-core-and-sit-up-training-product',
|
|
|
|
166
|
+ 'https://www.ntsportgoods.com/gymnastics-training-mat-for-fitness-and-yoga-workout-product',
|
|
|
|
167
|
+ 'https://www.ntsportgoods.com/adjustable-bench-stepper-for-aerobic-and-strength-gym-product',
|
|
|
|
168
|
+ 'https://www.ntsportgoods.com/rubber-body-pump-set-for-cardio-and-strength-training-product',
|
|
|
|
169
|
+ 'https://www.ntsportgoods.com/balance-training-yoga-ball-for-core-stability-workout-product',
|
|
|
|
170
|
+ 'https://www.ntsportgoods.com/pull-up-resistance-band-for-strength-and-stretching-product',
|
|
|
|
171
|
+ ],
|
|
|
|
172
|
+ 'modernsporting' => [
|
|
|
|
173
|
+ 'https://www.ntsportgoods.com/supplier/nantong-modern-sporting-industrial-co-ltdhttps://www.ntsportgoods.com/barbell-bars-modern-sporting/',
|
|
|
|
174
|
+ 'https://www.ntsportgoods.com/storage-racks-modern-sporting/',
|
|
|
|
175
|
+ 'https://www.ntsportgoods.com/dumbbells-modern-sporting/',
|
|
|
|
176
|
+ 'https://www.ntsportgoods.com/rubber-plates-modern-sporting/',
|
|
|
|
177
|
+ 'https://www.ntsportgoods.com/training-handles-modern-sporting/https://www.ntsportgoods.com/md4137-201cm-weightlifting-beginner-bar-product',
|
|
|
|
178
|
+ 'https://www.ntsportgoods.com/md4143-220cm-hybrid-training-bar-product',
|
|
|
|
179
|
+ 'https://www.ntsportgoods.com/md4149-powder-coated-pentagon-bar-product',
|
|
|
|
180
|
+ 'https://www.ntsportgoods.com/gym-home-10-pairs-dumbbell-rack-stand-md6242-product',
|
|
|
|
181
|
+ 'https://www.ntsportgoods.com/10-pairs-dumbbell-rack-for-home-gym-workouts-md6247-product',
|
|
|
|
182
|
+ 'https://www.ntsportgoods.com/10-pairs-dumbbell-storage-rack-for-gym-home-md6250-product',
|
|
|
|
183
|
+ 'https://www.ntsportgoods.com/urethane-dumbbells-set-for-strength-training-md2117-product',
|
|
|
|
184
|
+ 'https://www.ntsportgoods.com/md2123-rubber-coated-studio-dumbbells-product',
|
|
|
|
185
|
+ 'https://www.ntsportgoods.com/md2135-12-side-tpu-coated-dumbbells-product',
|
|
|
|
186
|
+ 'https://www.ntsportgoods.com/rubber-bumper-plates-for-weightlifting-gym-use-md1056-product',
|
|
|
|
187
|
+ 'https://www.ntsportgoods.com/high-quality-rubber-bumper-plates-for-gym-lifting-md1057-product',
|
|
|
|
188
|
+ 'https://www.ntsportgoods.com/md1058-competition-weight-plates-product',
|
|
|
|
189
|
+ 'https://www.ntsportgoods.com/tricep-press-down-bar-for-cable-machines-strength-md5128-product',
|
|
|
|
190
|
+ 'https://www.ntsportgoods.com/md5132-tricep-press-down-bar-product',
|
|
|
|
191
|
+ 'https://www.ntsportgoods.com/md5132-tricep-press-down-bar-product',
|
|
|
|
192
|
+ ],
|
|
|
|
193
|
+ 'liveupsports' => [
|
|
|
|
194
|
+ 'https://www.ntsportgoods.com/supplier/nantong-liveup-sports-co-ltd/',
|
|
|
|
195
|
+ 'https://www.ntsportgoods.com/yoga-pilates-liveup-sports/',
|
|
|
|
196
|
+ 'https://www.ntsportgoods.com/training-equipment-liveup-sports/',
|
|
|
|
197
|
+ 'https://www.ntsportgoods.com/gym-racks-and-equipment-liveup-sports/',
|
|
|
|
198
|
+ 'https://www.ntsportgoods.com/20-25-30cm-pvc-customised-pilates-stability-exercise-ball-inflatable-soft-mini-pilates-small-yoga-bal-product/',
|
|
|
|
199
|
+ 'https://www.ntsportgoods.com/55-65-75cm-bloom-workout-fitness-exercise-balance-gym-abs-anti-burst-yoga-ball-anti-slip-swiss-pilates-ball-product/',
|
|
|
|
200
|
+ 'https://www.ntsportgoods.com/bodybuilding-fitness-exercise-custom-logo-gym-yoga-latex-hip-resistance-bands-loop-bands-set-product/',
|
|
|
|
201
|
+ 'https://www.ntsportgoods.com/bloom-2080x4-5cm-natural-latex-loop-yoga-elastic-stretch-long-resistance-bands-exercise-band-product/',
|
|
|
|
202
|
+ 'https://www.ntsportgoods.com/custom-logo-manufacturer-high-quality-eco-friendly-fitness-pilates-anti-slip-3-10mm-pu-rubber-tpe-cork-nbr-pvc-printed-yoga-mat-product/',
|
|
|
|
203
|
+ 'https://www.ntsportgoods.com/custom-professional-manufacture-cheap-solid-cast-iron-dumbbell-weights-rubber-hex-dumbbell-sets-5-100lb-product/',
|
|
|
|
204
|
+ 'https://www.ntsportgoods.com/professional-wholesale-custom-logo-free-weight-colored-rubber-bumper-gym-weight-barbell-plates-with-kg-mark-product/',
|
|
|
|
205
|
+ 'https://www.ntsportgoods.com/gym-equipment-free-weights-fitness-12-sided-weightlifting-exercise-barbell-weight-lifting-polyurethane-fixed-barbell-product/',
|
|
|
|
206
|
+ 'https://www.ntsportgoods.com/livepro-high-quality-steel-fitness-equipment-training-competition-gym-power-weightlifting-20kg-barbell-bar-product/',
|
|
|
|
207
|
+ 'https://www.ntsportgoods.com/livepro-gym-commercial-equipment-fitness-storage-system-professional-multifunctional-training-frame-gym-storage-rack-product/',
|
|
|
|
208
|
+ 'https://www.ntsportgoods.com/livepro-commercial-floor-mount-free-standing-cross-training-gym-rigs-multi-functional-training-rack-fitness-gym-rig-product/',
|
|
|
|
209
|
+ 'https://www.ntsportgoods.com/livepro-oem-odm-fitness-equipment-multi-functional-trainer-smith-machine-station-home-using-gym-full-frame-cage-squat-power-rack-product/',
|
|
|
|
210
|
+ ],
|
|
|
|
211
|
+ 'topflor' => [
|
|
|
|
212
|
+ 'https://www.ntsportgoods.com/supplier/nantong-topflor-co-ltd/',
|
|
|
|
213
|
+ 'https://www.ntsportgoods.com/sports-flooring-topflor/',
|
|
|
|
214
|
+ 'https://www.ntsportgoods.com/healthcare-flooring-topflor/',
|
|
|
|
215
|
+ 'https://www.ntsportgoods.com/gym-flooring-topflor/',
|
|
|
|
216
|
+ 'https://www.ntsportgoods.com/sprint-track-turf-for-high-performance-indoor-and-outdoor-training-product/',
|
|
|
|
217
|
+ 'https://www.ntsportgoods.com/durable-gym-rubber-flooring-with-shock-absorption-and-slip-resistance-product/',
|
|
|
|
218
|
+ 'https://www.ntsportgoods.com/interlocking-gym-flooring-tilesinterlocking-gym-flooring-tiles-product/',
|
|
|
|
219
|
+ 'https://www.ntsportgoods.com/premium-hospital-vinyl-flooring-with-anti-bacterial-and-easy-clean-surface-product/',
|
|
|
|
220
|
+ 'https://www.ntsportgoods.com/high-performance-healthcare-flooring-for-safe-and-hygienic-environments-product/',
|
|
|
|
221
|
+ 'https://www.ntsportgoods.com/homogeneous-vinyl-flooring-with-high-durability-and-low-maintenance-product/',
|
|
|
|
222
|
+ 'https://www.ntsportgoods.com/clinic-vinyl-flooring-with-anti-bacterial-and-wear-resistant-properties-product/',
|
|
|
|
223
|
+ 'https://www.ntsportgoods.com/medical-pvc-flooring-with-anti-slip-hygienic-and-durable-features-product/',
|
|
|
|
224
|
+ 'https://www.ntsportgoods.com/professional-badminton-court-pvc-sports-flooring-with-high-grip-and-shock-absorption-product/',
|
|
|
|
225
|
+ 'https://www.ntsportgoods.com/indoor-basketball-sports-flooring-with-superior-ball-bounce-and-player-comfort-product/',
|
|
|
|
226
|
+ 'https://www.ntsportgoods.com/multi-sport-indoor-pvc-flooring-for-volleyball-handball-badminton-and-fitness-product/',
|
|
|
|
227
|
+ 'https://www.ntsportgoods.com/durable-multi-purpose-sports-flooring-for-schools-gyms-and-community-centers-product/',
|
|
|
|
228
|
+ 'https://www.ntsportgoods.com/high-performance-multi-use-indoor-sports-flooring-with-easy-maintenance-product/',
|
|
|
|
229
|
+ ],
|
|
|
|
230
|
+
|
|
|
|
231
|
+ ];
|
|
|
|
232
|
+ foreach ($url_map as $k=>$urls) {
|
|
|
|
233
|
+ if(in_array($referer, $urls)) {
|
|
|
|
234
|
+ return $mail_mobile_map[$k];
|
|
|
|
235
|
+ }
|
|
|
|
236
|
+ }
|
|
|
|
237
|
+ return $mail_mobile_map[array_rand($mail_mobile_map)];
|
|
|
|
238
|
+ }
|
|
|
|
239
|
+
|
|
|
|
240
|
+ /**
|
|
121
|
* 特殊项目 邮件模版
|
241
|
* 特殊项目 邮件模版
|
|
122
|
* FIXME 后期有多个特殊项目,需要按照项目ID设置模板
|
242
|
* FIXME 后期有多个特殊项目,需要按照项目ID设置模板
|
|
123
|
* @param $name
|
243
|
* @param $name
|
|
@@ -128,7 +248,7 @@ class InquiryFormData extends Base |
|
@@ -128,7 +248,7 @@ class InquiryFormData extends Base |
|
128
|
* @param $country
|
248
|
* @param $country
|
|
129
|
* @return string
|
249
|
* @return string
|
|
130
|
*/
|
250
|
*/
|
|
131
|
- public static function specialInquiryTemplate($name, $email, $phone, $message, $domain, $country)
|
251
|
+ public static function specialInquiryTemplate($name, $email, $phone, $message, $domain, $ip, $country)
|
|
132
|
{
|
252
|
{
|
|
133
|
$template = "
|
253
|
$template = "
|
|
134
|
客户姓名:$name
|
254
|
客户姓名:$name
|
|
@@ -139,7 +259,7 @@ class InquiryFormData extends Base |
|
@@ -139,7 +259,7 @@ class InquiryFormData extends Base |
|
139
|
$message
|
259
|
$message
|
|
140
|
--------------------------------------------------------------------
|
260
|
--------------------------------------------------------------------
|
|
141
|
发送询盘网址: $domain
|
261
|
发送询盘网址: $domain
|
|
142
|
-客户IP地址: [ip]
|
262
|
+客户IP地址: $ip
|
|
143
|
IP所在国家/地区: $country
|
263
|
IP所在国家/地区: $country
|
|
144
|
--------------------------------------------------------------------";
|
264
|
--------------------------------------------------------------------";
|
|
145
|
return $template;
|
265
|
return $template;
|