图片服务器上传Api接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

77 lines
2.5 KiB

<?php
/**
* +----------------------------------------------------------------------
* | 会员管理模型
* +----------------------------------------------------------------------
* .::::.
* .::::::::. | AUTHOR: siyu
* ::::::::::: | EMAIL: 407593529@qq.com
* ..:::::::::::' | DATETIME: 2020/07/10
* '::::::::::::'
* .::::::::::
* '::::::::::::::..
* ..::::::::::::.
* ``::::::::::::::::
* ::::``:::::::::' .:::.
* ::::' ':::::' .::::::::.
* .::::' :::: .:::::::'::::.
* .:::' ::::: .:::::::::' ':::::.
* .::' :::::.:::::::::' ':::::.
* .::' ::::::::::::::' ``::::.
* ...::: ::::::::::::' ``::.
* ```` ':. ':::::::::' ::::..
* '.:::::' ':'````..
* +----------------------------------------------------------------------
*/
namespace app\common\model;
// 引入框架内置类
use think\facade\Request;
// 引入构建器
use app\common\facade\MakeBuilder;
class Users extends Base
{
// 定义时间戳字段名
protected $createTime = 'create_time';
protected $updateTime = 'update_time';
public function usersType()
{
return $this->belongsTo('UsersType', 'type_id');
}
// 获取列表
public static function getList($where = array(), $pageSize, $order = ['sort', 'id' => 'desc'])
{
$list = self::where($where)
->order($order)
->paginate([
'query' => Request::get(),
'list_rows' => $pageSize,
]);
foreach ($list as $k => $v) {
if ($list[$k]['type_id']) {
$v['type_id'] = $v->usersType->getData('name');
}
}
return MakeBuilder::changeTableData($list, 'Users');
}
// 导出列表
public static function getExport($where = array(), $order = ['sort', 'id' => 'desc'])
{
$list = self::where($where)
->order($order)
->select();
foreach ($list as $k => $v) {
if ($list[$k]['type_id']) {
$v['type_id'] = $v->usersType->getData('name');
}
}
return MakeBuilder::changeTableData($list, 'Users');
}
}