1 Star 0 Fork 0

berlin75/yshopsso

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
init.sh 4.99 KB
一键复制 编辑 原始数据 按行查看 历史
berlin75 提交于 2024-01-18 09:20 . docker
#!/bin/sh
#函数库
function getPort() {
port=$1
while [ ! -n $(netstat -ntpl | grep $port) ]
do
((port++))
done
echo $port
}
#初始化脚本
read -p "请填写域名(不填https或http):" domain
read -p "请填写小程序appid:" mini_appid
read -p "请填写小程序secret:" mini_secret
#if [ ! $mini_secret ];then
# read -p "请填写小程序secret:" mini_secret
#fi
read -p "请填写小程序商户id:" mchid
read -p "商户密码:" mchkey
read -p "数据库root密码(回车自动生成):" dbrootpass
if [ ! $dbrootpass ];then
dbrootpass=$(tr -cd '[:alnum:]' </dev/urandom |fold -w15|head -n1)
fi
read -p "数据库密码(回车自动生成):" dbpass
if [ ! $dbpass ];then
dbpass=$(tr -cd '[:alnum:]' </dev/urandom |fold -w15|head -n1)
fi
read -p "数据库用户(默认tuan):" dbuser
if [ ! $dbuser ];then
dbuser='tuan'
fi
read -p "数据库名(默认tuan):" dbname
if [ ! $dbname ];then
dbname='tuan'
fi
read -p "输入短信方式(默认smsbao,可选ali):" smstype
if [ "$smstype" = 'ali' ];then
read -p "短信签名:" sms_sign_name
read -p "阿里短信id:" sms_id
read -p "阿里短信key:" sms_key
read -p "短信模版1(发送验证码)编号:" sms_template1
read -p "短信模版2(团长提货成功)编号:" sms_template2
read -p "短信模版3(用户提货成功)编号:" sms_template3
read -p "短信模版4(快递到店)编号:" sms_template4
read -p "短信模版5(团长提现)编号:" sms_template5
read -p "短信模版6(用户退款)编号:" sms_template6
read -p "短信模版7(邮寄订单支付)编号:" sms_template7
read -p "短信模版8(自提订单支付)编号:" sms_template8
else
read -p "短信宝帐号:" sms_user
read -p "短信宝密码:" sms_pass
fi
read -p "输入快递100key:" kuaidi100
MYSQL_PORT=$(getPort 33060)
NGINX_PORT=$(getPort 8080)
PHPMYADMIN_PORT=$(getPort 8050)
echo "数据库root密码:"$dbrootpass
echo "数据库密码:"$dbpass
echo "MYSQL_PORT:"$MYSQL_PORT
echo "NGINX_PORT:"$NGINX_PORT
echo "PHPMYADMIN_PORT:"$PHPMYADMIN_PORT
read -p "按任意键键继续"
#复制docker环境文件并配置
cp .envb .env
echo "已经生成配置文件.env"
sed -i "s/MYSQL_PORT=/MYSQL_PORT=$MYSQL_PORT/g" .env
sed -i "s/NGINX_PORT=/NGINX_PORT=$NGINX_PORT/g" .env
sed -i "s/PHPMYADMIN_PORT=/PHPMYADMIN_PORT=$PHPMYADMIN_PORT/g" .env
sed -i "s/MYSQL_ROOT_PASSWORD=/MYSQL_ROOT_PASSWORD=$dbrootpass/g" .env
sed -i "s/MYSQL_USER=/MYSQL_USER=$dbuser/g" .env
sed -i "s/MYSQL_DATABASE=/MYSQL_DATABASE=$dbname/g" .env
sed -i "s/MYSQL_PASSWORD=/MYSQL_PASSWORD=$dbpass/g" .env
#sed -i "s/\[mysql_database\]/$dbname/g" ./services/mysql/init.sql
#配置项目文件
cp ./app/application/config.phpb ./app/application/config.php
sed -i "s/\[mini_appid\]/$mini_appid/g" ./app/application/config.php
sed -i "s/\[mini_secret\]/$mini_secret/g" ./app/application/config.php
sed -i "s/\[mchid\]/$mchid/g" ./app/application/config.php
sed -i "s/\[mchkey\]/$mchkey/g" ./app/application/config.php
sed -i "s/\[smstype\]/$smstype/g" ./app/application/config.php
sed -i "s/\[domain\]/$domain/g" ./app/application/config.php
sed -i "s/\[kuaidi100\]/$kuaidi100/g" ./app/application/config.php
if [ "$smstype" = 'ali' ];then
sed -i "s/\[sms_sign_name\]/$sms_sign_name/g" ./app/application/config.php
sed -i "s/\[sms_id\]/$sms_id/g" ./app/application/config.php
sed -i "s/\[sms_key\]/$sms_key/g" ./app/application/config.php
sed -i "s/\[sms_template1\]/$sms_template1/g" ./app/application/config.php
sed -i "s/\[sms_template2\]/$sms_template2/g" ./app/application/config.php
sed -i "s/\[sms_template3\]/$sms_template3/g" ./app/application/config.php
sed -i "s/\[sms_template4\]/$sms_template4/g" ./app/application/config.php
sed -i "s/\[sms_template5\]/$sms_template5/g" ./app/application/config.php
sed -i "s/\[sms_template6\]/$sms_template6/g" ./app/application/config.php
sed -i "s/\[sms_template7\]/$sms_template7/g" ./app/application/config.php
sed -i "s/\[sms_template8\]/$sms_template8/g" ./app/application/config.php
else
sed -i "s/\[sms_user\]/$sms_user/g" ./app/application/config.php
sed -i "s/\[sms_pass\]/$sms_pass/g" ./app/application/config.php
fi
cp ./app/application/database.phpb ./app/application/database.php
sed -i "s/\[database\]/$dbname/g" ./app/application/database.php
sed -i "s/\[username\]/$dbuser/g" ./app/application/database.php
sed -i "s/\[password\]/$dbpass/g" ./app/application/database.php
cp ./app/public/youxuan/statistics/js/common.jsb ./app/public/youxuan/statistics/js/common.js
sed -i "s/\[domain\]/$domain/g" ./app/public/youxuan/statistics/js/common.js
cp ./app/extend/WxpayAPI/lib/WxPay.Config.phpb ./app/extend/WxpayAPI/lib/WxPay.Config.php
sed -i "s/\[mini_appid\]/$mini_appid/g" ./app/extend/WxpayAPI/lib/WxPay.Config.php
sed -i "s/\[mini_secret\]/$mini_secret/g" ./app/extend/WxpayAPI/lib/WxPay.Config.php
sed -i "s/\[mchid\]/$mchid/g" ./app/extend/WxpayAPI/lib/WxPay.Config.php
sed -i "s/\[mchkey\]/$mchkey/g" ./app/extend/WxpayAPI/lib/WxPay.Config.php
read -p "按任意键键继续"
docker-compose up -d --build
docker ps
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/berlin75/yshopsso.git
git@gitee.com:berlin75/yshopsso.git
berlin75
yshopsso
yshopsso
master

搜索帮助