12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <?php
- /*
- * @Author: wang jun
- * @Date: 2021-10-29 16:16:29
- * @Last Modified by: wang jun
- * @Last Modified time: 2021-12-25 13:02:19
- */
- namespace app\index\logic;
- use app\index\model\versionmodel;
- class versionlogic
- {
- /**
- * 获取最新根据版本号
- * 20211224
- * wj
- */
- public function getinfobyversion($arr)
- {
- if (!isset($arr['version']) || empty($arr['version']) || !is_string($arr['version'])) {
- return backarr(0, "请求失败");
- }
- if (!preg_match('/\d{1,2}.{1}\d{1,2}.{1}\d{1,2}/', $arr['version'])) {
- return backarr(0, "格式错误");
- }
- $type = 1;
- if (isset($arr['type']) && !empty($arr['type'])) {
- $type = $arr['type'];
- }
- $version = $arr['version'];
- $m_v = new versionmodel();
- $where = ['version' => ['>', $version], 'type' => $type];
- $cinfo = $m_v->getList($where, '*', 1, 1, 'id desc', '', true);
- if (empty($cinfo)) {
- return backarr(0, "无数据");
- }
- return backarr(1, "操作成功", $cinfo);
- }
- /**
- * 获取最新根据code
- * 20211224
- * wj
- */
- public function getinfobycode($arr)
- {
- $type = 1;
- if (isset($arr['type']) && !empty($arr['type'])) {
- $type = $arr['type'];
- }
- $m_v = new versionmodel();
- $where = ['type' => $type];
- $cinfo = $m_v->getList($where, '*', 1, 1, 'id desc', '', true);
- if (empty($cinfo)) {
- return backarr(0, "无数据");
- }
- return backarr(1, "操作成功", $cinfo);
- }
- }
|