初始化项目

This commit is contained in:
2026-09-01 22:15:50 +08:00
commit b5a26a8848
11217 changed files with 1710987 additions and 0 deletions
+84
View File
@@ -0,0 +1,84 @@
<?php
declare (strict_types=1);
namespace app\common\model;
use cores\BaseModel;
/**
* 银行账户模型
* Class Bank
* @package app\common\model
*/
class Bank extends BaseModel
{
protected $name = 'bank';
/**
* 关联管理员分类表
* @return \think\model\relation\BelongsTo
*/
public function admin()
{
return $this->belongsTo('app\common\model\store\User','store_user_id','store_user_id');
}
/**
* 获取银行账户列表
* @param int $status
* @param string $search_name
* @param string $sortType
* @param bool $sortPrice
* @param int $listRows
* @param array $power
* @return \think\Paginator
* @throws \think\exception\DbException
*/
public function getList($status = null, $search_name = '', $sortType = 'all', $sortPrice = false, $listRows = 15, $power = [])
{
// 筛选条件
$filter = [];
// 商品表名称
$status > 0 && $this->where('status', '=', $status);
!empty($power) && $this->where('store_user_id', 'in', $power);
!empty($search_name) && $this->where('name', 'like', "%$search_name%");
$r = $this->with(['admin'])
->order(['create_time' => 'desc'])
->paginate(15, false, [
'query' => \request()->request()
]);
return $r;
}
/**
* 关联供货商图片表
* @return \think\model\relation\HasMany
*/
public function image()
{
return $this->hasMany('SupplierImage')->order(['id' => 'asc']);
}
/**
* 银行账户详情
* @param $bank_id
* @return null|static
* @throws \think\exception\DbException
*/
public static function detail($bank_id)
{
return self::get($bank_id);
}
/*public static function detail($supplier_id)
{
$model = new static;
return $model->with([
'image.file'
])->where('supplier_id', '=', $supplier_id)->find();
}*/
/**
* 获取全部
* @return mixed
*/
public static function getAll()
{
$model = new static;
return $model->order(['bank_id' => 'asc'])->select();
}
}