初始化项目:添加后端代码、ThinkPHP框架、前端资源

This commit is contained in:
amb
2026-09-03 12:42:39 +08:00
commit 482bece22e
3726 changed files with 416708 additions and 0 deletions
@@ -0,0 +1,33 @@
<?php
namespace app\api\controller\app\score;
use app\common\controller\Api;
/**
* 配置
*/
class Config extends Api
{
protected $noNeedLogin = [];
// 无需鉴权的接口,*表示全部
protected $noNeedRight = ['*'];
public function _initialize()
{
parent::_initialize();
\app\common\model\fill\Handle::check('app_config','score');
$this->model = new \app\common\model\app\agent\Member();
}
public function getConfig(){
$config = \app\common\model\app\Config::getConfig('score');
$this->success('获取成功',$config);
}
}
@@ -0,0 +1,112 @@
<?php
namespace app\api\controller\app\score;
use app\common\controller\Api;
/**
* 积分商城
*/
class Goods extends Api
{
protected $noNeedLogin = [];
protected $noNeedRight = ['*'];
protected $model = null;
public function _initialize()
{
parent::_initialize();
\app\common\model\fill\Handle::check('app_config','score');
$this->model = new \app\api\model\app\score\Goods;
}
public function index()
{
$limit = input('limit',10);
$page = input('page',1);
$group = input('group','');
$search = input('search');
$sort = input('sort','desc') == 'desc' ? 'desc' : 'asc';
$order = input('order');
$where = [
'course.status'=>1,
'course.sales_type'=>['like',"%alone%"],
'course.hide'=>0,
'course.price'=>['>',0],
'goods.status'=>1,
'goods.stock'=>['>',0]
];
$orderField = 'course.createtime';
if(!empty($order)){
switch ($order){
case 'score':
$orderField = 'goods.score';
break;
case 'price':
$orderField = 'course.price';
break;
case 'views':
$orderField = 'course.views';
break;
}
}
if(!empty($search)){
$where['course.name'] = ['like',"%{$search}%"];
}
if(isset($params['type']) && !empty($params['type'])){
$where['course.type'] = $params['type'];
}
if($group > 0){
$where['goods.id'] = ['in',(new \app\admin\model\app\score\GroupBind)->getGroupBindGoods($group)];
}
$rows = $this->model->with(['course']);
$list = $rows
->where($where)
->limit($limit)->page($page)
->order($orderField,$sort)
->select();
if(!empty($list)){
foreach ($list as $item){
$item->course->visible(['name','cover','price','price_marking','pay_type','type','id']);
}
}
$this->success('获取成功', $list);
}
/**
* 积分商品详情
* @return void
*/
public function detail()
{
$id = $this->request->post('id');
$data = $this->model->where([
'goods_id'=>$id,
'status'=>1,
'stock'=>['>',0]
])->find();
if(!$data){
$this->error("该积分商品暂不可兑");
}
$this->success('商品详情', $data);
}
}
@@ -0,0 +1,38 @@
<?php
namespace app\api\controller\app\score;
use app\common\controller\Api;
/**
* 积分商城商品分组
*/
class GoodsGroup extends Api
{
protected $noNeedLogin = [];
protected $noNeedRight = ['*'];
protected $model = null;
public function _initialize()
{
parent::_initialize();
\app\common\model\fill\Handle::check('app_config','score');
$this->model = new \app\api\model\app\score\GoodsGroup;
}
/**
* 获取分组列表
* @return void
*/
public function getList(){
$list = $this->model->where([
'status'=>1
])->order('sort','asc')
->order('createtime','desc')->select();
$this->success('获取成功',$list);
}
}