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
f73b5cb1
Commit
f73b5cb1
authored
Jun 29, 2021
by
luhongguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update:rule_start_time 和 rule_end_time
parent
c461ec25
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
0 deletions
+32
-0
GoodsException.php
application/exception/custom/GoodsException.php
+2
-0
GoodsService.php
application/services/goods/GoodsService.php
+30
-0
No files found.
application/exception/custom/GoodsException.php
View file @
f73b5cb1
...
@@ -36,5 +36,7 @@ class GoodsException extends BaseException
...
@@ -36,5 +36,7 @@ class GoodsException extends BaseException
22
=>
'规则说明存在敏感词,请修改后提交'
,
22
=>
'规则说明存在敏感词,请修改后提交'
,
23
=>
'商品快照数据不存在'
,
23
=>
'商品快照数据不存在'
,
24
=>
'当前商品库存不足'
,
24
=>
'当前商品库存不足'
,
25
=>
'开始时间格式不对'
,
26
=>
'结束时间格式不对'
,
];
];
}
}
\ No newline at end of file
application/services/goods/GoodsService.php
View file @
f73b5cb1
...
@@ -178,6 +178,10 @@ class GoodsService
...
@@ -178,6 +178,10 @@ class GoodsService
throw
new
GoodsException
([
'cus'
=>
22
]);
throw
new
GoodsException
([
'cus'
=>
22
]);
}
}
if
(
!
empty
(
$skuData
[
"rule_start_time"
])
||
!
empty
(
$skuData
[
"rule_end_time"
]))
{
self
::
checkoutRuleTime
(
$skuData
[
"rule_start_time"
],
$skuData
[
"rule_end_time"
]);
}
$skuParams
=
[
$skuParams
=
[
"goods_sku_id"
=>
$skuId
,
"goods_sku_id"
=>
$skuId
,
"goods_spu_id"
=>
$spuData
[
"goods_spu_id"
],
"goods_spu_id"
=>
$spuData
[
"goods_spu_id"
],
...
@@ -195,6 +199,8 @@ class GoodsService
...
@@ -195,6 +199,8 @@ class GoodsService
"rule_limit"
=>
$skuData
[
"rule_limit"
],
"rule_limit"
=>
$skuData
[
"rule_limit"
],
"rule_desc"
=>
$skuData
[
"rule_desc"
],
"rule_desc"
=>
$skuData
[
"rule_desc"
],
"rule_refund"
=>
$skuData
[
"rule_refund"
],
"rule_refund"
=>
$skuData
[
"rule_refund"
],
"rule_start_time"
=>
$skuData
[
"rule_start_time"
],
"rule_end_time"
=>
$skuData
[
"rule_end_time"
],
"inventory_total"
=>
$skuData
[
"inventory"
],
"inventory_total"
=>
$skuData
[
"inventory"
],
"inventory_rest"
=>
$skuData
[
"inventory"
],
"inventory_rest"
=>
$skuData
[
"inventory"
],
"original_price"
=>
$skuData
[
"original_price"
]
*
100
,
"original_price"
=>
$skuData
[
"original_price"
]
*
100
,
...
@@ -547,6 +553,9 @@ class GoodsService
...
@@ -547,6 +553,9 @@ class GoodsService
if
(
$checkGoodsRuleDesc
)
{
if
(
$checkGoodsRuleDesc
)
{
throw
new
GoodsException
([
'cus'
=>
22
]);
throw
new
GoodsException
([
'cus'
=>
22
]);
}
}
if
(
!
empty
(
$params
[
"rule_start_time"
])
||
!
empty
(
$params
[
"rule_end_time"
]))
{
self
::
checkoutRuleTime
(
$params
[
"rule_start_time"
],
$params
[
"rule_end_time"
]);
}
//门店
//门店
$subShopIdStr
=
$params
[
"sub_shop_ids"
];
//逗号分割
$subShopIdStr
=
$params
[
"sub_shop_ids"
];
//逗号分割
...
@@ -564,6 +573,8 @@ class GoodsService
...
@@ -564,6 +573,8 @@ class GoodsService
"rule_limit"
=>
$params
[
"rule_limit"
],
"rule_limit"
=>
$params
[
"rule_limit"
],
"rule_desc"
=>
$params
[
"rule_desc"
],
"rule_desc"
=>
$params
[
"rule_desc"
],
"rule_refund"
=>
$params
[
"rule_refund"
],
"rule_refund"
=>
$params
[
"rule_refund"
],
"rule_start_time"
=>
$params
[
"rule_start_time"
],
"rule_end_time"
=>
$params
[
"rule_end_time"
],
"inventory_total"
=>
$skuData
[
"inventory_total"
]
+
$params
[
"inventory_add"
],
"inventory_total"
=>
$skuData
[
"inventory_total"
]
+
$params
[
"inventory_add"
],
"inventory_rest"
=>
$inventoryCount
,
"inventory_rest"
=>
$inventoryCount
,
"original_price"
=>
$params
[
"original_price"
]
*
100
,
"original_price"
=>
$params
[
"original_price"
]
*
100
,
...
@@ -622,6 +633,25 @@ class GoodsService
...
@@ -622,6 +633,25 @@ class GoodsService
||
$params
[
"price"
]
!=
$sku
[
"price"
];
||
$params
[
"price"
]
!=
$sku
[
"price"
];
}
}
/**
* @param $ruleStartTime
* @param $ruleEndTime
* @throws GoodsException
*/
private
static
function
checkoutRuleTime
(
$ruleStartTime
,
$ruleEndTime
)
{
$startArr
=
explode
(
":"
,
$ruleStartTime
);
if
(
!
(
isset
(
$startArr
[
0
])
&&
(
int
)
$startArr
[
0
]
>=
0
&&
(
int
)
$startArr
[
0
]
<=
23
)
||
!
(
isset
(
$startArr
[
1
])
&&
(
int
)
$startArr
[
1
]
>=
0
&&
(
int
)
$startArr
[
1
]
<=
59
))
{
throw
new
GoodsException
([
'cus'
=>
25
]);
}
$endArr
=
explode
(
":"
,
$ruleEndTime
);
if
(
!
(
isset
(
$endArr
[
0
])
&&
(
int
)
$endArr
[
0
]
>=
0
&&
(
int
)
$endArr
[
0
]
<=
23
)
||
!
(
isset
(
$endArr
[
1
])
&&
(
int
)
$endArr
[
1
]
>=
0
&&
(
int
)
$endArr
[
1
]
<=
59
))
{
throw
new
GoodsException
([
'cus'
=>
26
]);
}
}
/**
/**
* 后台用商品详情
* 后台用商品详情
* @param array $params
* @param array $params
...
...
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