refactor(api): 优化产品数据处理
- 在 IndexController 中添加数据解码步骤 - 使用 json_decode 将请求数据转换为关联数组 - 优化产品 ID 的验证逻辑
This commit is contained in:
parent
c6906f36e5
commit
834532a24d
@ -286,6 +286,7 @@ class IndexController extends BaseApiController
|
|||||||
{
|
{
|
||||||
$data = $this->request->post();
|
$data = $this->request->post();
|
||||||
if ($data) {
|
if ($data) {
|
||||||
|
$data=json_decode($data,true);
|
||||||
if ($data['product_id'] > 0) {
|
if ($data['product_id'] > 0) {
|
||||||
$find = Db::name('wps_product')->where('product_id', $data['product_id'])->find();
|
$find = Db::name('wps_product')->where('product_id', $data['product_id'])->find();
|
||||||
$arr = [];
|
$arr = [];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user