diff --git a/app/common/repositories/user/ExchangeQuotaRepository.php b/app/common/repositories/user/ExchangeQuotaRepository.php index 2f6aa8e..8e0dc29 100644 --- a/app/common/repositories/user/ExchangeQuotaRepository.php +++ b/app/common/repositories/user/ExchangeQuotaRepository.php @@ -163,6 +163,26 @@ class ExchangeQuotaRepository extends BaseRepository{ } + /** + * Common: 设置获取 + * Author: wu-hui + * Time: 2024/07/01 10:52 + * @return mixed + */ + public function getConfig(){ + $config = systemConfig([ + 'quota_integral_rate', + 'quota_integral_diff_rate', + 'quota_integral_upgrade_switch', + 'quota_integral_upgrade_money', + 'quota_integral_upgrade_level', + ]); + // 信息处理 + $config['quota_integral_upgrade_switch'] = (int)$config['quota_integral_upgrade_switch']; + + + return $config; + } } diff --git a/app/controller/admin/user/ExchangeQuota.php b/app/controller/admin/user/ExchangeQuota.php index 24ddb4a..72c9a5a 100644 --- a/app/controller/admin/user/ExchangeQuota.php +++ b/app/controller/admin/user/ExchangeQuota.php @@ -3,6 +3,9 @@ namespace app\controller\admin\user; use app\common\model\user\ExchangePickupPoint; +use app\common\repositories\marketing\AgentRepository; +use app\common\repositories\system\config\ConfigClassifyRepository; +use app\common\repositories\system\config\ConfigValueRepository; use app\common\repositories\user\ExchangeIntegralRecordRepository; use app\common\repositories\user\ExchangePickupPointRepository; use app\common\repositories\user\ExchangePickupRecordRepository; @@ -12,9 +15,10 @@ use crmeb\basic\BaseController; use app\common\model\user\User; -class ExchangeQuota extends BaseController -{ +class ExchangeQuota extends BaseController{ + protected $repository; + /** * Common: 额度信息 - 统计 * Author: wu-hui @@ -190,6 +194,38 @@ class ExchangeQuota extends BaseController } + /** + * Common: 配置信息 - 修改 + * Author: wu-hui + * Time: 2024/07/01 10:15 + * @return mixed + */ + public function setConfig(){ + $config = $this->request->params([ + ['quota_integral_rate',0],// 赠送比例 + ['quota_integral_diff_rate',0],// 补差折扣,以原价的百分之多少进行现金支付 + ['quota_integral_upgrade_switch',0],// 是否开启消费升级 + ['quota_integral_upgrade_money',0],// 升级分销商要求金额 + ['quota_integral_upgrade_level',0],// 升级后等级 + ]); + // 保存信息 + $cid = app()->make(ConfigClassifyRepository::class)->getConfigClassifyKeyById('quota_config', '额度与积分配置'); + if (!$cid) return app('json')->fail('保存失败'); + app()->make(ConfigValueRepository::class)->setFormData($config,$this->request->merId()); + return app('json')->success('保存成功'); + } + /** + * Common: 配置信息 - 获取 + * Author: wu-hui + * Time: 2024/07/01 10:15 + * @return mixed + */ + public function getConfig(){ + $config = app()->make(ExchangeQuotaRepository::class)->getConfig(); + + return app('json')->success($config); + } + } diff --git a/route/admin/marketing.php b/route/admin/marketing.php index 3018552..d24dbdf 100644 --- a/route/admin/marketing.php +++ b/route/admin/marketing.php @@ -426,7 +426,7 @@ Route::group(function () { ]); // 酒卡额度 Route::group('user/exchange_quota', function () { - // 酒卡额度相关 + // 酒卡额度相关管理 Route::get('quota_title','.ExchangeQuota/quotaTitle')->name('systemUserExchangeQuotaTitle')->option([ '_alias' => '额度统计', ]); @@ -436,6 +436,15 @@ Route::group(function () { Route::get('quota_record_list', '.ExchangeQuota/quotaRecordList')->name('systemUserExchangeQuotaRecordList')->option([ '_alias' => '额度变更记录', ]); + // 酒卡额度相关设置 + Route::get('quota_get_config','.ExchangeQuota/getConfig')->name('systemUserExchangeQuotaConfigGet')->option([ + '_alias' => '配置获取', + ]); + Route::post('quota_set_config','.ExchangeQuota/setConfig')->name('systemUserExchangeQuotaConfigSet')->option([ + '_alias' => '编辑配置', + ]); + + // 兑换积分相关 Route::get('integral_title','.ExchangeQuota/integralTitle')->name('systemUserExchangeIntegralTitle')->option([ '_alias' => '积分统计',