// +---------------------------------------------------------------------- namespace app\common\model\system\financial; use app\common\model\BaseModel; use app\common\model\system\admin\Admin; use app\common\model\system\merchant\Merchant; use app\common\model\system\merchant\MerchantAdmin; use think\facade\Db; class Financial extends BaseModel { public static function tablePk(): ?string { return 'financial_id'; } public static function tableName(): string { return 'financial'; } public function merchant() { return $this->hasOne(Merchant::class,'mer_id','mer_id'); } public function getFinancialAccountAttr($value) { return json_decode($value); } public function getImageAttr($value) { return explode(',',$value); } public function getAdminIdAttr($value) { return Admin::where('admin_id',$value)->value('real_name'); } public function getMerAdminIdAttr($value) { return MerchantAdmin::where('merchant_admin_id',$value)->value('real_name'); } public function searchFinancialIdAttr($query,$value) { $query->where('financial_id',$value); } public function searchMerIdAttr($query,$value) { $query->where('mer_id',$value); } public function searchStatusAttr($query,$value) { $query->where('status',$value); } public function searchFinancailStatusAttr($query,$value) { $query->where('financial_status',$value); } public function searchFinancailTypeAttr($query,$value) { $query->where('financial_type',$value); } public function searchKeywordsAttr($query,$value) { $query->whereLike('keywords',"%{$value}%"); } public function searchDateAttr($query,$value) { getModelTime($query,$value); } public function searchIsDelAttr($query,$value) { $query->where('is_del',$value); } }