From 91877cd4a3d59ccf1fcb39829dd85b72eaaf0a60 Mon Sep 17 00:00:00 2001 From: mkm <727897186@qq.com> Date: Fri, 29 Nov 2024 20:58:15 +0800 Subject: [PATCH] =?UTF-8?q?refactor(api):=20=E4=BC=98=E5=8C=96=20wps=5Fpro?= =?UTF-8?q?duct=20=E6=8E=A5=E5=8F=A3=E5=B9=B6=E7=A7=BB=E9=99=A4=E6=9C=AA?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 移除了 notNeedLogin 数组中的 'wps_product' 方法 - 优化了 wps_product 方法的逻辑,移除了不必要的解码和重新编码过程 - 删除了未使用的返回语句 --- app/api/controller/IndexController.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/app/api/controller/IndexController.php b/app/api/controller/IndexController.php index 0b265295..86b30def 100644 --- a/app/api/controller/IndexController.php +++ b/app/api/controller/IndexController.php @@ -53,7 +53,7 @@ use PhpOffice\PhpWord\Style\Font; class IndexController extends BaseApiController { - public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config', 'push', 'purchase_product_offer','wps_product']; + public $notNeedLogin = ['index', 'app_update', 'express_list', 'province', 'city', 'area', 'street', 'village', 'brigade', 'config', 'push', 'purchase_product_offer']; public function index() { @@ -285,11 +285,7 @@ class IndexController extends BaseApiController public function wps_product() { $data = $this->request->post(); - if ($data) { - $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 = []; @@ -310,7 +306,6 @@ class IndexController extends BaseApiController Db::name('wps_product')->insert($arr); } } - return $this->success('ok'); } else { return $this->fail('时间不能为空'); }