| xqd
@@ -91,22 +91,27 @@ class CatController extends Controller
|
|
|
/**
|
|
|
* 保存修改
|
|
|
*/
|
|
|
- private function _createFirst(){
|
|
|
+ private function _createFirst()
|
|
|
+ {
|
|
|
$data = (array) request('data');
|
|
|
- $id = request('id');
|
|
|
+ $ids = request('id');
|
|
|
$data['store_id'] = $this->getStoreId();
|
|
|
if (!empty($data['pic_url'])) {
|
|
|
$data['pic_url'] = $this->formatImgUrl($data['pic_url']);
|
|
|
}
|
|
|
$data['parent_id'] = 0;
|
|
|
$id = $this->repository->create($data);
|
|
|
+ if ($ids == 0) {
|
|
|
+ $url = U('Album/Cat/create');
|
|
|
+ } else {
|
|
|
+ $url = U('Album/Cat/update', ['id' => $ids]);
|
|
|
+ }
|
|
|
if ($id) {
|
|
|
- $url[] = array('url' => U('Album/Cat/index'), 'title' => '返回列表');
|
|
|
- $url[] = array('url' => U('Album/Cat/create'), 'title' => '继续添加');
|
|
|
- $this->showMessage('添加成功', $url);
|
|
|
+ $urls[] = array('url' => $url, 'title' => '返回');
|
|
|
+ $this->showMessage('添加成功', $urls);
|
|
|
} else {
|
|
|
- $url[] = array('url' => U('Album/Cat/index'), 'title' => '返回列表');
|
|
|
- return $this->showWarning('添加失败', $url);
|
|
|
+ $urls[] = array('url' => $url, 'title' => '返回列表');
|
|
|
+ return $this->showWarning('添加失败', $urls);
|
|
|
}
|
|
|
}
|
|
|
|