wugg 3 年之前
父節點
當前提交
cce5137e52
共有 4 個文件被更改,包括 159 次插入24 次删除
  1. 48 9
      app/admin/controller/Consult.php
  2. 74 9
      app/admin/controller/Good.php
  3. 36 6
      app/admin/controller/Goodup.php
  4. 1 0
      app/admin/route/app.php

+ 48 - 9
app/admin/controller/Consult.php

@@ -401,14 +401,53 @@ class Consult extends BaseController
             return error_show(1004,"参数cat_id不能为空");
         }
         $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
-        $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
-        $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
-        $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
-        $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
-        $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
-        $model = isset($this->post['model'])&&$this->post['model']!=""? trim($this->post['model']):"";
-        if($pname==""){
-            return error_show(1004,"参数pname不能为空");
-        }
+        $material = isset($this->post['material'])&&$this->post['material']!=""? trim($this->post['material']):"";
+        $unit_id = isset($this->post['unit_id'])&&$this->post['unit_id']!=""? trim($this->post['unit_id']):"";
+        $cost_desc = isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""? trim($this->post['cost_desc']):"";
+        $work_day = isset($this->post['work_day'])&&$this->post['work_day']!=""? trim($this->post['work_day']):"";
+        $delivery_day = isset($this->post['delivery_day'])&&$this->post['delivery_day']!=""? trim($this->post['delivery_day']):"";
+        $good_img = isset($this->post['good_img'])&&$this->post['good_img']!=""? trim($this->post['good_img']):"";
+        $expire_day = isset($this->post['expire_day'])&&$this->post['expire_day']!=""? trim($this->post['expire_day']):"";
+        $origin_place = isset($this->post['origin_place'])&&$this->post['origin_place']!=""? trim($this->post['origin_place']):"";
+        $supplierNo = isset($this->post['supplierNo'])&&$this->post['supplierNo']!=""? trim($this->post['supplierNo']):"";
+        $pay_way = isset($this->post['pay_way'])&&$this->post['pay_way']!=""? trim($this->post['pay_way']):"";
+        $tax = isset($this->post['tax'])&&$this->post['tax']!=""? trim($this->post['tax']):"";
+        $send_way = isset($this->post['send_way'])&&$this->post['send_way']!=""? trim($this->post['send_way']):"";
+        $metal_id = isset($this->post['metal_id'])&&$this->post['metal_id']!=""? trim($this->post['metal_id']):"";
+        $is_gold_price = isset($this->post['is_gold_price'])&&$this->post['is_gold_price']!=""? trim($this->post['is_gold_price']):"";
+        $config = isset($this->post['config'])&&$this->post['config']!=""? trim($this->post['config']):"";
+        $weight = isset($this->post['weight'])&&$this->post['weight']!=""? floatval($this->post['weight']):"";
+        $demo_fee = isset($this->post['demo_fee'])&&$this->post['demo_fee']!=""? floatval($this->post['demo_fee']):"";
+        $delivery_fee = isset($this->post['delivery_fee'])&&$this->post['delivery_fee']!=""? floatval($this->post['delivery_fee']):"";
+        $open_fee = isset($this->post['open_fee'])&&$this->post['open_fee']!=""? floatval($this->post['open_fee']):"";
+        $pakge_fee = isset($this->post['pakge_fee'])&&$this->post['pakge_fee']!=""? floatval($this->post['pakge_fee']):"";
+        $nake_fee = isset($this->post['nake_fee'])&&$this->post['nake_fee']!=""? floatval($this->post['nake_fee']):"";
+        $mark_fee = isset($this->post['mark_fee'])&&$this->post['mark_fee']!=""? floatval($this->post['mark_fee']):"";
+        $cert_fee = isset($this->post['cert_fee'])&&$this->post['cert_fee']!=""? floatval($this->post['cert_fee']):"";
+        $cost_fee = isset($this->post['cost_fee'])&&$this->post['cost_fee']!=""? floatval($this->post['cost_fee']):"";
+        $total_fee = isset($this->post['total_fee'])&&$this->post['total_fee']!=""? floatval($this->post['total_fee']):"";
+
+        $is_diff = isset($this->post['is_diff'])&&$this->post['is_diff']!==""? intval($this->post['is_diff']):"";
+        $supply_area = isset($this->post['supply_area'])&&$this->post['supply_area']!==""? intval($this->post['supply_area']):"";
+        $remark = isset($this->post['remark'])&&$this->post['remark']!=""? trim($this->post['remark']):"";
+        $bidNo=makeNo("BD");
+        $spucode=makeNo("SPU");
+        $data=[
+            "bidNo"=>$bidNo,
+            "infoNo"=>$infoNo,
+            "zxNo"=>$zxinfo['zxNo'],
+            "spuCode"=>$spucode,
+            "good_name"=>$pname,
+            "brand_id"=>$brandid,
+            "cat_id"=>$cat_id,
+            "model"=>$model,
+            "material"=>$material,
+            "unit_id"=>$unit_id,
+            "cost_desc"=>$cost_desc,
+            "work_day"=>$work_day,
+            "delivery_day"=>$delivery_day,
+            "good_img"=>$good_img,
+            ""
+        ];
     }
 }

