mirror of
https://gitee.com/ShopeX/ECShopX
synced 2026-08-08 12:55:32 +08:00
139
docs/docs/_book_deploy_prepare_amore_open_weixin.md
Normal file
139
docs/docs/_book_deploy_prepare_amore_open_weixin.md
Normal file
@@ -0,0 +1,139 @@
|
||||
---
|
||||
url: _book_deploy_prepare_amore_open_weixin
|
||||
---
|
||||
|
||||
# 微信开放平台-第三方平台配置
|
||||
|
||||
<a name="b66b8eaa"></a>
|
||||
## 注册微信平台账号
|
||||
|
||||
[注册微信平台注册](https://open.weixin.qq.com/cgi-bin/readtemplate?t=regist/regist_tmpl&lang=zh_CN)
|
||||
|
||||
<a name="d7b8487d"></a>
|
||||
## 开发者资质认证
|
||||
|
||||
[第三方平台申请流程](https://open.weixin.qq.com/cgi-bin/frame?t=home/wx_plugin_tmpl&lang=zh_CN)
|
||||
|
||||
点击`开发者资质认证`, 并进行认证.
|
||||
|
||||
> 开发者资质认证介绍
|
||||
|
||||
> 微信开放平台帐号的开发者资质认证提供更安全、更严格的真实性认证、也能够更好的保护企业及用户的合法权益<br />
|
||||
开发者资质认证通过后,微信开放平台帐号下的应用,将获得微信登录、智能接口、第三方平台开发等高级能力<br />
|
||||
审核费用:中国大陆地区:300元,非中国大陆地区:99美元
|
||||
|
||||
|
||||
认证时间大概2-3天, 已微信实际认证时间为准
|
||||
|
||||
<a name="bcce70b7"></a>
|
||||
## 创建第三方平台
|
||||
|
||||
管理中心->第三方平台
|
||||
|
||||
|
||||
点击`创建第三方平台`
|
||||
|
||||
<a name="a2890803"></a>
|
||||
## 输入基本信息
|
||||
|
||||
平台类型选择`平台型服务商`
|
||||
|
||||
|
||||
<a name="b17be281"></a>
|
||||
## 选择权限
|
||||
|
||||
公众号权限
|
||||
|
||||
小程序权限
|
||||
|
||||
|
||||
<a name="eeac4e56"></a>
|
||||
## 填写开发资料
|
||||
|
||||
为了表述方便, 下文将以源源客正式站站为例.
|
||||
|
||||
websocket地址: **dev-websocket-wmp.amorepacific.com.cn**
|
||||
|
||||
授权流程相关
|
||||
|
||||
- 授权发起页域名: dev-wmp.amorepacific.com.cn
|
||||
|
||||
> 必须从本域名内网页跳转到登录授权页,才可完成登录授权。无需填写`http://等域名协议前缀`
|
||||
|
||||
|
||||
- 授权测试公众号列表: ghhh_fff6479ae2c8;gh_7bc47f612ba6
|
||||
|
||||
> 在全网发布之前,仅该列表内公众号才可进行授权,以便测试。请填写公众号的原始ID(可在公众平台网站的公众号设置页找到),最多10个,以英文“;”隔开。
|
||||
|
||||
|
||||
- 授权事件接收URL: dev-wmp.amorepacific.com.cn/wechatAuth/events
|
||||
|
||||
::: danger
|
||||
**url前缀**选择https
|
||||
:::
|
||||
|
||||
> 用于接收取消授权通知、授权成功通知、授权更新通知,也用于接收ticket,ticket是验证平台方的重要凭据。
|
||||
|
||||
|
||||
授权后实现业务
|
||||
|
||||
- 消息校验Token: qwn2995ktj024
|
||||
|
||||
> 开发者在代替公众号或小程序接收到消息时,用此Token来校验消息。
|
||||
|
||||
|
||||
::: danger
|
||||
**消息校验Token**前后, 绝不能有空格
|
||||
:::
|
||||
|
||||
- 消息加解密Key: sklfjkfgeiawwwqvn65997wlj01ndnfoqoe8x2k0nck
|
||||
|
||||
> 在代替公众号或小程序收发消息过程中使用。必须是长度为43位的字符串,只能是字母和数字。
|
||||
|
||||
|
||||
::: danger
|
||||
**消息加解密Key**前后, 绝不能有空格. 长度必须43位
|
||||
:::
|
||||
|
||||
- 消息与事件接收URL: dev-wmp.amorepacific.com.cn/wechatAuth/callback/$APPID$
|
||||
|
||||
::: danger
|
||||
**url前缀**选择https
|
||||
:::
|
||||
|
||||
> 通过该URL接收公众号或小程序消息和事件推送,该参数按规则填写(需包含/$APPID$,如www.abc.com/$APPID$/callback),实际接收消息时$APPID$将被替换为公众号或小程序AppId。
|
||||
|
||||
|
||||
- 公众号开发域名: dev-wmp.amorepacific.com.cn
|
||||
|
||||
> 第三方平台在代公众号做网页授权、调用JS SDK等网页开发工作时所用的域名,以;隔开。为了满足开发者管理需要,符合以下要求的下级域名也将生效:$APPID$.wx.abc.com($APPID$为公众号的AppID的替换符)<br />
|
||||
请**下载校验文件**,并将文件放置在域名根目录下,例如wx.qq.com,并确保可以访问该文件。<br />
|
||||
每月可提交修改申请3次,本月有3次机会
|
||||
|
||||
|
||||
- 小程序服务器域名: dev-wmp.amorepacific.com.cn;dev-websocket-wmp.amorepacific.com.cn;mmbiz.qpic.cn;wx.qlogo.cn;
|
||||
|
||||
> 第三方平台旗下授权的小程序,只可配置本平台服务器域名列表中的域名,以;隔开。<br />
|
||||
每月可提交修改申请3次,本月有2次机会
|
||||
|
||||
|
||||
::: info
|
||||
需要访问的小程序服务器域名, 同时需要后端接口**dev-wmp.amorepacific.com.cn** 和 websocket服务: **dev-websocket-wmp.amorepacific.com.cn**
|
||||
:::
|
||||
|
||||
- 小程序业务域名:
|
||||
|
||||
> 请**下载校验文件**,并将文件放置在域名根目录下,例如wx.qq.com,并确保可以访问该文件。<br />
|
||||
每月可提交修改申请3次,本月有3次机会
|
||||
|
||||
|
||||
其他
|
||||
|
||||
- 白名单IP地址列表: 40.73.103.142
|
||||
|
||||
> 仅当开发者IP地址在该列表中时,才被允许调用相关接口。最多填写100个IP地址,以英文“;”隔开。
|
||||
|
||||
|
||||
::: info
|
||||
服务器出口ip地址, 如果是vpc. 否则访问微信接口会被拒
|
||||
:::
|
||||
8
docs/docs/_book_deploy_prepare_appoint.md
Normal file
8
docs/docs/_book_deploy_prepare_appoint.md
Normal file
@@ -0,0 +1,8 @@
|
||||
---
|
||||
url: _book_deploy_prepare_appoint
|
||||
---
|
||||
|
||||
# 约定
|
||||
|
||||
- 部署文档以源源客官方平台作为例子, 域名为: yuanyuanke.cn
|
||||
-
|
||||
17
docs/docs/_book_deploy_prepare_license.md
Normal file
17
docs/docs/_book_deploy_prepare_license.md
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
url: _book_deploy_prepare_license
|
||||
---
|
||||
|
||||
# 域名备案
|
||||
|
||||
如果由商派提供采购阿里云服务器, 可以选用我们的备案服务.
|
||||
|
||||
<a name="61fe3c73"></a>
|
||||
## 阿里云备案
|
||||
|
||||
[阿里云备案](https://beian.aliyun.com)
|
||||
|
||||
<a name="eebf8b79"></a>
|
||||
## 腾讯云备案
|
||||
|
||||
[腾讯云备案](https://cloud.tencent.com/product/ba)
|
||||
14
docs/docs/_book_deploy_prepare_readme.md
Normal file
14
docs/docs/_book_deploy_prepare_readme.md
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
url: _book_deploy_prepare_readme
|
||||
---
|
||||
|
||||
# README.md
|
||||
|
||||
---
|
||||
|
||||
|
||||
<a name="fb3745ce"></a>
|
||||
## description: Shortcut keys allows an easy and quick method for navigating or editing con
|
||||
|
||||
<a name="88210852"></a>
|
||||
# 准备工作
|
||||
29
docs/docs/_book_framework_bundle_database-orm.md
Normal file
29
docs/docs/_book_framework_bundle_database-orm.md
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
url: _book_framework_bundle_database-orm
|
||||
---
|
||||
|
||||
# Doctrine ORM
|
||||
|
||||
<a name="7c4747a5"></a>
|
||||
## 什么是 ORM ?
|
||||
|
||||
ORM 是 Object-Relation Mapping (对象-关系映射)的简称,是随着面向对象的软件开发方法发展而产生的。<br />
|
||||
Doctrine ORM 是 PHP 的对象关系映射器(ORM),可以将PHP对象持久化到数据库中。它以Data Mapper模式为核心,旨在将您的业务逻辑与数据库中的持久化完全分离。
|
||||
|
||||
ORM 主要做了两件事:
|
||||
|
||||
- ORM 使用对象,封装了数据库操作,因此可以不碰 SQL 语言就可以从数据库获取数据
|
||||
- ORM 将数据库映射为对象,或将对象持久化到数据库
|
||||
|
||||
ORM 把数据库映射成对象关系如下:
|
||||
|
||||
- 数据库的表(table) --> 类(class)
|
||||
- 记录(record,行数据)--> 对象(object)
|
||||
- 字段(field)--> 对象的属性(attribute)
|
||||
|
||||
<a name="03b5410c"></a>
|
||||
## 如何使用 Doctrine ORM ?
|
||||
|
||||
PHP 数据对象(PDO)扩展为PHP访问数据库定义了一个轻量级的一致接口,通过此扩展从数据库获取数据其结果集为一个数组。
|
||||
|
||||
在 ECOS 中,我们也对数据访问做了封装,可以通过 model 去获取数据,其结果也是也是一个数组,程序员通过 model 获取一个结果后,即可针对这个结果的数组做相关的业务处理。
|
||||
6
docs/docs/_book_framework_bundle_database-relations.md
Normal file
6
docs/docs/_book_framework_bundle_database-relations.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
url: _book_framework_bundle_database-relations
|
||||
---
|
||||
|
||||
# 数据库和 Doctrine ORM
|
||||
|
||||
14
docs/docs/_book_framework_standard-base.md
Normal file
14
docs/docs/_book_framework_standard-base.md
Normal file
@@ -0,0 +1,14 @@
|
||||
---
|
||||
url: _book_framework_standard-base
|
||||
---
|
||||
|
||||
# 规范
|
||||
|
||||
<a name="91b5047d"></a>
|
||||
## 代码规范
|
||||
|
||||
<a name="f895fc53"></a>
|
||||
## 数据库升级
|
||||
|
||||
<a name="918ded58"></a>
|
||||
## 业务规范
|
||||
81
docs/docs/_book_summary_1.md
Normal file
81
docs/docs/_book_summary_1.md
Normal file
@@ -0,0 +1,81 @@
|
||||
---
|
||||
url: _book_summary_1
|
||||
---
|
||||
|
||||
# SUMMARY_1.md
|
||||
|
||||
-
|
||||
[介绍](_book_README)
|
||||
|
||||
-
|
||||
[技术说明](_book_technical)
|
||||
|
||||
-
|
||||
系统部署
|
||||
|
||||
-
|
||||
准备工作
|
||||
|
||||
-
|
||||
[域名](_book_deploy_prepare_domain)
|
||||
|
||||
-
|
||||
[七牛](_book_deploy_prepare_qiniu)
|
||||
|
||||
-
|
||||
[微信开放平台第三方平台申请](_book_deploy_prepare_open_weixin)
|
||||
|
||||
-
|
||||
[域名备案](_book_deploy_prepare_domain_record)
|
||||
|
||||
-
|
||||
[服务器方案](_book_deploy_prepare_solution)
|
||||
|
||||
-
|
||||
[支付申请]
|
||||
|
||||
-
|
||||
[腾讯位置服务](_book_deploy_prepare_lbs)
|
||||
|
||||
-
|
||||
[ECShopX授权](_book_deplloy_prepare_license)
|
||||
|
||||
-
|
||||
短信方案
|
||||
|
||||
-
|
||||
物流跟踪
|
||||
|
||||
-
|
||||
客服工具
|
||||
|
||||
-
|
||||
微信小程序支付
|
||||
|
||||
-
|
||||
商品初始化/模版初始化
|
||||
|
||||
-
|
||||
部署方案
|
||||
|
||||
- [单机部署方案](_book_deploy_install)
|
||||
- [集群部署方案](_book_deploy_cluster_install)
|
||||
-
|
||||
框架
|
||||
|
||||
- 目录结构
|
||||
- 队列
|
||||
- orm
|
||||
-
|
||||
-
|
||||
快速入门
|
||||
|
||||
-
|
||||
API文档
|
||||
|
||||
-
|
||||
数据辞典
|
||||
|
||||
-
|
||||
数据库migration规则
|
||||
|
||||
287
docs/docs/_book_test.md
Normal file
287
docs/docs/_book_test.md
Normal file
@@ -0,0 +1,287 @@
|
||||
---
|
||||
url: _book_test
|
||||
---
|
||||
|
||||
# Laravel Cashier
|
||||
|
||||
- [Introduction](_book_billing.md#introduction)
|
||||
- [Configuration](_book_billing.md#configuration)
|
||||
- [Subscribing To A Plan](_book_billing.md#subscribing-to-a-plan)
|
||||
- [No Card Up Front](_book_billing.md#no-card-up-front)
|
||||
- [Swapping Subscriptions](_book_billing.md#swapping-subscriptions)
|
||||
- [Subscription Quantity](_book_billing.md#subscription-quantity)
|
||||
- [Cancelling A Subscription](_book_billing.md#cancelling-a-subscription)
|
||||
- [Resuming A Subscription](_book_billing.md#resuming-a-subscription)
|
||||
- [Checking Subscription Status](_book_billing.md#checking-subscription-status)
|
||||
- [Handling Failed Payments](_book_billing.md#handling-failed-payments)
|
||||
- [Invoices](_book_billing.md#invoices)
|
||||
|
||||
<a name="Introduction"></a>
|
||||
## Introduction
|
||||
|
||||
Laravel Cashier provides an expressive, fluent interface to [Stripe's](https://stripe.com) subscription billing services. It handles almost all of the boilerplate subscription billing code you are dreading writing. In addition to basic subscription management, Cashier can handle coupons, swapping subscription, subscription "quantites", cancellation grace periods, and even generate invoice PDFs.
|
||||
|
||||
<a name="Configuration"></a>
|
||||
## Configuration
|
||||
|
||||
<a name="Composer"></a>
|
||||
### Composer
|
||||
|
||||
First, add the Cashier package to your `composer.json` file:
|
||||
|
||||
```
|
||||
"laravel/cashier": "~2.0"
|
||||
```
|
||||
|
||||
<a name="508a05a7"></a>
|
||||
### Service Provider
|
||||
|
||||
Next, register the `Laravel\Cashier\CashierServiceProvider` in your `app` configuration file.
|
||||
|
||||
<a name="Migration"></a>
|
||||
### Migration
|
||||
|
||||
Before using Cashier, we'll need to add several columns to your database. Don't worry, you can use the `cashier:table` Artisan command to create a migration to add the necessary column. Once the migration has been created, simply run the `migrate` command.
|
||||
|
||||
<a name="d29b2496"></a>
|
||||
### Model Setup
|
||||
|
||||
Next, add the BillableTrait and appropriate date mutators to your model definition:
|
||||
|
||||
```
|
||||
use Laravel\Cashier\BillableTrait;
|
||||
use Laravel\Cashier\BillableInterface;
|
||||
|
||||
class User extends Eloquent implements BillableInterface {
|
||||
|
||||
use BillableTrait;
|
||||
|
||||
protected $dates = ['trial_ends_at', 'subscription_ends_at'];
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
<a name="7e3f1d72"></a>
|
||||
### Stripe Key
|
||||
|
||||
Finally, set your Stripe key in one of your bootstrap files:
|
||||
|
||||
```
|
||||
User::setStripeKey('stripe-key');
|
||||
```
|
||||
|
||||
<a name="37762da0"></a>
|
||||
## Subscribing To A Plan
|
||||
|
||||
Once you have a model instance, you can easily subscribe that user to a given Stripe plan:
|
||||
|
||||
```
|
||||
$user = User::find(1);
|
||||
|
||||
$user->subscription('monthly')->create($creditCardToken);
|
||||
```
|
||||
|
||||
If you would like to apply a coupon when creating the subscription, you may use the `withCoupon` method:
|
||||
|
||||
```
|
||||
$user->subscription('monthly')
|
||||
->withCoupon('code')
|
||||
->create($creditCardToken);
|
||||
```
|
||||
|
||||
The `subscription` method will automatically create the Stripe subscription, as well as update your database with Stripe customer ID and other relevant billing information.
|
||||
|
||||
If your plan has a trial period, make sure to set the trial end date on your model after subscribing:
|
||||
|
||||
```
|
||||
$user->trial_ends_at = Carbon::now()->addDays(14);
|
||||
|
||||
$user->save();
|
||||
```
|
||||
|
||||
<a name="5283bb22"></a>
|
||||
## No Card Up Front
|
||||
|
||||
If your application offers a free-trial with no credit-card up front, set the `cardUpFront` property on your model to `false`:
|
||||
|
||||
```
|
||||
protected $cardUpFront = false;
|
||||
```
|
||||
|
||||
On account creation, be sure to set the trial end date on the model:
|
||||
|
||||
```
|
||||
$user->trial_ends_at = Carbon::now()->addDays(14);
|
||||
|
||||
$user->save();
|
||||
```
|
||||
|
||||
<a name="d008f056"></a>
|
||||
## Swapping Subscriptions
|
||||
|
||||
To swap a user to a new subscription, use the `swap` method:
|
||||
|
||||
```
|
||||
$user->subscription('premium')->swap();
|
||||
```
|
||||
|
||||
If the user is on trial, the trial will be maintained as normal. Also, if a "quantity" exists for the subscription, that quantity will also be maintained.
|
||||
|
||||
<a name="0d519501"></a>
|
||||
## Subscription Quantity
|
||||
|
||||
Sometimes subscriptions are affected by "quantity". For example, your application might charge $10 per month per user on an account. To easily increment or decrement your subscription quantity, use the `increment` and `decrement` methods:
|
||||
|
||||
```
|
||||
$user = User::find(1);
|
||||
|
||||
$user->subscription()->increment();
|
||||
|
||||
// Add five to the subscription's current quantity...
|
||||
$user->subscription()->increment(5)
|
||||
|
||||
$user->subscription->decrement();
|
||||
|
||||
// Subtract five to the subscription's current quantity...
|
||||
$user->subscription()->decrement(5)
|
||||
```
|
||||
|
||||
<a name="d184d833"></a>
|
||||
## Cancelling A Subscription
|
||||
|
||||
Cancelling a subscription is a walk in the park:
|
||||
|
||||
```
|
||||
$user->subscription()->cancel();
|
||||
```
|
||||
|
||||
When a subscription is cancelled, Cashier will automatically set the `subscription_ends_at` column on your database. This column is used to know when the `subscribed` method should begin returning `false`. For example, if a customer cancels a subscription on March 1st, but the subscription was not scheduled to end until March 5th, the `subscribed` method will continue to return `true` until March 5th.
|
||||
|
||||
<a name="b57077dd"></a>
|
||||
## Resuming A Subscription
|
||||
|
||||
If a user has cancelled their subscription and you wish to resume it, use the `resume` method:
|
||||
|
||||
```
|
||||
$user->subscription('monthly')->resume($creditCardToken);
|
||||
```
|
||||
|
||||
If the user cancels a subscription and then resumes that subscription before the subscription has fully expired, they will not be billed immediately. Their subscription will simply be re-activated, and they will be billed on the original billing cycle.
|
||||
|
||||
<a name="acd03e95"></a>
|
||||
## Checking Subscription Status
|
||||
|
||||
To verify that a user is subscribed to your application, use the `subscribed` command:
|
||||
|
||||
```
|
||||
if ($user->subscribed())
|
||||
{
|
||||
//
|
||||
}
|
||||
```
|
||||
|
||||
The `subscribed` method makes a great candidate for a route filter:
|
||||
|
||||
```
|
||||
Route::filter('subscribed', function()
|
||||
{
|
||||
if (Auth::user() && ! Auth::user()->subscribed())
|
||||
{
|
||||
return Redirect::to('billing');
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
You may also determine if the user is still within their trial period (if applicable) using the `onTrial` method:
|
||||
|
||||
```
|
||||
if ($user->onTrial())
|
||||
{
|
||||
//
|
||||
}
|
||||
```
|
||||
|
||||
To determine if the user was once an active subscriber, but has cancelled their subscription, you may use the `cancelled` method:
|
||||
|
||||
```
|
||||
if ($user->cancelled())
|
||||
{
|
||||
//
|
||||
}
|
||||
```
|
||||
|
||||
You may also determine if a user has cancelled their subscription, but are still on their "grace period" until the subscription fully expires. For example, if a user cancels a subscription on March 5th that was scheduled to end on March 10th, the user is on their "grace period" until March 10th. Note that the `subscribed` method still returns `true` during this time.
|
||||
|
||||
```
|
||||
if ($user->onGracePeriod())
|
||||
{
|
||||
//
|
||||
}
|
||||
```
|
||||
|
||||
The `everSubscribed` method may be used to determine if the user has ever subscribed to a plan in your application:
|
||||
|
||||
```
|
||||
if ($user->everSubscribed())
|
||||
{
|
||||
//
|
||||
}
|
||||
```
|
||||
|
||||
<a name="9a5b8dde"></a>
|
||||
## Handling Failed Payments
|
||||
|
||||
What if a customer's credit card expires? No worries - Cashier includes a Webhook controller that can easily cancel the customer's subscription for you. Just point a route to the controller:
|
||||
|
||||
```
|
||||
Route::post('stripe/webhook', 'Laravel\Cashier\WebhookController@handleWebhook');
|
||||
```
|
||||
|
||||
That's it! Failed payments will be captured and handled by the controller. The controller will cancel the customer's subscription after three failed payment attempts. The `stripe/webhook` URI in this example is just for example. You will need to configure the URI in your Stripe settings.
|
||||
|
||||
If you have additional Stripe webhook events you would like to handle, simply extend the Webhook controller:
|
||||
|
||||
```
|
||||
class WebhookController extends Laravel\Cashier\WebhookController {
|
||||
|
||||
public function handleWebhook()
|
||||
{
|
||||
// Handle other events...
|
||||
|
||||
// Fallback to failed payment check...
|
||||
return parent::handleWebhook();
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
> **Note:** In addition to updating the subscription information in your database, the Webhook controller will also cancel the subscription via the Stripe API.
|
||||
|
||||
|
||||
<a name="Invoices"></a>
|
||||
## Invoices
|
||||
|
||||
You can easily retrieve an array of a user's invoices using the `invoices` method:
|
||||
|
||||
```
|
||||
$invoices = $user->invoices();
|
||||
```
|
||||
|
||||
When listing the invoices for the customer, you may use these helper methods to display the relevant invoice information:
|
||||
|
||||
```
|
||||
{{ $invoice->id }}
|
||||
|
||||
{{ $invoice->dateString() }}
|
||||
|
||||
{{ $invoice->dollars() }}
|
||||
```
|
||||
|
||||
Use the `downloadInvoice` method to generate a PDF download of the invoice. Yes, it's really this easy:
|
||||
|
||||
```
|
||||
return $user->downloadInvoice($invoice->id, [
|
||||
'vendor' => 'Your Company',
|
||||
'product' => 'Your Product',
|
||||
]);
|
||||
```
|
||||
37
docs/docs/ad1v2f.md
Normal file
37
docs/docs/ad1v2f.md
Normal file
@@ -0,0 +1,37 @@
|
||||
---
|
||||
url: ad1v2f
|
||||
---
|
||||
|
||||
# API控制器规范
|
||||
|
||||
<a name="70ea3b94"></a>
|
||||
## 资源控制器
|
||||
|
||||
<br />**必须** 优先使用 [Restful 资源控制器](http://learnku.com/docs/laravel/5.5/controllers#restful-resource-controllers) 。<br />
|
||||
|
||||
<a name="972987d4"></a>
|
||||
## 单数 or 复数?
|
||||
|
||||
<br />**必须** 使用资源的复数形式,如:<br />
|
||||
|
||||
> - 类名:PhotosController
|
||||
> - 文件名:PhotosController.php
|
||||
|
||||
|
||||
<br />错误的例子:<br />
|
||||
|
||||
> - 类名:PhotoController
|
||||
> - 文件名:PhotoController.php
|
||||
|
||||
|
||||
|
||||
<a name="c98bd870"></a>
|
||||
## 保持短小精炼
|
||||
|
||||
<br />**必须** 保持控制器文件代码行数最小化,还有可读性。<br />
|
||||
|
||||
- **不应该** 为「方法」书写注释,这要求方法取名要足够合理,不需要过多注释;
|
||||
- **应该** 为一些复杂的逻辑代码块书写注释,主要介绍产品逻辑 - `为什么要这么做。`;
|
||||
- **不应该** 在控制器中书写「私有方法」,控制器里 `应该` 只存放「路由动作方法」;
|
||||
- **绝不** 遗留「死方法」,就是没有用到的方法,控制器里的所有方法,都应该被使用到,否则应该删除;
|
||||
- **绝不** 在控制器里批量注释掉代码,无用的逻辑代码就必须清除掉。
|
||||
925
docs/docs/baota_install.md
Normal file
925
docs/docs/baota_install.md
Normal file
@@ -0,0 +1,925 @@
|
||||
## 约定
|
||||
|
||||
- 操作系统:Centos 7.x x64
|
||||
- 操作权限:root
|
||||
- 宝塔面板:[宝塔Linux面板 7.9](https://www.bt.cn/bbs/thread-19376-1-1.html)
|
||||
- 以下安装仅供参考,也可自行安装,关键配置对照文档即可。
|
||||
|
||||
## 软件版本清单
|
||||
|
||||
- supervisorctl > 2.0
|
||||
- mysql 5.7或者更高版本
|
||||
- nginx
|
||||
- node = 16.16.0 & 20.19.0(PC商城必须)
|
||||
- redis > 4.0
|
||||
- php 8.2
|
||||
|
||||
## 文档示例中主要配置展示
|
||||
|
||||
**注意:根据实际情况修改对应目录、域名、数据库配置、redis配置、其他配置等等!**
|
||||
|
||||
**如果使用小程序,域名一定是要https协议的,所以参照文档的时候,注意跳转http、https等是否一致**
|
||||
|
||||
***生产环境一定要全部用https协议*,这里ecshopx.demo.com是我绑定了本地hosts来使用,所以如果没有域名,也可以这样做绑定本地hosts吧。**
|
||||
|
||||
```bash
|
||||
● 测试域名
|
||||
ecshopx.demo.com
|
||||
● 测试H5域名
|
||||
ecshopx-h5.demo.com
|
||||
● 代码主目录
|
||||
/www/wwwroot/ecshopx.demo.com
|
||||
● php代码目录
|
||||
/www/wwwroot/ecshopx.demo.com/ECShopX
|
||||
● 管理后台代码目录
|
||||
/www/wwwroot/ecshopx.demo.com/ECShopX_admin-frontend
|
||||
● H5代码目录
|
||||
/www/wwwroot/ecshopx.demo.com/ECShopX_mobile-frontend
|
||||
● PC代码目录
|
||||
/www/wwwroot/ecshopx.demo.com/ECShopX_desktop-frontend
|
||||
● php的配置文件位置
|
||||
/www/wwwroot/ecshopx.demo.com/ECShopX_-frontend/.env
|
||||
```
|
||||
|
||||
## 安装宝塔Linux面板
|
||||
|
||||
本文档编写时基于宝塔Linux面板 7.9.1版本,本文不做宝塔面板本身的安装教程。具体可以点击下面链接参照宝塔官方文档安装宝塔面板,并且需要按照宝塔的要求进行基础设施搭建
|
||||
|
||||
[https://www.bt.cn/bbs/thread-19376-1-1.html](https://www.bt.cn/bbs/thread-19376-1-1.html)
|
||||
|
||||
> **附宝塔安装要求(摘自官方):**
|
||||
>
|
||||
> 内存:512M以上,推荐768M以上(纯面板约占系统60M内存)
|
||||
>
|
||||
> 硬盘:300M以上可用硬盘空间(纯面板约占20M磁盘空间)
|
||||
>
|
||||
> 系统:CentOS 7.1+ (Ubuntu16.04+.、Debian9.0+),**确保是干净的操作系统,没有安装过其它环境带的Apache/Nginx/php/MySQL/pgsql/gitlab/java(已有环境不可安装)**
|
||||
>
|
||||
> 架构:x86_64(主流服务器均是此架构),ARM不完整兼容(面板环境安装慢,部分软件可能安装不上)
|
||||
|
||||
## 基础软件部署
|
||||
|
||||
### 安装PHP-8.2
|
||||

|
||||
|
||||
### 安装扩展fileinfo
|
||||
composer install 的时候需要这个php扩展,在php管理面板中安装此扩展,并重启php
|
||||
|
||||

|
||||
|
||||
### 删除部分php被禁用函数
|
||||
在php管理面板中的`禁用函数`菜单中删除以下被禁用函数
|
||||
|
||||
> `putenv`
|
||||
>
|
||||
> `shell_exec`
|
||||
>
|
||||
> `<font style="color:rgb(51, 51, 51);">symlink</font>`
|
||||
>
|
||||
> `proc_open`
|
||||
>
|
||||
> `pcntl_alarm`
|
||||
>
|
||||
> `pcntl_fork`
|
||||
>
|
||||
> `pcntl_wait`
|
||||
>
|
||||
> `pcntl_signal`
|
||||
>
|
||||
> `pcntl_signal_dispatch`
|
||||
|
||||
### 安装composer
|
||||
|
||||
> 默认composer源网站是在国外,国内访问速度慢,这里换成国内的阿里云的composer镜像源
|
||||
|
||||
在终端中执行以下命令安装php的包管理工具 composer
|
||||
|
||||

|
||||
|
||||
```bash
|
||||
curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/bin --filename=composer
|
||||
/usr/bin/composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
|
||||
```
|
||||
|
||||
安装好后在终端中执行以下命令检查是否安装好
|
||||
|
||||
### 安装Nginx
|
||||
|
||||
> 本文选择的是nginx1.20版本
|
||||
|
||||

|
||||
|
||||
### 安装MySQL
|
||||
|
||||
> 本文选择的是mysql5.7.37版本,一般mysql8.0也是可以的
|
||||
|
||||

|
||||
|
||||
### 添加数据库
|
||||
|
||||
在宝塔面板`**数据库**`中,点击`**添加数据库**`**,**填写对应的数据库名、用户名、密码,字符编码选择 `**utf8mb4**`**,**添加好数据库后,安装应用的时候需要配置进去,所以需要记下来对应配置
|
||||
|
||||

|
||||
|
||||
例如我们这里设置成`数据库名:ecshopx,用户名:ecshopx,密码:ecshopx123`
|
||||
|
||||
### 安装phpMyAdmin
|
||||
|
||||
> 本文选择的是phpMyAdmin 5.0.0 Stable版本,宝塔默认通过phpmyadmin管理mysql
|
||||
|
||||

|
||||
|
||||
### 安装Redis
|
||||
|
||||
> 本文选择的是redis 6.2.6版本
|
||||
|
||||

|
||||
|
||||
修改redis密码
|
||||
|
||||
打开redis管理界面,点击`配置文件`,搜索 `requirepass`,取消这一行的注释,然后修改redis密码
|
||||
|
||||
|
||||

|
||||
例如我们修改为
|
||||
|
||||
```bash
|
||||
requirepass 123456
|
||||
```
|
||||
|
||||
然后保存并重启redis
|
||||
|
||||
### 安装Supervisor管理器
|
||||
|
||||
本文选选择的是supervisor 2.2版本
|
||||
|
||||

|
||||
|
||||
### 安装nodejs
|
||||
|
||||
本文选择的是PM2管理器2,node.js管理器,内置 node.js + npm + nvm + pm2.!
|
||||
|
||||

|
||||
|
||||
在宝塔后台修改node版本,建议在宝塔后台选择版本,下文还有终端修改的命令
|
||||
|
||||

|
||||
|
||||
在终端中修改版本,终端中直接改,下次再进终端,版本又会变成v16,这里需要注意
|
||||
|
||||
```bash
|
||||
使用nvm安装版本v16的node
|
||||
nvm install v16.16.0
|
||||
|
||||
切换成v16版本的node
|
||||
nvm use v16.16.0
|
||||
|
||||
查看版本
|
||||
node -v
|
||||
```
|
||||
|
||||
如下,版本显示 v16.16.0,下文安装编译管理后台和H5都需要v16版本的node
|
||||
|
||||

|
||||
|
||||
**注意:在终端中可能每次重新打开后node版本又会变掉,这里需要注意,每次执行node命令需要检查一次node版本是否为v16**
|
||||
|
||||
## 系统应用部署
|
||||
|
||||
代码部署分以下几部分
|
||||
|
||||
> 系统是前后端分离的。
|
||||
>
|
||||
> API服务(PHP开发,提供api服务)
|
||||
>
|
||||
> 平台管理端(VUE开发)
|
||||
>
|
||||
> 小程序/H5端(TARO开发)
|
||||
|
||||
### 部署API服务(php)
|
||||
|
||||
- 克隆代码
|
||||
|
||||
```bash
|
||||
git clone https://gitee.com/ShopeX/ECShopX.git
|
||||
```
|
||||
|
||||
- 修改目录权限为www,因为宝塔站点默认权限是www
|
||||
|
||||
```bash
|
||||
chown -R www:www /www/wwwroot/ecshopx.demo.com/ECShopX
|
||||
```
|
||||
|
||||
- 进入目录
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/demo.ecshopx.com/ECShopX
|
||||
```
|
||||
|
||||
- 安装composer包
|
||||
|
||||
```bash
|
||||
# 安装composer包
|
||||
composer install
|
||||
```
|
||||
|
||||
- 生成配置文件
|
||||
|
||||
```bash
|
||||
# 生成env配置文件
|
||||
# .env.full 文件是完整配置,.env.example 文件是基础配置。
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
- **生成APP_KEY密钥**
|
||||
|
||||
> 注意:2.8.0及以后版本才有这个命令,之前的需要手动修改.env中的APP_KEY配置
|
||||
|
||||
```bash
|
||||
# 生成密钥,用于敏感数据加密等使用
|
||||
php artisan key:generate
|
||||
```
|
||||
|
||||
- **生成api token密钥**
|
||||
|
||||
```bash
|
||||
# 生成api token密钥
|
||||
php artisan jwt:secret
|
||||
```
|
||||
|
||||
- **配置域名**
|
||||
|
||||
> **注意:这个一定要配置正确,是后台php访问域名,许多配置依赖于此**
|
||||
|
||||
```bash
|
||||
# 修改成您访问php对应的域名,例如我的后台域名是:https//ecshopx.demo.com
|
||||
APP_URL=http://ecshopx.demo.com
|
||||
```
|
||||
|
||||
- **配置MYSQL数据库**
|
||||
|
||||
```bash
|
||||
# 数据库相关配置
|
||||
## DB_CONNECTION默认不需要改
|
||||
DB_CONNECTION=default
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=ecshopx
|
||||
DB_USERNAME=ecshopx
|
||||
DB_PASSWORD=ecshopx123
|
||||
```
|
||||
|
||||
- **配置REDIS**
|
||||
|
||||
```bash
|
||||
# REDIS配置
|
||||
REDIS_CLIENT=predis
|
||||
REDIS_HOST=127.0.0.1
|
||||
## 必须要设置密码
|
||||
REDIS_PASSWORD=123456
|
||||
REDIS_PORT=6379
|
||||
## 如果按照服务配置,则参考config/database.php中redis部分进行配置,并注释下面这条默认项,按需配置
|
||||
REDIS_DATABASE=0
|
||||
```
|
||||
|
||||
- 配置云存储
|
||||
|
||||
> 默认使用阿里云的OSS云存储,存储图片、视频、上传私有文件等,如果没有云存储可以跳过配置下一步的本地存储
|
||||
|
||||
```bash
|
||||
|
||||
# 文件存储相关配置
|
||||
## oss(阿里云OSS)、qiniu(七牛云)、aws(亚马逊s3)、local(本地存储)
|
||||
DISK_DRIVER=oss
|
||||
## 当前客户文件存放目录
|
||||
OSS_PROJECT_NAME=default_project
|
||||
|
||||
## OSS密钥配置
|
||||
OSS_ACCESS_KEY=
|
||||
OSS_SECRET_KEY=
|
||||
|
||||
## OSS私有文件配置
|
||||
OSS_FILE_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com
|
||||
### OSS私有文件存储bucket
|
||||
OSS_FILE_BUCKET=oss-cdn
|
||||
### 是否开启cname,私有文件不需要开
|
||||
OSS_FILE_IS_CNAME=false
|
||||
|
||||
## OSS公共读图片配置
|
||||
OSS_IMAGE_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com
|
||||
### OSS公有图片bucket
|
||||
OSS_IMAGE_BUCKET=oss-cdn
|
||||
### 是否开启cdn
|
||||
OSS_IMAGE_IS_CNAME=false
|
||||
### 图片cdn,开启cdn则该配置必填
|
||||
OSS_IMAGE_DOMAIN=
|
||||
|
||||
## OSS公共读视频配置
|
||||
OSS_VIDEO_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com
|
||||
### OSS公有视频bucket
|
||||
OSS_VIDEO_BUCKET=oss-cdn
|
||||
### 是否开启cdn
|
||||
OSS_VIDEO_IS_CNAME=flase
|
||||
### 视频cdn,开启cdn则该配置必填
|
||||
OSS_VIDEO_DOMAIN=
|
||||
```
|
||||
|
||||
- 配置本地存储
|
||||
|
||||
> 如果还没有云存储,也可以配置本地存储
|
||||
|
||||
```bash
|
||||
# 会在public目录下生成一个连接storage目录的软连
|
||||
php artisan storage:link
|
||||
```
|
||||
|
||||
> 修改存储驱动为
|
||||
|
||||
```bash
|
||||
# 文件存储相关配置
|
||||
## oss(阿里云OSS)、qiniu(七牛云)、aws(亚马逊s3)、local(本地存储)
|
||||
DISK_DRIVER=local
|
||||
```
|
||||
|
||||
- 配置支付通知接口(以微信支付为例)
|
||||
|
||||
> 2.8.0及以后的版本可以不配置,只用配置APP_URL即可
|
||||
|
||||
```bash
|
||||
WECHAT_PAYMENT_NOTIFY=https://您的网址/wechatAuth/wxpay/notify
|
||||
```
|
||||
|
||||
- 完整的例子
|
||||
|
||||
```bash
|
||||
# 应用名称
|
||||
APP_NAME=EcshopX2.0
|
||||
# 标识应用环境, 本地环境设置为local,生产环境为production
|
||||
APP_ENV=local
|
||||
# 数据加密密钥
|
||||
APP_KEY=
|
||||
# 调试模式, 正式环境需要关闭(true,false)
|
||||
APP_DEBUG=true
|
||||
# php访问域名,不要带最后的斜杠,一定要配置
|
||||
APP_URL=http://ecshopx.demo.com
|
||||
# 时区不要修改
|
||||
APP_TIMEZONE=PRC
|
||||
|
||||
# 数据库相关配置
|
||||
## DB_CONNECTION默认不需要改
|
||||
DB_CONNECTION=default
|
||||
DB_HOST=127.0.0.1
|
||||
DB_PORT=3306
|
||||
DB_DATABASE=ecshopx
|
||||
DB_USERNAME=ecshopx
|
||||
DB_PASSWORD=ecshopx123
|
||||
|
||||
# REDIS配置
|
||||
REDIS_CLIENT=predis
|
||||
REDIS_HOST=127.0.0.1
|
||||
## 必须要设置密码
|
||||
REDIS_PASSWORD=123456
|
||||
REDIS_PORT=6379
|
||||
## 如果按照服务配置,则参考config/database.php中redis部分进行配置,并注释下面这条默认项,按需配置
|
||||
REDIS_DATABASE=0
|
||||
|
||||
# 文件存储相关配置
|
||||
## oss(阿里云OSS)、qiniu(七牛云)、aws(亚马逊s3)、local(本地存储)
|
||||
DISK_DRIVER=local
|
||||
## 当前客户文件存放目录
|
||||
OSS_PROJECT_NAME=default_project
|
||||
|
||||
## OSS密钥配置
|
||||
OSS_ACCESS_KEY=
|
||||
OSS_SECRET_KEY=
|
||||
|
||||
## OSS私有文件配置
|
||||
OSS_FILE_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com
|
||||
### OSS私有文件存储bucket
|
||||
OSS_FILE_BUCKET=oss-cdn
|
||||
### 是否开启cname,私有文件不需要开
|
||||
OSS_FILE_IS_CNAME=false
|
||||
|
||||
## OSS公共读图片配置
|
||||
OSS_IMAGE_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com
|
||||
### OSS公有图片bucket
|
||||
OSS_IMAGE_BUCKET=oss-cdn
|
||||
### 是否开启cdn
|
||||
OSS_IMAGE_IS_CNAME=false
|
||||
### 图片cdn,开启cdn则该配置必填
|
||||
OSS_IMAGE_DOMAIN=
|
||||
|
||||
## OSS公共读视频配置
|
||||
OSS_VIDEO_ENDPOINT=https://oss-cn-shanghai.aliyuncs.com
|
||||
### OSS公有视频bucket
|
||||
OSS_VIDEO_BUCKET=oss-cdn
|
||||
### 是否开启cdn
|
||||
OSS_VIDEO_IS_CNAME=flase
|
||||
### 视频cdn,开启cdn则该配置必填
|
||||
OSS_VIDEO_DOMAIN=
|
||||
|
||||
# 微信第三方平台配置,本地开发环境不配置, 会影响到调用微信的相关页面, 整体不影响后台开发。
|
||||
## 第三方平台APPID
|
||||
WECHAT_APPID=
|
||||
## 第三方平台SECRET
|
||||
WECHAT_SECRET=
|
||||
## 消息校验Token
|
||||
WECHAT_TOKEN=
|
||||
## 消息加解密Key
|
||||
WECHAT_AES_KEY=
|
||||
## 是否需要服务号,false则需要自己绑定到开放平台
|
||||
WX_OPEN_THIRD=true
|
||||
## 是否需要第三方平台
|
||||
WXA_NEED_OPEN_PLATFORM=true
|
||||
|
||||
## 支付宝配置
|
||||
ALIPAY_PAYMENT_RETURN_H5=https://h5域名
|
||||
|
||||
# JWT相关配置,通过php artisan jwt:secret生成密钥,线上务必重新生成
|
||||
JWT_SECRET=ker4H1Gp4TsddddWJMac2SMA8Zsh3drv
|
||||
JWT_TTL=7200
|
||||
JWT_REFRESH_TTL=20160
|
||||
|
||||
# 缓存驱动, 默认使用redis
|
||||
CACHE_DRIVER=redis
|
||||
|
||||
# 队列驱动, 默认使用redis
|
||||
QUEUE_DRIVER=redis
|
||||
|
||||
# 是否saas
|
||||
SYSTEM_IS_SAAS=false
|
||||
# 设置系统主要的企业id,用于pc和h5
|
||||
SYSTEM_MAIN_COMPANYS_ID=1
|
||||
# 是否使用系统菜单,false则是固定菜单,true则更新storage/static/目录下的菜单
|
||||
USE_SYSTEM_MENU=true
|
||||
# 系统版本
|
||||
PRODUCT_MODEL=platform
|
||||
|
||||
# 腾讯地图接口KEY, 建议根据项目进行申请
|
||||
QQMAP_KEY=
|
||||
# 腾讯地图配置, 建议根据项目进行申请
|
||||
API_TENCENT_POSITION_APP_KEY=
|
||||
API_TENCENT_POSITION_APP_SECRET=
|
||||
|
||||
# 高德地图key
|
||||
AMAP_LBS_KEY=
|
||||
|
||||
# 汇付企账通相关配置
|
||||
## true启用汇付支付渠道其他支付渠道则隐藏
|
||||
HFPAY_IS_OPEN=false
|
||||
|
||||
# 达达同城配送相关配置
|
||||
DADA_APP_KEY=
|
||||
DADA_APP_SECRET=
|
||||
DADA_IS_ONLINE=true
|
||||
|
||||
# 是否加密敏感数据,配合配置APP_KEY使用
|
||||
ENCRYPT_SENSITIVE_DATA=false
|
||||
```
|
||||
|
||||
#### 更新数据库
|
||||
|
||||
- 数据库迁移(将表和初始化数据更新到数据库中)
|
||||
|
||||
```bash
|
||||
php artisan doctrine:migrations:migrate
|
||||
```
|
||||
|
||||
#### 配置定时任务
|
||||
|
||||
- 在面板`计划任务`菜单中,添加一个计划任务如下,每分钟跑一次
|
||||
|
||||
```bash
|
||||
sudo -E -u www php /www/wwwroot/ecshopx.demo.com/ECShopX/artisan schedule:run >> /www/wwwroot/ecshopx.demo.com/ECShopX/storage/logs/ecshopx-cront.log 2>&1
|
||||
```
|
||||
|
||||
- 添加上述脚本内容后保存
|
||||
|
||||

|
||||
|
||||
#### 配置队列服务
|
||||
|
||||
- 打开`Supervisor管理器`界面,点击`添加守护进程`,如下界面
|
||||
|
||||

|
||||
|
||||
- 例如添加队列
|
||||
|
||||
名称:`ecshopx-queue-default`
|
||||
|
||||
启动用户:`www`
|
||||
|
||||
运行目录选择php目录: `/www/wwwroot/ecshopx.demo.com/ECShopX`
|
||||
|
||||
启动命令:`php artisan queue:work --queue=default --delay=3 --memory=128 --timeout=30 --sleep=1 --tries=3`
|
||||
|
||||
进程数量:`1`
|
||||
|
||||
点击确定,然后在`守护进程管理菜单`启动队列
|
||||
|
||||

|
||||
|
||||
- 添加默认队列:`ecshopx-queue-default`
|
||||
|
||||
```bash
|
||||
[program:ecshopx-queue-default]
|
||||
command=/www/wwwroot/ecshopx.demo.com/ECShopX/artisan queue:work --queue=default --delay=3 --memory=128 --timeout=30 --sleep=1 --tries=3
|
||||
stdout_logfile=/www/wwwroot/ecshopx.demo.com/ECShopX/storage/logs/supervisor-bloated-queue-default.log
|
||||
redirect_stderr=true
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=1
|
||||
user=www
|
||||
startsecs=3
|
||||
startretries=100000
|
||||
```
|
||||
|
||||
- 添加慢队列:`ecshopx-queue-slow`
|
||||
|
||||
```bash
|
||||
[program:ecshopx-queue-slow]
|
||||
command=/www/wwwroot/ecshopx.demo.com/ECShopX/artisan queue:work --queue=slow --delay=3 --memory=128 --timeout=1800 --sleep=1 --tries=3
|
||||
stdout_logfile=/www/wwwroot/ecshopx.demo.com/ECShopX/storage/logs/supervisor-bloated-queue-slow.log
|
||||
redirect_stderr=true
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
redirect_stderr=true
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=1
|
||||
user=www
|
||||
startsecs=3
|
||||
startretries=100000
|
||||
```
|
||||
|
||||
- 添加短信队列:`ecshopx-queue-sms`
|
||||
|
||||
```bash
|
||||
[program:ecshopx-queue-sms]
|
||||
command=/www/wwwroot/ecshopx.demo.com/ECShopX/artisan queue:work --queue=sms --delay=3 --memory=128 --timeout=1800 --sleep=1 --tries=3
|
||||
stdout_logfile=/www/wwwroot/ecshopx.demo.com/ECShopX/storage/logs/supervisor-bloated-queue-sms.log
|
||||
redirect_stderr=true
|
||||
process_name=%(program_name)s_%(process_num)02d
|
||||
redirect_stderr=true
|
||||
autostart=true
|
||||
autorestart=true
|
||||
numprocs=1
|
||||
user=www
|
||||
startsecs=3
|
||||
startretries=100000
|
||||
```
|
||||
|
||||
> 也可以添加好后在`子配置文件`中切换并修改,填写上面的配置
|
||||
|
||||
### 部署管理后台(vue)
|
||||
|
||||
- 克隆代码
|
||||
|
||||
```bash
|
||||
git clone https://gitee.com/ShopeX/ECShopX_admin-frontend.git
|
||||
```
|
||||
|
||||
- 进入目录
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/demo.ecshopx.com/ECShopX_admin-frontend
|
||||
```
|
||||
|
||||
- 检查配置文件
|
||||
|
||||
```bash
|
||||
vim .env.production
|
||||
```
|
||||
|
||||
- 安装npm包
|
||||
|
||||
```bash
|
||||
// 先安装@shopex/finder
|
||||
npm i @shopex/finder --registry=http://registry.npm.ishopex.cn/
|
||||
|
||||
// 安装其余依赖
|
||||
npm install
|
||||
```
|
||||
|
||||
- 项目部署
|
||||
|
||||
品牌云店模式
|
||||
```plain
|
||||
npm run build:b2c
|
||||
```
|
||||
|
||||
多商户入驻平台模式
|
||||
```plain
|
||||
npm run build:bbc
|
||||
```
|
||||
|
||||
> 编译好后,代码生成在dist目录下,如下图
|
||||
|
||||

|
||||
|
||||
#### 新建API和管理后台站点
|
||||
|
||||
> 例如说这里新建了一个 `ecshopx.demo.com` 的站点,由于数据库我们前面已经创建过了,这里就不要再重新创建了
|
||||
|
||||

|
||||
|
||||
#### 配置API和管理后台Nginx配置
|
||||
|
||||
这里提前将php、vue的nginx配置配好了,有些目录是下一步才建的,所以这里需要注意,具体配置如下
|
||||
|
||||
注意:下面配置中如果没有域名,可以改为ip地址
|
||||
|
||||
```bash
|
||||
server
|
||||
{
|
||||
listen 80;
|
||||
server_name ecshopx.demo.com;
|
||||
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header Access-Control-Allow-Headers "Content-Type, Access-Control-Allow-Headers, Authorization, X-Requested-With";
|
||||
add_header Access-Control-Expose-Headers "Authorization";
|
||||
add_header Access-Control-Allow-Methods "DELETE, GET, HEAD, POST, PUT, OPTIONS, TRACE, PATCH";
|
||||
|
||||
if ($request_method = OPTIONS ) {
|
||||
return 200;
|
||||
}
|
||||
|
||||
location /api/ {
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
client_max_body_size 32m;
|
||||
client_body_buffer_size 256k;
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
}
|
||||
|
||||
location /wechatAuth/ {
|
||||
proxy_pass http://127.0.0.1:8081;
|
||||
}
|
||||
|
||||
location /storage/ {
|
||||
alias /data/httpd/ECShopX/storage/app/public/;
|
||||
#autoindex on;
|
||||
}
|
||||
|
||||
location / {
|
||||
root /www/wwwroot/ecshopx.demo.com/ECShopX_admin-frontend/dist;
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
|
||||
access_log /www/wwwlogs/ecshopx.demo.com.log;
|
||||
error_log /www/wwwlogs/ecshopx.demo.com.error.log;
|
||||
}
|
||||
|
||||
server
|
||||
{
|
||||
listen 8081;
|
||||
server_name _;
|
||||
index index.php index.html index.htm;
|
||||
root /www/wwwroot/ecshopx.demo.com/ECShopX_admin-frontend/public;
|
||||
|
||||
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
|
||||
#error_page 404/404.html;
|
||||
#SSL-END
|
||||
|
||||
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
|
||||
#error_page 404 /404.html;
|
||||
#error_page 502 /502.html;
|
||||
#ERROR-PAGE-END
|
||||
|
||||
#PHP-INFO-START PHP引用配置,可以注释或修改
|
||||
include enable-php-74.conf;
|
||||
#PHP-INFO-END
|
||||
|
||||
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
|
||||
location / {
|
||||
try_files $uri $uri/ /index.php$is_args$args;
|
||||
}
|
||||
#REWRITE-END
|
||||
|
||||
#禁止访问的文件或目录
|
||||
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
|
||||
{
|
||||
return 404;
|
||||
}
|
||||
|
||||
#一键申请SSL证书验证目录相关设置
|
||||
location ~ \.well-known{
|
||||
allow all;
|
||||
}
|
||||
|
||||
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
|
||||
{
|
||||
expires 30d;
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
|
||||
location ~ .*\.(js|css)?$
|
||||
{
|
||||
expires 12h;
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
打开nginx站点修改,点击左侧菜单`配置文件`,将上面的配置复制进去,修改对应的域名和目录位置,如果没有域名,用ip也是可以的,如下图
|
||||
|
||||

|
||||
|
||||
### 小程序/H5编译打包(taro)
|
||||
|
||||
#### 编译H5
|
||||
|
||||
- 检查node版本是否为v16
|
||||
|
||||
```bash
|
||||
# 不要完全复制,看看您本地的v16的小版本是哪个,然后就使用哪个版本
|
||||
# 本文档编写的时候是v16.16.0
|
||||
# 检查版本
|
||||
node -v
|
||||
# 如果版本不是 v16,则执行下面或者去宝塔后台的pm2面板进行修改切换,
|
||||
# 或者用下面命令行切换,建议去宝塔后台切换node版本
|
||||
nvm use v16.16.0
|
||||
```
|
||||
|
||||
- 克隆代码
|
||||
|
||||
```bash
|
||||
git clone https://gitee.com/ShopeX/ECShopX_mobile-frontend.git
|
||||
```
|
||||
|
||||
- 进入目录
|
||||
|
||||
```bash
|
||||
cd /www/wwwroot/ecshopx.demo.com/ECShopX_mobile-frontend
|
||||
```
|
||||
|
||||
- 依赖安装
|
||||
|
||||
```bash
|
||||
# 如遇初始化下载时间过长或者network timeout,可更换npm镜像源
|
||||
# npm更换淘宝镜像,使用此命令后,npm指令关键词改为(cnpm),例如:npm i 改为 cnpm i
|
||||
# 更换命令:npm install -g cnpm --registry=https://registry.npm.taobao.org
|
||||
|
||||
# 先安装插件
|
||||
npm install @shopex/taro-plugin-modules -S --registry=http://registry.npm.ishopex.cn
|
||||
|
||||
# 再安装其他依赖
|
||||
npm install
|
||||
```
|
||||
|
||||
- 环境变量
|
||||
|
||||
> 复制一个配置文件
|
||||
|
||||
```bash
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
> 需要申请一个高德地图的key,配置中只需要修改域名的部分
|
||||
>
|
||||
> 注意:小程序需要配置APP_ID,编译H5则可以忽略
|
||||
|
||||
```json
|
||||
APP_BASE_URL=http://ecshopx.demo.com/api/h5app/wxapp
|
||||
APP_WEBSOCKET=wss://ecshopx.demo.com/ws
|
||||
APP_COMPANY_ID=1
|
||||
APP_PLATFORM=platform
|
||||
APP_CUSTOM_SERVER=http://ecshopx.demo.com/
|
||||
APP_HOME_PAGE=/pages/index
|
||||
APP_TRACK=youshu
|
||||
APP_YOUSHU_TOKEN=
|
||||
APP_ID= // 小程序APPID
|
||||
APP_MAP_KEY= // 高德地图key
|
||||
APP_MAP_NAME=门店定位
|
||||
APP_IMAGE_CDN=https://b-img-cdn.yuanyuanke.cn/ecshopx-vshop
|
||||
|
||||
```
|
||||
|
||||
- npm打包指令
|
||||
|
||||
> 执行生产环境H5打包命令`<font style="color:#E8323C;">npm run build:h5</font>`
|
||||
>
|
||||
> 注意:小程序需要本地执行,在开发者工具进行推送,注意命令差异
|
||||
|
||||
```bash
|
||||
# 小程序本地开发编译
|
||||
npm run dev:weapp
|
||||
|
||||
# 小程序生产打包
|
||||
npm run build:weapp
|
||||
|
||||
# H5本地开发编译
|
||||
npm run dev:h5
|
||||
|
||||
# H5生产打包
|
||||
npm run build:h5
|
||||
```
|
||||
|
||||
#### 新建H5站点
|
||||
|
||||
> 例如说这里新建了一个 `ecshopx-h5.demo.com` 的站点,由于数据库我们前面已经创建过了,这里就不要再重新创建了,php版本选择`纯静态`,根目录选择编译后的h5目录,如下图
|
||||
>
|
||||
> `/www/wwwroot/ecshopx.demo.com/ECShopX_mobile-frontend/dist/h5`
|
||||
|
||||

|
||||
|
||||
#### 配置H5的Nginx配置
|
||||
|
||||
```bash
|
||||
server
|
||||
{
|
||||
listen 80;
|
||||
server_name ecshopx-h5.demo.com;
|
||||
index index.php index.html index.htm default.php default.htm default.html;
|
||||
root /www/wwwroot/ecshopx.demo.com/ECShopX_mobile-frontend/dist/h5;
|
||||
|
||||
#SSL-START SSL相关配置,请勿删除或修改下一行带注释的404规则
|
||||
#error_page 404/404.html;
|
||||
#SSL-END
|
||||
|
||||
#ERROR-PAGE-START 错误页配置,可以注释、删除或修改
|
||||
#error_page 404 /404.html;
|
||||
#error_page 502 /502.html;
|
||||
#ERROR-PAGE-END
|
||||
|
||||
#PHP-INFO-START PHP引用配置,可以注释或修改
|
||||
include enable-php-00.conf;
|
||||
#PHP-INFO-END
|
||||
|
||||
#REWRITE-START URL重写规则引用,修改后将导致面板设置的伪静态规则失效
|
||||
location / {
|
||||
index index.html index.htm;
|
||||
try_files $uri $uri/ /index.html =404;
|
||||
}
|
||||
#REWRITE-END
|
||||
|
||||
#禁止访问的文件或目录
|
||||
location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
|
||||
{
|
||||
return 404;
|
||||
}
|
||||
|
||||
#一键申请SSL证书验证目录相关设置
|
||||
location ~ \.well-known{
|
||||
allow all;
|
||||
}
|
||||
|
||||
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
|
||||
{
|
||||
expires 30d;
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
|
||||
location ~ .*\.(js|css)?$
|
||||
{
|
||||
expires 12h;
|
||||
error_log /dev/null;
|
||||
access_log /dev/null;
|
||||
}
|
||||
access_log /www/wwwlogs/ecshopx-h5.demo.com.log;
|
||||
error_log /www/wwwlogs/ecshopx-h5.demo.com.error.log;
|
||||
}
|
||||
```
|
||||
|
||||
打开nginx站点修改,点击左侧菜单`配置文件`,将上面的配置复制进去,修改对应的域名和目录位置,如果是纯静态的H5应该直接新建站点选好对应目录就能用了,比php和管理后台的部署要简单的,如下图
|
||||
|
||||

|
||||
|
||||
#### 注意事项
|
||||
|
||||
> - 关于小程序预览,dev:weapp本地开发编译模式下因为主包过大无法上传预览,需要使用build:weapp打包后选择小程序开发工具中的详情->本地设置->上传代码时自动压缩混淆。
|
||||
> - H5编译文件生成在目录 ECShopX_mobile-frontend/dist/h5/ 下。
|
||||
> - 小程序编译文件生成在目录 ECShopX_mobile-frontend/dist/weapp/ 下。
|
||||
> - 小程序需要将相关域名配置到小程序的白名单当中
|
||||
|
||||
```bash
|
||||
# request合法域名
|
||||
https://api域名
|
||||
# 下面这行一般配置oss原始域名或者cdn域名
|
||||
https://oss-cn-shanghai.aliyuncs.com
|
||||
https://restapi.amap.com
|
||||
https://zhls.qq.com
|
||||
|
||||
|
||||
# uploadFile合法域名:
|
||||
https://api域名
|
||||
# 下面这行一般配置oss原始域名或者cdn域名
|
||||
https://oss-cn-shanghai.aliyuncs.com;
|
||||
|
||||
# downloadFile合法域名
|
||||
https://api域名
|
||||
# 下面这行一般配置oss原始域名或者cdn域名
|
||||
https://oss-cn-shanghai.aliyuncs.com
|
||||
https://b-img-cdn.yuanyuanke.cn
|
||||
https://mmbiz.qpic.cn
|
||||
https://wx.qlogo.cn
|
||||
https://thirdwx.qlogo.cn
|
||||
https://wework.qpic.cn
|
||||
```
|
||||
|
||||
7
docs/docs/bbzfmn.md
Normal file
7
docs/docs/bbzfmn.md
Normal file
File diff suppressed because one or more lines are too long
39
docs/docs/beqq8s.md
Normal file
39
docs/docs/beqq8s.md
Normal file
@@ -0,0 +1,39 @@
|
||||
---
|
||||
url: beqq8s
|
||||
---
|
||||
|
||||
# 七牛云
|
||||
|
||||
进入 [https://portal.qiniu.com/kodo/bucket](https://portal.qiniu.com/kodo/bucket) 创建 bucket<br />
|
||||
|
||||
<a name="aSBeA"></a>
|
||||
## 创建 espier-image 和 espier-vue (公共读)
|
||||
<a name="XLoyS"></a>
|
||||
### 一、创建 bucket
|
||||
|
||||
|
||||

|
||||
|
||||
<a name="KLcLw"></a>
|
||||
### 二、设置跨域
|
||||
进入详情:<br /><br />点击访问控制,下拉找到跨域设置<br /><br />
|
||||
<br />设置规则<br /><br />
|
||||
|
||||
<a name="1ra5i"></a>
|
||||
### 三、绑定域名
|
||||
|
||||
<br /><br />
|
||||
<br />
|
||||
<br /><br />
|
||||
<br />
|
||||
|
||||
<a name="ZHeb0"></a>
|
||||
## 创建 espier-import-files (私有)
|
||||
<a name="RRtfA"></a>
|
||||
### 一、创建
|
||||
<br />
|
||||
|
||||
> 私有存储不需要配置 cdn 和跨域
|
||||
|
||||
|
||||
|
||||
13953
docs/docs/data_dictionary.md
Normal file
13953
docs/docs/data_dictionary.md
Normal file
File diff suppressed because it is too large
Load Diff
59
docs/docs/ddzswy.md
Normal file
59
docs/docs/ddzswy.md
Normal file
@@ -0,0 +1,59 @@
|
||||
---
|
||||
url: ddzswy
|
||||
---
|
||||
|
||||
# 配置信息与环境变量
|
||||
|
||||
<a name="410df261"></a>
|
||||
## 问题说明
|
||||
|
||||
---
|
||||
|
||||
|
||||
<br />假如我们有个『CDN 域名』的变量,在 Laravel 中有以下几种方法:<br />
|
||||
|
||||
1. 硬代码,直接写死。- ❌ 可维护性低
|
||||
1. 写死在 `config/app.php` 文件中。 - ❌ 无法区分环境进行配置
|
||||
1. 存储于 `.env` 文件中,使用 `env()` 方法直接读取。 - ❌ 虽然解决了环境变量问题但是不推荐
|
||||
1. 存储在 `.env` 和 `config/app.php` 文件中,然后使用 `config()` 函数来读取。- ✅ 最佳实践
|
||||
|
||||
|
||||
<br />第一种方法是最古老的方法,代码可维护性极低,一旦域名变更就只能全局替换。<br />第二种方法无法区分环境,例如本地使用开发环境域名测试,线上才是正式的 CDN 域名。<br />第三种方法虽然解决了环境变量的问题,并且也具备一定的灵活性,但是不够灵活,假如你的网站流量巨大,需要配置几个 CDN 域名,使其在加载静态资源时随机支配域名,这种做法就无法满足需求了。<br />第四种方法既支持环境变量,又具备极高的灵活性,假如遇到同样的 CDN 多域名随机问题,你只需要写一个辅助方法,然后在 `config/app.php` 中调用即可,不需要动到任何一行业务逻辑代码。<br />
|
||||
|
||||
<a name="b5ea48ff"></a>
|
||||
## 代码示例
|
||||
|
||||
---
|
||||
|
||||
|
||||
<br />`.env` 文件中设置:<br />
|
||||
|
||||
```
|
||||
CDN_DOMAIN=cdndomain.com
|
||||
```
|
||||
|
||||
<br />`config/app.php` 文件中设置:<br />
|
||||
|
||||
```
|
||||
'cdn_domain' => env('CDN_DOMAIN', null),
|
||||
```
|
||||
|
||||
<br />程序中两种获取 `相同配置` 的方法:<br />
|
||||
|
||||
1. `env('CDN_DOMAIN')`
|
||||
1. `config('app.cdn_domain')`
|
||||
|
||||
|
||||
<br />在此统一规定:所有程序配置信息 **必须** 通过 `config()` 来读取,所有的 `.env` 配置信息 **必须** 通过 `config()` 来读取,**绝不** 在配置文件以外的范围使用 `env()`。<br />
|
||||
|
||||
<a name="9f8a234b"></a>
|
||||
## 有何优势
|
||||
|
||||
---
|
||||
|
||||
|
||||
<br />这样做主要有以下几个优势:<br />
|
||||
|
||||
1. 定义分明,`config()` 是配置信息,`env()` 只是用来区分不同环境;
|
||||
1. 统一放置于 `config` 中还可以利用框架的 [配置信息缓存功能](http://learnku.com/docs/laravel/5.5/installation#configuration-caching) 来提高运行效率;
|
||||
1. 代码健壮性, `config()` 在 `env()` 之上多出来一个抽象层,会使代码更加健壮,更加灵活。
|
||||
70
docs/docs/deploy_cluster_install.md
Normal file
70
docs/docs/deploy_cluster_install.md
Normal file
@@ -0,0 +1,70 @@
|
||||
---
|
||||
url: deploy_cluster_install
|
||||
---
|
||||
|
||||
# 集群部署方案
|
||||
|
||||
|
||||
|
||||
<a name="mCEew"></a>
|
||||
### 服务器说明(2web机情况,其他类似)
|
||||
|
||||
|
||||
- 本文档仅供参考,达到集群部署目的即可,不同运维都有自己的方案,生产环境的要求要复杂于以下文档,具体环境具体对待
|
||||
- 软件部署安装具体请参考 [linux单机部署方案](http://club.shopex.cn/ecshopx/manual/docs/deploy_install.html),集群部署可能不需按照单机部署那样所有软件都需要安装,根据服务器实际需要安装
|
||||
- 集群部署机器分配,根据业务需要进行机器配置,不是所有机器都是要一台或者多台服务器,根据你的实际情况来就可以了
|
||||
- 服务器信息列表
|
||||
| 机器 | 安装软件 | 说明 |
|
||||
| --- | --- | --- |
|
||||
| worker | php+supervisor | 队列机器,执行队列相关,默认用的redis队列 |
|
||||
| scheduler | php+supervisor | 定时任务机器 |
|
||||
| web1 | php+nginx | api,vue前端(后台、pc、h5) |
|
||||
| web2 | php+nginx | api,vue前端(后台、pc、h5) |
|
||||
| redis | redis | redis单机,或者第三方如阿里云的redis |
|
||||
| mysql | mysql | 自己安装mysql5.7单机或者集群,或者第三方如阿里云的rds |
|
||||
| 图片存储 | 七牛或者oss | 目前只支持第三方七牛或者阿里OSS云存储 |
|
||||
| 负载均衡 | haproxy | 自己搭建负载均衡服务器或者使用第三方如阿里云的负载均衡服务 |
|
||||
|
||||
|
||||
|
||||
<a name="hqcrS"></a>
|
||||
### 集群与单机的一些差异化说明
|
||||
<a name="Te3do"></a>
|
||||
#### 数据库配置
|
||||
> - env中配置数据库的方式有所改变,如果是自己的部署的数据库集群,参考下面的env配置修改配置就行了
|
||||
> - 如果用的阿里云的rds集群并且自己控制读写分离,也参照下面配置读写实例和只读实例
|
||||
> - 如果用的阿里云的rds的代理模式,则按照原来的数据库配置就行,不用特殊指定读写服务器
|
||||
|
||||
```bash
|
||||
# 数据库主从配置,根据自己实际情况配置
|
||||
DB_DRIVER=master_slave
|
||||
DB_MASTER={"user":"root","password":"123455","host":"localhost","dbname":"ecx"}
|
||||
DB_SLAVES=[{"user":"root","password":"123455","host":"localhost2","dbname":"ecx"},{"user":"root","password":"123455","host":"localhost3","dbname":"ecx"}]
|
||||
```
|
||||
<a name="95JVW"></a>
|
||||
#### 代码同步
|
||||
> - 通过git的形式去更新代码,结合pssh命令或者自己写脚本去批量更新每台服务器
|
||||
> - 通过rsync等工具同步代码
|
||||
|
||||
<a name="oRjYe"></a>
|
||||
#### redis集群
|
||||
> - 如果要求不是特别高,部署一个单机的redis就可以了。
|
||||
> - 如果使用阿里云的集群,云数据库Redis集群版相比标准版在原生Redis命令的支持上有一定的区别,例如eval是不能用的,由于系统使用了lua脚本,所以阿里redis集群用起来是有问题的
|
||||
|
||||
<a name="GPtdM"></a>
|
||||
#### 负载均衡
|
||||
> - 自己安装负载均衡,如用nginx,haproxy等
|
||||
> - 用第三方如阿里云的负载均衡服务
|
||||
|
||||
<a name="wGn3Y"></a>
|
||||
#### scheduler机
|
||||
> - 定时任务机器,跑一些系统的定时任务。如果机器资源不够,也可以和队列机部署在一起
|
||||
|
||||
<a name="3CE7C"></a>
|
||||
#### worker机
|
||||
> - 队列机,跑系统的一些队列,默认用的redis队列
|
||||
|
||||
<a name="UYkUU"></a>
|
||||
#### 云存储
|
||||
> - 系统目前只支持七牛云存储和阿里的oss,所以这里集群单机没有区别
|
||||
|
||||
1298
docs/docs/deploy_install.md
Normal file
1298
docs/docs/deploy_install.md
Normal file
File diff suppressed because it is too large
Load Diff
139
docs/docs/deploy_prepare_amore_open_weixin.md
Normal file
139
docs/docs/deploy_prepare_amore_open_weixin.md
Normal file
@@ -0,0 +1,139 @@
|
||||
---
|
||||
url: deploy_prepare_amore_open_weixin
|
||||
---
|
||||
|
||||
# 微信开放平台-第三方平台配置
|
||||
|
||||
<a name="b66b8eaa"></a>
|
||||
## 注册微信平台账号
|
||||
|
||||
[注册微信平台注册](https://open.weixin.qq.com/cgi-bin/readtemplate?t=regist/regist_tmpl&lang=zh_CN)
|
||||
|
||||
<a name="d7b8487d"></a>
|
||||
## 开发者资质认证
|
||||
|
||||
[第三方平台申请流程](https://open.weixin.qq.com/cgi-bin/frame?t=home/wx_plugin_tmpl&lang=zh_CN)
|
||||
|
||||
点击`开发者资质认证`, 并进行认证.
|
||||
|
||||
> 开发者资质认证介绍
|
||||
|
||||
> 微信开放平台帐号的开发者资质认证提供更安全、更严格的真实性认证、也能够更好的保护企业及用户的合法权益<br />
|
||||
开发者资质认证通过后,微信开放平台帐号下的应用,将获得微信登录、智能接口、第三方平台开发等高级能力<br />
|
||||
审核费用:中国大陆地区:300元,非中国大陆地区:99美元
|
||||
|
||||
|
||||
认证时间大概2-3天, 已微信实际认证时间为准
|
||||
|
||||
<a name="bcce70b7"></a>
|
||||
## 创建第三方平台
|
||||
|
||||
管理中心->第三方平台
|
||||
|
||||
|
||||
点击`创建第三方平台`
|
||||
|
||||
<a name="a2890803"></a>
|
||||
## 输入基本信息
|
||||
|
||||
平台类型选择`平台型服务商`
|
||||
|
||||
<a name="b17be281"></a>
|
||||
## 选择权限
|
||||
|
||||
公众号权限
|
||||
|
||||
|
||||
小程序权限
|
||||
|
||||
|
||||
<a name="eeac4e56"></a>
|
||||
## 填写开发资料
|
||||
|
||||
为了表述方便, 下文将以源源客正式站站为例.
|
||||
|
||||
websocket地址: **dev-websocket-wmp.amorepacific.com.cn**
|
||||
|
||||
授权流程相关
|
||||
|
||||
- 授权发起页域名: dev-wmp.amorepacific.com.cn
|
||||
|
||||
> 必须从本域名内网页跳转到登录授权页,才可完成登录授权。无需填写`http://等域名协议前缀`
|
||||
|
||||
|
||||
- 授权测试公众号列表: ghhh_fff6479ae2c8;gh_7bc47f612ba6
|
||||
|
||||
> 在全网发布之前,仅该列表内公众号才可进行授权,以便测试。请填写公众号的原始ID(可在公众平台网站的公众号设置页找到),最多10个,以英文“;”隔开。
|
||||
|
||||
|
||||
- 授权事件接收URL: dev-wmp.amorepacific.com.cn/wechatAuth/events
|
||||
|
||||
::: danger
|
||||
**url前缀**选择https
|
||||
:::
|
||||
|
||||
> 用于接收取消授权通知、授权成功通知、授权更新通知,也用于接收ticket,ticket是验证平台方的重要凭据。
|
||||
|
||||
|
||||
授权后实现业务
|
||||
|
||||
- 消息校验Token: qwn2995ktj024
|
||||
|
||||
> 开发者在代替公众号或小程序接收到消息时,用此Token来校验消息。
|
||||
|
||||
|
||||
::: danger
|
||||
**消息校验Token**前后, 绝不能有空格
|
||||
:::
|
||||
|
||||
- 消息加解密Key: sklfjkfgeiawwwqvn65997wlj01ndnfoqoe8x2k0nck
|
||||
|
||||
> 在代替公众号或小程序收发消息过程中使用。必须是长度为43位的字符串,只能是字母和数字。
|
||||
|
||||
|
||||
::: danger
|
||||
**消息加解密Key**前后, 绝不能有空格. 长度必须43位
|
||||
:::
|
||||
|
||||
- 消息与事件接收URL: dev-wmp.amorepacific.com.cn/wechatAuth/callback/$APPID$
|
||||
|
||||
::: danger
|
||||
**url前缀**选择https
|
||||
:::
|
||||
|
||||
> 通过该URL接收公众号或小程序消息和事件推送,该参数按规则填写(需包含/$APPID$,如www.abc.com/$APPID$/callback),实际接收消息时$APPID$将被替换为公众号或小程序AppId。
|
||||
|
||||
|
||||
- 公众号开发域名: dev-wmp.amorepacific.com.cn
|
||||
|
||||
> 第三方平台在代公众号做网页授权、调用JS SDK等网页开发工作时所用的域名,以;隔开。为了满足开发者管理需要,符合以下要求的下级域名也将生效:$APPID$.wx.abc.com($APPID$为公众号的AppID的替换符)<br />
|
||||
请**下载校验文件**,并将文件放置在域名根目录下,例如wx.qq.com,并确保可以访问该文件。<br />
|
||||
每月可提交修改申请3次,本月有3次机会
|
||||
|
||||
|
||||
- 小程序服务器域名: dev-wmp.amorepacific.com.cn;dev-websocket-wmp.amorepacific.com.cn;mmbiz.qpic.cn;wx.qlogo.cn;
|
||||
|
||||
> 第三方平台旗下授权的小程序,只可配置本平台服务器域名列表中的域名,以;隔开。<br />
|
||||
每月可提交修改申请3次,本月有2次机会
|
||||
|
||||
|
||||
::: info
|
||||
需要访问的小程序服务器域名, 同时需要后端接口**dev-wmp.amorepacific.com.cn** 和 websocket服务: **dev-websocket-wmp.amorepacific.com.cn**
|
||||
:::
|
||||
|
||||
- 小程序业务域名:
|
||||
|
||||
> 请**下载校验文件**,并将文件放置在域名根目录下,例如wx.qq.com,并确保可以访问该文件。<br />
|
||||
每月可提交修改申请3次,本月有3次机会
|
||||
|
||||
|
||||
其他
|
||||
|
||||
- 白名单IP地址列表: 40.73.103.142
|
||||
|
||||
> 仅当开发者IP地址在该列表中时,才被允许调用相关接口。最多填写100个IP地址,以英文“;”隔开。
|
||||
|
||||
|
||||
::: info
|
||||
服务器出口ip地址, 如果是vpc. 否则访问微信接口会被拒
|
||||
:::
|
||||
Reference in New Issue
Block a user