mirror of
https://gitee.com/koogua/course-tencent-cloud.git
synced 2025-06-25 12:09:09 +08:00
会员期限价格等可设置
This commit is contained in:
parent
b8d2523435
commit
64dc731b23
@ -282,7 +282,7 @@ class SettingController extends Controller
|
|||||||
|
|
||||||
if ($this->request->isPost()) {
|
if ($this->request->isPost()) {
|
||||||
|
|
||||||
$data = $this->request->getPost('vip', 'string');
|
$data = $this->request->getPost('vip');
|
||||||
|
|
||||||
$settingService->updateVipSettings($data);
|
$settingService->updateVipSettings($data);
|
||||||
|
|
||||||
@ -290,9 +290,9 @@ class SettingController extends Controller
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$vips = $settingService->getVipSettings();
|
$items = $settingService->getVipSettings();
|
||||||
|
|
||||||
$this->view->setVar('vips', $vips);
|
$this->view->setVar('items', $items);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ class Setting extends Service
|
|||||||
{
|
{
|
||||||
$vipRepo = new VipRepo();
|
$vipRepo = new VipRepo();
|
||||||
|
|
||||||
return $vipRepo->findAll(['deleted' => 0]);
|
return $vipRepo->findAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLiveSettings($section)
|
public function getLiveSettings($section)
|
||||||
@ -198,9 +198,13 @@ class Setting extends Service
|
|||||||
{
|
{
|
||||||
$vipRepo = new VipRepo();
|
$vipRepo = new VipRepo();
|
||||||
|
|
||||||
foreach ($items as $id => $price) {
|
foreach ($items as $id => $item) {
|
||||||
$vip = $vipRepo->findById($id);
|
$vip = $vipRepo->findById($id);
|
||||||
$vip->price = $price;
|
if (!$vip) continue;
|
||||||
|
$vip->title = sprintf('%s个月', $item['expiry']);
|
||||||
|
$vip->expiry = (int)$item['expiry'];
|
||||||
|
$vip->price = (float)$item['price'];
|
||||||
|
$vip->deleted = (int)$item['deleted'];
|
||||||
$vip->update();
|
$vip->update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -36,7 +36,7 @@
|
|||||||
<fieldset class="layui-elem-field layui-field-title">
|
<fieldset class="layui-elem-field layui-field-title">
|
||||||
<legend>行为奖励规则</legend>
|
<legend>行为奖励规则</legend>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<table class="layui-table kg-table layui-form" style="width:60%;">
|
<table class="layui-table kg-table layui-form" style="width:80%;">
|
||||||
<colgroup>
|
<colgroup>
|
||||||
<col width="20%">
|
<col width="20%">
|
||||||
<col width="20%">
|
<col width="20%">
|
||||||
|
@ -6,15 +6,39 @@
|
|||||||
<fieldset class="layui-elem-field layui-field-title">
|
<fieldset class="layui-elem-field layui-field-title">
|
||||||
<legend>会员设置</legend>
|
<legend>会员设置</legend>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
{% for item in vips %}
|
<table class="layui-table kg-table layui-form" style="width:80%;">
|
||||||
<div class="layui-form-item">
|
<colgroup>
|
||||||
<label class="layui-form-label">{{ item.title }}</label>
|
<col width="20%">
|
||||||
<div class="layui-input-inline">
|
<col width="20%">
|
||||||
<input class="layui-input" type="text" name="vip[{{ item.id }}]" value="{{ item.price }}" lay-verify="number">
|
<col>
|
||||||
</div>
|
</colgroup>
|
||||||
<div class="layui-form-mid layui-word-aux">元</div>
|
<thead>
|
||||||
</div>
|
<tr>
|
||||||
|
<th>启用</th>
|
||||||
|
<th>期限</th>
|
||||||
|
<th>价格(元)</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{% for item in items %}
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<input type="radio" name="vip[{{ item.id }}][deleted]" value="0" title="是" {% if item.deleted == 0 %}checked="checked"{% endif %}>
|
||||||
|
<input type="radio" name="vip[{{ item.id }}][deleted]" value="1" title="否" {% if item.deleted == 1 %}checked="checked"{% endif %}>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<select name="vip[{{ item.id }}][expiry]" lay-verify="required">
|
||||||
|
{% for value in 1..60 %}
|
||||||
|
<option value="{{ value }}" {% if item.expiry == value %}selected="selected"{% endif %}>{{ value }}个月</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</select>
|
||||||
|
</td>
|
||||||
|
<td><input class="layui-input" type="text" name="vip[{{ item.id }}][price]" value="{{ item.price }}" lay-verify="number"></td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
<br>
|
||||||
<div class="layui-form-item">
|
<div class="layui-form-item">
|
||||||
<label class="layui-form-label"></label>
|
<label class="layui-form-label"></label>
|
||||||
<div class="layui-input-block">
|
<div class="layui-input-block">
|
||||||
|
@ -22,7 +22,7 @@ class Vip extends Model
|
|||||||
public $title = '';
|
public $title = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 期限(天)
|
* 期限(月)
|
||||||
*
|
*
|
||||||
* @var int
|
* @var int
|
||||||
*/
|
*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user