数据库: - db/schema_phase1.sql 16 张业务表(类目/服务/地址/师傅/订单/流水/取证/报价/评价/券/钱包/提现/结算/消息) - db/seed_phase1.sql 15 类目 + 32 服务项目 + 新人券(幂等) 后端 API (application/api/controller): - Base/Auth/Home/Address/Order/Master/Review - app/common/library/OrderStatus 11 状态机 + 流转矩阵 - application/api/common.php PHP 8.5 兼容垫片(E_DEPRECATED 不再升级为异常) 测试: - tests/e2e_flow.js 用户下单→支付→师傅抢单→履约→验收→结算→评价 全链路 65 项断言 - 含异常用例:越权/重复操作/非法状态流转/2h 未联系自动回流
106 行
2.6 KiB
PHP
可执行文件
106 行
2.6 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace app\admin\controller\user;
|
|
|
|
use app\common\controller\Backend;
|
|
use app\common\library\Auth;
|
|
|
|
/**
|
|
* 会员管理
|
|
*
|
|
* @icon fa fa-user
|
|
*/
|
|
class User extends Backend
|
|
{
|
|
|
|
protected $relationSearch = true;
|
|
protected $searchFields = 'id,username,nickname';
|
|
|
|
/**
|
|
* @var \app\admin\model\User
|
|
*/
|
|
protected $model = null;
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = new \app\admin\model\User;
|
|
}
|
|
|
|
/**
|
|
* 查看
|
|
*/
|
|
public function index()
|
|
{
|
|
//设置过滤方法
|
|
$this->request->filter(['strip_tags', 'trim']);
|
|
if ($this->request->isAjax()) {
|
|
//如果发送的来源是Selectpage,则转发到Selectpage
|
|
if ($this->request->request('keyField')) {
|
|
return $this->selectpage();
|
|
}
|
|
list($where, $sort, $order, $offset, $limit) = $this->buildparams();
|
|
$list = $this->model
|
|
->with('group')
|
|
->where($where)
|
|
->order($sort, $order)
|
|
->paginate($limit);
|
|
foreach ($list as $k => $v) {
|
|
$v->avatar = $v->avatar ? cdnurl($v->avatar, true) : letter_avatar($v->nickname);
|
|
$v->hidden(['password', 'salt']);
|
|
}
|
|
$result = array("total" => $list->total(), "rows" => $list->items());
|
|
|
|
return json($result);
|
|
}
|
|
return $this->view->fetch();
|
|
}
|
|
|
|
/**
|
|
* 添加
|
|
*/
|
|
public function add()
|
|
{
|
|
if ($this->request->isPost()) {
|
|
$this->token();
|
|
}
|
|
return parent::add();
|
|
}
|
|
|
|
/**
|
|
* 编辑
|
|
*/
|
|
public function edit($ids = null)
|
|
{
|
|
if ($this->request->isPost()) {
|
|
$this->token();
|
|
}
|
|
$row = $this->model->get($ids);
|
|
$this->modelValidate = true;
|
|
if (!$row) {
|
|
$this->error(__('No Results were found'));
|
|
}
|
|
$this->view->assign('groupList', build_select('row[group_id]', \app\admin\model\UserGroup::column('id,name'), $row['group_id'], ['class' => 'form-control selectpicker']));
|
|
return parent::edit($ids);
|
|
}
|
|
|
|
/**
|
|
* 删除
|
|
*/
|
|
public function del($ids = "")
|
|
{
|
|
if (!$this->request->isPost()) {
|
|
$this->error(__("Invalid parameters"));
|
|
}
|
|
$ids = $ids ? $ids : $this->request->post("ids");
|
|
$row = $this->model->get($ids);
|
|
$this->modelValidate = true;
|
|
if (!$row) {
|
|
$this->error(__('No Results were found'));
|
|
}
|
|
Auth::instance()->delete($row['id']);
|
|
$this->success();
|
|
}
|
|
|
|
}
|