<?php
|
|
namespace app\supplier\controller\setting;
|
|
use app\supplier\controller\Controller;
|
use app\supplier\model\app\AppPay as AppPayModel;
|
use app\common\enum\settings\PlatformEnum;
|
use app\common\enum\order\OrderPayTypeEnum;
|
|
/**
|
* 应用设置
|
*/
|
class App extends Controller
|
{
|
/**
|
* 支付方式
|
*/
|
public function pay()
|
{
|
if ($this->request->isGet()) {
|
$app = AppPayModel::detail($this->getSupplierId());
|
$platform = PlatformEnum::data();
|
$pay_type = OrderPayTypeEnum::data();
|
return $this->renderSuccess('', compact('app', 'platform', 'pay_type'));
|
}
|
$model = AppPayModel::detail($this->getSupplierId());
|
if(empty($model)){
|
$model = new AppPayModel();
|
}
|
$data = $this->postData();
|
if(!empty($data['pay_type'])){
|
foreach ($data['pay_type'] as &$item){
|
if(!isset($item['pay_type'])){
|
$item['pay_type'] = [];
|
}
|
}
|
}
|
|
$data["shop_supplier_id"] = $this->getSupplierId();
|
if ($model->editPay($data)) {
|
return $this->renderSuccess('操作成功');
|
}
|
return $this->renderError($model->getError() ?: '操作失败');
|
}
|
|
}
|