<?php
|
|
namespace app\openapi\controller\app;
|
|
use app\openapi\controller\Controller;
|
use app\openapi\model\app\App as AppModel;
|
use app\shop\model\app\AppWx as AppWxModel;
|
|
/**
|
* 控制器
|
*/
|
class App extends Controller
|
{
|
/**
|
* 列表
|
*/
|
public function index()
|
{
|
$model = new AppModel;
|
$list = $model->getList($this->postData());
|
return $this->renderSuccess('', compact('list'));
|
}
|
|
/**
|
* 添加商城
|
*/
|
public function add()
|
{
|
$model = new AppModel;
|
// 新增记录
|
if ($model->add($this->postData)) {
|
return $this->renderSuccess('添加成功');
|
}
|
return $this->renderError($model->getError() ?: '添加失败');
|
}
|
|
/**
|
* 编辑商城
|
*/
|
public function edit()
|
{
|
$model = AppModel::detail($this->postData["app_id"]);
|
// 新增记录
|
if ($model->edit($this->postData)) {
|
return $this->renderSuccess('修改成功');
|
}
|
return $this->renderError($model->getError() ?: '修改失败');
|
}
|
|
/**
|
* 重置商城账号密码
|
*/
|
public function editUser()
|
{
|
$model = AppModel::detail($this->postData["app_id"]);
|
// 新增记录
|
if ($model->editUser($this->postData)) {
|
return $this->renderSuccess('修改成功');
|
}
|
return $this->renderError($model->getError() ?: '修改失败');
|
}
|
|
/**
|
* 删除
|
*/
|
public function delete()
|
{
|
//详情
|
$model = AppModel::detail($this->postData["app_id"]);
|
if (!$model->setDelete()) {
|
return $this->renderError('操作失败');
|
}
|
return $this->renderSuccess('操作成功');
|
}
|
|
/*
|
*启用禁用
|
*/
|
public function updateStatus()
|
{
|
$model = AppModel::detail($this->postData["app_id"]);
|
if (!$model->updateStatus()) {
|
return $this->renderError('操作失败');
|
}
|
return $this->renderSuccess('操作成功');
|
}
|
|
/*
|
*启用服务商支付
|
*/
|
public function updateWxStatus()
|
{
|
$model = AppModel::detail($this->postData["app_id"]);
|
if (!$model->updateWxStatus()) {
|
return $this->renderError('操作失败');
|
}
|
return $this->renderSuccess('操作成功');
|
}
|
|
/**
|
* 设置小程序付呗支付信息
|
*/
|
public function setPay()
|
{
|
$model = new AppWxModel;
|
$data = $this->postData;
|
if ($model->syncEdit($data)) {
|
return $this->renderSuccess('操作成功');
|
}
|
return $this->renderError($model->getError() ?: '修改失败');
|
}
|
/**
|
* 总后台获取付呗支付配置
|
*/
|
public function getPay()
|
{
|
$model = new AppWxModel;
|
$postData = $this->postData;
|
$data = $model->syncGet($postData);
|
return $this->renderSuccess('', compact('data'));
|
}
|
}
|