初始上传
This commit is contained in:
38
addon/qiniu/config/diy_view.php
Executable file
38
addon/qiniu/config/diy_view.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
|
||||
// 自定义模板页面类型,格式:[ 'title' => '页面类型名称', 'name' => '页面标识', 'path' => '页面路径', 'value' => '页面数据,json格式' ]
|
||||
'template' => [],
|
||||
|
||||
// 后台自定义组件——装修
|
||||
'util' => [],
|
||||
|
||||
// 自定义页面路径
|
||||
'link' => [],
|
||||
|
||||
// 自定义图标库
|
||||
'icon_library' => [],
|
||||
|
||||
// uni-app 组件,格式:[ 'name' => '组件名称/文件夹名称', 'path' => '文件路径/目录路径' ],多个逗号隔开,自定义组件名称前缀必须是diy-,也可以引用第三方组件
|
||||
'component' => [],
|
||||
|
||||
// uni-app 页面,多个逗号隔开
|
||||
'pages' => [],
|
||||
|
||||
// 模板信息,格式:'title' => '模板名称', 'name' => '模板标识', 'cover' => '模板封面图', 'preview' => '模板预览图', 'desc' => '模板描述'
|
||||
'info' => [],
|
||||
|
||||
// 主题风格配色,格式可以自由定义扩展,【在uni-app中通过:this.themeStyle... 获取定义的颜色字段,例如:this.themeStyle.main_color】
|
||||
'theme' => [],
|
||||
|
||||
// 自定义页面数据,格式:[ 'title' => '页面名称', 'name' => "页面标识", 'value' => [页面数据,json格式] ]
|
||||
'data' => []
|
||||
];
|
||||
30
addon/qiniu/config/event.php
Executable file
30
addon/qiniu/config/event.php
Executable file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
// 事件定义文件
|
||||
return [
|
||||
'bind' => [
|
||||
|
||||
],
|
||||
|
||||
'listen' => [
|
||||
//短信方式
|
||||
'OssType' => [
|
||||
'addon\qiniu\event\OssType'
|
||||
],
|
||||
'Put' => [
|
||||
'addon\qiniu\event\Put'
|
||||
],
|
||||
'CloseOss' => [
|
||||
'addon\qiniu\event\CloseOss'
|
||||
],
|
||||
'ClearAlbumPic' => [
|
||||
'addon\qiniu\event\ClearAlbumPic'
|
||||
],
|
||||
// 展示活动
|
||||
'ShowPromotion' => [
|
||||
'addon\qiniu\event\ShowPromotion',
|
||||
],
|
||||
],
|
||||
|
||||
'subscribe' => [
|
||||
],
|
||||
];
|
||||
21
addon/qiniu/config/info.php
Executable file
21
addon/qiniu/config/info.php
Executable file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
return [
|
||||
'name' => 'qiniu',
|
||||
'title' => '七牛云上传',
|
||||
'description' => '七牛云上传功能',
|
||||
'type' => 'system', //插件类型 system :系统插件 promotion:营销插件 tool:工具插件
|
||||
'status' => 1,
|
||||
'author' => '',
|
||||
'version' => '5.5.3',
|
||||
'version_no' => '553250709001',
|
||||
'content' => '',
|
||||
];
|
||||
18
addon/qiniu/config/menu_shop.php
Executable file
18
addon/qiniu/config/menu_shop.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | 平台端菜单设置
|
||||
// +----------------------------------------------------------------------
|
||||
return [
|
||||
[
|
||||
'name' => 'QINIU_CONFIG',
|
||||
'title' => '七牛云上传配置',
|
||||
'url' => 'qiniu://shop/config/config',
|
||||
'parent' => 'UPLOAD_OSS',
|
||||
'is_show' => 0,
|
||||
'is_control' => 1,
|
||||
'is_icon' => 0,
|
||||
'picture' => '',
|
||||
'picture_select' => '',
|
||||
'sort' => 1,
|
||||
],
|
||||
];
|
||||
38
addon/qiniu/event/ClearAlbumPic.php
Executable file
38
addon/qiniu/event/ClearAlbumPic.php
Executable file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\qiniu\event;
|
||||
|
||||
use addon\qiniu\model\Qiniu;
|
||||
use addon\qiniu\model\Config;
|
||||
|
||||
/**
|
||||
* 删除七牛云图片
|
||||
*/
|
||||
class ClearAlbumPic
|
||||
{
|
||||
|
||||
public function handle($params)
|
||||
{
|
||||
$config_model = new Config();
|
||||
$qiniu_model = new Qiniu();
|
||||
|
||||
$config = $config_model->getQiniuConfig($params[ 'site_id' ]);
|
||||
|
||||
if (!empty($config[ 'data' ])) {
|
||||
if (!empty($config[ 'data' ][ 'value' ][ 'domain' ]) && strpos($params[ 'pic_path' ], $config[ 'data' ][ 'value' ][ 'domain' ]) === 0) {
|
||||
$result = $qiniu_model->deleteAlbumPic($params[ 'pic_path' ], $config[ 'data' ][ 'value' ][ 'domain' ]);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
27
addon/qiniu/event/CloseOss.php
Executable file
27
addon/qiniu/event/CloseOss.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\qiniu\event;
|
||||
|
||||
use addon\qiniu\model\Config;
|
||||
|
||||
/**
|
||||
* 关闭云上传
|
||||
*/
|
||||
class CloseOss
|
||||
{
|
||||
public function handle()
|
||||
{
|
||||
$config_model = new Config();
|
||||
$result = $config_model->modifyConfigIsUse(0);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
26
addon/qiniu/event/Install.php
Executable file
26
addon/qiniu/event/Install.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\qiniu\event;
|
||||
|
||||
/**
|
||||
* 应用安装
|
||||
*/
|
||||
class Install
|
||||
{
|
||||
/**
|
||||
* 执行安装
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
33
addon/qiniu/event/OssType.php
Executable file
33
addon/qiniu/event/OssType.php
Executable file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\qiniu\event;
|
||||
|
||||
/**
|
||||
* 云上传方式
|
||||
*/
|
||||
class OssType
|
||||
{
|
||||
/**
|
||||
* 短信发送方式方式及配置
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$info = array(
|
||||
"sms_type" => "qiniu",
|
||||
"sms_type_name" => "七牛云上传",
|
||||
"edit_url" => "qiniu://shop/config/config",
|
||||
"shop_url" => "qiniu://shop/config/config",
|
||||
"desc" => "七牛云上传,七牛提供10GB免费存储空间"
|
||||
);
|
||||
return $info;
|
||||
}
|
||||
}
|
||||
29
addon/qiniu/event/Put.php
Executable file
29
addon/qiniu/event/Put.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\qiniu\event;
|
||||
|
||||
use addon\qiniu\model\Qiniu;
|
||||
|
||||
/**
|
||||
* 云上传方式
|
||||
*/
|
||||
class Put
|
||||
{
|
||||
/**
|
||||
* 短信发送方式方式及配置
|
||||
*/
|
||||
public function handle($param)
|
||||
{
|
||||
$qiniu_model = new Qiniu();
|
||||
$result = $qiniu_model->putFile($param);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
57
addon/qiniu/event/ShowPromotion.php
Executable file
57
addon/qiniu/event/ShowPromotion.php
Executable file
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* 这不是一个自由软件!您只能在不用于商业目的的前提下对程序代码进行修改和使用。
|
||||
* 任何企业和个人不允许对程序代码以任何形式任何目的再发布。
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
|
||||
namespace addon\qiniu\event;
|
||||
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
*/
|
||||
class ShowPromotion
|
||||
{
|
||||
|
||||
/**
|
||||
* 活动展示
|
||||
* @param array $params
|
||||
* @return array
|
||||
*/
|
||||
public function handle($params = [])
|
||||
{
|
||||
$data = [
|
||||
|
||||
'admin' => [
|
||||
|
||||
],
|
||||
'shop' => [
|
||||
[
|
||||
//插件名称
|
||||
'name' => 'qiniu',
|
||||
//展示分类(根据平台端设置,admin(平台营销),shop:店铺营销,member:会员营销, tool:应用工具)
|
||||
'show_type' => 'tool',
|
||||
//展示主题
|
||||
'title' => '七牛云',
|
||||
//展示介绍
|
||||
'description' => '七牛云配置',
|
||||
//展示图标
|
||||
'icon' => 'addon/qiniu/icon.png',
|
||||
//跳转链接
|
||||
'url' => 'qiniu://shop/config/config',
|
||||
],
|
||||
|
||||
],
|
||||
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
26
addon/qiniu/event/UnInstall.php
Executable file
26
addon/qiniu/event/UnInstall.php
Executable file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\qiniu\event;
|
||||
|
||||
/**
|
||||
* 应用卸载
|
||||
*/
|
||||
class UnInstall
|
||||
{
|
||||
/**
|
||||
* 执行卸载
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
return success();
|
||||
}
|
||||
}
|
||||
BIN
addon/qiniu/icon.png
Executable file
BIN
addon/qiniu/icon.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
56
addon/qiniu/model/Config.php
Executable file
56
addon/qiniu/model/Config.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\qiniu\model;
|
||||
|
||||
use app\model\system\Config as ConfigModel;
|
||||
use app\model\BaseModel;
|
||||
|
||||
/**
|
||||
* 七牛云配置
|
||||
*/
|
||||
class Config extends BaseModel
|
||||
{
|
||||
/**
|
||||
* 设置七牛云上传配置
|
||||
* array $data
|
||||
*/
|
||||
public function setQiniuConfig($data, $status, $site_id = 1, $app_module = 'shop')
|
||||
{
|
||||
if ($status == 1) {
|
||||
event('CloseOss', []);//同步关闭所有云上传
|
||||
}
|
||||
$config = new ConfigModel();
|
||||
$res = $config->setConfig($data, '七牛云上传配置', $status, [['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'QINIU_CONFIG']]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取七牛云上传配置
|
||||
*/
|
||||
public function getQiniuConfig($site_id = 1, $app_module = 'shop')
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->getConfig([['site_id', '=', $site_id], ['app_module', '=', $app_module], ['config_key', '=', 'QINIU_CONFIG']]);
|
||||
return $res;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置七牛云开关状态
|
||||
* @param $status
|
||||
*/
|
||||
public function modifyConfigIsUse($status)
|
||||
{
|
||||
$config = new ConfigModel();
|
||||
$res = $config->modifyConfigIsUse($status, [['site_id', '=', 1], ['app_module', '=', 'shop'], ['config_key', '=', 'QINIU_CONFIG']]);
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
131
addon/qiniu/model/Qiniu.php
Executable file
131
addon/qiniu/model/Qiniu.php
Executable file
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\qiniu\model;
|
||||
|
||||
use app\model\BaseModel;
|
||||
// 引入鉴权类
|
||||
use \Qiniu\Auth;
|
||||
// 引入上传类
|
||||
use Qiniu\Storage\BucketManager;
|
||||
use \Qiniu\Storage\UploadManager;
|
||||
|
||||
/**
|
||||
* 七牛云上传
|
||||
*/
|
||||
class Qiniu extends BaseModel
|
||||
{
|
||||
|
||||
/**
|
||||
* 字节组上传
|
||||
* @param $data
|
||||
* @param $key
|
||||
* @return array
|
||||
*/
|
||||
public function put($param)
|
||||
{
|
||||
$data = $param[ "data" ];
|
||||
$key = $param[ "key" ];
|
||||
$config_model = new Config();
|
||||
$config_result = $config_model->getQiniuConfig();
|
||||
$config = $config_result[ "data" ];
|
||||
|
||||
if ($config[ "is_use" ] == 1) {
|
||||
$config = $config[ "value" ];
|
||||
$accessKey = $config[ "access_key" ];
|
||||
$secretKey = $config[ "secret_key" ];
|
||||
$bucket = $config[ "bucket" ];
|
||||
$auth = new Auth($accessKey, $secretKey);
|
||||
$token = $auth->uploadToken($bucket);
|
||||
( new BucketManager($auth) )->delete($bucket, $key);
|
||||
$uploadMgr = new UploadManager();
|
||||
//----------------------------------------upload demo1 ----------------------------------------
|
||||
// 上传字符串到七牛
|
||||
list($ret, $err) = $uploadMgr->put($token, $key, $data);
|
||||
if ($err !== null) {
|
||||
return $this->error('', $err->getResponse()->error);
|
||||
} else {
|
||||
//返回图片的完整URL
|
||||
$domain = $config[ "domain" ];//自定义域名
|
||||
$data = array (
|
||||
"path" => $domain . "/" . $key,
|
||||
"domain" => $domain,
|
||||
"bucket" => $bucket
|
||||
);
|
||||
return $this->success($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置七牛参数配置
|
||||
* @param unknown $filePath 上传图片路径
|
||||
* @param unknown $key 上传到七牛后保存的文件名
|
||||
*/
|
||||
public function putFile($param)
|
||||
{
|
||||
$file_path = $param[ "file_path" ];
|
||||
$key = $param[ "key" ];
|
||||
$config_model = new Config();
|
||||
$config = $config_model->getQiniuConfig()[ "data" ];
|
||||
if ($config[ "is_use" ] == 1) {
|
||||
$config = $config[ "value" ];
|
||||
$accessKey = $config[ "access_key" ];
|
||||
$secretKey = $config[ "secret_key" ];
|
||||
$bucket = $config[ "bucket" ];
|
||||
$auth = new Auth($accessKey, $secretKey);
|
||||
( new BucketManager($auth) )->delete($bucket, $key);
|
||||
//要上传的空间
|
||||
$token = $auth->uploadToken($bucket);
|
||||
// 初始化 UploadManager 对象并进行文件的上传
|
||||
$uploadMgr = new UploadManager();
|
||||
// 调用 UploadManager 的 putFile 方法进行文件的上传
|
||||
list($ret, $err) = $uploadMgr->putFile($token, $key, $file_path);
|
||||
if ($err !== null) {
|
||||
return $this->error('', $err->getResponse()->error);
|
||||
} else {
|
||||
//返回图片的完整URL
|
||||
$domain = $config[ "domain" ];//自定义域名
|
||||
$data = array (
|
||||
"path" => $domain . "/" . $key,
|
||||
"domain" => $domain,
|
||||
"bucket" => $bucket
|
||||
);
|
||||
return $this->success($data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $file_path
|
||||
* 删除七牛云图片
|
||||
*/
|
||||
public function deleteAlbumPic($file_path, $prefix)
|
||||
{
|
||||
$config_model = new Config();
|
||||
$config_result = $config_model->getQiniuConfig();
|
||||
$config = $config_result[ "data" ];
|
||||
if (!empty($config)) {
|
||||
$config = $config[ "value" ];
|
||||
$accessKey = $config[ "access_key" ];
|
||||
$secretKey = $config[ "secret_key" ];
|
||||
$bucket = $config[ "bucket" ];
|
||||
|
||||
$auth = new Auth($accessKey, $secretKey);
|
||||
// $prefix = substr($file_path,0,strripos($file_path, "/"));
|
||||
// dump(str_replace($prefix."/", "",$file_path));
|
||||
( new BucketManager($auth) )->delete($bucket, str_replace($prefix . "/", "", $file_path));
|
||||
( new BucketManager($auth) )->delete($bucket, str_replace($prefix . "/", "", img($file_path, 'big')));
|
||||
( new BucketManager($auth) )->delete($bucket, str_replace($prefix . "/", "", img($file_path, 'mid')));
|
||||
( new BucketManager($auth) )->delete($bucket, str_replace($prefix . "/", "", img($file_path, 'small')));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
52
addon/qiniu/shop/controller/Config.php
Executable file
52
addon/qiniu/shop/controller/Config.php
Executable file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
/**
|
||||
* Niushop商城系统 - 团队十年电商经验汇集巨献!
|
||||
* =========================================================
|
||||
* Copy right 2019-2029 杭州牛之云科技有限公司, 保留所有权利。
|
||||
* ----------------------------------------------
|
||||
* 官方网址: https://www.niushop.com
|
||||
|
||||
* =========================================================
|
||||
*/
|
||||
|
||||
namespace addon\qiniu\shop\controller;
|
||||
|
||||
use addon\qiniu\model\Config as ConfigModel;
|
||||
use app\shop\controller\BaseShop;
|
||||
|
||||
/**
|
||||
* 七牛云上传管理
|
||||
*/
|
||||
class Config extends BaseShop
|
||||
{
|
||||
|
||||
/**
|
||||
* 云上传配置
|
||||
* @return mixed
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
$config_model = new ConfigModel();
|
||||
if (request()->isJson()) {
|
||||
$bucket = input('bucket', '');
|
||||
$access_key = input('access_key', '');
|
||||
$secret_key = input('secret_key', '');
|
||||
$domain = input('domain', '');
|
||||
$status = input('status', 0);
|
||||
$data = array(
|
||||
'bucket' => $bucket,
|
||||
'access_key' => $access_key,
|
||||
'secret_key' => $secret_key,
|
||||
'domain' => $domain,
|
||||
);
|
||||
|
||||
$result = $config_model->setQiniuConfig($data, $status, $this->site_id, $this->app_module);
|
||||
return $result;
|
||||
} else {
|
||||
$info_result = $config_model->getQiniuConfig($this->site_id, $this->app_module);
|
||||
$info = $info_result['data'];
|
||||
$this->assign('info', $info);
|
||||
return $this->fetch('config/config');
|
||||
}
|
||||
}
|
||||
}
|
||||
89
addon/qiniu/shop/view/config/config.html
Executable file
89
addon/qiniu/shop/view/config/config.html
Executable file
@@ -0,0 +1,89 @@
|
||||
<div class="layui-form form-wrap">
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label">是否开启:</label>
|
||||
<div class="layui-input-block" id="isOpen">
|
||||
<input type="checkbox" name="status" lay-filter="isOpen" value="1" lay-skin="switch" {if condition="$info.is_use == 1"} checked {/if} />
|
||||
</div>
|
||||
<div class="word-aux">当前使用七牛云上传配置</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>Accesskey:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="access_key" placeholder="请输入Accesskey" lay-verify="required" value="{$info.value.access_key ?? ''}" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
<div class="word-aux">用于签名的公钥</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>Secretkey:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="secret_key" placeholder="请输入Secretkey" lay-verify="required" value="{$info.value.secret_key ?? ''}" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
<div class="word-aux">用于签名的私钥</div>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>Bucket:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="bucket" placeholder="请输入库的名称" lay-verify="required" value="{$info.value.bucket ?? ''}" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
<div class="word-aux">请保证bucket为可公共读取的</div>
|
||||
</div>
|
||||
<div class="layui-form-item">
|
||||
<label class="layui-form-label"><span class="required">*</span>Domain:</label>
|
||||
<div class="layui-input-block">
|
||||
<input type="text" name="domain" placeholder="请输入domain" lay-verify="required" value="{$info.value.domain ?? ''}" autocomplete="off" class="layui-input len-long">
|
||||
</div>
|
||||
<div class="word-aux">七牛支持用户自定义访问域名。注:url开头加http://或https://,结尾不加 ‘/’,例:http://abc.com</div>
|
||||
</div>
|
||||
<!-- 表单操作 -->
|
||||
<div class="form-row">
|
||||
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||
<button class="layui-btn layui-btn-primary" onclick="backUploadOss()">返回</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
layui.use('form', function() {
|
||||
var form = layui.form,
|
||||
repeat_flag = false; //防重复标识
|
||||
form.render();
|
||||
|
||||
form.on('submit(save)', function(data) {
|
||||
if (repeat_flag) return;
|
||||
repeat_flag = true;
|
||||
|
||||
$.ajax({
|
||||
url: ns.url("qiniu://shop/config/config"),
|
||||
data: data.field,
|
||||
dataType: 'JSON',
|
||||
type: 'POST',
|
||||
success: function(res) {
|
||||
repeat_flag = false;
|
||||
|
||||
if (res.code == 0) {
|
||||
layer.confirm('编辑成功', {
|
||||
title:'操作提示',
|
||||
btn: ['返回列表', '继续操作'],
|
||||
yes: function(index, layero){
|
||||
location.hash = ns.hash("shop/upload/oss")
|
||||
layer.close(index);
|
||||
},
|
||||
btn2: function(index, layero) {
|
||||
layer.close(index);
|
||||
}
|
||||
});
|
||||
}else{
|
||||
layer.msg(res.message);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function backUploadOss() {
|
||||
location.hash = ns.hash("shop/upload/oss");
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user