{{ t('orderInfo') }}
- -
- {{ t('refundContent') }}
- - - -
- {{ t('mapSetting') }}
{{ t('websiteInfo') }}
{{ t('frontEndInfo') }}
{{ t('serviceInformation') }}
-
-
@@ -91,4 +79,4 @@
-{/block}
\ No newline at end of file
+{/block}
diff --git a/niucloud/app/job/pay/PayReturnTo.php b/niucloud/app/job/pay/PayReturnTo.php
index 3d1ca0f1c..bcc523faf 100644
--- a/niucloud/app/job/pay/PayReturnTo.php
+++ b/niucloud/app/job/pay/PayReturnTo.php
@@ -26,11 +26,11 @@ class PayReturnTo extends BaseJob
* @param $data
* @return true
*/
- protected function doJob($data)
+ protected function doJob($site_id, $out_trade_no)
{
- Log::write('pay_log_' . json_encode($data));
- $res = (new CorePayService())->returnTo($data['site_id'], $data['out_trade_no']);
+ Log::write('pay_log_' . $site_id.'_'.$out_trade_no);
+ $res = (new CorePayService())->returnTo($site_id, $out_trade_no);
return true;
}
diff --git a/niucloud/app/model/member/MemberLabel.php b/niucloud/app/model/member/MemberLabel.php
index e6a18feef..28aae7cc0 100644
--- a/niucloud/app/model/member/MemberLabel.php
+++ b/niucloud/app/model/member/MemberLabel.php
@@ -43,8 +43,13 @@ class MemberLabel extends BaseModel
*/
public function getMemberNumAttr($value, $data)
{
- if (isset($data['label_id'])) {
- return (new Member())->where([['member_label', 'like', '%"' . $data['label_id'] . '"%']])->count();
+ if (isset($data[ 'label_id' ])) {
+ $like_arr = [
+ '[' . $data[ 'label_id' ] . ']',
+ '[' . $data[ 'label_id' ] . ',%',
+ '%,' . $data[ 'label_id' ] . ']'
+ ];
+ return ( new Member() )->where([ [ 'member_label', "like", $like_arr, 'or' ] ])->count();
} else
return 0;
}
diff --git a/niucloud/app/model/order/RechargeOrder.php b/niucloud/app/model/order/RechargeOrder.php
deleted file mode 100644
index 24ca792f6..000000000
--- a/niucloud/app/model/order/RechargeOrder.php
+++ /dev/null
@@ -1,225 +0,0 @@
- 'timestamp',
- 'close_time' => 'timestamp',
- ];
-
-
- /**
- * 登录渠道字段转化
- * @param $value
- * @param $data
- * @return mixed
- */
- public function getOrderFromNameAttr($value, $data)
- {
- if (isset($data['order_from'])) {
- return ChannelDict::getType()[$data['order_from']] ?? '';
- }
-
- }
-
- /**
- * 会员id搜索
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchMemberIdAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('member_id', '=', $value);
- }
- }
-
- /**
- * 订单来源
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchOrderFromAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('order_from', '=', $value);
- }
- }
-
- /**
- * 订单类型
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchOrderTypeAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('order_type', '=', $value);
- }
- }
-
- /**
- * 支付流水号
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchOutTradeNoAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('out_trade_no', '=', $value);
- }
- }
-
- /**
- * 订单号
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchOrderNoAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('order_no', '=', $value);
- }
- }
-
- /**
- * 订单金额
- * @param $query
- * @param $value
- * @param $data
- * @return void
- */
- public function searchOrderMoneyAttr($query, $value, $data)
- {
- if (!empty($data['start_money']) && !empty($data['end_money'])) {
- $money = [$data['start_money'], $data['end_money']];
- sort($money);
- $query->where('order_money', 'between', $money);
- } else if (!empty($data['start_money'])) {
- $query->where('order_money', '>=', $data['start_money']);
- } else if (!empty($data['end_money'])) {
- $query->where('order_money', '<=', $data['end_money']);
- }
- }
-
- /**
- * 订单状态
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchOrderStatusAttr($query, $value, $data)
- {
- if ($value != '') {
- $query->where('order_status', '=', $value);
- }
- }
-
- /**
- * 创建时间搜索器
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchCreateTimeAttr($query, $value, $data)
- {
- $start_time = empty($value[0]) ? 0 : strtotime($value[0]);
- $end_time = empty($value[1]) ? 0 : strtotime($value[1]);
- if ($start_time > 0 && $end_time > 0) {
- $query->whereBetweenTime('create_time', $start_time, $end_time);
- } else if ($start_time > 0 && $end_time == 0) {
- $query->where([['create_time', '>=', $start_time]]);
- } else if ($start_time == 0 && $end_time > 0) {
- $query->where([['create_time', '<=', $end_time]]);
- }
- }
-
- /**
- * 支付时间筛选
- * @param $query
- * @param $value
- * @param $data
- * @return void
- */
- public function searchPayTimeAttr($query, $value, $data)
- {
- $start_time = empty($value[0]) ? 0 : strtotime($value[0]);
- $end_time = empty($value[1]) ? 0 : strtotime($value[1]);
- if ($start_time > 0 && $end_time > 0) {
- $query->whereBetweenTime('pay_time', $start_time, $end_time);
- } else if ($start_time > 0 && $end_time == 0) {
- $query->where([['pay_time', '>=', $start_time]]);
- } else if ($start_time == 0 && $end_time > 0) {
- $query->where([['pay_time', '<=', $end_time]]);
- }
- }
-
- /**
- * 订单项目
- * @return HasMany
- */
- public function item()
- {
- return $this->hasMany(RechargeOrderItem::class, 'order_id', 'order_id');
- }
-
- /**
- * 订单会员
- * @return HasOne
- */
- public function member()
- {
- return $this->hasOne(Member::class, 'member_id', 'member_id');
- }
-
- /**
- * 支付记录
- * @return HasOne
- */
- public function pay()
- {
- return $this->hasOne(Pay::class, 'out_trade_no', 'out_trade_no')->bind(['pay_type_name' => 'type_name']);
- }
-}
diff --git a/niucloud/app/model/order/RechargeOrderItem.php b/niucloud/app/model/order/RechargeOrderItem.php
deleted file mode 100644
index 2b8b2422a..000000000
--- a/niucloud/app/model/order/RechargeOrderItem.php
+++ /dev/null
@@ -1,66 +0,0 @@
-hasOne(RechargeOrder::class, 'order_id', 'order_id')->joinType('left')->withField('order_id, order_no')->bind(['order_no' => 'order_no']);
- }
-
- /**
- * 数量字段处理
- * @param $value
- * @param $data
- * @return string|void
- */
- public function getNumAttr($value, $data)
- {
- if (isset($data['num'])) {
- return number_format($data['num']);
- }
- }
-
- /**
- * 关联订单主表
- * @return HasOne
- */
- public function ordermain()
- {
- return $this->hasOne(RechargeOrder::class, 'order_id')->joinType('inner');
- }
-}
diff --git a/niucloud/app/model/order/RechargeOrderItemRefund.php b/niucloud/app/model/order/RechargeOrderItemRefund.php
deleted file mode 100644
index 76ae1792d..000000000
--- a/niucloud/app/model/order/RechargeOrderItemRefund.php
+++ /dev/null
@@ -1,216 +0,0 @@
- 'timestamp',
- 'audit_time' => 'timestamp',
- 'transfer_time' => 'timestamp',
- ];
-
- /**
- * 数据表主键
- * @var string
- */
- protected $pk = 'refund_id';
-
- /**
- * 模型名称
- * @var string
- */
- protected $name = 'recharge_order_item_refund';
-
- /**
- * 退款状态字段处理
- * @param $value
- * @param $data
- * @return mixed
- */
- public function getStatusNameAttr($value, $data)
- {
- if (empty($data['status']))
- return '';
- $temp = RechargeOrderDict::getRefundStatus()[$data['status']] ?? [];
- return $temp['name'] ?? '';
- }
-
- /**
- *
- * @return HasOne
- */
- public function item()
- {
- return $this->hasOne(RechargeOrderItem::class, 'order_item_id', 'order_item_id')->joinType('inner');
- }
-
- /**
- * 订单会员
- * @return HasOne
- */
- public function member()
- {
- return $this->hasOne(Member::class, 'member_id', 'member_id')->withField('member_id, username, mobile, nickname, headimg')->joinType('left');
- }
-
- /**
- * 关联退款支付记录表
- * @return HasOne
- */
- public function payrefund()
- {
- return $this->hasOne(Refund::class, 'refund_no', 'refund_no');
- }
-
- /**
- * 会员id搜索
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchRefundNoAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('refund_no', '=', $value);
- }
- }
-
-
- /**
- * 订单号搜索
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchOrderNoAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('order_no', '=', $value);
- }
- }
-
- /**
- * 订单号搜索(用于关联)
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchJoinOrderNoAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('recharge_order_item_refund.order_no', '=', $value);
- }
- }
-
- /**
- * 会员id搜索
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchMemberIdAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('member_id', '=', $value);
- }
- }
-
- /**
- * 会员id搜索
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchJoinMemberIdAttr($query, $value, $data)
- {
- if ($value) {
- $query->where('recharge_order_item_refund.member_id', '=', $value);
- }
- }
-
- /**
- * 退款状态
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchStatusAttr($query, $value, $data)
- {
- if ($value != '') {
- $query->where('status', '=', $value);
- }
- }
-
- /**
- * 退款状态
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchJoinStatusAttr($query, $value, $data)
- {
- if ($value != '') {
- $query->where('recharge_order_item_refund.status', '=', $value);
- }
- }
-
- /**
- * 创建时间搜索器
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchCreateTimeAttr($query, $value, $data)
- {
- $start_time = empty($value[0]) ? 0 : strtotime($value[0]);
- $end_time = empty($value[1]) ? 0 : strtotime($value[1]);
- if ($start_time > 0 && $end_time > 0) {
- $query->whereBetweenTime('create_time', $start_time, $end_time);
- } else if ($start_time > 0 && $end_time == 0) {
- $query->where([['create_time', '>=', $start_time]]);
- } else if ($start_time == 0 && $end_time > 0) {
- $query->where([['create_time', '<=', $end_time]]);
- }
- }
-
- /**
- * 创建时间搜索器
- * @param $query
- * @param $value
- * @param $data
- */
- public function searchJoinCreateTimeAttr($query, $value, $data)
- {
- $start_time = empty($value[0]) ? 0 : strtotime($value[0]);
- $end_time = empty($value[1]) ? 0 : strtotime($value[1]);
- if ($start_time > 0 && $end_time > 0) {
- $query->whereBetweenTime('recharge_order_item_refund.create_time', $start_time, $end_time);
- } else if ($start_time > 0 && $end_time == 0) {
- $query->where([['recharge_order_item_refund.create_time', '>=', $start_time]]);
- } else if ($start_time == 0 && $end_time > 0) {
- $query->where([['recharge_order_item_refund.create_time', '<=', $end_time]]);
- }
- }
-}
diff --git a/niucloud/app/model/order/RechargeOrderLog.php b/niucloud/app/model/order/RechargeOrderLog.php
deleted file mode 100644
index dc0b3b758..000000000
--- a/niucloud/app/model/order/RechargeOrderLog.php
+++ /dev/null
@@ -1,37 +0,0 @@
-hasOne(Site::class, 'site_id', 'site_id')->joinType('inner')
->withField('site_id, site_name, app_type, status, expire_time')
- ->bind(['site_name', 'app_type', 'status', 'expire_time', 'status_name'])->append(['status_name']);
+ ->bind(['site_name', 'app_type', 'status', 'expire_time', 'status_name', 'site_status_name'])->append(['status_name', 'site_status_name']);
}
/**
diff --git a/niucloud/app/service/admin/diy/DiyService.php b/niucloud/app/service/admin/diy/DiyService.php
index 0b8f7b9d1..152a79245 100644
--- a/niucloud/app/service/admin/diy/DiyService.php
+++ b/niucloud/app/service/admin/diy/DiyService.php
@@ -48,7 +48,7 @@ class DiyService extends BaseAdminService
public function getPage(array $where = [])
{
$where[] = [ 'site_id', '=', $this->site_id ];
- $field = 'id,site_id,title,name,template,type,mode,is_default,share,visit_count,create_time,update_time';
+ $field = 'id,site_id,title,name,template,type,mode,is_default,share,visit_count,create_time,update_time,value';
$order = "update_time desc";
$search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ "title", "type", 'mode', 'addon_name' ], $where)->field($field)->order($order)->append([ 'type_name', 'type_page', 'addon_name' ]);
return $this->pageQuery($search_model);
@@ -66,7 +66,7 @@ class DiyService extends BaseAdminService
public function getList(array $where = [], $field = 'id,title,name,template,type,mode,is_default,share,visit_count,create_time,update_time')
{
$order = "update_time desc";
- return $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ "title", "type", 'mode' ], $where)->field($field)->select()->order($order)->toArray();
+ return $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ "title", "type", 'mode' ], $where)->field($field)->order($order)->select()->toArray();
}
/**
diff --git a/niucloud/app/service/admin/member/MemberAccountService.php b/niucloud/app/service/admin/member/MemberAccountService.php
index c09df64ca..e12432433 100644
--- a/niucloud/app/service/admin/member/MemberAccountService.php
+++ b/niucloud/app/service/admin/member/MemberAccountService.php
@@ -45,9 +45,9 @@ class MemberAccountService extends BaseAdminService
if (!empty($where[ 'keywords' ])) {
$member_where[] = [ "member.member_no|member.nickname|member.mobile", 'like', '%' . $where[ 'keywords' ] . '%' ];
}
- $search_model = $this->model->where([ [ 'member_account_log.site_id', '=', $this->site_id ] ])->withSearch([ 'join_member_id' => 'member_id', 'account_type', 'from_type', 'join_create_time' => 'create_time' ], $where)->withJoin([ 'member' => function($query) {
- $query->field("member.nickname, member.headimg, member.mobile, member.member_id, member.member_no");
- }
+ $search_model = $this->model->where([ [ 'member_account_log.site_id', '=', $this->site_id ] ])->withSearch([ 'join_member_id' => 'member_id', 'account_type', 'from_type', 'join_create_time' => 'create_time' ], $where)
+ ->withJoin(
+ [ 'member' => ['member_id','member_no', 'username', 'mobile', 'nickname', 'headimg']
])->where($member_where)->field($field)->order('create_time desc')->append([ 'from_type_name', 'account_type_name' ]);
return $this->pageQuery($search_model);
}
diff --git a/niucloud/app/service/admin/member/MemberCashOutService.php b/niucloud/app/service/admin/member/MemberCashOutService.php
index 765cc1b32..6ffb32212 100644
--- a/niucloud/app/service/admin/member/MemberCashOutService.php
+++ b/niucloud/app/service/admin/member/MemberCashOutService.php
@@ -41,9 +41,7 @@ class MemberCashOutService extends BaseAdminService
{
$member_where = [['member.member_no|member.nickname|member.mobile', '=', $where['keywords']]];
}
- $search_model = $this->model->where([['member_cash_out.site_id', '=', $this->site_id]])->withSearch(['member_id','status', 'join_create_time' => 'create_time', 'audit_time', 'transfer_time', 'transfer_type', 'cash_out_no'],$where)->with(['transfer'])->withJoin(["member" => function($query){
- $query->field("member.nickname, member.headimg, member.mobile, member.member_id, member.member_no");
- }])->where($member_where)->field($field)->order('create_time desc')->append(['status_name', 'transfer_status_name', 'transfer_type_name', 'account_type_name']);
+ $search_model = $this->model->where([['member_cash_out.site_id', '=', $this->site_id]])->withSearch(['member_id','status', 'join_create_time' => 'create_time', 'audit_time', 'transfer_time', 'transfer_type', 'cash_out_no'],$where)->with(['transfer'])->withJoin(["member" => ['memeber_id', 'member_no', 'username', 'mobile', 'nickname', 'headimg']])->where($member_where)->field($field)->order('create_time desc')->append(['status_name', 'transfer_status_name', 'transfer_type_name', 'account_type_name']);
return $this->pageQuery($search_model);
}
diff --git a/niucloud/app/service/admin/member/MemberLabelService.php b/niucloud/app/service/admin/member/MemberLabelService.php
index 7fe1b5627..6446c51f3 100644
--- a/niucloud/app/service/admin/member/MemberLabelService.php
+++ b/niucloud/app/service/admin/member/MemberLabelService.php
@@ -38,10 +38,10 @@ class MemberLabelService extends BaseAdminService
* @param string $order
* @return array
*/
- public function getPage(array $where = [], string $order = 'create_time desc')
+ public function getPage(array $where = [], string $order = 'sort desc,create_time desc')
{
$field = 'label_id, site_id, label_name, memo, sort, create_time, update_time';
- $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'label_name'], $where)->field($field)->append(["member_num"])->order($order);
+ $search_model = $this->model->where([ [ 'site_id', '=', $this->site_id ] ])->withSearch([ 'label_name' ], $where)->field($field)->append([ "member_num" ])->order($order);
return $this->pageQuery($search_model);
}
@@ -53,8 +53,7 @@ class MemberLabelService extends BaseAdminService
public function getInfo(int $label_id)
{
$field = 'label_id, site_id, label_name, memo, sort, create_time, update_time';
-
- return $this->model->field($field)->where([['label_id', '=', $label_id], ['site_id', '=', $this->site_id]])->findOrEmpty()->toArray();
+ return $this->model->field($field)->where([ [ 'label_id', '=', $label_id ], [ 'site_id', '=', $this->site_id ] ])->findOrEmpty()->toArray();
}
/**
@@ -64,8 +63,9 @@ class MemberLabelService extends BaseAdminService
* @throws DbException
* @throws ModelNotFoundException
*/
- public function getAll(){
- return (new CoreMemberLabelService())->getAll($this->site_id);
+ public function getAll()
+ {
+ return ( new CoreMemberLabelService() )->getAll($this->site_id);
}
/**
@@ -75,11 +75,10 @@ class MemberLabelService extends BaseAdminService
*/
public function add(array $data)
{
- $data['site_id'] = $this->site_id;
+ $data[ 'site_id' ] = $this->site_id;
$res = $this->model->create($data);
- (new CoreMemberLabelService())->clearCache($this->site_id);
+ ( new CoreMemberLabelService() )->clearCache($this->site_id);
return $res->label_id;
-
}
/**
@@ -90,9 +89,9 @@ class MemberLabelService extends BaseAdminService
*/
public function edit(int $label_id, array $data)
{
- $data['update_time'] = time();
- $this->model->where([['label_id', '=', $label_id], ['site_id', '=', $this->site_id]])->save($data);
- (new CoreMemberLabelService())->clearCache($this->site_id);
+ $data[ 'update_time' ] = time();
+ $this->model->where([ [ 'label_id', '=', $label_id ], [ 'site_id', '=', $this->site_id ] ])->save($data);
+ ( new CoreMemberLabelService() )->clearCache($this->site_id);
return true;
}
@@ -103,8 +102,8 @@ class MemberLabelService extends BaseAdminService
*/
public function del(int $label_id)
{
- $res = $this->model->where([['label_id', '=', $label_id], ['site_id', '=', $this->site_id]])->delete();
- (new CoreMemberLabelService())->clearCache($this->site_id);
+ $res = $this->model->where([ [ 'label_id', '=', $label_id ], [ 'site_id', '=', $this->site_id ] ])->delete();
+ ( new CoreMemberLabelService() )->clearCache($this->site_id);
return $res;
}
@@ -116,8 +115,9 @@ class MemberLabelService extends BaseAdminService
* @throws DbException
* @throws ModelNotFoundException
*/
- public function getMemberLabelListByLabelIds(array $label_ids){
- return (new CoreMemberLabelService())->getMemberLabelListByLabelIds($this->site_id, $label_ids);
+ public function getMemberLabelListByLabelIds(array $label_ids)
+ {
+ return ( new CoreMemberLabelService() )->getMemberLabelListByLabelIds($this->site_id, $label_ids);
}
}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/order/RechargeOrderRefundService.php b/niucloud/app/service/admin/order/RechargeOrderRefundService.php
deleted file mode 100644
index 54de19758..000000000
--- a/niucloud/app/service/admin/order/RechargeOrderRefundService.php
+++ /dev/null
@@ -1,123 +0,0 @@
-model = new RechargeOrderItemRefund();
- }
-
- public function create($order_id) {
- try {
- (new CoreRechargeRefundService())->create($this->site_id, $order_id);
- return true;
- } catch ( Exception $e) {
- return $e->getMessage();
- }
- }
-
- /**
- * 查询退款列表
- * @param array $where
- * @return array
- */
- public function getPage(array $where) {
-
- $field = 'recharge_order_item_refund.refund_id,recharge_order_item_refund.num,recharge_order_item_refund.money,recharge_order_item_refund.refund_no,recharge_order_item_refund.status,recharge_order_item_refund.create_time,recharge_order_item_refund.audit_time,recharge_order_item_refund.transfer_time,recharge_order_item_refund.item_type,recharge_order_item_refund.order_item_id, recharge_order_item_refund.order_id,recharge_order_item_refund.member_id,recharge_order_item_refund.order_no';
- $member_where = [];
- if(!empty($where['keywords']))
- {
- $member_where[] = ["member.member_id|member.nickname|member.mobile", '=', $where['keywords']];
- }
- $search_model = $this->model->where([['recharge_order_item_refund.site_id', '=', $this->site_id]])->with(['item' => function($query) {
- $query->with('orderNo')->field('order_id, order_item_id, item_name, item_image');
- }])->withSearch(['join_order_no' => 'order_no', 'join_status' => 'status', 'join_member_id' => 'member_id', 'refund_no' => 'refund_no', 'join_create_time' => 'create_time'],$where)->withJoin(['member' => function($query){
- $query->field("member.nickname, member.headimg, member.mobile, member.member_id");
- }
- ])->where($member_where)->field($field)->order('create_time desc')->append(['status_name', 'payrefund.type_name']);
-
- return $this->pageQuery($search_model);
- }
-
- /**
- * 查询退款详情
- * @param int $refund_id
- * @return array
- */
- public function getDetail(int $refund_id) {
- $field = 'refund_id,num,money,refund_no,status,create_time,audit_time,transfer_time,item_type,order_item_id, order_id,member_id';
- return $this->model->where([ ['site_id', '=', $this->site_id], ['refund_id', '=', $refund_id]])->field($field)->with(['item' => function($query) {
- $query->field('order_item_id, item_name, item_image');
- }, 'member' => function($query) {
- $query->field('member_id, nickname, mobile, headimg');
- }, 'payrefund' => function($query) {
- $query->field('refund_no');
- }])->append(['status_name', 'payrefund.type_name'])->findOrEmpty()->toArray();
- }
-
- /**
- * 获取退款状态
- * @return array|array[]|string
- */
- public function getStatus(){
- return RechargeOrderDict::getRefundStatus();
- }
-
- /**
- * 退款统计数据(根据状态查询)
- */
- public function stat()
- {
- $status = RechargeOrderDict::getRefundStatus();
- $all = 0;
- $have = 0;
- foreach ($status as $k => &$v)
- {
- $money = $this->model->where([['status', '=', $v['status']], ['site_id', '=', $this->site_id]])->sum("money");
- if($money == null)
- {
- $money = 0;
- }
- if($k == 1 || $k == 2){
- $have += $money;
- }
- $v['money'] = number_format($money, 2);
- $all += $money;
- }
- $status['all'] = [
- 'name' => get_lang('dict_refund.all'),
- 'key' => 'all',
- 'money' => number_format($all, 2)
- ];
- $status['have'] = [
- 'name' => get_lang('dict_refund.have'),
- 'key' => 'all',
- 'money' => number_format($have, 2)
- ];
- return $status;
-
- }
-}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/order/RechargeOrderService.php b/niucloud/app/service/admin/order/RechargeOrderService.php
deleted file mode 100644
index 500afa56f..000000000
--- a/niucloud/app/service/admin/order/RechargeOrderService.php
+++ /dev/null
@@ -1,124 +0,0 @@
-model = new RechargeOrder();
- }
-
- /**
- * 充值订单分页列表
- * @param array $where
- * @return array
- */
- public function getPage(array $where)
- {
- $field = 'order_id, site_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason';
- $order = 'create_time desc';
- $where['order_type'] = 'recharge';
- $search_model = $this->model->where([['site_id', '=', $this->site_id]])->withSearch(['order_no', 'order_money', 'order_from', 'order_status', 'order_type', 'member_id', 'out_trade_no', 'create_time', 'pay_time'], $where)->field($field)->with(['item' => function($query) {
- $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time');
- }, 'member' => function($query) {
- $query->field('member_id, nickname, mobile, headimg');
- }, 'pay' => function($query) {
- $query->field('');
- } ])->order($order)->append(['order_from_name' ]);
- $list = $this->pageQuery($search_model);
- $order_status = RechargeOrderDict::getStatus();
- $refund_status = RechargeOrderDict::getRefundStatus();
- foreach ($list['data'] as $k => $v)
- {
- $list['data'][$k]['order_status_info'] = $order_status[$v['order_status']] ?? [];
- $list['data'][$k]['refund_status_name'] = $refund_status[$v['refund_status']]['name'] ?? '';
- }
- return $list;
- }
-
- /**
- * 充值订单详情
- * @param int $order_id
- * @return array
- */
- public function getDetail(int $order_id)
- {
- $field = 'order_id, site_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason';
- $detail = $this->model->where([['order_type', '=', 'recharge'], ['site_id', '=', $this->site_id], ['order_id', '=', $order_id]])->field($field)->with(['item' => function($query) {
- $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time');
- }, 'member' => function($query) {
- $query->field('member_id, nickname, mobile, headimg');
- }, 'pay' => function($query) {
- $query->field('');
- } ])->append(['order_from_name'])->findOrEmpty()->toArray();
- if(!empty($detail))
- {
- $detail['order_status_info'] = RechargeOrderDict::getStatus($detail['order_status']) ?? [];
- }
- return $detail;
- }
-
- /**
- * 充值订单状态
- * @return array|array[]|string
- */
- public function getStatus()
- {
- return RechargeOrderDict::getStatus();
- }
-
-
- /**
- * 充值订单
- * @param array $data
- * @return int[]
- */
- public function stat(array $data = [])
- {
- $res = [
- 'recharge_money' => 0,
- 'recharge_refund_money' => 0
- ];
- $where = [
- ['site_id', '=', $this->site_id],
- ['order_type', '=', 'recharge'],
- ['order_status', '=', RechargeOrderDict::FINISH],
- ];
- if(!empty($data['member_id'])) $where[] = ['member_id', '=', $data['member_id']];
-
- $res['recharge_money'] = $this->model->where($where)->sum('order_money');
-
- $where = [
- ['site_id', '=', $this->site_id],
- ['order_type', '=', 'recharge'],
- ['refund_status', '=', RechargeOrderDict::REFUND_COMPLETED],
- ];
- if(!empty($data['member_id'])) $where[] = ['member_id', '=', $data['member_id']];
- $res['recharge_refund_money'] = $this->model->where($where)->sum('order_money');
- return $res;
- }
-
-
-
-
-}
\ No newline at end of file
diff --git a/niucloud/app/service/admin/sys/SystemService.php b/niucloud/app/service/admin/sys/SystemService.php
index f77050a49..53a0f43c7 100644
--- a/niucloud/app/service/admin/sys/SystemService.php
+++ b/niucloud/app/service/admin/sys/SystemService.php
@@ -56,8 +56,8 @@ class SystemService extends BaseAdminService
return [
'wap_domain' => env("system.wap_domain"),
- 'wap_url' => $site_domain ? "http://" . $site_domain . "/wap/" : $wap_domain . "/wap/" . $this->site_id,
- 'web_url' => $site_domain ? "http://" . $site_domain . "/web/" : $web_domain . "/web/" . $this->site_id,
+ 'wap_url' => $site_domain ? (request()->isSsl() ? "https://" : "http://") . $site_domain . "/wap" : $wap_domain . "/wap/" . $this->site_id,
+ 'web_url' => $site_domain ? (request()->isSsl() ? "https://" : "http://") . $site_domain . "/web" : $web_domain . "/web/" . $this->site_id,
];
}
@@ -156,7 +156,7 @@ class SystemService extends BaseAdminService
// $timeout++;
// sleep(1);
// }
- sleep(3);
+ sleep(5);
if (file_exists($file)) {
@unlink($file);
return true;
diff --git a/niucloud/app/service/admin/user/UserService.php b/niucloud/app/service/admin/user/UserService.php
index cb169c605..dceb442b7 100644
--- a/niucloud/app/service/admin/user/UserService.php
+++ b/niucloud/app/service/admin/user/UserService.php
@@ -272,7 +272,7 @@ class UserService extends BaseAdminService
* @return true
*/
public function statusChange($uid, $status) {
- (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->uid] ])->update(['status' => $status]);
+ (new SysUserRole())->where([ ['uid', '=', $uid], ['site_id', '=', $this->site_id] ])->update(['status' => $status]);
LoginService::clearToken($uid);
return true;
}
diff --git a/niucloud/app/service/api/login/RegisterService.php b/niucloud/app/service/api/login/RegisterService.php
index 9a2a73d65..78d6ac0ce 100644
--- a/niucloud/app/service/api/login/RegisterService.php
+++ b/niucloud/app/service/api/login/RegisterService.php
@@ -71,7 +71,7 @@ class RegisterService extends BaseApiService
$data[ 'register_channel' ] = $this->channel;
$data[ 'register_type' ] = $type;
$data[ 'site_id' ] = $this->site_id;
- $pid = $this->request->get('pid');
+ $pid = $this->request->get('pid', $this->request->post('pid', 0));
if ($pid > 0) {
$p_member_info = $member_service->findMemberInfo([ 'member_id' => $pid, 'site_id' => $this->site_id ]);
if (!$p_member_info->isEmpty()) $data[ 'pid' ] = $pid;//设置上级推荐人
diff --git a/niucloud/app/service/api/order/RechargeOrderService.php b/niucloud/app/service/api/order/RechargeOrderService.php
deleted file mode 100644
index d8126af99..000000000
--- a/niucloud/app/service/api/order/RechargeOrderService.php
+++ /dev/null
@@ -1,95 +0,0 @@
-model = new RechargeOrder();
- }
-
- /**
- * 会员充值
- * @param $data //['order_from' => 'h5', 'ip' => '127.0.0.1', 'member_message' => '','recharge_money' => 12.00]
- */
- public function recharge(array $data)
- {
- $data['order_from'] = $this->channel;
- $data['site_id'] = $this->site_id;
- $data['member_id'] = $this->member_id;
- return (new CoreRechargeOrderService())->create($data);
- }
-
-
- /**
- * 充值订单分页列表
- * @param array $where
- * @return array
- */
- public function getPage(array $where)
- {
- $field = 'order_id, site_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason';
- $order = 'create_time desc';
- $where['order_type'] = 'recharge';
- $search_model = $this->model->where([ ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id] ])->withSearch(['order_status'], $where)->field($field)->with(['item' => function($query) {
- $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time');
- }])->order($order)->append(['order_from_name']);
- $list = $this->pageQuery($search_model);
- $order_status = RechargeOrderDict::getStatus();
- //$refund_status = RechargeOrderDict::getRefundStatus();
- foreach ($list['data'] as $k => $v)
- {
- $list['data'][$k]['order_status_info'] = $order_status[$v['order_status']] ?? [];
- // $list['data'][$k]['refund_status_name'] = $refund_status[$v['refund_status']]['name'] ?? '';
- }
- return $list;
- }
-
- /**
- * 充值订单详情
- * @param int $order_id
- * @return array
- */
- public function getDetail(int $order_id)
- {
- $field = 'order_id, site_id, order_no, order_from, order_type, out_trade_no, order_status, refund_status, member_id, ip, member_message, order_item_money, order_discount_money, order_money, create_time, pay_time, close_time, is_delete, is_enable_refund, remark, invoice_id, close_reason';
- $detail = $this->model->where([['order_type', '=', 'recharge'], ['site_id', '=', $this->site_id], ['member_id', '=', $this->member_id], ['order_id', '=', $order_id]])->field($field)->with(['item' => function($query) {
- $query->field('order_item_id, order_id, member_id, item_id, item_type, item_name, item_image, price, num, item_money, is_refund, refund_no, refund_status, create_time');
- }])->append(['order_from_name'])->findOrEmpty()->toArray();
- if(!empty($detail))
- {
- $detail['order_status_info'] = RechargeOrderDict::getStatus($detail['order_status']) ?? [];
- }
- return $detail;
- }
-
- /**
- * 充值订单状态
- * @return array|array[]|string
- */
- public function getStatus()
- {
- return RechargeOrderDict::getStatus();
- }
-}
\ No newline at end of file
diff --git a/niucloud/app/service/api/pay/PayService.php b/niucloud/app/service/api/pay/PayService.php
index 1a1bee3d1..6aa058813 100644
--- a/niucloud/app/service/api/pay/PayService.php
+++ b/niucloud/app/service/api/pay/PayService.php
@@ -67,7 +67,7 @@ class PayService extends BaseApiService
* @return null
*/
public function close(string $type, string $out_trade_no){
- return $this->core_pay_service->close($this->site_id, $type);
+ return $this->core_pay_service->close($this->site_id, $out_trade_no);
}
/**
diff --git a/niucloud/app/service/api/wechat/WechatAuthService.php b/niucloud/app/service/api/wechat/WechatAuthService.php
index fc6d92ff8..953b50689 100644
--- a/niucloud/app/service/api/wechat/WechatAuthService.php
+++ b/niucloud/app/service/api/wechat/WechatAuthService.php
@@ -195,9 +195,8 @@ class WechatAuthService extends BaseApiService
$data = array(
'channel' => $this->channel,
);
-
$key = (new CoreScanService())->scan($this->site_id, ScanDict::WECHAT_LOGIN, $data, 300);
- $url = $this->core_wechat_serve_service->scan($this->site_id, $key, 300);
+ $url = $this->core_wechat_serve_service->scan($this->site_id, $key, 300)['url'] ?? '';
return [
'url' => $url,
'key' => $key
diff --git a/niucloud/app/service/core/addon/WapTrait.php b/niucloud/app/service/core/addon/WapTrait.php
index e8e297607..1cad4d005 100644
--- a/niucloud/app/service/core/addon/WapTrait.php
+++ b/niucloud/app/service/core/addon/WapTrait.php
@@ -59,7 +59,7 @@ trait WapTrait
$file_name = 'diy-' . $path;
$content .= " \n";
- $content .= " <$file_name :component=\"component\" :index=\"index\" :pullDownRefreshCount=\"props.pullDownRefreshCount\">$file_name>\n";
+ $content .= " <$file_name :component=\"component\" :global=\"data.global\" :index=\"index\" :pullDownRefreshCount=\"props.pullDownRefreshCount\">$file_name>\n";
$content .= " \n";
}
}
@@ -121,10 +121,10 @@ trait WapTrait
}
$content .= " import useDiyStore from '@/app/stores/diy';\n";
- $content .= " import { onMounted, nextTick, computed } from 'vue';\n";
+ $content .= " import { ref, onMounted, nextTick, computed } from 'vue';\n";
$content .= " import Sortable from 'sortablejs';\n";
$content .= " import { range } from 'lodash-es';\n";
- $content .= " import useConfigStore from '@/stores/config'\n";
+ $content .= " import useConfigStore from '@/stores/config'\n\n";
$content .= " const props = defineProps(['data','pullDownRefreshCount']);\n";
$content .= " const diyStore = useDiyStore();\n\n";
@@ -141,6 +141,8 @@ trait WapTrait
$content .= " return useConfigStore().addon;\n";
$content .= " })\n\n";
+ $content .= " const positionFixed = ref(['fixed', 'top_fixed','right_fixed','bottom_fixed','left_fixed'])\n\n";
+
$content .= " const getComponentClass = (index:any,component:any) => {\n\n";
$content .= " let obj: any = {\n\n";
$content .= " relative: true,\n\n";
@@ -148,7 +150,7 @@ trait WapTrait
$content .= " decorate: diyStore.mode == 'decorate'\n\n";
$content .= " }\n\n";
$content .= " obj['top-fixed-' + diyStore.topFixedStatus] = true;\n\n";
- $content .= " if (component.position && component.position == 'top_fixed') {\n\n";
+ $content .= " if (component.position && positionFixed.value.indexOf(component.position) != -1) {\n\n";
$content .= " // 找出置顶组件,设置禁止拖动\n\n";
$content .= " obj['ignore-draggable-element'] = true;\n\n";
$content .= " } else {\n\n";
@@ -301,33 +303,32 @@ trait WapTrait
return;
}
- $addon = strtoupper($this->addon);
+ $pages = [];
+ $addon_arr = array_unique(array_merge([$this->addon], array_column((new CoreAddonService())->getInstallAddonList(), 'key')));
+ foreach ($addon_arr as $addon) {
+ if (!file_exists($this->geAddonPackagePath($addon) . 'uni-app-pages.php')) continue;
+ $uniapp_pages = require $this->geAddonPackagePath($addon) . 'uni-app-pages.php';
+ if (empty($uniapp_pages[ 'pages' ])) continue;
+
+ $page_begin = strtoupper($addon) . '_PAGE_BEGIN';
+ $page_end = strtoupper($addon) . '_PAGE_END';
+
+ // 对0.2.0之前的版本做处理
+ $uniapp_pages[ 'pages' ] = preg_replace_callback('/(.*)(\\r\\n.*\/\/ PAGE_END.*)/s', function ($match){
+ return $match[1] . (substr($match[1], -1) == ',' ? '' : ',') .$match[2];
+ }, $uniapp_pages[ 'pages' ]);
+
+ $uniapp_pages[ 'pages' ] = str_replace('PAGE_BEGIN', $page_begin, $uniapp_pages[ 'pages' ]);
+ $uniapp_pages[ 'pages' ] = str_replace('PAGE_END', $page_end, $uniapp_pages[ 'pages' ]);
+ $uniapp_pages[ 'pages' ] = str_replace('{{addon_name}}', $addon, $uniapp_pages[ 'pages' ]);
+
+ $pages[] = $uniapp_pages[ 'pages' ];
+ }
$content = @file_get_contents($compile_path . "pages.json");
-
- $page_begin = $addon . '_PAGE_BEGIN';
- $page_end = $addon . '_PAGE_END';
-
- // 清除插件页面路由代码块
- $pattern = "/\s+\/\/ {$page_begin}[\S\s]+\/\/ {$page_end}(\n,)?/";
- $content = preg_replace($pattern, '', $content);
-
- $page_begin_matches_count = preg_match_all('/PAGE_BEGIN/', $content, $page_begin_matches);
- if ($page_begin_matches_count > 0) {
- $uniapp_pages[ 'pages' ] = str_replace('PAGE_BEGIN', $page_begin . PHP_EOL . ",", $uniapp_pages[ 'pages' ]);
- } else {
- $uniapp_pages[ 'pages' ] = str_replace('PAGE_BEGIN', $page_begin . PHP_EOL, $uniapp_pages[ 'pages' ]);
- }
- $uniapp_pages[ 'pages' ] = str_replace('PAGE_END', $page_end, $uniapp_pages[ 'pages' ]);
- $uniapp_pages[ 'pages' ] = str_replace('{{addon_name}}', $this->addon, $uniapp_pages[ 'pages' ]); // 将变量替换为当前安装的插件名称
-
- $replacement = $uniapp_pages[ 'pages' ] . PHP_EOL;
- $replacement .= " // {{PAGE}}\n";
-
- $content = str_replace('// {{PAGE}}', $replacement, $content);
-
- // 清除最后一个逗号
- $content = preg_replace('/PAGE_END\n,\s+\],/', "PAGE_END\n],", $content);
+ $content = preg_replace_callback('/(.*\/\/ \{\{ PAGE_BEGAIN \}\})(.*)(\/\/ \{\{ PAGE_END \}\}.*)/s', function ($match) use ($pages) {
+ return $match[1] . PHP_EOL . implode(PHP_EOL, $pages) . PHP_EOL . $match[3];
+ }, $content);
// 找到页面路由文件 pages.json,写入内容
return file_put_contents($compile_path . "pages.json", $content);
@@ -348,32 +349,30 @@ trait WapTrait
return;
}
- $addon = strtoupper($this->addon);
+ $pages = [];
+ $addon_arr = array_diff(array_column((new CoreAddonService())->getInstallAddonList(), 'key'), [$this->addon]);
- $content = @file_get_contents($compile_path . "pages.json");
+ foreach ($addon_arr as $addon) {
+ if (!file_exists($this->geAddonPackagePath($addon) . 'uni-app-pages.php')) continue;
+ $uniapp_pages = require $this->geAddonPackagePath($addon) . 'uni-app-pages.php';
+ if (empty($uniapp_pages[ 'pages' ])) continue;
- $page_begin = $addon . '_PAGE_BEGIN';
- $page_end = $addon . '_PAGE_END';
+ $page_begin = strtoupper($addon) . '_PAGE_BEGIN';
+ $page_end = strtoupper($addon) . '_PAGE_END';
- $uniapp_pages[ 'pages' ] = str_replace('PAGE_BEGIN', $page_begin, $uniapp_pages[ 'pages' ]);
- $uniapp_pages[ 'pages' ] = str_replace('PAGE_END', $page_end, $uniapp_pages[ 'pages' ]);
+ $uniapp_pages[ 'pages' ] = str_replace('PAGE_BEGIN', $page_begin, $uniapp_pages[ 'pages' ]);
+ $uniapp_pages[ 'pages' ] = str_replace('PAGE_END', $page_end, $uniapp_pages[ 'pages' ]);
+ $uniapp_pages[ 'pages' ] = str_replace('{{addon_name}}', $addon, $uniapp_pages[ 'pages' ]);
- // 清除插件页面路由代码块
- $pattern = "/\s+\/\/ {$page_begin}[\S\s]+\/\/ {$page_end}(\n,)?/";
- $content = preg_replace($pattern, '', $content);
-
- $page_begin_matches_count = preg_match_all('/PAGE_BEGIN/', $content, $page_begin_matches);
-
- // 如果没有页面,清除最后一个逗号
- if ($page_begin_matches_count == 0) {
- $content = str_replace(',// {{PAGE}}', '// {{PAGE}}', $content);
+ $pages[] = $uniapp_pages[ 'pages' ];
}
- // 清除最后一个逗号
- $content = preg_replace('/PAGE_END\n,\s+\],/', "PAGE_END\n],", $content);
-
+ $content = @file_get_contents($compile_path . "pages.json");
+ $content = preg_replace_callback('/(.*\/\/ \{\{ PAGE_BEGAIN \}\})(.*)(\/\/ \{\{ PAGE_END \}\}.*)/s', function ($match) use ($pages) {
+ return $match[1] . PHP_EOL . implode(PHP_EOL, $pages) . PHP_EOL . $match[3];
+ }, $content);
+ // 找到页面路由文件 pages.json,写入内容
return file_put_contents($compile_path . "pages.json", $content);
-
}
/**
diff --git a/niucloud/app/service/core/addon/vm/package/uni-app-pages.vm b/niucloud/app/service/core/addon/vm/package/uni-app-pages.vm
index 73e4c775f..27399973f 100644
--- a/niucloud/app/service/core/addon/vm/package/uni-app-pages.vm
+++ b/niucloud/app/service/core/addon/vm/package/uni-app-pages.vm
@@ -1,14 +1,14 @@
<<-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},a.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},a.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),L(this.media.textTracks).forEach(function(t){Object(T.clearCurrentCues)(t)}),this.subtitleTrack=-1,this.media=null)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},a.onManifestParsed=function(t,s){this.tracks=s.subtitleTracks},a.onSubtitleTrackLoaded=function(t,s){var u=s.id,n=s.details,l=this.trackId,v=this.tracksInGroup[l];if(v){var g=v.details;v.details=s.details,this.log("subtitle track "+u+" loaded ["+n.startSN+"-"+n.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,g))}else this.warn("Invalid subtitle track id "+u)},a.onLevelLoading=function(t,s){this.switchLevel(s.level)},a.onLevelSwitching=function(t,s){this.switchLevel(s.level)},a.switchLevel=function(t){var s=this.hls.levels[t];if(s!=null&&s.textGroupIds){var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var n=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,l=this.tracks.filter(function(p){return!u||p.groupId===u});this.tracksInGroup=l;var v=this.findTrackId(n==null?void 0:n.name)||this.findTrackId();this.groupId=u;var g={subtitleTracks:l};this.log("Updating subtitle tracks, "+l.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(R.Events.SUBTITLE_TRACKS_UPDATED,g),v!==-1&&this.setSubtitleTrack(v,n)}}},a.findTrackId=function(t){for(var s=this.tracksInGroup,u=0;u -1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},a.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},a.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),L(this.media.textTracks).forEach(function(t){Object(T.clearCurrentCues)(t)}),this.subtitleTrack=-1,this.media=null)},a.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},a.onManifestParsed=function(t,s){this.tracks=s.subtitleTracks},a.onSubtitleTrackLoaded=function(t,s){var u=s.id,n=s.details,l=this.trackId,v=this.tracksInGroup[l];if(v){var g=v.details;v.details=s.details,this.log("subtitle track "+u+" loaded ["+n.startSN+"-"+n.endSN+"]"),u===this.trackId&&(this.retryCount=0,this.playlistLoaded(u,s,g))}else this.warn("Invalid subtitle track id "+u)},a.onLevelLoading=function(t,s){this.switchLevel(s.level)},a.onLevelSwitching=function(t,s){this.switchLevel(s.level)},a.switchLevel=function(t){var s=this.hls.levels[t];if(s!=null&&s.textGroupIds){var u=s.textGroupIds[s.urlId];if(this.groupId!==u){var n=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,l=this.tracks.filter(function(p){return!u||p.groupId===u});this.tracksInGroup=l;var v=this.findTrackId(n==null?void 0:n.name)||this.findTrackId();this.groupId=u;var g={subtitleTracks:l};this.log("Updating subtitle tracks, "+l.length+' track(s) found in "'+u+'" group-id'),this.hls.trigger(R.Events.SUBTITLE_TRACKS_UPDATED,g),v!==-1&&this.setSubtitleTrack(v,n)}}},a.findTrackId=function(t){for(var s=this.tracksInGroup,u=0;u0?U-1:U].dts&&(B=!0)}B&&S.sort(function(_e,Ue){var Dt=_e.dts-Ue.dts,Rt=_e.pts-Ue.pts;return Dt||Rt}),r=S[0].dts,i=S[S.length-1].dts;var V=Math.round((i-r)/(k-1));if(M<0){if(M<-2*V){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(L.toMsFromMpegTsClock)(-V,!0)+" ms");for(var H=M,X=0;X-1)for(var y=E,d=o.length;y
/gi,`
+`)}var f=function(){function E(){this.state="INITIAL",this.buffer="",this.decoder=new T,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var y=E.prototype;return y.parse=function(d){var e=this;function a(){var l=e.buffer,v=0;for(l=m(l);v{let a=E(e);x("update:modelValue",a),x("change",e,a)},E=e=>{let a=R.value,t=0;if(h.vertical){let s=a.clientHeight;t=(a.getBoundingClientRect().bottom-e.clientY)/s}else t=(e.clientX-a.getBoundingClientRect().left)/a.clientWidth;return t<0?0:t>1?1:t},y=e=>{f(e)},d=e=>{A.dragging&&(be(window,"mousemove",y),be(window,"touchmove",y),be(window,"mouseup",d),be(window,"touchend",d),be(window,"contextmenu",d),setTimeout(()=>{A.dragging=!1},0))};return(e,a)=>(Y(),Z("div",{ref:R,class:Le(["d-slider",{"is-vertical":h.vertical}]),onMousedown:It(L,["stop"]),onContextmenu:o},[K("div",{class:"d-slider__runway",onMousemove:m},[me(K("div",{class:"d-slider__cursor",style:je(G(_))},[me(K("div",{class:"d-slider__tips",ref:T,style:je({left:G(A).hoverTipsLeft})},J(h.hoverText),5),[[Te,h.hoverText]])],4),[[Te,h.hover]]),K("div",{class:"d-slider__preload",style:je(G(C))},null,4),K("div",{class:"d-slider__bar",style:je(G(D))},null,4)],32)],42,Fr))}}));Xe.__scopeId="data-v-5a794390";Ve("data-v-570fa0d1");const Mr={key:0,class:"d-player-dialog"},Nr={class:"d-player-dialog-body"},Br={class:"d-player-dialog-title"},Ur={class:"d-player-hotkey-panel"},Gr={class:"d-player-filter-panel"},jr={class:"d-player-filter-panel-item"},Kr=K("span",null,"饱和度",-1),Vr={class:"d-player-filter-panel-item"},Hr=K("span",null,"亮度",-1),Wr={class:"d-player-filter-panel-item"},Yr=K("span",null,"对比度",-1),qr={key:0,class:"d-player-contextmenu"},zr=["dplayerKeyCode"],Xr=K("input",{class:"d-player-copyText"},null,-1);He();var _t=xe({setup(N){const x=Se({show:!1,dialogType:"",dialogTitle:"",version:"1.3.1-beta.6",mouseX:0,mouseY:0}),h=[{label:"视频色彩调整",key:"filter"},{label:"快捷键说明",key:"hotkey"},{label:"复制视频网址",key:"copy"},{label:"版本:1.3.1-beta.6",key:"version"}],R=[{key:"Space",label:"播放/暂停"},{key:"→",label:"单次快进10s,长按5倍速播放"},{key:"←",label:"快退5s"},{key:"↑",label:"音量增加10%"},{key:"↓",label:"音量增加降低10%"},{key:"Esc",label:"退出全屏/退出网页全屏"},{key:"F",label:"全屏/退出全屏"}],T=Se({saturate:.392,brightness:.392,contrast:.392}),A=Re(()=>({left:x.mouseX+"px",top:x.mouseY+"px"}));et(T,L=>{let m=document.querySelector("#dPlayerVideo"),f=(2.55*L.saturate).toFixed(2),E=(2.55*L.brightness).toFixed(2),y=(2.55*L.contrast).toFixed(2);m.style.filter=`saturate(${f}) brightness(${E}) contrast(${y})`});const D=()=>{T.saturate=.392,T.brightness=.392,T.contrast=.392},C=L=>{L.key=="Escape"&&o(0)},_=L=>{L.preventDefault(),Ke(window,"keydown",C),Ke(window,"click",o);let m=document.querySelector("#refPlayerWrap"),f=m.clientWidth;m.clientHeight,x.mouseX=L.clientX-m.getBoundingClientRect().left,f-x.mouseX<130&&(x.mouseX=x.mouseX+(f-x.mouseX-130)),x.mouseY=L.clientY-m.getBoundingClientRect().top,x.show=!0},o=L=>{let m=L.path[0].tagName=="LI",f=L.path[0].attributes.dplayerKeyCode&&L.path[0].attributes.dplayerKeyCode.value,E=h.map(y=>y.key);if(m&&E.includes(f))if(x.dialogTitle=L.path[0].innerText,x.dialogType=f,f=="copy"){let y=document.querySelector(".d-player-copyText");y.value=window.location.href,y.select(),document.execCommand("copy"),x.dialogType=""}else f=="version"&&(x.dialogType="");x.show=!1,be(window,"keydown",C),be(window,"click",o)};return mt(()=>{let L=document.querySelector("#refPlayerWrap");be(window,"keydown",C),be(window,"click",o),be(L,"contextmenu",_),Ke(L,"contextmenu",_)}),yt(()=>{let L=document.querySelector("#refPlayerWrap");be(window,"keydown",C),be(window,"click",o),be(L,"contextmenu",_)}),(L,m)=>(Y(),Z("div",null,[z(at,{name:"d-fade-in"},{default:Q(()=>[G(x).dialogType?(Y(),Z("div",Mr,[K("div",Nr,[K("h5",Br,[he(J(G(x).dialogTitle)+" ",1),K("i",{onClick:m[0]||(m[0]=f=>G(x).dialogType=!1),class:"icon icon-close"},"X")]),me(K("ul",Ur,[(Y(),Z(we,null,Fe(R,f=>K("li",{class:"d-player-hotkey-panel-item",key:f.key},[K("span",null,J(f.key),1),K("span",null,J(f.label),1)])),64))],512),[[Te,G(x).dialogType=="hotkey"]]),me(K("ul",Gr,[K("li",jr,[Kr,z(Xe,{class:"filter-panel-slider",size:"5px",modelValue:G(T).saturate,"onUpdate:modelValue":m[1]||(m[1]=f=>G(T).saturate=f)},null,8,["modelValue"]),K("span",null,J(Math.round(255*G(T).saturate)),1)]),K("li",Vr,[Hr,z(Xe,{class:"filter-panel-slider",size:"5px",modelValue:G(T).brightness,"onUpdate:modelValue":m[2]||(m[2]=f=>G(T).brightness=f)},null,8,["modelValue"]),K("span",null,J(Math.round(255*G(T).brightness)),1)]),K("li",Wr,[Yr,z(Xe,{class:"filter-panel-slider",size:"5px",modelValue:G(T).contrast,"onUpdate:modelValue":m[3]||(m[3]=f=>G(T).contrast=f)},null,8,["modelValue"]),K("span",null,J(Math.round(255*G(T).contrast)),1)]),K("span",{onClick:D,title:"重置","aria-label":"重置",class:"d-player-filter-reset"},"重置")],512),[[Te,G(x).dialogType=="filter"]])])])):ae("",!0)]),_:1}),G(x).show?(Y(),Z("div",qr,[K("ul",{class:"d-player-contextmenu-body",style:je(G(A))},[(Y(),Z(we,null,Fe(h,f=>K("li",{dplayerKeyCode:f.key,key:f.key},J(f.label),9,zr)),64))],4),Xr])):ae("",!0)]))}});_t.__scopeId="data-v-570fa0d1";const nt=N=>{let x=~~(N/3600),h=~~(N%3600/60),R=~~(N%60);return x=x<10?"0"+x:x,h=h<10?"0"+h:h,R=R<10?"0"+R:R,`${x}:${h}:${R}`},Je="ontouchstart"in window,pt=["loadstart","play","pause","playing","seeking","seeked","waiting","durationchange","progress","canplay","timeupdate","ended","error","stalled"],$r={width:{type:String,default:"800px"},height:{type:String,default:"450px"},color:{type:String,default:"#409eff"},src:{required:!0,type:String,default:""},title:{type:String,default:""},type:{type:String,default:"video/mp4"},poster:{type:String,default:""},webFullScreen:{type:Boolean,default:!1},speed:{type:Boolean,default:!0},currentTime:{type:Number,default:0},playsinline:{type:Boolean,default:!1},muted:{type:Boolean,default:!1},speedRate:{type:Array,default:()=>["2.0","1.5","1.25","1.0","0.75","0.5"]},autoPlay:{type:Boolean,default:!1},loop:{type:Boolean,default:!1},mirror:{type:Boolean,default:!1},ligthOff:{type:Boolean,default:!1},volume:{type:[String,Number],default:.3},control:{type:Boolean,default:!0},controlBtns:{type:Array,default:["audioTrack","quality","speedRate","volume","setting","pip","pageFullScreen","fullScreen"]},preload:{type:String,default:"auto"}};Ve("data-v-01791e9e");const Qr={class:"d-player-video",id:"dPlayerVideo"},Zr=["controls","webkit-playsinline","playsinline","volume","muted","loop","preload","src","poster"],Jr={class:"d-player-lightoff"},ei={key:1,class:"d-player-state"},ti={class:"d-play-btn"},ri=["onKeyup","onKeydown"],ii={class:"d-control-progress"},ni={class:"d-tool-bar"},ai={key:0,class:"d-tool-item d-tool-time audioTrack-btn"},si=K("span",{style:{margin:"0 3px"}},"/",-1),oi={class:"total-time"},li={class:"d-tool-bar"},ui={key:0,class:"d-tool-item quality-btn"},di={class:"d-tool-item-main"},ci={class:"speed-main",style:{"text-align":"center"}},hi=["onClick"],fi={key:1,class:"d-tool-item speedRate-btn"},gi={class:"d-tool-item-main"},vi={class:"speed-main"},pi=["onClick"],mi={key:2,class:"d-tool-item volume-btn"},yi={class:"d-tool-item-main volume-box",style:{width:"52px"}},Ei={class:"volume-text-size"},Ti={key:3,class:"d-tool-item setting-btn"},Si={class:"d-tool-item-main"},bi={class:"speed-main"},Li=he(" 镜像画面 "),Ai=he(" 循环播放 "),ki=he(" 关灯模式 "),_i=K("div",{class:"d-tool-item-main"},"画中画",-1),Di=K("div",{class:"d-tool-item-main"},"网页全屏",-1),Ri=K("div",{class:"d-tool-item-main"},"全屏",-1);He();var tt=xe(lt(ot({},{name:"vue3VideoPlay",inheritAttrs:!1}),{props:$r,emits:[...pt,"mirrorChange","loopChange","lightOffChange"],setup:function(N,{expose:x,emit:h}){const R=N;ut(w=>({"51d4439c":G(E),"77e758a6":w.width,b8a1afc0:w.height}));const T=new it({fragLoadingTimeOut:2e3}),A=Ee(null),D=Ee(null),C=Ee(null),_=Ee(null),o=Se(lt(ot({dVideo:null},R),{muted:R.muted,playBtnState:R.autoPlay?"pause":"play",loadStateType:"loadstart",fullScreen:!1,handleType:"",currentTime:"00:00:00",preloadBar:0,totalTime:"00:00:00",isVideoHovering:!0,speedActive:"1.0",playProgress:0,isMultiplesPlay:!1,longPressTimeout:null,progressCursorTime:"00:00:00",qualityLevels:[],currentLevel:0})),L=(...w)=>O=>w.reverse().reduce((P,F)=>F(P),O),m=pt.reduce((w,O)=>{var P;return w[`on${P=O,P.charAt(0).toUpperCase()+P.slice(1)}`]=F=>{o.loadStateType=O,h(O,F)},w},{});m.onCanplay=L(m.onCanplay,()=>{o.playBtnState!="play"&&o.dVideo.play(),o.autoPlay&&(o.dVideo.play(),o.playBtnState="pause")}),m.onEnded=L(m.onEnded,()=>{o.playBtnState="replay"}),m.onDurationchange=w=>{h("durationchange",w),R.currentTime!=0&&(o.dVideo.currentTime=R.currentTime),m.onTimeupdate(w)},m.onProgress=w=>{console.log("缓冲中..."),h("progress",w);let O=w.target.duration,P=w.target.buffered,F=w.target.buffered.length&&w.target.buffered.end(P-1);o.preloadBar=F/O},m.onTimeupdate=w=>{h("timeupdate",w);let O=w.duration||w.target.duration||0,P=w.currentTime||w.target.currentTime;o.playProgress=P/O,o.currentTime=nt(P),o.totalTime=nt(O)},m.onError=L(m.onError,()=>{o.playBtnState="replay"});let f=Ct();for(let w in f)m[w]=f[w];const E=(y=o.color,`${parseInt("0x"+y.slice(1,3))},${parseInt("0x"+y.slice(3,5))},${parseInt("0x"+y.slice(5,7))}`);var y;const d=vt(500,()=>{o.handleType=""}),e=w=>{w.preventDefault(),w.code=="ArrowUp"?o.volume=o.volume+.1>1?1:o.volume+.1:o.volume=o.volume-.1<0?0:o.volume-.1,o.muted=!1,o.handleType="volume",d()},a=w=>{R.speed&&(o.dVideo.currentTime=o.dVideo.currentTime<10?.1:o.dVideo.currentTime-10,m.onTimeupdate(o.dVideo),u())},t=w=>{w.preventDefault();let O=w.type;if(w.key=="ArrowRight"){if(u(),O=="keyup"){if(clearTimeout(o.longPressTimeout),!R.speed&&!o.longPressTimeout)return;o.isMultiplesPlay?(o.dVideo.playbackRate=o.speedActive,o.isMultiplesPlay=!1):(o.dVideo.currentTime=o.dVideo.currentTime+10,m.onTimeupdate(o.dVideo))}else if(O=="keydown"){if(!R.speed)return;o.isMultiplesPlay&&clearTimeout(o.longPressTimeout),o.longPressTimeout=setTimeout(()=>{o.isMultiplesPlay=!0,o.dVideo.playbackRate=5,o.handleType="playbackRate",d()},500)}}},s=()=>{Je||_.value.focus()},u=()=>{o.loadStateType="play",o.dVideo.play().catch(()=>{setTimeout(()=>{o.playBtnState="replay",o.loadStateType="error"},500)}),o.playBtnState="pause"},n=()=>{o.dVideo.pause(),o.playBtnState="play"},l=w=>{w&&w.preventDefault(),o.playBtnState=="play"||o.playBtnState=="replay"?u():o.playBtnState=="pause"&&n()},v=()=>{o.muted=!o.muted,o.volume==0&&(o.volume=.05)},g=(w,O)=>{let P=o.dVideo.duration||o.dVideo.target.duration;o.dVideo.currentTime=P*O,o.playBtnState=="play"&&(o.dVideo.play(),o.playBtnState="pause")},p=(w,O)=>{o.progressCursorTime=nt(o.dVideo.duration*O)},r=vt(2500,()=>{o.isVideoHovering=!1}),i=w=>{o.isVideoHovering=!0,r()},c=w=>{h("mirrorChange",w,o.dVideo)},S=w=>{h("loopChange",w,o.dVideo)},b=w=>{h("lightOffChange",w,o.dVideo)},k=()=>{var w;w=o.dVideo,document.pictureInPictureElement?document.exitPictureInPicture().catch(O=>{console.log(O,"Video failed to leave Picture-in-Picture mode.")}):w.requestPictureInPicture().catch(O=>{console.log(O,"Video failed to enter Picture-in-Picture mode.")})},I=()=>{o.fullScreen=(w=>{let O=document,P=O.webkitIsFullScreen||O.fullscreen;return P?(document.exitFullscreen||O.webkitExitFullScreen).call(O):(w.requestFullscreen||w.webkitRequestFullScreen).call(w),!P})(A.value)};return et(()=>R.src,()=>{Et(()=>{o.dVideo.canPlayType(R.type)||o.dVideo.canPlayType("application/vnd.apple.mpegurl")?o.muted=R.autoPlay:it.isSupported()&&(T.detachMedia(),T.attachMedia(o.dVideo),T.on(it.Events.MEDIA_ATTACHED,()=>{T.loadSource(R.src),T.on("hlsManifestParsed",(w,O)=>{console.log(O),o.currentLevel=O.level,o.qualityLevels=O.levels||[]})}),T.on("hlsLevelSwitching",(w,O)=>{console.log(O),console.log("LEVEL_SWITCHING")}),T.on("hlsLevelSwitched",(w,O)=>{o.currentLevel=O.level,console.log("LEVEL_SWITCHED")}))})},{immediate:!0}),mt(()=>{o.dVideo=D,s()}),x({play:u,pause:n,togglePlay:l}),(w,O)=>(Y(),Z("div",{ref:A,id:"refPlayerWrap",class:Le(["d-player-wrap",{"web-full-screen":G(o).webFullScreen,"is-lightoff":G(o).lightOff,"d-player-wrap-hover":G(o).playBtnState=="play"||G(o).isVideoHovering}]),onMousemove:i},[K("div",Qr,[K("video",Tt({ref:D,class:["d-player-video-main",{"video-mirror":G(o).mirror}],id:"dPlayerVideoMain",controls:!(!G(Je)||!G(o).speed),"webkit-playsinline":R.playsinline,playsinline:R.playsinline},G(m),{volume:G(o).volume,muted:G(o).muted,loop:G(o).loop,preload:w.preload,width:"100%",height:"100%",src:R.src,poster:R.poster}),"您的浏览器不支持Video标签。",16,Zr)]),z(at,{name:"d-fade-in"},{default:Q(()=>[me(K("div",Jr,null,512),[[Te,G(o).lightOff]])]),_:1}),G(o).fullScreen?(Y(),ge(Lr,{key:0,title:R.title},null,8,["title"])):ae("",!0),G(Je)?ae("",!0):(Y(),Z("div",ei,[z(at,{name:"d-scale-out"},{default:Q(()=>[me(K("div",ti,[z(Ae,{icon:"icon-play",size:40})],512),[[Te,G(o).playBtnState=="play"]])]),_:1}),z(At,{state:G(o)},null,8,["state"])])),G(Je)?ae("",!0):(Y(),Z("input",{key:2,type:"input",readonly:"readonly",ref:_,onDblclick:I,onKeyup:[Ze(I,["f"]),O[0]||(O[0]=Ze(P=>G(o).webFullScreen=!1,["esc"])),t],onClick:l,onKeydown:[Ze(l,["space"]),Ze(a,["arrow-left"]),Ze(e,["arrow-up","arrow-down"]),t],class:"d-player-input",maxlength:"0"},null,40,ri)),z(kt,{loadType:G(o).loadStateType},null,8,["loadType"]),z(_t),!G(Je)&&G(o).control?(Y(),Z("div",{key:3,class:"d-player-control",ref:C},[K("div",ii,[z(Xe,{class:"d-progress-bar",onOnMousemove:p,onChange:g,disabled:!G(o).speed,hoverText:G(o).progressCursorTime,modelValue:G(o).playProgress,"onUpdate:modelValue":O[1]||(O[1]=P=>G(o).playProgress=P),preload:G(o).preloadBar},null,8,["disabled","hoverText","modelValue","preload"])]),K("div",{class:"d-control-tool",onClick:s},[K("div",ni,[K("div",{class:"d-tool-item",onClick:l},[z(Ae,{size:"24",icon:`icon-${G(o).playBtnState}`},null,8,["icon"])]),R.controlBtns.includes("audioTrack")?(Y(),Z("div",ai,[K("span",null,J(G(o).currentTime),1),si,K("span",oi,J(G(o).totalTime),1)])):ae("",!0)]),K("div",li,[G(o).qualityLevels.length&&R.controlBtns.includes("quality")?(Y(),Z("div",ui,[he(J(G(o).qualityLevels.length&&(G(o).qualityLevels[G(o).currentLevel]||{}).height)+"P ",1),K("div",di,[K("ul",ci,[(Y(!0),Z(we,null,Fe(G(o).qualityLevels,(P,F)=>(Y(),Z("li",{class:Le({"speed-active":G(o).currentLevel==F}),onClick:M=>((B,U)=>{T.currentLevel=U,o.currentLevel=U})(0,F),key:P},J(P.height)+"P",11,hi))),128))])])])):ae("",!0),R.controlBtns.includes("speedRate")?(Y(),Z("div",fi,[he(J(G(o).speedActive=="1.0"?"倍速":G(o).speedActive+"x")+" ",1),K("div",gi,[K("ul",vi,[(Y(!0),Z(we,null,Fe(G(o).speedRate,P=>(Y(),Z("li",{class:Le({"speed-active":G(o).speedActive==P}),onClick:F=>(M=>{o.speedActive=M,o.dVideo.playbackRate=M})(P),key:P},J(P)+"x",11,pi))),128))])])])):ae("",!0),R.controlBtns.includes("volume")?(Y(),Z("div",mi,[K("div",yi,[K("div",{class:Le(["volume-main",{"is-muted":G(o).muted}])},[K("span",Ei,J(G(o).muted?0:~~(100*G(o).volume))+"%",1),z(Xe,{onChange:O[2]||(O[2]=P=>G(o).muted=!1),hover:!1,size:"5px",vertical:!0,modelValue:G(o).volume,"onUpdate:modelValue":O[3]||(O[3]=P=>G(o).volume=P)},null,8,["modelValue"])],2)]),K("span",{onClick:v,style:{display:"flex"}},[z(Ae,{size:"20",icon:"icon-volume-"+(G(o).volume==0||G(o).muted?"mute":G(o).volume>.5?"up":"down")},null,8,["icon"])])])):ae("",!0),R.controlBtns.includes("setting")?(Y(),Z("div",Ti,[z(Ae,{size:"20",class:"rotateHover",icon:"icon-settings"}),K("div",Si,[K("ul",bi,[K("li",null,[Li,z(rt,{onChange:c,modelValue:G(o).mirror,"onUpdate:modelValue":O[4]||(O[4]=P=>G(o).mirror=P)},null,8,["modelValue"])]),K("li",null,[Ai,z(rt,{onChange:S,modelValue:G(o).loop,"onUpdate:modelValue":O[5]||(O[5]=P=>G(o).loop=P)},null,8,["modelValue"])]),K("li",null,[ki,z(rt,{onChange:b,modelValue:G(o).lightOff,"onUpdate:modelValue":O[6]||(O[6]=P=>G(o).lightOff=P)},null,8,["modelValue"])])])])])):ae("",!0),R.controlBtns.includes("pip")?(Y(),Z("div",{key:4,class:"d-tool-item pip-btn",onClick:k},[z(Ae,{size:"20",icon:"icon-pip"}),_i])):ae("",!0),R.controlBtns.includes("pageFullScreen")?(Y(),Z("div",{key:5,class:"d-tool-item pip-btn",onClick:O[7]||(O[7]=P=>G(o).webFullScreen=!G(o).webFullScreen)},[z(Ae,{size:"20",icon:"icon-web-screen"}),Di])):ae("",!0),R.controlBtns.includes("fullScreen")?(Y(),Z("div",{key:6,class:"d-tool-item fullScreen-btn",onClick:I},[Ri,z(Ae,{size:"20",icon:"icon-screen"})])):ae("",!0)])])],512)):ae("",!0)],34))}}));function Ii(N){N.component(tt.name,tt)}tt.__scopeId="data-v-01791e9e",tt.install=Ii;const Ci=xe({__name:"index",setup(N){return(x,h)=>(Y(),ge(G(tt)))}}),wi={class:"text-right mt-[15px]"},xi=xe({__name:"index",props:{width:{type:String,default:"350px"},modelValue:{type:String,default:""},placeholder:{type:String,default:""},required:{type:Boolean,default:!0},maxlength:{type:Number,default:10}},emits:["confirm"],setup(N,{emit:x}){const h=N,R=Re({get(){return h.modelValue},set(D){x("update:modelValue",D)}}),T=Ee(!1),A=()=>{if(!/[\S]+/.test(R.value)){st.error(h.placeholder||"不能为空");return}x("confirm",R.value),T.value=!1};return(D,C)=>{const _=St,o=bt,L=Pt;return Y(),ge(L,{placement:"top",trigger:"click",width:h.width,visible:T.value,"onUpdate:visible":C[2]||(C[2]=m=>T.value=m)},{reference:Q(()=>[xt(D.$slots,"default")]),default:Q(()=>[z(_,{modelValue:G(R),"onUpdate:modelValue":C[0]||(C[0]=m=>Ot(R)?R.value=m:null),placeholder:h.placeholder,clearable:"",class:"mr-[10px]",maxlength:h.maxlength,"show-word-limit":!0},null,8,["modelValue","placeholder","maxlength"]),K("div",wi,[z(o,{onClick:C[1]||(C[1]=m=>T.value=!1)},{default:Q(()=>[he(J(G(ee)("cancel")),1)]),_:1}),z(o,{type:"primary",onClick:A},{default:Q(()=>[he(J(G(ee)("confirm")),1)]),_:1})])]),_:3},8,["width","visible"])}}}),Oi={class:"group-wrap w-[180px] p-[15px] h-full border-r border-color flex flex-col"},Pi={class:"group-list flex-1 my-[10px] h-0"},Fi=["onClick"],Mi={key:0,class:"leading-none operate py-[10px]"},Ni={class:"text-center w-full"},Bi={class:"attachment-list-wrap flex flex-col p-[15px] flex-1 overflow-hidden"},Ui={class:"flex"},Gi={key:1},ji={class:"flex-1 my-[15px] h-0"},Ki={key:0,class:"flex flex-wrap"},Vi=["onClick"],Hi=["src"],Wi={class:"absolute z-[1] flex items-center justify-center w-full h-full inset-0 bg-black bg-opacity-60"},Yi={class:"file-box-active absolute z-[1] bottom-0 right-0 w-full h-full"},qi={class:"absolute bottom-[2px] right-[2px] text-white z-[2] leading-none"},zi={class:"flex items-center"},Xi={class:"truncate my-[10px] cursor-pointer text-base flex-1 text-center"},$i={class:"text-center w-full"},Qi={class:"text-center w-full"},Zi={class:"text-center w-full"},Ji={class:"text-center w-full"},en={key:1,class:"flex flex-wrap"},tn={class:"attachment-wrap w-full rounded cursor-pointer overflow-hidden relative flex items-center justify-center h-[120px]"},rn=["src"],nn={class:"flex items-center"},an={class:"truncate my-[10px] cursor-pointer text-base flex-1 text-center"},sn={key:2,class:"flex items-center justify-center"},on={class:"flex items-center"},ln={class:"flex h-full justify-end items-center"},un={class:"dialog-footer"},dn=xe({__name:"attachment",props:{limit:{type:Number,default:1},type:{type:String,default:"image"},scene:{type:String,default:"select"}},setup(N,{expose:x}){const h=N,R=Ee(""),T=Ee(!1),A=Se({}),D=Se([]),C=Se({data:[]}),_=Se({loading:!0,page:1,total:0,limit:h.scene=="select"?10:20,data:[]});h.scene=="select"?(_.limit=10,h.type=="icon"&&(_.limit=20)):(_.limit=20,h.type=="icon"&&(_.limit=30));const o=Se({name:""}),L=Se({real_name:"",cate_id:0}),m=dt(()=>{(h.type=="icon"?lr:ur)({type:h.type,...o}).then(I=>{C.data=I.data}).catch(()=>{})});m();const f=dt((k=1)=>{const I=h.type=="icon"?dr:cr;_.loading=!0,_.page=k,I({page:_.page,limit:_.limit,att_type:h.type,...L}).then(w=>{if(_.data=w.data.data,_.total=w.data.total,_.loading=!1,h.scene=="attachment"&&s(),h.type!="icon")for(let O=0;O<_.data.length;O++)_.data[O].image_list=[],_.data[O].image_list.push(Ge(w.data.data[O].url))}).catch(()=>{_.loading=!1})});f(),et(()=>L.cate_id,()=>{f()});const E=k=>{ir({type:h.type,name:k}).then(I=>{R.value="",m(1)}).catch(()=>{})},y=(k,I)=>{nr({id:C.data[I].id,name:k}).then(w=>{C.data[I].name=k}).catch(()=>{})},d=k=>{ct.confirm(ee("upload.deleteCategoryTips"),ee("warning"),{confirmButtonText:ee("confirm"),cancelButtonText:ee("cancel"),type:"warning"}).then(()=>{ar(C.data[k].id).then(()=>{C.data.splice(k,1)}).catch(()=>{})})},e=Ee(null),a=Re(()=>{const k={};return k.token=Ft(),k["site-id"]=Mt.get("siteId")||0,{action:`/adminapi//sys/${h.type}`,multiple:!0,data:{cate_id:L.cate_id},headers:k,onSuccess:(I,w,O)=>{var P;I.code>=1?(f(),(P=e.value)==null||P.handleRemove(w)):(w.status="fail",st({message:I.msg,type:"error"}))}}}),t=Ee(!1);et(t,()=>{if(t.value){const k=Object.keys(De(A));_.data.forEach(I=>{k.includes(I.att_id)||(A[I.att_id]=De(I))})}else s()});const s=()=>{const k=Object.keys(De(A));k.length&&(k.forEach(I=>{delete A[I]}),t.value=!1)},u=k=>{if(A[k.att_id])delete A[k.att_id],D.splice(D.indexOf(k.att_id),1);else if(h.scene=="select"){const I=Object.keys(De(A)),w=I.length;if(h.limit==1&&w==h.limit)delete A[I[0]],D.splice(D.indexOf(I[0]),1);else if(w>=h.limit){st.info(ee("upload.triggerUpperLimit"));return}A[k.att_id]=De(k),D.push(k.att_id)}else A[k.att_id]=De(k),D.push(k.att_id)},n=k=>{let I=D.indexOf(k);return I==-1?0:I+1},l=(k=null)=>{const I=k===null?Object.keys(De(A)):[_.data[k].att_id];ct.confirm(ee("upload.deleteAttachmentTips"),ee("warning"),{confirmButtonText:ee("confirm"),cancelButtonText:ee("cancel"),type:"warning"}).then(()=>{sr({att_ids:I}).then(()=>{f()}).catch(()=>{})})},v=Se({cateId:"",loading:!1,visible:!1}),g=(k=null)=>{const I=k===null?Object.keys(De(A)):[_.data[k].att_id];v.visible=!0,v.cateId=C.data[0].id,v.confirm=()=>{v.loading=!0,or({cate_id:v.cateId,att_ids:I}).then(()=>{v.visible=!1,v.loading=!1,f()}).catch(()=>{v.loading=!1})}},p=Ee(!0);et(A,()=>{p.value=Object.keys(De(A)).length==0});const r=Se({show:!1,index:0}),i=k=>{r.show=!0,r.index=k},c=Re(()=>De(_.data).map(k=>Ge(k.url))),S=Se({visible:!1,src:""}),b=k=>{S.visible=!0,S.src=Ge(_.data[k].url)};return x({selectedFile:A}),(k,I)=>{const w=St,O=rr,P=xi,F=Nt,M=Bt,B=Ut,U=Gt,j=bt,V=jt,H=Kt,X=Vt,q=Ht,$=Wt,ie=Yt,se=qt,le=zt,re=Xt,fe=$t,te=Qt,ne=Zt,ce=Jt,ue=er,ve=Ci,ye=tr;return Y(),Z("div",{class:Le(["flex border-t border-b main-wrap border-color w-full",N.scene=="select"?"h-[40vh]":"h-full"])},[K("div",Oi,[z(w,{modelValue:o.name,"onUpdate:modelValue":I[0]||(I[0]=W=>o.name=W),class:"m-0",placeholder:G(ee)("upload.attachmentCategoryPlaceholder"),clearable:"","prefix-icon":"Search",onInput:I[1]||(I[1]=W=>G(m)())},null,8,["modelValue","placeholder"]),K("div",Pi,[z(U,null,{default:Q(()=>[K("div",{class:Le(["group-item p-[10px] leading-none text-xs rounded cursor-pointer",{active:L.cate_id==0}]),onClick:I[2]||(I[2]=W=>L.cate_id=0)},J(G(ee)("selectPlaceholder")),3),(Y(!0),Z(we,null,Fe(C.data,(W,de)=>(Y(),Z("div",{class:Le(["group-item px-[10px] text-xs rounded cursor-pointer flex",{active:L.cate_id==W.id}]),key:de},[K("div",{class:"flex-1 leading-none truncate py-[10px]",onClick:oe=>L.cate_id=W.id},J(W.name),9,Fi),N.scene=="attachment"&&h.type!="icon"?(Y(),Z("div",Mi,[N.scene=="attachment"?(Y(),ge(B,{key:0,"hide-on-click":!1},{dropdown:Q(()=>[z(M,null,{default:Q(()=>[z(F,{class:"text-center"},{default:Q(()=>[z(P,{placeholder:G(ee)("upload.attachmentCategoryPlaceholder"),onConfirm:oe=>y(oe,de),modelValue:W.name,"onUpdate:modelValue":oe=>W.name=oe},{default:Q(()=>[K("span",null,J(G(ee)("edit")),1)]),_:2},1032,["placeholder","onConfirm","modelValue","onUpdate:modelValue"])]),_:2},1024),z(F,{onClick:oe=>d(de)},{default:Q(()=>[K("div",Ni,J(G(ee)("delete")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),default:Q(()=>[z(O,{name:"element-MoreFilled",class:"cursor-pointer ml-[10px]",size:"14px"}),he(" "+J(W.name)+" ",1)]),_:2},1024)):ae("",!0)])):ae("",!0)],2))),128))]),_:1})]),h.type!="icon"?(Y(),ge(P,{key:0,placeholder:G(ee)("upload.attachmentCategoryPlaceholder"),onConfirm:E,modelValue:R.value,"onUpdate:modelValue":I[3]||(I[3]=W=>R.value=W)},{default:Q(()=>[z(j,null,{default:Q(()=>[he(J(G(ee)("upload.addAttachmentCategory")),1)]),_:1})]),_:1},8,["placeholder","modelValue"])):ae("",!0)]),K("div",Bi,[z(X,{gutter:15,class:"h-[32px]"},{default:Q(()=>[z(H,{span:10},{default:Q(()=>[K("div",Ui,[h.type!="icon"?(Y(),ge(V,Tt({key:0},G(a),{ref_key:"uploadRef",ref:e}),{default:Q(()=>[z(j,{type:"primary"},{default:Q(()=>[he(J(G(ee)("upload.upload"+N.type))+" "+J(k.isOpen),1)]),_:1})]),_:1},16)):ae("",!0),N.scene=="attachment"&&h.type!="icon"?(Y(),Z("div",Gi,[T.value===!1?(Y(),ge(j,{key:0,class:"ml-[10px]",type:"primary",onClick:I[4]||(I[4]=W=>T.value=!0)},{default:Q(()=>[he(J(G(ee)("edit")),1)]),_:1})):(Y(),ge(j,{key:1,class:"ml-[10px]",type:"primary",onClick:I[5]||(I[5]=W=>T.value=!1)},{default:Q(()=>[he(J(G(ee)("complete")),1)]),_:1}))])):ae("",!0)])]),_:1}),z(H,{span:14,class:"text-right"},{default:Q(()=>[z(w,{modelValue:L.real_name,"onUpdate:modelValue":I[6]||(I[6]=W=>L.real_name=W),class:"m-0 w-[200px]",clearable:"",placeholder:G(ee)("upload.placeholder"+N.type+"Name"),"prefix-icon":"Search",onInput:I[7]||(I[7]=W=>G(f)())},null,8,["modelValue","placeholder"])]),_:1})]),_:1}),me((Y(),Z("div",ji,[z(U,null,{default:Q(()=>[_.data.length&&(T.value===!0||N.scene!="attachment")?(Y(),Z("div",Ki,[(Y(!0),Z(we,null,Fe(_.data,(W,de)=>(Y(),Z("div",{class:Le(["attachment-item mr-[10px]",N.scene=="select"?"w-[100px]":"w-[120px]"]),key:de},[K("div",{class:Le(["attachment-wrap w-full rounded cursor-pointer overflow-hidden relative flex items-center justify-center",N.scene=="select"?"h-[100px]":"h-[120px]"]),onClick:oe=>u(W)},[N.type=="image"?(Y(),ge(q,{key:0,src:G(Ge)(W.url),fit:"contain"},null,8,["src"])):N.type=="video"?(Y(),Z("video",{key:1,src:G(Ge)(W.url)},null,8,Hi)):N.type=="icon"?(Y(),ge(O,{key:2,name:W.url,size:"40px"},null,8,["name"])):ae("",!0),me(K("div",Wi,[z(O,{name:"element-Select",color:"#fff",size:"40px"}),K("div",Yi,[K("span",qi,J(n(W.att_id)),1)])],512),[[Te,A[W.att_id]]])],10,Vi),K("div",zi,[z($,{placement:"top"},{content:Q(()=>[he(J(W.real_name),1)]),default:Q(()=>[K("div",Xi,J(W.real_name),1)]),_:2},1024),N.scene=="attachment"?(Y(),ge(B,{key:0,"hide-on-click":!1,class:"attachment-action hidden"},{dropdown:Q(()=>[z(M,null,{default:Q(()=>[W.att_type=="image"?(Y(),ge(F,{key:0,class:"text-center",onClick:oe=>i(de)},{default:Q(()=>[K("div",$i,J(G(ee)("lookOver")),1)]),_:2},1032,["onClick"])):ae("",!0),W.att_type=="video"?(Y(),ge(F,{key:1,class:"text-center",onClick:oe=>b(de)},{default:Q(()=>[K("div",Qi,J(G(ee)("lookOver")),1)]),_:2},1032,["onClick"])):ae("",!0),z(F,{class:"text-center",onClick:oe=>g(de)},{default:Q(()=>[K("div",Zi,J(G(ee)("upload.move")),1)]),_:2},1032,["onClick"]),z(F,{onClick:oe=>l(de)},{default:Q(()=>[K("div",Ji,J(G(ee)("delete")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),default:Q(()=>[z(O,{name:"element-MoreFilled",class:"cursor-pointer ml-[8px]",size:"14px"})]),_:2},1024)):ae("",!0)])],2))),128))])):_.data.length&&T.value===!1?(Y(),Z("div",en,[(Y(!0),Z(we,null,Fe(_.data,(W,de)=>(Y(),Z("div",{class:"attachment-item mr-[10px] w-[120px]",key:de},[K("div",tn,[N.type=="image"?(Y(),ge(q,{key:0,src:G(Ge)(W.url),fit:"contain","preview-src-list":W.image_list},null,8,["src","preview-src-list"])):N.type=="video"?(Y(),Z("video",{key:1,src:G(Ge)(W.url)},null,8,rn)):N.type=="icon"?(Y(),ge(O,{key:2,name:W.url,size:"40px"},null,8,["name"])):ae("",!0)]),K("div",nn,[z($,{placement:"top"},{content:Q(()=>[he(J(W.real_name),1)]),default:Q(()=>[K("div",an,J(W.real_name),1)]),_:2},1024)])]))),128))])):(Y(),Z("div",sn,[_.loading?ae("",!0):(Y(),ge(ie,{key:0,description:N.type=="icon"?G(ee)("upload.iconEmpty"):G(ee)("upload.attachmentEmpty"),"image-size":100},null,8,["description"]))]))]),_:1})])),[[ye,_.loading]]),z(X,{gutter:20},{default:Q(()=>[N.scene=="attachment"&&T.value===!0?(Y(),ge(H,{key:0,span:8},{default:Q(()=>[K("div",on,[z(se,{modelValue:t.value,"onUpdate:modelValue":I[8]||(I[8]=W=>t.value=W),label:G(ee)("selectAll"),size:"large"},null,8,["modelValue","label"]),z(j,{class:"ml-[15px]",disabled:p.value,onClick:I[9]||(I[9]=W=>l())},{default:Q(()=>[he(J(G(ee)("delete")),1)]),_:1},8,["disabled"]),z(j,{disabled:p.value,onClick:I[10]||(I[10]=W=>g())},{default:Q(()=>[he(J(G(ee)("upload.move")),1)]),_:1},8,["disabled"])])]),_:1})):ae("",!0),z(H,{span:N.scene=="attachment"?16:24},{default:Q(()=>[K("div",ln,[z(le,{"current-page":_.page,"onUpdate:current-page":I[11]||(I[11]=W=>_.page=W),small:!0,"page-size":_.limit,"onUpdate:page-size":I[12]||(I[12]=W=>_.limit=W),"page-sizes":[10,20,30,40,60],layout:"total, sizes, prev, pager, next, jumper",total:_.total,onSizeChange:I[13]||(I[13]=W=>G(f)()),onCurrentChange:G(f)},null,8,["current-page","page-size","total","onCurrentChange"])])]),_:1},8,["span"])]),_:1})]),N.scene=="attachment"?(Y(),Z(we,{key:0},[z(ce,{modelValue:v.visible,"onUpdate:modelValue":I[17]||(I[17]=W=>v.visible=W),title:G(ee)("upload.moveCategory"),width:"350px"},{footer:Q(()=>[K("span",un,[z(j,{onClick:I[15]||(I[15]=W=>v.visible=!1)},{default:Q(()=>[he(J(G(ee)("cancel")),1)]),_:1}),z(j,{type:"primary",loading:v.loading,onClick:I[16]||(I[16]=W=>v.confirm())},{default:Q(()=>[he(J(G(ee)("confirm")),1)]),_:1},8,["loading"])])]),default:Q(()=>[z(ne,{"label-width":"60px"},{default:Q(()=>[z(te,{label:G(ee)("upload.moveTo"),style:{"margin-bottom":"0"}},{default:Q(()=>[z(fe,{modelValue:v.cateId,"onUpdate:modelValue":I[14]||(I[14]=W=>v.cateId=W),class:"input-width"},{default:Q(()=>[(Y(!0),Z(we,null,Fe(C.data,(W,de)=>(Y(),ge(re,{label:W.name,value:W.id,key:de},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"])]),_:1})]),_:1},8,["modelValue","title"]),r.show?(Y(),ge(ue,{key:0,"url-list":G(c),onClose:I[18]||(I[18]=W=>r.show=!1),"initial-index":r.index,"zoom-rate":1},null,8,["url-list","initial-index"])):ae("",!0),z(ce,{modelValue:S.visible,"onUpdate:modelValue":I[19]||(I[19]=W=>S.visible=W),width:"50%","align-center":"","destroy-on-close":!0,"custom-class":"video-preview"},{default:Q(()=>[z(ve,{src:S.src,width:"100%"},null,8,["src"])]),_:1},8,["modelValue"])],64)):ae("",!0)],2)}}});const Fn=hr(dn,[["__scopeId","data-v-eb48c084"]]);export{Ci as _,Fn as a};
diff --git a/niucloud/public/admin/assets/attachment-fe805df4.js b/niucloud/public/admin/assets/attachment-fe805df4.js
deleted file mode 100644
index 3c6e8ccd1..000000000
--- a/niucloud/public/admin/assets/attachment-fe805df4.js
+++ /dev/null
@@ -1,22 +0,0 @@
-import{q as Re,c as Z,A as Le,x as je,u as G,i as he,d as xe,y as me,z as Te,a as K,e as z,t as J,r as Ee,B as ae,n as Se,s as et,v as mt,o as yt,w as Q,T as at,F as we,G as Fe,h as Y,p as Ve,g as He,D as Et,a5 as It,aO as Ct,aP as Tt,I as ge,S as Ze,aQ as ut,C as wt,b as xt,aR as Ot,N as ee,a3 as st,W as St,E as bt,a9 as Pt,aS as Ft,U as Mt,aw as De,R as Ge,ax as dt,a8 as ct,aT as Nt,aU as Bt,aV as Ut,ap as Gt,aW as jt,an as Kt,ao as Vt,V as Ht,ai as Wt,ad as Yt,aA as qt,a4 as zt,as as Xt,aE as $t,X as Qt,Y as Zt,aa as Jt,aN as er,$ as tr}from"./index-9fd19666.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{_ as rr}from"./index.vue_vue_type_script_setup_true_lang-979165cb.js";import{r as ir,s as nr,t as ar,u as sr,v as or,w as lr,x as ur,y as dr,z as cr}from"./sys-f18fe462.js";import{_ as hr}from"./_plugin-vue_export-helper-c27b6911.js";var fr=Object.defineProperty,gr=Object.defineProperties,vr=Object.getOwnPropertyDescriptors,ht=Object.getOwnPropertySymbols,pr=Object.prototype.hasOwnProperty,mr=Object.prototype.propertyIsEnumerable,ft=(N,x,h)=>x in N?fr(N,x,{enumerable:!0,configurable:!0,writable:!0,value:h}):N[x]=h,ot=(N,x)=>{for(var h in x||(x={}))pr.call(x,h)&&ft(N,h,x[h]);if(ht)for(var h of ht(x))mr.call(x,h)&&ft(N,h,x[h]);return N},lt=(N,x)=>gr(N,vr(x));function gt(N,x,h,R){var T,A=!1,D=0;function C(){T&&clearTimeout(T)}function _(){for(var o=arguments.length,L=new Array(o),m=0;m0&&r===-1?(this.log("Override startPosition with lastCurrentTime @"+i.toFixed(3)),this.state=T.State.IDLE):(this.loadedmetadata=!1,this.state=T.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=r,this.tick()},p.doTick=function(){switch(this.state){case T.State.IDLE:this.doTickIdle();break;case T.State.WAITING_TRACK:var r,i=this.levels,c=this.trackId,S=i==null||(r=i[c])===null||r===void 0?void 0:r.details;if(S){if(this.waitForCdnTuneIn(S))break;this.state=T.State.WAITING_INIT_PTS}break;case T.State.FRAG_LOADING_WAITING_RETRY:var b,k=performance.now(),I=this.retryDate;(!I||k>=I||(b=this.media)!==null&&b!==void 0&&b.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.state=T.State.IDLE);break;case T.State.WAITING_INIT_PTS:var w=this.waitingData;if(w){var O=w.frag,P=w.part,F=w.cache,M=w.complete;if(this.initPTS[O.cc]!==void 0){this.waitingData=null,this.waitingVideoCC=-1,this.state=T.State.FRAG_LOADING;var B={frag:O,part:P,payload:F.flush(),networkDetails:null};this._handleFragmentLoadProgress(B),M&&n.prototype._handleFragmentLoadComplete.call(this,B)}else if(this.videoTrackCC!==this.waitingVideoCC)a.logger.log("Waiting fragment cc ("+O.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var U=this.getLoadPosition(),j=D.BufferHelper.bufferInfo(this.mediaBuffer,U,this.config.maxBufferHole);Object(y.fragmentWithinToleranceTest)(j.end,this.config.maxFragLookUpTolerance,O)<0&&(a.logger.log("Waiting fragment cc ("+O.cc+") @ "+O.start+" cancelled because another fragment at "+j.end+" is needed"),this.clearWaitingFragment())}}else this.state=T.State.IDLE}this.onTickEnd()},p.clearWaitingFragment=function(){var r=this.waitingData;r&&(this.fragmentTracker.removeFragment(r.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=T.State.IDLE)},p.onTickEnd=function(){var r=this.media;if(r&&r.readyState){var i=(this.mediaBuffer?this.mediaBuffer:r).buffered;!this.loadedmetadata&&i.length&&(this.loadedmetadata=!0),this.lastCurrentTime=r.currentTime}},p.doTickIdle=function(){var r,i,c=this.hls,S=this.levels,b=this.media,k=this.trackId,I=c.config;if(S&&S[k]&&(b||!this.startFragRequested&&I.startFragPrefetch)){var w=S[k].details;if(!w||w.live&&this.levelLastLoaded!==k||this.waitForCdnTuneIn(w))this.state=T.State.WAITING_TRACK;else{this.bufferFlushed&&(this.bufferFlushed=!1,this.afterBufferFlushed(this.mediaBuffer?this.mediaBuffer:this.media,L.ElementaryStreamTypes.AUDIO,o.PlaylistLevelType.AUDIO));var O=this.getFwdBufferInfo(this.mediaBuffer?this.mediaBuffer:this.media,o.PlaylistLevelType.AUDIO);if(O!==null){var P=O.len,F=this.getMaxBufferLength(),M=this.audioSwitch;if(!(P>=F)||M){if(!M&&this._streamEnded(O,w))return c.trigger(A.Events.BUFFER_EOS,{type:"audio"}),void(this.state=T.State.ENDED);var B=w.fragments[0].start,U=O.end;if(M){var j=this.getLoadPosition();U=j,w.PTSKnown&&jB||O.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),b.currentTime=B+.05)}var V=this.getNextFragment(U,w);V?((r=V.decryptdata)===null||r===void 0?void 0:r.keyFormat)!=="identity"||(i=V.decryptdata)!==null&&i!==void 0&&i.key?this.loadFragment(V,w,U):this.loadKey(V,w):this.bufferFlushed=!0}}}}},p.getMaxBufferLength=function(){var r=n.prototype.getMaxBufferLength.call(this),i=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,o.PlaylistLevelType.MAIN);return i===null?r:Math.max(r,i.len)},p.onMediaDetaching=function(){this.videoBuffer=null,n.prototype.onMediaDetaching.call(this)},p.onAudioTracksUpdated=function(r,i){var c=i.audioTracks;this.resetTransmuxer(),this.levels=c.map(function(S){return new _.Level(S)})},p.onAudioTrackSwitching=function(r,i){var c=!!i.url;this.trackId=i.id;var S=this.fragCurrent;S!=null&&S.loader&&S.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),c?this.setInterval(100):this.resetTransmuxer(),c?(this.audioSwitch=!0,this.state=T.State.IDLE):this.state=T.State.STOPPED,this.tick()},p.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},p.onLevelLoaded=function(r,i){this.mainDetails=i.details},p.onAudioTrackLoaded=function(r,i){var c,S=this.levels,b=i.details,k=i.id;if(S){this.log("Track "+k+" loaded ["+b.startSN+","+b.endSN+"],duration:"+b.totalduration);var I=S[k],w=0;if(b.live||(c=I.details)!==null&&c!==void 0&&c.live){var O=this.mainDetails;if(b.fragments[0]||(b.deltaUpdateFailed=!0),b.deltaUpdateFailed||!O)return;!I.details&&b.hasProgramDateTime&&O.hasProgramDateTime?(Object(d.alignPDT)(b,O),w=b.fragments[0].start):w=this.alignPlaylists(b,I.details)}I.details=b,this.levelLastLoaded=k,this.startFragRequested||!this.mainDetails&&b.live||this.setStartPosition(I.details,w),this.state!==T.State.WAITING_TRACK||this.waitForCdnTuneIn(b)||(this.state=T.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+k)},p._handleFragmentLoadProgress=function(r){var i,c=r.frag,S=r.part,b=r.payload,k=this.config,I=this.trackId,w=this.levels;if(w){var O=w[I];console.assert(O,"Audio track is defined on fragment load progress");var P=O.details;console.assert(P,"Audio track details are defined on fragment load progress");var F=k.defaultAudioCodec||O.audioCodec||"mp4a.40.2",M=this.transmuxer;M||(M=this.transmuxer=new f.default(this.hls,o.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var B=this.initPTS[c.cc],U=(i=c.initSegment)===null||i===void 0?void 0:i.data;if(B!==void 0){var j=S?S.index:-1,V=j!==-1,H=new E.ChunkMetadata(c.level,c.sn,c.stats.chunkCount,b.byteLength,j,V);M.push(b,U,F,"",c,S,P.totalduration,!1,H,B)}else a.logger.log("Unknown video PTS for cc "+c.cc+", waiting for video PTS before demuxing audio frag "+c.sn+" of ["+P.startSN+" ,"+P.endSN+"],track "+I),(this.waitingData=this.waitingData||{frag:c,part:S,cache:new m.default,complete:!1}).cache.push(new Uint8Array(b)),this.waitingVideoCC=this.videoTrackCC,this.state=T.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+c.sn+" of level "+c.level+" will not be buffered")},p._handleFragmentLoadComplete=function(r){this.waitingData?this.waitingData.complete=!0:n.prototype._handleFragmentLoadComplete.call(this,r)},p.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},p.onBufferCreated=function(r,i){var c=i.tracks.audio;c&&(this.mediaBuffer=c.buffer),i.tracks.video&&(this.videoBuffer=i.tracks.video.buffer)},p.onFragBuffered=function(r,i){var c=i.frag,S=i.part;c.type===o.PlaylistLevelType.AUDIO&&(this.fragContextChanged(c)?this.warn("Fragment "+c.sn+(S?" p: "+S.index:"")+" of level "+c.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):(c.sn!=="initSegment"&&(this.fragPrevious=c,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(A.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(c,S)))},p.onError=function(r,i){switch(i.details){case e.ErrorDetails.FRAG_LOAD_ERROR:case e.ErrorDetails.FRAG_LOAD_TIMEOUT:case e.ErrorDetails.KEY_LOAD_ERROR:case e.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(o.PlaylistLevelType.AUDIO,i);break;case e.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case e.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==T.State.ERROR&&this.state!==T.State.STOPPED&&(this.state=i.fatal?T.State.ERROR:T.State.IDLE,this.warn(i.details+" while loading frag, switching to "+this.state+" state"));break;case e.ErrorDetails.BUFFER_FULL_ERROR:if(i.parent==="audio"&&(this.state===T.State.PARSING||this.state===T.State.PARSED)){var c=!0,S=this.getFwdBufferInfo(this.mediaBuffer,o.PlaylistLevelType.AUDIO);S&&S.len>.5&&(c=!this.reduceMaxBufferLength(S.len)),c&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,n.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}},p.onBufferFlushed=function(r,i){i.type===L.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},p._handleTransmuxComplete=function(r){var i,c="audio",S=this.hls,b=r.remuxResult,k=r.chunkMeta,I=this.getCurrentContext(k);if(!I)return this.warn("The loading context changed while buffering fragment "+k.sn+" of level "+k.level+". This chunk will not be buffered."),void this.resetLiveStartWhenNotLoaded(k.level);var w=I.frag,O=I.part,P=b.audio,F=b.text,M=b.id3,B=b.initSegment;if(!this.fragContextChanged(w)){if(this.state=T.State.PARSING,this.audioSwitch&&P&&this.completeAudioSwitch(),B!=null&&B.tracks&&(this._bufferInitSegment(B.tracks,w,k),S.trigger(A.Events.FRAG_PARSING_INIT_SEGMENT,{frag:w,id:c,tracks:B.tracks})),P){var U=P.startPTS,j=P.endPTS,V=P.startDTS,H=P.endDTS;O&&(O.elementaryStreams[L.ElementaryStreamTypes.AUDIO]={startPTS:U,endPTS:j,startDTS:V,endDTS:H}),w.setElementaryStreamInfo(L.ElementaryStreamTypes.AUDIO,U,j,V,H),this.bufferFragmentData(P,w,O,k)}if(M!=null&&(i=M.samples)!==null&&i!==void 0&&i.length){var X=t({frag:w,id:c},M);S.trigger(A.Events.FRAG_PARSING_METADATA,X)}if(F){var q=t({frag:w,id:c},F);S.trigger(A.Events.FRAG_PARSING_USERDATA,q)}}},p._bufferInitSegment=function(r,i,c){if(this.state===T.State.PARSING){r.video&&delete r.video;var S=r.audio;if(S){S.levelCodec=S.codec,S.id="audio",this.log("Init audio buffer, container:"+S.container+", codecs[parsed]=["+S.codec+"]"),this.hls.trigger(A.Events.BUFFER_CODECS,r);var b=S.initSegment;if(b!=null&&b.byteLength){var k={type:"audio",frag:i,part:null,chunkMeta:c,parent:i.type,data:b};this.hls.trigger(A.Events.BUFFER_APPENDING,k)}this.tick()}}},p.loadFragment=function(r,i,c){var S=this.fragmentTracker.getState(r);this.fragCurrent=r,(this.audioSwitch||S===C.FragmentState.NOT_LOADED||S===C.FragmentState.PARTIAL)&&(r.sn==="initSegment"?this._loadInitSegment(r):i.live&&!Object(R.isFiniteNumber)(this.initPTS[r.cc])?(this.log("Waiting for video PTS in continuity counter "+r.cc+" of live stream before loading audio fragment "+r.sn+" of level "+this.trackId),this.state=T.State.WAITING_INIT_PTS):(this.startFragRequested=!0,n.prototype.loadFragment.call(this,r,i,c)))},p.completeAudioSwitch=function(){var r=this.hls,i=this.media,c=this.trackId;i&&(this.log("Switching audio track : flushing all audio"),n.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,r.trigger(A.Events.AUDIO_TRACK_SWITCHED,{id:c})},g}(T.default);x.default=u},"./src/controller/audio-track-controller.ts":function(N,x,h){h.r(x);var R=h("./src/events.ts"),T=h("./src/errors.ts"),A=h("./src/controller/base-playlist-controller.ts"),D=h("./src/types/loader.ts");function C(L,m){for(var f=0;f0?U-1:U].dts&&(B=!0)}B&&S.sort(function(_e,Ue){var Dt=_e.dts-Ue.dts,Rt=_e.pts-Ue.pts;return Dt||Rt}),r=S[0].dts,i=S[S.length-1].dts;var V=Math.round((i-r)/(k-1));if(M<0){if(M<-2*V){_.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(L.toMsFromMpegTsClock)(-V,!0)+" ms");for(var H=M,X=0;X
-
+
+