...
|
...
|
@@ -37,6 +37,11 @@ class GoodController extends AdminBaseController |
|
|
public function edit(){
|
|
|
$id=input('id');
|
|
|
$data=db('goods')->where('id',$id)->find();
|
|
|
$data['banner']=json_decode($data['banner']);
|
|
|
$data['banner_name']=json_decode($data['banner_name']);
|
|
|
foreach ($data['banner'] as $k=>$v){
|
|
|
$data['banner'][$k]=cmf_get_image_url($v);
|
|
|
}
|
|
|
$this->assign('data',$data);
|
|
|
return $this->fetch();
|
|
|
}
|
...
|
...
|
@@ -47,7 +52,18 @@ class GoodController extends AdminBaseController |
|
|
public function editPost(){
|
|
|
$id=input('id');
|
|
|
$data=input();
|
|
|
$banner=input('banner/a');
|
|
|
$banner_name=input('banner_name/a');
|
|
|
if (empty($banner)){
|
|
|
|
|
|
}else{
|
|
|
unset($data['banner']);
|
|
|
unset($data['banner_name']);
|
|
|
$data['banner']=json_encode($banner,true);
|
|
|
$data['banner_name']=json_encode($banner_name,true);
|
|
|
}
|
|
|
$info=db('goods')->where('id',$id)->update($data);
|
|
|
|
|
|
if (!empty($info)){
|
|
|
$this->success('编辑成功!');
|
|
|
}else{
|
...
|
...
|
@@ -67,6 +83,16 @@ class GoodController extends AdminBaseController |
|
|
*/
|
|
|
public function addPost(){
|
|
|
$data=input();
|
|
|
$banner=input('banner/a');
|
|
|
$banner_name=input('banner_name/a');
|
|
|
if (empty($banner)){
|
|
|
|
|
|
}else{
|
|
|
unset($data['banner']);
|
|
|
unset($data['banner_name']);
|
|
|
$data['banner']=json_encode($banner,true);
|
|
|
$data['banner_name']=json_encode($banner_name,true);
|
|
|
}
|
|
|
$info=db('goods')->insert($data);
|
|
|
if (!empty($info)){
|
|
|
$this->success('编辑成功!');
|
...
|
...
|
|