Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
M
my-yaf-project
Project
Project
Details
Activity
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
chenchuanwen
my-yaf-project
Commits
59d0ab4f
Commit
59d0ab4f
authored
Aug 29, 2018
by
wwccw0591
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into ccw
parents
3ba40e3f
eb91a3bf
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
144 additions
and
14 deletions
+144
-14
Common.php
application/controllers/Common.php
+11
-7
ImageConst.php
application/library/Our/ImageConst.php
+2
-0
ImageUtil.php
application/library/Our/ImageUtil.php
+0
-1
NameConst.php
application/library/Our/NameConst.php
+3
-1
CommonService.php
application/models/Business/Common/CommonService.php
+39
-0
FrontLog.php
application/models/DAO/FrontLog.php
+67
-0
CodeConfig.php
application/models/Error/CodeConfig.php
+6
-1
LinkMySQL.php
application/models/Mysql/LinkMySQL.php
+16
-4
No files found.
application/controllers/Common.php
View file @
59d0ab4f
...
...
@@ -70,13 +70,17 @@ class CommonController extends \Our\Controller_AbstractIndex{
}
public
function
logAction
(){
$logContent
=
trim
(
$this
->
req
[
\Our\NameConst
::
data
][
'content'
]);
if
(
!
$logContent
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyLog
);
}
$log
=
\Our\Log
::
getInstance
();
// $log->write(print_r($data, true));
$log
->
write
(
$logContent
,
\Our\NameConst
::
frontLogPath
);
$logContent
=
$this
->
req
[
\Our\NameConst
::
data
][
'content'
];
$commonServiceModel
=
\Business\Common\CommonServiceModel
::
getInstance
();
$commonServiceModel
->
log
(
$logContent
);
$this
->
success
(
new
stdClass
(),
\Our\DescribeConst
::
logWriteSuccess
,
\Our\DescribeConst
::
logWriteSuccess
);
}
public
function
readLogAction
(){
$where
=
$this
->
req
[
\Our\NameConst
::
data
];
$commonServiceModel
=
\Business\Common\CommonServiceModel
::
getInstance
();
$logList
=
$commonServiceModel
->
readLog
(
$where
);
$this
->
success
(
$logList
);
}
}
\ No newline at end of file
application/library/Our/ImageConst.php
View file @
59d0ab4f
...
...
@@ -79,6 +79,8 @@ class ImageConst{
//店铺广告位路径
const
advSrcImagePath
=
'mall/adv_src/'
;
const
frontLogPath
=
'mall/log/'
;
//可上传图片类型
const
uploadTypes
=
array
(
0
=>
self
::
defaultPath
,
...
...
application/library/Our/ImageUtil.php
View file @
59d0ab4f
...
...
@@ -103,7 +103,6 @@ class ImageUtil {
$ossUploadFilePath
=
$path
.
$uploadImageName
;
//return $ossUploadFilePath;
$return
=
$ossClient
->
uploadFile
(
$bucketName
,
$ossUploadFilePath
,
$filePath
);
\Our\Log
::
getInstance
()
->
write
(
json_encode
(
$return
,
true
));
return
$return
[
'oss-request-url'
];
}
...
...
application/library/Our/NameConst.php
View file @
59d0ab4f
...
...
@@ -159,7 +159,9 @@ class NameConst {
const
cancelUnPayedOrderTimePrefix
=
'cancelUnPayedOrderTime'
;
const
cancelUnReceivedOrderTimePrefix
=
'cancelUnReceivedOrderTime'
;
const
frontLogPath
=
'/data/log/front'
;
const
frontLogPath
=
'/data/log/'
;
const
frontPrefix
=
'front'
;
}
?>
\ No newline at end of file
application/models/Business/Common/CommonService.php
View file @
59d0ab4f
...
...
@@ -110,6 +110,45 @@ class CommonServiceModel extends \Business\AbstractModel
return
$share
;
}
public
function
log
(
$content
){
$logContent
=
$content
;
if
(
!
$logContent
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyLog
);
}
$log
[
'content'
]
=
$logContent
;
$frontLogDao
=
\DAO\FrontLogModel
::
getInstance
(
\Our\DbNameConst
::
masterDBConnectName
);
$result
=
$frontLogDao
->
insert
(
$log
);
if
(
!
$result
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
writeLogFailed
);
}
return
true
;
}
public
function
readLog
(
$where
){
$logList
=
array
();
$condition
=
array
();
if
(
empty
(
$where
[
'startTime'
])
&&
empty
(
$where
[
'endTime'
])){
$condition
[
'gmt_create'
]
=
array
(
'egt'
,
TIMESTAMP
-
\Our\ApiConst
::
oneDaySecond
);
$condition
[
'gmt_create'
]
=
array
(
'lt'
,
TIMESTAMP
);
}
else
{
if
((
isset
(
$where
[
'startTime'
])
&&
$where
[
'startTime'
])
&&
(
isset
(
$where
[
'endTime'
])
&&
$where
[
'endTime'
])){
if
(
$where
[
'startTime'
]
>
$where
[
'endTime'
]){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
wrongTimeForReadLog
);
}
$condition
[
'gmt_create'
]
=
array
(
'between'
,
$where
[
'startTime'
],
$where
[
'endTime'
]);
}
else
if
(
isset
(
$where
[
'startTime'
])
&&
$where
[
'startTime'
]){
$condition
[
'gmt_create'
]
=
array
(
'egt'
,
$where
[
'startTime'
]);
}
else
if
(
isset
(
$where
[
'endTime'
])
&&
$where
[
'endTime'
]){
$condition
[
'gmt_create'
]
=
array
(
'lt'
,
$where
[
'endTime'
]);
}
}
$frontLogDao
=
\DAO\FrontLogModel
::
getInstance
();
$logList
=
$frontLogDao
->
getList
(
$condition
);
return
$logList
;
}
private
static
$_instance
=
null
;
/**
...
...
application/models/DAO/FrontLog.php
0 → 100644
View file @
59d0ab4f
<?php
namespace
DAO
;
/**
* User: liuyuzhen
* Date: 2018/8/29
* Time: 15:01
* Description:
*/
class
FrontLogModel
extends
\DAO\AbstractModel
{
private
$logField
=
'content as logContent , gmt_create as logTime'
;
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_front_log'
;
/**
* 主键
*
* @var string
*/
protected
$_primaryKey
=
'id'
;
public
function
init
(){
}
public
function
insert
(
$param
){
$param
[
'gmt_create'
]
=
TIMESTAMP
;
$this
->
setDb
(
\Our\DbNameConst
::
masterDBConnectName
);
return
$this
->
db
->
insert
(
$this
->
_tableName
)
->
rows
(
$param
)
->
execute
();
}
public
function
getList
(
$where
){
$this
->
setDb
(
$this
->
dbName
);
if
(
is_array
(
$where
)){
$where
=
$this
->
db
->
getSqlWhereByArray
(
$where
);
}
$result
=
$this
->
db
->
select
(
$this
->
logField
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchAll
();
return
$result
;
}
/**
* 类实例
*
* @var \DAO\UserModel
*/
private
static
$_instance
=
null
;
/**
* 获取类实例
*
* @return \DAO\UserModel
*/
public
static
function
getInstance
(
$dbName
=
\Our\DbNameConst
::
salveDBConnectName
)
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
(
$dbName
);
}
return
self
::
$_instance
;
}
}
application/models/Error/CodeConfig.php
View file @
59d0ab4f
...
...
@@ -91,6 +91,9 @@ class CodeConfigModel {
const
currentMobileHasBeenBind
=
10078
;
const
otherDriverLogin
=
10105
;
const
emptyLog
=
10106
;
const
writeLogFailed
=
10107
;
const
wrongTimeForReadLog
=
10108
;
//访问错误
const
illegalAccess
=
200001
;
...
...
@@ -747,7 +750,9 @@ class CodeConfigModel {
self
::
currentMobileHasBeenBind
=>
'当前手机号码已经绑定其他微信,如需绑定,请先手机号码登录app进行微信解绑'
,
self
::
otherDriverLogin
=>
'当前用户已被其他设备登录,请重新登录'
,
self
::
elasticsError
=>
'全文索引连接出错'
,
self
::
emptyLog
=>
'日志内容不能为空'
self
::
emptyLog
=>
'日志内容不能为空'
,
self
::
writeLogFailed
=>
'日志写入失败'
,
self
::
wrongTimeForReadLog
=>
'读日志时写入时间段查询开始时间不能大于结束时间'
);
}
...
...
application/models/Mysql/LinkMySQL.php
View file @
59d0ab4f
...
...
@@ -858,7 +858,11 @@ class LinkMySQLModel{
$where
.=
$this
->
getJointWhereByTwoArray
(
$key
,
$value
);
}
if
(
count
(
$value
)
==
3
)
{
$where
.=
$this
->
getJointWhereBySecondArray
(
$key
,
$value
);
if
(
$value
[
0
]
==
'between'
){
$where
.=
$this
->
getJointWhereByTwoArray
(
$key
,
$value
);
}
else
{
$where
.=
$this
->
getJointWhereBySecondArray
(
$key
,
$value
);
}
}
...
...
@@ -926,9 +930,14 @@ class LinkMySQLModel{
public
function
getJointWhereByTwoArray
(
$key
,
$array
)
{
if
(
empty
(
$array
)
||
!
$key
||
count
(
$array
)
!=
2
||
$array
[
1
]
===
''
||
$array
[
1
]
===
null
)
{
return
false
;
if
(
count
(
$array
)
==
3
){
if
(
!
(
$array
[
0
]
==
'between'
&&!
(
empty
(
$array
[
1
])
&&
empty
(
$array
[
2
]))
&&
$key
)){
return
false
;
}
}
else
{
if
(
empty
(
$array
)
||
!
$key
||
(
count
(
$array
)
!=
2
)
||
$array
[
1
]
===
''
||
$array
[
1
]
===
null
)
{
return
false
;
}
}
$return
=
''
;
$strArray
=
explode
(
'|'
,
$key
);
...
...
@@ -967,6 +976,9 @@ class LinkMySQLModel{
$return
.=
"
{
$value
}
not in('"
.
implode
(
"','"
,
$array
[
1
])
.
"')"
;
break
;
case
'between'
:
$return
.=
"
{
$value
}
between '
$array[1]
' and '
$array[2]
' "
;
break
;
}
if
(
$k
<
$count
-
1
)
$return
.=
" or "
;
...
...
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