diff --git a/admin/controllers/base/ChargeCashController.php b/admin/controllers/base/ChargeCashController.php index 86e1569..f068b03 100644 --- a/admin/controllers/base/ChargeCashController.php +++ b/admin/controllers/base/ChargeCashController.php @@ -37,7 +37,7 @@ class ChargeCashController extends BaseAdminController } - $query->with(['store'])->orderBy(['id' => SORT_DESC]); + $query->with(['store', 'supplier'])->orderBy(['id' => SORT_DESC]); $this->field = [ ChargeCashPayRecord::class => [ 'id', @@ -46,7 +46,9 @@ class ChargeCashController extends BaseAdminController 'charge_cash', 'type', 'status', - 'store', + 'store' => function ($query) { + return empty($query->store)? $query->supplier: $query->store; + }, 'created_at' => function ($le) { return date('Y-m-d H:i:s', $le->created_at); } diff --git a/common/models/newDb/CardModel.php b/common/models/newDb/CardModel.php new file mode 100644 index 0000000..335aebd --- /dev/null +++ b/common/models/newDb/CardModel.php @@ -0,0 +1,19 @@ + TimestampBehavior::class, + 'attributes' => [ + ], + ], + ]; + } +} \ No newline at end of file diff --git a/common/models/newDb/SupplierModel.php b/common/models/newDb/SupplierModel.php index 7f366d1..86ed5bf 100644 --- a/common/models/newDb/SupplierModel.php +++ b/common/models/newDb/SupplierModel.php @@ -16,4 +16,9 @@ class SupplierModel extends \common\modelsgii\newDb\SupplierModelGii ], ]; } + + public function getCard() + { + return $this->hasOne(CardModel::class, ['user_id' => 'id']); + } } \ No newline at end of file diff --git a/common/models/oldDb/ChargeCashPayRecord.php b/common/models/oldDb/ChargeCashPayRecord.php index 71f0684..06b893e 100644 --- a/common/models/oldDb/ChargeCashPayRecord.php +++ b/common/models/oldDb/ChargeCashPayRecord.php @@ -2,6 +2,7 @@ namespace common\models\oldDb; +use common\models\newDb\SupplierModel; use yii\behaviors\TimestampBehavior; use yii\db\ActiveRecord; @@ -27,4 +28,9 @@ class ChargeCashPayRecord extends \common\modelsgii\oldDb\ChargeCashPayRecord { return $this->hasOne(Store::class, ['id'=>'store_id']); } + + public function getSupplier() + { + return $this->hasOne(SupplierModel::class, ['id'=>'store_id']); + } } \ No newline at end of file diff --git a/common/modelsgii/newDb/CardModelGii.php b/common/modelsgii/newDb/CardModelGii.php new file mode 100644 index 0000000..9dbd625 --- /dev/null +++ b/common/modelsgii/newDb/CardModelGii.php @@ -0,0 +1,49 @@ +