数据库: - 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 未联系自动回流
69 行
1.7 KiB
PHP
可执行文件
69 行
1.7 KiB
PHP
可执行文件
<?php
|
|
|
|
namespace app\admin\controller\wechat;
|
|
|
|
use app\common\controller\Backend;
|
|
use app\admin\model\WechatResponse;
|
|
|
|
/**
|
|
* 微信自动回复管理
|
|
*
|
|
* @icon fa fa-circle-o
|
|
*/
|
|
class Autoreply extends Backend
|
|
{
|
|
|
|
protected $model = null;
|
|
protected $noNeedRight = ['check_text_unique'];
|
|
|
|
public function _initialize()
|
|
{
|
|
parent::_initialize();
|
|
$this->model = model('WechatAutoreply');
|
|
}
|
|
|
|
/**
|
|
* 编辑
|
|
*/
|
|
public function edit($ids = null)
|
|
{
|
|
$row = $this->model->get(['id' => $ids]);
|
|
if (!$row) {
|
|
$this->error(__('No Results were found'));
|
|
}
|
|
if ($this->request->isPost()) {
|
|
$params = $this->request->post("row/a");
|
|
if ($params) {
|
|
$row->save($params);
|
|
$this->success();
|
|
}
|
|
$this->error();
|
|
}
|
|
$response = WechatResponse::get(['eventkey' => $row['eventkey']]);
|
|
$this->view->assign("response", $response);
|
|
$this->view->assign("row", $row);
|
|
return $this->view->fetch();
|
|
}
|
|
|
|
/**
|
|
* 判断文本是否唯一
|
|
* @internal
|
|
*/
|
|
public function check_text_unique()
|
|
{
|
|
$row = $this->request->post("row/a");
|
|
$except = $this->request->post("except");
|
|
$text = isset($row['text']) ? $row['text'] : '';
|
|
if ($this->model->where('text', $text)->where(function ($query) use ($except) {
|
|
if ($except) {
|
|
$query->where('text', '<>', $except);
|
|
}
|
|
})->count() == 0) {
|
|
$this->success();
|
|
} else {
|
|
$this->error(__('Text already exists'));
|
|
}
|
|
}
|
|
|
|
}
|