feat: 修改了 StoreRefundOrderLists 和 UserRechargeLists 类以获取用户真实姓名和昵称
This commit is contained in:
parent
b8d086f35d
commit
68d55fa04e
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\user_product_storage;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\user_product_storage\UserProductStorageLists;
|
||||
|
||||
|
||||
/**
|
||||
* 用户商品储存控制器
|
||||
* Class UserProductStorageController
|
||||
* @package app\admin\controller\user_product_storage
|
||||
*/
|
||||
class UserProductStorageController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户商品储存列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/28 11:05
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new UserProductStorageLists());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\controller\user_product_storage_log;
|
||||
|
||||
|
||||
use app\admin\controller\BaseAdminController;
|
||||
use app\admin\lists\user_product_storage_log\UserProductStorageLogLists;
|
||||
use app\admin\logic\user_product_storage_log\UserProductStorageLogLogic;
|
||||
use app\admin\validate\user_product_storage_log\UserProductStorageLogValidate;
|
||||
|
||||
|
||||
/**
|
||||
* 用户商品储存操作日志控制器
|
||||
* Class UserProductStorageLogController
|
||||
* @package app\admin\controller\user_product_storage_log
|
||||
*/
|
||||
class UserProductStorageLogController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户商品储存操作日志列表
|
||||
* @return \think\response\Json
|
||||
* @author admin
|
||||
* @date 2024/06/28 11:15
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new UserProductStorageLogLists());
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\enum\OrderEnum;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\store_order\StoreOrder;
|
||||
use app\common\model\user\User;
|
||||
|
||||
class StoreRefundOrderLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
@ -38,7 +39,7 @@ class StoreRefundOrderLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
public function lists(): array
|
||||
{
|
||||
$this->searchWhere[] = ['refund_status','>', 0];
|
||||
return StoreOrder::with(['user', 'staff', 'product' => function ($query) {
|
||||
return StoreOrder::with(['staff', 'product' => function ($query) {
|
||||
$query->field(['id', 'oid', 'product_id', 'cart_info']);
|
||||
}])
|
||||
->where($this->searchWhere)
|
||||
@ -46,6 +47,15 @@ class StoreRefundOrderLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
if ($item['uid'] <= 0) {
|
||||
$item['nickname'] = '游客';
|
||||
} else {
|
||||
$id = $item['uid'];
|
||||
$user=User::where('id', $item['uid'])->field('real_name,nickname')->find();
|
||||
if($user){
|
||||
$item['nickname'] =$user['real_name']!=''?$user['real_name'].'|'.$id:$user['nickname'].'|'.$id;
|
||||
}
|
||||
}
|
||||
$item['pay_time'] = $item['pay_time'] > 0 ? date('Y-m-d H:i:s', $item['pay_time']) : '';
|
||||
$item['refund_status_name'] = OrderEnum::refundStatus($item['refund_status']) ?? '';
|
||||
$item['refund_type_name'] = OrderEnum::refundType($item['refund_type']) ?? '';
|
||||
|
@ -0,0 +1,72 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\user_product_storage;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\user_product_storage\UserProductStorage;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* 用户商品储存列表
|
||||
* Class UserProductStorageLists
|
||||
* @package app\admin\listsuser_product_storage
|
||||
*/
|
||||
class UserProductStorageLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/06/28 11:05
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['uid', 'oid', 'product_id'],
|
||||
'between_time' => ['create_time'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户商品储存列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/06/28 11:05
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return UserProductStorage::where($this->searchWhere)
|
||||
->field(['id', 'uid', 'oid', 'product_id', 'nums', 'status','create_time'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
$user=User::where('id',$item['uid'])->field('nickname,real_name')->find();
|
||||
$item['nickname']=$user['real_name']?$user['real_name'].'|'.$item['uid']:$user['nickname'].'|'.$item['uid'];
|
||||
$item['store_name']=StoreProduct::where('id',$item['product_id'])->value('store_name');
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户商品储存数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/06/28 11:05
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserProductStorage::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,78 @@
|
||||
<?php
|
||||
|
||||
namespace app\admin\lists\user_product_storage_log;
|
||||
|
||||
|
||||
use app\admin\lists\BaseAdminDataLists;
|
||||
use app\common\model\user_product_storage_log\UserProductStorageLog;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\store_product\StoreProduct;
|
||||
use app\common\model\system_store\SystemStore;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* 用户商品储存操作日志列表
|
||||
* Class UserProductStorageLogLists
|
||||
* @package app\admin\listsuser_product_storage_log
|
||||
*/
|
||||
class UserProductStorageLogLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author admin
|
||||
* @date 2024/06/28 11:15
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'between_time' => ['create_time'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户商品储存操作日志列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author admin
|
||||
* @date 2024/06/28 11:15
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return UserProductStorageLog::where($this->searchWhere)
|
||||
->field(['id', 'oid', 'uid', 'product_id', 'store_id', 'financial_pm', 'nums'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function($item){
|
||||
$user=User::where('id',$item['uid'])->field('nickname,real_name')->find();
|
||||
$item['system_store_name']=SystemStore::where('id',$item['store_id'])->value('name');
|
||||
$item['nickname']=$user['real_name']?$user['real_name'].'|'.$item['uid']:$user['nickname'].'|'.$item['uid'];
|
||||
$item['store_name']=StoreProduct::where('id',$item['product_id'])->value('store_name');
|
||||
if($item['financial_pm']==1){
|
||||
$item['financial_pm']='增加';
|
||||
}else{
|
||||
$item['financial_pm']='减少';
|
||||
}
|
||||
return $item;
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取用户商品储存操作日志数量
|
||||
* @return int
|
||||
* @author admin
|
||||
* @date 2024/06/28 11:15
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return UserProductStorageLog::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -48,7 +48,11 @@ class UserRechargeLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
$item['nickname']=User::where('id',$item['uid'])->value('nickname');
|
||||
$id = $item['uid'];
|
||||
$user=User::where('id', $item['uid'])->field('real_name,nickname')->find();
|
||||
if($user){
|
||||
$item['nickname'] =$user['real_name']!=''?$user['real_name'].'|'.$id:$user['nickname'].'|'.$id;
|
||||
}
|
||||
if($item['pay_time']>0){
|
||||
$item['pay_time']=date('Y-m-d H:i:s',$item['pay_time']);
|
||||
}else{
|
||||
|
Loading…
x
Reference in New Issue
Block a user