|
|
@@ -882,10 +882,33 @@ class ProductController extends BaseController
|
|
|
|
|
|
$post = Yii::$app->request->post();
|
|
|
|
|
|
+ //临时兼容,2023.7.1后可以删除
|
|
|
$appVersion = $post['appVersion'] ?? 0;
|
|
|
if ($appVersion != 1) {
|
|
|
util::fail('请先升级应用');
|
|
|
}
|
|
|
+ $discountPrice = $post['discountPrice'] ?? 0;
|
|
|
+ if ($discountPrice > 0) {
|
|
|
+ if (isset($post['hjDiscountPrice']) == false || empty($post['hjDiscountPrice'])) {
|
|
|
+ $addPrice = $post['addPrice'] ?? 0;
|
|
|
+ $hjAddPrice = $post['hjAddPrice'] ?? 0;
|
|
|
+ $skMore = $post['skMore'] ?? 0;
|
|
|
+ $diff = bcsub($addPrice, $hjAddPrice, 2);
|
|
|
+ if ($diff > 0 && $discountPrice > $diff) {
|
|
|
+ $hjDiscountPrice = bcsub($discountPrice, $diff, 2);
|
|
|
+ } else {
|
|
|
+ $hjDiscountPrice = $discountPrice;
|
|
|
+ }
|
|
|
+ $diff = bcsub($skMore, $addPrice, 2);
|
|
|
+ if ($diff > 0) {
|
|
|
+ $skDiscountPrice = bcadd($diff, $discountPrice, 2);
|
|
|
+ } else {
|
|
|
+ $skDiscountPrice = $discountPrice;
|
|
|
+ }
|
|
|
+ $post['skDiscountPrice'] = $skDiscountPrice;
|
|
|
+ $post['hjDiscountPrice'] = $hjDiscountPrice;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
$post['adminId'] = $this->adminId;
|
|
|
$post['staffId'] = $this->shopAdmin->id;
|
|
|
@@ -991,10 +1014,34 @@ class ProductController extends BaseController
|
|
|
{
|
|
|
$post = Yii::$app->request->post();
|
|
|
|
|
|
+ //临时兼容,2023.7.1后可以删除
|
|
|
$appVersion = $post['appVersion'] ?? 0;
|
|
|
if ($appVersion != 1) {
|
|
|
util::fail('请先升级应用');
|
|
|
}
|
|
|
+ $discountPrice = $post['discountPrice'] ?? 0;
|
|
|
+ if ($discountPrice > 0) {
|
|
|
+ if (isset($post['hjDiscountPrice']) == false || empty($post['hjDiscountPrice'])) {
|
|
|
+ $addPrice = $post['addPrice'] ?? 0;
|
|
|
+ $hjAddPrice = $post['hjAddPrice'] ?? 0;
|
|
|
+ $skMore = $post['skMore'] ?? 0;
|
|
|
+ $diff = bcsub($addPrice, $hjAddPrice, 2);
|
|
|
+ if ($diff > 0 && $discountPrice > $diff) {
|
|
|
+ $hjDiscountPrice = bcsub($discountPrice, $diff, 2);
|
|
|
+ } else {
|
|
|
+ $hjDiscountPrice = $discountPrice;
|
|
|
+ }
|
|
|
+ $diff = bcsub($skMore, $addPrice, 2);
|
|
|
+ if ($diff > 0) {
|
|
|
+ $skDiscountPrice = bcadd($diff, $discountPrice, 2);
|
|
|
+ } else {
|
|
|
+ $skDiscountPrice = $discountPrice;
|
|
|
+ }
|
|
|
+ $post['skDiscountPrice'] = $skDiscountPrice;
|
|
|
+ $post['hjDiscountPrice'] = $hjDiscountPrice;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
$shop = $this->shop;
|
|
|
$join = $shop->join ?? 0;
|
|
|
@@ -1041,6 +1088,28 @@ class ProductController extends BaseController
|
|
|
if ($appVersion != 1) {
|
|
|
util::fail('请先升级应用');
|
|
|
}
|
|
|
+ $discountPrice = $post['discountPrice'] ?? 0;
|
|
|
+ if ($discountPrice > 0) {
|
|
|
+ if (isset($post['hjDiscountPrice']) == false || empty($post['hjDiscountPrice'])) {
|
|
|
+ $addPrice = $post['addPrice'] ?? 0;
|
|
|
+ $hjAddPrice = $post['hjAddPrice'] ?? 0;
|
|
|
+ $skMore = $post['skMore'] ?? 0;
|
|
|
+ $diff = bcsub($addPrice, $hjAddPrice, 2);
|
|
|
+ if ($diff > 0 && $discountPrice > $diff) {
|
|
|
+ $hjDiscountPrice = bcsub($discountPrice, $diff, 2);
|
|
|
+ } else {
|
|
|
+ $hjDiscountPrice = $discountPrice;
|
|
|
+ }
|
|
|
+ $diff = bcsub($skMore, $addPrice, 2);
|
|
|
+ if ($diff > 0) {
|
|
|
+ $skDiscountPrice = bcadd($diff, $discountPrice, 2);
|
|
|
+ } else {
|
|
|
+ $skDiscountPrice = $discountPrice;
|
|
|
+ }
|
|
|
+ $post['skDiscountPrice'] = $skDiscountPrice;
|
|
|
+ $post['hjDiscountPrice'] = $hjDiscountPrice;
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
$shop = $this->shop;
|
|
|
$join = $shop->join ?? 0;
|