作者 耿培杰

修改接口

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