pull/1/head
wanghousheng 12 months ago
parent 9fd37966b4
commit 46f3adcf60
  1. 6
      app/api/controller/Recovery.php
  2. 32
      app/api/service/Identity.php

@ -184,6 +184,11 @@ class Recovery extends Controller
if (!$recovery_id) {
return $this->renderError('缺少必要参数');
}
$model = new ServerRecovery();
$recovery_name = $model->where(['recovery_id' => $recovery_id, 'status' => 1])->value('recovery_name');
if (!$recovery_name) {
return $this->renderError('非法请求');
}
$recovery_type_arr = array_values(RecoveryStatusEnum::data());
$recovery_type_arr = array_column($recovery_type_arr, 'value');
$recovery_type = intval($this->request->post('recovery_type'));
@ -247,6 +252,7 @@ class Recovery extends Controller
'username' => $username,
'recovery_type' => $recovery_type,
'shop_id' => $shop_id,
'recovery_name' => $recovery_name,
];
$model = new RecoveryOrder();
if ($model->add($data, $imageIds)) {

@ -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);

Loading…
Cancel
Save