Bläddra i källkod

Merge branch 'master-new-wgg' of wugg/phpstock into master-new

wugg 1 år sedan
förälder
incheckning
d4666b4458

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

@@ -303,7 +303,6 @@ class Base extends \app\BaseController
         $newAdd = Db::name("good_change_log")->insert($log);
         if ($newAdd == false) throw new \Exception("非库存商品转库存失败", 1005);
         return $spuCode;
-
     }
 
 }

+ 3 - 22
app/admin/controller/Brand.php

@@ -20,14 +20,10 @@ class Brand extends Base
         if($brand_name==""){
             return error_show(1002,"参数brand_name不能为空");
         }
-
         $brandisT=Db::name("brand")->where(["brand_name"=>$brand_name,"is_del"=>0])->findOrEmpty();
         if(!empty($brandisT))return error_show(1002,"品牌名称已存在");
 
         $logo_url= isset($this->post['logo_url'])  && $this->post['logo_url'] !=="" ? trim($this->post['logo_url']):"";
-//        if($logo_url==""){
-//            return error_show(1002,"参数logo_url不能为空");
-//        }
         $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
         if($token==''){
             return error_show(105,"参数token不能为空");
@@ -86,13 +82,9 @@ class Brand extends Base
         }
         $supplierNo = isset($this->post['supplierNo']) && $this->post['supplierNo'] != "" ? trim($this->post['supplierNo']) : "";
         if($supplierNo!=""){
-//            $gyscode = Db::name("supplier")->where(["code"=>$supplierNo])->find();
-//            if(empty($gyscode)){
-//                return error_show(1004,"未找到供应商信息");
-//            }
-        $wsmcode = Db::name("brand_book")->where(["gyscode" => $supplierNo, "is_del" => 0])->column("brand_id");
-        $where[] = ['b.id', "in", $wsmcode];
-    }
+	        $wsmcode = Db::name("brand_book")->where(["gyscode" => $supplierNo, "is_del" => 0])->column("brand_id");
+	        $where[] = ['b.id', "in", $wsmcode];
+        }
         $company_name = isset($this->post['company_name']) && $this->post['company_name'] !== "" ? trim($this->post['company_name']) : "";
         if ($company_name !== "") $where[] = ["b.createrid", 'in', get_company_item_user_by_name($company_name)];
 
@@ -139,16 +131,6 @@ class Brand extends Base
         ->findOrEmpty();
         if(!empty($brandisT))return error_show(1002,"品牌名称已存在");
         $logo_url= isset($this->post['logo_url'])  && $this->post['logo_url'] !=="" ? trim($this->post['logo_url']):"";
