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
caa44875
Commit
caa44875
authored
Nov 30, 2018
by
christ
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into ccw
parents
69f7a326
b8bf90e2
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
139 additions
and
22 deletions
+139
-22
GoodsClassService.php
application/models/Business/Goods/GoodsClassService.php
+7
-3
GroupSaleService.php
application/models/Business/Goods/GroupSaleService.php
+2
-2
Member.php
application/models/DAO/Member.php
+3
-1
CodeConfig.php
application/models/Error/CodeConfig.php
+2
-0
application.ini
conf/application.ini
+22
-16
storeStat.php
scripts/crontab/store/storeStat.php
+103
-0
No files found.
application/models/Business/Goods/GoodsClassService.php
View file @
caa44875
...
...
@@ -189,7 +189,7 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
$storeDao
=
\DAO\StoreModel
::
getInstance
();
$signStoreClasses
=
$this
->
getSignClassesByCityCode
(
$cityCode
);
//var_dump($signStoreClasses);
if
(
$signStoreClasses
){
$storeIds
=
array_unique
(
array_column
(
$signStoreClasses
,
'store_id'
));
$tempStoreList
=
$storeDao
->
getNearbyStores
(
$cityCode
,
$storeIds
);
...
...
@@ -209,14 +209,18 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
$class_distance
=
\Our\CommonExtension
::
getDistance
(
$lat
,
$lng
,
$store
[
'store_latitude'
],
$store
[
'store_latitude'
],
1
);
$class
=
$signClass
;
$class
[
'class_distance'
]
=
$class_distance
;
$returnClass
[
$class_distance
]
=
$class
;
$returnClass
[]
=
$class
;
if
(
!
(
$newStoreIds
&&
in_array
(
$signClass
[
'store_id'
],
$newStoreIds
))){
$newStoreIds
[]
=
$signClass
[
'store_id'
];
}
}
}
ksort
(
$returnClass
);
foreach
(
$returnClass
as
$key
=>
$class
){
$classDistance
[
$key
]
=
$class
[
'class_distance'
];
}
array_multisort
(
$classDistance
,
SORT_DESC
,
$returnClass
);
$signParentClassIds
=
array_unique
(
array_column
(
$returnClass
,
'gc_parent_id'
));
//$signStoreIds = array_unique(array_column($returnClass,'store_id'));
...
...
application/models/Business/Goods/GroupSaleService.php
View file @
caa44875
...
...
@@ -245,7 +245,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
}
}
$storeCarts
=
$newstoreCarts
;
$store
=
$storeDao
->
get
(
$storeId
,
false
);
$store
=
$storeDao
->
get
(
$storeId
,
false
,
false
);
$temp
=
array
();
$temp
[
'storeName'
]
=
$store
[
'store_name'
];
$temp
[
'storeId'
]
=
$storeId
;
...
...
@@ -271,7 +271,7 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
$newResult
=
array
();
foreach
(
$storeIds
as
$key
){
$tempReturnCart
=
$result
[
$key
];
$tempStore
=
$storeDao
->
get
(
$key
,
false
);
$tempStore
=
$storeDao
->
get
(
$key
,
false
,
false
);
$tempReturnCart
[
'inAreaFlag'
]
=
$storeDao
->
checkAddressInServiceArea
(
$address
,
$tempStore
);
$newResult
[]
=
$tempReturnCart
;
}
...
...
application/models/DAO/Member.php
View file @
caa44875
...
...
@@ -125,7 +125,9 @@ class MemberModel extends \DAO\AbstractModel
if
(
isset
(
$member
[
'member_passwd'
])
&&
$member
[
'member_passwd'
]){
unset
(
$member
[
'member_passwd'
]);
}
$memberDb0Redis
->
tableHMSet
(
$memberId
,
$member
);
foreach
(
$member
as
$key
=>
$val
){
$memberDb0Redis
->
tableHSet
(
$memberId
,
$key
,
$val
);
}
}
return
$result
;
...
...
application/models/Error/CodeConfig.php
View file @
caa44875
...
...
@@ -131,6 +131,7 @@ class CodeConfigModel
const
emptyScanStoreInfo
=
40011
;
const
saveScanStoreInfoFailed
=
40012
;
const
storeNotOpen
=
40013
;
const
storeNotExistOrClose1
=
40014
;
//购物车
const
wrongCartType
=
50001
;
...
...
@@ -553,6 +554,7 @@ class CodeConfigModel
self
::
emptyScanStoreInfo
=>
'扫码关注店铺不存在'
,
self
::
saveScanStoreInfoFailed
=>
'扫码店铺保存失败'
,
self
::
storeNotOpen
=>
'店铺还未配置开启'
,
self
::
storeNotExistOrClose1
=>
'店铺不存在或者已关闭'
,
//购物车相关
self
::
wrongCartType
=>
'加入购物车类型不能为空'
,
...
...
conf/application.ini
View file @
caa44875
...
...
@@ -404,7 +404,7 @@ elastic.master.scheme="http";
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"127.0.0.1"
resources.database.params.port
=
3306
resources.database.params.database
=
"qmcs"
resources.database.params.database
=
"
test
qmcs"
resources.database.params.username
=
"root"
resources.database.params.password
=
"123456"
resources.database.params.charset
=
"UTF8"
...
...
@@ -414,7 +414,7 @@ resources.database.params.driver_options.1002 = "SET NAMES utf8"
resources.database.slave.params.driver
=
"pdo_mysql"
resources.database.slave.params.hostname
=
"127.0.0.1"
resources.database.slave.params.port
=
3306
resources.database.slave.params.database
=
"qmcs"
resources.database.slave.params.database
=
"
test
qmcs"
resources.database.slave.params.username
=
"root"
resources.database.slave.params.password
=
"123456"
resources.database.slave.params.charset
=
"UTF8"
...
...
@@ -449,49 +449,55 @@ elastic.master.scheme="http";
[lyztest : common]
; 数据库配置
resources.database.params.driver
=
"pdo_mysql"
resources.database.params.hostname
=
"1
27.0.0.1
"
resources.database.params.hostname
=
"1
06.14.14.233
"
resources.database.params.port
=
3306
resources.database.params.database
=
"
test
qmcs"
resources.database.params.database
=
"qmcs"
resources.database.params.username
=
"root"
resources.database.params.password
=
"
123456
"
resources.database.params.password
=
"
!@#$%12345werty
"
resources.database.params.charset
=
"UTF8"
resources.database.params.driver_options.1002
=
"SET NAMES utf8"
; 从库配置
resources.database.slave.params.driver
=
"pdo_mysql"
resources.database.slave.params.hostname
=
"1
27.0.0.1
"
resources.database.slave.params.hostname
=
"1
06.14.14.233
"
resources.database.slave.params.port
=
3306
resources.database.slave.params.database
=
"
test
qmcs"
resources.database.slave.params.database
=
"qmcs"
resources.database.slave.params.username
=
"root"
resources.database.slave.params.password
=
"
123456
"
resources.database.slave.params.password
=
"
!@#$%12345werty
"
resources.database.slave.params.charset
=
"UTF8"
resources.database.slave.params.driver_options.1002
=
"SET NAMES utf8"
password.key
=
'~!@#$`1234qwertasdfgzxcvb'
; mongodb
resources.database.mongo.params.driver
=
"scram"
resources.database.mongo.params.hostname
=
"106.14.14.233"
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"
redis.database.params.host
=
"127.0.0.1"
redis.database.params.port
=
"6379"
redis.database.params.prefix
=
"qm_"
;redis.database.params.password = "23456ertyu"
redis.database.params.password
=
"23456ertyu"
out.config
=
"/data/config"
out.config
=
"/data/config"
;
;锁文件
out.locks
=
"/data/locks"
;
; redis配置
;redis.database.params.password = "test"
;推送配置
push.clientHost
=
"ws://192.168.80.1
34
:9502"
push.host
=
"1
92.168.134.18
"
push.clientHost
=
"ws://192.168.80.1
8
:9502"
push.host
=
"1
27.0.0.1
"
push.port
=
"9503"
push.open
=
1
push.user.service.id
=
293
push.user.service.type
=
7
elastic.master.host
=
"192.168.1.201"
elastic.master.port
=
"9200"
elastic.master.scheme
=
"http"
;
password.key
=
'~!@#$`1234qwertasdfgzxcvb'
[linqing : common]
; 数据库配置
...
...
scripts/crontab/store/storeStat.php
0 → 100644
View file @
caa44875
<?php
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 cliStoreStoreStat
* User: King <358887571@qq.com>
* Date: 2018/11/30 0030
* Time: 下午 3:00
*
*/
class
cliStoreStoreStat
extends
basecli
{
const
CLI_ADMIN_ID
=
255
;
private
$bDoUnLock
=
FALSE
;
// 是否允许释放 LOCK 文件
private
$_debug
=
0
;
private
$lockFileName
;
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
);
}
}
/**
* 自动统计商品
* User: linqin <358887571@qq.com>
* Date: 2018/11/27 0027
* Time: 下午 3:23
*/
protected
function
autoStatGoods
(){
$service
=
\Business\Store\StoreServiceModel
::
getInstance
(
\Our\DbNameConst
::
masterDBConnectName
);
$service
->
baseDir
=
\Our\Common
::
getConfig
(
'out.config'
);
echo
"update store stat
\n
"
;
if
(
$service
->
updateStatStore
())
{
//更新商品基础信息
echo
"update store others
\n
"
;
//$goodsService->updateStatGoodsSell();
}
}
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
(
'goods'
);
if
(
!
$this
->
mkdirs
(
$lockDir
)){
echo
'****create dir fail ****'
;
exit
;
}
$this
->
lockFileName
=
$lockDir
.
DS
.
'stat.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
;
if
(
APP_ENV
==
'pre'
||
APP_ENV
==
'product'
){
file_put_contents
(
$this
->
lockFileName
,
"running"
);
// CLI 独占锁
}
$this
->
autoStatGoods
();
echo
date
(
'Y-m-d H:i:s'
,
TIMESTAMP
)
.
'定单关闭消息成功'
.
"
\r\n
"
;
}
}
$oCli
=
new
cliStoreStoreStat
(
TRUE
);
EXIT
;
?>
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