Category.php 938 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2017 https://www.sapixx.com All rights reserved.
  4. * @license Licensed (http://www.apache.org/licenses/LICENSE-2.0).
  5. * @author pillar<ltmn@qq.com>
  6. * 小程序公共API服务
  7. */
  8. namespace app\bestbao\controller\api\v1;
  9. use app\bestbao\controller\api\Base;
  10. use app\bestbao\model\BestbaoCategory;
  11. class Category extends Base{
  12. /**
  13. * 获取分类
  14. **/
  15. public function index(){
  16. $data['publickey'] = $this->request->param('publickey');
  17. $data['sign'] = $this->request->param('sign');
  18. $rel = $this->apiSign($data);
  19. if($rel['code'] != 200){
  20. return enjson($rel['code'],'签名验证失败');
  21. }
  22. $rel = BestbaoCategory::where(['member_miniapp_id' => $this->miniapp_id])->order('sort desc,id desc')->select()->toArray();
  23. if($rel){
  24. return enjson(200,$rel);
  25. }
  26. return enjson(204);
  27. }
  28. }