2024-02-01 17:13:32 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace app\jinyou\model;
|
|
|
|
|
|
|
|
|
|
use fastphp\base\Model;
|
|
|
|
|
|
|
|
|
|
class UserPrice extends Model
|
|
|
|
|
{
|
|
|
|
|
protected $table = 'product_user_price';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function get_user_price($user_id,$discount,$package_info){
|
|
|
|
|
$price = 100000;
|
|
|
|
|
|
|
|
|
|
//根据用户价格
|
|
|
|
|
if ($discount != 0) {
|
|
|
|
|
if ($discount == -1) {
|
2024-02-02 18:50:41 +08:00
|
|
|
$user_price = $this->getOne(['UserId' => $user_id,'PackageId' => $package_info['Id']]);
|
|
|
|
|
if (isset($user_price['UserPrice'])) {
|
|
|
|
|
$price = $user_price['UserPrice'];
|
|
|
|
|
}
|
2024-02-01 17:13:32 +08:00
|
|
|
} else {
|
|
|
|
|
$scheme_model = new PriceScheme;
|
|
|
|
|
$discount = $scheme_model->getone(['Id' => $discount])['discount'];
|
|
|
|
|
$price = $package_info['LinePrice'] * $discount / 100;
|
|
|
|
|
}
|
|
|
|
|
//判读最低价
|
|
|
|
|
if ($price < $package_info['MinPrice']) {
|
|
|
|
|
$price = $package_info['MinPrice'];
|
|
|
|
|
}
|
|
|
|
|
if ($price < $package_info['Price']) {
|
|
|
|
|
$package_info['Price'] = $price;
|
|
|
|
|
}
|
2025-05-30 15:34:51 +08:00
|
|
|
|
2025-05-30 19:43:25 +08:00
|
|
|
if ($price > $package_info['Price'] && $price < 100000) {
|
2025-05-30 15:34:51 +08:00
|
|
|
$package_info['Price'] = $price;
|
2025-05-30 15:20:27 +08:00
|
|
|
}
|
2024-02-01 17:13:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $package_info['Price'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|