admin/addon/pointcash/shop/controller/Config.php

44 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
/**
* ThinkShop商城系统 - 团队十年电商经验汇集巨献!
* =========================================================
* Copy right 2019-2029 成都云之牛科技有限公司, 保留所有权利。
* ----------------------------------------------
* 官方网址: https://www.cdcloudshop.com
* =========================================================
*/
namespace addon\pointcash\shop\controller;
use app\shop\controller\BaseShop;
use addon\pointcash\model\Config as ConfigModel;
/**
* 积分抵现
* @author Administrator
*
*/
class Config extends BaseShop
{
public function index()
{
$config = new ConfigModel();
if (request()->isAjax()) {
$data = [
'is_enable' => input('is_enable', 0), // 是否开启
'cash_rate' => input('cash_rate', 0), // 抵现比率
'is_limit' => input('is_limit', 0), // 是否限制订单金额门槛
'limit' => input('limit', 0.00), // 订单金额门槛
'is_limit_use' => input('is_limit_use', 0), // 是否限制使用上限
'type' => input('type', 0), // 限制类型 0固定金额 1订单百分比
'max_use' => input('max_use', 0) // 最大可用
];
$res = $config->setPointCashConfig($data, $this->site_id);
return $res;
} else {
$info = $config->getPointCashConfig($this->site_id);
$this->assign('config', $info[ 'data' ][ 'value' ]);
return $this->fetch("config/index");
}
}
}