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
7b2d93f7
Commit
7b2d93f7
authored
Jan 10, 2019
by
liuyuzhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lyz' of git.shenbd.com:qm-develop/shenbd into lyz
parents
38bdadab
849551af
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
260 additions
and
119 deletions
+260
-119
Common.php
application/controllers/Common.php
+3
-0
Home.php
application/controllers/Home.php
+3
-0
GoodsClassService.php
application/models/Business/Goods/GoodsClassService.php
+3
-4
GoodsCommonService.php
application/models/Business/Goods/GoodsCommonService.php
+2
-1
GroupSaleService.php
application/models/Business/Goods/GroupSaleService.php
+2
-1
ClassStoreService.php
application/models/Business/Store/ClassStoreService.php
+75
-0
StoreService.php
application/models/Business/Store/StoreService.php
+1
-1
PlatformFirstClass.php
application/models/DAO/GoodsClass/PlatformFirstClass.php
+0
-112
ClassStore.php
application/models/DAO/Store/ClassStore.php
+66
-0
ClassStoreRedis.php
application/models/Redis/Db6/ClassStoreRedis.php
+105
-0
No files found.
application/controllers/Common.php
100755 → 100644
View file @
7b2d93f7
...
...
@@ -31,6 +31,9 @@ class CommonController extends \Our\Controller_AbstractIndex{
*/
public
function
setCurrentAddressAction
(){
$data
=
$this
->
req
[
\Our\NameConst
::
data
];
if
(
$data
[
'lng'
]
&&
$data
[
'lat'
]
&&
empty
(
$data
[
'cityCode'
])){
$data
[
'cityCode'
]
=
\Our\Common
::
getCityCodeByLatLng
(
$data
[
'lat'
],
$data
[
'lng'
]);
}
$data
[
'choosedFlag'
]
=
\Our\ApiConst
::
one
;
$addressService
=
\Business\User\AddressServiceModel
::
getInstance
();
$memberId
=
$this
->
sess
->
get
(
'member_id'
);
...
...
application/controllers/Home.php
View file @
7b2d93f7
...
...
@@ -24,6 +24,9 @@ class HomeController extends \Our\Controller_AbstractIndex{
$returnData
[
'currentAddress'
]
=
$currentAddress
;
$data
=
$this
->
req
[
\Our\NameConst
::
data
];
if
(
$data
[
'lng'
]
&&
$data
[
'lat'
]
&&
empty
(
$data
[
'cityCode'
])){
$data
[
'cityCode'
]
=
\Our\Common
::
getCityCodeByLatLng
(
$data
[
'lat'
],
$data
[
'lng'
]);
}
$requestAddress
=
\Business\User\AddressServiceModel
::
getInstance
()
->
getRequestAddress
(
$data
,
$currentAddress
);
//获取首页推荐分类
$resultClasses
=
$this
->
getPlatformGoodsClassAction
(
$requestAddress
);
...
...
application/models/Business/Goods/GoodsClassService.php
View file @
7b2d93f7
...
...
@@ -66,7 +66,7 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
//验证参数
/*
$addressDao = \DAO\AddressModel::getInstance();
$addressDao
=
\DAO\AddressModel
::
getInstance
();
$validFlag
=
$addressDao
->
getValidAddress
(
$where
);
if
(
!
$validFlag
){
\Error\ErrorModel
::
throwException
(
$addressDao
->
errorCode
);
...
...
@@ -88,7 +88,6 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
if
(
$serviceParentClassIds
){
$classIds
=
array_merge
(
$serviceParentClassIds
,
$classIds
);
}
var_dump($classIds);*/
/*
//获取可快递店铺对应分类
...
...
@@ -97,12 +96,12 @@ class GoodsClassServiceModel extends \Business\AbstractModel{
$classIds = array_merge($expressClassIds,$classIds);
}
*/
$classIds
=
array
();
/*
$classIds = array();
$platformFirstClassDao = \DAO\GoodsClass\PlatformFirstClassModel::getInstance();
$firstClassList = \Our\RedisHelper::cachedFunction(\Redis\Db3\PlatformFirstClassRedisModel::getInstance(),array(&$platformFirstClassDao, 'getList'),array(),\Our\ApiConst::oneHour,array());
if($firstClassList){
$classIds = array_column($firstClassList,'gc_id');
}
}
*/
$classIdKeys
=
array_flip
(
$classIds
);
$goodsClassDao
=
\DAO\GoodsClassModel
::
getInstance
();
$parentClasses
=
$goodsClassDao
->
getParentClasses
();
...
...
application/models/Business/Goods/GoodsCommonService.php
View file @
7b2d93f7
...
...
@@ -531,7 +531,8 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$lat
=
$param
[
'lat'
];
}
$storeInfo
=
\DAO\StoreModel
::
getInstance
()
->
get
(
$commonInfo
[
'store_id'
],
false
);
$in_store_service_flag
=
\DAO\StoreModel
::
getInstance
()
->
checkAddressInServiceArea
(
array
(
'lng'
=>
$lng
,
'lat'
=>
$lat
),
$storeInfo
);
//$in_store_service_flag = \DAO\StoreModel::getInstance()->checkAddressInServiceArea(array('lng'=>$lng,'lat'=>$lat),$storeInfo);
$in_store_service_flag
=
1
;
//所在地
$area
=
''
;
if
(
$commonInfo
[
'areaid_1'
]
&&
$commonInfo
[
'areaid_2'
]){
...
...
application/models/Business/Goods/GroupSaleService.php
View file @
7b2d93f7
...
...
@@ -45,7 +45,8 @@ class GroupSaleServiceModel extends \Business\AbstractModel {
// $in_store_service && $in_store_service_flag = 1;
// }
$storeInfo
=
\DAO\StoreModel
::
getInstance
()
->
get
(
$data
[
'store_id'
],
false
);
$in_store_service_flag
=
\DAO\StoreModel
::
getInstance
()
->
checkAddressInServiceArea
(
array
(
'lng'
=>
$lng
,
'lat'
=>
$lat
),
$storeInfo
);
//$in_store_service_flag = \DAO\StoreModel::getInstance()->checkAddressInServiceArea(array('lng'=>$lng,'lat'=>$lat),$storeInfo);
$in_store_service_flag
=
1
;
$data
[
'inStoreService'
]
=
$in_store_service_flag
;
$data
[
'state'
]
=
\Our\ApiConst
::
cartGoodsOnline
;
...
...
application/models/Business/Store/ClassStoreService.php
0 → 100644
View file @
7b2d93f7
<?php
/**
* User: liuyuzhen
* Date: 2019/1/9
* Time: 17:09
* Description:
*/
namespace
Business\Store
;
use
Our\ApiConst
;
use
Our\DbNameConst
;
/**
* 店铺service
*
* @date 2018-5-15
* @author zhz
*/
class
ClassStoreServiceModel
extends
\Business\AbstractModel
{
$classStoreField
=
'store_id as storeId,store_name as storeName,store_label as storeLabel,store_intro as storeIntro,store_longitude,store_latitude,gc_id as gcId,gc_name as gcName'
;
public
function
init
()
{
}
public
function
getRecommondStores
(
$where
,
$memberId
){
$addressDao
=
\DAO\AddressModel
::
getInstance
();
$validFlag
=
$addressDao
->
getValidAddress
(
$where
);
if
(
!
$validFlag
){
\Error\ErrorModel
::
throwException
(
$addressDao
->
errorCode
);
}
$condition
[
'lat'
]
=
$where
[
'lat'
];
$condition
[
'lng'
]
=
$where
[
'lng'
];
$condition
[
'cityCode'
]
=
$where
[
'cityCode'
];
$gcId
=
$where
[
'gcId'
];
\DAO\AddressModel
::
getInstance
()
->
getValidAddress
(
$condition
);
if
(
!
$gcId
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyGcId
);
}
/* \Our\RedisHelper::cachedFunction(\Redis\Db6\ClassStoreRedisModel::getInstance(), array(&$classStoreModel, 'getList'), array(array('gc_id'=>$gcId),'store_id,fav_time'), \Our\ApiConst::oneHour,array($memberId));*/
}
public
function
getStoreListByGcId
(
$gcId
,
$position
){
$lat
=
$position
[
'lat'
];
$lng
=
$position
[
'lng'
];
$classStoreModel
=
\DAO\Store\ClassStoreModel
::
getInstance
();
$storeList
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db6\ClassStoreRedisModel
::
getInstance
(),
array
(
&
$classStoreModel
,
'getList'
),
array
(
array
(
'gc_id'
=>
$gcId
),
$this
->
classStoreField
),
\Our\ApiConst
::
oneHour
,
array
());
$newStoreList
=
array
();
if
(
$storeList
){
}
}
/**
*/
private
static
$_instance
=
null
;
/**
* 单例模式获取类实例
*
*/
public
static
function
getInstance
()
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
();
}
return
self
::
$_instance
;
}
}
application/models/Business/Store/StoreService.php
View file @
7b2d93f7
...
...
@@ -313,7 +313,7 @@ class StoreServiceModel extends \Business\AbstractModel{
$sellerDistribution
=
$storeInfo
[
'seller_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'
,
'isClose'
=>
$storeInfo
[
'isClose'
]);
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'
=>
1
,
'adv'
=>
$adv
,
'memberId'
=>
$storeInfo
[
'member_id'
],
'businessHours'
=>
$businessHours
,
'sellerDistribution'
=>
$sellerDistribution
,
'buyerDistribution'
=>
$buyerDistribution
,
'bannerColor'
=>
'#ffa92f'
,
'isClose'
=>
$storeInfo
[
'isClose'
]);
}
/**
...
...
application/models/DAO/GoodsClass/PlatformFirstClass.php
View file @
7b2d93f7
...
...
@@ -38,118 +38,6 @@ class PlatformFirstClassModel extends \DAO\AbstractModel{
$result
=
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchAll
();
return
$result
;
}
public
function
getStoreOnlineGoodsClassesByGcIdFromCache
(
$gcId
,
$storeId
,
$field
=
\Our\NameConst
::
allField
){
$gcIds
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db6\StoreOnlineGoodsClassRedisModel
::
getInstance
(),
array
(
&
$this
,
'getStoreOnlineGoodsClassesByGcId'
),
array
(
$gcId
,
$storeId
,
$field
),
\Our\ApiConst
::
oneDaySecond
,
array
(
$storeId
));
return
$gcIds
;
}
public
function
getStoreOnlineGoodsClassesByGcId
(
$gcId
,
$storeId
,
$field
=
\Our\NameConst
::
allField
){
$where
[
'gc_id_1'
]
=
$gcId
;
$where
[
'store_id'
]
=
$storeId
;
$list
=
$this
->
getList
(
$where
);
if
(
$list
){
$platThirdGcIds
=
array
();
$storeThirdGcIds
=
array
();
$secondGcIds
=
array_unique
(
array_column
(
$list
,
'gc_id_2'
));
$treeGcIds
=
array
();
foreach
(
$list
as
$temp
){
if
(
$temp
[
'gc_from'
]
==
\Our\ApiConst
::
zero
){
$platThirdGcIds
[]
=
$temp
[
'gc_id_3'
];
}
else
{
$storeThirdGcIds
[]
=
$temp
[
'gc_id_3'
];
}
if
(
!
(
isset
(
$treeGcIds
[
$temp
[
'gc_id_2'
]][
$temp
[
'gc_from'
]])
&&
in_array
(
$temp
[
'gc_id_3'
],
$treeGcIds
[
$temp
[
'gc_id_2'
]][
$temp
[
'gc_from'
]]))){
$treeGcIds
[
$temp
[
'gc_id_2'
]][
$temp
[
'gc_from'
]][]
=
$temp
[
'gc_id_3'
];
}
}
$platThirdGcIds
=
array_unique
(
$platThirdGcIds
);
$storeThirdGcIds
=
array_unique
(
$storeThirdGcIds
);
return
array
(
'secondGcIds'
=>
$secondGcIds
,
'treeGcIds'
=>
$treeGcIds
,
'platThirdGcIds'
=>
$platThirdGcIds
,
'storeThirdGcIds'
=>
$storeThirdGcIds
);
}
return
false
;
}
/**
* 检查获取店铺一级在售分类传参是否正确
*/
public
function
checkStoreTopClasses
(
$data
){
if
(
!
isset
(
$data
[
'storeId'
])){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyStoreIdForOnlineTopClass
);
}
}
/**
* 检查获取店铺下级在售分类及广告传参是否正确
*/
public
function
checkStoreChildrenClasses
(
$data
){
if
(
!
isset
(
$data
[
'storeId'
])){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emptyStoreIdForOnlineChildrenClass
);
}
if
(
!
isset
(
$data
[
'gcId'
])){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
emtpyGcIdForOnlineChildrenClass
);
}
}
/**
* 商品详情发生改变存如缓存
* @param $goodsCommon goodsCommon详情
* @param int $type 操作类型(1:加,0:减)
* @return bool
*/
public
function
addGoodsToGoodsClassCache
(
$goodsCommon
,
$type
=
\Our\ApiConst
::
plus
){
if
(
!
$goodsCommon
){
return
false
;
}
$goodsClass
[
'gc_id_1'
]
=
$goodsCommon
[
'gc_id_1'
];
$goodsClass
[
'gc_id_2'
]
=
$goodsCommon
[
'gc_id_2'
];
$goodsClass
[
'gc_id_3'
]
=
$goodsCommon
[
'gc_id_3'
];
$goodsClass
[
'store_id'
]
=
$goodsCommon
[
'store_id'
];
$goodsClass
[
'gc_from'
]
=
\Our\ApiConst
::
zero
;
if
(
$goodsClass
[
'gc_id_3'
]){
$this
->
addChangedGoodsClass
(
serialize
(
$goodsClass
),
$type
);
}
if
(
$goodsCommon
[
'goods_class_t_id'
]){
$goodsClass
[
'gc_id_3'
]
=
$goodsCommon
[
'goods_class_t_id'
];
$goodsClass
[
'gc_from'
]
=
\Our\ApiConst
::
one
;
$this
->
addChangedGoodsClass
(
serialize
(
$goodsClass
),
$type
);
}
return
true
;
}
public
function
addChangedGoodsClass
(
$goodsClass
,
$type
=
\Our\ApiConst
::
plus
){
$key
=
'changedAddGoodsClass'
;
if
(
$type
==
\Our\ApiConst
::
minus
){
$key
=
'changedMinusGoodsClass'
;
}
$storeOnlineClassRedisModel
=
\Redis\Db6\StoreOnlineGoodsClassRedisModel
::
getInstance
();
$storeOnlineClassRedisModel
->
tableLPush
(
$key
,
$goodsClass
);
}
public
function
getChangedGoodsClass
(
$type
=
\Our\ApiConst
::
plus
){
$key
=
'changedAddGoodsClass'
;
if
(
$type
==
\Our\ApiConst
::
minus
){
$key
=
'changedMinusGoodsClass'
;
}
$storeOnlineClassRedisModel
=
\Redis\Db6\StoreOnlineGoodsClassRedisModel
::
getInstance
();
return
$storeOnlineClassRedisModel
->
tableLPop
(
$key
);
}
/**
* 获取更改商品
* @param $start 记录开始条数
* @param $end 记录结束条数
* @return \Redis\mix
*/
public
function
getChangedGoodsClasses
(
$start
,
$end
,
$type
=
\Our\ApiConst
::
plus
){
$key
=
'changedAddGoodsClass'
;
if
(
$type
==
\Our\ApiConst
::
minus
){
$key
=
'changedMinusGoodsClass'
;
}
$storeOnlineClassRedisModel
=
\Redis\Db6\StoreOnlineGoodsClassRedisModel
::
getInstance
();
return
$storeOnlineClassRedisModel
->
tableLRange
(
$key
,
$start
,
$end
);
}
/**
* 类实例
*/
...
...
application/models/DAO/Store/ClassStore.php
0 → 100644
View file @
7b2d93f7
<?php
/**
* User: liuyuzhen
* Date: 2019/1/9
* Time: 16:52
* Description:
*/
namespace
DAO\Store
;
class
ClassStoreModel
extends
\DAO\AbstractModel
{
protected
function
init
()
{
}
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_class_store'
;
/**
* 主键
*
* @var string
*/
protected
$_primaryKey
=
'id'
;
public
function
findByWhere
(
$where
){
$this
->
setDb
(
\Our\DbNameConst
::
salveDBConnectName
);
$address
=
$this
->
db
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchOne
();
return
$address
;
}
public
function
getList
(
$where
,
$field
=
\Our\NameConst
::
allField
,
$orders
=
array
(
'gc_parent_id'
=>
'asc'
,
'gc_sort'
=>
'asc'
,
'gc_id'
=>
'asc'
)){
$this
->
setDb
(
$this
->
dbName
);
$this
->
db
->
select
(
$field
)
->
from
(
$this
->
_tableName
);
if
(
$orders
){
foreach
(
$orders
as
$key
=>
$val
){
$this
->
db
->
order
(
$key
,
$val
);
}
}
$result
=
$this
->
db
->
where
(
$where
)
->
fetchAll
();
return
$result
;
}
/**
* 类实例
*/
private
static
$_instance
=
null
;
/**
* 获取类实例
*/
public
static
function
getInstance
(
$dbName
=
\Our\DbNameConst
::
salveDBConnectName
)
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
(
$dbName
);
}
return
self
::
$_instance
;
}
}
application/models/Redis/Db6/ClassStoreRedis.php
0 → 100644
View file @
7b2d93f7
<?php
namespace
Redis\Db6
;
/**
* 分类店铺信息缓存
*/
class
ClassStoreRedisModel
extends
\Redis\Db6\AbstractModel
{
/**
* 表名
*
* @var string
*/
protected
$_tableName
=
'han_class_store'
;
/**
* 计算key
*
* @param int $id
* @return string
*/
public
function
calcKey
(
$id
)
{
return
$this
->
_tableName
.
self
::
DELIMITER
.
$id
;
}
/**
* 根据id查找店铺信息
*
* @param int $id
* @return array
*/
public
function
find
(
$id
,
$expire
=
\Our\ApiConst
::
zero
)
{
$result
=
$this
->
get
(
$this
->
calcKey
(
$id
));
if
(
$expire
>
\Our\ApiConst
::
zero
){
$this
->
expire
(
$this
->
calcKey
(
$id
),
$expire
);
}
if
(
$this
->
is_serialized
(
$result
)){
return
unserialize
(
$result
);
}
return
$result
;
}
/**
* 更新数据
*
* @param int $id
* @param array $data
*/
public
function
update
(
$id
,
$data
,
$expire
=
0
)
{
return
$this
->
set
(
$this
->
calcKey
(
$id
),
serialize
(
$data
),
$expire
);
}
public
function
tableHSet
(
$h
,
$key
,
$val
,
$experio
=
0
){
return
$this
->
hset
(
$this
->
calcKey
(
$h
),
$key
,
$val
,
$experio
);
}
public
function
tableHGet
(
$h
,
$key
){
return
$this
->
hget
(
$this
->
calcKey
(
$h
),
$key
);
}
public
function
tableHMSet
(
$h
,
$keysvalue
,
$experio
=
0
){
return
$this
->
hmset
(
$this
->
calcKey
(
$h
),
$keysvalue
,
$experio
);
}
public
function
tableHMGet
(
$h
,
$keyvalues
){
return
$this
->
hmget
(
$this
->
calcKey
(
$h
),
$keyvalues
);
}
public
function
tableHGAll
(
$h
){
return
$this
->
hGetAll
(
$this
->
calcKey
(
$h
));
}
public
function
tableDel
(
$h
){
return
$this
->
del
(
$this
->
calcKey
(
$h
));
}
public
function
tableCacheGet
(
$id
){
$result
=
$this
->
get
(
$this
->
calcKey
(
$id
));
return
$result
;
}
public
function
tableCacheSet
(
$id
,
$data
,
$experio
){
$res
=
$this
->
set
(
$this
->
calcKey
(
$id
),
$data
,
$experio
);
return
$res
;
}
/**
* 类实例
*
* @var \Redis\Db0\UserModel
*/
private
static
$_instance
=
null
;
/**
* 获取类实例
*
* @return \Redis\Db0\UserModel
*/
public
static
function
getInstance
()
{
if
(
!
(
self
::
$_instance
instanceof
self
))
{
self
::
$_instance
=
new
self
();
}
return
self
::
$_instance
;
}
}
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