Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
goods
Project
Project
Details
Activity
Releases
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
bp
goods
Commits
0c301941
Commit
0c301941
authored
Aug 30, 2021
by
jianghaiming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:修改上架时间的判断
parent
85fc04ad
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
17 deletions
+44
-17
GoodsException.php
application/exception/custom/GoodsException.php
+1
-0
GoodsService.php
application/services/goods/GoodsService.php
+43
-17
No files found.
application/exception/custom/GoodsException.php
View file @
0c301941
...
@@ -65,5 +65,6 @@ class GoodsException extends BaseException
...
@@ -65,5 +65,6 @@ class GoodsException extends BaseException
46
=>
'已经执行过cancel'
,
46
=>
'已经执行过cancel'
,
47
=>
'sku rollback error'
,
47
=>
'sku rollback error'
,
48
=>
'请满足以下条件后提交,售价-分销总金额-手续费>=结算价'
,
48
=>
'请满足以下条件后提交,售价-分销总金额-手续费>=结算价'
,
49
=>
'商品过期时间小于等于,上架时间'
,
];
];
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
0c301941
...
@@ -278,6 +278,15 @@ class GoodsService
...
@@ -278,6 +278,15 @@ class GoodsService
break
;
break
;
}
}
if
(
!
empty
(
$skuData
[
"online_type"
]))
{
//立即上架和定时上架
if
(
in_array
(
$skuData
[
"online_type"
],
[
1
,
2
]))
{
if
(
$skuData
[
"expiration_time"
]
<=
$skuData
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
49
]);
}
}
}
GoodsSku
::
save
(
$skuParams
);
GoodsSku
::
save
(
$skuParams
);
self
::
addGoodsSkuPicRecord
(
$skuId
,
$skuData
);
self
::
addGoodsSkuPicRecord
(
$skuId
,
$skuData
);
return
$skuId
;
return
$skuId
;
...
@@ -426,14 +435,12 @@ class GoodsService
...
@@ -426,14 +435,12 @@ class GoodsService
];
];
}
}
if
(
$status
==
GoodsSku
::
STATUS_PASS
)
{
$online_type
=
empty
(
$sku
[
"online_type"
])
?
0
:
$sku
[
"online_type"
];
$online_type
=
empty
(
$sku
[
"online_type"
])
?
0
:
$sku
[
"online_type"
];
if
(
$online_type
==
1
)
{
if
(
$online_type
==
1
)
{
if
(
$status
==
GoodsSku
::
STATUS_PASS
)
{
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_ONLINE
;
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_ONLINE
;
$statusData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
$statusData
[
'online_start_time'
]
=
date
(
"Y-m-d H:i:s"
);
}
}
}
//定点上架
//定点上架
if
(
$online_type
==
2
)
{
if
(
$online_type
==
2
)
{
...
@@ -445,7 +452,8 @@ class GoodsService
...
@@ -445,7 +452,8 @@ class GoodsService
//暂不上架
//暂不上架
if
(
$online_type
==
3
)
{
if
(
$online_type
==
3
)
{
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_NO_ONLINE
;
$statusData
[
'online_status'
]
=
GoodsSku
::
ONLINE_STATUS_OFFLINE
;
}
}
}
GoodsSku
::
save
(
$statusData
,
[
"goods_sku_id"
=>
$sku
[
"goods_sku_id"
]]);
GoodsSku
::
save
(
$statusData
,
[
"goods_sku_id"
=>
$sku
[
"goods_sku_id"
]]);
...
@@ -571,6 +579,7 @@ class GoodsService
...
@@ -571,6 +579,7 @@ class GoodsService
$goodsSkuList
=
GoodsSku
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
$goodsSkuList
=
GoodsSku
::
select
(
"*"
,
[
"goods_spu_id"
=>
$goodsSpuId
]);
if
(
!
empty
(
$goodsSkuList
))
{
if
(
!
empty
(
$goodsSkuList
))
{
foreach
(
$goodsSkuList
as
$sku
)
{
foreach
(
$goodsSkuList
as
$sku
)
{
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuId
=
$sku
[
"goods_sku_id"
];
$goodsSkuData
=
[
$goodsSkuData
=
[
"online_type"
=>
$onlineType
,
"online_type"
=>
$onlineType
,
...
@@ -597,6 +606,13 @@ class GoodsService
...
@@ -597,6 +606,13 @@ class GoodsService
}
}
}
}
//立即上架和定时上架
if
(
in_array
(
$onlineType
,
[
1
,
2
]))
{
if
(
$sku
[
"expiration_time"
]
<=
$goodsSkuData
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
49
]);
}
}
GoodsSku
::
save
(
$goodsSkuData
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
GoodsSku
::
save
(
$goodsSkuData
,
[
"goods_sku_id"
=>
$goodsSkuId
]);
//上架的话,生成快照
//上架的话,生成快照
self
::
addGoodsSnapshot
(
$sku
);
self
::
addGoodsSnapshot
(
$sku
);
...
@@ -828,6 +844,16 @@ class GoodsService
...
@@ -828,6 +844,16 @@ class GoodsService
$skuParams
[
'online_type'
]
=
empty
(
$params
[
"online_type"
])
?
0
:
$params
[
"online_type"
];
$skuParams
[
'online_type'
]
=
empty
(
$params
[
"online_type"
])
?
0
:
$params
[
"online_type"
];
}
}
if
(
!
empty
(
$params
[
"online_type"
]))
{
//立即上架和定时上架
if
(
in_array
(
$params
[
"online_type"
],
[
1
,
2
]))
{
if
(
$skuData
[
"expiration_time"
]
<=
$skuParams
[
'online_start_time'
])
{
throw
new
GoodsException
([
"cus"
=>
49
]);
}
}
}
//商品操作记录
//商品操作记录
$record
=
[
$record
=
[
"goods_spu_id"
=>
$skuData
[
"goods_spu_id"
],
"goods_spu_id"
=>
$skuData
[
"goods_spu_id"
],
...
...
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