<?php
/**
 * @copyright   Copyright (c) 2017 https://www.sapixx.com All rights reserved.
 * @license     Licensed (http://www.apache.org/licenses/LICENSE-2.0).
 * @author      pillar<ltmn@qq.com>
 * 小程序公共API服务
 */
namespace app\bestbao\controller\api\v1;
use app\bestbao\controller\api\Base;
use app\bestbao\model\BestbaoCategory;

class Category extends Base{

     /**
     * 获取分类
     **/
    public function index(){
        $data['publickey'] = $this->request->param('publickey');
        $data['sign'] = $this->request->param('sign');
        $rel = $this->apiSign($data);
        if($rel['code'] != 200){
            return enjson($rel['code'],'签名验证失败');
        }
        $rel = BestbaoCategory::where(['member_miniapp_id' => $this->miniapp_id])->order('sort desc,id desc')->select()->toArray();
        if($rel){
            return enjson(200,$rel);
        }
        return enjson(204);
    }
}