|
|
@ -13,7 +13,7 @@ use think\Db; |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
class Product extends Api |
|
|
|
class Product extends Api |
|
|
|
{ |
|
|
|
{ |
|
|
|
protected $noNeedLogin = ['lists', 'goods', 'drawer', 'comment', 'likes', 'stock','activelists']; |
|
|
|
protected $noNeedLogin = ['lists', 'goods', 'drawer', 'comment', 'likes', 'stock','activelists','getbrand']; |
|
|
|
protected $noNeedRight = ['*']; |
|
|
|
protected $noNeedRight = ['*']; |
|
|
|
|
|
|
|
|
|
|
|
protected $excludeFields = ""; |
|
|
|
protected $excludeFields = ""; |
|
|
@ -104,7 +104,7 @@ class Product extends Api |
|
|
|
//记录去除红包之后的价格 |
|
|
|
//记录去除红包之后的价格 |
|
|
|
$priceinfo['price'] = round($price*(100-$bili)/100,2); |
|
|
|
$priceinfo['price'] = round($price*(100-$bili)/100,2); |
|
|
|
//计算红包数量 |
|
|
|
//计算红包数量 |
|
|
|
$priceinfo['redpocket'] = ($price-$priceinfo['price'])/$config['moneyRedpocket']['money']*$config['moneyRedpocket']['redpocket']; |
|
|
|
$priceinfo['redpocket'] = round(($price-$priceinfo['price'])/$config['moneyRedpocket']['money']*$config['moneyRedpocket']['redpocket'],2); |
|
|
|
return $priceinfo; |
|
|
|
return $priceinfo; |
|
|
|
} |
|
|
|
} |
|
|
|
public function getbili($uid=0){ |
|
|
|
public function getbili($uid=0){ |
|
|
@ -178,7 +178,14 @@ class Product extends Api |
|
|
|
->select() |
|
|
|
->select() |
|
|
|
]); |
|
|
|
]); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
public function getbrand(){ |
|
|
|
|
|
|
|
$brandModel = model('app\api\model\wanlshop\Brand'); |
|
|
|
|
|
|
|
$brandInfo = $brandModel |
|
|
|
|
|
|
|
->where('status','normal') |
|
|
|
|
|
|
|
->field('id,name,image') |
|
|
|
|
|
|
|
->select(); |
|
|
|
|
|
|
|
$this->success('返回成功',$brandInfo); |
|
|
|
|
|
|
|
} |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 猜你喜欢 |
|
|
|
* 猜你喜欢 |
|
|
|
* |
|
|
|
* |
|
|
@ -293,7 +300,16 @@ class Product extends Api |
|
|
|
->field('id,category_id,shop_category_id,brand_id,freight_id,shop_id,title,image,images,flag,content,category_attribute,activity_type,price,sales,payment,comment,praise,moderate,negative,like,views,status') |
|
|
|
->field('id,category_id,shop_category_id,brand_id,freight_id,shop_id,title,image,images,flag,content,category_attribute,activity_type,price,sales,payment,comment,praise,moderate,negative,like,views,status') |
|
|
|
->find(); |
|
|
|
->find(); |
|
|
|
// 浏览+1 & 报错 |
|
|
|
// 浏览+1 & 报错 |
|
|
|
|
|
|
|
$config = get_addon_config('wanlshop'); |
|
|
|
|
|
|
|
$vipbili = $config['vipbili']['vipuser']; |
|
|
|
|
|
|
|
$freebili = $config['vipbili']['freeuser']; |
|
|
|
if($goods && $goods['status'] == 'normal'){ |
|
|
|
if($goods && $goods['status'] == 'normal'){ |
|
|
|
|
|
|
|
//免费会员商品价格+红包 |
|
|
|
|
|
|
|
$priceinfo = $this->pricejisuan($goods['price'],$freebili,0); |
|
|
|
|
|
|
|
$goods['freepriceInfo'] = $priceinfo; |
|
|
|
|
|
|
|
//vip会员价格+红包 |
|
|
|
|
|
|
|
$priceinfo = $this->pricejisuan($goods['price'],$vipbili,0); |
|
|
|
|
|
|
|
$goods['vippriceInfo'] = $priceinfo; |
|
|
|
// 查询类目 |
|
|
|
// 查询类目 |
|
|
|
$goods->category->visible(['id','pid','name']); |
|
|
|
$goods->category->visible(['id','pid','name']); |
|
|
|
// 查询优惠券 |
|
|
|
// 查询优惠券 |
|
|
|