feature/main20240421
郭嘉 6 months ago
parent a2a6fefa51
commit 85ce197a25
  1. 3
      app/store/controller/setting/Payment.php
  2. 6
      app/store/model/Payment.php

@ -34,8 +34,7 @@ class Payment extends Controller
{ {
$model = new PaymentModel; $model = new PaymentModel;
$postform = $this->postForm(); $postform = $this->postForm();
//$postform['merchant_id'] = $this->merchantId; if ($model->updateOptions($postform, $this->merchantId)) {
if ($model->updateOptions($postform/*, $this->merchantId*/)) {
return $this->renderSuccess('更新成功'); return $this->renderSuccess('更新成功');
} }
return $this->renderError($model->getError() ?: '更新失败'); return $this->renderError($model->getError() ?: '更新失败');

@ -30,7 +30,7 @@ class Payment extends PaymentModel
public function updateOptions(array $form, $merchantId = 0): bool public function updateOptions(array $form, $merchantId = 0): bool
{ {
// 生成写入的数据 // 生成写入的数据
$dataList = $this->buildData($form/*, $merchantId*/); $dataList = $this->buildData($form, $merchantId);
// 删除所有的支付方式记录 // 删除所有的支付方式记录
static::deleteAll([]); static::deleteAll([]);
// 批量写入商品图片记录 // 批量写入商品图片记录
@ -65,7 +65,7 @@ class Payment extends PaymentModel
* @param array $form * @param array $form
* @return array[] * @return array[]
*/ */
private function buildData(array $form/*, $merchantId = 0*/): array private function buildData(array $form, $merchantId = 0): array
{ {
$data = []; $data = [];
foreach ($form as $item) { foreach ($form as $item) {
@ -79,7 +79,7 @@ class Payment extends PaymentModel
'is_default' => (int)$method['is_default'], 'is_default' => (int)$method['is_default'],
'others' => [], 'others' => [],
'store_id' => self::$storeId, 'store_id' => self::$storeId,
//'merchant_id' => $merchantId, 'merchant_id' => $merchantId,
]; ];
} }
} }

Loading…
Cancel
Save