wugg 11 months ago
parent
commit
ab7c0d9e33
3 changed files with 18 additions and 2 deletions
  1. 3 1
      app/admin/model/CgdCaixiao.php
  2. 14 0
      app/admin/model/OriginCgd.php
  3. 1 1
      app/command/caixiao.php

+ 3 - 1
app/admin/model/CgdCaixiao.php

@@ -10,5 +10,7 @@ use think\Model;
  */
 class CgdCaixiao extends Model
 {
-    //
+    public function OriginCgd(){
+    	return $this->belongsTo(OriginCgd::class,"cgdNo","newCode")->bind(["mainCode"=>"oldCode"]);
+    }
 }

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

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

+ 1 - 1
app/command/caixiao.php

@@ -14,7 +14,7 @@ class caixiao extends Command
     protected function cgd(){
     	$cgd=new CgdCaixiao();
     	$where=[['updatetime','>=',$this->hour]];
-    	$list = $cgd->where($where)->cursor();
+    	$list = $cgd->with(["originCgd"])->where($where)->cursor();
     	$cgdArr=[];
     	foreach ($list as $item){
     		$unique = md5($item->cgdNo.$item->updatetime);