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
e8aee150
Commit
e8aee150
authored
Nov 12, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz_version1
parents
d60c4e45
046f2cbb
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
224 additions
and
47 deletions
+224
-47
Goods.php
application/controllers/Goods.php
+1
-1
Group.php
application/controllers/Group.php
+1
-1
GoodsCommonService.php
application/models/Business/Goods/GoodsCommonService.php
+1
-1
OrderService.php
application/models/Business/Order/OrderService.php
+6
-6
StoreService.php
application/models/Business/Store/StoreService.php
+15
-3
Store.php
application/models/DAO/Store.php
+11
-2
ElasticsTool.php
application/models/Elastics/ElasticsTool.php
+15
-1
application.ini
conf/application.ini
+10
-31
nginxLogsIndex.php
scripts/crontab/logs/nginxLogsIndex.php
+154
-0
news_server.php
scripts/crontab/push/news_server.php
+10
-1
No files found.
application/controllers/Goods.php
View file @
e8aee150
...
@@ -15,7 +15,7 @@ class GoodsController extends \Our\Controller_AbstractIndex {
...
@@ -15,7 +15,7 @@ class GoodsController extends \Our\Controller_AbstractIndex {
public
function
getAction
(){
public
function
getAction
(){
$address
=
\Business\User\AddressServiceModel
::
getInstance
()
->
getMyAddress
(
$this
->
req
[
\Our\NameConst
::
data
],
$this
->
memberId
,
false
);
$address
=
\Business\User\AddressServiceModel
::
getInstance
()
->
getMyAddress
(
$this
->
req
[
\Our\NameConst
::
data
],
$this
->
memberId
,
false
);
$goodsInfo
=
$this
->
goodsService
->
getCommonDetail
(
$this
->
req
[
\Our\NameConst
::
data
],
$this
->
memberId
,
$address
);
$goodsInfo
=
$this
->
goodsService
->
getCommonDetail
(
$this
->
req
[
\Our\NameConst
::
data
],
$this
->
memberId
,
$address
);
$store
=
$this
->
goodsService
->
getStore
(
$goodsInfo
[
'storeId'
]);
$store
=
$this
->
goodsService
->
getStore
(
$goodsInfo
[
'storeId'
]
,
false
,
false
);
$goodsInfo
[
'freeShippingPrice'
]
=
$store
[
'freeShippingPrice'
];
$goodsInfo
[
'freeShippingPrice'
]
=
$store
[
'freeShippingPrice'
];
$goodsInfo
[
'isQuality'
]
=
$store
[
'isQuality'
];
$goodsInfo
[
'isQuality'
]
=
$store
[
'isQuality'
];
$evaluation
=
$this
->
goodsService
->
getEvaluation
(
$this
->
req
[
\Our\NameConst
::
data
]);
$evaluation
=
$this
->
goodsService
->
getEvaluation
(
$this
->
req
[
\Our\NameConst
::
data
]);
...
...
application/controllers/Group.php
View file @
e8aee150
...
@@ -23,7 +23,7 @@ class GroupController extends \Our\Controller_AbstractIndex {
...
@@ -23,7 +23,7 @@ class GroupController extends \Our\Controller_AbstractIndex {
$goods
=
$this
->
GroupSaleService
->
getGroupGoods
(
$this
->
req
[
\Our\NameConst
::
data
],
$address
);
$goods
=
$this
->
GroupSaleService
->
getGroupGoods
(
$this
->
req
[
\Our\NameConst
::
data
],
$address
);
// $data = $this->GroupSaleService->getOnePBundingCache($this->req[\Our\NameConst::data]['groupId']);
// $data = $this->GroupSaleService->getOnePBundingCache($this->req[\Our\NameConst::data]['groupId']);
// $this->GroupSaleService->handleData($data);
// $this->GroupSaleService->handleData($data);
$storeInfo
=
\Business\Goods\GoodsCommonServiceModel
::
getInstance
()
->
getStore
(
$goods
[
'store_id'
]);
$storeInfo
=
\Business\Goods\GoodsCommonServiceModel
::
getInstance
()
->
getStore
(
$goods
[
'store_id'
]
,
false
,
false
);
unset
(
$storeInfo
[
'freeShippingPrice'
]);
unset
(
$storeInfo
[
'isQuality'
]);
unset
(
$storeInfo
[
'shareDesc'
]);
unset
(
$storeInfo
[
'freeShippingPrice'
]);
unset
(
$storeInfo
[
'isQuality'
]);
unset
(
$storeInfo
[
'shareDesc'
]);
$otherGroups
=
\Business\Goods\GroupSaleServiceModel
::
getInstance
()
->
getOtherGroup
(
$goods
[
'store_id'
],
$this
->
req
[
\Our\NameConst
::
data
][
'groupId'
]);
$otherGroups
=
\Business\Goods\GroupSaleServiceModel
::
getInstance
()
->
getOtherGroup
(
$goods
[
'store_id'
],
$this
->
req
[
\Our\NameConst
::
data
][
'groupId'
]);
\Business\Goods\GroupSaleServiceModel
::
getInstance
()
->
addBrowseRecord
(
$this
->
req
[
\Our\NameConst
::
data
],
$this
->
memberId
);
\Business\Goods\GroupSaleServiceModel
::
getInstance
()
->
addBrowseRecord
(
$this
->
req
[
\Our\NameConst
::
data
],
$this
->
memberId
);
...
...
application/models/Business/Goods/GoodsCommonService.php
View file @
e8aee150
...
@@ -619,7 +619,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
...
@@ -619,7 +619,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$commonInstance
=
\DAO\GoodsCommonModel
::
getInstance
();
$commonInstance
=
\DAO\GoodsCommonModel
::
getInstance
();
$count
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db4\GoodsCommonRedisModel
::
getInstance
(),
array
(
&
$commonInstance
,
'getCount'
),
array
(
array
(
'store_id'
=>
$storeId
)),
\Our\ApiConst
::
oneDaySecond
);
$count
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db4\GoodsCommonRedisModel
::
getInstance
(),
array
(
&
$commonInstance
,
'getCount'
),
array
(
array
(
'store_id'
=>
$storeId
)),
\Our\ApiConst
::
oneDaySecond
);
return
array
(
'storeId'
=>
$storeId
,
'storeName'
=>
$storeInfo
[
'store_name'
],
'storeLabel'
=>
\DAO\StoreModel
::
getInstance
()
->
getStoreLabelSrc
(
$storeInfo
[
'store_label'
],
\Our\ImageConst
::
goodsStoreImg
),
'goodsTotal'
=>
$count
,
'isQuality'
=>
$storeInfo
[
'store_zhping'
],
'freeShippingPrice'
=>
$storeInfo
[
'free_shipping_price'
],
'shareDesc'
=>
$storeInfo
[
'store_share_desc'
],
'memberId'
=>
$storeInfo
[
'member_id'
]);
return
array
(
'storeId'
=>
$storeId
,
'storeName'
=>
$storeInfo
[
'store_name'
],
'storeLabel'
=>
\DAO\StoreModel
::
getInstance
()
->
getStoreLabelSrc
(
$storeInfo
[
'store_label'
],
\Our\ImageConst
::
goodsStoreImg
),
'goodsTotal'
=>
$count
,
'isQuality'
=>
$storeInfo
[
'store_zhping'
],
'freeShippingPrice'
=>
$storeInfo
[
'free_shipping_price'
],
'shareDesc'
=>
$storeInfo
[
'store_share_desc'
],
'memberId'
=>
$storeInfo
[
'member_id'
]
,
'isClose'
=>
$storeInfo
[
'isClose'
]
);
}
}
/**
/**
...
...
application/models/Business/Order/OrderService.php
View file @
e8aee150
...
@@ -73,7 +73,8 @@ class OrderServiceModel extends \Business\AbstractModel
...
@@ -73,7 +73,8 @@ class OrderServiceModel extends \Business\AbstractModel
// $query2[]= array('match' => array('orderSn' => $keyword"));
// $query2[]= array('match' => array('orderSn' => $keyword"));
$query2
[]
=
array
(
'match'
=>
array
(
'storeName'
=>
$keyword
));
$query2
[]
=
array
(
'match'
=>
array
(
'storeName'
=>
$keyword
));
$query2
[]
=
array
(
'match'
=>
array
(
'goodsName'
=>
$keyword
));
$query2
[]
=
array
(
'match'
=>
array
(
'goodsName'
=>
$keyword
));
$query2
[]
=
array
(
'wildcard'
=>
array
(
'orderSn'
=>
"*
{
$keyword
}
*"
));
$query2
[]
=
array
(
'match'
=>
array
(
'orderSn'
=>
"
$keyword
"
));
// $query2[] = array('wildcard' => array('orderSn' => "*{$keyword}*"));
$res1
[
'must'
][
1
][
'bool'
][
'should'
]
=
$query2
;
$res1
[
'must'
][
1
][
'bool'
][
'should'
]
=
$query2
;
$allQuery
[
'bool'
]
=
$res1
;
$allQuery
[
'bool'
]
=
$res1
;
// echo json_encode($allQuery);exit;
// echo json_encode($allQuery);exit;
...
@@ -123,16 +124,15 @@ class OrderServiceModel extends \Business\AbstractModel
...
@@ -123,16 +124,15 @@ class OrderServiceModel extends \Business\AbstractModel
if
(
$orderState
==
ApiConst
::
orderStateComplete
){
if
(
$orderState
==
ApiConst
::
orderStateComplete
){
$where
[
'evaluation_state'
]
=
ApiConst
::
waitEvaluation
;
$where
[
'evaluation_state'
]
=
ApiConst
::
waitEvaluation
;
$where
[
'order_state'
]
=
array
(
'eq'
,
ApiConst
::
orderStateComplete
);
$where
[
'order_state'
]
=
array
(
'eq'
,
ApiConst
::
orderStateComplete
);
}
}
elseif
(
$orderState
==
ApiConst
::
orderStateWaitRecieveOne
){
if
(
$orderState
==
ApiConst
::
orderStateWaitRecieveOne
){
$where
[
'shipping_type'
]
=
array
(
'eq'
,
ApiConst
::
bySeller
);
$where
[
'shipping_type'
]
=
array
(
'eq'
,
ApiConst
::
bySeller
);
$where
[
'order_state'
]
=
array
(
'in'
,
array
(
ApiConst
::
orderStateWaitSend
,
ApiConst
::
orderStateWaitRecieve
));
$where
[
'order_state'
]
=
array
(
'in'
,
array
(
ApiConst
::
orderStateWaitSend
,
ApiConst
::
orderStateWaitRecieve
));
}
}
elseif
(
$orderState
==
ApiConst
::
orderStateWaitSendOne
){
if
(
$orderState
==
ApiConst
::
orderStateWaitSendOne
){
$where
[
'shipping_type'
]
=
array
(
'eq'
,
ApiConst
::
bySelf
);
$where
[
'shipping_type'
]
=
array
(
'eq'
,
ApiConst
::
bySelf
);
$where
[
'order_state'
]
=
array
(
'eq'
,
ApiConst
::
orderStateWaitRecieve
);
$where
[
'order_state'
]
=
array
(
'eq'
,
ApiConst
::
orderStateWaitRecieve
);
}
else
{
$where
[
'order_state'
]
=
array
(
'eq'
,
$orderState
);
}
}
// $where['order_state'] = array('in', explode(',', $orderState));
}
}
}
}
...
...
application/models/Business/Store/StoreService.php
View file @
e8aee150
...
@@ -29,7 +29,7 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -29,7 +29,7 @@ class StoreServiceModel extends \Business\AbstractModel{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyStoreId
);
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyStoreId
);
}
}
list
(
$storeInfo
,
$storeLabel
)
=
\DAO\StoreModel
::
getInstance
()
->
get
(
$storeId
);
list
(
$storeInfo
,
$storeLabel
)
=
\DAO\StoreModel
::
getInstance
()
->
get
(
$storeId
,
true
,
false
);
if
((
int
)
$param
[
'isScan'
]
>
0
)
{
if
((
int
)
$param
[
'isScan'
]
>
0
)
{
//扫码进入
//扫码进入
if
(
$memberId
>
0
)
{
if
(
$memberId
>
0
)
{
...
@@ -135,10 +135,21 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -135,10 +135,21 @@ class StoreServiceModel extends \Business\AbstractModel{
}
}
}
}
//营业时间
//营业时间
if
(
$storeInfo
[
'store_start_time'
]
&&
$storeInfo
[
'store_close_time'
])
{
if
(
$storeInfo
[
'store_start_time'
]
==
$storeInfo
[
'store_close_time'
])
{
$businessHours
=
'全天'
;
}
elseif
(
$storeInfo
[
'store_start_time'
]
>
$storeInfo
[
'store_close_time'
])
{
$businessHours
=
$storeInfo
[
'store_start_time'
]
.
' - 次日'
.
$storeInfo
[
'store_close_time'
];
}
else
{
$businessHours
=
$storeInfo
[
'store_start_time'
]
.
' - '
.
$storeInfo
[
'store_close_time'
];
$businessHours
=
$storeInfo
[
'store_start_time'
]
.
' - '
.
$storeInfo
[
'store_close_time'
];
}
}
else
{
$businessHours
=
''
;
}
$sellerDistribution
=
$storeInfo
[
'seller_distribution'
];
$sellerDistribution
=
$storeInfo
[
'seller_distribution'
];
$buyerDistribution
=
$storeInfo
[
'buyer_distribution'
];
$buyerDistribution
=
$storeInfo
[
'buyer_distribution'
];
return
array
(
'storeLabel'
=>
$storeLabel
,
'storeName'
=>
$storeInfo
[
'store_name'
],
'grade'
=>
$grade
,
'fansCount'
=>
\DAO\FavoritesStoreModel
::
getInstance
()
->
getFavoritesStoreCountByStoreId
(
$storeId
),
'favType'
=>
$favType
,
'monthlySalesCount'
=>
$monthlySalesCount
,
'defaultDeliveryTime'
=>
$defaultDeliveryTime
,
'freeShippingPrice'
=>
$storeInfo
[
'free_shipping_price'
],
'storeDistance'
=>
$distince
,
'storeNotice'
=>
$storeInfo
[
'store_notice'
],
'startShippingPrice'
=>
$storeInfo
[
'start_shipping_price'
],
'memberId'
=>
$storeInfo
[
'member_id'
],
'inStoreService'
=>
$in_store_service_flag
,
'adv'
=>
$adv
,
'memberId'
=>
$storeInfo
[
'member_id'
],
'businessHours'
=>
$businessHours
,
'sellerDistribution'
=>
$sellerDistribution
,
'buyerDistribution'
=>
$buyerDistribution
,
'bannerColor'
=>
'#ffa92f'
);
return
array
(
'storeLabel'
=>
$storeLabel
,
'storeName'
=>
$storeInfo
[
'store_name'
],
'grade'
=>
$grade
,
'fansCount'
=>
\DAO\FavoritesStoreModel
::
getInstance
()
->
getFavoritesStoreCountByStoreId
(
$storeId
),
'favType'
=>
$favType
,
'monthlySalesCount'
=>
$monthlySalesCount
,
'defaultDeliveryTime'
=>
$defaultDeliveryTime
,
'freeShippingPrice'
=>
$storeInfo
[
'free_shipping_price'
],
'storeDistance'
=>
$distince
,
'storeNotice'
=>
$storeInfo
[
'store_notice'
],
'startShippingPrice'
=>
$storeInfo
[
'start_shipping_price'
],
'memberId'
=>
$storeInfo
[
'member_id'
],
'inStoreService'
=>
$in_store_service_flag
,
'adv'
=>
$adv
,
'memberId'
=>
$storeInfo
[
'member_id'
],
'businessHours'
=>
$businessHours
,
'sellerDistribution'
=>
$sellerDistribution
,
'buyerDistribution'
=>
$buyerDistribution
,
'bannerColor'
=>
'#ffa92f'
,
'isClose'
=>
$storeInfo
[
'isClose'
]
);
}
}
/**
/**
...
@@ -624,6 +635,7 @@ class StoreServiceModel extends \Business\AbstractModel{
...
@@ -624,6 +635,7 @@ class StoreServiceModel extends \Business\AbstractModel{
if
(
empty
(
$exitStore
)
&&
$serviceStores
&&
in_array
(
$goodsClass
[
'gcId'
],
array_keys
(
$serviceStores
))){
if
(
empty
(
$exitStore
)
&&
$serviceStores
&&
in_array
(
$goodsClass
[
'gcId'
],
array_keys
(
$serviceStores
))){
$exitStore
=
$allStores
[
$serviceStores
[
$goodsClass
[
'gcId'
]]];
$exitStore
=
$allStores
[
$serviceStores
[
$goodsClass
[
'gcId'
]]];
}
}
/*if(empty($exitStore)&&$expressStores&&in_array($goodsClass['gcId'],array_keys($expressStores))){
/*if(empty($exitStore)&&$expressStores&&in_array($goodsClass['gcId'],array_keys($expressStores))){
$exitStore = $allStores[$expressStores[$goodsClass['gcId']]];
$exitStore = $allStores[$expressStores[$goodsClass['gcId']]];
}*/
}*/
...
...
application/models/DAO/Store.php
View file @
e8aee150
...
@@ -266,12 +266,21 @@ class StoreModel extends \DAO\AbstractModel
...
@@ -266,12 +266,21 @@ class StoreModel extends \DAO\AbstractModel
return
$address
;
return
$address
;
}
}
public
function
get
(
$storeId
,
$label
=
true
)
public
function
get
(
$storeId
,
$label
=
true
,
$reportError
=
true
)
{
{
$storeInfo
=
$this
->
getStoreInfoCache
(
$storeId
);
$storeInfo
=
$this
->
getStoreInfoCache
(
$storeId
);
if
(
!
$storeInfo
||
$storeInfo
[
'open_flag'
]
!=
1
||
$storeInfo
[
'store_state'
]
!=
1
)
{
if
(
!
$storeInfo
)
{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
storeNotExistOrClose
);
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
storeNotExistOrClose
);
}
}
if
(
$storeInfo
[
'open_flag'
]
!=
1
||
$storeInfo
[
'store_state'
]
!=
1
){
if
(
$reportError
)
{
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
storeNotExistOrClose
);
}
else
{
$storeInfo
[
'isClose'
]
=
1
;
}
}
else
{
$storeInfo
[
'isClose'
]
=
0
;
}
if
(
$label
){
if
(
$label
){
//店铺头像
//店铺头像
...
...
application/models/Elastics/ElasticsTool.php
View file @
e8aee150
...
@@ -303,7 +303,21 @@ class ElasticsToolModel
...
@@ -303,7 +303,21 @@ class ElasticsToolModel
$res
=
$this
->
client
->
indices
()
->
create
(
$params
);
$res
=
$this
->
client
->
indices
()
->
create
(
$params
);
return
$res
;
return
$res
;
}
}
public
function
createIndexAndMapping
(
$propertiesField
)
{
$params
=
[
'index'
=>
$this
->
dbName
,
//索引名称
'body'
=>
[
'mappings'
=>
[
//映射
$this
->
tbName
=>
[
//默认配置,每个类型缺省的配置使用默认配置
'properties'
=>
$propertiesField
],
],
]
];
$res
=
$this
->
client
->
indices
()
->
create
(
$params
);
return
$res
;
}
// public function createIkField($indexFild)
// public function createIkField($indexFild)
// {
// {
// $params = [
// $params = [
...
...
conf/application.ini
View file @
e8aee150
...
@@ -15,34 +15,23 @@ application.modules = Index,Api,Admin,Client
...
@@ -15,34 +15,23 @@ application.modules = Index,Api,Admin,Client
[productone : common]
[productone : common]
; 数据库配置
; 数据库配置
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"
172.16.142.15
"
resources.database.params.hostname
=
"
rm-bp1j835zol35h2nm0.mysql.rds.aliyuncs.com
"
resources.database.params.port
=
3306
resources.database.params.port
=
3306
resources.database.params.database
=
"qmcs"
resources.database.params.database
=
"qmcs"
resources.database.params.username
=
"
root
"
resources.database.params.username
=
"
chenchuanwen
"
resources.database.params.password
=
"!@#$%12345werty"
resources.database.params.password
=
"!@#$%12345werty"
resources.database.params.charset
=
"UTF8"
resources.database.params.charset
=
"UTF8"
resources.database.params.driver_options.1002
=
"SET NAMES utf8"
resources.database.params.driver_options.1002
=
"SET NAMES utf8"
;
;
; ; 从库配置
; ; 从库配置
resources.database.slave.params.driver
=
"pdo_mysql"
resources.database.slave.params.driver
=
"pdo_mysql"
resources.database.slave.params.hostname
=
"
172.16.142.13
"
resources.database.slave.params.hostname
=
"
rm-bp1j835zol35h2nm0.mysql.rds.aliyuncs.com
"
resources.database.slave.params.port
=
3306
resources.database.slave.params.port
=
3306
resources.database.slave.params.database
=
"qmcs"
resources.database.slave.params.database
=
"qmcs"
resources.database.slave.params.username
=
"
root
"
resources.database.slave.params.username
=
"
chenchuanwen
"
resources.database.slave.params.password
=
"!@#$%12345werty"
resources.database.slave.params.password
=
"!@#$%12345werty"
resources.database.slave.params.charset
=
"UTF8"
resources.database.slave.params.charset
=
"UTF8"
resources.database.slave.params.driver_options.1002
=
"SET NAMES utf8"
resources.database.slave.params.driver_options.1002
=
"SET NAMES utf8"
; mongodb
resources.database.mongo.params.driver
=
"scram"
resources.database.mongo.params.hostname
=
"172.16.142.15"
resources.database.mongo.params.port
=
27017
resources.database.mongo.params.database
=
"qmcs"
resources.database.mongo.params.username
=
"qmcs"
resources.database.mongo.params.password
=
"123456asdfgh"
resources.database.mongo.params.charset
=
"UTF8"
resources.database.mongo.params.driver_options.1002
=
"SET NAMES utf8"
;
;
password.key
=
'~!@#$`1234qwertasdfgzxcvb'
;
password.key
=
'~!@#$`1234qwertasdfgzxcvb'
;
redis.database.params.host = "172.16.142.15"
redis.database.params.host = "172.16.142.15"
...
@@ -73,34 +62,24 @@ password.key='~!@#$`1234qwertasdfgzxcvb';
...
@@ -73,34 +62,24 @@ password.key='~!@#$`1234qwertasdfgzxcvb';
[product : common]
[product : common]
; 数据库配置
; 数据库配置
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"
127.0.0.1
"
resources.database.params.hostname
=
"
rm-bp1j835zol35h2nm0.mysql.rds.aliyuncs.com
"
resources.database.params.port
=
3306
resources.database.params.port
=
3306
resources.database.params.database
=
"qmcs"
resources.database.params.database
=
"qmcs"
resources.database.params.username
=
"
root
"
resources.database.params.username
=
"
chenchuanwen
"
resources.database.params.password
=
"!@#$%12345werty"
resources.database.params.password
=
"!@#$%12345werty"
resources.database.params.charset
=
"UTF8"
resources.database.params.charset
=
"UTF8"
resources.database.params.driver_options.1002
=
"SET NAMES utf8"
resources.database.params.driver_options.1002
=
"SET NAMES utf8"
; 从库配置
; 从库配置
resources.database.slave.params.driver
=
"pdo_mysql"
resources.database.slave.params.driver
=
"pdo_mysql"
resources.database.slave.params.hostname
=
"
172.16.142.13
"
resources.database.slave.params.hostname
=
"
rm-bp1j835zol35h2nm0.mysql.rds.aliyuncs.com
"
resources.database.slave.params.port
=
3306
resources.database.slave.params.port
=
3306
resources.database.slave.params.database
=
"qmcs"
resources.database.slave.params.database
=
"qmcs"
resources.database.slave.params.username
=
"
root
"
resources.database.slave.params.username
=
"
chenchuanwen
"
resources.database.slave.params.password
=
"!@#$%12345werty"
resources.database.slave.params.password
=
"!@#$%12345werty"
resources.database.slave.params.charset
=
"UTF8"
resources.database.slave.params.charset
=
"UTF8"
resources.database.slave.params.driver_options.1002
=
"SET NAMES utf8"
resources.database.slave.params.driver_options.1002
=
"SET NAMES utf8"
; mongodb
resources.database.mongo.params.driver
=
"scram"
resources.database.mongo.params.hostname
=
"127.0.0.1"
resources.database.mongo.params.port
=
27017
resources.database.mongo.params.database
=
"qmcs"
resources.database.mongo.params.username
=
"qmcs"
resources.database.mongo.params.password
=
"123456asdfgh"
resources.database.mongo.params.charset
=
"UTF8"
resources.database.mongo.params.driver_options.1002
=
"SET NAMES utf8"
password.key
=
'~!@#$`1234qwertasdfgzxcvb'
;
password.key
=
'~!@#$`1234qwertasdfgzxcvb'
;
redis.database.params.host = "127.0.0.1"
redis.database.params.host = "127.0.0.1"
redis.database.params.port
=
"6379"
redis.database.params.port
=
"6379"
...
@@ -395,7 +374,7 @@ elastic.master.host="192.168.1.201"
...
@@ -395,7 +374,7 @@ elastic.master.host="192.168.1.201"
elastic.master.port
=
"9200"
elastic.master.port
=
"9200"
elastic.master.scheme
=
"http"
;
elastic.master.scheme
=
"http"
;
[lyz : common]
[lyz
test
: common]
; 数据库配置
; 数据库配置
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"127.0.0.1"
resources.database.params.hostname
=
"127.0.0.1"
...
@@ -442,7 +421,7 @@ elastic.master.host="192.168.1.201"
...
@@ -442,7 +421,7 @@ elastic.master.host="192.168.1.201"
elastic.master.port
=
"9200"
elastic.master.port
=
"9200"
elastic.master.scheme
=
"http"
;
elastic.master.scheme
=
"http"
;
[lyz
test
: common]
[lyz : common]
; 数据库配置
; 数据库配置
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"127.0.0.1"
resources.database.params.hostname
=
"127.0.0.1"
...
...
scripts/crontab/logs/nginxLogsIndex.php
0 → 100644
View file @
e8aee150
<?php
/**
* 生成店铺订单索引
* 执行时间:每分钟执行一次
*
* @author chenjiebin <sjlinyu@qq.com>
*/
define
(
"APPLICATION_PATH"
,
realpath
(
dirname
(
__FILE__
)
.
'/../../../'
));
//指向public的上一级
require
APPLICATION_PATH
.
'/scripts/crontab/baseCli.php'
;
require
APPLICATION_PATH
.
'/scripts/crontab/common.php'
;
error_reporting
(
E_ALL
^
E_NOTICE
);
class
clinNginxLogsIndex
extends
basecli
{
const
CLI_ADMIN_ID
=
255
;
private
$bDoUnLock
=
FALSE
;
// 是否允许释放 LOCK 文件
private
$_debug
=
0
;
private
$lockFileName
;
public
$key
=
''
;
private
$fromState
;
private
function
mkdirs
(
$dir
,
$mode
=
0777
)
{
if
(
is_dir
(
$dir
)
||
@
mkdir
(
$dir
,
$mode
))
{
return
TRUE
;
}
if
(
!
$this
->
mkdirs
(
dirname
(
$dir
),
$mode
))
{
return
FALSE
;
}
return
@
mkdir
(
$dir
,
$mode
);
}
/**
* 析构
*/
public
function
__destruct
()
{
parent
::
__destruct
();
if
(
$this
->
bDoUnLock
)
{
@
unlink
(
$this
->
lockFileName
);
}
}
public
function
getIndex
(
$dayOption
){
$dateStr
=
date
(
'Y-m-d'
,
strtotime
(
$dayOption
));
$indexStr
=
\Our\Common
::
format
(
"nignx-log-"
.
$dateStr
);
return
$indexStr
;
}
public
function
removeNginxLogIndex
(){
$index
=
$this
->
getIndex
(
"-30 day"
);
$type
=
"nginx-log"
;
$elasticsTool
=
\Elastics\ElasticsToolModel
::
getInstance
(
$type
,
$index
);
$i
=
30
;
while
(
$elasticsTool
->
indexExists
(
$index
)){
$elasticsTool
->
deleteIndex
(
$index
);
$i
--
;
$index
=
$this
->
getIndex
(
"-
{
$i
}
day"
);
}
}
//创建索引
public
function
createNginxLogIndex
()
{
$index
=
$this
->
getIndex
(
"+1 day"
);
$type
=
"nginx-log"
;
$elasticsTool
=
\Elastics\ElasticsToolModel
::
getInstance
(
$type
,
$index
);
$propertiesfield
=
[
//映射
"@timestamp"
=>
[
"type"
=>
"date"
,
"format"
=>
"strict_date_optional_time||epoch_millis"
],
"@version"
=>
[
"type"
=>
"string"
],
"client"
=>
[
"type"
=>
"string"
],
"domain"
=>
[
"type"
=>
"string"
],
"host"
=>
[
"type"
=>
"string"
],
"path"
=>
[
"type"
=>
"string"
],
"referer"
=>
[
"type"
=>
"string"
],
"responsetime"
=>
[
"type"
=>
"string"
],
"size"
=>
[
"type"
=>
"string"
],
"status"
=>
[
"type"
=>
"string"
],
"type"
=>
[
"type"
=>
"string"
],
"ua"
=>
[
"type"
=>
"string"
],
"url"
=>
[
"type"
=>
"string"
,
"index"
=>
"not_analyzed"
],
];
$elasticsTool
->
createIndexAndMapping
(
$propertiesfield
);
}
protected
function
_runCli
()
{
$this
->
_debug
=
isset
(
$this
->
aArgv
[
1
])
?
intval
(
$this
->
aArgv
[
1
])
:
0
;
if
(
$this
->
_debug
)
{
echo
"*** Debug mode ***
\n
"
;
}
// Step: 02 检查是否已有相同CLI在运行中
$lockDir
=
$this
->
_getBaseFileName
(
'logs'
);
if
(
!
$this
->
mkdirs
(
$lockDir
))
{
echo
'****create dir fail ****'
;
exit
;
}
$this
->
lockFileName
=
$lockDir
.
DS
.
'nginxLogsIndex.locks'
;
if
(
file_exists
(
$this
->
lockFileName
))
{
$stat
=
stat
(
$this
->
lockFileName
);
if
((
TIMESTAMP
-
$stat
[
'mtime'
])
>
1800
)
{
echo
"文件被锁超过1800秒,被强制删除"
;
@
unlink
(
$this
->
lockFileName
);
}
else
{
$this
->
halt
(
'['
.
date
(
'Y-m-d H:i:s'
)
.
'] The CLI is running'
.
"
\n
"
);
}
}
$this
->
bDoUnLock
=
true
;
file_put_contents
(
$this
->
lockFileName
,
"running"
);
// CLI 独占锁
$shopkeeperService
=
\Business\Store\ShopkeeperServiceModel
::
getInstance
();
$shopkeeperService
->
baseDir
=
\Our\Common
::
getConfig
(
'out.config'
);
try
{
$this
->
createNginxLogIndex
();
}
catch
(
\Exception
$ex
)
{
throw
new
\Exception
(
$ex
->
getMessage
(),
$ex
->
getCode
());
}
echo
'nginx,log 生成成功'
.
date
(
'Y-m-d H:i:s'
,
TIMESTAMP
)
.
"
\r\n
"
;
}
}
$oCli
=
new
clinNginxLogsIndex
(
TRUE
);
EXIT
;
?>
scripts/crontab/push/news_server.php
View file @
e8aee150
...
@@ -241,9 +241,11 @@ $tcp_server->on('receive', function($serv, $fd, $from_id, $data) use($conf) {
...
@@ -241,9 +241,11 @@ $tcp_server->on('receive', function($serv, $fd, $from_id, $data) use($conf) {
if
(
!
isset
(
$data
[
'uid'
])
||
empty
(
$data
[
'uid'
])){
if
(
!
isset
(
$data
[
'uid'
])
||
empty
(
$data
[
'uid'
])){
foreach
(
$data
[
'data'
]
as
$value
){
foreach
(
$data
[
'data'
]
as
$value
){
if
(
isset
(
$value
[
'type'
])
&&
$value
[
'type'
]
>
100
){
if
(
isset
(
$value
[
'type'
])
&&
$value
[
'type'
]
>
100
){
echo
json_encode
(
$value
);
$sendStoreFd
=
$redis
->
hGet
(
KEY_PRE_STORE
.
$value
[
'storeId'
],
'fd'
);
$sendStoreFd
=
$redis
->
hGet
(
KEY_PRE_STORE
.
$value
[
'storeId'
],
'fd'
);
if
(
!
empty
(
$sendStoreFd
)){
if
(
!
empty
(
$sendStoreFd
)){
if
(
!
$value
[
'message'
]){
$value
[
'message'
]
=
new
\stdClass
();
}
$serv
->
push
(
$sendStoreFd
,
responseJson
(
1
,
"fromMsg"
,
"success"
,
$value
));
$serv
->
push
(
$sendStoreFd
,
responseJson
(
1
,
"fromMsg"
,
"success"
,
$value
));
}
}
}
else
{
}
else
{
...
@@ -253,6 +255,9 @@ $tcp_server->on('receive', function($serv, $fd, $from_id, $data) use($conf) {
...
@@ -253,6 +255,9 @@ $tcp_server->on('receive', function($serv, $fd, $from_id, $data) use($conf) {
$sendFd
=
$redis
->
hGet
(
KEY_PRE
.
$value
[
'toId'
],
'fd'
);
$sendFd
=
$redis
->
hGet
(
KEY_PRE
.
$value
[
'toId'
],
'fd'
);
$redis
->
hIncrBy
(
KEY_PRE
.
$value
[
'toId'
],
'unread_message_count'
,
\Our\ApiConst
::
one
);
$redis
->
hIncrBy
(
KEY_PRE
.
$value
[
'toId'
],
'unread_message_count'
,
\Our\ApiConst
::
one
);
if
(
!
empty
(
$sendFd
)){
if
(
!
empty
(
$sendFd
)){
if
(
!
$value
[
'message'
]){
$value
[
'message'
]
=
new
\stdClass
();
}
$serv
->
push
(
$sendFd
,
responseJson
(
1
,
"fromMsg"
,
"success"
,
$value
));
$serv
->
push
(
$sendFd
,
responseJson
(
1
,
"fromMsg"
,
"success"
,
$value
));
$redis
->
hSet
(
KEY_PRE
.
$value
[
'fromId'
],
'sendTime'
,
time
());
$redis
->
hSet
(
KEY_PRE
.
$value
[
'fromId'
],
'sendTime'
,
time
());
}
}
...
@@ -297,12 +302,16 @@ $serv->on('Close', function($server, $fd) use($conf){
...
@@ -297,12 +302,16 @@ $serv->on('Close', function($server, $fd) use($conf){
});
});
function
responseJson
(
$status
=
1
,
$method
,
$message
=
''
,
$data
=
array
())
{
function
responseJson
(
$status
=
1
,
$method
,
$message
=
''
,
$data
=
array
())
{
if
(
!
$data
[
'message'
]){
$data
[
'message'
]
=
new
\stdClass
();
}
$data
=
[
$data
=
[
'status'
=>
$status
,
'status'
=>
$status
,
'method'
=>
$method
,
'method'
=>
$method
,
'message'
=>
$message
,
'message'
=>
$message
,
'data'
=>
$data
,
'data'
=>
$data
,
];
];
echo
json_encode
(
$data
);
return
json_encode
(
$data
);
return
json_encode
(
$data
);
}
}
$serv
->
start
();
$serv
->
start
();
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