Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

修复商品端口限速和IP限制的bug #15

Merged
merged 2 commits into from
Mar 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions app/Controllers/Admin/ShopController.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,13 @@ public function add($request, $response, $args)
$content["reset_exp"]=$request->getParam('reset_exp');
}

if ($request->getParam('speedlimit')!=0) {
//if ($request->getParam('speedlimit')!=0) {
$content["speedlimit"]=$request->getParam('speedlimit');
}
//}

if ($request->getParam('connector')!=0) {
//if ($request->getParam('connector')!=0) {
$content["connector"]=$request->getParam('connector');
}
//}

$shop->content=json_encode($content);

Expand Down Expand Up @@ -147,13 +147,13 @@ public function update($request, $response, $args)
$content["reset_exp"]=$request->getParam('reset_exp');
}

if ($request->getParam('speedlimit')!=0) {
//if ($request->getParam('speedlimit')!=0) {
$content["speedlimit"]=$request->getParam('speedlimit');
}
//}

if ($request->getParam('connector')!=0) {
//if ($request->getParam('connector')!=0) {
$content["connector"]=$request->getParam('connector');
}
//}

$shop->content=json_encode($content);

Expand Down
12 changes: 10 additions & 2 deletions app/Models/Shop.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,18 @@ public function content()
$content_text .= " 在 ".$content["reset_exp"]." 天内,每 ".$value." 天重置流量为 ".$content["reset_value"]." G ";
break;
case "speedlimit":
$content_text .= "用户端口限速变为".$content["speedlimit"]." Mbps";
if ($value == 0){
$content_text .= "用户端口不限速";
}else{
$content_text .= "用户端口限速变为".$value." Mbps";
}
break;
case "connector":
$content_text .= "用户IP限制变为".$content["connector"]." 个";
if ($value == 0){
$content_text .= "用户IP不限制";
}else{
$content_text .= "用户IP限制变为".$value." 个";
}
break;
default:
}
Expand Down
4 changes: 2 additions & 2 deletions resources/views/material/admin/shop/edit.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -125,13 +125,13 @@
<div class="card-inner">
<div class="form-group form-group-label">
<label class="floating-label" for="speedlimit">端口限速</label>
<input class="form-control" id="speedlimit" type="number" value="0">
<input class="form-control" id="speedlimit" type="number" value="{$shop->speedlimit()}">
</div>


<div class="form-group form-group-label">
<label class="floating-label" for="connector">IP限制</label>
<input class="form-control" id="connector" type="number" value="0">
<input class="form-control" id="connector" type="number" value="{$shop->connector()}">
</div>
</div>
</div>
Expand Down