Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
5ad0f36535
@ -412,7 +412,7 @@ class Product extends BaseModel
|
|||||||
|
|
||||||
public function merchant()
|
public function merchant()
|
||||||
{
|
{
|
||||||
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count,is_margin');
|
return $this->hasOne(Merchant::class, 'mer_id', 'mer_id')->field('is_trader,type_id,mer_id,mer_name,mer_avatar,product_score,service_score,postage_score,service_phone,care_count,is_margin,wholesale');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function reply()
|
public function reply()
|
||||||
|
@ -59,6 +59,8 @@ use think\contract\Arrayable;
|
|||||||
class ProductRepository extends BaseRepository
|
class ProductRepository extends BaseRepository
|
||||||
{
|
{
|
||||||
|
|
||||||
|
/** @var $isWholesale bool 是否批发 */
|
||||||
|
public $isWholesale = false;
|
||||||
protected $dao;
|
protected $dao;
|
||||||
const CREATE_PARAMS = [
|
const CREATE_PARAMS = [
|
||||||
"is_copy", "image", "slider_image", "store_name", "store_info", "keyword", "bar_code", "guarantee_template_id", "cate_id", "unit_name", "sort", "is_show", "is_good", 'is_gift_bag', 'integral_rate', "video_link", "temp_id", "content", "spec_type", "extension_type", "attr", 'mer_labels', 'delivery_way', 'delivery_free', 'param_temp_id', 'extend', 'mer_form_id',
|
"is_copy", "image", "slider_image", "store_name", "store_info", "keyword", "bar_code", "guarantee_template_id", "cate_id", "unit_name", "sort", "is_show", "is_good", 'is_gift_bag', 'integral_rate', "video_link", "temp_id", "content", "spec_type", "extension_type", "attr", 'mer_labels', 'delivery_way', 'delivery_free', 'param_temp_id', 'extend', 'mer_form_id',
|
||||||
@ -1329,6 +1331,7 @@ class ProductRepository extends BaseRepository
|
|||||||
$with = [
|
$with = [
|
||||||
'attr',
|
'attr',
|
||||||
'attrValue',
|
'attrValue',
|
||||||
|
'merchant',
|
||||||
];
|
];
|
||||||
$append = ['topReply'];
|
$append = ['topReply'];
|
||||||
switch ($productType) {
|
switch ($productType) {
|
||||||
@ -1376,6 +1379,7 @@ class ProductRepository extends BaseRepository
|
|||||||
],
|
],
|
||||||
$userInfo['uid']
|
$userInfo['uid']
|
||||||
);
|
);
|
||||||
|
$this->isWholesale = $product->merchant->isWholesale() && $userInfo->getMerId() > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (systemConfig('sys_reply_status')) {
|
if (systemConfig('sys_reply_status')) {
|
||||||
@ -1399,6 +1403,9 @@ class ProductRepository extends BaseRepository
|
|||||||
$product['attr'] = $attr;
|
$product['attr'] = $attr;
|
||||||
$product['sku'] = $sku;
|
$product['sku'] = $sku;
|
||||||
$product['isRelation'] = $isRelation;
|
$product['isRelation'] = $isRelation;
|
||||||
|
if ($this->isWholesale) {
|
||||||
|
$product['price'] = current($sku)['price'];
|
||||||
|
}
|
||||||
return $product;
|
return $product;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1653,6 +1660,9 @@ class ProductRepository extends BaseRepository
|
|||||||
'unique' => $value['unique'],
|
'unique' => $value['unique'],
|
||||||
'bar_code' => $value['bar_code'],
|
'bar_code' => $value['bar_code'],
|
||||||
];
|
];
|
||||||
|
if ($this->isWholesale) {
|
||||||
|
$_value['price'] = $value['wholesale_price'];
|
||||||
|
}
|
||||||
if ($productType == 0) {
|
if ($productType == 0) {
|
||||||
$_value['ot_price'] = $value['ot_price'];
|
$_value['ot_price'] = $value['ot_price'];
|
||||||
$_value['svip_price'] = $value['svip_price'];
|
$_value['svip_price'] = $value['svip_price'];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user