Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
liu 2024-03-13 14:25:03 +08:00
commit 5ad0f36535
2 changed files with 11 additions and 1 deletions

View File

@ -412,7 +412,7 @@ class Product extends BaseModel
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()

View File

@ -59,6 +59,8 @@ use think\contract\Arrayable;
class ProductRepository extends BaseRepository
{
/** @var $isWholesale bool 是否批发 */
public $isWholesale = false;
protected $dao;
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',
@ -1329,6 +1331,7 @@ class ProductRepository extends BaseRepository
$with = [
'attr',
'attrValue',
'merchant',
];
$append = ['topReply'];
switch ($productType) {
@ -1376,6 +1379,7 @@ class ProductRepository extends BaseRepository
],
$userInfo['uid']
);
$this->isWholesale = $product->merchant->isWholesale() && $userInfo->getMerId() > 0;
}
if (systemConfig('sys_reply_status')) {
@ -1399,6 +1403,9 @@ class ProductRepository extends BaseRepository
$product['attr'] = $attr;
$product['sku'] = $sku;
$product['isRelation'] = $isRelation;
if ($this->isWholesale) {
$product['price'] = current($sku)['price'];
}
return $product;
}
@ -1653,6 +1660,9 @@ class ProductRepository extends BaseRepository
'unique' => $value['unique'],
'bar_code' => $value['bar_code'],
];
if ($this->isWholesale) {
$_value['price'] = $value['wholesale_price'];
}
if ($productType == 0) {
$_value['ot_price'] = $value['ot_price'];
$_value['svip_price'] = $value['svip_price'];