pull/1/head
parent
5826227dfc
commit
8418ce457b
@ -1,16 +1,26 @@ |
||||
<?php |
||||
|
||||
namespace app\api\controller; |
||||
|
||||
use app\common\model\Banner; |
||||
use app\common\model\UploadFile; |
||||
/** |
||||
* 默认控制器 |
||||
* Class Index |
||||
* @package app\api\controller |
||||
*/ |
||||
class Index |
||||
class Index extends Controller |
||||
{ |
||||
public function index() |
||||
{ |
||||
echo '当前访问的index.php,请将index.html设为默认站点入口'; |
||||
} |
||||
|
||||
public function getBannerList(){ |
||||
$list = Banner::where("status", 10)->select()->toArray(); |
||||
foreach ($list as &$value) { |
||||
$file_path = UploadFile::where('file_id', $value['image_id'])->field('file_path')->find()->file_path; |
||||
$value['image'] = getUrl($file_path); |
||||
} |
||||
return $this->renderSuccess($list); |
||||
} |
||||
} |
@ -0,0 +1,46 @@ |
||||
<?php |
||||
// +---------------------------------------------------------------------- |
||||
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ] |
||||
// +---------------------------------------------------------------------- |
||||
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved. |
||||
// +---------------------------------------------------------------------- |
||||
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行 |
||||
// +---------------------------------------------------------------------- |
||||
// | Author: 萤火科技 <admin@yiovo.com> |
||||
// +---------------------------------------------------------------------- |
||||
declare (strict_types=1); |
||||
|
||||
namespace app\common\model; |
||||
|
||||
use cores\BaseModel; |
||||
use think\model\relation\BelongsTo; |
||||
use think\model\relation\HasOne; |
||||
|
||||
/** |
||||
* 文章模型 |
||||
* Class Article |
||||
* @package app\common\model |
||||
*/ |
||||
class Banner extends BaseModel |
||||
{ |
||||
// 定义表名 |
||||
protected $name = 'banner'; |
||||
|
||||
// 定义主键 |
||||
protected $pk = 'id'; |
||||
|
||||
// 追加字段 |
||||
protected $append = []; |
||||
|
||||
/** |
||||
* 关联文章封面图 |
||||
* @return HasOne |
||||
*/ |
||||
public function image(): HasOne |
||||
{ |
||||
return $this->hasOne('UploadFile', 'file_id', 'image_id') |
||||
->bind(['image_url' => 'preview_url']); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,31 @@ |
||||
<?php |
||||
// +---------------------------------------------------------------------- |
||||
// | 萤火商城系统 [ 致力于通过产品和服务,帮助商家高效化开拓市场 ] |
||||
// +---------------------------------------------------------------------- |
||||
// | Copyright (c) 2017~2023 https://www.yiovo.com All rights reserved. |
||||
// +---------------------------------------------------------------------- |
||||
// | Licensed 这不是一个自由软件,不允许对程序代码以任何形式任何目的的再发行 |
||||
// +---------------------------------------------------------------------- |
||||
// | Author: 萤火科技 <admin@yiovo.com> |
||||
// +---------------------------------------------------------------------- |
||||
declare (strict_types=1); |
||||
|
||||
namespace app\common\model; |
||||
|
||||
use cores\BaseModel; |
||||
|
||||
/** |
||||
* 模型类:购物车 |
||||
* Class Cart |
||||
* @package app\common\model |
||||
*/ |
||||
class TransferRecord extends BaseModel |
||||
{ |
||||
// 定义表名 |
||||
protected $name = 'transfer_record'; |
||||
|
||||
// 定义主键 |
||||
protected $pk = 'id'; |
||||
|
||||
|
||||
} |
Loading…
Reference in new issue