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
4507ba0c
Commit
4507ba0c
authored
Dec 14, 2018
by
liuyuzhen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master_dev' of git.shenbd.com:qm-develop/shenbd into lyz
parents
dbfb3838
e8edbe52
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
43 deletions
+8
-43
GoodsCommonService.php
application/models/Business/Goods/GoodsCommonService.php
+8
-43
No files found.
application/models/Business/Goods/GoodsCommonService.php
View file @
4507ba0c
...
...
@@ -10,7 +10,7 @@ use Zend\Json\Server\Exception\ErrorException;
class
GoodsCommonServiceModel
extends
\Business\AbstractModel
{
private
$goodsStorageField
=
'goods_id goodsId,goods_name goodsName,goods_verify goodsVerify,goods_state goodsState,goods_image goodsImage,goods_price goodsPrice,goods_storage goodsStorage,goods_spec goodsAttr
,goods_storage_alarm as goodsStorageAlarm
'
;
private
$goodsStorageField
=
'goods_id goodsId,goods_name goodsName,goods_verify goodsVerify,goods_state goodsState,goods_image goodsImage,goods_price goodsPrice,goods_storage goodsStorage,goods_spec goodsAttr'
;
private
$setStorageType
=
array
(
'add'
=>
1
,
'set'
=>
2
);
public
function
init
()
{
...
...
@@ -28,8 +28,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
*/
public
function
setGoodsStorage
(
$storeId
,
$goodsId
,
$num
=
0
,
$type
=
'add'
)
{
$orderService
=
\Business\Order\OrderServiceModel
::
getInstance
();
$goodsDao
=
\DAO\GoodsModel
::
getInstance
(
DbNameConst
::
masterDBConnectName
);
$commonDao
=
\DAO\GoodsCommonModel
::
getInstance
();
if
(
$goodsId
===
0
){
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
commonError
);
}
...
...
@@ -38,21 +36,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
else
{
$type
=
ApiConst
::
set
;
$where
=
array
();
$where
[
'store_id'
]
=
$storeId
;
$where
[
'goods_id'
]
=
$goodsId
;
$data
=
$goodsDao
->
find
(
$where
,
'goods_id, goods_commonid'
);
$goodsDao
->
setDb
(
$goodsDao
->
dbName
);
$goodsDao
->
db
->
doTransaction
();
$ret1
=
$goodsDao
->
updateStorage
(
$goodsId
,
$num
,
ApiConst
::
zero
);
$ret2
=
$commonDao
->
updateStorage
(
$data
[
'goods_commonid'
],
ApiConst
::
zero
);
if
(
!
$ret1
||
!
$ret2
)
{
$goodsDao
->
db
->
doRollback
();
\Error\ErrorModel
::
throwException
(
\Error\CodeConfigModel
::
updateGoodsStorageForOrder
);
}
$goodsDao
->
db
->
doCommit
();
return
true
;
}
$res
=
$orderService
->
updateGoodsStoregeByGoodsIds
(
$storeId
,
$goodsId
,
$num
,
$type
);
return
$res
;
...
...
@@ -103,7 +86,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where
=
array
();
$where
[]
=
'store_id = '
.
$storeId
;
$where
[]
=
'goods_storage_alarm > 0'
;
$where
[]
=
'goods_storage<goods_storage_alarm'
;
$where
[]
=
'goods_storage<
=
goods_storage_alarm'
;
//获得列表
if
(
$datas
=
$goodsDao
->
getList
(
implode
(
$where
,
' and '
),
$this
->
goodsStorageField
))
{
foreach
(
$datas
as
$key
=>
$val
)
{
...
...
@@ -186,7 +169,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where
[]
=
'goods_commonid in('
.
trim
(
$ids
,
','
)
.
')'
;
}
}
$order
[]
=
[
'goodsCommonid'
,
'DESC'
];
$saleSort
?
$ttl
=
\Our\ApiConst
::
oneHour
:
\Our\ApiConst
::
oneDaySecond
;
if
(
$activities
){
$activities
=
array_keys
(
$activities
);
...
...
@@ -438,13 +420,11 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
if
(
!
$result
)
{
$statGoodsDao
->
db
->
doRollback
();
}
}
if
(
$result
)
{
//商品报表更新成功
}
else
{
//商品报表更新成功
$statGoodsDao
->
db
->
doCommit
();
file_put_contents
(
$this
->
baseDir
.
\Our\PathConst
::
goodsSellStatTime
,
$endTime
);
}
}
}
...
...
@@ -486,7 +466,7 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$keyword
!==
''
&&
$where
[]
=
"goods_name like '%
{
$keyword
}
%'"
;
list
(
$_where
,
$order
,
$attrStr
,
$saleSort
)
=
$this
->
getParam
(
$attrValue
,
$minPrice
,
$maxPrice
,
$goodsSort
);
$where
=
array_merge
(
$where
,
$_where
);
$order
[]
=
[
'goodsCommonId'
,
'DESC'
];
$commonDAO
=
\DAO\GoodsCommonModel
::
getInstance
();
$saleSort
?
$ttl
=
\Our\ApiConst
::
oneHour
:
\Our\ApiConst
::
oneDaySecond
;
if
(
!
$activities
){
...
...
@@ -1364,7 +1344,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
break
;
}
}
return
true
;
}
/**
...
...
@@ -1378,9 +1357,6 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
if
(
!
$oldTemp
){
$storeOnlineGoodsClassDao
->
insert
(
$goodsClass
);
}
$storeOnlineGoodsClassDao
=
\DAO\GoodsClass\StoreOnlineGoodsClassModel
::
getInstance
();
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\StoreOnlineGoodsClassRedisModel
::
getInstance
(),
array
(
&
$storeOnlineGoodsClassDao
,
'getList'
),
array
(),
array
(
$goodsClass
[
'store_id'
]));
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\StoreOnlineGoodsClassRedisModel
::
getInstance
(),
array
(
&
$storeOnlineGoodsClassDao
,
'getStoreOnlineGoodsClassesByGcId'
),
array
(),
array
(
$goodsClass
[
'store_id'
]));
return
true
;
}
...
...
@@ -1395,18 +1371,12 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
$where
[
'store_id'
]
=
$goodsClass
[
'store_id'
];
$where
[
'goods_state'
]
=
\Our\ApiConst
::
onlineGoodsState
;
$where
[
'goods_verify'
]
=
\Our\ApiConst
::
onlineGoodsVerify
;
$where
[
'is_del'
]
=
\Our\ApiConst
::
zero
;
if
(
$gcFrom
==
\Our\ApiConst
::
one
){
$where
[
'goods_class_t_id'
]
=
$goodsClass
[
'gc_id_3'
];
}
$tempOne
=
$goodsCommonDao
->
getOne
(
$where
,
'goods_commonid'
);
if
(
!
$tempOne
){
$result
=
$storeOnlineGoodsClassDao
->
del
(
$goodsClass
);
if
(
$result
){
$storeOnlineGoodsClassDao
=
\DAO\GoodsClass\StoreOnlineGoodsClassModel
::
getInstance
();
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\StoreOnlineGoodsClassRedisModel
::
getInstance
(),
array
(
&
$storeOnlineGoodsClassDao
,
'getList'
),
array
(),
array
(
$goodsClass
[
'store_id'
]));
\Our\RedisHelper
::
delCachedFunction
(
\Redis\Db6\StoreOnlineGoodsClassRedisModel
::
getInstance
(),
array
(
&
$storeOnlineGoodsClassDao
,
'getStoreOnlineGoodsClassesByGcId'
),
array
(),
array
(
$goodsClass
[
'store_id'
]));
}
$storeOnlineGoodsClassDao
->
del
(
$goodsClass
);
}
}
}
...
...
@@ -1505,9 +1475,4 @@ class GoodsCommonServiceModel extends \Business\AbstractModel
}
public
function
syncGoodsCommonStorageByGoods
(){
$goodsCommonDao
=
\DAO\GoodsCommonModel
::
getInstance
();
$return
=
$goodsCommonDao
->
syncGoodsCommonStorageByGoods
();
}
}
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