Thank.php 2.2 KB
<?php

namespace app\api\controller;

use app\api\model\Price;
use app\common\controller\Api;
/**
 * 答谢
 */
class Thank extends Api
{

    // 无需登录的接口,*表示全部
    protected $noNeedLogin = ['*'];
    // 无需鉴权的接口,*表示全部
    protected $noNeedRight = ['*'];



    /**
     * 支付下单
     * @ApiTitle    (支付下单)
     * @ApiSummary  (支付下单)
     * @ApiMethod   (POST)
     * @ApiHeaders  (name="token", type="string", required=true, description="请求的Token")
     * @ApiParams   (name="price", type="integer", required=true, description="价格")
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturnParams   (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据返回")
     * @ApiReturn   ()
     */
    public function pay()
    {
        $price = $this->request->param('price', 0, 'int');
        if(!$price || $price <= 0) {
            $this->error('您的操作有误');
        }


    }


    /**
     * 获取价目表
     * @ApiTitle    (获取价目表)
     * @ApiSummary  (获取价目表)
     * @ApiMethod   (POST)
     * @ApiReturnParams   (name="code", type="integer", required=true, sample="0")
     * @ApiReturnParams   (name="msg", type="string", required=true, sample="返回成功")
     * @ApiReturnParams   (name="data", type="object", sample="{'user_id':'int','user_name':'string','profile':{'email':'string','age':'integer'}}", description="扩展数据返回")
     * @ApiReturn   ({
        "code": 1,
        "msg": "获取价目表成功",
        "time": "1586398313",
        "data": [
        {
        "id": 1,
        "price": 1,
        "weigh": 0,
        "createtime": 0,
        "updatetime": 0,
        "deletetime": null,
        "show_switch": 1
        }
        ]
        })
     */
    public function getPriceList()
    {
        $price = new Price();
        $priceList = $price->listAll();
        $this->success('获取价目表成功', $priceList);
    }

}