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
080fe413
Commit
080fe413
authored
Aug 30, 2018
by
zhz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
collectgoods
parent
e0816322
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
4 deletions
+15
-4
MemberCenterService.php
application/models/Business/User/MemberCenterService.php
+11
-4
Favorites.php
application/models/DAO/Favorites.php
+4
-0
No files found.
application/models/Business/User/MemberCenterService.php
View file @
080fe413
...
...
@@ -57,7 +57,7 @@ class MemberCenterServiceModel extends \Business\AbstractModel
//店铺收藏数量
$memberCenter
[
NameConst
::
storeCollection
]
=
\DAO\FavoritesStoreModel
::
getInstance
()
->
getFavoritesStoreCount
(
array
(
'member_id'
=>
$memberId
,
'fav_type'
=>
1
));
//商品收藏数量
$memberCenter
[
NameConst
::
goodsCollection
]
=
\DAO\FavoritesModel
::
getInstance
()
->
getFavoritesCount
(
array
(
'member_id'
=>
$memberId
,
'isdel'
=>
0
)
);
$memberCenter
[
NameConst
::
goodsCollection
]
=
\DAO\FavoritesModel
::
getInstance
()
->
getFavoritesCount
WithCommon
(
null
,
$memberId
);
//足迹数量
$memberCenter
[
NameConst
::
footprint
]
=
\DAO\GoodsBrowseModel
::
getInstance
()
->
getBrowseCount
(
array
(
'member_id'
=>
$memberId
));
$memebrCenterDb1Redis
->
tableHMSet
(
$memberId
,
$memberCenter
);
...
...
@@ -67,7 +67,7 @@ class MemberCenterServiceModel extends \Business\AbstractModel
$memebrCenterDb1Redis
->
tableHSet
(
$memberId
,
NameConst
::
footprint
,
$memberCenter
[
NameConst
::
footprint
]);
}
if
(
$memebrCenterDb1Redis
->
tableHExists
(
$memberId
,
NameConst
::
goodsCollection
)
===
false
){
$memberCenter
[
NameConst
::
goodsCollection
]
=
\DAO\FavoritesModel
::
getInstance
()
->
getFavoritesCount
(
array
(
'member_id'
=>
$memberId
,
'isdel'
=>
0
)
);
$memberCenter
[
NameConst
::
goodsCollection
]
=
\DAO\FavoritesModel
::
getInstance
()
->
getFavoritesCount
WithCommon
(
null
,
$memberId
);
$memebrCenterDb1Redis
->
tableHSet
(
$memberId
,
NameConst
::
goodsCollection
,
$memberCenter
[
NameConst
::
goodsCollection
]);
}
if
(
$memebrCenterDb1Redis
->
tableHExists
(
$memberId
,
NameConst
::
waitPay
)
===
false
){
...
...
@@ -214,11 +214,11 @@ class MemberCenterServiceModel extends \Business\AbstractModel
$pageIndex
=
$pageIndex
+
\Our\ApiConst
::
one
;
$keyword
=
trim
(
$param
[
'keyword'
]);
$memberCenter
=
$this
->
getStatistics
(
$memberId
);
$totalCount
=
(
int
)
$memberCenter
[
'goodsCollection'
];
$totalCount
=
0
;
$field
=
'han_goods_common.goods_commonid,han_goods_common.goods_id,han_goods_common.store_id,goods_name,goods_price,goods_image,favid'
;
$param
[
'keyword'
]
&&
$where
=
"goods_name like '%
{
$param
[
'keyword'
]
}
%'"
;
//$list = \DAO\FavoritesStoreModel::getInstance()->getList($where,$field,$pageIndex,$pageSize,$memberId);
$favoritesInstance
=
\DAO\FavoritesModel
::
getInstance
();
$list
=
\Our\RedisHelper
::
cachedFunction
(
\Redis\Db4\FavoritesRedisModel
::
getInstance
(),
array
(
&
$favoritesInstance
,
'getList'
),
array
(
$where
,
$field
,
$pageIndex
,
$pageSize
,
$memberId
),
\Our\ApiConst
::
oneDaySecond
,
array
(
$memberId
));
...
...
@@ -257,6 +257,13 @@ class MemberCenterServiceModel extends \Business\AbstractModel
$goods
[]
=
array
(
'favid'
=>
$v
[
'favid'
],
'goodsCommonId'
=>
$v
[
'goods_commonid'
],
'goodsImage'
=>
\Our\ImageUtil
::
getGoodsImgUrl
(
$v
[
'goods_image'
]),
'goodsName'
=>
$v
[
'goods_name'
],
'goodsPrice'
=>
$v
[
'goods_price'
],
'goodsId'
=>
$v
[
'goods_id'
]);
// }
}
if
(
$where
)
{
$totalCount
=
$favoritesInstance
->
getFavoritesCountWithCommon
(
$where
,
$memberId
);
}
else
{
$memberCenter
=
$this
->
getStatistics
(
$memberId
);
$totalCount
=
(
int
)
$memberCenter
[
'goodsCollection'
];
}
}
return
array
(
'goods'
=>
$goods
,
'totalCount'
=>
$totalCount
);
}
...
...
application/models/DAO/Favorites.php
View file @
080fe413
...
...
@@ -49,6 +49,10 @@ class FavoritesModel extends \DAO\AbstractModel {
$this
->
setDb
(
$this
->
dbName
);
return
$this
->
db
->
from
(
$this
->
_tableName
)
->
where
(
$where
)
->
fetchNum
();
}
public
function
getFavoritesCountWithCommon
(
$where
,
$memberId
){
$this
->
setDb
(
$this
->
dbName
);
return
$this
->
db
->
from
(
$this
->
_tableName
)
->
join
(
'han_goods_common'
,
"han_favorites.goods_commonid = han_goods_common.goods_commonid"
,
'inner'
)
->
where
([
'han_favorites.member_id'
=>
$memberId
,
'isdel'
=>
0
])
->
where
(
$where
)
->
fetchNum
();
}
public
function
insertOrUpdate
(
$data
){
$this
->
setDb
(
\Our\DbNameConst
::
masterDBConnectName
);
$baseSql
=
"insert into
{
$this
->
_tableName
}
(member_id,goods_commonid,fav_time) values(
{
0},{1},{2
}
) ON DUPLICATE KEY UPDATE isdel=0"
;
...
...
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