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