修改数据表名

This commit is contained in:
邹景立 2021-04-07 13:56:49 +08:00
parent 03976d94f7
commit 745e5bf0fa
18 changed files with 3916 additions and 3877 deletions

View File

@ -11,78 +11,17 @@
Target Server Version : 80018
File Encoding : 65001
Date: 07/04/2021 13:37:02
Date: 07/04/2021 13:56:07
*/
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
-- ----------------------------
-- Table structure for data_base_discount
-- Table structure for base_postage_company
-- ----------------------------
DROP TABLE IF EXISTS `data_base_discount`;
CREATE TABLE `data_base_discount` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '方案名称',
`items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '方案规则',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '方案描述',
`sort` bigint(20) NULL DEFAULT 0 COMMENT '排序权重',
`status` tinyint(1) NULL DEFAULT 1 COMMENT '方案状态(1使用,0禁用)',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_data_base_discount_status`(`status`) USING BTREE,
INDEX `idx_data_base_discount_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-基础-折扣' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_base_message
-- ----------------------------
DROP TABLE IF EXISTS `data_base_message`;
CREATE TABLE `data_base_message` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '消息类型',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '消息名称',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '消息内容',
`num_read` bigint(20) NULL DEFAULT 0 COMMENT '阅读次数',
`sort` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '排序权重',
`status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '消息状态(1使用,0禁用)',
`deleted` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '删除状态',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_data_base_message_type`(`type`) USING BTREE,
INDEX `idx_data_base_message_status`(`status`) USING BTREE,
INDEX `idx_data_base_message_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-基础-通知' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_base_payment
-- ----------------------------
DROP TABLE IF EXISTS `data_base_payment`;
CREATE TABLE `data_base_payment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付类型',
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '通道编号',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付名称',
`cover` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付图标',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付参数',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付说明',
`sort` bigint(20) NULL DEFAULT 0 COMMENT '排序权重',
`status` tinyint(1) NULL DEFAULT 1 COMMENT '支付状态(1使用,0禁用)',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_data_base_payment_type`(`type`) USING BTREE,
INDEX `idx_data_base_payment_code`(`code`) USING BTREE,
INDEX `idx_data_base_payment_status`(`status`) USING BTREE,
INDEX `idx_data_base_payment_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-基础-支付' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_base_postage_company
-- ----------------------------
DROP TABLE IF EXISTS `data_base_postage_company`;
CREATE TABLE `data_base_postage_company` (
DROP TABLE IF EXISTS `base_postage_company`;
CREATE TABLE `base_postage_company` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '快递公司名称',
`code_1` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '快递公司代码',
@ -94,18 +33,18 @@ CREATE TABLE `data_base_postage_company` (
`deleted` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '删除状态(1已删除,0未删除)',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_data_base_postage_company_code1`(`code_1`) USING BTREE,
INDEX `idx_data_base_postage_company_code2`(`code_2`) USING BTREE,
INDEX `idx_data_base_postage_company_code3`(`code_3`) USING BTREE,
INDEX `idx_data_base_postage_company_status`(`status`) USING BTREE,
INDEX `idx_data_base_postage_company_deleted`(`deleted`) USING BTREE
INDEX `idx_base_postage_company_code1`(`code_1`) USING BTREE,
INDEX `idx_base_postage_company_code2`(`code_2`) USING BTREE,
INDEX `idx_base_postage_company_code3`(`code_3`) USING BTREE,
INDEX `idx_base_postage_company_status`(`status`) USING BTREE,
INDEX `idx_base_postage_company_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 16 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据-快递-公司' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_base_postage_region
-- Table structure for base_postage_region
-- ----------------------------
DROP TABLE IF EXISTS `data_base_postage_region`;
CREATE TABLE `data_base_postage_region` (
DROP TABLE IF EXISTS `base_postage_region`;
CREATE TABLE `base_postage_region` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'ID',
`pid` int(11) UNSIGNED NULL DEFAULT 0 COMMENT '上级PID',
`first` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '首字母',
@ -118,15 +57,15 @@ CREATE TABLE `data_base_postage_region` (
`lng` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '所在经度',
`lat` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '所在纬度',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_data_base_postage_region_pid`(`pid`) USING BTREE,
INDEX `idx_data_base_postage_region_name`(`name`) USING BTREE
INDEX `idx_base_postage_region_pid`(`pid`) USING BTREE,
INDEX `idx_base_postage_region_name`(`name`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 4019 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '数据-快递-区域' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_base_postage_template
-- Table structure for base_postage_template
-- ----------------------------
DROP TABLE IF EXISTS `data_base_postage_template`;
CREATE TABLE `data_base_postage_template` (
DROP TABLE IF EXISTS `base_postage_template`;
CREATE TABLE `base_postage_template` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '模板编号',
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '模板名称',
@ -137,16 +76,77 @@ CREATE TABLE `data_base_postage_template` (
`deleted` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '删除状态',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_data_base_postage_template_code`(`code`) USING BTREE,
INDEX `idx_data_base_postage_template_status`(`status`) USING BTREE,
INDEX `idx_data_base_postage_template_deleted`(`deleted`) USING BTREE
INDEX `idx_base_postage_template_code`(`code`) USING BTREE,
INDEX `idx_base_postage_template_status`(`status`) USING BTREE,
INDEX `idx_base_postage_template_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-快递-模板' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_base_upgrade
-- Table structure for base_user_discount
-- ----------------------------
DROP TABLE IF EXISTS `data_base_upgrade`;
CREATE TABLE `data_base_upgrade` (
DROP TABLE IF EXISTS `base_user_discount`;
CREATE TABLE `base_user_discount` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '方案名称',
`items` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '方案规则',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '方案描述',
`sort` bigint(20) NULL DEFAULT 0 COMMENT '排序权重',
`status` tinyint(1) NULL DEFAULT 1 COMMENT '方案状态(1使用,0禁用)',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_base_user_discount_status`(`status`) USING BTREE,
INDEX `idx_base_user_discount_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 2 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-基础-折扣' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for base_user_message
-- ----------------------------
DROP TABLE IF EXISTS `base_user_message`;
CREATE TABLE `base_user_message` (
`id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT,
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '消息类型',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '消息名称',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '消息内容',
`num_read` bigint(20) NULL DEFAULT 0 COMMENT '阅读次数',
`sort` bigint(20) UNSIGNED NULL DEFAULT 0 COMMENT '排序权重',
`status` tinyint(1) UNSIGNED NULL DEFAULT 1 COMMENT '消息状态(1使用,0禁用)',
`deleted` tinyint(1) UNSIGNED NULL DEFAULT 0 COMMENT '删除状态',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_base_user_message_type`(`type`) USING BTREE,
INDEX `idx_base_user_message_status`(`status`) USING BTREE,
INDEX `idx_base_user_message_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 3 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-基础-通知' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for base_user_payment
-- ----------------------------
DROP TABLE IF EXISTS `base_user_payment`;
CREATE TABLE `base_user_payment` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`type` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付类型',
`code` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '通道编号',
`name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付名称',
`cover` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付图标',
`content` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '支付参数',
`remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '支付说明',
`sort` bigint(20) NULL DEFAULT 0 COMMENT '排序权重',
`status` tinyint(1) NULL DEFAULT 1 COMMENT '支付状态(1使用,0禁用)',
`deleted` tinyint(1) NULL DEFAULT 0 COMMENT '删除状态',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_base_user_payment_type`(`type`) USING BTREE,
INDEX `idx_base_user_payment_code`(`code`) USING BTREE,
INDEX `idx_base_user_payment_status`(`status`) USING BTREE,
INDEX `idx_base_user_payment_deleted`(`deleted`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-基础-支付' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for base_user_upgrade
-- ----------------------------
DROP TABLE IF EXISTS `base_user_upgrade`;
CREATE TABLE `base_user_upgrade` (
`id` bigint(20) NOT NULL AUTO_INCREMENT,
`name` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '用户级别名称',
`number` tinyint(2) NULL DEFAULT 0 COMMENT '用户级别序号',
@ -166,9 +166,9 @@ CREATE TABLE `data_base_upgrade` (
`status` tinyint(1) NULL DEFAULT 1 COMMENT '用户等级状态(1使用,0禁用)',
`create_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP COMMENT '等级创建时间',
PRIMARY KEY (`id`) USING BTREE,
INDEX `idx_data_base_upgrade_status`(`status`) USING BTREE,
INDEX `idx_data_base_upgrade_number`(`number`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-用户-等级' ROW_FORMAT = COMPACT;
INDEX `idx_base_user_upgrade_status`(`status`) USING BTREE,
INDEX `idx_base_user_upgrade_number`(`number`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 6 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '数据-用户-等级' ROW_FORMAT = COMPACT;
-- ----------------------------
-- Table structure for data_news_item

File diff suppressed because it is too large Load Diff

View File

@ -31,10 +31,10 @@ class Data extends Controller
*/
public function getNotify()
{
$query = $this->_query('DataBaseMessage')->where(['status' => 1, 'deleted' => 0]);
$query = $this->_query('BaseUserMessage')->where(['status' => 1, 'deleted' => 0]);
$result = $query->equal('id')->order('sort desc,id desc')->page(true, false, false, 20);
if (($id = input('id')) > 0) {
$this->app->db->name('DataBaseMessage')->where(['id' => $id])->inc('num_read')->update();
$this->app->db->name('BaseUserMessage')->where(['id' => $id])->inc('num_read')->update();
}
$this->success('获取系统通知数据', $result);
}

View File

@ -306,7 +306,7 @@ class Order extends Auth
if (empty($payments)) $this->error('获取订单支付参数失败');
[$map, $types] = [['status' => 1, 'deleted' => 0], []];
foreach (PaymentService::TYPES as $type => $arr) if (in_array($this->type, $arr['bind'])) $types[] = $type;
$query = $this->app->db->name('DataBasePayment')->where($map)->whereIn('type', $types)->whereIn('code', str2arr($payments));
$query = $this->app->db->name('BaseUserPayment')->where($map)->whereIn('type', $types)->whereIn('code', str2arr($payments));
$this->success('获取支付参数数据', $query->order('sort desc,id desc')->field('type,code,name,cover')->select()->toArray());
}

View File

@ -44,7 +44,7 @@ class Rebate extends Auth
{
[$map, $data] = [['number' => $this->user['vip_code']], []];
$prizes = $this->app->db->name($this->table)->group('name')->column('name');
$rebate = $this->app->db->name('DataBaseUpgrade')->where($map)->value('rebate_rule', '');
$rebate = $this->app->db->name('BaseUserUpgrade')->where($map)->value('rebate_rule', '');
$codemap = array_merge($prizes, str2arr($rebate));
foreach (RebateService::PRIZES as $prize) {
if (in_array($prize['code'], $codemap)) $data[] = $prize;

View File

@ -16,7 +16,7 @@ class Discount extends Controller
* 绑定数据表
* @var string
*/
private $table = 'DataBaseDiscount';
private $table = 'BaseUserDiscount';
/**
* 折扣方案管理

View File

@ -15,7 +15,7 @@ class Message extends Controller
* 绑定数据表
* @var string
*/
private $table = 'DataBaseMessage';
private $table = 'BaseUserMessage';
/**
* 系统通知管理

View File

@ -18,7 +18,7 @@ class Payment extends Controller
* 绑定数据表
* @var string
*/
private $table = 'DataBasePayment';
private $table = 'BaseUserPayment';
/**
* 支付通道类型

View File

@ -16,7 +16,7 @@ class Upgrade extends Controller
* 绑定数据表
* @var string
*/
private $table = 'DataBaseUpgrade';
private $table = 'BaseUserUpgrade';
/**
* 用户等级管理

View File

@ -18,7 +18,7 @@ class Company extends Controller
* 绑定数据表
* @var string
*/
private $table = 'DataBasePostageCompany';
private $table = 'BasePostageCompany';
/**
* 快递公司管理

View File

@ -17,7 +17,7 @@ class Template extends Controller
* 绑定数据表
* @var string
*/
private $table = 'DataBasePostageTemplate';
private $table = 'BasePostageTemplate';
/**
* 快递邮费模板

View File

@ -159,8 +159,8 @@ class Goods extends Controller
$this->cates = GoodsService::instance()->getCateData();
$this->trucks = ExpressService::instance()->templates();
$this->upgrades = UserUpgradeService::instance()->levels();
$this->payments = $this->app->db->name('DataBasePayment')->where(['status' => 1, 'deleted' => 0])->order('sort desc,id desc')->column('type,code,name', 'code');
$this->discounts = $this->app->db->name('DataBaseDiscount')->where(['status' => 1, 'deleted' => 0])->order('sort desc,id desc')->column('id,name,items', 'id');
$this->payments = $this->app->db->name('BaseUserPayment')->where(['status' => 1, 'deleted' => 0])->order('sort desc,id desc')->column('type,code,name', 'code');
$this->discounts = $this->app->db->name('BaseUserDiscount')->where(['status' => 1, 'deleted' => 0])->order('sort desc,id desc')->column('id,name,items', 'id');
// 商品规格处理
$fields = 'goods_sku `sku`,goods_code,goods_spec `key`,price_selling `selling`,price_market `market`,number_virtual `virtual`,number_express `express`,reward_balance `balance`,reward_integral `integral`,status';
$data['data_items'] = json_encode($this->app->db->name('ShopGoodsItem')->where(['goods_code' => $data['code']])->column($fields, 'goods_spec'), JSON_UNESCAPED_UNICODE);

View File

@ -102,7 +102,7 @@ class Order extends Controller
{
if ($this->request->isGet()) {
$map = ['deleted' => 0, 'status' => 1];
$query = $this->app->db->name('DataBasePostageCompany')->where($map);
$query = $this->app->db->name('BasePostageCompany')->where($map);
$this->items = $query->order('sort desc,id desc')->select()->toArray();
}
$this->_form('ShopOrderSend', '', 'order_no');
@ -123,7 +123,7 @@ class Order extends Controller
if (empty($order)) $this->error('订单查询异常,请稍候再试!');
// 配送快递公司填写
$map = ['code_1|code_2|code_3' => $vo['company_code']];
$company = $this->app->db->name('DataBasePostageCompany')->where($map)->find();
$company = $this->app->db->name('BasePostageCompany')->where($map)->find();
if (empty($company)) $this->error('配送快递公司异常,请重新选择快递公司!');
$vo['status'] = 2;
$vo['company_name'] = $company['name'];

View File

@ -28,7 +28,7 @@ class ExpressService extends Service
{
if (empty($codes)) return [0, $truckCount, '', '邮费模板编码为空!'];
$map = [['status', '=', 1], ['deleted', '=', 0], ['code', 'in', $codes]];
$template = $this->app->db->name('DataBasePostageTemplate')->where($map)->order('sort desc,id desc')->find();
$template = $this->app->db->name('BasePostageTemplate')->where($map)->order('sort desc,id desc')->find();
if (empty($template)) return [0, $truckCount, '', '邮费模板编码无效!'];
$rule = json_decode($template['normal'] ?: '[]', true) ?: [];
foreach (json_decode($template['content'] ?: '[]', true) ?: [] as $item) {
@ -57,7 +57,7 @@ class ExpressService extends Service
public function templates(): array
{
$map = ['status' => 1, 'deleted' => 0];
$query = $this->app->db->name('DataBasePostageTemplate')->where($map);
$query = $this->app->db->name('BasePostageTemplate')->where($map);
return $query->order('sort desc,id desc')->column('code,name,normal,content', 'code');
}

View File

@ -105,7 +105,7 @@ class OrderService extends Service
{
if ($disId > 0) {
$map = ['id' => $disId, 'status' => 1, 'deleted' => 0];
$discount = $this->app->db->name('DataBaseDiscount')->where($map)->value('items');
$discount = $this->app->db->name('BaseUserDiscount')->where($map)->value('items');
$disitems = json_decode($discount ?: '[]', true) ?: [];
if (is_array($disitems) && count($disitems) > 0) foreach ($disitems as $vo) {
if ($vo['level'] == $vipCode) $disRate = floatval($vo['discount']);

View File

@ -202,7 +202,7 @@ abstract class PaymentService
try {
if (empty($payment)) {
$map = ['code' => $code, 'status' => 1, 'deleted' => 0];
$payment = app()->db->name('DataBasePayment')->where($map)->find();
$payment = app()->db->name('BaseUserPayment')->where($map)->find();
}
if (empty($payment)) {
throw new Exception("支付参数[#{$code}]禁用关闭");

View File

@ -175,7 +175,7 @@ class RebateService extends Service
private function checkPrizeStatus(string $prize, int $level): bool
{
$map = [['number', '=', $level], ['rebate_rule', 'like', "%,{$prize},%"]];
return $this->app->db->name('DataBaseUpgrade')->where($map)->count() > 0;
return $this->app->db->name('BaseUserUpgrade')->where($map)->count() > 0;
}
/**
@ -306,11 +306,11 @@ class RebateService extends Service
$puids = array_reverse(str2arr($this->user['path'], '-'));
if (empty($puids) || $this->order['amount_total'] <= 0) return false;
// 获取可以参与奖励的代理
$vips = $this->app->db->name('DataBaseUpgrade')->whereLike('rebate_rule', '%,' . self::PRIZE_05 . ',%')->column('number');
$vips = $this->app->db->name('BaseUserUpgrade')->whereLike('rebate_rule', '%,' . self::PRIZE_05 . ',%')->column('number');
$users = $this->app->db->name('DataUser')->whereIn('vip_code', $vips)->whereIn('id', $puids)->orderField('id', $puids)->select()->toArray();
// 查询需要计算奖励的商品
foreach ($this->app->db->name('ShopOrderItem')->where(['order_no' => $this->order['order_no']])->cursor() as $item) {
$itemJson = $this->app->db->name('DataBaseDiscount')->where(['status' => 1, 'deleted' => 0])->value('items');
$itemJson = $this->app->db->name('BaseUserDiscount')->where(['status' => 1, 'deleted' => 0])->value('items');
if (!empty($itemJson) && is_array($rules = json_decode($itemJson, true))) {
[$tVip, $tRate] = [$item['vip_code'], $item['discount_rate']];
foreach ($rules as $rule) if ($rule['level'] > $tVip) foreach ($users as $user) if ($user['vip_code'] > $tVip) {
@ -346,7 +346,7 @@ class RebateService extends Service
// 记录原始等级
$prevLevel = $this->user['vip_code'];
// 获取可以参与奖励的代理
$vips = $this->app->db->name('DataBaseUpgrade')->whereLike('rebate_rule', '%,' . self::PRIZE_06 . ',%')->column('number');
$vips = $this->app->db->name('BaseUserUpgrade')->whereLike('rebate_rule', '%,' . self::PRIZE_06 . ',%')->column('number');
foreach ($this->app->db->name('DataUser')->whereIn('vip_code', $vips)->whereIn('id', $puids)->orderField('id', $puids)->cursor() as $user) {
if ($user['vip_code'] > $prevLevel) {
if (($amount = $this->_prize06amount($prevLevel + 1, $user['vip_code'])) > 0.00) {

View File

@ -18,7 +18,7 @@ class UserUpgradeService extends Service
*/
public function levels(): array
{
$query = $this->app->db->name('DataBaseUpgrade');
$query = $this->app->db->name('BaseUserUpgrade');
return $query->where(['status' => 1])->order('number asc')->column('*', 'number');
}
@ -81,7 +81,7 @@ class UserUpgradeService extends Service
$teamsIndirect = $this->app->db->name('DataUser')->where(['pid2' => $uid])->whereRaw('vip_code>0')->count();
$teamsUsers = $this->app->db->name('DataUser')->where(['pid1|pid2' => $uid])->whereRaw('vip_code>0')->count();
// 计算用户等级
foreach ($this->app->db->name('DataBaseUpgrade')->where(['status' => 1])->order('number desc')->cursor() as $item) {
foreach ($this->app->db->name('BaseUserUpgrade')->where(['status' => 1])->order('number desc')->cursor() as $item) {
$l1 = empty($item['goods_vip_status']) || $user['buy_vip_entry'] > 0;
$l2 = empty($item['teams_users_status']) || $item['teams_users_number'] <= $teamsUsers;
$l3 = empty($item['order_amount_status']) || $item['order_amount_number'] <= $orderAmount;
@ -101,7 +101,7 @@ class UserUpgradeService extends Service
$tmpCode = $query->whereRaw("a.uid={$uid} and a.payment_status=1 and a.status>=4 and b.vip_entry=1")->max('b.vip_upgrade');
if ($tmpCode > $vipCode) {
$map = ['status' => 1, 'number' => $tmpCode];
$upgrade = $this->app->db->name('DataBaseUpgrade')->where($map)->find();
$upgrade = $this->app->db->name('BaseUserUpgrade')->where($map)->find();
if (!empty($upgrade)) [$vipName, $vipCode] = [$upgrade['name'], $upgrade['number']];
} else {
$orderNo = null;
@ -110,7 +110,7 @@ class UserUpgradeService extends Service
$tmpCode = $this->app->db->name('DataUserBalance')->where(['uid' => $uid, 'deleted' => 0])->max('upgrade');
if ($tmpCode > $vipCode) {
$map = ['status' => 1, 'number' => $tmpCode];
$upgrade = $this->app->db->name('DataBaseUpgrade')->where($map)->find();
$upgrade = $this->app->db->name('BaseUserUpgrade')->where($map)->find();
if (!empty($upgrade)) [$vipName, $vipCode] = [$upgrade['name'], $upgrade['number']];
}
// 统计用户订单金额