zoukankan      html  css  js  c++  java
  • swagger-open api 手动编写规范

    参考资料

    coding swagger3.0doc 编辑器
    文档 链接 Swagger Editor

    info

    基本结构

    所有关键字名称均区分大小写。

    元数据

    每个API定义都必须包括该定义基于的OpenAPI规范版本:

    openapi: 3.0.0
    

    OpenAPI版本定义了API定义的整体结构-您可以记录什么以及如何记录它。OpenAPI 3.0使用具有三部分版本号的语义版本控制。的可用版本是3.0.0,3.0.1,3.0.2,和3.0.3; 它们在功能上是相同的。
    info节包含API信息:titledescription(可选)version、:

    info:
      title: Sample API
      description: Optional multiline or single-line description in [CommonMark](http://commonmark.org/help/) or HTML.
      version: 0.1.9
    

    title是您的API名称。description是有关您的API的扩展信息。它可以是多行,并支持Markdown的CommonMark方言以表示富文本。在CommonMark提供的范围内支持HTML(请参阅CommonMark 0.27规范中的HTML块)。是一个任意字符串,用于指定API的版本(请勿将其与文件修订或版本混淆)。您可以使用诸如major.minor.patch之类的语义版本控制,或诸如1.0-beta或2017-07-25之类的任意字符串。 versionopenapiinfo 还支持其他关键字,用于联系信息,许可证,服务条款和其他详细信息。
    伺服器
    servers部分指定API服务器和基本URL。您可以定义一台或多台服务器,例如生产服务器和沙箱。

    servers:
      - url: http://api.example.com/v1
        description: Optional server description, e.g. Main (production) server
      - url: http://staging-api.example.com
        description: Optional server description, e.g. Internal staging server for testing
    

    所有API路径均相对于服务器URL。在上面的示例中,/users表示http://api.example.com/v1/users或http://staging-api.example.com/users,具体取决于所使用的服务器。有关更多信息,请参见API服务器和基本路径。

    路径
    paths部分定义了API中的各个端点(路径),以及这些端点支持的HTTP方法(操作)。例如,GET /users可以描述为:

    paths:
      /users:
        get:
          summary: Returns a list of users.
          description: Optional extended description in CommonMark or HTML
          responses:
            '200':
              description: A JSON array of user names
              content:
                application/json:
                  schema: 
                    type: array
                    items: 
                      type: string
    

    操作定义包括参数,请求正文(如果有),可能的响应状态代码(例如200 OK或404未找到)和响应内容。有关更多信息,请参见路径和操作。

    openapi: 3.0.0
    info:
      title: EDP Skip APP API
      version: 1.0.0
      description: |
        公共的请求错误码对应描述如下:
          - 401: 授权失败,当用户access_token失效;
          - 404: 页面不存在;
          - 500: 服务器错误
         
    tags: 
      - name: security
        description: 安全
      - name: account
        description: 账户å
      - name: notification
        description: 通知  
      - name: coupon
        description: 优惠券   
      - name: notice
        description: 告示     
      - name: booking
        description: 预约 
      - name: order
        description: 订单 
      - name: setting
        description: 设置   
      - name: file
        description: 文件     
       
    paths:
      #Security Module
      /password_sessions:
        post:
          tags:
            - security
          summary: 密码登陆
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    account:
                      type: string
                      description: "账户(email or mobile)"
                    password:
                      type: string
                      description: "密码"
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "用户ID"
                          access_token:
                            type: string
                            description: "API调用凭证"
                          role_type:
                            type: integer
                            description: "角色类型:0位顾客;1为职员(用户角色为职员时access_token为空,需要在调用职员登录API)"
                          recycle_company_name:
                            type: string
                            description: "回收公司名称"
                          recycle_company_city_name:
                            type: string
                            description: "回收公司地区名称"
                          recycle_company_group_name:
                            type: string
                            description: "回收公司小组名称"
                         
                          
                          
            "400":
              description: 错误信息(含多种情况)
              content:
                application/json:
                  examples:
                    EMAIL_OR_MOBILE_EMPTY:
                      summary: "邮件/电话為空"
                      value:
                        error_code: "EMAIL_OR_MOBILE_EMPTY"
                        error_msg: "請輸入Email/電話"
                    PASSWORD_EMPTY:
                      summary: "密碼為空"
                      value:
                        error_code: "PASSWORD_EMPTY"
                        error_msg: "請輸入密碼"
                    ACCOUNT_IS_NOT_EXIST:
                      summary: "账户不存在"
                      value:
                        error_code: "ACCOUNT_IS_NOT_EXIST"
                        error_msg: "账户不存在"
                    ACCOUNT_PASSWORD_ERRPR:
                      summary: "帳號或密碼錯誤"
                      value:
                        error_code: "ACCOUNT_PASSWORD_ERRPR"
                        error_msg: "帳號或密碼錯誤"    
      
      /sms_sessions:
        post:
          tags:
            - security
          summary: 短信登陆
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    mobile:
                      type: string
                      description: "电话"
                    verify_code:
                      type: string
                      description: "验证码"
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "用户ID"
                          access_token:
                            type: string
                            description: "API调用凭证"
                          role_type:
                            type: integer
                            description: "角色类型:0位顾客;1为职员"  
                           
                          
            "400":
              description: 错误信息(含多种情况)
              content:
                application/json:
                  examples:
                    MOBILE_EMPTY:
                      summary: "电话為空"
                      value:
                        error_code: "MOBILE_EMPTY"
                        error_msg: "請輸入電話"
                    VERIFY_CODE_EMPTY:
                      summary: "验证码為空"
                      value:
                        error_code: "VERIFY_CODE_EMPTY"
                        error_msg: "验证码為空"
                    ACCOUNT_IS_NOT_EXIST:
                      summary: "账户不存在"
                      value:
                        error_code: "ACCOUNT_IS_NOT_EXIST"
                        error_msg: "账户不存在"
                    VERIFY_CODE_ERRPR:
                      summary: "验证码错误"
                      value:
                        error_code: "VERIFY_CODE_ERRPR"
                        error_msg: "验证码错误"    
       
      /staff_sessions:
        post:
          tags:
            - security
          summary: 职员登陆
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    account:
                      type: string
                      description: "账户(email or mobile)"
                    password:
                      type: string
                      description: "密码"
                    staff_employee_no:
                      type: string
                      description: "职员编号"  
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "用户ID"
                          access_token:
                            type: string
                            description: "API调用凭证"
                          
                          
                          
            "400":
              description: 错误信息(含多种情况)
              content:
                application/json:
                  examples:
                    EMAIL_OR_MOBILE_EMPTY:
                      summary: "邮件/电话為空"
                      value:
                        error_code: "EMAIL_OR_MOBILE_EMPTY"
                        error_msg: "請輸入Email/電話"
                    PASSWORD_EMPTY:
                      summary: "密碼為空"
                      value:
                        error_code: "PASSWORD_EMPTY"
                        error_msg: "請輸入密碼"
                    ACCOUNT_IS_NOT_EXIST:
                      summary: "账户不存在"
                      value:
                        error_code: "ACCOUNT_IS_NOT_EXIST"
                        error_msg: "账户不存在"
                    ACCOUNT_PASSWORD_ERRPR:
                      summary: "帳號或密碼錯誤"
                      value:
                        error_code: "ACCOUNT_PASSWORD_ERRPR"
                        error_msg: "帳號或密碼錯誤"    
      
      /sessions/$session_id:  
        delete:
          tags:
            - security
          summary: 登出
          operationId: logout
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: path
              name: session_id
              required: true
              schema:
                type: integer
                description: 用户id
              
          responses:
            '200':
              description: ""
      
      /verify_code:
        get:
          tags:
            - security
          summary: 发送短信验证码
          parameters:
            - in: query
              name: mobile
              required: true
              schema:
                type: integer
            - in: query
              name: zone
              required: true
              schema:
                type: integer  
              description: "区号"
                    
          responses:
            "200":
             description: ""
                          
            "400":
              description: 错误信息(含多种情况)
              content:
                application/json:
                  examples:
                    MOBILE_EMPTY:
                      summary: "电话為空"
                      value:
                        error_code: "MOBILE_EMPTY"
                        error_msg: "請輸入電話"
                    ZONE_EMPTY:
                      summary: "区号為空"
                      value:
                        error_code: "ZONE_EMPTY"
                        error_msg: "請輸入区号"    
                    
      /forget_password:
        patch:
          tags:
            - security
          summary: 忘记密码
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    mobile:
                      type: string
                      description: "电话"
                    verify_code:
                      type: string
                      description: "验证码"
                    new_password:
                      type: string
                      description: "新密码"
                    confirm_new_password:
                      type: string
                      description: "确认新密码"  
                    
          responses:
            "200":
             description: ""
                          
            "400":
              description: 错误信息(含多种情况)
              content:
                application/json:
                  examples:
                    VERIFY_CODE_EMPTY:
                      summary: "验证码为空"
                      value:
                        error_code: "VERIFY_CODE_EMPTY"
                        error_msg: "請輸入验证码" 
                    NEW_PASSWORD_EMPTY:
                      summary: "新电话为空"
                      value:
                        error_code: "NEW_PASSWORD_EMPTY"
                        error_msg: "請輸入電話" 
                    CONFIRM_PASSWORD_EMPTY:
                      summary: "电话為空"
                      value:
                        error_code: "CONFIRM_PASSWORD_EMPTY"
                        error_msg: "請輸入确认新密码"     
                    PASSWORD_INCONSISTENT:
                      summary: "密码不一致"
                      value:
                        error_code: "PASSWORD_INCONSISTENT"
                        error_msg: "密码不一致"         
      
      #Account Module
      /customers:
        post:
          tags:
            - account
          summary: 注册顾客
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    title_type:
                      type: integer
                      description: "称谓类型;0位先生;1为小姐;2位女士"
                    username:
                      type: string
                      description: "用户名"
                    mobile:
                      type: string
                      description: "电话"  
                    verify_code:
                      type: string
                      description: "验证码"    
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "用户id"
                          access_token :
                            type: string
                            description: "API调用凭证"  
                          
            "400":
              description: 错误信息(含多种情况)
              content:
                application/json:
                  examples:
                    USERNAME_EMPTY:
                      summary: "名称為空"
                      value:
                        error_code: "USERNAME_EMPTY"
                        error_msg: "請輸入名稱 "
                    MOBILE_EMPTY:
                      summary: "电话為空"
                      value:
                        error_code: "MOBILE_EMPTY"
                        error_msg: "請輸入電話 "    
                    MOBILE_EXIST:
                      summary: "电话已存在"
                      value:
                        error_code: "MOBILE_EXIST"
                        error_msg: "电话已存在"
                    VERIFY_CODE_ERROR:
                      summary: "验证码错误"
                      value:
                        error_code: "VERIFY_CODE_ERROR"
                        error_msg: "验证码错误"    
                    
      /customer_profile:
        get:
          tags:
            - account
          summary: 获取顾客详情
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "用户id"
                          title_type:
                            type: integer
                            description: "称谓类型"
                          username:
                            type: string
                            description: "称谓类型;0位先生;1为小姐;2位女士"
                          email:
                            type: string
                            description: "电邮"
                          mobile:
                            type: string
                            description: "电话"  
                          company_name:
                            type: string
                            description: "公司名称" 
                        
        patch:
          tags:
            - account
          summary: 修改顾客资料
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    title_type:
                      type: integer
                      description: "称谓类型;0位先生;1为小姐;2位女士"
                    username:
                      type: string
                      description: "名称"
                    company_name:
                      type: string
                      description: "公司名称"
                    email:
                      type: string
                      description: "电邮"
          responses:
            "200":
              description: ""
            "400":
              description: 错误信息(含多种情况)
              content:
                application/json:
                  examples:
                    EMAIL_FORMAT_ERROR:
                      summary: "邮件格式错误"
                      value:
                        error_code: "EMAIL_FORMAT_ERROR"
                        error_msg: "電郵格式不正確。"
      
      /customer_password:
        patch:
          tags:
            - account
          summary: 修改顾客密码
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    old_password:
                      type: string
                      description: "旧密码"
                    new_password:
                      type: string
                      description: "新密码"
                    confirm_new_password:
                      type: string
                      description: "确认密码"
                   
          responses:
            "200":
              description: ""
            "400":
              description: 错误信息(含多种情况)
              content:
                application/json:
                  examples:
                    OLD_PASSWORD_ERROR:
                      summary: "旧密码错误"
                      value:
                        error_code: "OLD_PASSWORD_ERROR"
                        error_msg: "現有密碼不正確"     
                    NEW_PASSWORD_EMPTY:
                      summary: "新密码为空"
                      value:
                        error_code: "NEW_PASSWORD_EMPTY"
                        error_msg: "新密码为空。"     
                    CONFIRM_NEW_PASSWORD_EMPTY:
                      summary: "确认新密码为空"
                      value:
                        error_code: "CONFIRM_NEW_PASSWORD_EMPTY"
                        error_msg: "确认新密码为空。"         
      
      /customers/$customer_id/dislike_histories:
         get:
          tags:
            - account
          summary: 获取顾客差评记录
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          date:
                            type: string
                            description: "日期"
                          dislike_reason_name:
                            type: string
                            description: "差评原因"
                          collection_location_name:
                            type: number
                            description: "收集点名称"  
                         
      /staff_profile:
        get:
          tags:
            - account
          summary: 获取职员详情
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
            
                
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "用户id"
                          name:  
                            type: string
                            description: "职员名称"
                          employee_no:
                            type: string
                            description: "职员工号"
                          recycle_company_name:
                            type: string
                            description: "回收公司名称"
                          recycle_company_city_name:
                            type: string
                            description: "回收公司城市名称"
                             
                            
    
      #Notification Module
      /notifications:
        get:
          tags:
            - notification
          summary: 获取通知列表
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
            - $ref: '#/components/parameters/limitParam'
            - $ref: '#/components/parameters/pageParam'    
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "通知id"
                            order_number:
                              type: string
                              description: "订单编号"
                            booking_collection_start_time:
                              type: string
                              description: "预约收集开始时间"
                            booking_collection_end_time:
                              type: string
                              description: "预约收集结束时间"  
                            order_status:
                              type: integer
                              description: "订单状态:0 is pending ; 1 is no_collection ; 2 is completed ; 3 is cancel ; 4 is comment"
                            collection_locaiton_name:
                              type: string
                              description: "收集点名称"  
                            decoration_address_name:
                              type: string
                              description: "装修地址全称"    
                            create_at:
                              type: string
                              description: "发送时间"      
      
      #post 上传远程推送token
      /remote_push_tokens:
        post:
          tags:
            - notification
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string  
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"
                
          summary: 上传远程推送token
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    type:
                      type: integer
                      description: "远程推送类型:0为android ; 1为ios"
                    token:
                      type: string
                      description: "远程推送token"
          responses:
            "200":
             description: ""
              
      #Coupon Module
      /coupons:
        get:
          tags:
            - coupon
          summary: 获取优惠券列表
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
            - in: query
              name: customer_id
              required: false
              schema:
                type: integer  
              description: "顾客id(当前用户角色类型为司机时才需要传递)"      
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "顾客领取优惠券记录id"
                            coupon_id:
                              type: integer
                              description: "优惠券id"  
                            recycle_company_id:
                              type: integer
                              description: "回收公司id"  
                            recycle_company_name:
                              type: string
                              description: "回收公司名称"
                            recycle_company_city_name:
                              type: string
                              description: "回收公司地区名称"
                            each_like_to_change:
                              type: integer
                              description: "获取一张优惠券所需要的好评数量"
                            current_like_quantity:
                              type: integer
                              description: "顾客当前这个公司的好评数量"  
                            unit_amount:
                              type: integer
                              description: "优惠券单价"
                            issued_quantity:
                              type: integer
                              description: "已发放优惠券数量"  
                            start_weight:
                              type: integer
                              description: "起步吨数"
                            each_weight_to_use:
                              type: number
                              description: "允许使用1张优惠券的每吨重量数"    
                            receive_at:
                              type: string
                              description: "优惠券领取时间"  
                            
                              
                            
      /coupons/$coupon_id:
        get:
          tags:
            - coupon
          summary: 获取优惠券详情
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"       
            - in: path
              name: coupon_id
              required: true
              schema:
                type: integer    
              
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "id"
                          recycle_company_name:
                            type: string
                            description: "回收公司名称"
                          recycle_company_city_name:
                            type: string
                            description: "回收公司地区名称"
                          start_weight:
                            type: integer
                            description: "起步吨数"
                          each_weight_to_use:
                            type: integer
                            description: "允许使用1张优惠券的每吨重量数"  
                          each_like_to_change:
                            type: integer
                            description: "获取一张优惠券所需要的好评数量"
                          max_amount_limit:
                            type: integer
                            description: "优惠券最多发放金额限制"  
                          unit_amount:
                            type: integer
                            description: "优惠券定额金额" 
                          summary:
                            type: string
                            description: "摘要" 
                           
                            
      #Notice Module
      /term_and_condition:
        get:
          tags:
            - notice
          summary: 获取条款及细则内容
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"     
          responses:
            "200":
             description: ""
             content:
               text/html:
                  schema:
                      type: string
                      description: "富文本编辑内容"
                      example: "废物产生者 使用者守则"
                              
      /important_notice:
        get:
          tags:
            - notice
          summary: 获取重要告示内容
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"     
          responses:
            "200":
             description: ""
             content:
               text/html:
                  schema:
                      type: string
                      description: "富文本编辑内容"
                      example: "无障碍网页设计声明"
      
      /use_notice:
        get:
          tags:
            - notice
          summary: 获取使用须知
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"     
          responses:
            "200":
             description: ""
             content:
               text/html:
                  schema:
                      type: string
                      description: "富文本编辑内容"
                      example: "使用须知"                
             
      #Booking Module 
      /booking_notice:
        get:
          tags:
            - booking
          summary: 获取预约公告内容
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"       
              
          responses:
            "200":
             description: ""
             content:
               text/html:
                  schema:
                      type: string
                      description: "富文本编辑内容"
                      example: "手机建筑废物-下单通知"
                            
      /nearby_collection_locations:  
        get:
            tags:
              - booking
            summary: 获取附近的收集点
            parameters:
              - in: cookie
                name: access_token
                required: true
                schema:
                  type: string
              - in: cookie
                name: role_type
                required: true
                schema:
                  type: integer  
                description: "角色类型:0表示顾客;1表示司机"       
              - in: query
                name: longitude
                required: true
                schema:
                  type: number
                description: "当前位置:经度"  
              - in: query
                name: latitude
                required: true
                schema:
                  type: number    
                description: "当前位置:维度"  
              - $ref: '#/components/parameters/limitParam'
              - $ref: '#/components/parameters/pageParam'    
            responses:
              "200":
               description: ""
               content:
                 application/json:
                        schema:
                          type: array
                          items:
                            properties:
                              id:
                                type: integer
                                description: "id"
                              recycle_company_name:
                                type: string
                                description: "回收公司名称"
                              name:
                                type: string
                                description: "收集点名称"
                              about_distance:
                                type: number
                                description: "大约距离"
                              longitude:
                                type: number
                                description: "收集点-经度"  
                              latitude:
                                type: number
                                description: "收集点-维度"  
      
      /collection_locations/$collection_location_id/service_calendars:
        get:
          tags:
            - booking
          summary: 获取收集点的营运日历
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"      
            - in: path
              name: collection_location_id
              required: true
              schema:
                type: integer  
              description: "收集点id"        
            
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            working_day:
                              type: string
                              description: "工作日"
                            times:
                              type: array
                              items:
                                  type: string
                                  description: "时间"
                                  
      
      /collection_locations:
        get:
          tags:
            - order
          summary: 获取当前职员所有收集点
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"      
           
            
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            name:
                              type: string
                              description: "收集点名称"
      /available_booking_times:
        get:
          tags:
            - order
          summary: 获取可预约的下单时间(服务器根据当前时间显示在这之后的时间)
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"      
           
            
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            start_time:
                              type: string
                              example: "14:00"
                              description: "开始时间"
                            end_time:
                              type: string
                              example: "14:30"
                              description: "结束时间"  
                            booked_collection_loction_name:
                              type: string
                              example: "文咸东街100号"
                               
      
      #Order Module   
      /orders:
        get:
          tags:
            - order
          summary: 获取订单列表
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"          
            - in: query
              name: book_date_gt
              required: false
              schema:
                type: string
              description: 预约开始日期
            - in: query
              name: booking_date_lt
              required: false
              schema:
                type: string
              description: 预约结束日期
            - in: query
              name: status
              required: false
              description: 订单状态:0 is pending ; 1 is no_collection ; 2 is completed ; 3 is cancel ; 4 is comment(不传递时,默认返回请求者的所有订单数据)
              schema:
                type: string    
            - $ref: '#/components/parameters/limitParam'
            - $ref: '#/components/parameters/pageParam'    
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "订单id"
                            order_number:
                              type: string
                              description: "订单编号"
                            decoration_location_name:
                              type: string
                              description: "装修位置名称"
                            collection_location_name:
                              type: number
                              description: "收集点名称"  
                            collection_location_longitude:
                              type: number
                              description: "收集点经度"  
                            collection_location_latitude:
                              type: integer
                              description: "收集点维度"    
                            booking_collection_start_time:
                              type: string
                              description: "预约收集开始时间"
                            booking_collection_end_time:
                              type: string
                              description: "预约收集结束时间"
                            actual_cost:
                              type: number
                              description: "实付金额"   
                            customer_name:
                              type: string
                              description: :"顾客名称"
                            customer_mobile:
                              type: string
                              description: :"顾客电话"
                            customer_non_inert_waste_quantity:
                              type: integer
                              description: :"顾客预计惰性废物数量(袋)"
                            customer_insert_waste_quantity:
                              type: integer
                              description: :"顾客预计惰性废物数量(袋)"  
                            is_like:
                              type: boolean
                              description: :"是否好评;0为差评;1为好评" 
                            dislike_reason_name:
                              type: string
                              description: :"差评原因名称"
        
        post:
          tags:
            - order
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
          summary: 生成订单
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    decoration_city_id:
                      type: integer
                      description: "装修城市id"
                    decoration_area_id:
                      type: integer
                      description: "装修区域id"
                    decoration_street:
                      type: string
                      description: "装修地址街道"
                    decoration_address:
                      type: string
                      description: "装修地址单位、大厦、座"
                    collection_location_id:
                      type: integer
                      description: "收集点id"  
                    booking_collection_start_time:
                      type: string
                      description: "预约收集开始"
                    
                    customer_non_inert_waste_quantity:
                      type: integer
                      description: "顾客预计非惰性废物数量(袋)"  
                    customer_insert_waste_quantity:
                      type: integer
                      description: "顾客预计惰性废物数量(袋)"    
                    order_images:
                      type: array
                      items:
                        properties:
                          path:
                            type: string
                            description: "图片绝对路径"
                          type:
                            type: integer
                            description: "图片类型:0为顾客上传的图片;1为司机上传的备注图片;2为司机上传的差评图片"  
                    customer_voice_path:
                       type: integer
                       description: "顾客语音语音绝对文件路径"    
                    customer_additional_info:
                       type: integer
                       description: "顾客补充资料" 
                    
                      
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "订单id"
                          order_numebr:
                            type: string
                            description: "订单编号"
      
      /orders/$order_id:
        get:
          tags:
            - order
          summary: 获取订单详情
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
            - in: path
              name: order_id
              required: true
              description: 订单id
              schema:
                type: string    
      
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        properties:
                          id:
                            type: integer
                            description: "订单id"
                          customer_name:
                            type: string
                            description: "顾客名称"
                          customer_mobile:
                            type: string
                            description: "顾客电话"  
                          order_number:
                            type: string
                            description: "订单编号"
                          status:
                            type: integer
                            description: 订单状态:0 is pending ; 1 is no_collection ; 2 is completed ; 3 is cancel ; 4 is comment
                          is_like:
                            type: boolean
                            description: "是否好评;0为差评;1为好评"
                          dislike_reason_name:
                            type: string
                            description: "差评原因"  
                          decoration_location_name:
                            type: integer
                            description: "装修地址名称"
                         
                          collection_location_name:
                            type: number
                            description: "收集点名称"  
                          collection_location_longitude:
                            type: number
                            description: "收集点经度"  
                          collection_location_latitude:
                            type: integer
                            description: "收集点维度"    
                          booking_collection_start_time:
                            type: string
                            description: "预约收集开始时间"
                          booking_collection_end_time:
                            type: string
                            description: "预约收集结束时间"
                         
                          
                          customer_non_inert_waste_quantity:
                            type: integer
                            description: "顾客预计惰性废物数量(袋)"    
                          customer_insert_waste_quantity:
                            type: integer
                            description: "顾客预计惰性废物数量(袋)"    
                          customer_voice_path:
                            type: string
                            description: "顾客语音语音绝对文件路径"    
                          customer_additional_info:
                            type: string
                            description: "顾客补充资料" 
                          predict_cost:
                            type: string
                            description: "预计收费" 
                          order_images:
                            type: array
                            items:
                              properties:
                                path:
                                  type: string
                                  description: "上传图片绝对路径"
                                type:
                                  type: integer
                                  description: "图片类型:0为顾客上传的图片;1为司机上传的备注图片;2为司机上传的差评图片"  
                          
                          staff_non_inert_waste_quantity:
                            type: number
                            description: "职员预计惰性废物数量(袋)"    
                          staff_insert_waste_quantity:
                            type: number
                            description: "职员预计惰性废物数量(袋)"    
                          staff_voice_path:
                            type: string
                            description: "职员语音语音绝对文件路径"    
                          staff_additional_info:
                            type: string
                            description: "职员补充资料"     
                          origianl_cost:
                            type: number
                            description: "原价"     
                          coupon_cost:
                            type: number
                            description: "优惠价格" 
                          actual_cost:
                            type: number
                            description: "实付价格" 
                          payment_type:
                            type: integer
                            description: "付款类型 :0为现金;1为百达通" 
                          total_like:
                            type: integer
                            description: "好评总数" 
                          total_dislike:
                            type: integer
                            description: "差评总数"   
                          total_completed_order:  
                            type: integer
                            description: "完成订单总数"
                          total_no_collection_order:  
                            type: integer
                            description: "未完成订单总数"
                          total_cancel_order:  
                            type: integer
                            description: "取消订单总数"  
                            
        patch:
          tags:
            - order
          summary: 修改订单
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    booking_collection_start_time:
                      type: string
                      description: "预约收集开始时间"
                    booking_collection_end_time:
                      type: string
                      description: "预约收集结束时间"  
                    collection_locaiton_id:
                      type: integer
                      description: "收集点id"    
                   
          responses:
            "200":
              description: ""                          
              
      /score_order_requests:
        post:
          tags:
            - order
          summary: 订单评分
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    order_id:
                      type: integer
                      description: "订单id"
                    is_like:
                      type: boolean
                      description: "是否好评;0为差评;1为好评"
                    dislike_reason_id:
                      type: integer
                      description: "差评原因id"
                    order_images:
                      type: array
                      items:
                        properties:
                          path:
                            type: string
                            description: 差评图片绝对路径
                          type:
                            type: integer
                            description: 图片类型:0为顾客上传的图片;1为司机上传的备注图片;2为司机上传的差评图片  
                   
                   
          responses:
            "200":
              description: ""
            
      /reject_order_requests:
        post:
          tags:
            - order
          summary: 拒绝订单
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    order_id:
                      type: integer
                      description: "订单id"
                    reject_reason_id:
                      type: integer
                      description: "拒绝原因id"
                   
          responses:
            "200":
              description: ""
      
      /accept_order_requests:
        post:
          tags:
            - order
          summary: 接受订单
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    order_id:
                      type: integer
                      description: "订单id"
                   
               
          responses:
            "200":
              description: ""
              
      /cancel_order_requests:
        post:
          tags:
            - order
          summary: 取消订单
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    cancel_reason_id:
                      type: integer
                      description: "取消原因id"
                    order_id:
                      type: integer
                      description: "订单id"  
                   
          responses:
            "200":
              description: ""        
      
      /quotations:
        post:
          tags:
            - order
          summary: 订单报价
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"    
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    order_id:
                      type: integer
                      description: "订单id"
                    coupon_record_ids:
                      type: array
                      items: 
                        type: integer
                        description: "优惠券id"
                    coupon_cost:
                      type : string
                      description: "优惠券抵扣金额"
                    staff_non_inert_waste_weight:
                      type: number
                      description: "职员非惰性废物重量(顿)"
                    staff_insert_waste_weight:
                      type: number
                      description: "职员惰性废物重量(顿)"
                    staff_voice_path:
                      type: string
                      description: "职员语音文件绝对路径"
                    staff_additional_info:
                      type: string
                      description: "职员补充资料"
                    payment_type:
                      type: integer
                      description: "付款类型 :0为现金;1为百达通"
                    order_images:
                      type: array
                      items:
                        properties:
                          path:
                            type: string
                            description: "图片绝对路径"
                          type:
                            type: integer
                            description: "图片类型:0为顾客上传的图片;1为司机上传的备注图片;2为司机上传的差评图片"  
                    
                   
          responses:
            "200":
              description: ""        
      
      /accept_quotations:
        post:
          tags:
            - order
          summary: 接收报价
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"
          responses:
            "200":
              description: ""                
      
      /orders/$order_id/reject_quotations:
        post:
          tags:
            - order
          summary: 拒绝报价
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"
          requestBody:
              content:
                application/json:
                  schema:
                    type: object
                    properties:
                      order_id:
                        type: integer
                        description: "订单id"       
                   
          responses:
            "200":
              description: ""                        
      
      /complete_order_requests:
        post:
          tags:
            - order
          summary: 完成订单
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机" 
          requestBody:
            content:
              application/json:
                schema:
                  type: object
                  properties:
                    order_id:
                      type: integer
                      description: "订单id"
                    plate_number:
                      type: string
                      description: "车牌号码"     
                    skip_number:
                      type: string
                      description: "环保斗编号"     
                    classification_field_number:
                      type: string
                      description: "分类场编号(分类场职员填写)"      
                   
          responses:
            "200":
              description: ""        
      
      /order_cancel_reasons:
        get:
          tags:
            - order
          summary: 获取订单取消原因(后台根据请求者角色独立显示)
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"        
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            name:
                              type: string
                              description: "原因名称"
      
      /order_reject_reasons:
        get:
          tags:
            - order
          summary: 获取订单拒绝原因
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"            
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            name:
                              type: string
                              description: "原因名称"                        
                              
      /order_dislike_reasons:
        get:
          tags:
            - order
          summary: 获取订单差评原因
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"            
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            name:
                              type: string
                              description: "原因名称"                                                
                            
      #Setting Module
      /cities:
        get:
          tags:
            - setting
          summary: 获取城市列表
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"            
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            name:
                              type: string
                              description: "城市名称"
                              
      /cities/$city_id/districts:
        get:
          tags:
            - setting
          summary: 获取城市对应区域列表
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: path
              name: city_id
              required: true
              schema:
                type: integer 
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"            
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            name:
                              type: string
                              description: "区域名称"                                             
                              
      /app_banners:
        get:
          tags:
            - setting
          summary: 获取APP横幅列表
          parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            - in: cookie
              name: role_type
              required: true
              schema:
                type: integer  
              description: "角色类型:0表示顾客;1表示司机"            
          responses:
            "200":
             description: ""
             content:
               application/json:
                      schema:
                        type: array
                        items:
                          properties:
                            id:
                              type: integer
                              description: "id"
                            title:
                              type: string
                              description: "标题"  
                            image_path:
                              type: string
                              description: "横幅图片绝对地址"
                            url:
                              type: string
                              description: "跳转地址"
      
       #File Module
      "/files":
        post:
            tags:
              - file
            summary: 上传文件
            parameters:
            - in: cookie
              name: access_token
              required: true
              schema:
                type: string
            requestBody:
              content:
                multipart/form-data:
                  schema:
                    type: object
                    properties:
                        key:
                         type : string 
                         description: "file" 
                        value:
                         type : string 
                         description: "local file" 
                      
            responses:
             "200":
                description: ""
                content:
                  text/plain:
                        schema:
                          type: string
                          example: https://image.baidu.com/search/detail?ct=503316480
                           
    #定义实体对象  
    components: 
      parameters:
        pageParam:
          in: query
          name: _page
          required: true
          description: 从第几页开始取
          schema:
            type: integer
        limitParam:
          in: query
          name: _limit
          required: true
          description: 最多返回多少条
          schema:
            type: integer
      #schemas:
        
    
      schemas:
    
    # iOS&Android 推送
        RemoteNotificationExtraData:
          type: object
          description: 远程推送消息的额外数据,请放在远程推送消息的'data'属性下
          properties:
            notification_type:
              type: number
              description: >-
                notification type, 
                0:订单状态改变;
                1:司机报价;
            extra_data:
              type: string
              description: >-
                notification type, 
                0,1:Return order_id;
    
  • 相关阅读:
    HDU1029 Ignatius and the Princess IV
    UVA11039 Building designing【排序】
    UVA11039 Building designing【排序】
    POJ3278 HDU2717 Catch That Cow
    POJ3278 HDU2717 Catch That Cow
    POJ1338 Ugly Numbers(解法二)
    POJ1338 Ugly Numbers(解法二)
    UVA532 Dungeon Master
    UVA532 Dungeon Master
    POJ1915 Knight Moves
  • 原文地址:https://www.cnblogs.com/yaoliuyang/p/14003612.html
Copyright © 2011-2022 走看看