Commit 716b080d by zhufx

1.公共实体增加获取表明方法(Query::Table的时候用)

2.订单错误码更新
parent 3298c078
......@@ -58,6 +58,16 @@ class CommonEntity extends Model
}
/**
* 获取分库表明
* @throws Exception
*/
public static function tableName()
{
$num = self::getDbNum();
return self::getTableName().'_'.$num;
}
/**
* 获取数据库id
* @return int
* @throws Exception
......@@ -75,10 +85,13 @@ class CommonEntity extends Model
}
/**
* 设置表名
* @param $dbNum
*/
private static function setTableName($dbNum)
{
preg_match('/(?<=Table\(name=").*(?="\))/', self::$commentString, $matches);
$tableName = isset($matches[0])?$matches[0]:'';
$tableName = self::getTableName();
EntityCollector::collect(
static::class,
......@@ -86,4 +99,14 @@ class CommonEntity extends Model
);
}
/**
* 获取原始表名
* @return string
*/
private static function getTableName()
{
preg_match('/(?<=Table\(name=").*(?="\))/', self::$commentString, $matches);
return $tableName = isset($matches[0])?$matches[0]:'';
}
}
\ No newline at end of file
......@@ -37,6 +37,13 @@ class OrderError
const O_CREATE_ERR = ["msg" => "创建订单失败", "code" => 500, "errorCode" => 22110];
const O_GOODS_SAVE_ERR = ["msg" => "商品订单存入失败", "code" => 500, "errorCode" => 22111];
const O_CUT_PRICE_SAVE_ERR = ["msg" => "砍价订单存入失败", "code" => 500, "errorCode" => 22115];
const O_NOT_FOUND = ["msg" => "订单不存在", "code" => 404, "errorCode" => 22116];
const O_STATUS_ERR = ["msg" => "订单状态错误,无法操作", "code" => 400, "errorCode" => 22117];
const DB_ERROR = ["msg" => "数据库操作错误", "code" => 500, "errorCode" => 22118];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment