You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
73 lines
2.2 KiB
73 lines
2.2 KiB
<?php
|
|
// +----------------------------------------------------------------------
|
|
// | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
|
// +----------------------------------------------------------------------
|
|
// | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
|
// +----------------------------------------------------------------------
|
|
// | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
|
// +----------------------------------------------------------------------
|
|
// | Author: CRMEB Team <admin@crmeb.com>
|
|
// +----------------------------------------------------------------------
|
|
|
|
namespace app\controller\api\v1\work;
|
|
|
|
use app\services\kefu\ProductServices;
|
|
|
|
/**
|
|
* Class Product
|
|
* @package app\controller\api\v1\work
|
|
*/
|
|
class Product extends BaseWork
|
|
{
|
|
|
|
/**
|
|
* Product constructor.
|
|
* @param ProductServices $services
|
|
*/
|
|
public function __construct(ProductServices $services)
|
|
{
|
|
parent::__construct();
|
|
$this->service = $services;
|
|
}
|
|
|
|
/**
|
|
* 获取用户购买记录
|
|
* @return mixed
|
|
*/
|
|
public function getCartProductList(string $store_name = '')
|
|
{
|
|
$uid = $this->clientInfo['uid'] ?? 0;
|
|
if (!$uid) {
|
|
return $this->success([]);
|
|
}
|
|
return $this->success(get_thumb_water($this->service->getProductCartList((int)$uid, $store_name)));
|
|
}
|
|
|
|
/**
|
|
* 用户浏览记录
|
|
* @param string $store_name
|
|
* @return mixed
|
|
*/
|
|
public function getVisitProductList(string $store_name = '')
|
|
{
|
|
$uid = $this->clientInfo['uid'] ?? 0;
|
|
if (!$uid) {
|
|
return $this->success([]);
|
|
}
|
|
return $this->success(get_thumb_water($this->service->getVisitProductList((int)$uid, $store_name)));
|
|
}
|
|
|
|
/**
|
|
* 获取用户购买的热销商品
|
|
* @param string $store_name
|
|
* @return mixed
|
|
*/
|
|
public function getProductHotSale(string $store_name = '')
|
|
{
|
|
$uid = $this->clientInfo['uid'] ?? 0;
|
|
if (!$uid) {
|
|
return $this->success([]);
|
|
}
|
|
return $this->success(get_thumb_water($this->service->getProductHotSale((int)$uid, $store_name)));
|
|
}
|
|
}
|
|
|