refactor(api): 优化 wps_product 接口处理逻辑
- 新增获取 post 数据的第一个键并解码 - 重构了原始的直接解码整个数据的逻辑
This commit is contained in:
parent
adfc293568
commit
cb2187c0ff
@ -285,10 +285,11 @@ class IndexController extends BaseApiController
|
||||
public function wps_product()
|
||||
{
|
||||
$data = $this->request->post();
|
||||
return $this->success('ok',$data);
|
||||
|
||||
if ($data) {
|
||||
$data=json_decode($data,true);
|
||||
$keys = array_keys($data); // 获取所有键
|
||||
$firstKey = $keys[0]; // 获取第一个键
|
||||
$data=json_decode($firstKey,true);
|
||||
if ($data['product_id'] > 0) {
|
||||
$find = Db::name('wps_product')->where('product_id', $data['product_id'])->find();
|
||||
$arr = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user