上线金柚产品
This commit is contained in:
36
app/jinyou/model/UserPrice.php
Normal file
36
app/jinyou/model/UserPrice.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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) {
|
||||
$price = $$this->getOne(['UserId' => $user_id,'PackageId' => $package_info['Id']])['UserPrice'];
|
||||
} 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;
|
||||
}
|
||||
}
|
||||
|
||||
return $package_info['Price'];
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user