Browse Source

Merge branch 'version1.5' of ssh://192.168.10.210:10022/wugg/stock into version1.5

panlumeng 3 years ago
parent
commit
e48a837ca9

+ 2 - 1
app/BaseController.php

@@ -52,7 +52,8 @@ abstract class BaseController
 
     // 初始化
     protected function initialize()
-    {}
+    {
+    }
 
     /**
      * 验证数据

+ 31 - 0
app/admin/controller/Base.php

@@ -0,0 +1,31 @@
+<?php
+
+
+namespace app\admin\controller;
+
+
+use think\App;
+
+class Base extends \app\BaseController
+{
+    public  $post=[];
+    public function __construct(App $app)
+    {
+        parent::__construct($app);
+        $this->post =$this->request->post();
+        $this->validateToken();
+    }
+
+    public function validateToken()
+    {
+        $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']);
+        }
+        // TODO: Change the autogenerated stub
+    }
+}

+ 196 - 15
app/admin/controller/Consult.php

@@ -2,25 +2,15 @@
 
 namespace app\admin\controller;
 
-use app\BaseController;
 use think\App;
 use think\facade\Db;
 
-class Consult extends BaseController
+class Consult extends Base
 {
-    public $post = "";
+
     public function __construct(App $app)
     {
         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']);
-//        }
     }
 //    public function list(){
 //      $page = isset($this->post['page']) && $this->post['page'] !== "" ? intval($this->post['page']) :"1";
@@ -233,7 +223,7 @@ class Consult extends BaseController
         $zx = Db::name("consult_order")->insert($data);
         if($zx){
             foreach ($ladder as $value){
-                $infoNo=isset($value['pgNo'])&&$value['pgNo']!==""?trim($value['pgNo']):makeNo("INF");
+                $infoNo=makeNo("INF");
                 $info=[
                     "infoNo"=>$infoNo,
                     "zxNo"=>$zxNo,
@@ -259,6 +249,7 @@ class Consult extends BaseController
                     "total_weight"=>isset($value['total_weight'])?$value['total_weight']:"0",
                     "budget_price"=>$value['budget_price'],
                     "num"=>$value['num'],
+                    "pgNo"=>isset($value['pgNo'])&&$value['pgNo']!==""?trim($value['pgNo']):"",
                     "use_desc"=>$value['use_desc'],
                     "remark"=>$value['remark'],
                     "status"=>1,
@@ -492,6 +483,184 @@ class Consult extends BaseController
         }
         return app_show(0,"获取成功",$zxinfo);
     }
+
+    public function zxedit(){
+        $infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
+        if($infoNo==""){
+            return error_show(1004,"参数infoNo不能为空");
+        }
+        $zxinfo = Db::name("consult_info")->where(["infoNo"=>$infoNo,"is_del"=>0])->find();
+        if($zxinfo==false){
+            return error_show(1004,"未找到信息数据");
+        }
+
+        $good_name= isset($this->post['good_name'])&&$this->post['good_name']!=""?trim($this->post['good_name']):"";
+        if($good_name==""){
+            return error_show(1003,"参数good_name不能为空");
+        }
+
+        $good_img= isset($this->post['good_img'])&&$this->post['good_img']!=""?trim($this->post['good_img']):"";
+        if($good_img==""){
+            return error_show(1003,"参数good_img不能为空");
+        }
+
+        $cat_id= isset($this->post['cat_id'])&&$this->post['cat_id']!=""?intval($this->post['cat_id']):"";
+        if($cat_id==""){
+            return error_show(1003,"参数cat_id不能为空");
+        }
+
+        $unit= isset($this->post['unit'])&&$this->post['unit']!=""?trim($this->post['unit']):"";
+        if($unit==""){
+            return error_show(1003,"参数unit不能为空");
+        }
+        $brand_id= isset($this->post['brand_id'])&&$this->post['brand_id']!==""?intval($this->post['brand_id']):"0";
+
+        $arrival_time= isset($this->post['arrival_time'])&&$this->post['arrival_time']!=""?$this->post['arrival_time']:"";
+        if($arrival_time==""){
+            return error_show(1003,"参数arrival_time不能为空");
+        }
+        $model= isset($this->post['model'])&&$this->post['model']!=""?trim($this->post['model']):"";
+        if($model==""){
+            return error_show(1003,"参数model不能为空");
+        }
+        $color= isset($this->post['color'])&&$this->post['color']!=""?trim($this->post['color']):"";
+        if($color==""){
+            return error_show(1003,"参数color不能为空");
+        }
+        $material= isset($this->post['material'])&&$this->post['material']!=""?trim($this->post['material']):"";
+        if($material==""){
+            return error_show(1003,"参数material不能为空");
+        }
+        $cost_desc= isset($this->post['cost_desc'])&&$this->post['cost_desc']!=""?trim($this->post['cost_desc']):"";
+        if($cost_desc==""){
+            return error_show(1003,"参数cost_desc不能为空");
+        }
+        $is_addrs= isset($this->post['is_addrs'])&&$this->post['is_addrs']!==""?intval($this->post['is_addrs']):"";
+        if($is_addrs===""){
+            return error_show(1003,"参数is_addrs不能为空");
+        }
+        $is_custom= isset($this->post['is_custom'])&&$this->post['is_custom']!==""?trim($this->post['is_custom']):"";
+        if($is_custom===""){
+            return error_show(1003,"参数is_custom不能为空");
+        }
+        $metal_id= isset($this->post['metal_id'])&&$this->post['metal_id']!==""?intval($this->post['metal_id']):"";
+        if($metal_id===""){
+            return error_show(1003,"参数metal_id不能为空");
+        }
+        $config = isset($this->post['config'])&& $this->post['config']!=""?trim($this->post['config']):"";
+        $other_config = isset($this->post['other_config'])&& $this->post['other_config']!=""?trim($this->post['other_config']):"";
+        $specs_weight = isset($this->post['specs_weight'])&& $this->post['specs_weight']!==""?floatval($this->post['specs_weight']):"";
+        $gold_price = isset($this->post['gold_price'])&& $this->post['gold_price']!==""?floatval($this->post['gold_price']):"";
+        $is_gold_price = isset($this->post['is_gold_price'])&& $this->post['is_gold_price']!==""?intval($this->post['is_gold_price']):"0";
+        $budget_price = isset($this->post['budget_price'])&& $this->post['budget_price']!==""?floatval($this->post['budget_price']):"";
+        $total_weight = isset($this->post['total_weight'])&& $this->post['total_weight']!==""?floatval($this->post['total_weight']):"";
+        $num = isset($this->post['num'])&& $this->post['num']!==""?intval($this->post['num']):"";
+        if($num===""){
+            return error_show(1003,"参数num不能为空");
+        }
+        if($budget_price===""){
+            return error_show(1003,"参数budget_price不能为空");
+        }
+        $use_desc = isset($this->post['use_desc'])&& $this->post['use_desc']!="" ? trim($this->post['use_desc']):"";
+        if($use_desc==""){
+            return error_show(1003,"参数use_desc不能为空");
+        }
+        $remark = isset($this->post['remark'])&& $this->post['remark']!="" ? trim($this->post['remark']):"";
+        if($remark==""){
+            return error_show(1003,"参数remark不能为空");
+        }
+        if($metal_id!=0){
+            if($config==""){
+                return error_show(1003,"参数config不能为空");
+            }
+            if($other_config==""){
+                return error_show(1003,"参数other_config不能为空");
+            }
+            if($specs_weight===""){
+                return error_show(1003,"参数specs_weight不能为空");
+            }
+            if($gold_price===""){
+                return error_show(1003,"参数gold_price不能为空");
+            }
+        }
+        $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
+        if($token==''){
+            return error_show(102,"参数token不能为空");
+        }
+        $user =GetUserInfo($token);
+        if(empty($user)||$user['code']!=0){
+            return error_show(105,"用户数据不存在");
+        }
+        $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
+        $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
+        $bidlist = Db::name("consult_bids")->where(["infoNo"=>$zxinfo['infoNo'],"is_del"=>0])->select();
+        try{
+            $innew =makeNo("INF");
+            $info=[
+                "infoNo"=>$innew,
+                "zxNo"=>$zxinfo['zxNo'],
+                "spuCode"=>"",
+                "good_name"=>$good_name,
+                "good_img"=>$good_img,
+                "cat_id"=>$cat_id,
+                "unit"=>$unit,
+                "brand_id"=>$brand_id,
+                "arrival_time"=>$arrival_time,
+                "model"=>$model,
+                "color"=>$color,
+                "material"=>$material,
+                "cost_desc"=>$cost_desc,
+                "is_addrs"=>$is_addrs,
+                "is_custom"=>$is_custom,
+                "metal_id"=>$metal_id,
+                "config"=>$config,
+                "other_config"=>$other_config,
+                "specs_weight"=>$specs_weight===""?0:$specs_weight,
+                "gold_price"=>$gold_price===""? 0 : $gold_price,
+                "is_gold_price"=>$is_gold_price===""?0:$is_gold_price,
+                "total_weight"=>$total_weight===""? $num*$specs_weight :$total_weight,
+                "budget_price"=>$budget_price,
+                "num"=>$num,
+                "use_desc"=>$use_desc,
+                "remark"=>$remark,
+                "status"=>1,
+                "is_del"=>0,
+                "addtime"=>date("Y-m-d H:i:s"),
+                "updatetime"=>date("Y-m-d H:i:s")
+            ];
+            $up = Db::name("consult_info")->insert($info);
+            if($up){
+                if (!empty($bidlist)){
+                    foreach ($bidlist as $value){
+                        unset($value['id']);
+                        $value['infoNo']=$innew;
+                        $value['sale_price'] =$value['total_price'];
+                        $value['status'] =0;
+                        $value['updatetime'] =date("Y-m-d H:i:s");
+                        $in = Db::name("consult_bids")->insert($value);
+                        if($in==false){
+                            Db::rollback();
+                            return error_show(1004,"反馈商品新建失败");
+                        }
+                    }
+                }
+                $zxinfo["bargain_status"] =1;
+                $zxinfo["bargain_code"] =$innew;
+                $zxinfo["updatetime"] =date("Y-m-d H:i:s");
+                $bar=Db::name("consult_info")->save($zxinfo);
+                if($bar==false){
+                    Db::rollback();
+                    return error_show(1004,"反馈商品更新失败");
+                }
+                Db::commit();
+                return app_show(0,"咨询新建成功",["infoNo"=>$innew]);
+            }
+        }catch (\Exception $e){
+            Db::rollback();
+            return error_show(1004,$e->getMessage());
+        }
+
+    }
     //** 发布竞标任务 */
     public function  bargain(){
         $infoNo= isset($this->post['infoNo'])&&$this->post['infoNo']!=""?trim($this->post['infoNo']):"";
@@ -968,6 +1137,16 @@ class Consult extends BaseController
         if ($bidNo !== "") {
             $where[] = ['bidNo','=',$bidNo];
         }
+        $pgNo = isset($this->post['pgNo']) && $this->post['pgNo'] !== "" ? trim($this->post['pgNo']) : "";
+        if ($pgNo !== "") {
+            $bidinfo = Db::name("consult_info")->where([["pgNo","=",$pgNo],["is_del","=",0]])->column("infoNo");
+            $where[] = ['infoNo','in',$bidinfo];
+        }
+        $bargain_status = isset($this->post['bargain_status']) && $this->post['bargain_status'] !== "" ? intval($this->post['bargain_status']) : "";
+        if ($bargain_status !== "") {
+            $bidinfo = Db::name("consult_info")->where([["bargain_status","=",$bargain_status],["is_del","=",0]])->column("infoNo");
+            $where[] = ['infoNo','in',$bidinfo];
+        }
         $projectNo = isset($this->post['projectNo']) && $this->post['projectNo'] !== "" ? trim($this->post['projectNo']) : "";
         if ($projectNo !== "") {
             $zxlist = Db::name("consult_order")->where(["projectNo"=>$projectNo,"is_del"=>0,"is_project"=>1])->column
@@ -1015,6 +1194,7 @@ class Consult extends BaseController
                 $price = GoodPrice($god, $budget/100);
             }
             $value['sale_price'] =round($price,2);
+            $value['bargain_status']=$bidinfo['bargain_status'];
             $data[]=$value;
         }
         return app_show(0,"获取成功",['count'=>$count,'list'=>$data]);
