daili价格调整
This commit is contained in:
@@ -175,16 +175,39 @@ class Userinfo extends Controller
|
||||
|
||||
$data = json_decode(file_get_contents("php://input"), true);
|
||||
|
||||
$agent_price_model = new AgentPriceModel;
|
||||
|
||||
$agent_user_model = new AgentUser;
|
||||
$package_model = new ProductPackage;
|
||||
$product_model = new ProductModel;
|
||||
$discount_model = new ProductPriceScheme;
|
||||
|
||||
$agent_id = $this->userinfo['OperaterID'];
|
||||
|
||||
$where = [
|
||||
'agent_id' => $agent_id,
|
||||
'package_id' => $data['Id']
|
||||
];
|
||||
$agent_info = $agent_user_model->getOne(['id'=>$agent_id]);
|
||||
|
||||
$price = $agent_price_model->getOne($where);
|
||||
//套餐价
|
||||
$package_price = $package_model->getOne(['Id' => $data['Id']]);
|
||||
|
||||
//退款价
|
||||
$refund_price = $product_model->getOne(['Id' => $data['ProductId']]);
|
||||
|
||||
$discount = $discount_model->getOne($agent_info['discount_id']);
|
||||
if (empty($discount)){
|
||||
$retuen_data = [
|
||||
'Code' => -10000,
|
||||
'Message' => '请联系管理员设置您的代理价!',
|
||||
];
|
||||
echo json_encode($retuen_data);
|
||||
die;
|
||||
}
|
||||
|
||||
$user_set_price = $package_price['LinePrice'] * $discount['discount'] / 100;
|
||||
$user_refund_price = $refund_price['RefundDayPrice'] * $discount['discount'] / 100;
|
||||
|
||||
$price = [
|
||||
'price' => $user_set_price,
|
||||
'refund' => $user_refund_price
|
||||
];
|
||||
|
||||
$retuen_data = [
|
||||
'Code' => 30000,
|
||||
@@ -224,14 +247,15 @@ class Userinfo extends Controller
|
||||
}
|
||||
|
||||
//套餐价
|
||||
$package_price = $package_model->getOne(['package_id' => $data['PackageId']]);
|
||||
$package_price = $package_model->getOne(['Id' => $data['PackageId']]);
|
||||
|
||||
//退款价
|
||||
$refund_price = $product_model->getOne(['package_id' => $data['ProductId']]);
|
||||
$refund_price = $product_model->getOne(['Id' => $data['ProductId']]);
|
||||
|
||||
$user_set_price = $package_price['LinePrice'] * $discount['discount'] / 100;
|
||||
$user_refund_price = $refund_price['RefundDayPrice'] * $discount['discount'] / 100;
|
||||
|
||||
|
||||
if($data['UserPrice']<$user_set_price || $data['RefundDayPrice']<$user_refund_price){
|
||||
$retuen_data = [
|
||||
'Code' => -10000,
|
||||
|
||||
Reference in New Issue
Block a user