get('p_sources'); } /** * 获取最新的稳定版app * * @param int $type android(1) IOS(3) * @return array */ public static function getLastStable($type = 1,$platform_id = 1) { $max_version = self::find()->where(['type' => $type,'platform_id' => $platform_id])->max('version'); $data = self::find()->where(['type' => $type,'platform_id' => $platform_id,'version' => $max_version])->asArray()->one(); return $data; } public function formName() { return ''; } public function attributeLabels() { return [ 'id' => 'ID', 'status' => '状态', 'type' => '类型', 'version_code' => '版本代码', 'version' => '版本号', 'download_url' => '下载地址', 'log' => '升级日志', 'platform_id' => '平台', 'created_at' => '创建时间', 'updated_at' => '更新时间', ]; } public function rules() { return [ [['id', 'status', 'type', 'version_code','platform_id'], 'integer'], [['log', 'created_at', 'updated_at'], 'string'], [['version'], 'string', 'max' => 17], [['download_url'], 'string', 'max' => 255], [['status', 'type', 'version_code', 'version', 'download_url'], 'required', 'on' => 'add'], [['id', 'status', 'type', 'version_code', 'version', 'download_url'], 'required', 'on' => 'update'], ]; } public function scenarios() { return [ 'add' => ['status', 'type', 'version_code', 'version', 'download_url', 'log','platform_id'], 'update' => ['id', 'status', 'type', 'version_code', 'version', 'download_url', 'log'], ]; } }