655 lines
32 KiB
PHP
655 lines
32 KiB
PHP
<?php
|
||
|
||
namespace app\KitchenScale3\controller\app;
|
||
|
||
|
||
use think\Db;
|
||
use PHPMailer\PHPMailer\PHPMailer;
|
||
|
||
|
||
class Login extends Base{
|
||
protected $code_time = 55;
|
||
// protected $token_time = 2592000;//30天的秒数
|
||
protected $default_head_pic = 'http://tc.pcxbc.com/tsf/head_pic.png';
|
||
protected $login_use_db_name = [
|
||
'account'=>'app_user_data_multilingual',
|
||
];
|
||
protected $language_country = [
|
||
'zh' => ['中文','zh'], // 中文(简体)★
|
||
'en' => ['English','en'], // 英语(通用)★
|
||
'jp' => ['日本語(Japanese)','ja'], // 日语(变化)
|
||
'fra' => ['Français(French)','fr'], // 法语(变化)
|
||
'de' => ['Deutsch(German)','de'], // 德语
|
||
'kor' => ['한국어(Korean)','ko'], // 韩语(变化)
|
||
'ru' => ['Русский(Russian)','ru'], // 俄语
|
||
'pt' => ['Português(Portuguese)','pt'], // 葡萄牙
|
||
'spa' => ["Español(Spanish)",'es'], // 西班牙(变化)
|
||
'ara' => ['Arabic(العربية)','ar'], // 阿拉伯(变化)
|
||
];
|
||
|
||
################################################################接口################################################################
|
||
################################################################接口################################################################
|
||
################################################################接口################################################################
|
||
|
||
// 注册
|
||
public function register_action(){
|
||
try {
|
||
// 你的业务逻辑
|
||
// 验证是否前段发送过来的数据
|
||
$data = input('post.');
|
||
// 验证数据项是否完整
|
||
if(!array_key_exists('data', $data)){
|
||
return $this->msg(10001,'data is miss');
|
||
}
|
||
if(!array_key_exists('password', $data)){
|
||
return $this->msg(10001,'password is miss');
|
||
}
|
||
if(!array_key_exists('confirm_password', $data)){
|
||
return $this->msg(10001,'confirm_password is miss');
|
||
}
|
||
if(!array_key_exists('code', $data)){
|
||
return $this->msg(10001,'code is miss');
|
||
}
|
||
if(!array_key_exists('language', $data)){
|
||
return $this->msg(10001,'language is miss');
|
||
}
|
||
|
||
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
||
return $this->msg(10005,'data type is error');
|
||
}else{
|
||
if(strlen($data['data']) > 50){
|
||
return $this->msg(10005,'email too long');
|
||
}
|
||
}
|
||
|
||
if(!$this->verify_data_is_ok($data['password'],'str')){
|
||
return $this->msg(10005,'password type is error');
|
||
}else{
|
||
if(!strlen($data['password']) > 50){
|
||
return $this->msg(10005,'password too long');
|
||
}else{
|
||
if($data['password'] != $data['confirm_password']){
|
||
return $this->msg(10005,'The two passwords entered do not match.');
|
||
}
|
||
}
|
||
}
|
||
if(!array_key_exists($data['language'],$this->language_country)){
|
||
return $this->msg(10005,'language type is error');
|
||
}
|
||
|
||
|
||
$cfc = Db::connect('cfc_db');
|
||
// 查询账号是否已经注册
|
||
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'is_del'=>0])->field('id,token')->find();
|
||
|
||
if($inspect_repeat){
|
||
return $this->msg(10002,'Registration failed. Account already exists.');
|
||
}
|
||
|
||
|
||
|
||
// 检查验证码
|
||
$code_result = $this->check_code($data['data'],$data['code']);
|
||
if($code_result !== true){
|
||
return $this->msg(10002,'Verification code is incorrect or invalid.');
|
||
}
|
||
|
||
// 验证完之后
|
||
$set_data = [];
|
||
$set_data['password'] = $data['password'];
|
||
$set_data['account'] = $data['data'];
|
||
$set_data['head_pic'] = $this->default_head_pic;
|
||
$set_data['nickname'] = '用户'.time();
|
||
$set_data['create_time'] = date('Y-m-d H:i:s');
|
||
$set_data['login_time'] = date('Y-m-d H:i:s');
|
||
$set_data['language'] = $data['language'];
|
||
$set_data['token'] = md5($data['data'].$this->create_random_string(12).time());
|
||
|
||
$result = $cfc->table($this->login_use_db_name['account'])->insertGetId($set_data);
|
||
if($result){
|
||
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$result]);
|
||
}else{
|
||
return $this->msg(10002);
|
||
}
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "方法: " . __METHOD__ . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
}
|
||
// 登录
|
||
public function login_action(){
|
||
try {
|
||
// 你的业务逻辑
|
||
$data = input('post.');
|
||
|
||
if(!array_key_exists('data', $data)){
|
||
return $this->msg(10001,'data is miss');
|
||
}
|
||
if(!array_key_exists('validate_data', $data)){
|
||
return $this->msg(10001,'validate_data is miss');
|
||
}
|
||
if(!array_key_exists('validate_type', $data)){
|
||
return $this->msg(10001,'validate_type is miss');
|
||
}
|
||
if(!array_key_exists('language', $data)){
|
||
return $this->msg(10001,'language is miss');
|
||
}
|
||
|
||
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
||
return $this->msg(10005,'data type is error');
|
||
}else{
|
||
if(strlen($data['data']) > 50){
|
||
return $this->msg(10005,'email too long');
|
||
}
|
||
}
|
||
if(!array_key_exists($data['language'],$this->language_country)){
|
||
return $this->msg(10005,'language type is error');
|
||
}
|
||
|
||
|
||
$cfc = Db::connect('cfc_db');
|
||
|
||
if($data['validate_type'] == 'code'){
|
||
if(!$this->verify_data_is_ok($data['validate_data'],'intnum')){
|
||
return $this->msg(10005,'validate_data type is error');
|
||
}
|
||
|
||
// 检查验证码
|
||
$code_result = $this->check_code($data['data'],$data['validate_data']);
|
||
if($code_result !== true){
|
||
return $this->msg(20001,'Verification code is incorrect or invalid.');
|
||
}
|
||
|
||
|
||
$code_name = $data['data'];
|
||
if($this->check_code($code_name,$data['validate_data']) === true){
|
||
// 查询账号是否已经注册
|
||
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'is_del'=>0])->field('id,token,language')->find();
|
||
if($inspect_repeat){
|
||
$cfc->table($this->login_use_db_name['account'])->where(['token'=>$inspect_repeat['token']])->update(['login_time'=>date('Y-m-d H:i:s'),'language'=>$data['language']]);
|
||
return $this->msg(['token'=>$inspect_repeat['token'],'aan_id'=>$inspect_repeat['id'],'language'=>$this->language_country[$data['language']][1]]);
|
||
}else{
|
||
// $set_data = [];
|
||
$set_data['password'] = '123456';
|
||
$set_data['account'] = $data['data'];
|
||
$set_data['head_pic'] = $this->default_head_pic;
|
||
$set_data['nickname'] = '用户'.time();
|
||
$set_data['create_time'] = date('Y-m-d H:i:s');
|
||
$set_data['login_time'] = date('Y-m-d H:i:s');
|
||
$set_data['language'] = $data['language'];
|
||
$set_data['token'] = md5($data['data'].$this->create_random_string(12).time());
|
||
$result_add = $cfc->table($this->login_use_db_name['account'])->insertGetId($set_data);
|
||
if($result_add){
|
||
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$result_add,'language'=>$this->language_country[$data['language']][1]]);
|
||
}else{
|
||
return $this->msg(10002,'Login failed. Please try again later.');
|
||
}
|
||
}
|
||
}else{
|
||
return $this->msg(10002,'Login failed. Verification code is incorrect or expired.');
|
||
}
|
||
}else if($data['validate_type'] == 'password'){
|
||
if(!$this->verify_data_is_ok($data['validate_data'],'str')){
|
||
return $this->msg(10005,'validate_data type is error');
|
||
}else{
|
||
if(strlen($data['validate_data']) > 50){
|
||
return $this->msg(10005,'password too long');
|
||
}
|
||
}
|
||
// 查询账号是否已经注册
|
||
$inspect_repeat = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'password'=>$data['validate_data'],'is_del'=>0])->field('id,token,language')->find();
|
||
|
||
if($inspect_repeat){
|
||
|
||
$cfc->table($this->login_use_db_name['account'])->where(['token'=>$inspect_repeat['token']])->update(['login_time'=>date('Y-m-d H:i:s')]);
|
||
|
||
return $this->msg(['token'=>$inspect_repeat['token'],'aan_id'=>$inspect_repeat['id'],'language'=>$this->language_country[$inspect_repeat['language']][1]]);
|
||
}else{
|
||
return $this->msg(10003,'Account not registered. Please sign up first.');
|
||
$set_data['password'] = $data['validate_data'];
|
||
$set_data['account'] = $data['data'];
|
||
$set_data['head_pic'] = $this->default_head_pic;
|
||
$set_data['nickname'] = '用户'.time();
|
||
$set_data['create_time'] = date('Y-m-d H:i:s');
|
||
$set_data['login_time'] = date('Y-m-d H:i:s');
|
||
$set_data['language'] = $data['language'];
|
||
$set_data['token'] = md5($data['data'].$this->create_random_string(12).time());
|
||
$result_add = $cfc->table($this->login_use_db_name['account'])->insertGetId($set_data);
|
||
if($result_add){
|
||
return $this->msg(['token'=>$set_data['token'],'aan_id'=>$result_add,'language'=>$this->language_country[$data['language']][1]]);
|
||
}else{
|
||
return $this->msg(10002,'Login failed. Please try again later.');
|
||
}
|
||
}
|
||
}else{
|
||
return $this->msg(10005,'validate_type type is error');
|
||
}
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "方法: " . __METHOD__ . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
|
||
}
|
||
// 退出登录操作
|
||
public function user_quit_account($data=['token'=>'0dafb98a10995c98b5a33b7d59d986ca']){
|
||
try {
|
||
// 你的业务逻辑
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}
|
||
if(!array_key_exists('token', $data)){
|
||
$return_data = $this->msg(10001);
|
||
}
|
||
// if($this->token_time_validate($data['token']) === false){
|
||
// $return_data = $this->msg(20001);
|
||
// }
|
||
$cfc = Db::connect('cfc_db');
|
||
$result = $cfc->table($this->login_use_db_name['account'])->where(['token'=>$data['token']])->update(['login_time'=>'2000-01-01 00:00:00']);
|
||
if($result){
|
||
$return_data = $this->msg([]);
|
||
}else{
|
||
$return_data = $this->msg(10002);
|
||
}
|
||
// 成功
|
||
$this->record_api_log($data, null, $return_data);
|
||
return $return_data;
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "方法: " . __METHOD__ . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
}
|
||
|
||
// 重置密码
|
||
public function reset_password(){
|
||
$data = input('post.');
|
||
try {
|
||
// 你的业务逻辑
|
||
// 验证是否前段发送过来的数据
|
||
|
||
// 验证数据项是否完整
|
||
if(!array_key_exists('token', $data) || !array_key_exists('data', $data) || !array_key_exists('password', $data) || !array_key_exists('c_password', $data) || !array_key_exists('code', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
// 验证数据值是否合规
|
||
if($data['password'] != $data['c_password']){
|
||
return $this->msg(10003,'The two passwords entered do not match.');
|
||
}
|
||
if($data['password'] == ''){
|
||
return $this->msg(10003,'Password cannot be empty.');
|
||
}
|
||
if(!$this->verify_data_is_ok($data['password'],'str')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['code'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
// 检查验证码
|
||
$code_result = $this->check_code($data['data'],$data['code']);
|
||
if($code_result !== true){
|
||
return $this->msg(10003,$code_result);
|
||
}
|
||
|
||
if (!preg_match('/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/', $data['data'])) {
|
||
return $this->msg(10005,'data type is error');
|
||
}else{
|
||
if(strlen($data['data']) > 50){
|
||
return $this->msg(10005,'email too long');
|
||
}
|
||
}
|
||
|
||
|
||
// $t_y = $this->is_tel_email($data['data']);
|
||
// if($t_y === false){
|
||
// return $this->msg(10003,'账号格式错误');
|
||
// }
|
||
|
||
$cfc = Db::connect('cfc_db');
|
||
|
||
// 检查账号是否存在
|
||
$find_data = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data'],'is_del'=>0])->field('id,token')->find();
|
||
if(!$find_data){
|
||
return $this->msg(10003);
|
||
}
|
||
|
||
$result = $cfc->table($this->login_use_db_name['account'])->where(['account'=>$data['data']])->update(['password'=>$data['password']]);
|
||
|
||
if($result){
|
||
return $this->msg(['token'=>$find_data['token'],'aan_id'=>$find_data['id']]);
|
||
}else{
|
||
return $this->msg(10002);
|
||
}
|
||
|
||
// 成功
|
||
// $this->record_api_log($data, null, $return_data);
|
||
// return $return_data;
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "方法: " . __METHOD__ . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
}
|
||
|
||
|
||
|
||
// 删除账号
|
||
public function delete_account(){
|
||
$data = input('post.');
|
||
try {
|
||
// 你的业务逻辑
|
||
|
||
if(!array_key_exists('token', $data) || !array_key_exists('code', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['token'],'str')){
|
||
return $this->msg(10005);
|
||
}
|
||
if(!$this->verify_data_is_ok($data['code'],'num')){
|
||
return $this->msg(10005);
|
||
}
|
||
|
||
|
||
$cfc = Db::connect('cfc_db');
|
||
|
||
$account_data = $cfc->table($this->login_use_db_name['account'])->where(['token'=>$data['token']])->field('id,token,account')->find();
|
||
|
||
// dump($account_data);
|
||
// die;
|
||
// 检查验证码
|
||
$code_result = $this->check_code($account_data['account'],$data['code']);
|
||
|
||
|
||
if($code_result !== true){
|
||
return $this->msg(10003,$code_result);
|
||
}
|
||
|
||
$result = $cfc->table($this->login_use_db_name['account'])->where(['token'=>$data['token']])->update(['is_del'=>1]);
|
||
|
||
if($result){
|
||
return $this->msg([]);
|
||
}else{
|
||
return $this->msg(10002);
|
||
}
|
||
} catch (\Exception $e) {
|
||
// 捕获异常
|
||
$logContent["flie"] = $e->getFile();
|
||
$logContent["line"] = $e->getLine();
|
||
$logContent['all_content'] = "异常信息:\n";
|
||
$logContent['all_content'] .= "消息: " . $e->getMessage() . "\n";
|
||
$logContent['all_content'] .= "代码: " . $e->getCode() . "\n";
|
||
$logContent['all_content'] .= "文件: " . $e->getFile() . "\n";
|
||
$logContent['all_content'] .= "方法: " . __METHOD__ . "\n";
|
||
$logContent['all_content'] .= "行号: " . $e->getLine() . "\n";
|
||
$logContent['all_content'] .= "跟踪信息:\n" . $e->getTraceAsString() . "\n";
|
||
$this->record_api_log($data, $logContent, null);
|
||
return $this->msg(99999);
|
||
}
|
||
|
||
}
|
||
|
||
################################################################接口################################################################
|
||
################################################################接口################################################################
|
||
################################################################接口################################################################
|
||
|
||
|
||
|
||
// 发送验证码 手机/邮箱
|
||
/* 接口说明(发邮件)
|
||
* $data(手机或者邮箱信息) 字符串
|
||
* $type(验证类型,是注册用,还是其他用途) 字符串 默认register(注册)(register、login、reset_password)
|
||
* $road(是手机还是邮箱还是其他) 字符串 默认tel或email
|
||
*/
|
||
//18736019909
|
||
public function send_phone_email_code($data = ['data'=>'18736019909']){
|
||
|
||
if(count(input('post.')) > 0){
|
||
$data = input('post.');
|
||
}
|
||
if(!array_key_exists('data', $data)){
|
||
return $this->msg(10001);
|
||
}
|
||
|
||
if(cache($data['data'].'_cfc_multilingual')){
|
||
return $this->msg(10002,'You can only send a verification code once every 60 seconds.');
|
||
}
|
||
|
||
$num = mt_rand(100000,999999);
|
||
|
||
$result = $this->send_email_code([$data['data']],['title'=>'CAPTCHA','from_user_name'=>'Wendu','content'=>$num]);
|
||
if(is_array($result) && $result['code'] == 0){
|
||
cache($data['data'].'_cfc_multilingual', $num, $this->code_time);
|
||
return $this->msg([]);
|
||
}else{
|
||
return $this->msg(10010,'Failed to send verification code.');
|
||
}
|
||
|
||
}
|
||
|
||
################################内部调用################################
|
||
|
||
/* 接口说明(发邮件)
|
||
* $address(收件人的邮箱地址) 数组 格式: ['460834639@qq.com','460834639@qq.com'.......]
|
||
* $content(邮件的主题数据信息) 数组 格式:['title'=>'123','from_user_name'=>'123','content'=>'123']
|
||
* $annex(附件路径信息) 字符串
|
||
*/
|
||
public function send_email_code($address,$content,$annex=''){
|
||
// $ad = '460834639@qq.com';
|
||
$ad1 = '295155911@qq.com';
|
||
$mail = new PHPMailer(); //实例化
|
||
$mail->IsSMTP(); // 启用SMTP
|
||
$mail->Host = "smtp.126.com"; //SMTP服务器 163邮箱例子
|
||
$mail->Port = 465; //邮件发送端口
|
||
$mail->SMTPAuth = true; //启用SMTP认证
|
||
$mail->SMTPSecure = 'ssl';
|
||
$mail->CharSet = "UTF-8"; //字符集
|
||
$mail->Encoding = "base64"; //编码方式
|
||
$mail->Username = "tsf3920322@126.com"; //你的邮箱
|
||
$mail->Password = "HLWXNRPUCTHJFIIX"; //你的密码(邮箱后台的授权密码)
|
||
$mail->From = "tsf3920322@126.com"; //发件人地址(也就是你的邮箱)
|
||
|
||
// $mail->Subject = "微盟测试邮件"; //邮件标题
|
||
$mail->Subject = $content['title']; //邮件标题
|
||
|
||
// $mail->FromName = "微盟体测中心"; //发件人姓名
|
||
$mail->FromName = $content['from_user_name']; //发件人姓名
|
||
|
||
|
||
for ($i=0; $i < count($address); $i++) {
|
||
$mail->AddAddress($address[$i], ""); //添加收件人(地址,昵称)
|
||
}
|
||
|
||
if($annex != ''){
|
||
// $url = ROOT_PATH. 'public' . DS . 'tsf' . DS .'demoooo.jpg';
|
||
$mail->AddAttachment($annex,''); // 添加附件,并指定名称
|
||
}
|
||
|
||
$mail->IsHTML(true); //支持html格式内容
|
||
|
||
$huashu1 = 'Wendu';
|
||
$huashu2 = 'Thank you for choosing Wendu products!';
|
||
$huashu3 = 'The following 6-digit number is the email verification code. Please enter it in the required field to pass verification.';
|
||
$huashu4 = '(If you did not request an email verification code, please ignore this message.)';
|
||
|
||
$neirong = '<div style="margin: 0; padding: 0;">
|
||
|
||
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="background: #f3f3f3; min-width: 350px; font-size: 1px; line-height: normal;">
|
||
<tbody><tr>
|
||
<td align="center" valign="top">
|
||
|
||
<table cellpadding="0" cellspacing="0" border="0" width="750" class="table750" style="width: 100%; max-width: 750px; min-width: 350px; background: #f3f3f3;">
|
||
<tbody><tr>
|
||
<td class="mob_pad" width="25" style="width: 25px; max-width: 25px; min-width: 25px;"> </td>
|
||
<td align="center" valign="top" style="background: #ffffff;">
|
||
|
||
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="width: 100% !important; min-width: 100%; max-width: 100%; background: #f3f3f3;">
|
||
<tbody><tr>
|
||
<td align="right" valign="top">
|
||
<div class="top_pad" style="height: 25px; line-height: 25px; font-size: 23px;"> </div>
|
||
</td>
|
||
</tr>
|
||
</tbody></table>
|
||
|
||
<table cellpadding="0" cellspacing="0" border="0" width="88%" style="width: 88% !important; min-width: 88%; max-width: 88%;">
|
||
<tbody><tr>
|
||
<td align="left" valign="top">
|
||
<div style="height: 39px; line-height: 39px; font-size: 37px;"> </div>
|
||
<font class="mob_title1" face="\'Source Sans Pro\', sans-serif" color="#1a1a1a" style="font-size: 52px; line-height: 55px; font-weight: 300; letter-spacing: -1.5px;">
|
||
<span class="mob_title1" style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #fb966e; font-size: 48px; line-height: 55px; font-weight: 700; letter-spacing: -1.5px;">'.$huashu1.'</span>
|
||
</font>
|
||
<div style="height: 73px; line-height: 73px; font-size: 71px;"> </div>
|
||
</td>
|
||
</tr>
|
||
</tbody></table>
|
||
|
||
<table cellpadding="0" cellspacing="0" border="0" width="88%" style="width: 88% !important; min-width: 88%; max-width: 88%;">
|
||
<tbody><tr>
|
||
<td align="left" valign="top">
|
||
<div style="height: 33px; line-height: 33px; font-size: 31px;"> </div>
|
||
<font face="\'Nunito\', sans-serif" color="#585858" style="font-size: 24px; line-height: 32px;">
|
||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #585858; font-size: 24px; line-height: 32px;">'.$huashu2.'</span>
|
||
</font>
|
||
<div style="height: 33px; line-height: 33px; font-size: 31px;"> </div>
|
||
<font face="\'Nunito\', sans-serif" color="#585858" style="font-size: 24px; line-height: 32px;">
|
||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #585858; font-size: 24px; line-height: 32px;">'.$huashu3.'</span>
|
||
</font>
|
||
<div style="height: 18px; line-height: 33px; font-size: 31px;"> </div>
|
||
<font face="\'Nunito\', sans-serif" color="#585858" style="font-size: 24px; line-height: 32px;">
|
||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #aaaaaa; font-size: 16px; line-height: 32px;">'.$huashu4.'</span>
|
||
</font>
|
||
<div style="height: 33px; line-height: 33px; font-size: 31px;"> </div>
|
||
<table class="mob_btn" cellpadding="0" cellspacing="0" border="0" style="background: #fb966e; border-radius: 4px;">
|
||
<tbody><tr>
|
||
<td align="center" valign="top">
|
||
<span style="display: block; border: 1px solid #fb966e; border-radius: 0px; padding: 6px 12px; font-family: \'Nunito\', Arial, Verdana, Tahoma, Geneva, sans-serif; color: #ffffff; font-size: 20px; line-height: 30px; text-decoration: none; white-space: nowrap; font-weight: 600;">
|
||
<font face="\'Nunito\', sans-serif" color="#ffffff" style="font-size: 20px; line-height: 30px; text-decoration: none; white-space: nowrap; font-weight: 600;">
|
||
<span style="font-family: \'Nunito\', Arial, Verdana, Tahoma, Geneva, sans-serif; color: #ffffff; font-size: 20px; line-height: 30px; text-decoration: none; white-space: nowrap; font-weight: 600;">'.$content['content'].'</span>
|
||
</font>
|
||
</span>
|
||
</td>
|
||
</tr>
|
||
</tbody></table>
|
||
<div style="height: 75px; line-height: 75px; font-size: 73px;"> </div>
|
||
</td>
|
||
</tr>
|
||
</tbody></table>
|
||
|
||
<table cellpadding="0" cellspacing="0" border="0" width="100%" style="width: 100% !important; min-width: 100%; max-width: 100%; background: #f3f3f3;">
|
||
<tbody><tr>
|
||
<td align="center" valign="top">
|
||
<div style="height: 34px; line-height: 34px; font-size: 32px;"> </div>
|
||
<table cellpadding="0" cellspacing="0" border="0" width="88%" style="width: 88% !important; min-width: 88%; max-width: 88%;">
|
||
<tbody><tr>
|
||
<td align="center" valign="top">
|
||
<div style="height:12px; line-height: 34px; font-size: 32px;"> </div>
|
||
<font face="\'Nunito\', sans-serif" color="#868686" style="font-size: 17px; line-height: 20px;">
|
||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #868686; font-size: 17px; line-height: 20px;">© Zhengzhou Pinchuan Technology Co., Ltd. </span>
|
||
</font>
|
||
<div style="height: 3px; line-height: 3px; font-size: 1px;"> </div>
|
||
<font face="\'Nunito\', sans-serif" color="#1a1a1a" style="font-size: 17px; line-height: 20px;">
|
||
<span style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #1a1a1a; font-size: 17px; line-height: 20px;"><a target="_blank" style="font-family: \'Nunito\', Arial, Tahoma, Geneva, sans-serif; color: #1a1a1a; font-size: 17px; line-height: 20px; text-decoration: none;" href="https://paoluz.link/"></a></span>
|
||
</font>
|
||
<div style="height: 35px; line-height: 35px; font-size: 33px;"> </div>
|
||
</td>
|
||
</tr>
|
||
</tbody></table>
|
||
</td>
|
||
</tr>
|
||
</tbody></table>
|
||
|
||
</td>
|
||
<td class="mob_pad" width="25" style="width: 25px; max-width: 25px; min-width: 25px;"> </td>
|
||
</tr>
|
||
</tbody></table>
|
||
|
||
</td>
|
||
</tr>
|
||
</tbody></table>
|
||
</div>';
|
||
|
||
$mail->Body = $neirong; //邮件主体内容
|
||
//发送
|
||
if (!$mail->Send()) {
|
||
|
||
return ['code' => 10003,'msg'=>$mail->ErrorInfo];
|
||
// return $mail->ErrorInfo;
|
||
} else {
|
||
return ['code' => 0];
|
||
// return 'success';
|
||
}
|
||
}
|
||
|
||
|
||
|
||
public function check_code($data = 18530934717 , $code = 123456){
|
||
// // 默认验证码正确
|
||
|
||
if(cache($data.'_cfc_multilingual') == false){
|
||
return '验证码过期';
|
||
}else{
|
||
if($code != cache($data.'_cfc_multilingual')){
|
||
return '验证码错误';
|
||
}
|
||
}
|
||
return true;
|
||
}
|
||
################################################################other################################################################
|
||
################################################################other################################################################
|
||
################################################################other################################################################
|
||
|
||
|
||
public function create_random_string($length = 12)
|
||
{
|
||
//创建随机字符
|
||
$chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||
$str = "";
|
||
for ($i = 0; $i < $length; $i++) {
|
||
$str .= substr($chars, mt_rand(0, strlen($chars) - 1), 1);
|
||
}
|
||
return $str;
|
||
}
|
||
|
||
|
||
|
||
} |