+ 74 - 9
app/admin/controller/Good.php

@@ -31,14 +31,14 @@ class Good extends \app\BaseController
         {
             parent::__construct($app);
             $this->post = $this->request->post();
-            $token = isset($this->post['token']) ? trim($this->post['token']) : "";
-            if($token==""){
-                return error_show(101,'token不能为空');
-            }
-            $effetc = VerifyTokens($token);
-            if(!empty($effetc) && $effetc['code']!=0){
-                return error_show($effetc['code'],$effetc['message']);
-            }
+//            $token = isset($this->post['token']) ? trim($this->post['token']) : "";
+//            if($token==""){
+//                return error_show(101,'token不能为空');
+//            }
+//            $effetc = VerifyTokens($token);
+//            if(!empty($effetc) && $effetc['code']!=0){
+//                return error_show($effetc['code'],$effetc['message']);
+//            }
         }
 
     public function list(){
@@ -120,7 +120,72 @@ class Good extends \app\BaseController
         }
         return app_show(0,"获取成功",['list'=>$data,'count'=>$count]);
     }
-        public function SetWarn(){
+
+    public function info(){
+            $skucode=isset($this->post['skuCode'])&&$this->post['skuCode']!=""?trim($this->post['skuCode']):"";
+            if($skucode==""){
+                return error_show(1005,"参数skuCode不能为空");
+            }
+            $good_platform = Db::name("good_platform")->where(['skuCode'=>$skucode,"is_del"=>0])->find();
+            if($good_platform==false){
+              return error_show(1004,"未找到商品数据");
+            }
+            $data = Db::name("good")->where(["spuCode"=>$good_platform['spuCode'],"is_del"=>0])->find();
+            if($data==false){
+                return error_show(1004,"未找到商品数据");
+            }
+            $plat =Db::name("platform")->where(["platform_code"=>$good_platform['platform_code']])->find();
+            $data['skuCode']=$good_platform['skuCode'];
+            $data['platform_code']=$good_platform['platform_code'];
+            $data['platform_name']=isset($plat['platform_name'])?$plat['platform_name']:"";
+            $data['online_reason']=$good_platform['online_reason'];
+            $data['online_time']=$good_platform['online_time'];
+            $data['online_remark']=$good_platform['online_remark'];
+            $data['exam_status']=$good_platform['exam_status'];
+            $data['is_online']=$good_platform['is_online'];
+        $unit =Db::name("unit")->where(["id"=>$data['good_unit']])->find();
+        $data['unit'] = isset($unit['unit'])?$unit['unit']:'';
+        $data['cat_info'] = made($data['cat_id'],[]);
+        $spec = Db::name("good_spec")->where(["spuCode"=>$good_platform['spuCode'],"is_del"=>0])->select()->toArray();
+        $supplier = Db::name("supplier")->where(["code"=>$data['supplierNo']])->find();
+        $data['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
+//        $supplier = Db::name("supplier")->where(["code"=>$data['supplierNo']])->find();
+//        $data['supplierName'] = isset($supplier['name'])?$supplier['name']:"";
+        $company = Db::name("business")->where(["companyNo"=>$data['companyNo']])->find();
+        $data['company'] = isset($company['company'])?$company['company']:"";
+        if($data['brand_id']!=0){
+            $brand=Db::name("brand")->where(["id"=>$data['brand_id']])->find();
+            $data["brand_name"]=isset($brand['brand_name'])?$brand['brand_name']:"";
+        }else{
+            $data["brand_name"]="";
+            $data["brand_id"]="";
+        }
+        $data["good_info_img"]=$data['good_info_img']!=""? json_decode($data['good_info_img'],true):[];
+        $speclist=[];
+        if(!empty($spec)){
+            foreach ($spec as $value){
+                $temp=[];
+                $temp['id']=$value['id'];
+                $temp['spuCode']=$value['spuCode'];
+                $temp['spec_id']=$value['spec_id'];
+                $temp['spec_value_id']=$value['spec_value_id'];
+                $temp['is_del']=$value['is_del'];
+                $sp = Db::name("specs")->where(["id"=>$value['spec_id']])->find();
+                $temp['spec_name']=isset($sp["spec_name"]) ? $sp["spec_name"]:"";
+                $spv = Db::name("spec_value")->where(["id"=>$value['spec_value_id']])->find();
+                $temp['spec_value']=isset($spv["spec_value"]) ? $spv["spec_value"]:"";
+                $speclist[]=$temp;
+            }
+        }
+        $data["speclist"]=empty($speclist)?[]:$speclist;
+        // $nake=[];
+        $ladder = Db::name("good_ladder")->where(['skuCode'=>$skucode,"is_del"=>0])->select()->toArray();
+        $data["ladderlist"]=!empty($ladder)?$ladder:[];
+        return app_show(0,"获取成功",$data);
+    }
+
+
+    public function SetWarn(){
             $condition=["is_del"=>0];
             $wsm_code = isset($this->post['wsm_code']) &&$this->post['wsm_code'] !=="" ? trim($this->post['wsm_code']):"";
             if($wsm_code!=""){

+ 36 - 6
app/admin/controller/Goodup.php

@@ -818,7 +818,6 @@ class Goodup extends BaseController
         if($data==false){
             return error_show(1004,"未找到商品数据");
         }
-
         $online_reason = isset($this->post['online_reason'])&&$this->post['online_reason']!==""? trim($this->post['online_reason']):"";
         if($online_reason===""){
             return error_show(1004,"参数online_reason不能为空");
@@ -858,8 +857,28 @@ class Goodup extends BaseController
         Db::startTrans();
         $create =Db::name("good_platform")->insertAll($data);
         if($create){
-            Db::commit();
-            return app_show(0,"提交成功");
+            $iso = Db::name("good")->where(["spuCode"=>$data['spuCode'],"is_del"=>0])->find();
+            if($iso==false){
+                unset($data['id']);
+                $data['creater']=$creater;
+                $data['createrid']=$createrid;
+                $data['addtime']=date("Y-m-d H:i:s");
+                $data['updatetime']=date("Y-m-d H:i:s");
+            }else{
+                $data['id']=$iso['is'];
+                $data['creater']=$creater;
+                $data['createrid']=$createrid;
+                $data['updatetime']=date("Y-m-d H:i:s");
+            }
+            $up =Db::name("good")->save($data);
+            if($up){
+                Db::commit();
+                return app_show(0,"提交成功");
+            }else{
+                Db::rollback();
+                return error_show(1004,"提交失败");
+            }
+
         }else{
             Db::rollback();
             return error_show(1004,"提交失败");
@@ -944,6 +963,16 @@ class Goodup extends BaseController
         if($good_ladder==""){
             return error_show(1004,"参数good_ladder不能为空");
         }
+        $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
+        if($token==''){
+            return error_show(1005,"参数token不能为空");
+        }
+        $user =GetUserInfo($token);
+        if(empty($user)||$user['code']!=0){
+            return error_show(1002,"用户数据不存在");
+        }
+        $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
+        $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
         $platform['exam_status']=4;
         $platform['updatetime']=date("Y-m-d H:i:s");
         Db::startTrans();
@@ -974,10 +1003,11 @@ class Goodup extends BaseController
             $up = Db::name("good_platform")->save($platform);
             if($up){
                 $data=[
-                    "skuCode"=>$platform['skuCode'],
+                    "code"=>$platform['skuCode'],
+                    "type"=>2,
                     "exam_status"=>4,
-                    "exam_id"=>0,
-                    "exam_name"=>"",
+                    "exam_id"=>$createrid,
+                    "exam_name"=>$creater,
                     "exam_remark"=>'',
                     "addtime"=>date("Y-m-d H:i:s")
                 ];

+ 1 - 0
app/admin/route/app.php

@@ -340,6 +340,7 @@ Route::rule('gooduponline','admin/Goodup/online');
 Route::rule('goodupexam','admin/Goodup/online_exam');
 Route::rule('goodupeditladder','admin/Goodup/editladder');
 Route::rule('goodexam','admin/Goodup/exam');
+Route::rule('goodinfo','admin/Good/info');
 
 Route::rule('activitylist','admin/Activity/list');
 Route::rule('activitylinst','admin/Activity/linst');