作者 刘锟

合并分支 'akun' 到 'master'

Akun



查看合并请求 !1307
@@ -9,6 +9,7 @@ @@ -9,6 +9,7 @@
9 namespace App\Console\Commands\Inquiry; 9 namespace App\Console\Commands\Inquiry;
10 10
11 use App\Helper\Translate; 11 use App\Helper\Translate;
  12 +use App\Helper\Validate;
12 use App\Models\Inquiry\InquiryInfo; 13 use App\Models\Inquiry\InquiryInfo;
13 use App\Services\InquiryRelayService; 14 use App\Services\InquiryRelayService;
14 use Illuminate\Console\Command; 15 use Illuminate\Console\Command;
@@ -167,7 +168,20 @@ class SyncInquiryRelay extends Command @@ -167,7 +168,20 @@ class SyncInquiryRelay extends Command
167 $data['image'] = ''; 168 $data['image'] = '';
168 } 169 }
169 170
170 - $model->createInquiry($data['name'], $data['phone'], $data['email'], $data['ip'], $country, $data['message'], $message_cn, $type, $data['time'], $data['refer'], $data['title'], $keywords, $message_sign, $data['origin_key'], $data['image']); 171 + //判断手机和邮箱是否有效
  172 + $email_status = 0;
  173 + if ($data['email']) {
  174 + $check_email = Validate::email($data['email']);
  175 + $email_status = $check_email ? 1 : 0;
  176 + }
  177 + $phone_status = 0;
  178 + if ($data['phone']) {
  179 + $num_phone = preg_replace('/\D/', '', $data['phone']) ?? ''; // \D 匹配所有非数字字符
  180 + $check_phone = Validate::phone($num_phone);
  181 + $phone_status = $check_phone ? 1 : 0;
  182 + }
  183 +
  184 + $model->createInquiry($data['name'], $data['phone'], $data['email'], $data['ip'], $country, $data['message'], $message_cn, $type, $data['time'], $data['refer'], $data['title'], $keywords, $message_sign, $data['origin_key'], $data['image'], $email_status, $phone_status);
171 return true; 185 return true;
172 } 186 }
173 187
@@ -342,7 +342,7 @@ class InquiryForwardLogic extends BaseLogic @@ -342,7 +342,7 @@ class InquiryForwardLogic extends BaseLogic
342 $rs = $this->model->edit(['status' => $status], ['id' => $this->param['id']]); 342 $rs = $this->model->edit(['status' => $status], ['id' => $this->param['id']]);
343 343
344 if ($rs === false) { 344 if ($rs === false) {
345 - $this->fail('设置无效失败'); 345 + $this->fail('设置失败');
346 } 346 }
347 return $this->success(); 347 return $this->success();
348 } 348 }
@@ -85,9 +85,11 @@ class InquiryInfo extends Base @@ -85,9 +85,11 @@ class InquiryInfo extends Base
85 * @param $message_sign 85 * @param $message_sign
86 * @param $origin_key 86 * @param $origin_key
87 * @param string $image 87 * @param string $image
  88 + * @param int $email_status
  89 + * @param int $phone_status
88 * @return bool 90 * @return bool
89 */ 91 */
90 - public function createInquiry($name, $phone, $email, $ip, $country, $message, $message_cn, $type, $inquiry_date, $url, $url_title, $url_keyword, $message_sign, $origin_key, $image = '') 92 + public function createInquiry($name, $phone, $email, $ip, $country, $message, $message_cn, $type, $inquiry_date, $url, $url_title, $url_keyword, $message_sign, $origin_key, $image = '', $email_status = 0, $phone_status = 0)
91 { 93 {
92 try { 94 try {
93 $self = new self(); 95 $self = new self();