|
@@ -110,7 +110,7 @@ class Serve extends Controller
|
|
|
*/
|
|
|
protected function _form_filter(&$data)
|
|
|
{
|
|
|
- // 生成商品ID
|
|
|
+ // 生成服务ID
|
|
|
if(empty($data['id'])){
|
|
|
$goods_id = Db::name('store_goods')->order('id desc')->value('id');
|
|
|
$data['id'] = $goods_id + 1;
|
|
@@ -121,33 +121,25 @@ class Serve extends Controller
|
|
|
$this->defaultValues = json_encode($defaultValues, JSON_UNESCAPED_UNICODE);
|
|
|
$this->cates = Db::name('StoreGoodsCate')->where(['is_deleted' => '0', 'status' => '1'])->order('sort desc,id desc')->select();
|
|
|
} elseif ($this->request->isPost()) {
|
|
|
- if (empty($data['logo'])) $this->error('商品LOGO不能为空,请上传图片');
|
|
|
- if (empty($data['image'])) $this->error('商品展示图片不能为空,请上传图片');
|
|
|
+ if (empty($data['logo'])) $this->error('服务LOGO不能为空,请上传图片');
|
|
|
Db::name('StoreGoodsList')->where(['goods_id' => $data['id']])->update(['status' => '0']);
|
|
|
//查询是否有规格信息
|
|
|
$goods_type = Db::name('store_goods_type')->where('goods_id',$data['id'])->find();
|
|
|
if(empty($goods_type)){
|
|
|
$serve_type = array();
|
|
|
- $phone_type = array();
|
|
|
foreach (json_decode($data['lists']) as $value){
|
|
|
foreach ($value as $k=>$v){
|
|
|
if($k == 0){
|
|
|
if(!in_array($v->name,$serve_type)){
|
|
|
$serve_type[] = $v->name;
|
|
|
}
|
|
|
- }elseif ($k == 1){
|
|
|
- if(!in_array($v->name,$phone_type)){
|
|
|
- $phone_type[] = $v->name;
|
|
|
- }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ var_dump($serve_type);exit();
|
|
|
foreach ($serve_type as $v){
|
|
|
Db::name('store_goods_type')->insert(array('goods_id'=>$data['id'],'spec_name'=>$v));
|
|
|
}
|
|
|
- foreach ($phone_type as $v){
|
|
|
- Db::name('store_goods_type')->insert(array('goods_id'=>$data['id'],'spec_name'=>$v,'type'=>2));
|
|
|
- }
|
|
|
}
|
|
|
foreach (json_decode($data['lists'], true) as $vo) Data::save('StoreGoodsList', [
|
|
|
'goods_id' => $data['id'],
|
|
@@ -168,7 +160,7 @@ class Serve extends Controller
|
|
|
protected function _form_result($result)
|
|
|
{
|
|
|
if ($result && $this->request->isPost()) {
|
|
|
- $this->success('商品编辑成功!', 'javascript:history.back()');
|
|
|
+ $this->success('服务编辑成功!', 'javascript:history.back()');
|
|
|
}
|
|
|
}
|
|
|
|