update 首单订单详情

This commit is contained in:
chenbo 2024-01-22 15:13:22 +08:00
parent bb28bbd410
commit c678d95e4d
2 changed files with 42 additions and 1 deletions

View File

@ -322,10 +322,15 @@ class UserController extends BaseApiController
{ {
$page = $this->request->param('page_no', 1); $page = $this->request->param('page_no', 1);
$limit = $this->request->param('page_size', 15); $limit = $this->request->param('page_size', 15);
$firstOrderLogList = Db::name('user_invite_first_order_log')->where('user_id', $this->userId)->page($page, $limit)->select(); $firstOrderLogList = Db::name('user_invite_first_order_log')->where('user_id', $this->userId)->page($page, $limit)->select()->toArray();
foreach ($firstOrderLogList as &$item) {
$item['order_info'] = Db::connect('mysql2')->name('store_order')->alias('o')->field('o.total_num,p.store_name,p.image')->leftJoin('store_order_product op', 'o.order_id=op.order_id')->leftJoin('store_product p', 'op.product_id = p.product_id')->where('o.order_sn', $item['order_no'])->select();
}
$data = [ $data = [
'lists' => $firstOrderLogList, 'lists' => $firstOrderLogList,
'count' => Db::name('user_invite_first_order_log')->where('user_id', $this->userId)->count(), 'count' => Db::name('user_invite_first_order_log')->where('user_id', $this->userId)->count(),
'total_money' => Db::name('user_invite_first_order_log')->where('user_id', $this->userId)->sum('order_money'),
'page_no' => $page, 'page_no' => $page,
'page_size' => $limit, 'page_size' => $limit,
]; ];

View File

@ -56,7 +56,43 @@ return [
// 开启字段缓存 // 开启字段缓存
'fields_cache' => false, 'fields_cache' => false,
], ],
'mysql2' => [
// 数据库类型
'type' => env('database2.type', 'mysql'),
// 服务器地址
'hostname' => env('database2.hostname', '127.0.0.1'),
// 数据库名
'database' => env('database2.database', ''),
// 用户名
'username' => env('database2.username', 'root'),
// 密码
'password' => env('database2.password', ''),
// 端口
'hostport' => env('database2.hostport', '3306'),
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => env('database2.charset', 'utf8'),
// 数据库表前缀
'prefix' => env('database2.prefix', ''),
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => true,
// 是否需要断线重连
'break_reconnect' => false,
// 监听SQL
'trigger_sql' => env('app_debug', true),
// 开启字段缓存
'fields_cache' => false,
],
// 更多的数据库配置信息 // 更多的数据库配置信息
], ],
]; ];