Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pay
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
bp
pay
Commits
f04ab681
Commit
f04ab681
authored
Nov 23, 2021
by
顾文旭
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
email
parent
6f430c6c
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
147 additions
and
148 deletions
+147
-148
Daemon.php
vendor/api/php_services/src/Daemon/Daemon.php
+2
-2
InterDynamic.php
vendor/api/php_services/src/Interaction/InterDynamic.php
+1
-1
Ks3Api.php
vendor/api/php_services/src/Ksy/Ks3Api.php
+59
-81
RedisSession.php
vendor/api/php_services/src/Session/RedisSession.php
+2
-2
RedisSessionHandler.php
vendor/api/php_services/src/Session/RedisSessionHandler.php
+1
-1
CacheUtil.php
vendor/api/php_utils/src/Cache/CacheUtil.php
+7
-7
FileLog.php
vendor/api/php_utils/src/Log/FileLog.php
+3
-4
Email.php
vendor/api/php_utils/src/Message/Email.php
+71
-49
RedisUtil.php
vendor/api/php_utils/src/Redis/RedisUtil.php
+1
-1
No files found.
vendor/api/php_services/src/Daemon/Daemon.php
View file @
f04ab681
...
@@ -192,8 +192,8 @@ class Daemon
...
@@ -192,8 +192,8 @@ class Daemon
'host name: '
.
gethostname
()
.
"
\r\n
"
;
'host name: '
.
gethostname
()
.
"
\r\n
"
;
// $to = 'api@yidian-inc.com';
// $to = 'api@yidian-inc.com';
$to
=
'
zhangyu1@yidian-inc
.com'
;
$to
=
'
wenxu.gu@linkingcities
.com'
;
Email
::
sendMail
(
'
bp-noreply@yidian-inc
.com'
,
$to
,
$subject
,
$mail_body
);
Email
::
sendMail
(
'
noreply@linkingcities
.com'
,
$to
,
$subject
,
$mail_body
);
}
}
}
}
}
}
...
...
vendor/api/php_services/src/Interaction/InterDynamic.php
View file @
f04ab681
...
@@ -35,7 +35,7 @@ class InterDynamic
...
@@ -35,7 +35,7 @@ class InterDynamic
$this
->
fields
=
array_keys
(
$this
->
key_map
);
$this
->
fields
=
array_keys
(
$this
->
key_map
);
$this
->
reverse_map
=
array_flip
(
$this
->
key_map
);
$this
->
reverse_map
=
array_flip
(
$this
->
key_map
);
// //文章动态计数哨兵集群 Sentinel apiConnect
// //文章动态计数哨兵集群 Sentinel apiConnect
$this
->
redis
=
RedisUtil
::
getInstance
(
'c
ount
'
,
[
'serializer'
=>
'none'
,
'master'
=>
$useMaster
]);
$this
->
redis
=
RedisUtil
::
getInstance
(
'c
ache
'
,
[
'serializer'
=>
'none'
,
'master'
=>
$useMaster
]);
}
}
public
function
get
(
$docid
,
array
$fields
=
array
())
public
function
get
(
$docid
,
array
$fields
=
array
())
...
...
vendor/api/php_services/src/Ksy/Ks3Api.php
View file @
f04ab681
...
@@ -5,6 +5,12 @@ namespace Api\PhpServices\Ksy;
...
@@ -5,6 +5,12 @@ namespace Api\PhpServices\Ksy;
use
Api\PhpUtils\Http\HttpUtil
;
use
Api\PhpUtils\Http\HttpUtil
;
use
Api\PhpUtils\Mon\MonUtil
;
use
Api\PhpUtils\Mon\MonUtil
;
// 引入鉴权类
use
Qiniu\Auth
;
// 引入上传类
use
Qiniu\Storage\UploadManager
;
/**
/**
* 文档: http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=68515904
* 文档: http://ydwiki.yidian-inc.com/pages/viewpage.action?pageId=68515904
* Class Ks3Api
* Class Ks3Api
...
@@ -144,31 +150,60 @@ class Ks3Api
...
@@ -144,31 +150,60 @@ class Ks3Api
*/
*/
public
static
function
upload
(
$type
)
public
static
function
upload
(
$type
)
{
{
$url
=
self
::
BASE_URL
.
self
::
PATH_PIC_UPLOAD
;
// 控制台获取密钥:https://portal.qiniu.com/user/key
$timestamp
=
self
::
msectime
();
$accessKey
=
"v8h5axBiWk5aoyNV-xlWcnmAZdKOHPKeqXp2yJRc"
;
$secretKey
=
"kbTIQ2mfpzsWnV9o6iWm7gSHds3lKOWaV5jYzTB9"
;
$handle
=
fopen
(
$_FILES
[
'file'
][
'tmp_name'
],
'r'
);
$bucket
=
"pinyipin"
;
$content
=
fread
(
$handle
,
filesize
(
$_FILES
[
'file'
][
'tmp_name'
]));
// 构建鉴权对象
$extend
=
[
"type"
=>
$type
];
$auth
=
new
Auth
(
$accessKey
,
$secretKey
);
$extendJsonStr
=
json_encode
(
$extend
);
$md5Str
=
$extendJsonStr
.
"&"
.
md5
(
$content
)
.
"&"
.
$timestamp
.
"&"
.
self
::
KSYUN_SK
;
// 生成上传 Token
$signature
=
self
::
KSYUN_AK
.
":"
.
md5
(
$md5Str
);
$token
=
$auth
->
uploadToken
(
$bucket
);
$params
=
[
"pic"
=>
new
\CURLFile
(
$_FILES
[
'file'
][
'tmp_name'
],
$_FILES
[
'file'
][
'type'
]),
// 初始化 UploadManager 对象并进行文件的上传。
"timestamp"
=>
$timestamp
,
$uploadMgr
=
new
UploadManager
();
"signature"
=>
$signature
,
// 调用 UploadManager 的 putFile 方法进行文件的上传,该方法会判断文件大小,进而决定使用表单上传还是分片上传,无需手动配置。
"extend"
=>
$extendJsonStr
,
list
(
$ret
,
$err
)
=
$uploadMgr
->
putFile
(
$token
,
$_FILES
[
"file"
][
"name"
],
$_FILES
[
'file'
][
'tmp_name'
]);
// $url = self::BASE_URL . self::PATH_PIC_UPLOAD;
// $timestamp = self::msectime();
//
// $handle = fopen($_FILES['file']['tmp_name'], 'r');
// $content = fread($handle, filesize($_FILES['file']['tmp_name']));
//
// $extend = ["type" => $type];
// $extendJsonStr = json_encode($extend);
// $md5Str = $extendJsonStr . "&" . md5($content) . "&" . $timestamp . "&" . self::KSYUN_SK;
// $signature = self::KSYUN_AK . ":" . md5($md5Str);
//
// $params = [
// "pic" => new \CURLFile($_FILES['file']['tmp_name'], $_FILES['file']['type']),
// "timestamp" => $timestamp,
// "signature" => $signature,
// "extend" => $extendJsonStr,
// ];
//
// $begin = microtime(true);
// $uploadRes = HttpUtil::post($url, $params);
// $end = microtime(true);
// $totalTime = round(($end - $begin), 4) * 1000;
// $resCode = $uploadRes["response"]['code'] === 0 ? 200 : $uploadRes["response"]['code'];
// MonUtil::proxyMon($url, $resCode, 'ks3api', $totalTime);
return
[
"response"
=>
[
"data"
=>
[
"animated"
=>
false
,
"format"
=>
$_FILES
[
'file'
][
'type'
],
"image_id"
=>
$ret
[
'key'
],
"size"
=>
[],
"url"
=>
"https://pingouimg.jwshq.cn/"
.
$ret
[
'key'
]
.
"?url="
.
$ret
[
'key'
],
]
],
];
];
$begin
=
microtime
(
true
);
$uploadRes
=
HttpUtil
::
post
(
$url
,
$params
);
$end
=
microtime
(
true
);
$totalTime
=
round
((
$end
-
$begin
),
4
)
*
1000
;
$resCode
=
$uploadRes
[
"response"
][
'code'
]
===
0
?
200
:
$uploadRes
[
"response"
][
'code'
];
MonUtil
::
proxyMon
(
$url
,
$resCode
,
'ks3api'
,
$totalTime
);
return
$uploadRes
;
}
}
/**
/**
...
@@ -180,61 +215,4 @@ class Ks3Api
...
@@ -180,61 +215,4 @@ class Ks3Api
list
(
$msec
,
$sec
)
=
explode
(
' '
,
microtime
());
list
(
$msec
,
$sec
)
=
explode
(
' '
,
microtime
());
return
(
float
)
sprintf
(
'%.0f'
,
(
floatval
(
$msec
)
+
floatval
(
$sec
))
*
1000
);
return
(
float
)
sprintf
(
'%.0f'
,
(
floatval
(
$msec
)
+
floatval
(
$sec
))
*
1000
);
}
}
/**
* 批量获取图片
* @param $imageIds image_id 数组
* @param int $widthSize
* @param int $highSize
* @param float|int $expirationTime
* @return array
*/
public
static
function
concurrencyPicEncryptUrl
(
$imageIds
,
$widthSize
=
0
,
$highSize
=
0
,
$expirationTime
=
60
*
60
*
24
*
365
)
{
$url
=
self
::
BASE_GEN_URL
.
self
::
PATH_PIC_ENCRYPT_URL
;
$timestamp
=
self
::
msectime
();
$extend
=
[];
$extend
[
"expiration_time"
]
=
$expirationTime
;
if
(
!
empty
(
$widthSize
)
&&
!
empty
(
$highSize
))
{
$extend
[
"query"
]
=
"type=thumbnail_"
.
$widthSize
.
"x"
.
$highSize
;
}
$extendJsonStr
=
json_encode
(
$extend
);
$params
=
[];
$urls
=
[];
foreach
(
$imageIds
as
$imageId
)
{
$md5Str
=
$extendJsonStr
.
"&"
.
$imageId
.
"&"
.
self
::
AUDIT_ID
.
"&"
.
$timestamp
.
"&"
.
self
::
KSYUN_SK
;
$signature
=
self
::
KSYUN_AK
.
":"
.
md5
(
$md5Str
);
$contentType
=
'multipart/form-data'
;
$param
=
[
"image_id"
=>
$imageId
,
"auth_id"
=>
self
::
AUDIT_ID
,
"timestamp"
=>
$timestamp
,
"signature"
=>
$signature
,
"content_type"
=>
$contentType
,
"extend"
=>
$extendJsonStr
,
];
$params
[
$imageId
]
=
$param
;
$urls
[
$imageId
]
=
$url
;
}
$data
=
[];
if
(
!
empty
(
$urls
))
{
$begin
=
microtime
(
true
);
$encryptRes
=
HttpUtil
::
concurrencyPost
(
$urls
,
$params
);
$end
=
microtime
(
true
);
$totalTime
=
round
((
$end
-
$begin
),
4
)
*
1000
;
$resCode
=
$encryptRes
[
"response"
][
'code'
]
===
0
?
200
:
$encryptRes
[
"response"
][
'code'
];
MonUtil
::
proxyMon
(
$url
,
$resCode
,
'ks3api'
,
$totalTime
);
if
(
!
empty
(
$encryptRes
))
{
foreach
(
$encryptRes
as
$imageId
=>
$item
)
{
if
(
!
empty
(
$item
[
"response"
][
"data"
][
"url"
]))
{
$data
[
$imageId
]
=
$item
[
"response"
][
"data"
][
"url"
];
}
}
}
}
return
$data
;
}
}
}
\ No newline at end of file
vendor/api/php_services/src/Session/RedisSession.php
View file @
f04ab681
...
@@ -149,7 +149,7 @@ class RedisSession extends Session
...
@@ -149,7 +149,7 @@ class RedisSession extends Session
}
}
return
$this
->
getSessionRedis
()
return
$this
->
getSessionRedis
()
->
del
(
array_unique
(
$sessionIds
)
,
CacheUtil
::
PREFIX_BLANK_PREFIX
);
->
del
(
array_unique
(
$sessionIds
));
}
}
/**
/**
...
@@ -199,7 +199,7 @@ class RedisSession extends Session
...
@@ -199,7 +199,7 @@ class RedisSession extends Session
protected
function
getSessionRedis
()
protected
function
getSessionRedis
()
{
{
if
(
is_null
(
$this
->
redis
))
{
if
(
is_null
(
$this
->
redis
))
{
$this
->
redis
=
RedisUtil
::
getInstance
(
'
redis
'
,
[
'serverRegion'
=>
'master'
,
'serializer'
=>
'php'
,
'master'
=>
true
]);
$this
->
redis
=
RedisUtil
::
getInstance
(
'
cache
'
,
[
'serverRegion'
=>
'master'
,
'serializer'
=>
'php'
,
'master'
=>
true
]);
}
}
return
$this
->
redis
;
return
$this
->
redis
;
}
}
...
...
vendor/api/php_services/src/Session/RedisSessionHandler.php
View file @
f04ab681
...
@@ -119,7 +119,7 @@ class RedisSessionHandler implements \SessionHandlerInterface
...
@@ -119,7 +119,7 @@ class RedisSessionHandler implements \SessionHandlerInterface
public
function
getRedis
()
public
function
getRedis
()
{
{
if
(
is_null
(
$this
->
redis
))
{
if
(
is_null
(
$this
->
redis
))
{
$this
->
redis
=
RedisUtil
::
getInstance
(
'
redis
'
,
[
'serverRegion'
=>
'master'
,
'serializer'
=>
'php'
,
'master'
=>
true
]);
$this
->
redis
=
RedisUtil
::
getInstance
(
'
cache
'
,
[
'serverRegion'
=>
'master'
,
'serializer'
=>
'php'
,
'master'
=>
true
]);
}
}
return
$this
->
redis
;
return
$this
->
redis
;
}
}
...
...
vendor/api/php_utils/src/Cache/CacheUtil.php
View file @
f04ab681
...
@@ -24,7 +24,7 @@ class CacheUtil
...
@@ -24,7 +24,7 @@ class CacheUtil
const
EXPIRE_AFTER_THREE_DAYS
=
259200
;
const
EXPIRE_AFTER_THREE_DAYS
=
259200
;
const
EXPIRE_AFTER_FIFTEEN_DAYS
=
1296000
;
const
EXPIRE_AFTER_FIFTEEN_DAYS
=
1296000
;
const
EXPIRE_AFTER_ONE_MONTH
=
2592000
;
const
EXPIRE_AFTER_ONE_MONTH
=
2592000
;
private
static
$instances
=
[];
private
static
$instances
=
[];
private
$handler
=
null
;
private
$handler
=
null
;
private
$expire
=
86400
;
//@todo 讨论一下,如果不设置有效时间,默认1天,不允许设置长期有效
private
$expire
=
86400
;
//@todo 讨论一下,如果不设置有效时间,默认1天,不允许设置长期有效
...
@@ -40,7 +40,7 @@ class CacheUtil
...
@@ -40,7 +40,7 @@ class CacheUtil
* @param boolean $master
* @param boolean $master
* @return mixed
* @return mixed
*/
*/
public
static
function
getInstance
(
$serverName
=
''
,
array
$options
=
[])
public
static
function
getInstance
(
$serverName
=
''
,
array
$options
=
[])
{
{
if
(
empty
(
$serverName
))
{
if
(
empty
(
$serverName
))
{
return
null
;
return
null
;
...
@@ -53,7 +53,7 @@ class CacheUtil
...
@@ -53,7 +53,7 @@ class CacheUtil
if
(
isset
(
self
::
$instances
[
$instancesKey
]))
{
if
(
isset
(
self
::
$instances
[
$instancesKey
]))
{
return
self
::
$instances
[
$instancesKey
];
return
self
::
$instances
[
$instancesKey
];
}
}
return
self
::
$instances
[
$instancesKey
]
=
new
Self
(
$serverName
,
$options
);
return
self
::
$instances
[
$instancesKey
]
=
new
Self
(
$serverName
,
$options
);
}
}
...
@@ -87,7 +87,7 @@ class CacheUtil
...
@@ -87,7 +87,7 @@ class CacheUtil
if
(
is_null
(
$value
)
||
false
===
$value
)
{
if
(
is_null
(
$value
)
||
false
===
$value
)
{
return
$default
;
return
$default
;
}
}
return
$value
;
return
json_decode
(
$value
,
true
)
;
}
}
/**
/**
...
@@ -123,9 +123,9 @@ class CacheUtil
...
@@ -123,9 +123,9 @@ class CacheUtil
$key
=
$this
->
getCacheKey
(
$prefix
,
$key
);
$key
=
$this
->
getCacheKey
(
$prefix
,
$key
);
//对数组/对象数据进行缓存处理,保证数据完整性
//对数组/对象数据进行缓存处理,保证数据完整性
if
(
is_int
(
$expire
)
&&
$expire
)
{
if
(
is_int
(
$expire
)
&&
$expire
)
{
$result
=
$this
->
handler
->
setex
(
$key
,
$expire
,
$value
);
$result
=
$this
->
handler
->
setex
(
$key
,
$expire
,
json_encode
(
$value
)
);
}
else
{
}
else
{
$result
=
$this
->
handler
->
set
(
$key
,
$value
);
$result
=
$this
->
handler
->
set
(
$key
,
json_encode
(
$value
)
);
}
}
return
$result
;
return
$result
;
}
}
...
@@ -282,7 +282,7 @@ class CacheUtil
...
@@ -282,7 +282,7 @@ class CacheUtil
$keyArr
[]
=
$prefix
.
$val
;
$keyArr
[]
=
$prefix
.
$val
;
}
}
return
$keyArr
;
return
$keyArr
;
}
}
return
$prefix
.
$key
;
return
$prefix
.
$key
;
}
}
}
}
vendor/api/php_utils/src/Log/FileLog.php
View file @
f04ab681
...
@@ -74,7 +74,7 @@ class FileLog
...
@@ -74,7 +74,7 @@ class FileLog
$log
.=
' [debug_backtrace info: ]'
.
print_r
(
debug_backtrace
(),
1
);
$log
.=
' [debug_backtrace info: ]'
.
print_r
(
debug_backtrace
(),
1
);
error_log
(
$log
);
error_log
(
$log
);
if
(
empty
(
$mail_to
))
{
if
(
empty
(
$mail_to
))
{
$mail_to
=
'
bp-server
@yidian-inc.com'
;
$mail_to
=
'
guwenxu
@yidian-inc.com'
;
}
}
$subject
=
'App api #'
.
$signature
.
'# '
.
$_SERVER
[
'SERVER_NAME'
]
.
' ('
.
$_SERVER
[
'SERVER_ADDR'
]
.
') Alert Message'
;
$subject
=
'App api #'
.
$signature
.
'# '
.
$_SERVER
[
'SERVER_NAME'
]
.
' ('
.
$_SERVER
[
'SERVER_ADDR'
]
.
') Alert Message'
;
$body
=
'Error: '
.
$signature
.
"
\n\n
"
;
$body
=
'Error: '
.
$signature
.
"
\n\n
"
;
...
@@ -86,11 +86,10 @@ class FileLog
...
@@ -86,11 +86,10 @@ class FileLog
if
(
!
is_array
(
$mail_to
))
{
if
(
!
is_array
(
$mail_to
))
{
$mail_to
=
[
$mail_to
];
$mail_to
=
[
$mail_to
];
}
}
if
(
self
::
shouldSendEmail
(
md5
(
$signature
))
===
true
)
{
foreach
(
$mail_to
as
$mail
)
{
foreach
(
$mail_to
as
$mail
)
{
Email
::
sendMail
(
'
bp-noreply@yidian-inc
.com'
,
$mail
,
$subject
,
$body
);
Email
::
sendMail
(
'
noreply@linkingcities
.com'
,
$mail
,
$subject
,
$body
);
}
}
}
}
}
public
static
function
accessLog
()
public
static
function
accessLog
()
...
...
vendor/api/php_utils/src/Message/Email.php
View file @
f04ab681
...
@@ -4,6 +4,7 @@ namespace Api\PhpUtils\Message;
...
@@ -4,6 +4,7 @@ namespace Api\PhpUtils\Message;
use
Yaf\Application
;
use
Yaf\Application
;
class
Email
class
Email
{
{
/**
/**
...
@@ -16,61 +17,82 @@ class Email
...
@@ -16,61 +17,82 @@ class Email
* @param string $content_type body内容的格式和编码, 可支持html格式邮件 $content_type="Content-Type: text/html; charset=\"utf-8\"\r\n\r\n"
* @param string $content_type body内容的格式和编码, 可支持html格式邮件 $content_type="Content-Type: text/html; charset=\"utf-8\"\r\n\r\n"
* @return bool
* @return bool
*/
*/
public
static
function
sendMail
(
$from
,
$to
,
$subject
,
$body
,
$smtp_server
=
'smtp.
yidian.com'
,
$smtp_port
=
25
,
$content_type
=
"Content-Type: text/plain; charset=
\"
utf-8
\"\r\n\r\n
"
)
public
static
function
sendMail
(
$from
,
$to
,
$subject
,
$body
,
$smtp_server
=
'smtp.
mxhichina.com'
,
$smtp_port
=
25
,
$content_type
=
1
)
{
{
if
(
empty
(
$to
))
{
// $smtp_to = 'bp_all@linkingcities.com';
return
false
;
$smtp_to
=
' wenxu.gu@linkingcities.com'
;
}
$smtp_host
=
'smtp.mxhichina.com'
;
//SMTP服务器地址
$env
=
Application
::
app
()
->
environ
();
$smtp_port
=
25
;
//SMTP服务器端口
if
(
$env
!=
'test'
&&
$env
!=
'prod'
&&
$env
!=
'perf'
){
$smtp_openssl
=
0
;
//是否使用SSL加密通信
return
false
;
$smtp_debug
=
0
;
//是否debug输出运行信息
}
$smtp_username
=
'bp@linkingcities.com'
;
//用户账号
if
(
empty
(
$from
))
{
$smtp_password
=
'Hello1234'
;
//用户密码
$from
=
'bp-noreply@yidian-inc.com'
;
$smtp_from
=
'bp@linkingcities.com'
;
//发件邮箱
}
try
{
$email
=
explode
(
'@'
,
$from
);
$domain
=
$email
[
1
];
$sock
=
fsockopen
(
$smtp_server
,
$smtp_port
,
$errno
,
$errstr
,
1
);
fwrite
(
$sock
,
"HELO "
.
$domain
.
"
\r\n
"
);
fgets
(
$sock
);
fwrite
(
$sock
,
"auth login
\r\n
"
);
$smtp
=
array
(
fgets
(
$sock
);
//1.EHLO 向服务器标识用户身份发送者 收到 220 或 250 时OK
array
(
"EHLO "
.
$smtp_host
.
"
\r\n
"
,
"220,250"
,
"EHLO: "
),
//2.AUTH LOGIN 请求登录认证 334 OK
array
(
"AUTH LOGIN
\r\n
"
,
"334"
,
"AUTH LOGIN: "
),
//3.发送经Base64加密的用户账号 334 OK
array
(
base64_encode
(
$smtp_username
)
.
"
\r\n
"
,
"334"
,
"Send Base64 Encode username: "
),
//4.发送经Base64加密的用户密码 235 OK
array
(
base64_encode
(
$smtp_password
)
.
"
\r\n
"
,
"235"
,
"Send Base64 Encode password: "
),
//5.Mail From 发送发件人邮箱 250 OK
array
(
"MAIL FROM: <"
.
$smtp_from
.
">
\r\n
"
,
"250"
,
"MAIL FROM: "
),
//6.发送收件人邮箱 250 OK
array
(
"RCPT TO: <"
.
$smtp_to
.
">
\r\n
"
,
"250"
,
"RCPT TO: "
),
//7.开始发送邮件数据 354 OK
array
(
"DATA
\r\n
"
,
"354"
,
"DATA Start: "
),
//8.0 发件人
array
(
"From: "
.
$smtp_from
.
"
\r\n
"
,
""
,
""
),
//8.1 收件人
array
(
"To: "
.
$smtp_to
.
"
\r\n
"
,
""
,
""
),
//8.2 发件代理客户端
array
(
"X-Mailer: LANSEYUJIE WebMailer 1.0
\r\n
"
,
""
,
""
),
//8.3 邮件重要级别 1(Highest) 3(Normal) 5(Lowest)
array
(
"X-Priority: 1 (Highest)
\r\n
"
,
""
,
""
),
//8.4 标题
array
(
"Subject: "
.
$subject
.
"
\r\n
"
,
""
,
""
),
//8.5 编码
array
(
"Content-Type: text/html; charset=
\"
utf-8
\"\r\n
"
,
""
,
""
),
//8.6 内容加密方式
array
(
"Content-Transfer-Encoding: base64
\r\n\r\n
"
,
""
,
""
),
//8.7 Base64 Encode Body
array
(
base64_encode
(
$body
)
.
"
\r\n
"
,
""
,
""
),
//9.结束发送邮件数据 250
array
(
"
\r\n
.
\r\n
"
,
"250"
,
"DATA End: "
),
//10.结束会话
array
(
"QUIT
\r\n
"
,
"221"
,
"QUIT: "
)
);
fwrite
(
$sock
,
"YnAtbm9yZXBseQ==
\r\n
"
);
$info
=
''
;
fgets
(
$sock
);
fwrite
(
$sock
,
"VlhObGNtNWhiJFclVTY=
\r\n
"
);
//建立socket通信
fgets
(
$sock
);
if
(
1
==
$smtp_openssl
)
{
//SSL加密通信
$fp
=
@
fsockopen
(
'ssl://'
.
$smtp_host
,
$smtp_port
);
}
else
{
//普通无加密通信
$fp
=
@
fsockopen
(
$smtp_host
,
$smtp_port
);
}
if
(
!
$fp
)
{
$info
.=
"FSOCKOPEN Error: Cannot conect to "
.
$smtp_host
.
"
\r\n
<br />"
;
}
fwrite
(
$sock
,
"MAIL FROM:<"
.
$from
.
">
\r\n
"
);
//发送smtp数组中的命令/数据
fgets
(
$sock
);
foreach
(
$smtp
as
$request
)
{
if
(
!
is_array
(
$to
))
{
//发送请求信息
$to
=
[
$to
];
@
fputs
(
$fp
,
$request
[
0
]);
}
//接收响应信息
foreach
(
$to
as
$t
)
{
if
(
1
==
$smtp_debug
&&
''
!=
$request
[
1
])
{
fwrite
(
$sock
,
"RCPT TO:<"
.
$t
.
">
\r\n
"
);
//接收信息
$response
=
@
fgets
(
$fp
,
128
);
$info
.=
$request
[
2
]
.
$response
.
"
\r\n
<br />"
;
}
}
fgets
(
$sock
);
fwrite
(
$sock
,
"DATA
\r\n
"
);
fgets
(
$sock
);
fwrite
(
$sock
,
"Subject: "
.
$subject
.
"
\r\n
"
);
fwrite
(
$sock
,
"From: <"
.
$from
.
">
\r\n
"
);
foreach
(
$to
as
$t
)
{
fwrite
(
$sock
,
"To: <"
.
$t
.
">
\r\n
"
);
}
fwrite
(
$sock
,
$content_type
);
fwrite
(
$sock
,
$body
.
"
\r\n
.
\r\n
"
);
fgets
(
$sock
);
fwrite
(
$sock
,
"QUIT
\r\n
"
);
fgets
(
$sock
);
fclose
(
$sock
);
}
catch
(
\Exception
$e
)
{
return
false
;
}
}
//关闭连接
@
fclose
(
$fp
);
return
$info
;
}
}
}
}
vendor/api/php_utils/src/Redis/RedisUtil.php
View file @
f04ab681
...
@@ -113,7 +113,7 @@ class RedisUtil
...
@@ -113,7 +113,7 @@ class RedisUtil
$this
->
connect
();
$this
->
connect
();
}
}
private
function
initConfigure
()
private
function
initConfigure
()
{
{
$this
->
config
=
config
(
'redis'
,
$this
->
serverName
.
'Connect'
);
$this
->
config
=
config
(
'redis'
,
$this
->
serverName
.
'Connect'
);
if
(
!
empty
(
$this
->
config
))
{
if
(
!
empty
(
$this
->
config
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment