Card.php 645 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace app\controller;
  3. use app\BaseController;
  4. use app\model\CardModel;
  5. class Card extends BaseController
  6. {
  7. function index(): \think\response\Json
  8. {
  9. $apps = CardModel::where('status', 1)->select();
  10. return $this->success('ok', $apps);
  11. }
  12. function install_num(): \think\response\Json
  13. {
  14. $id = $this->request->post('id', 0);
  15. if ($id) {
  16. $find = CardModel::where("id", $id)->find();
  17. if ($find) {
  18. $find->install_num += 1;
  19. $find->save();
  20. }
  21. }
  22. return $this->success('ok');
  23. }
  24. }