-//        $token = isset($this->post['token'])&& $this->post['token']!='' ? trim($this->post['token']):"";
-//        if($token==''){
-//            return error_show(105,"参数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'] : "";
         $status = isset($this->post['status']) &&$this->post['status'] !==""? intval($this->post['status']):"0";
 
         $data=[
@@ -220,7 +202,6 @@ class Brand extends Base
             ->alias('a')
             ->field("b.logo_url,b.brand_name")
             ->join("brand b","a.brand_id=b.id")
-//            ->join("supplier c","c.code= a.gyscode","left")
             ->field("a.creater,a.addtime,a.gyscode")//c.name,c.status
             ->where(['brand_id'=>$info['id']])
             ->findOrEmpty();

+ 14 - 0
app/admin/model/Brand.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class Brand extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/Cat.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class Cat extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/GoodExam.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class GoodExam extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/GoodLadder.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class GoodLadder extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/GoodNake.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class GoodNake extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/GoodOffineLog.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class GoodOffineLog extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/GoodPlatform.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class GoodPlatform extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/GoodProof.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class GoodProof extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/Platform.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class Platform extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/PlatformYouzan.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class PlatformYouzan extends Model
+{
+    //
+}

+ 14 - 0
app/admin/model/Unit.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\admin\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class Unit extends Model
+{
+    //
+}

+ 56 - 0
app/bbc/controller/Base.php

@@ -0,0 +1,56 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\bbc\controller;
+
+use think\App;
+use think\exception\HttpResponseException;
+use think\Response;
+
+class Base extends \app\admin\controller\Base
+{
+  public function __construct(App $app) {parent::__construct($app);}
+  
+   /**
+	* @param string $message
+	* @param int $code
+	* @param null $data
+	 */
+    public function error($message='',$code=1003,$data=null){
+        $this->result($message,$data,$code);
+    }
+    /**
+	* @param string $message
+	* @param int $code
+	* @param null $data
+	 */
+     public function success($message='',$data=null,$code=0){
+        $this->result($message,$data,$code);
+    }
+    
+     /**
+	* @param string $msg
+	* @param null $data
+	* @param int $code
+	* @param string|null $type
+	* @param array $header
+	* @param array $options
+	 */
+    private function result(string $msg, $data = null, int $code = 0, string $type = "json", array $header = [], array
+    $options = [])
+    {
+        $result = [
+            'code' => $code,
+            'message'  => $msg,
+            'data' => $data,
+        ];
+        $code = 200;
+        if (isset($header['statuscode'])) {
+            $code = $header['statuscode'];
+            unset($header['statuscode']);
+        }
+
+        $response = Response::create($result, $type, $code)->header($header)->options($options);
+         throw new HttpResponseException($response);
+    }
+}

+ 231 - 0
app/bbc/controller/Good.php

@@ -0,0 +1,231 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\bbc\controller;
+
+use app\admin\model\GoodBasic;use app\admin\model\GoodExam;use app\admin\model\GoodLadder;use app\admin\model\GoodNake;use app\admin\model\GoodPlatform;use app\admin\model\GoodProof;use app\admin\model\Platform;use app\admin\model\PlatformYouzan;use app\model\AccountItem;use app\youzan\model\Account;use think\App;use think\Exception;use thinkException;use think\facade\Validate;
+
+class Good extends Base
+{
+   public function __construct(App $app) {parent::__construct($app);}
+   
+   public function list(){
+   	 $param = $this->request->only([
+        	'page' => 1,
+            'size' => 15,
+            'cat_id' => '',
+            'good_name' => '',
+            'skucode' => '',
+            'spucode' => '',
+            'start' => '',
+            'end' => '',
+            'is_stock' => '',
+            'good_type' => '',
+            'supplierNo' => '',
+            'companyNo' => '',
+            'creater' => '',
+            'online_creater' => '',
+            'createrid' => '',
+            'status' => '',
+            'platform_code' => '',
+            'platform_type' => 2,
+            'plat_code' => '',
+            'exam_status' => '',
+            'brand_id' => '',
+            'company_name' => '',
+            'create_source' => '',
+            'is_compliance' => '',
+            'relaComNo' => '',
+            ],'post','trim');
+        
+         $where = [['b.is_del', '=', 0]];
+         $platfrom =new Platform();
+        if ($param['cat_id'] !== '') $where[] = ['a.cat_id', '=', $param['cat_id']];
+        if ($param['good_name'] !== '') $where[] = ['a.good_name', 'like', '%' . $param['good_name'] . '%'];
+        if ($param['skucode'] !== '') $where [] = ['b.skucode', 'like', '%' . $param['skucode'] . '%'];
+        if ($param['spucode'] !== '') $where [] = ['b.spucode', 'like', '%' . $param['spucode'] . '%'];
+        if ($param['start'] !== '') $where[] = ['b.addtime', '>=', date('Y-m-d H:i:s', strtotime($param['start']))];
+        if ($param['end'] !== '') $where[] = ['b.addtime', '<', date('Y-m-d H:i:s', strtotime($param['end']) + 24 * 3600)];
+        if ($param['is_stock'] !== '') $where[] = ['a.is_stock', '=', $param['is_stock']];
+        if ($param['good_type'] !== '') $where[] = ['a.good_type', '=', $param['good_type']];
+        if ($param['supplierNo'] !== '') $where[] = ['a.supplierNo', '=', $param['supplierNo']];
+        if ($param['companyNo'] !== '') $where[] = ['a.companyNo', 'like', '%' . $param['companyNo'] . '%'];
+        if ($param['online_creater'] !== '') $where[] = ['b.creater', 'like', '%' . $param['online_creater'] . '%'];
+        if ($param['creater'] !== '') $where[] = ['a.creater', 'like', '%' . $param['creater'] . '%'];
+        if ($param['createrid'] !== '') $where[] = ['a.createrid', '=', $param['createrid']];
+        if ($param['status'] !== '') $where[] = ['a.status', '=', $param['status']];
+        if ($param['platform_code'] !== '') $where[] = ['b.platform_code', '=', $param['platform_code']];
+        if ($param['plat_code'] !== '') $where[] = ['b.plat_code', 'like', '%' . $param['plat_code'] . '%'];
+        if ($param['exam_status'] !== '') $where[] = ['b.exam_status', '=', $param['exam_status']];
+        if ($param['create_source'] !== '') $where[] = ['a.create_source', '=', $param['create_source']];
+        if ($param['is_compliance'] !== '') $where[] = ['b.is_compliance', '=', $param['is_compliance']];
+        if ($param['brand_id'] !== '') $where[] = ['a.brand_id', '=', $param['brand_id']];
+        if($param['platform_type'] !== ''){
+            $platfromId = $platfrom->where(['platform_type'=>$param['platform_type'],'is_del'=>0])->column('id');
+            $where[] = ['b.platform_code', 'in', $platfromId ];
+        }
+         if($param['relaComNo'] !== '') $where[]=['a.companyNo|a.supplierNo','=', $param['relaComNo']];
+         $list = (new GoodPlatform()) ->alias('b')
+            ->leftJoin('good a', 'a.spuCode=b.spuCode')
+            ->field('b.skuCode,b.platform_code,b.plat_code,b.id as good_id,a.cat_id,a.good_name,a.good_img,b.is_fixed,
+            a.good_info_img,a.good_thumb_img,b.createrid,a.is_exclusive,a.brand_id,a.supplierNo,a.supplierName,a.create_source,
+            a.good_unit,a.noble_metal,a.companyNo,a.companyName,a.spuCode,a.good_type,b.creater,b.addtime,b.updatetime,
+            b.exam_status,a.createrid purchase_id,a.creater purchase,a.is_stock,b.is_compliance,b.compliance_remark')
+            ->where($where)->order('b.id desc')->paginate(['page'=>$param['page'],'list_rows'=>$param['size']]);
+         $cat =new \app\admin\model\Cat();
+         $Brand =new \app\admin\model\Brand();
+         $unit =new \app\admin\model\Unit();
+         $account = new AccountItem();
+         foreach ($list->items() as $item){
+         	$catinfo= $cat->where(['id'=>$item['cat_id']])->value('search','');
+            $item['cat_info'] =explode('_',$catinfo);
+            $item['brand_name'] =$Brand->where(['id'=>$item['brand_id']])->value('brand_name','');
+//            $item['unit'] =$unit->where(['id'=>$item['good_unit']])->value('unit','');
+            $item['platform_name'] =$platfrom->where(['id'=>$item['platform_code']])->value('platform_name','');
+//            $item['exclusive'] = makeExcluse($item['is_exclusive']);
+            $item['company_name'] =$account->alias('a')->leftJoin('company_item b','a.itemid=b.id')
+            ->where('a.account_id',$item['createrid'])->value('b.name');
+         }
+      $this->success("获取成功", ['list' => $list->items(), 'count' => $list->total()]);
+   }
+   
+   
+    //审核
+    public function exam(){
+    	$post =$this->request->only([
+    		'skuCode'=>'',          //商品成本编号
+    		'exam_status'=>'',      //审核状态 1 提交待完善成本 2待审核 3上线完成 4 审核驳回 5 下线完成 6 待bbc上线补录bbc编号 7 bbc驳回
+    		'offline_reason'=>'',   //下线原因
+    		'offline_remark'=>'',   //下线备注
+    		'plat_code'=>'',        //平台订单号
+    		'exam_remark'=>'',      //审核备注
+    		'good_ladder'=>[],      //售价阶梯
+    		'proof_type'=>'',       // 售价凭证类型
+    		'proof_url'=>'',       // 售价凭证
+    		],'post','trim');
+    	$valide = Validate::rule([
+    		'skuCode|商品编号'=>'require|max:255',
+    		'exam_status|审核状态'=>'require|number|in:0,1,2,3,4,5,6,7',
+    		'offline_reason|线下原因'=>'requireIf:exam_status,5|max:255',
+    		'offline_remark|下线备注'=>'requireIf:exam_status,5|max:255',
+    		'plat_code|平台商品编码'=>'requireIf:exam_status,3|max:255',
+    		'exam_remark|审核备注'=>'max:255',
+    		'good_ladder|售价阶梯'=>'requireIf:exam_status,3|array',
+    		'proof_type|售价凭证类型'=>'requireIf:exam_status,3|number|gt:0',
+    		'proof_url|售价凭证'=>'requireIf:exam_status,3|max:255',
+    		]);
+		if($valide->check($post)==false) $this->error($valide->getError());
+		$goodPlat = new GoodPlatform();
+		$goodNake = new GoodNake();
+        $platform = $goodPlat->where(['skuCode'=>$post['skuCode'],'is_del'=>0])->findOrEmpty();
+        if($platform->isEmpty()) $this->error('未找到商品数据');
+        
+         if($platform->is_fixed==1){
+        	//使用实时金价
+        	 $nake=$goodNake->where(['spuCode'=> $platform->spuCode,'is_del'=>0,'nake_fee'=>0])
+        	 ->findOrEmpty();
+        	 if($nake->isEmpty()) $this->error('一口价商品请先完善商品成本单价');
+        }
+        if($post['exam_status']==3){
+            $is_exit = $goodPlat
+                ->where(['plat_code' =>$post['plat_code'],'is_del' =>0, 'exam_status' =>3])//bbc商品编号唯一不可重复
+                ->where('id', '<>', $platform['id'])
+                ->findOrEmpty();
+            if($is_exit->isEmpty()) $platform->plat_code=$post['plat_code'];
+            else  $this->error("平台商品编码 {$post['plat_code']} 已存在");
+        }
+          if($post['exam_status']==5){
+	            $platform->is_compliance=0;
+	            $platform->compliance_remark='';
+          }
+         $before= $platform['exam_status'];
+        $platform->exam_status=$post['exam_status'];
+        $platform->updatetime=date('Y-m-d H:i:s');
+        $createrid= $this->uid;
+        $creater= $this->uname;
+        $platform->startTrans();
+        try {
+            $up = $platform->save();
+            if($up){
+                $data=[
+                    'code'=>$platform->skuCode,
+                    'exam_status'=>$post['exam_status'],//$exam_status,
+                    'type'=>2,
+                    'exam_id'=>$createrid,
+                    'exam_name'=>$creater,
+                    'exam_remark'=>$post['exam_remark'],
+                    'addtime'=>date('Y-m-d H:i:s')
+                ];
+                $inr=(new GoodExam())->save($data);
+                if($inr){
+                    if ($post['exam_status'] == 3) {
+                    	//todo::需要去掉;
+                    	if($post['proof_url']!=''){
+                    		$proof=[
+		                    'spuCode'=>$platform->spuCode,
+		                    'proof_type'=>$post['proof_type'],
+		                    'proof_url'=>$post['proof_url'],
+		                    'is_del'=>0,
+		                    'creater'=>$this->uname,
+		                    'createrid'=>$this->uid,
+		                    'addtime'=>date('Y-m-d H:i:s'),
+		                    'updatetime'=>date('Y-m-d H:i:s')
+		                    ];
+		                    GoodProof::create($proof);
+                    	}
+                    	
+		                if(empty($post['good_ladder']))throw new Exception('商品阶梯价不能为空');
+		                $goodLadder =new GoodLadder();
+		                $saveArr=[];
+		                foreach ($post['good_ladder'] as $value){
+		                	    $lemp=[];
+				                isset($value['id'])?$lemp['id']=$value['id']:$lemp['addtime'] = date('Y-m-d H:i:s');
+				                $lemp['skuCode']=$platform->spuCode;
+				                $lemp['min_num'] = $value['min_num'];
+				                $lemp['max_num'] = 0;
+				                $lemp['sale_price'] = $value['sale_price'];
+				                $lemp['market_price'] = $value['market_price'];
+				                $lemp['market_platform'] = $value['market_platform'];
+				                $lemp['cost_fee'] = $value['cost_fee'];
+				                $lemp['is_del'] = isset($value['is_del'])?$value['is_del']:0;
+                                $lemp['updatetime'] =date('Y-m-d H:i:s');
+                                $saveArr[]=$lemp;
+		                }
+		                $ladderUp = $goodLadder->saveAll($saveArr);
+		                if($ladderUp==false) throw new Exception('商品阶梯价录入失败');
+                    }
+                   
+                }else throw new Exception('商品审核失败');
+            }else throw new Exception('商品审核失败');
+                    $platform->commit();
+                    //流程记录
+                    $event=[ 'order_type' => 'SPSX',
+                        'order_code' =>$platform->skuCode,//咨询单详情编号
+                        'order_id' => $platform->id,
+                        'order_status' => 2,
+                        'action_process' =>$post['exam_status'],
+                        'action_status' => $before,
+                        'action_uid' => $this->uid,
+                        'action_name' => $this->uname,
+                        ];
+                   event('ProcessOrder',$event);
+                   if($post['exam_status']==5){
+                   	//下线记录
+                   	$enevt=[
+                   		    'spuCode' => $platform->spuCode,
+                            'skuCodes' => $platform->skuCode,
+                            'good_name' => (new GoodBasic())->where('spuCode',$platform->spuCode)->value('good_name', ''),
+                            'offline_reason' => $post['offline_reason'],
+                            'offline_remark' => $post['offline_remark'],
+                            'createrid' => $createrid,
+                            'creater' => $creater,
+						];
+                   	event('goodOff',$enevt);
+                   }
+                   $this->success('商品审核成功');
+        }catch (Exception $e){
+            $platform->rollback();
+            $this->error($e->getMessage().$e->getLine().$e->getFile());
+        }
+    }
+}

+ 8 - 0
app/bbc/event/GoodOffineLog.php

@@ -0,0 +1,8 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\bbc\event;
+
+class GoodOffineLog
+{
+}

+ 8 - 0
app/bbc/event/ProcessOrder.php

@@ -0,0 +1,8 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\bbc\event;
+
+class ProcessOrder
+{
+}

+ 18 - 0
app/bbc/listener/GoodOffine.php

@@ -0,0 +1,18 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\bbc\listener;
+
+use app\admin\model\GoodOffineLog;
+class GoodOffine
+{
+    /**
+     * 事件监听处理
+     *
+     * @return mixed
+     */
+    public function handle($event)
+    {
+       GoodOffineLog::create($event);
+    }
+}

+ 18 - 0
app/bbc/listener/ProcessOrder.php

@@ -0,0 +1,18 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\bbc\listener;
+
+class ProcessOrder
+{
+    /**
+     * 事件监听处理
+     *
+     * @return mixed
+     */
+    public function handle($event)
+    {
+       
+       \app\admin\model\ProcessOrder::create($event);
+    }
+}

+ 7 - 0
app/bbc/route/app.php

@@ -0,0 +1,7 @@
+<?php
+
+use think\facade\Route;
+
+route::rule('goodList', 'bbc/Good/list');
+route::rule('goodExam', 'bbc/Good/exam');
+

+ 4 - 0
app/event.php

@@ -2,6 +2,8 @@
 // 事件定义文件
 return [
     'bind'      => [
+//    	"GoodOff"=>\app\bbc\event\GoodOffineLog::class,
+//    	"ProcessOrder"=>\app\bbc\event\ProcessOrder::class
     ],
 
     'listen'    => [
@@ -10,6 +12,8 @@ return [
         'HttpEnd'  => [],
         'LogLevel' => [],
         'LogWrite' => [],
+        'ProcessOrder' => [\app\bbc\listener\ProcessOrder::class],
+        'GoodOff' => [\app\bbc\listener\GoodOffine::class],
     ],
 
     'subscribe' => [

+ 1 - 1
app/report/controller/Stats.php

@@ -345,7 +345,7 @@ class Stats extends Base
 				    }
 				    )
 	            ->select();
-				if($list->isEmpty())$noArr['result'][$start]['total_price']==0;
+				if($list->isEmpty())$noArr['result'][$start]=['total_price'=>0];
 				else{
 					$total =strval(array_sum(array_column($list->toArray() , 'total_price')));
 					$before_th =strval(array_sum(array_column($list->toArray() , 'before_th')));

+ 77 - 3
app/youzan/controller/Index.php

@@ -3,11 +3,11 @@
 namespace app\youzan\controller;
 
 use app\admin\controller\Base;
-use app\youzan\logic\Cat;
+use app\admin\model\Platform;use app\admin\model\PlatformYouzan;use app\youzan\logic\Cat;
 use app\youzan\logic\Order;
 use app\youzan\logic\Tag;
 use app\youzan\logic\Goodup;
-use think\facade\Validate;
+use app\youzan\model\Account;use think\facade\Validate;
 
 //有赞对接类
 class Index extends Base
@@ -253,5 +253,79 @@ class Index extends Base
         } else return error_show(1005, $val->getError());
 
     }
-
+    
+    public function goodList(){
+        $param = $this->request->only([
+        	'page' => 1,
+            'size' => 15,
+            'cat_id' => '',
+            'good_name' => '',
+            'skucode' => '',
+            'spucode' => '',
+            'start' => '',
+            'end' => '',
+            'is_stock' => '',
+            'good_type' => '',
+            'supplierNo' => '',
+            'companyNo' => '',
+            'creater' => '',
+            'online_creater' => '',
+            'createrid' => '',
+            'status' => '',
+            'platform_code' => '',
+            'platform_type' => 1,
+            'plat_code' => '',
+            'exam_status' => '',
+            'brand_id' => '',
+            'company_name' => '',
+            'relaComNo' => '',
+            ],"post","trim");
+        
+         $where = [['b.is_del', '=', 0]];
+         $platfrom =new Platform();
+        if ($param['cat_id'] !== '') $where[] = ['a.cat_id', '=', $param['cat_id']];
+        if ($param['good_name'] !== '') $where[] = ['a.good_name', 'like', '%' . $param['good_name'] . '%'];
+        if ($param['skucode'] !== '') $where [] = ['b.skucode', 'like', '%' . $param['skucode'] . '%'];
+        if ($param['spucode'] !== '') $where [] = ['b.spucode', 'like', '%' . $param['spucode'] . '%'];
+        if ($param['start'] !== '') $where[] = ['b.addtime', '>=', date('Y-m-d H:i:s', strtotime($param['start']))];
+        if ($param['end'] !== '') $where[] = ['b.addtime', '<', date('Y-m-d H:i:s', strtotime($param['end']) + 24 * 3600)];
+        if ($param['is_stock'] !== '') $where[] = ['a.is_stock', '=', $param['is_stock']];
+        if ($param['good_type'] !== '') $where[] = ['a.good_type', '=', $param['good_type']];
+        if ($param['supplierNo'] !== '') $where[] = ['a.supplierNo', '=', $param['supplierNo']];
+        if ($param['companyNo'] !== '') $where[] = ['a.companyNo', 'like', '%' . $param['companyNo'] . '%'];
+        if ($param['online_creater'] !== '') $where[] = ['b.creater', 'like', '%' . $param['online_creater'] . '%'];
+        if ($param['creater'] !== '') $where[] = ['a.creater', 'like', '%' . $param['creater'] . '%'];
+        if ($param['createrid'] !== '') $where[] = ['a.createrid', '=', $param['createrid']];
+        if ($param['status'] !== '') $where[] = ['a.status', '=', $param['status']];
+        if ($param['platform_code'] !== '') $where[] = ['b.platform_id', '=', $param['platform_code']];
+        if ($param['plat_code'] !== '') $where[] = ['b.plat_code', 'like', '%' . $param['plat_code'] . '%'];
+        if ($param['exam_status'] !== '') $where[] = ['b.exam_status', '=', $param['exam_status']];
+        if ($param['brand_id'] !== '') $where[] = ['a.brand_id', '=', $param['brand_id']];
+        if($param['platform_type'] == ''){
+            $platfromId = $platfrom->where(["platform_type"=>$param['platform_type'],"is_del"=>0])->column("id");
+            $where[] = ['b.platform_id', 'in', $platfromId ];
+        }
+         if($param['relaComNo'] !== '') $where[]=['a.companyNo|a.supplierNo','=', $param['relaComNo']];
+         $list = (new PlatformYouzan()) ->alias('b')
+            ->leftJoin('good_basic a', 'a.spuCode=b.spuCode')
+            ->field("b.id,b.platform_id,b.plat_code,b.spuCode,b.skuCode,good_img,good_name,b.exam_status status,a.cat_id,a.good_unit,a.good_type,
+            a.is_exclusive,a.brand_id,a.companyNo,a.companyName company,b.creater,b.addtime,a.createrid purchase_id,a.creater purchase")
+            ->where($where)->order("id desc")->paginate(["page"=>$param['page'],"list_rows"=>$param['size']]);
+         $cat =new \app\admin\model\Cat();
+         $Brand =new \app\admin\model\Brand();
+         $unit =new \app\admin\model\Unit();
+         $account = new Account();
+         foreach ($list->items() as $item){
+         	$catinfo= $cat->where(['id'=>$item['cat_id']])->value('search','');
+            $item['cat_info'] =explode("_",$catinfo);
+            $item['brand_name'] =$Brand->where(["id"=>$item['brand_id']])->value("brand_name",'');
+            $item['unit'] =$unit->where(["id"=>$item['good_unit']])->value("unit",'');
+            $item['platform_name'] =$platfrom->where(["id"=>$item['platform_id']])->value("platform_name",'');
+            $item['exclusive'] = makeExcluse($item['is_exclusive']);
+            $item['is_allow_update'] = 0;
+            $item['company_name'] =$account->name("account_item")->alias("a")->leftJoin("company_item b","a.itemid=b.id")
+            ->where("a.account_id",$item['purchase_id'])->value("b.name");
+         }
+         return app_show(0, '获取成功', ['list' => $list->items(), 'count' => $list->total()]);
+    }
 }

+ 14 - 0
app/youzan/model/Account.php

@@ -0,0 +1,14 @@
+<?php
+declare (strict_types = 1);
+
+namespace app\youzan\model;
+
+use think\Model;
+
+/**
+ * @mixin \think\Model
+ */
+class Account extends Model
+{
+   protected $connection = 'mysql_sys';
+}

+ 2 - 0
app/youzan/route/app.php

@@ -12,6 +12,8 @@ route::rule('yz_goodoff', 'youzan/Index/youzanOffline');//将商品从有赞平
 route::rule('yz_goodoff_list', 'youzan/Index/youzanOfflineList');//有赞下线商品列表
 route::rule('yz_goodoff_detail', 'youzan/Index/youzanOfflineDetail');//有赞下线商品详情
 route::rule('yz_order_list', 'youzan/Index/getYzOrderList');//获取有赞订单列表
+
+route::rule('yz_good_list', 'youzan/Index/goodList');//获取有赞商品列表
 //route::rule('yz_check_handle_status', 'youzan/Index/checkHandleStatus');//处理有赞订单(确认或取消)
 route::rule('yz_get_update_good_log_by_yz', 'youzan/Index/getYzUpdateLog');//获取有赞平台修改商品日志,有赞平台
 route::rule('yz_get_update_good_log_by_caixiao', 'youzan/Index/getUpdateGoodLog');//获取修改商品日志,采销系统