|
|
|
@ -65,6 +65,10 @@ class Identity extends BaseService |
|
|
|
|
// 获取充值方案列表 |
|
|
|
|
$model = new \app\api\model\user\Identity(); |
|
|
|
|
$planList = $model->getList(['type' => IdentityEnum::MEMBER]); |
|
|
|
|
if (!empty($planList)) { |
|
|
|
|
$planList = $this->cheapPrice($planList); |
|
|
|
|
} |
|
|
|
|
//计算优惠价格 |
|
|
|
|
// 根据指定客户端获取可用的支付方式 |
|
|
|
|
$PaymentModel = new PaymentModel; |
|
|
|
|
$methods = $PaymentModel->getMethodsByClient($client); |
|
|
|
@ -76,6 +80,31 @@ class Identity extends BaseService |
|
|
|
|
]; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private function cheapPrice($data) |
|
|
|
|
{ |
|
|
|
|
$one_data = []; |
|
|
|
|
foreach ($data as $value) { |
|
|
|
|
if ($value['month'] == 1) { |
|
|
|
|
$one_data = $value; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
foreach ($data as $key => $value) { |
|
|
|
|
$data[$key]['cheap_price'] = 0; |
|
|
|
|
if (!empty($one_data)) { |
|
|
|
|
if ($value['month'] > 1) { |
|
|
|
|
$price = $value['month'] * $one_data['price']; |
|
|
|
|
$data[$key]['cheap_price'] = $price - $value['price']; |
|
|
|
|
} |
|
|
|
|
} else { |
|
|
|
|
if ($key > 0) { |
|
|
|
|
$price = $value['month'] * $data[$key - 1]['price']; |
|
|
|
|
$data[$key]['cheap_price'] = $price - $value['price']; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return $data; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 开通分销页面数据 |
|
|
|
|
* @param string $client 当前客户端 |
|
|
|
@ -95,6 +124,9 @@ class Identity extends BaseService |
|
|
|
|
// 获取充值方案列表 |
|
|
|
|
$model = new \app\api\model\user\Identity(); |
|
|
|
|
$planList = $model->getList(['type' => IdentityEnum::DEALER]); |
|
|
|
|
if (!empty($planList)) { |
|
|
|
|
$planList = $this->cheapPrice($planList); |
|
|
|
|
} |
|
|
|
|
// 根据指定客户端获取可用的支付方式 |
|
|
|
|
$PaymentModel = new PaymentModel; |
|
|
|
|
$methods = $PaymentModel->getMethodsByClient($client); |
|
|
|
|