You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
zhishifufei_php/application/agent/controller/live/AliyunLive.php

154 lines
5.1 KiB

9 months ago
<?php
// +----------------------------------------------------------------------
// | 天诚科技 [ 刘海东 17600099397赋能开发者,助力企业发展 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2016~2020 https://www.tczxkj.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed 该系统并不是自由软件,未经许可不能去掉相关版权
// +----------------------------------------------------------------------
// | Author:甘肃天诚志信电子商务有限公司 刘海东 联系电话维系17600099397
// +----------------------------------------------------------------------
namespace app\agent\controller\live;
use app\agent\controller\AuthController;
use app\merchant\model\live\LiveGoods;
use app\merchant\model\live\LiveGift;
use app\merchant\model\live\LiveReward;
use app\merchant\model\order\StoreOrder as StoreOrderModel;
use app\merchant\model\live\LiveBarrage;
use app\merchant\model\live\LiveHonouredGuest;
use app\merchant\model\live\LiveStudio;
use app\merchant\model\live\LiveUser;
use app\merchant\model\live\LiveAudit;
use app\merchant\model\live\LivePlayback;
use app\merchant\model\special\Special as SpecialModel;
use app\merchant\model\special\SpecialSubject;
use app\merchant\model\special\SpecialTask;
use app\merchant\model\user\User;
use app\merchant\model\merchant\MerchantBill;
use app\wap\model\user\WechatUser;
use service\JsonService as Json;
use service\SystemConfigService;
use service\WechatTemplateService;
use think\Exception;
use service\FormBuilder as Form;
use Api\AliyunLive as ApiAliyunLive;
use think\Session;
use think\Url;
use \GatewayWorker\Lib\Gateway;
use app\wap\model\routine\RoutineTemplate;
use app\wap\model\wap\SmsTemplate;
use app\merchant\model\merchant\Merchant;
use app\index\controller\PushJob;
/**直播
* Class AliyunLive
* @package app\merchant\controller\live
*/
class AliyunLive extends AuthController
{
/**
* 阿里云直播句柄
* @var \Api\AliyunLive
*/
protected $aliyunLive;
protected function _initialize()
{
parent::_initialize();
$this->aliyunLive = \Api\AliyunLive::instance([
'AccessKey' => SystemConfigService::get('accessKeyId'),
'AccessKeySecret' => SystemConfigService::get('accessKeySecret'),
'OssEndpoint' => SystemConfigService::get('aliyun_live_end_point'),
'OssBucket' => SystemConfigService::get('aliyun_live_oss_bucket'),
'appName' => SystemConfigService::get('aliyun_live_appName'),
'payKey' => SystemConfigService::get('aliyun_live_play_key'),
'key' => SystemConfigService::get('aliyun_live_push_key'),
'playLike' => SystemConfigService::get('aliyun_live_playLike'),
'rtmpLink' => SystemConfigService::get('aliyun_live_rtmpLink'),
]);
}
/**
* 直播间管理
* */
public function index()
{
$this->assign([
'special_list' => SpecialModel::where('type', SPECIAL_LIVE)->where(['is_del' => 0])->field(['id', 'title'])->select()->toArray(),
'type' => $this->request->param('type', 1),
]);
return $this->fetch();
}
/**
* 直播专题列表
* @param int $subject_id
* @return mixed
*/
public function special_live()
{
$special_type = $this->request->param("special_type");
if (!$special_type || !is_numeric($special_type)) return $this->failed('专题类型参数缺失');
$subjectlist = SpecialSubject::specialCategoryAll();
$this->assign([
'type' => 1,
'special_type' => $special_type,
'special_title' => SPECIAL_TYPE[$special_type],
'subject_list' => $subjectlist,
'is_live' => 1,
]);
return $this->fetch();
}
/**
* 获取专题直播列表
*/
public function special_list()
{
$where = parent::getMore([
['subject_id', 0],
['page', 1],
['limit', 20],
['store_name', ''],
['title', ''],
['start_time', ''],
['end_time', ''],
['order', ''],
['is_show', ''],
['special_type', 4],
['status', ''],
]);
if (isset($where['special_type'])) {
$where['type'] = $where['special_type'];
}
// $where['agent_id'] = $this->merchantId;
$special_list = SpecialModel::getSpecialList($where);
return Json::successlayui($special_list);
}
public function mer_live_reward()
{
$this->assign([
'gold_name' => SystemConfigService::get("gold_name")
]);
return $this->fetch();
}
/**
* 收益列表
*/
public function mer_live_reward_list()
{
$where = parent::postMore([
['page', 1],
['limit', 20],
['order', ''],
['live_id', 0],
]);
$where['mer_id'] = $this->merchantId;
return Json::successlayui(LiveReward::get_mer_live_reward_list($where));
}
}