544782275@qq.com il y a 3 ans
Parent
commit
3d126ada45
2 fichiers modifiés avec 10 ajouts et 18 suppressions
  1. 6 6
      application/store/controller/Goods.php
  2. 4 12
      application/store/controller/Serve.php

+ 6 - 6
application/store/controller/Goods.php

@@ -68,7 +68,7 @@ class Goods extends Controller
     }
 
     /**
-     * 商品库存入库
+     * 服务库存入库
      * @auth true
      * @throws \think\Exception
      * @throws \think\db\exception\DataNotFoundException
@@ -98,7 +98,7 @@ class Goods extends Controller
                     $this->success('金刚区服务入库成功!');
                 }
             }
-            $this->error('没有需要商品入库的数据!');
+            $this->error('没有需要服务入库的数据!');
         }
     }
 
@@ -145,7 +145,7 @@ class Goods 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;
@@ -156,8 +156,8 @@ class Goods 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不能为空,请上传图片');
+            if (empty($data['image'])) $this->error('服务展示图片不能为空,请上传图片');
             Db::name('StoreGoodsList')->where(['goods_id' => $data['id']])->update(['status' => '0']);
             //查询是否有规格信息
             $goods_type = Db::name('store_goods_type')->where('goods_id',$data['id'])->find();
@@ -203,7 +203,7 @@ class Goods extends Controller
     protected function _form_result($result)
     {
         if ($result && $this->request->isPost()) {
-            $this->success('商品编辑成功!', 'javascript:history.back()');
+            $this->success('服务编辑成功!', 'javascript:history.back()');
         }
     }
 

+ 4 - 12
application/store/controller/Serve.php

@@ -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()');
         }
     }