系統:
Linux Cent OS7
環境:
Nginx 1.12
PHP 7.3.18
安裝前准備:
安裝PHP ZipArchive擴展
//默認安裝過程
wget http://pecl.php.net/get/zip tar -zxvf zip cd zip-x.x.x //注意替換為對應版本號 phpize ./configure --with-php-config=/www/server/php/73/bin/php-config //指定對應PHP版本的路徑 make make install
安裝成功后將返回安裝路徑
將路徑配置至php.ini擴展即可
extension=/www/server/php/73/lib/php/extensions/no-debug-non-zts-20180731/zip.so
//錯誤解決 1.Please reinstall the libzip distribution (libzip版本過低,下載新版本即可) yum remove libzip wget https://nih.at/libzip/libzip-xxx.tar.gz tar -zxvf libzip-xxx.tar.gz cd libzip-xxx ./configure make & make install 2.fatal error: zipconf.h: No such file or directory (找不到找不到zipconf.h文件) find /usr/local -iname 'zipconf.h' ln -s /usr/local/lib/libzip/include/zipconf.h /usr/local/include
安裝fileinfo擴展
直接在寶塔后台PHP管理中安裝擴展即可
部署前准備:
1.PHP版本>=7.2
2.安裝EasyWechat
//先更換國內源,已更換的無需此步驟 查看composer配置 composer config -g -l

禁用默認源
composer config -g secure-http
false
更換為國內源
composer config -g repo.packagist composer https:
//mirrors
.aliyun.com
/composer/
//安裝EasyWechat //先刪除舊版本 composer remove overtrue/wechat //若提示Could not read ./composer.json進入項目根目錄即可
//安裝新版本
composer require "overtrue/wechat:^4.2" -vvv
//更新
composer update
3.安裝隊列
composer require topthink/think-queue:v1.1.6 -vvv

application/extra/queue.php中添加 'connector' => 'redis', // 隊列驅動使用 redis 推薦, 可選 database 不推薦 'host' => '', // redis 主機地址 'password' => '', // redis 密碼 'port' => , // redis 端口 'select' => 1, // redis db 庫, 建議顯示指定 1-15 的數字均可,如果緩存驅動是 redis,避免和緩存驅動 select 沖突 'timeout' => 0, // redis 超時時間 'persistent' => false, // redis 持續性,連接復用
4.安裝redis擴展(PHP7.3擴展中安裝即可)
application/config.php 文件中添加 'redis' => [ 'host' => '', // redis 主機地址 'password' => '', // redis 密碼 'port' => , // redis 端口 'select' => 1, // redis 數據庫 'timeout' => 0, // redis 超時時間 'persistent' => false, // redis 持續性,連接復用 ],
5.后端偽靜態配置
//前后端分離部署,建議各自使用一個域名
location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=$1 last; break; } } add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, token, platform' always; add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,HEAD,OPTIONS' always; if ($request_method = OPTIONS ) { return 200; }
6.前端域名偽靜態配置
location / { try_files $uri $uri/ /index.html last; index index.html; } add_header 'Access-Control-Allow-Origin' '*' always; add_header 'Access-Control-Allow-Credentials' 'true' always; add_header 'Access-Control-Allow-Headers' 'Origin, X-Requested-With, Content-Type, Accept, token, platform' always; add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,HEAD,OPTIONS' always; if ($request_method = OPTIONS ) { return 200; }
商城基礎配置:
安裝短信插件:
//根據自己選擇,此處安裝的是阿里雲短信插件
注意若可申請測試簽名 XX商城
添加模板mobilelogin用於短信登錄
安裝富文本編輯器
//按自己喜好安裝即可
前端配置:
因為前端使用的uniapp因此只能在Hbuilder中開發
壓縮包位置/addons/shopro/uniapp/shopro-frontend.zip
解壓后導入到Hbuilder
//Hbuilder需安裝scss/sass編譯插件 點擊工具->插件安裝 找到對應插件安裝即可
安裝完成后
在命令行工具運行(需安裝Node.js,其中包含npm模塊)
npm install
至此即可運行至內置瀏覽器查看商城首頁
完善:
更新請求接口,env.js文件中 api.7wapp.com更換為自己的服務器域名
商城域名更換為自己的域名,否則生成的分享圖片地址都是錯的
點擊發行H5或小程序,將文件上傳至服務器H5域名/發布到小程序等即可
2020-10-07更新
使用新版fastadmin(V1.2.0.20201001)版本時無需配置后台跨域設置,僅保留默認thinkphp的偽靜態即可
在config.php目錄中 Line291 左右(FastAdmin配置)添加前端需要配置跨域的域名即可