123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- <?php
- namespace app\common\model;
- use think\facade\Db;
- /**
- * ============================================================================
- * DSKMS多用户商城
- * ============================================================================
- * 版权所有 2014-2028 浙江惠利玛产业互联网有限公司,并保留所有权利。
- * 网站地址: https://www.valimart.net/
- * ----------------------------------------------------------------------------
- *
- * ============================================================================
- * 数据层模型
- */
- class LiveApply extends BaseModel {
- public $page_info;
- public function getLiveApplyList($condition, $field = '*', $pagesize=10, $order = 'live_apply_id desc') {
- if ($pagesize) {
- $result = Db::name('live_apply')->field($field)->where($condition)->order($order)->paginate(['list_rows' => $pagesize, 'query' => request()->param()], false);
- $this->page_info = $result;
- return $result->items();
- } else {
- $result = Db::name('live_apply')->field($field)->where($condition)->order($order)->select()->toArray();
- return $result;
- }
- }
- /**
- * 取单个内容
- * @access public
- * @author csdeshang
- * @param int $id 分类ID
- * @return array 数组类型的返回结果
- */
- public function getLiveApplyInfo($condition) {
- $result = Db::name('live_apply')->where($condition)->find();
- return $result;
- }
- /**
- * 新增
- * @access public
- * @author csdeshang
- * @param array $data 参数内容
- * @return bool 布尔类型的返回结果
- */
- public function addLiveApply($data) {
- $result = Db::name('live_apply')->insertGetId($data);
- return $result;
- }
- /**
- * 取商品
- * @access public
- * @author csdeshang
- * @param array $condition 条件
- * @return array 数组类型的返回结果
- */
- public function getLiveApplyGoodsList($condition) {
- $result = Db::name('live_apply_goods')->where($condition)->select()->toArray();
- return $result;
- }
- /**
- * 新增
- * @access public
- * @author csdeshang
- * @param array $data 参数内容
- * @return bool 布尔类型的返回结果
- */
- public function addLiveApplyGoodsAll($data) {
- $result = Db::name('live_apply_goods')->insertAll($data);
- return $result;
- }
- /**
- * 更新信息
- * @access public
- * @author csdeshang
- * @param array $data 数据
- * @param array $condition 条件
- * @return bool
- */
- public function editLiveApply($data, $condition) {
- $result = Db::name('live_apply')->where($condition)->update($data);
- return $result;
- }
- /**
- * 删除分类
- * @access public
- * @author csdeshang
- * @param int $condition 记录ID
- * @return bool
- */
- public function delLiveApply($condition) {
- return Db::name('live_apply')->where($condition)->delete();
- }
- function getPushUrl($streamName, $time) {
- if (config('ds_config.video_type') == 'aliyun') {
- $domain=config('ds_config.aliyun_live_push_domain');
- $key=config('ds_config.aliyun_live_push_key');
- $rand=rand(10000,99999);
- $ext_str='?auth_key='.$time.'-'.$rand.'-0-'.md5('/live/'.$streamName.'-'.$time.'-'.$rand.'-0-'.$key);
- } else {
- $domain=config('ds_config.live_push_domain');
- $key=config('ds_config.live_push_key');
- $txTime = strtoupper(base_convert($time, 10, 16));
- $txSecret = md5($key . $streamName . $txTime);
- $ext_str = "?" . http_build_query(array(
- "txSecret" => $txSecret,
- "txTime" => $txTime
- ));
- }
- return "rtmp://" . $domain . "/live/" . $streamName . (isset($ext_str) ? $ext_str : "");
- }
- function getPlayUrl($streamName, $time,$rtmp=false){
- if (config('ds_config.video_type') == 'aliyun') {
- $domain=config('ds_config.aliyun_live_play_domain');
- $key=config('ds_config.aliyun_live_play_key');
- $rand=rand(10000,99999);
- $ext_str='?auth_key='.$time.'-'.$rand.'-0-'.md5('/live/'.$streamName.'.m3u8'.'-'.$time.'-'.$rand.'-0-'.$key);
- }else{
- $domain=config('ds_config.live_play_domain');
- }
- if($rtmp){
- return 'rtmp://'.$domain.'/live/'.$streamName . (isset($ext_str) ? $ext_str : "");
- }else{
- return HTTP_TYPE.$domain.'/live/'.$streamName.'.m3u8' . (isset($ext_str) ? $ext_str : "");
- }
-
- }
- }
|