@@ -1042,11 +1222,11 @@ class Consult extends BaseController
         }
         $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
         if($token==''){
-            return error_show(1002,"参数token不能为空");
+            return error_show(102,"参数token不能为空");
         }
         $user =GetUserInfo($token);
         if(empty($user)||$user['code']!=0){
-            return error_show(1005,"用户数据不存在");
+            return error_show(105,"用户数据不存在");
         }
         $createrid= isset($user["data"]['id']) ?  $user["data"]['id'] : "";
         $creater= isset($user["data"]['nickname']) ?  $user["data"]['nickname'] : "";
@@ -1089,6 +1269,7 @@ class Consult extends BaseController
                 $price = GoodPrice($god, $budget/100);
             }
             $value['sale_price'] =round($price,2);
+            $value['bargain_status']=$bidinfo['bargain_status'];
             $data[]=$value;
         }
         return app_show(0,"获取成功",$data);

+ 4 - 3
app/admin/controller/Good.php

@@ -610,9 +610,10 @@ class Good extends \app\BaseController
         if($paltcode!=""){
             $where[]=["platform_code","=",$paltcode];
         }
-        $company_id = isset($this->post["company_id"])&& $this->post["company_id"]!=""? trim($this->post["company_id"]):"";
-        if($company_id!=""){
-            $where[]=["company_id","=",$company_id];
+        $companyNo = isset($this->post["companyNo"])&& $this->post["companyNo"]!=""? trim($this->post["companyNo"])
+            :"";
+        if($companyNo!=""){
+            $where[]=["companyNo","like","%$companyNo%"];
         }
 
         $cat_id = isset($this->post["cat_id"])&& $this->post["cat_id"]!==""? intval($this->post["cat_id"]):"";

+ 34 - 3
app/admin/controller/Project.php

@@ -5,13 +5,12 @@ namespace app\admin\controller;
 use think\App;
 use think\facade\Db;
 
-class Project extends \app\BaseController
+class Project extends Base
 {
-    private $post=[];
+
     public function __construct(App $app)
     {
         parent::__construct($app);
-        $this->post=$this->request->post();
     }
     public function create(){
         $name = isset($this->post['name'])&&$this->post['name']!=""? trim($this->post['name']):"";
@@ -146,6 +145,11 @@ class Project extends \app\BaseController
             if(empty($good)){
                 return error_show(1004,"未找到商品信息");
             }
+        }else{
+            $good=Db::name("consoult_bids")->where(["spuCode"=>$spuCode,"is_del"=>0])->select()->toArray();
+            if(empty($good)){
+                return error_show(1004,"未找到商品信息");
+            }
         }
         $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
         if($token==''){
@@ -307,7 +311,18 @@ class Project extends \app\BaseController
                 array_walk($feedback,function (&$v){
                     $v["cat_info"]=isset($v['cat_id'])? made($v['cat_id'],[]):[];
                 });
+//                $zx = Db::name("consult_info")->where(["pgNo"=>$value["pgNo"],"is_del"=>0,"bargain_status"=>0])
+//                    ->column("infoNo");
+//                if(!empty($zx)){
+//                    $zxback = Db::name("consult_bids")->where(["infoNo"=>$zx,"is_del"=>0])->select()->toArray();
+//                    array_walk($zxback,function (&$v){
+//                        $v["cat_info"]=isset($v['cat_id'])? made($v['cat_id'],[]):[];
+//                    });
+//                }else{
+//                    $zxback=[];
+//                }
                 $value['feedback']=$feedback;
+               // $value['zxback']=$zxback;
                 $info['ladder'][]=$value;
             }
         }
@@ -616,4 +631,20 @@ class Project extends \app\BaseController
         }
     }
 
