1.优化商城参数配置菜单-以及配置生效问题

This commit is contained in:
2026-05-06 15:50:42 +08:00
parent ec499dce0f
commit ddd533f436
7 changed files with 144 additions and 36 deletions

View File

@@ -6,12 +6,12 @@ namespace app\admin\controller\mall;
use app\common\controller\Backend;
use app\common\library\MallPlayxRatios;
use app\common\model\MallConfig;
use app\common\model\MallBusinessConfig;
use support\Response;
use Webman\Http\Request;
/**
* 积分商城参数PlayX 比例等)
* 积分商城参数PlayX 比例等,读写 mall_business_config
*/
class PlayxConfig extends Backend
{
@@ -22,17 +22,21 @@ class PlayxConfig extends Backend
return $response;
}
$row = MallConfig::order('id', 'asc')->find();
$row = MallBusinessConfig::order('id', 'asc')->find();
if (!$row) {
$now = time();
MallConfig::create([
MallBusinessConfig::create([
'return_ratio' => floatval(env('PLAYX_RETURN_RATIO', '0.1')),
'unlock_ratio' => floatval(env('PLAYX_UNLOCK_RATIO', '0.1')),
'points_to_cash_ratio' => floatval(env('PLAYX_POINTS_TO_CASH_RATIO', '0.1')),
'create_time' => $now,
'update_time' => $now,
]);
$row = MallConfig::order('id', 'asc')->find();
$row = MallBusinessConfig::order('id', 'asc')->find();
}
if ($row) {
MallPlayxRatios::syncFromRow($row);
}
return $this->success('', [
@@ -67,10 +71,10 @@ class PlayxConfig extends Backend
return $this->error(__('Parameter error'));
}
$row = MallConfig::order('id', 'asc')->find();
$row = MallBusinessConfig::order('id', 'asc')->find();
if (!$row) {
$now = time();
MallConfig::create([
MallBusinessConfig::create([
'return_ratio' => $returnF,
'unlock_ratio' => $unlockF,
'points_to_cash_ratio' => $cashF,
@@ -84,7 +88,10 @@ class PlayxConfig extends Backend
$row->save();
}
MallPlayxRatios::forget();
$fresh = MallBusinessConfig::order('id', 'asc')->find();
if ($fresh) {
MallPlayxRatios::syncFromRow($fresh);
}
return $this->success(__('The current page configuration item was updated successfully'));
}