chore(docker): 保存关键信息,与Dev分支同步
This commit is contained in:
@@ -140,4 +140,5 @@ volumes:
|
|||||||
networks:
|
networks:
|
||||||
sass-platform-net:
|
sass-platform-net:
|
||||||
name: ${PROJECT_NAME}_${APP_ENV}_net
|
name: ${PROJECT_NAME}_${APP_ENV}_net
|
||||||
driver: bridge
|
driver: bridge
|
||||||
|
external: true
|
||||||
@@ -847,6 +847,45 @@ class Config extends BaseModel
|
|||||||
// return $data;
|
// return $data;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置企业微信配置
|
||||||
|
* @param $data
|
||||||
|
* @param int $site_id
|
||||||
|
* @param string $app_module
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function setWxworkConfig($data, $site_id = 1, $app_module = 'shop')
|
||||||
|
{
|
||||||
|
$config = new ConfigModel();
|
||||||
|
$res = $config->setConfig($data, '企业微信配置', 1, [ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'WXWORK_CONFIG' ] ]);
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取企业微信配置
|
||||||
|
* @param int $site_id
|
||||||
|
* @param string $app_module
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getWxworkConfig($site_id = 1, $app_module = 'shop')
|
||||||
|
{
|
||||||
|
$config = new ConfigModel();
|
||||||
|
$res = $config->getConfig([ [ 'site_id', '=', $site_id ], [ 'app_module', '=', $app_module ], [ 'config_key', '=', 'WXWORK_CONFIG' ] ]);
|
||||||
|
if (empty($res[ 'data' ][ 'value' ])) {
|
||||||
|
$res[ 'data' ][ 'value' ] = [
|
||||||
|
'corp_id' => '',
|
||||||
|
'agent_id' => '',
|
||||||
|
'contact_id' => '',
|
||||||
|
'contact_url' => '',
|
||||||
|
'timestamp' => '',
|
||||||
|
'nonceStr' => '',
|
||||||
|
'signature' => '',
|
||||||
|
'enabled' => false
|
||||||
|
];
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置商品编码设置
|
* 设置商品编码设置
|
||||||
* @param $data
|
* @param $data
|
||||||
|
|||||||
@@ -210,6 +210,32 @@ class Config extends BaseShop
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业微信配置
|
||||||
|
*/
|
||||||
|
public function wxwork()
|
||||||
|
{
|
||||||
|
$config_model = new ConfigModel();
|
||||||
|
if (request()->isJson()) {
|
||||||
|
$data = [
|
||||||
|
'corp_id' => input('corp_id', ''),
|
||||||
|
'agent_id' => input('agent_id', ''),
|
||||||
|
'contact_id' => input('contact_id', ''),
|
||||||
|
'contact_url' => input('contact_url', ''),
|
||||||
|
'timestamp' => input('timestamp', ''),
|
||||||
|
'nonceStr' => input('nonceStr', ''),
|
||||||
|
'signature' => input('signature', ''),
|
||||||
|
'enabled' => input('enabled', 0)
|
||||||
|
];
|
||||||
|
$this->addLog('修改企业微信配置');
|
||||||
|
return $config_model->setWxworkConfig($data, $this->site_id, $this->app_module);
|
||||||
|
} else {
|
||||||
|
$config_result = $config_model->getWxworkConfig($this->site_id, $this->app_module);
|
||||||
|
$this->assign('wxwork_config', $config_result[ 'data' ][ 'value' ]);
|
||||||
|
return $this->fetch('config/wxwork');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 域名跳转配置
|
* 域名跳转配置
|
||||||
*/
|
*/
|
||||||
|
|||||||
146
src/app/shop/view/config/wxwork.html
Normal file
146
src/app/shop/view/config/wxwork.html
Normal file
@@ -0,0 +1,146 @@
|
|||||||
|
<style type="text/css">
|
||||||
|
.inline-block{display: inline-block;}
|
||||||
|
.wxwork-form .layui-form-item{margin-bottom: 20px;}
|
||||||
|
.wxwork-form .layui-input-block{margin-left: 120px;}
|
||||||
|
.wxwork-help{color: #999; font-size: 12px; margin-top: 5px;}
|
||||||
|
</style>
|
||||||
|
|
||||||
|
<div class="layui-form form-wrap wxwork-form">
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">启用状态:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="checkbox" name="enabled" value="1" lay-skin="switch" {if condition="$wxwork_config.enabled == 1" }checked {/if} lay-title="启用|关闭"/>
|
||||||
|
</div>
|
||||||
|
<div class="wxwork-help">开启后,企业微信相关功能将可用</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">企业ID:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="corp_id" autocomplete="off" value="{$wxwork_config.corp_id ?? ''}" class="layui-input len-long">
|
||||||
|
</div>
|
||||||
|
<div class="wxwork-help">
|
||||||
|
<p>企业微信的企业ID,可在企业微信管理后台获取</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">应用ID:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="agent_id" autocomplete="off" value="{$wxwork_config.agent_id ?? ''}" class="layui-input len-long">
|
||||||
|
</div>
|
||||||
|
<div class="wxwork-help">
|
||||||
|
<p>企业微信应用的AgentId,创建应用后获取</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">客服ID:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="contact_id" autocomplete="off" value="{$wxwork_config.contact_id ?? ''}" class="layui-input len-long">
|
||||||
|
</div>
|
||||||
|
<div class="wxwork-help">
|
||||||
|
<p>企业微信客服的ID,用于客服功能</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">活码链接:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="contact_url" autocomplete="off" value="{$wxwork_config.contact_url ?? ''}" class="layui-input len-long">
|
||||||
|
</div>
|
||||||
|
<div class="wxwork-help">
|
||||||
|
<p>企业微信活码的链接地址</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">时间戳:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="timestamp" autocomplete="off" value="{$wxwork_config.timestamp ?? ''}" class="layui-input len-long">
|
||||||
|
</div>
|
||||||
|
<div class="wxwork-help">
|
||||||
|
<p>用于验证的时间戳,通常由系统自动生成</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">随机字符串:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="nonceStr" autocomplete="off" value="{$wxwork_config.nonceStr ?? ''}" class="layui-input len-long">
|
||||||
|
</div>
|
||||||
|
<div class="wxwork-help">
|
||||||
|
<p>用于验证的随机字符串</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="layui-form-item">
|
||||||
|
<label class="layui-form-label">签名:</label>
|
||||||
|
<div class="layui-input-block">
|
||||||
|
<input type="text" name="signature" autocomplete="off" value="{$wxwork_config.signature ?? ''}" class="layui-input len-long">
|
||||||
|
</div>
|
||||||
|
<div class="wxwork-help">
|
||||||
|
<p>用于验证的签名,通常由系统自动生成</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="form-row">
|
||||||
|
<button class="layui-btn" lay-submit lay-filter="save">保存</button>
|
||||||
|
<button type="button" class="layui-btn layui-btn-primary" onclick="window.location.reload()">重置</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
layui.use(['form', 'layer'], function() {
|
||||||
|
var form = layui.form,
|
||||||
|
layer = layui.layer,
|
||||||
|
repeat_flag = false; //防重复标识
|
||||||
|
|
||||||
|
form.render();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监听提交
|
||||||
|
*/
|
||||||
|
form.on('submit(save)', function(data) {
|
||||||
|
if (repeat_flag) return false;
|
||||||
|
repeat_flag = true;
|
||||||
|
|
||||||
|
// 开关值处理
|
||||||
|
data.field.enabled = data.field.enabled ? 1 : 0;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: ns.url("shop/config/wxwork"),
|
||||||
|
data: data.field,
|
||||||
|
dataType: 'JSON',
|
||||||
|
type: 'POST',
|
||||||
|
success: function(res){
|
||||||
|
if(res.code == 0){
|
||||||
|
layer.msg(res.message, {icon: 1});
|
||||||
|
}else{
|
||||||
|
layer.msg(res.message, {icon: 2});
|
||||||
|
}
|
||||||
|
repeat_flag = false;
|
||||||
|
},
|
||||||
|
error: function(){
|
||||||
|
layer.msg('服务器错误', {icon: 2});
|
||||||
|
repeat_flag = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// 启用状态切换时的提示
|
||||||
|
$('input[name="enabled"]').on('change', function() {
|
||||||
|
if($(this).is(':checked')) {
|
||||||
|
// 可以在这里添加启用时的验证提示
|
||||||
|
var corpId = $('input[name="corp_id"]').val();
|
||||||
|
var agentId = $('input[name="agent_id"]').val();
|
||||||
|
|
||||||
|
if(!corpId || !agentId) {
|
||||||
|
layer.msg('请先填写企业ID和应用ID', {icon: 2});
|
||||||
|
$(this).prop('checked', false);
|
||||||
|
form.render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -68,11 +68,12 @@ if ($appEnv) {
|
|||||||
if (is_file($envFile)) {
|
if (is_file($envFile)) {
|
||||||
$app->env->load($envFile);
|
$app->env->load($envFile);
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
|
echo "⚠️ 警告:未设置APP_ENV环境变量,默认使用local环境。\n";
|
||||||
// 3. 为了兼容性,如果存在.env.local也加载(优先级最高)
|
// 3. 为了兼容性,如果存在.env.local也加载(优先级最高)
|
||||||
if (is_file(__DIR__ . '/.env.local')) {
|
if (is_file(__DIR__ . '/.env.local')) {
|
||||||
$app->env->load(__DIR__ . '/.env.local');
|
$app->env->load(__DIR__ . '/.env.local');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 执行HTTP应用并响应
|
// 执行HTTP应用并响应
|
||||||
|
|||||||
10
src/think
10
src/think
@@ -21,12 +21,14 @@ if ($appEnv) {
|
|||||||
if (is_file($envFile)) {
|
if (is_file($envFile)) {
|
||||||
$app->env->load($envFile);
|
$app->env->load($envFile);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
echo "⚠️ 警告:未设置APP_ENV环境变量,默认使用local环境。\n";
|
||||||
|
// 3. 为了兼容性,如果存在.env.local也加载(优先级最高)
|
||||||
|
if (is_file(__DIR__ . '/.env.local')) {
|
||||||
|
$app->env->load(__DIR__ . '/.env.local');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. 为了兼容性,如果存在.env.local也加载(优先级最高)
|
|
||||||
if (is_file(__DIR__ . '/.env.local')) {
|
|
||||||
$app->env->load(__DIR__ . '/.env.local');
|
|
||||||
}
|
|
||||||
|
|
||||||
// 应用初始化
|
// 应用初始化
|
||||||
$app->console->run();
|
$app->console->run();
|
||||||
Reference in New Issue
Block a user