feat: 新增账号安全模块及资质校验功能
- 新增账号安全页面及支付密码验证组件 - 新增用户类型选择流程及商家资质管理 - 新增订单资质校验逻辑,师傅需满足订单证书要求 - 新增企业资质认证相关数据库表及接口 - 优化用户列表展示,区分个人与商家用户类型
这个提交包含在:
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
namespace app\api\controller {
|
||||
class Base {
|
||||
public $request;
|
||||
protected function requireMaster() { return ['id' => 5, 'work_status' => 'on']; }
|
||||
protected function uid() { return 7; }
|
||||
protected function error($message) { throw new \RuntimeException($message); }
|
||||
}
|
||||
}
|
||||
namespace think {
|
||||
class Db {
|
||||
public static $order;
|
||||
public static $certs = [];
|
||||
public static function name($name) { return new Query($name); }
|
||||
}
|
||||
class Query {
|
||||
private $table;
|
||||
public function __construct($table) { $this->table = $table; }
|
||||
public function where(...$args) { return $this; }
|
||||
public function field(...$args) { return $this; }
|
||||
public function find() { return $this->table === 'order' ? Db::$order : null; }
|
||||
public function select() { return Db::$certs; }
|
||||
public function update($values) { throw new \RuntimeException('REACHED_GRAB_UPDATE'); }
|
||||
public function insert($values) { throw new \RuntimeException('REACHED_QUOTE_INSERT'); }
|
||||
}
|
||||
}
|
||||
namespace {
|
||||
require __DIR__ . '/../server/application/common/library/OrderStatus.php';
|
||||
require __DIR__ . '/../server/application/common/library/OrderQualification.php';
|
||||
require __DIR__ . '/../server/application/api/controller/Master.php';
|
||||
class RequestStub { public function post($key, $default = null) { return ['order_id' => 12, 'amount' => 100][$key] ?? $default; } }
|
||||
$api = new \app\api\controller\Master();
|
||||
$api->request = new RequestStub();
|
||||
$base = ['id' => 12, 'user_id' => 8, 'master_id' => 0, 'status' => \app\common\library\OrderStatus::PENDING_ACCEPT, 'qual_req' => '电工证'];
|
||||
function expectResult($api, $method, $expected) {
|
||||
try { $api->$method(); throw new \RuntimeException('unexpected success'); }
|
||||
catch (\RuntimeException $e) { if (strpos($e->getMessage(), $expected) === false) throw $e; }
|
||||
}
|
||||
foreach (['grab' => 'fixed', 'quote' => 'quote'] as $method => $type) {
|
||||
\think\Db::$order = $base + ['price_type' => $type];
|
||||
\think\Db::$certs = [];
|
||||
expectResult($api, $method, '请先上传认证证书');
|
||||
\think\Db::$certs = [['cert_name'=>'电工证', 'cert_code'=>'electrician', 'is_custom'=>0, 'status'=>'pass', 'is_long_term'=>1, 'expire_date'=>null]];
|
||||
expectResult($api, $method, $method === 'grab' ? 'REACHED_GRAB_UPDATE' : 'REACHED_QUOTE_INSERT');
|
||||
\think\Db::$order['qual_req'] = '';
|
||||
\think\Db::$certs = [];
|
||||
expectResult($api, $method, $method === 'grab' ? 'REACHED_GRAB_UPDATE' : 'REACHED_QUOTE_INSERT');
|
||||
}
|
||||
echo "Order qualification endpoint checks passed\n";
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户