本文分三部分系统介绍如何开发一套在线客服系统聊天源码,该源码基于ThinkPHP,代码完全开源。
首先,我们只使用@auth指令。
其次,我们添加一个带有参数的订阅类型。
第三,我们更新@auth指令和订阅类型。
完整源码:kf.zxkfym.top
1 使用@auth指令并执行身份验证
添加和使用身份验证
$ amplify add auth
Scanning for plugins...
Plugin scan successful
Using service: Cognito, provided by: awscloudformation
The current configured provider is Amazon Cognito.
Do you want to use the default authentication and security configuration? Default configuration
Warning: you will not be able to edit these selections.
How do you want users to be able to sign in? Username
Do you want to configure advanced settings? No, I am done.
Successfully added auth resource sampleamplifysubscriXXXXXXXX locally
Some next steps:
"amplify push" will build all your local backend resources and provision it in the cloud
"amplify publish" will build all your local backend and frontend resources (if you have hosting category added) and provision it in the cloud
$
$ amplify push
✔ Successfully pulled backend environment dev from the cloud.
Current Environment: dev
| Category | Resource name | Operation | Provider plugin |
| -------- | ---------------------------- | --------- | ----------------- |
| Auth | sampleamplifysubscriXXXXXXXX | Create | awscloudformation |
| Api | sampleamplifysubscri | No Change | awscloudformation |
? Are you sure you want to continue? Yes
⠙ Updating resources in the cloud. This may take a few minutes...
(snip)
✔ All resources are updated in the cloud
$
然后,更新 api。
$ amplify update api
? Please select from one of the below mentioned services: GraphQL
? Select from the options below Update auth settings
? Choose the default authorization type for the API Amazon Cognito User Pool
Use a Cognito user pool configured as a part of this project.
? Configure additional auth types? No
The following types do not have '@auth' enabled. Consider using @auth with @model
- OpenChat
- RoomChat
Learn more about @auth here: https://docs.amplify.aws/cli/graphql-transformer/auth
GraphQL schema compiled successfully.
Edit your schema at /[YOUR_DIRECTORY]/sample-amplify-subscriptions/amplify/backend/api/sampleamplifysubscri/schema.graphql or place .graphql files in a directory at /[YOUR_DIRECTORY]/sample-amplify-subscriptions/amplify/backend/api/sampleamplifysubscri/schema
The API_KEY auth type has been removed from the API.
If other resources depend on this API, run "amplify update <category>" and reselect this API to remove the dependency on the API key.
⚠️ This must be done before running "amplify push" to prevent a push failure
Successfully updated resource
$
这意味着,我们可以使用@auth指令并且只能使用userPools.
更新 graphql 模式文件。文章来源:https://www.toymoban.com/news/detail-791405.html
文章来源地址https://www.toymoban.com/news/detail-791405.html
type CloseRoomChat
@model
@auth(rules: [{ allow: owner, provider: userPools }]) {
id: ID!
roomName: String!
message: String!
}
$ amplify push
✔ Successfully pulled backend environment dev from the cloud.
Current Environment: dev
| Category | Resource name | Operation | Provider plugin |
| -------- | ---------------------------- | --------- | ----------------- |
| Api | sampleamplifysubscri | Update | awscloudformation |
| Auth | sampleamplifysubscriXXXXXXXX | No Change | awscloudformation |
? Are you sure you want to continue? Yes
The following types do not have '@auth' enabled. Consider using @auth with @model
- OpenChat
- RoomChat
Learn more about @auth here: https://docs.amplify.aws/cli/graphql-transformer/auth
GraphQL schema compiled successfully.
Edit your schema at /[YOUR_DIRECTORY]/sample-amplify-subscriptions/amplify/backend/api/sampleamplifysubscri/schema.graphql or place .graphql files in a directory at /[YOUR_DIRECTORY]/sample-amplify-subscriptions/ampli
到了这里,关于多国语言在线客服系统源码+软件下载二合一集成的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!