init: 项目初始代码
This commit is contained in:
40
app/index/model/Platform.php
Normal file
40
app/index/model/Platform.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace app\index\model;
|
||||
|
||||
/**
|
||||
* 平台模型
|
||||
* @mixin \think\Model
|
||||
*/
|
||||
class Platform extends BaseModel
|
||||
{
|
||||
protected $schema = [
|
||||
'id' => 'int',
|
||||
'vi_color1' => 'string',
|
||||
'vi_color2' => 'string',
|
||||
'vi_color3' => 'string',
|
||||
'language_id' => 'int',
|
||||
'coin_id' => 'int',
|
||||
'name' => 'string',
|
||||
'desc' => 'string',
|
||||
'icon' => 'string',
|
||||
'sort' => 'int',
|
||||
'status' => 'int',
|
||||
'create_time' => 'int',
|
||||
'update_time' => 'int',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param string $platformName
|
||||
* @return int
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function getPlatformId(string $platformName):int
|
||||
{
|
||||
$result = $this->where('name',$platformName)->find();
|
||||
return $result ? $result->id : 0;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user