|
@@ -5,6 +5,7 @@ namespace app\api\controller\mall;
|
|
|
use app\common\controller\Api;
|
|
|
use app\common\model\Category;
|
|
|
use app\common\model\GoodsSku;
|
|
|
+use app\common\model\UserCategoryView;
|
|
|
use app\common\validate\KillService;
|
|
|
|
|
|
/**
|
|
@@ -160,4 +161,25 @@ class Goods extends Api
|
|
|
}
|
|
|
$this->success('',$info);
|
|
|
}
|
|
|
+ /**
|
|
|
+ * 记录用户浏览产品时长
|
|
|
+ * @ApiParams (name=goods_id,description=商品ID)
|
|
|
+ * @ApiParams (name=sec,description=时长S)
|
|
|
+ */
|
|
|
+ public function ls(){
|
|
|
+ $user=$this->auth->getUser();
|
|
|
+ $data=input();
|
|
|
+ if(empty($data['id'])){
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
+ $goods=\app\common\model\Goods::where('id',$data['id'])->find();
|
|
|
+ if(!$goods){
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
+ $category=$goods->category;
|
|
|
+ if(!$category){
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
+ UserCategoryView::addSecond($user,$category,$data['sec']??0);
|
|
|
+ }
|
|
|
}
|