feat: spu
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace App\Model;
|
||||
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
use Hyperf\Tappable\HigherOrderTapProxy;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -34,4 +35,13 @@ class Category extends Model
|
||||
|
||||
const string UPDATED_AT = 'update_time';
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return HigherOrderTapProxy|mixed|null
|
||||
*/
|
||||
public function getNameById(int $id): mixed
|
||||
{
|
||||
return $this->where('id', $id)->value('name');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace App\Model;
|
||||
use App\Constants\Admin\UserCode;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
use Hyperf\Tappable\HigherOrderTapProxy;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -56,4 +57,13 @@ class Chef extends Model
|
||||
return $this->where('is_del',UserCode::IS_NO_DEL)->where('user_id', $userId)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return HigherOrderTapProxy|mixed|null
|
||||
*/
|
||||
public function getChineseNameById(int $id): mixed
|
||||
{
|
||||
return $this->leftJoin('admin_user', 'admin_user.id', '=', 'chef.user_id')->where('admin_user.id', $id)->value('admin.chinese_name');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace App\Model;
|
||||
use App\Constants\Common\SiteCode;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
use Hyperf\Tappable\HigherOrderTapProxy;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -52,6 +53,15 @@ class Kitchen extends Model
|
||||
return $this->where('name', $name)->where('is_del',SiteCode::KITCHEN_NO_DEL)->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return HigherOrderTapProxy|mixed|null
|
||||
*/
|
||||
public function getNameById(int $id)
|
||||
{
|
||||
return $this->where('id', $id)->value('name');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return \Hyperf\Database\Model\Model|Builder|null
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace App\Model;
|
||||
use App\Constants\Common\CityCode;
|
||||
use Hyperf\Database\Model\Builder;
|
||||
use Hyperf\DbConnection\Model\Model;
|
||||
use Hyperf\Tappable\HigherOrderTapProxy;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -68,6 +69,15 @@ class SystemCity extends Model
|
||||
return $this->whereIn('id',$ids)->pluck('title','id')->toArray();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $id
|
||||
* @return HigherOrderTapProxy|mixed|null
|
||||
*/
|
||||
public function getCityNameById(int $id)
|
||||
{
|
||||
return $this->where('id',$id)->where('is_del',CityCode::IS_NOT_DELETE)->value('title');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有数据
|
||||
* @param array $ids
|
||||
|
||||
Reference in New Issue
Block a user