|
@@ -17,7 +17,7 @@ class ActionBarController extends Controller
|
|
"description" => "max:255",
|
|
"description" => "max:255",
|
|
"icon" => "max:255",
|
|
"icon" => "max:255",
|
|
"link_type" => "between:1,32",
|
|
"link_type" => "between:1,32",
|
|
- "link" => "max255",
|
|
|
|
|
|
+ "link" => "max:255",
|
|
]);
|
|
]);
|
|
if ($validator->fails()) {
|
|
if ($validator->fails()) {
|
|
return $this->fail(REQUEST_PARAM_ERROR, $this->error[REQUEST_PARAM_ERROR], $validator->errors());
|
|
return $this->fail(REQUEST_PARAM_ERROR, $this->error[REQUEST_PARAM_ERROR], $validator->errors());
|
|
@@ -42,12 +42,13 @@ class ActionBarController extends Controller
|
|
public function ModifyActionBar(Request $request)
|
|
public function ModifyActionBar(Request $request)
|
|
{
|
|
{
|
|
$validator = Validator::make($request->all(), [
|
|
$validator = Validator::make($request->all(), [
|
|
- "parent" => "",
|
|
|
|
- "name" => "required|between:1,64",
|
|
|
|
|
|
+ "id" => "required|integer|min:1",
|
|
|
|
+ "parent" => "integer|min:0",
|
|
|
|
+ "name" => "between:1,64",
|
|
"description" => "max:255",
|
|
"description" => "max:255",
|
|
"icon" => "max:255",
|
|
"icon" => "max:255",
|
|
- "link_type" => "",
|
|
|
|
- "link" => "",
|
|
|
|
|
|
+ "link_type" => "max:32",
|
|
|
|
+ "link" => "max:255",
|
|
]);
|
|
]);
|
|
if ($validator->fails()) {
|
|
if ($validator->fails()) {
|
|
return $this->fail(REQUEST_PARAM_ERROR, $this->error[REQUEST_PARAM_ERROR], $validator->errors());
|
|
return $this->fail(REQUEST_PARAM_ERROR, $this->error[REQUEST_PARAM_ERROR], $validator->errors());
|
|
@@ -64,29 +65,46 @@ class ActionBarController extends Controller
|
|
$params["name"] = $request->input("name");
|
|
$params["name"] = $request->input("name");
|
|
|
|
|
|
$bar = new Models\ActionBar();
|
|
$bar = new Models\ActionBar();
|
|
- $result = $bar->ModifyActionBar($params);
|
|
|
|
- return $result;
|
|
|
|
|
|
+ $code = $bar->ModifyActionBar($params);
|
|
|
|
+ return $this->response($code, $this->error[$code]);
|
|
}
|
|
}
|
|
|
|
|
|
public function DeleteActionBar(Request $request)
|
|
public function DeleteActionBar(Request $request)
|
|
{
|
|
{
|
|
|
|
+ $validator = Validator::make($request->all(), [
|
|
|
|
+ "id" => "required|integer|min:1",
|
|
|
|
+ ]);
|
|
|
|
+ if ($validator->fails()) {
|
|
|
|
+ return $this->fail(REQUEST_PARAM_ERROR, $this->error[REQUEST_PARAM_ERROR], $validator->errors());
|
|
|
|
+ }
|
|
|
|
+
|
|
$params = [];
|
|
$params = [];
|
|
- $bid = $request->input("id");
|
|
|
|
|
|
+ $bid = (int)$request->input("id");
|
|
$params["id"] = $bid;
|
|
$params["id"] = $bid;
|
|
|
|
|
|
$bar = new Models\ActionBar();
|
|
$bar = new Models\ActionBar();
|
|
- $result = $bar->DeleteActionBar($params);
|
|
|
|
- return $result;
|
|
|
|
|
|
+ $code = $bar->DeleteActionBar($params);
|
|
|
|
+ return $this->response($code, $this->error[$code]);
|
|
}
|
|
}
|
|
|
|
|
|
public function LoadActionBar(Request $request)
|
|
public function LoadActionBar(Request $request)
|
|
{
|
|
{
|
|
|
|
+ $validator = Validator::make($request->all(), [
|
|
|
|
+ "uid" => "required|integer|min:1",
|
|
|
|
+ ]);
|
|
|
|
+ if ($validator->fails()) {
|
|
|
|
+ return $this->fail(REQUEST_PARAM_ERROR, $this->error[REQUEST_PARAM_ERROR], $validator->errors());
|
|
|
|
+ }
|
|
|
|
+
|
|
$params = [];
|
|
$params = [];
|
|
$uid = $request->input("uid");
|
|
$uid = $request->input("uid");
|
|
$params["uid"] = $uid;
|
|
$params["uid"] = $uid;
|
|
|
|
|
|
$bar = new Models\ActionBar();
|
|
$bar = new Models\ActionBar();
|
|
$result = $bar->ListActionBar($params);
|
|
$result = $bar->ListActionBar($params);
|
|
- return "success";
|
|
|
|
|
|
+ if ($result["code"] == 0){
|
|
|
|
+ return $this->success($result["data"]);
|
|
|
|
+ }
|
|
|
|
+ return $this->fail($result["code"], $this->error[$result["code"]]);
|
|
}
|
|
}
|
|
}
|
|
}
|