diff --git a/niucloud/app/adminapi/controller/dict/Dict.php b/niucloud/app/adminapi/controller/dict/Dict.php index ec9a6e185..5a07fd3e9 100644 --- a/niucloud/app/adminapi/controller/dict/Dict.php +++ b/niucloud/app/adminapi/controller/dict/Dict.php @@ -49,10 +49,10 @@ class Dict extends BaseAdminController */ public function add(){ $data = $this->request->params([ - ["name",""], - ["key",""], - ["memo",""], - + ["name",""], + ["key",""], + ["memo",""], + ["dictionary", ""] ]); // $this->validate($data, 'app\validate\dict\Dict.add'); $id = (new DictService())->add($data); @@ -66,10 +66,9 @@ class Dict extends BaseAdminController */ public function edit($id){ $data = $this->request->params([ - ["name",""], - ["key",""], - ["memo",""], - + ["name",""], + ["key",""], + ["memo",""], ]); // $this->validate($data, 'app\validate\dict\Dict.edit'); (new DictService())->edit($id, $data); diff --git a/niucloud/app/dict/menu/admin.php b/niucloud/app/dict/menu/admin.php index 128a56c80..f51389627 100644 --- a/niucloud/app/dict/menu/admin.php +++ b/niucloud/app/dict/menu/admin.php @@ -13,17 +13,6 @@ return [ 'status' => 1, 'is_show' => 0, 'children' => [ - [ - 'menu_name' => '应用管理', - 'menu_key' => 'app_manage_index', - 'menu_type' => 1, - 'icon' => '', - 'api_url' => '', - 'router_path' => '', - 'view_path' => 'index/app_manage', - 'methods' => 'get', - 'status' => 1, - ], [ 'menu_name' => '插件管理', 'menu_key' => 'app_manage_store', @@ -33,7 +22,7 @@ return [ 'router_path' => 'app_store', 'view_path' => 'index/store', 'methods' => 'get', - 'sort' => 20, + 'sort' => 40, 'status' => 1, 'is_show' => 1 ], @@ -49,6 +38,19 @@ return [ 'sort' => 30, 'status' => 1, 'is_show' => 1 + ], + [ + 'menu_name' => '应用管理', + 'menu_key' => 'app_manage_index', + 'menu_type' => 1, + 'icon' => '', + 'api_url' => '', + 'router_path' => '', + 'view_path' => 'index/app_manage', + 'methods' => 'get', + 'sort' => 10, + 'status' => 1, + 'is_show' => 0 ] ] ], diff --git a/niucloud/app/service/core/addon/CoreAddonCloudService.php b/niucloud/app/service/core/addon/CoreAddonCloudService.php index 908b78fa1..69b5923cc 100644 --- a/niucloud/app/service/core/addon/CoreAddonCloudService.php +++ b/niucloud/app/service/core/addon/CoreAddonCloudService.php @@ -212,13 +212,18 @@ class CoreAddonCloudService extends CoreCloudBaseService * @return void */ public function downloadAddon(string $addon, string $version) { + $action_token = (new CoreModuleService())->getActionToken('download', ['data' => ['app_key' => $addon, 'version' => $version]]); + if (isset($action_token['code']) && $action_token['code'] != 1) { + if ($action_token['code'] == 401) $action_token = (new CoreModuleService())->getActionToken('download', ['data' => ['app_key' => $addon, 'version' => $version]]); + if ($action_token['code'] != 1) throw new CommonException($action_token['msg']); + } + $query = [ 'authorize_code' => $this->auth_code, 'addon_name' => $addon, 'addon_version' => $version, -// 'token' => (new CoreModuleService())->getActionToken('download', ['app_key' => $addon, 'version' => $version]) + 'token' => $action_token['data']['token'] ?? '' ]; - // 获取文件大小 $response = (new CloudService())->request('HEAD','cloud/download?' . http_build_query($query), [ 'headers' => ['Range' => 'bytes=0-'] diff --git a/niucloud/app/service/core/addon/CoreAddonInstallService.php b/niucloud/app/service/core/addon/CoreAddonInstallService.php index 92e501861..a94b3199a 100644 --- a/niucloud/app/service/core/addon/CoreAddonInstallService.php +++ b/niucloud/app/service/core/addon/CoreAddonInstallService.php @@ -255,7 +255,6 @@ class CoreAddonInstallService extends CoreAddonBaseService } Cache::set('install_task', null); - Cache::set($this->cache_key . '_install_check', null); } /** @@ -406,7 +405,7 @@ class CoreAddonInstallService extends CoreAddonBaseService Cache::set("local_install_addons", []); //执行命令 //执行插件安装方法 - $class = "addon\\" . $this->addon . "\\" . 'Manage'; + $class = "addon\\" . $this->addon . "\\" . 'Addon'; if (class_exists($class)) { (new $class())->install(); } @@ -529,7 +528,7 @@ class CoreAddonInstallService extends CoreAddonBaseService public function uninstall() { //执行插件卸载方法 - $class = "addon\\" . $this->addon . "\\" . 'Manage'; + $class = "addon\\" . $this->addon . "\\" . 'Addon'; if (class_exists($class)) { (new $class())->uninstall(); } diff --git a/niucloud/app/service/core/weapp/CoreWeappCloudService.php b/niucloud/app/service/core/weapp/CoreWeappCloudService.php index c67a85aee..f48406a7b 100644 --- a/niucloud/app/service/core/weapp/CoreWeappCloudService.php +++ b/niucloud/app/service/core/weapp/CoreWeappCloudService.php @@ -73,7 +73,7 @@ class CoreWeappCloudService extends CoreCloudBaseService 'do' => 1, 'timestamp' => time() ]; - (new CloudService())->httpPost('cloud/weapp?' . http_build_query($query), [ + $response = (new CloudService())->httpPost('cloud/weapp?' . http_build_query($query), [ 'multipart' => [ [ 'name' => 'file', @@ -86,6 +86,8 @@ class CoreWeappCloudService extends CoreCloudBaseService // 删除临时文件 del_target_dir(runtime_path() . 'backup' . DIRECTORY_SEPARATOR . 'weapp', true); + if (isset($response['code']) && $response['code'] == 0) throw new CommonException($response['msg']); + return ['key' => $query['timestamp'] ]; } diff --git a/niucloud/app/service/core/wechat/CoreWechatConfigService.php b/niucloud/app/service/core/wechat/CoreWechatConfigService.php index 1b0ff7d02..a7ca70ea3 100644 --- a/niucloud/app/service/core/wechat/CoreWechatConfigService.php +++ b/niucloud/app/service/core/wechat/CoreWechatConfigService.php @@ -70,7 +70,7 @@ class CoreWechatConfigService extends BaseCoreService */ public function getWechatStaticInfo(){ // $domain = request()->domain(); - $wap_domain = (new CoreSysConfigService())->getSceneDomain()['wap_domain'] ?? ''; + $wap_domain = (new CoreSysConfigService())->getSceneDomain()['wap_url'] ?? ''; $wap_domain_array = explode('/', $wap_domain); if(count($wap_domain_array) > 2){ $wap_domain = $wap_domain_array[0].'/'.$wap_domain_array[1].'/'.$wap_domain_array[2]; diff --git a/niucloud/config/queue.php b/niucloud/config/queue.php index 0e82f3194..e727da9b4 100644 --- a/niucloud/config/queue.php +++ b/niucloud/config/queue.php @@ -31,7 +31,7 @@ return [ // 端口 'port' => env('redis.port', '6379'), // 密码 - 'password' => env('redis.redis_password', ''), + 'password' => env('redis.redis_password', '123456'), // 缓存有效期 0表示永久缓存 'expire' => 0 , // 缓存前缀 diff --git a/niucloud/config/version.php b/niucloud/config/version.php index ad8a8edc3..d81855696 100644 --- a/niucloud/config/version.php +++ b/niucloud/config/version.php @@ -1,6 +1,6 @@ '0.0.4', - 'code' => '202310240001' + 'version' => '0.0.5', + 'code' => '202311150001' ]; diff --git a/niucloud/core/pay/Alipay.php b/niucloud/core/pay/Alipay.php index 6f8d65589..da681970a 100644 --- a/niucloud/core/pay/Alipay.php +++ b/niucloud/core/pay/Alipay.php @@ -224,7 +224,7 @@ class Alipay extends BasePay ]; } else { //todo 这儿可以抛出错误 - return false; + throw new PayException($result['msg']); } } @@ -376,4 +376,4 @@ class Alipay extends BasePay { return ['url' => $params->getHeader('Location')[0]]; } -} \ No newline at end of file +} diff --git a/niucloud/core/pay/BasePay.php b/niucloud/core/pay/BasePay.php index 92872e34a..9215bdc6f 100644 --- a/niucloud/core/pay/BasePay.php +++ b/niucloud/core/pay/BasePay.php @@ -2,6 +2,7 @@ namespace core\pay; +use core\exception\PayException; use core\loader\Storage; use Psr\Http\Message\MessageInterface; use Yansongda\Supports\Collection; @@ -158,12 +159,16 @@ abstract class BasePay extends Storage public function returnFormat($param) { if ($param instanceof MessageInterface) { - return $param->getBody()->getContents(); + $return_value = $param->getBody()->getContents(); } else if ($param instanceof Collection) { - return $param->all(); + $return_value = $param->all(); } else { - return $param; + $return_value = $param; } + if(isset($return_value['code'])){ + throw new PayException($return_value['message']); + } + return $return_value; } /** diff --git a/niucloud/core/util/niucloud/http/AccessToken.php b/niucloud/core/util/niucloud/http/AccessToken.php index d3bb564c9..20bdb36fb 100644 --- a/niucloud/core/util/niucloud/http/AccessToken.php +++ b/niucloud/core/util/niucloud/http/AccessToken.php @@ -67,6 +67,7 @@ trait AccessToken { $access_token_info = $this->httpGet('auth', ['code' => $this->code, 'secret' => $this->secret, 'token' => $this->createToken(), 'redirect_uri' => $this->getDomain(false)]); if (isset($access_token_info['code']) && $access_token_info['code'] != 1) throw new NiucloudException($access_token_info['msg']); + sleep(2); } }