作者 耿培杰

修改接口

@@ -305,7 +305,14 @@ class Goods extends Api @@ -305,7 +305,14 @@ class Goods extends Api
305 { 305 {
306 $params = $this->request->param(); 306 $params = $this->request->param();
307 if (empty($params['keyword'])) $this->error('缺少参数 keyword!'); 307 if (empty($params['keyword'])) $this->error('缺少参数 keyword!');
308 - if ($this->userId) $this->keywordLogModel->save(['user_id'=>$this->userId,'content'=>$params['keyword'],'createtime'=>time()]); 308 + if ($this->userId){
  309 + $last = $this->keywordLogModel->where(['user_id'=>$this->userId,'content'=>$params['keyword']])->value('id');
  310 + if ($last){
  311 + $this->keywordLogModel->where('id',$last)->update(['createtime'=>time()]);
  312 + }else{
  313 + $this->keywordLogModel->save(['user_id'=>$this->userId,'content'=>$params['keyword'],'createtime'=>time()]);
  314 + }
  315 + }
309 $page = $params['page']; 316 $page = $params['page'];
310 $limit = Config::get('paginate.index_rows'); 317 $limit = Config::get('paginate.index_rows');
311 $where = []; 318 $where = [];