where('action', $ledgerTokenChangeModel::Share)->sum("change_amount"); $list['data'] = $ledgerTokenChangeModel::where('user_id', $uid) ->where('action', $ledgerTokenChangeModel::Share) ->order('id desc') ->paginate($pageSize); $list['statusList'] = $ledgerTokenChangeModel::getStatusList(); return $list; } //获取用户发行Nft列表 public static function getUserNftList(object $productOrder, object $productTransfer, string $lan, int $uid, int $pageSize, array $where): object { $list = $productOrder->alias('a') ->join("product_list b", "b.id = a.product_id", "left") ->join("products c", "c.id = b.type_id", "left") ->join("product_transfer z", "a.id = z.order_id AND a.status=2", "left") //转让 ->join("product_area d", "d.id = a.area_id", "left") //地区 ->field('a.id as order_id,a.product_id,'.'b.'.$lan.'_name as name,b.thum as img_url,a.price,a.status,a.order_no,a.type_id,c.'.$lan.'_title as title, z.price as transfer_price,d.address,b.min_transfer_fee,b.max_transfer_fee,b.gift_fee,b.freight,b.is_transfer,b.is_gift,b.is_freight,b.is_storage,b.is_buying') ->where('a.user_id', $uid) ->where($where) ->order('a.id DESC') ->paginate($pageSize); //地板价格 foreach ($list as &$item) { if($item->price == 0) $item->floor_price = $productTransfer::getTransferMinPrice($item->product_id); } return $list; } //获取自己发行的Nft列表 public static function getMyUserNftList(object $productOrder, int $uid, string $lan, array $where, int $pageSize): object { return $productOrder->alias('a') ->join("product_list b", "b.id = a.product_id", "left") ->field('a.id as order_id,a.product_id,'.'b.'.$lan.'_name as name,b.thum as img_url,a.price,a.status,a.type_id, count(a.num) as hold_num') ->where('a.user_id', $uid) ->group('a.product_id') ->where($where) ->order('a.id DESC') ->paginate($pageSize); } //获取我的茶友好列表 public static function getUserChaList(object $userModel, int $uid, int $pageSize): array { // 总推荐数 $list['total'] = $userModel::where('parent_id', $uid)->count(); // 直推列表 $list['data'] = $userModel::where('parent_id', $uid) ->field("address,address_level,create_time,nickname,direct_super,REPLACE(phone, SUBSTRING(phone, 4, 4), '****') as phone") ->order('id desc') ->paginate($pageSize); return $list; } public static function getUserOperateLog(object $productOrder, string $lan, int $uid, int $pageSize, array $where): array { $list['data'] = $productOrder->alias('a') ->join("product_list b", "b.id = a.product_id", "left") ->join("product_area d", "d.id = a.area_id", "left") //地区 ->field('a.id as order_id,a.product_id,'.'b.'.$lan.'_name as name,b.thum as img_url,a.price,a.status,a.type_id,a.create_time,d.province,d.city,d.area,d.county') ->where('a.user_id', $uid) ->where($where) ->order('a.id DESC') ->paginate($pageSize); foreach ($list['data'] as &$item) { $item->address_id = ''; if($item->province > 0) $item->address_id .= $item->province.'-'; if($item->city > 0) $item->address_id .= $item->city.'-'; if($item->area > 0) $item->address_id .= $item->area.'-'; if($item->county > 0) $item->address_id .= $item->county.'-'; $item->address_id = rtrim($item->address_id, '-'); } $list['statusList'] = $productOrder::getStatusAll(); return $list; } /** * 我的茶权搜索条件 * @return array */ public static function getNftWhere(int $typeId, int $productId , object $productOrder): array { $where = []; switch ($typeId) { case 0: //持有= 抢购+转让中+存储 $where['a.status'] = ['in' , [$productOrder::Paid, $productOrder::Transferred, $productOrder::Freeze]]; $where['b.is_show'] = ['=' , ProductLists::Normal]; break; case 1: $where = ['a.type_id' => $productOrder::Transfer, 'a.status' => $productOrder::Transferred]; break; case 2: $where = ['a.type_id' => $productOrder::Transfer, 'a.status' => $productOrder::Closure]; break; case 3: $where = ['a.type_id' => $productOrder::Popular, 'a.status' => $productOrder::Closure]; break; case 4: $where = ['a.type_id' => $productOrder::Giveaway, 'a.status' => $productOrder::Closure]; break; case 5: $where = ['a.type_id' => $productOrder::Popular, 'a.status' => $productOrder::Shipped]; break; } if($productId > 0) $where['a.product_id'] = ['=' , $productId]; return $where; } /** * 操作记录搜索条件 * @return array */ public static function getOperateWhere(int $typeId, int $status, string $areaId) { $where = []; //类型 if($typeId > 0 || $status > 0) $where = ['a.type_id' => $typeId, 'a.status' => $status]; //编号Id if(!empty($areaId)){ $arr = explode('-', $areaId); if(count($arr) > 0) { if(isset($arr[0])) $where['d.province'] = ['=', $arr[0]]; if(isset($arr[1])) $where['d.city'] = ['=', $arr[1]]; if(isset($arr[2])) $where['d.area'] = ['=', $arr[2]]; if(isset($arr[3])) $where['d.county'] = ['=', $arr[3]]; } } return $where; } }