Skip to content

Commit

Permalink
更新版本1.47
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoxing1617 committed May 20, 2023
1 parent a5be594 commit 12283ab
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 21 deletions.
49 changes: 39 additions & 10 deletions application/common.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
//================================================
error_reporting(E_ERROR | E_PARSE); // 异常抛出报错级别
$sistemaInfo = getSistemaInfo();
define('IS_UNLINK', $sistemaInfo['IS_UNLINK']);
define('SYSTEM_ROOT', dirname(__FILE__) . '/');
define('ROOT', dirname(SYSTEM_ROOT) . '/');
define('PAY_PATH', EXTEND_PATH . "pay/");
Expand Down Expand Up @@ -67,9 +68,20 @@
//===================检查更新=======================
//================================================
if(Request::instance()->baseUrl() != "/update" && Request::instance()->baseUrl() != "/install"){
if (checkUpdate()) {
weuiMsg('warn-primary', '系统检查到您的 v'.VERSION.'('.BUILD.') 未更新完成,请完成更新后使用!<br/><br/><br/><a href="/update" class="weui-btn weui-btn_default">去更新</a>', '版本更新', false);
exit();
if (is_dir(ROOT."application/install/update_sql/")) {
$files = scandir(ROOT."application/install/update_sql/");
if (count($files) !== 2) {
//文件夹不为空
foreach ($files as $i=>$filename){
if ($filename != "." && $filename != "..") {
$build = pathinfo($filename, PATHINFO_FILENAME);
if (checkUpdate($build)) {
weuiMsg('warn-primary', '系统检查到您当前的版本有需要同步数据库,当前版本v'.VERSION.'('.BUILD.')。请先完成同步后即可正常使用!<br/><br/><br/><a href="/update?build='.$build.'" class="weui-btn weui-btn_default">去更新</a>', '版本更新', false);
exit();
}
}
}
}
}
}
extension_loaded('openssl') or die(weuiMsg('warn-primary', '', '需要支持openssl扩展', false));
Expand All @@ -79,21 +91,38 @@
/**
* 检查更新
*/
function checkUpdate(){
$core = Core::where('id', '<>', 0)->column('value1', 'name');
switch (BUILD){
function checkUpdate($build=0){
$is = false;
switch ($build){
case 1019:
$core = Core::where('id', '<>', 0)->column('value1', 'name');
if(!DB::query("SHOW TABLES LIKE 'xy_cashier_fixed_amount'")){
return true;
$is = true;
}
if(!isset($core['user_theme_data']) || !isset($core['page_grey'])){
return true;
$is = true;
}
break;
case 1020:
if(!DB::query("SHOW COLUMNS FROM `xy_cashier_order` LIKE 'faid' ")){
$is = true;
}
break;
default:
return false;
$build = 0;
$is = false;
}
return false;
//不需要同步数据库 && 版本序号不是0 && 删除
if(!$is && $build!=0 && IS_UNLINK){
$path = ROOT."application/install/update_sql/".$build.".sql";
if(file_exists($path)){
//文件存在
if(!unlink(ROOT."application/install/update_sql/".$build.".sql")){
weuiMsg('warn-primary', '', '同步数据库的临时文件删除失败,请检查系统是否有删除文件权限', false);
}
}
}
return $is;
}
/**
* 获取当前域名(不带协议头)
Expand Down
8 changes: 4 additions & 4 deletions application/install/controller/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ public function Index(Request $request)
*/
public function update(Request $request)
{
$get = $request->get();
$build = intval($request->get('build',0));
//================页面载入================
if (!checkUpdate()) {
if (!checkUpdate($build)) {
weuiMsg('info', '已是最新版本v'.VERSION.'('.BUILD.')','无更新',true,["url"=>"https://github.com/xiaoxing1617/cashier","title"=>"GitHub开源地址"]);
exit();
}
Expand All @@ -289,9 +289,9 @@ public function update(Request $request)
];
//---------------------------
$msg = "";
$path = APP_PATH . "install/update_sql/".BUILD.".sql";
$path = APP_PATH . "install/update_sql/".$build.".sql";
if(!file_exists($path)){
weuiMsg('warn-primary', "更新数据包不存在或已被删除,请自行前往github下载<b> ".BUILD.".sql </b>。并将文件放置在源码<b> /application/install/update_sql </b>文件夹里,重新刷新此页面即可!",'更新失败',true,["url"=>"https://github.com/xiaoxing1617/cashier/tree/master/application/install/update_sql","title"=>"GitHub数据包"]);
weuiMsg('warn-primary', "更新数据包不存在或已被删除,请自行前往github下载<b> ".$build.".sql </b>。并将文件放置在源码<b> /application/install/update_sql </b>文件夹里,重新刷新此页面即可!",'更新失败',true,["url"=>"https://github.com/xiaoxing1617/cashier/tree/master/application/install/update_sql","title"=>"GitHub数据包"]);
exit();
}
//---------------------------
Expand Down
1 change: 1 addition & 0 deletions application/install/install.sql
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ CREATE TABLE `xy_cashier_order` (
`buyer` varchar(255) DEFAULT NULL COMMENT '买家标识',
`source` varchar(255) DEFAULT NULL COMMENT '订单来源类型',
`state` int(11) NOT NULL DEFAULT '0' COMMENT '支付状态',
`faid` int(11) DEFAULT '0' COMMENT '固额码ID',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='订单表';</explode>

Expand Down
3 changes: 3 additions & 0 deletions application/install/update_sql/1020.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#星益云www.96xy.cn【1020数据包】;</explode>

ALTER TABLE `xy_cashier_order` ADD `faid` int(11) DEFAULT 0 NOT NULL COMMENT '固额码ID';</explode>
2 changes: 1 addition & 1 deletion application/user/controller/FixedAmount.php
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ public function getList(Request $request){
$arr['color'] = "#6e00ff";
$arr['count'] = 0;
}
$pay_type[] = $arr;
$pay_type = $arr;
}
$list[$k]['pay_type'] = $pay_type;
}
Expand Down
6 changes: 3 additions & 3 deletions application/user/view/default/fixed_amount.html
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ <h6 class="mb-0">创建记录</h6>
`);
$.ajax({
type: "POST",
url: "/user/FixedAmount/getList",
url: "/user/bill/getBill",
data: {
"mode":"fixed_amount_id",
"value":id,
Expand Down Expand Up @@ -482,10 +482,10 @@ <h6 class="mb-0">创建记录</h6>
var res = data.list[i];
html += `
<tr>
<td style="font-weight: bolder;text-align: center;color: ${res.type_color}">
<td style="font-weight: bolder;text-align: center;color: ${res.pay_type.color}">
${res.trade_type}
<br>
<img style="vertical-align:middle" src="/static/icon/${res.type_icon}" width="17"> ${res.type}
<img style="vertical-align:middle" src="/static/icon/${res.pay_type.icon}" width="17"> ${res.pay_type.name}
</td>
<td>${res.out_trade_no}</td>
Expand Down
7 changes: 4 additions & 3 deletions public/static/common/json/sistema.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"VERSION":"1.46",
"BUILD": 1019,
"VERSION":"1.47",
"BUILD": 1020,
"ADMIN_BOTTOM": "Copyright © 2023 <a href='http://www.96xy.cn/' target='_blank'>星益云</a> 版权所有",
"AUTORE": "小星"
"AUTORE": "小星",
"IS_UNLINK":true
}

0 comments on commit 12283ab

Please sign in to comment.