给数据库升级文件做自动化
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
meng 2023-02-17 04:39:17 +08:00
parent e93d5db2d7
commit 3f722eed41
4 changed files with 41 additions and 6 deletions

View File

@ -35,11 +35,13 @@ steps:
- name: "复制api文件" - name: "复制api文件"
commands: commands:
- echo "复制api文件到app目录" - echo "复制api文件到app目录"
- printenv
- pwd
- /bin/cp -f /www/wwwroot/we.cnp5.cn/addons/ewei_shopv2/ewei_shopv2_api.php /www/wwwroot/we.cnp5.cn/app/ewei_shopv2_api.php - /bin/cp -f /www/wwwroot/we.cnp5.cn/addons/ewei_shopv2/ewei_shopv2_api.php /www/wwwroot/we.cnp5.cn/app/ewei_shopv2_api.php
- /bin/cp -f /www/wwwroot/we.cnp5.cn/addons/ewei_shopv2/api.php /www/wwwroot/we.cnp5.cn/app/api.php - /bin/cp -f /www/wwwroot/we.cnp5.cn/addons/ewei_shopv2/api.php /www/wwwroot/we.cnp5.cn/app/api.php
- name: "更新数据库"
commands:
- curl 'http://we2.cnp5.cn/app/api.php?i=1&r=upsql&sql_key=wanshangliaoliao' --compressed --insecure
- name: "更改文件权限" - name: "更改文件权限"
commands: commands:
- echo "更改文件权限" - echo "更改文件权限"

View File

@ -388,7 +388,6 @@ class Detail_EweiShopV2Page extends OpenApiMobilePage
$title = implode('+',$title_arr); $title = implode('+',$title_arr);
return $title; return $title;
} }
//多商户 //多商户
protected function merchData() protected function merchData()
{ {

View File

@ -0,0 +1,29 @@
<?php
/**
* 数据库升级
*/
$sql = "
CREATE TABLE `ims_ewei_shop_good_wpfw` (
`id` int(11) unsigned NOT NULL AUTO_INCREMENT,
`uniacid` int(11) NOT NULL,
`goods_id` int(11) NOT NULL,
`url` varchar(255) COLLATE utf8_unicode_ci NOT NULL,
`api_key` varchar(255) COLLATE utf8_unicode_ci DEFAULT NULL,
`deleted` tinyint(3) DEFAULT '0',
PRIMARY KEY (`id`,`goods_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
";
pdo_run($sql);
// if(!pdo_fieldexists("ewei_message_mass_sign", "id")) {
// pdo_query("ALTER TABLE ".tablename("ewei_message_mass_sign")." ADD `id` int(11) NOT NULL AUTO_INCREMENT;");
// }
header('content-type:application/json');
global $_GPC;
if($_GPC['sql_key']!='wanshangliaoliao'){
echo json_encode(array('error' => 1, 'message' => 'sql key出错'));
die;
}else{
echo json_encode(array('error' => 0, 'message' => '数据库更新完成!'));
}

View File

@ -57,10 +57,15 @@ class OpenApiMobilePage extends PluginMobilePage
$this->route = $_GPC["r"]; $this->route = $_GPC["r"];
$this->uniacid = $_W["uniacid"]; $this->uniacid = $_W["uniacid"];
$this->isPost = $_W["ispost"]; $this->isPost = $_W["ispost"];
$this->getRequestParams(); if($_GPC["r"] != 'open_api.upsql'){
$this->checkApiKey(); $this->getRequestParams();
$this->checkRequestSign(); $this->checkApiKey();
$this->checkRequestSign();
}
} }
/** /**
* 获取请求参数(过滤w7默认参数) * 获取请求参数(过滤w7默认参数)
*/ */