+    public function  feeddel(){
+        $feedid = isset($this->post['id'])&&!empty($this->post['id']) ? $this->post['id'] :[];
+        if(empty($feedid)){
+            return error_show(1004,"参数feedid不能为空");
+        }
+        $selec = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0])->select();
+        if(empty($selec)){
+            return error_show(1004,"反馈数据信息未找到");
+        }
+        $up = Db::name("project_feedback")->where(["id"=>$feedid,'is_del'=>0])->save(["is_del"=>1,"updatetime"=>date("Y-m-d H:i:s")]);
+        if($up){
+            return app_show(0,"反馈数据删除成功");
+        }else{
+            return error_show(1004,"反馈数据删除失败");
+        }
+    }
 }

+ 3 - 2
app/admin/controller/Sale.php

@@ -1690,6 +1690,7 @@ class Sale extends BaseController
        if($outinfo==false){
            return error_show(1004,"发货数据未找到");
        }
+
        $post_name = isset($this->post['post_name']) &&$this->post['post_name']!="" ? trim($this->post['post_name']):"";
        if($post_name==""){
            return error_show(1004,"参数post_name不能为空");
@@ -1698,8 +1699,7 @@ class Sale extends BaseController
         if($post_code==""){
             return error_show(1004,"参数post_code不能为空");
         }
-        $post_fee = isset($this->post['post_fee']) && $this->post['post_fee']!="" ? floatval($this->post['post_fee'])
-            :"";
+        $post_fee = isset($this->post['post_fee']) && $this->post['post_fee']!="" ? floatval($this->post['post_fee']):"";
         $outinfo['post_name'] = $post_name;
         $outinfo['post_code'] = $post_code;
         $outinfo['post_fee'] = $post_fee;
@@ -1708,6 +1708,7 @@ class Sale extends BaseController
         $outinfo['updatetime'] = date("Y-m-d H:i:s");
         $up =Db::name("order_out")->save($outinfo);
         if($up){
+
             return app_show(0,"发货成功");
         }else{
             return error_show(1004,"发货失败");

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

@@ -412,6 +412,8 @@ Route::rule('consultfeededit','admin/Consult/feededit');
 Route::rule('consultfeedlist','admin/Consult/feedlist');
 Route::rule('bragainstatus','admin/Consult/bargain_status');
 Route::rule('bragaininfo','admin/Consult/bargain_info');
+Route::rule('zxedit','admin/Consult/zxedit');
+
 
 Route::rule('supplercreate','admin/Suppler/create');
 Route::rule('supplerlist','admin/Suppler/list');
@@ -432,4 +434,5 @@ Route::rule("projectplan","admin/Project/project_plan");
 Route::rule("projectfeeddheck","admin/Project/feedCheck");
 Route::rule("plandheck","admin/Project/planCheck");
 Route::rule("projectrate","admin/Project/changeRate");
+Route::rule("projectfeeddel","admin/Project/feeddel");