From 6d5bda47851782efcf5743ef591a6e423b837c04 Mon Sep 17 00:00:00 2001 From: heyuntao <heyuntao@LAPTOP-MP4HD5NS> Date: 星期一, 12 六月 2023 14:19:40 +0800 Subject: [PATCH] 剪贴板问题修复 --- application/api/logic/UserBrowse.php | 25 +++++++++++++++++++++++-- 1 files changed, 23 insertions(+), 2 deletions(-) diff --git a/application/api/logic/UserBrowse.php b/application/api/logic/UserBrowse.php index 6512126..87ecb61 100644 --- a/application/api/logic/UserBrowse.php +++ b/application/api/logic/UserBrowse.php @@ -82,16 +82,37 @@ */ public function updatefirstfreelog($user_id,$ids,$new_goodsId) { - if(empty($ids)){ + if(empty($ids)||empty($new_goodsId)){ fault('瀹濊礉ID涓嶈兘涓虹┖'); return true; } - $res=Db::name('user_browse')->where(['user_id'=>$user_id,'goodsId'=>$ids])->update(['is_free'=>1,'goodsId'=>$new_goodsId]); + //鏌ヨ鏄惁宸茬粡鏍囪杩� + $res=Db::query('SELECT id FROM t_user_first_free_browse WHERE user_id=? AND goodsId=?',[$user_id,$ids]); + if(!empty($res)){ + return true; + } + $res=Db::execute('INSERT INTO t_user_first_free_browse(user_id,goodsId,new_goodsId) VALUES (?,?,?)',[$user_id,$ids,$new_goodsId]); return true; } + /** + * 鏌ヨ鏄惁棣栬喘 + * + * * @param [type] $user_id + * @param [type] $ids + * @return void + */ + + public function checkisfirstfree($user_id) + { + //鏌ヨ鏄惁宸茬粡鏍囪杩� + $res=Db::query('SELECT id FROM t_user_first_free_browse WHERE user_id=? AND is_order=?',[$user_id,1]); + return $res; + + } + -- Gitblit v1.9.3