chore: 重写初始提交(清空历史,整理后全量提交)
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | YwxApp [ WE CAN DO IT JUST THINK ]
|
||||
// +----------------------------------------------------------------------
|
||||
// | Copyright (c) 2026-2036 http://ywxapp.cn All rights reserved.
|
||||
// +----------------------------------------------------------------------
|
||||
// | Author: ywxapp<admin@ywxapp.cn>
|
||||
// +----------------------------------------------------------------------
|
||||
declare (strict_types = 1);
|
||||
|
||||
namespace addon\wxchat\model;
|
||||
|
||||
use ywxapp\model\BaseModel;
|
||||
|
||||
|
||||
class WxchatAppVersion extends BaseModel
|
||||
{
|
||||
|
||||
protected function getOptions(): array
|
||||
{
|
||||
return [
|
||||
'strict' => true,
|
||||
'name' => 'wxchat_app_versions',
|
||||
'autoWriteTimestamp' => 0,
|
||||
'createTime' => 'create_at',
|
||||
'updateTime' => 'update_at',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最新版本
|
||||
* @param string $platform 平台: android/ios/harmony
|
||||
* @return AppVersion|null
|
||||
*/
|
||||
public static function getLatestVersion(string $platform)
|
||||
{
|
||||
return self::where('platform', $platform)
|
||||
->where('status', 1)
|
||||
->order('version_code', 'desc')
|
||||
->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定版本
|
||||
* @param string $platform 平台
|
||||
* @param int $versionCode 版本号
|
||||
* @return AppVersion|null
|
||||
*/
|
||||
public static function getVersion(string $platform, int $versionCode)
|
||||
{
|
||||
return self::where('platform', $platform)
|
||||
->where('version_code', $versionCode)
|
||||
->where('status', 1)
|
||||
->find();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有可用版本
|
||||
* @param string $platform 平台
|
||||
* @return array
|
||||
*/
|
||||
public static function getAllVersions(string $platform): array
|
||||
{
|
||||
return self::where('platform', $platform)
|
||||
->where('status', 1)
|
||||
->order('version_code', 'desc')
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user