AliyunLive.php 44 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
  4. // +----------------------------------------------------------------------
  5. // | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
  6. // +----------------------------------------------------------------------
  7. // | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
  8. // +----------------------------------------------------------------------
  9. // | Author: CRMEB Team <admin@crmeb.com>
  10. // +----------------------------------------------------------------------
  11. namespace app\admin\controller\live;
  12. use app\admin\controller\AuthController;
  13. use app\admin\model\live\LiveGoods;
  14. use app\admin\model\live\LiveGift;
  15. use app\admin\model\live\LiveReward;
  16. use app\admin\model\order\StoreOrder as StoreOrderModel;
  17. use app\admin\model\live\LiveBarrage;
  18. use app\admin\model\live\LiveHonouredGuest;
  19. use app\admin\model\live\LiveStudio;
  20. use app\admin\model\live\LiveUser;
  21. use app\admin\model\live\LivePlayback;
  22. use app\admin\model\special\Grade;
  23. use app\admin\model\special\Special as SpecialModel;
  24. use app\admin\model\special\Special;
  25. use app\admin\model\special\SpecialCourse;
  26. use app\admin\model\special\SpecialSubject;
  27. use app\admin\model\special\SpecialTask;
  28. use app\admin\model\system\SystemAdmin;
  29. use app\admin\model\user\User;
  30. use app\wap\model\user\WechatUser;
  31. use service\JsonService as Json;
  32. use service\SystemConfigService;
  33. use service\WechatTemplateService;
  34. use think\Exception;
  35. use service\FormBuilder as Form;
  36. use Api\AliyunLive as ApiAliyunLive;
  37. use think\Session;
  38. use think\Url;
  39. use \GatewayWorker\Lib\Gateway;
  40. use app\admin\model\system\SystemRole as RoleModel;
  41. class AliyunLive extends AuthController
  42. {
  43. /**
  44. * 阿里云直播句柄
  45. * @var \Api\AliyunLive
  46. */
  47. protected $aliyunLive;
  48. protected function _initialize()
  49. {
  50. parent::_initialize();
  51. $this->aliyunLive = \Api\AliyunLive::instance([
  52. 'AccessKey' => SystemConfigService::get('accessKeyId'),
  53. 'AccessKeySecret' => SystemConfigService::get('accessKeySecret'),
  54. 'OssEndpoint' => SystemConfigService::get('aliyun_live_end_point'),
  55. 'OssBucket' => SystemConfigService::get('aliyun_live_oss_bucket'),
  56. 'appName' => SystemConfigService::get('aliyun_live_appName'),
  57. 'payKey' => SystemConfigService::get('aliyun_live_play_key'),
  58. 'key' => SystemConfigService::get('aliyun_live_push_key'),
  59. 'playLike' => SystemConfigService::get('aliyun_live_playLike'),
  60. 'rtmpLink' => SystemConfigService::get('aliyun_live_rtmpLink'),
  61. ]);
  62. }
  63. /**
  64. * 直播间管理
  65. * */
  66. public function index()
  67. {
  68. $this->assign([
  69. 'special_list' => SpecialModel::where('type', SPECIAL_LIVE)->where(['is_del'=>0])->field(['id', 'title'])->select()->toArray(),
  70. 'type' => $this->request->param('type', 1),
  71. ]);
  72. return $this->fetch();
  73. }
  74. /**
  75. * 快速设置直播的某个字段的值
  76. * @param string $field 键值
  77. * @param string $value 值
  78. * @param int $id 直播id
  79. * @return json
  80. * */
  81. public function set_live_value($field = '', $value = '', $id = 0)
  82. {
  83. if (!$field || !$id) return Json::fail('缺少参数');
  84. $value = str_replace('免密', '', $value);
  85. if (LiveStudio::where('id', $id)->update([$field => $value]))
  86. return Json::successful('修改成功');
  87. else
  88. return Json::fail('修改失败');
  89. }
  90. /**
  91. * 编辑直播间
  92. * */
  93. public function update_live($id = 0)
  94. {
  95. if (!$id) return $this->failed('缺少参数');
  96. $liveInfo = LiveStudio::get($id);
  97. if (!$liveInfo) return $this->failed('未查到直播间信息');
  98. $f[] = Form::input('stream_name', '直播间号:', $liveInfo->getData('stream_name'))->disabled(true);
  99. $f[] = Form::input('live_title', '直播间标题:', $liveInfo->getData('live_title'));
  100. $f[] = Form::frameImageOne('live_image', '直播封面:', Url::build('admin/widget.images/index', array('fodder' => 'live_image')), $liveInfo->getData('live_image'))->icon('image')->width('100%')->height('500px');
  101. $f[] = Form::input('studio_pwd', '直播间密码:', $liveInfo->getData('studio_pwd'));
  102. $f[] = Form::textarea('live_introduction', '直播间简介:', $liveInfo->getData('live_introduction'));
  103. $f[] = Form::number('online_num', '虚拟在线人数:', $liveInfo->getData('online_num'));
  104. $f[] = Form::number('sort', '排序', $liveInfo->getData('sort'));
  105. $f[] = Form::radio('is_remind', '开播提醒:', $liveInfo->getData('is_remind'))->options([
  106. ['value' => 1, 'label' => '是'],
  107. ['value' => 0, 'label' => '否'],
  108. ]);
  109. $f[] = Form::number('remind_time', '开播前提醒时间(分):', $liveInfo->getData('remind_time'));
  110. $f[] = Form::radio('is_recording', '自动录制:', $liveInfo->getData('is_recording'))->options([
  111. ['value' => 1, 'label' => '是'],
  112. ['value' => 0, 'label' => '否'],
  113. ]);
  114. $f[] = Form::radio('is_playback', '回放:', $liveInfo->getData('is_playback'))->options([
  115. ['value' => 1, 'label' => '是'],
  116. ['value' => 0, 'label' => '否'],
  117. ]);
  118. $form = Form::make_post_form('修改直播间', $f, Url::build('save_live', array('id' => $id)), 3);
  119. $this->assign(compact('form'));
  120. return $this->fetch('public/form-builder');
  121. }
  122. /**
  123. * 修改直播间
  124. * @param int $id
  125. * @return json
  126. * */
  127. public function save_live($id = 0)
  128. {
  129. if (!$id) return Json::fail('缺少参数');
  130. $data = parent::postMore([
  131. ['live_title', ''],
  132. ['live_image', ''],
  133. ['studio_pwd', ''],
  134. ['live_introduction', ''],
  135. ['online_num', 0],
  136. ['sort', 0],
  137. ['is_remind', 0],
  138. ['remind_time', 0],
  139. ['is_recording', 0],
  140. ['is_playback', 0],
  141. ]);
  142. if (!$data['live_title']) return Json::fail('直播间标题不能为空');
  143. if (!$data['live_introduction']) return Json::fail('直播间简介不能为空');
  144. if ($data['is_remind'] && !$data['remind_time']) return Json::fail('请输入直播前提醒时间!');
  145. if (LiveStudio::edit($data, $id))
  146. return Json::successful('修改成功');
  147. else
  148. return Json::fail('修改失败或者您没有修改内容');
  149. }
  150. /**
  151. * 直播间用户管理
  152. * @param int $id
  153. * */
  154. public function live_user($id = 0)
  155. {
  156. if (!$id) return $this->failed('缺少参数');
  157. $liveInfo = LiveStudio::get($id);
  158. if (!$liveInfo) return $this->failed('未查到直播间');
  159. $this->assign([
  160. 'stream_name' => $liveInfo->stream_name,
  161. 'live_id' => $id
  162. ]);
  163. return $this->fetch();
  164. }
  165. /**
  166. * 获取直播间用户列表
  167. * */
  168. public function get_live_user_list()
  169. {
  170. $where = parent::getMore([
  171. ['live_id', 0],
  172. ['page', 0],
  173. ['limit', 20],
  174. ['nickname', ''],
  175. ['start_time', ''],
  176. ['end_time', ''],
  177. ]);
  178. if (!$where['live_id']) return Json::fail('缺少参数');
  179. return Json::successlayui(LiveUser::getLiveUserList($where));
  180. }
  181. /**
  182. * 设置直播用户
  183. * @param string $field
  184. * @param string $id
  185. * @param string $value
  186. */
  187. public function set_live_user_value($field = '', $id = '', $value = '')
  188. {
  189. if (!$field || !$id) return Json::fail('缺少参数');
  190. if (LiveUser::where('id', $id)->update([$field => $value]))
  191. return Json::successful('修改成功');
  192. else
  193. return Json::fail('修改失败');
  194. }
  195. /**
  196. * 禁止发言
  197. */
  198. public function live_no_speaking($id)
  199. {
  200. if (!$id) return $this->failed('缺少参数');
  201. $liveInfo = LiveUser::get($id);
  202. if (!$liveInfo) return $this->failed('未查到直播间信息');
  203. $f[] = Form::radio('is_ban', '是否禁言', $liveInfo->getData('is_ban'))->options([
  204. ['value' => 1, 'label' => '是'],
  205. ['value' => 0, 'label' => '否'],
  206. ]);
  207. $f[] = Form::number('ban_time', '禁言时间:分');
  208. $form = Form::make_post_form('禁止发言', $f, Url::build('save_no_speaking', array('id' => $id)), 2);
  209. $this->assign(compact('form'));
  210. return $this->fetch('public/form-builder');
  211. }
  212. public function save_no_speaking($id = 0)
  213. {
  214. if (!$id) return Json::fail('缺少参数');
  215. $data = parent::postMore([
  216. ['is_ban', 0],
  217. ['ban_time', 0]
  218. ]);
  219. if ($data['is_ban']) {
  220. $workerman = \think\Config::get('workerman.channel', []);
  221. Gateway::$registerAddress = $workerman['ip'] . ':' . $workerman['port'];
  222. $uid = LiveUser::where('id', $id)->value('uid');
  223. if (Gateway::isUidOnline($uid)) {
  224. Gateway::sendToUid($uid, json_encode([
  225. 'type' => 'ban',
  226. 'value' => 1
  227. ]));
  228. }
  229. }
  230. if ($data['is_ban'] && $data['ban_time']<=0) return Json::fail('请输入禁言时间');
  231. $data['ban_time']=bcadd(time(),bcmul($data['ban_time'],60,0),0);
  232. if (LiveUser::edit($data, $id)){
  233. return Json::successful('修改成功');
  234. }else{
  235. return Json::fail('修改失败');
  236. }
  237. }
  238. /**
  239. * 禁止进入
  240. */
  241. public function live_no_entry($id)
  242. {
  243. if (!$id) return $this->failed('缺少参数');
  244. $liveInfo = LiveUser::get($id);
  245. if (!$liveInfo) return $this->failed('未查到直播间信息');
  246. $f[] = Form::radio('is_open_ben', '是否禁止进入直播间', $liveInfo->getData('is_open_ben'))->options([
  247. ['value' => 1, 'label' => '是'],
  248. ['value' => 0, 'label' => '否'],
  249. ]);
  250. $f[] = Form::number('open_ben_time', '禁止时间:分');
  251. $form = Form::make_post_form('禁止进入', $f, Url::build('save_no_entry', array('id' => $id)), 2);
  252. $this->assign(compact('form'));
  253. return $this->fetch('public/form-builder');
  254. }
  255. public function save_no_entry($id = 0)
  256. {
  257. if (!$id) return Json::fail('缺少参数');
  258. $data = parent::postMore([
  259. ['is_open_ben', 0],
  260. ['open_ben_time', 0]
  261. ]);
  262. if ($data['is_open_ben'] && $data['open_ben_time']<=0) return Json::fail('请输入禁止时间');
  263. $data['open_ben_time']=bcadd(time(),bcmul($data['open_ben_time'],60,0),0);
  264. if (LiveUser::edit($data, $id)){
  265. return Json::successful('修改成功');
  266. }else{
  267. return Json::fail('修改失败');
  268. }
  269. }
  270. /**
  271. * 直播间管理
  272. */
  273. public function get_live_list()
  274. {
  275. $where = parent::getMore([
  276. ['stream_name', ''],
  277. ['start_time', ''],
  278. ['end_time', ''],
  279. ['page', 1],
  280. ['limit', 20],
  281. ['special_id', 0],
  282. ]);
  283. //根据账号身份获取各自的列表数据
  284. $role_sign = get_login_role();
  285. if (isset($role_sign['role_sign']) && $role_sign['role_sign'] == "anchor") {
  286. $where['admin_id'] = get_login_id()['admin_id'];
  287. }
  288. return Json::successlayui(LiveStudio::getLiveList($where));
  289. }
  290. /**
  291. * 直播专题列表
  292. * @param int $subject_id
  293. * @return mixed
  294. */
  295. public function special_live($subject_id = 0)
  296. {
  297. $special_type = $this->request->param("special_type");
  298. $role_session = Session::get("adminInfo") ? Session::get("adminInfo")->toArray() : [];
  299. if ($role_session) {
  300. $login_role = RoleModel::where(['id' => $role_session['roles']])->field('role_name, id, sign, status')->find()->toArray();
  301. }
  302. if (!$special_type || !is_numeric($special_type)) return $this->failed('专题类型参数缺失');
  303. $admin_list = SystemAdmin::getRoleAdmin(['anchor', 'admin']);
  304. $subjectlist = Grade::with(['SpecialSubject'=>function($query){
  305. $query->where(['is_show'=>1,'is_del'=>0]);
  306. }])->where(['is_del'=>0,'is_show'=>1])->order('sort desc')->select();
  307. $this->assign([
  308. 'type' => $this->request->param('type', 1),
  309. 'special_type' => $special_type,
  310. 'special_title' => SPECIAL_TYPE[$special_type],
  311. 'subject_id' => $subject_id,
  312. 'subject_list' => $subjectlist,
  313. 'is_live' => 1,
  314. 'login_role' => $login_role,
  315. 'admin_list' => $admin_list
  316. ]);
  317. return $this->fetch();
  318. }
  319. /**
  320. * 获取直播推流地址
  321. * @param int $id
  322. * @throws \think\db\exception\DataNotFoundException
  323. * @throws \think\db\exception\ModelNotFoundException
  324. * @throws \think\exception\DbException
  325. */
  326. public function go_live($id = 0)
  327. {
  328. if (!$id) return Json::fail('缺少参数');
  329. $specialInfo = SpecialModel::get($id);
  330. if (!$specialInfo) return Json::fail('直播专题暂未查到');
  331. if ($specialInfo->type!=SPECIAL_LIVE) return Json::fail('此专题不授予直播专题,无法获取推流地址!');
  332. $liveInfo = LiveStudio::where('special_id', $specialInfo->id)->find();
  333. if (!$liveInfo) return Json::fail('没有查到此直播间');
  334. if ($liveInfo->is_del) return Json::fail('直播间已删除无法推流');
  335. $url = $this->aliyunLive->getPushSteam($liveInfo->stream_name);
  336. return Json::successful($url);
  337. }
  338. /**
  339. * 直播消息提醒
  340. * @param int $id
  341. * @throws \think\db\exception\DataNotFoundException
  342. * @throws \think\db\exception\ModelNotFoundException
  343. * @throws \think\exception\DbException
  344. */
  345. public function send_remind($id = 0)
  346. {
  347. if (!$id) return Json::fail('缺少参数');
  348. $specialInfo = SpecialModel::get($id);
  349. if (!$specialInfo) return Json::fail('直播专题暂未查到,无法进行提醒');
  350. $liveInfo = LiveStudio::where('special_id', $specialInfo->id)->find();
  351. if (!$liveInfo) return Json::fail('没有查到此直播间,无法提醒');
  352. if ($liveInfo->is_del) return Json::fail('直播间已删除无法提醒');
  353. try {
  354. if($specialInfo['pay_type']==1 && $specialInfo['member_pay_type']==1){
  355. $orderList = StoreOrderModel::where(['cart_id' => $id])->column("uid");
  356. }elseif ($specialInfo['pay_type']==1 && $specialInfo['member_pay_type']==0){
  357. $order = StoreOrderModel::where(['cart_id' => $id])->column("uid");
  358. $user =User::where('is_h5user',0)->where('level',1)->column("uid");
  359. $orderList=array_merge($order,$user);
  360. }else{
  361. $orderList =User::where('is_h5user',0)->column("uid");
  362. }
  363. if (!$orderList) {
  364. return Json::fail('暂无合适用户,无需提醒');
  365. }
  366. $sendUid = array();
  367. $site_url = SystemConfigService::get('site_url');
  368. foreach (array_unique($orderList) as $k => $v) {
  369. if ($openId = WechatUser::where('uid',$v)->value('openid')) {
  370. WechatTemplateService::sendTemplate($openId,WechatTemplateService::LIVE_START_NOTICE, [
  371. 'first' => '叮!直播马上开始啦,精彩不容错过!',
  372. 'keyword1' => $specialInfo->title,
  373. 'keyword2' => $liveInfo->start_play_time,
  374. 'remark' => '直播间通道'
  375. ], $site_url . Url::build('wap/special/details',['id' => $id]));
  376. $sendUid[] = $v;
  377. }
  378. }
  379. return Json::successful("发送成功",$sendUid);
  380. } catch (\Exception $e) {
  381. return Json::fail($e->getMessage());
  382. }
  383. }
  384. /**
  385. * 获取专题直播列表
  386. */
  387. public function special_list()
  388. {
  389. $where = parent::getMore([
  390. ['subject_id', 0],
  391. ['page', 1],
  392. ['limit', 20],
  393. ['store_name', ''],
  394. ['title', ''],
  395. ['start_time', ''],
  396. ['end_time', ''],
  397. ['order', ''],
  398. ['is_show', ''],
  399. ['special_type', 4],
  400. ]);
  401. if (isset($where['special_type'])) {
  402. $where['type'] = $where['special_type'];
  403. }
  404. //根据账号身份获取各自的列表数据
  405. $role_sign = get_login_role();
  406. if (isset($role_sign['role_sign']) && $role_sign['role_sign'] == "anchor") {
  407. $where['admin_id'] = get_login_id()['admin_id'];
  408. }
  409. $special_list = SpecialModel::getSpecialList($where);
  410. if ($special_list && isset($special_list['data'])) {
  411. foreach ($special_list['data'] as $k => $v) {
  412. $sys_admin = SystemAdmin::where(['id' => $v['admin_id']])->field('real_name, account')->find();
  413. $special_list['data'][$k]['admin_name'] = $sys_admin ? ($sys_admin['real_name'] ? $sys_admin['real_name'] : $sys_admin['account']) : "超级管理员";
  414. }
  415. }
  416. return Json::successlayui($special_list);
  417. }
  418. /**
  419. * 删除专题和直播间
  420. * @param int $id
  421. * @throws \think\db\exception\DataNotFoundException
  422. * @throws \think\db\exception\ModelNotFoundException
  423. * @throws \think\exception\DbException
  424. */
  425. public function delete($id = 0)
  426. {
  427. if (!$id) return Json::fail('缺少参数');
  428. $specialInfo = SpecialModel::get($id);
  429. if (!$specialInfo) return Json::fail('查找的专题不存在');
  430. if ($specialInfo->is_del) return Json::fail('专题已经删除');
  431. $liveInfo = LiveStudio::where(['special_id' => $id])->find();
  432. if (!$liveInfo) return Json::fail('删除的专题直播不存在');
  433. if ($liveInfo->is_del) return Json::fail('直播间已删除');
  434. $specialInfo->is_del = 1;
  435. $liveInfo->is_del = 1;
  436. if ($specialInfo->save() && $liveInfo->save()) {
  437. LiveStudio::where(['special_id' => $id])->update(['is_del' => 1]);
  438. return Json::successful('删除成功');
  439. }else{
  440. return Json::fail('删除失败');
  441. }
  442. }
  443. public function recommend($id = 0){
  444. if (!$id) return Json::fail('缺少参数');
  445. $specialInfo = SpecialModel::get($id);
  446. if (!$specialInfo) return Json::fail('专题不存在');
  447. Session::set('live_one_id',$id,'wap');
  448. return Json::successful('推荐成功');
  449. }
  450. /**
  451. * 嘉宾列表
  452. * @param $live_id
  453. * @return mixed
  454. */
  455. public function guest_list($live_id = 0)
  456. {
  457. $this->assign('live_id', $live_id);
  458. return $this->fetch();
  459. }
  460. /**
  461. * 添加嘉宾
  462. * @param int $live_id
  463. * @return mixed|void
  464. * @throws \FormBuilder\exception\FormBuilderException
  465. * @throws \think\db\exception\DataNotFoundException
  466. * @throws \think\db\exception\ModelNotFoundException
  467. * @throws \think\exception\DbException
  468. */
  469. public function add_course($live_id = 0){
  470. $where = parent::getMore([
  471. ['nickname', ''],
  472. ['status', ''],
  473. ['is_promoter', ''],
  474. ], $this->request);
  475. $this->assign('where', $where);
  476. $this->assign(User::systemPage($where));
  477. $this->assign('live_id', $live_id);
  478. return $this->fetch();
  479. }
  480. /**
  481. * 添加嘉宾
  482. * @param int $live_id
  483. */
  484. public function save_guest($uid=0,$live_id = 0,$type=0)
  485. {
  486. if (!$live_id) return Json::fail('缺少直播间id');
  487. if (!$uid) return Json::fail('请选择用户');
  488. if ($type === '') return Json::fail('请选择类型');
  489. if ($type && LiveHonouredGuest::be(['live_id' => $live_id, 'type' => 1])) return Json::fail('讲师只能添加一个');
  490. $data['uid'] = $uid;
  491. $data['type'] = $type;
  492. $data['live_id'] = $live_id;
  493. $data['nickname'] = User::where('uid', $uid)->value('nickname');
  494. $data['add_time'] = time();
  495. if (LiveHonouredGuest::set($data))
  496. return Json::successful('添加成功');
  497. else
  498. return Json::fail('添加失败');
  499. }
  500. /**
  501. * 获取嘉宾列表
  502. */
  503. public function get_guest_list()
  504. {
  505. $where = parent::getMore([
  506. ['live_id', 0],
  507. ['nickname', ''],
  508. ['page', 1],
  509. ['limit', 20],
  510. ]);
  511. return Json::successlayui(LiveHonouredGuest::getGuestList($where));
  512. }
  513. /**
  514. * 删除嘉宾
  515. * @param int $id
  516. */
  517. public function del_guest($id = 0)
  518. {
  519. if (!$id) return Json::fail('缺少参数');
  520. if (LiveHonouredGuest::del($id))
  521. return Json::successful('删除成功');
  522. else
  523. return Json::fail('删除失败');
  524. }
  525. /**
  526. * 回放设置和下载列表
  527. * @param int $special_id
  528. * @return mixed|void
  529. * @throws \think\db\exception\DataNotFoundException
  530. * @throws \think\db\exception\ModelNotFoundException
  531. * @throws \think\exception\DbException
  532. */
  533. public function download_list($special_id = 0)
  534. {
  535. if (!$special_id) return $this->failed('缺少参数');
  536. $specialInfo = SpecialModel::get($special_id);
  537. if (!$specialInfo) return $this->failed('查找的专题不存在');
  538. if ($specialInfo->is_del) return $this->failed('专题已经删除');
  539. $liveInfo = LiveStudio::where(['special_id' => $special_id])->find();
  540. if (!$liveInfo) return $this->failed('直播不存在!');
  541. $livePlayBack = LivePlayback::where(['stream_name' => $liveInfo->stream_name, 'is_record' => 1])->find();
  542. $this->assign([
  543. 'stream_name' => $liveInfo->stream_name,
  544. 'record_id' => $livePlayBack ? $livePlayBack->RecordId : 0,
  545. 'is_playback' => 1
  546. ]);
  547. return $this->fetch();
  548. }
  549. /**
  550. * 获取直播间下的录制内容
  551. * @param string $record_id
  552. * @param string $stream_name
  553. * @param string $start_time
  554. * @param string $end_time
  555. * @param int $page
  556. * @param int $limit
  557. */
  558. public function get_live_record()
  559. {
  560. $start_time = $this->request->param('syn_start_time');
  561. $end_time = $this->request->param('syn_end_time');
  562. $stream_name = $this->request->param('stream_name');
  563. $record_id = $this->request->param('record_id');
  564. if (!$stream_name) return Json::fail('缺少直播间id');
  565. $aliyunLive = $this->aliyunLive;
  566. $beginToday = mktime(0, 0, 0, date('m'), date('d') - 3, date('Y'));
  567. if ($start_time && $end_time) {
  568. $start_time = strtotime($start_time);
  569. $end_time = strtotime($end_time);
  570. if ($start_time > $end_time) return Json::fail('开始时间不能大于结束时间');
  571. $time = bcsub($end_time, $start_time, 0) / 86400;
  572. if ($time > 4) return Json::fail('开始和结束的时间不能间隔4天');
  573. }
  574. try{
  575. $res = $aliyunLive->queryLiveRecordFiles(
  576. $stream_name,
  577. $start_time ? ApiAliyunLive::setTimeFormat($start_time) : ApiAliyunLive::setTimeFormat($beginToday),
  578. $end_time ? ApiAliyunLive::setTimeFormat($end_time) : ApiAliyunLive::setTimeFormat(time()),
  579. 1,
  580. 10
  581. );
  582. $data = [];
  583. $count = 0;
  584. if ($res) {
  585. if (isset($res['RecordIndexInfoList']['RecordIndexInfo'])) {
  586. foreach ($res['RecordIndexInfoList']['RecordIndexInfo'] as $item) {
  587. LivePlayback::livePlaybackAdd($item);
  588. $data [] = [
  589. 'StreamName' => $item['StreamName'],
  590. 'RecordId' => $item['RecordId'],
  591. 'playback_record_id' => $record_id,
  592. 'RecordUrl' => $item['RecordUrl'],
  593. 'StartTime' => $item['StartTime'],
  594. 'EndTime' => $item['EndTime'],
  595. ];
  596. }
  597. }
  598. if (isset($res['TotalNum'])) $count = $res['TotalNum'];
  599. return Json::successlayui($count, $data);
  600. } else {
  601. return Json::fail('未拉取到直播回放');
  602. }
  603. }catch (Exception $exception){
  604. return Json::fail($exception->getMessage());
  605. }
  606. }
  607. /**回放列表
  608. * @param string $stream_name
  609. * @param string $start_time
  610. * @param string $end_time
  611. * @param int $page
  612. * @param int $limit
  613. */
  614. public function get_live_record_list()
  615. {
  616. $where = parent::getMore([
  617. ['page', 1],
  618. ['limit', 20],
  619. ['stream_name', ''],
  620. ['start_time', ''],
  621. ['end_time', ''],
  622. ]);
  623. $data=LivePlayback::getLivePlaybackList($where);
  624. return Json::successlayui($data);
  625. }
  626. /**
  627. * 删除直播回放
  628. */
  629. public function delete_live_playback($id=0)
  630. {
  631. $res=LivePlayback::where('id',$id)->update(['is_del'=>1]);
  632. if($res){
  633. return Json::successful('删除成功');
  634. }else{
  635. return Json::fail('删除失败');
  636. }
  637. }
  638. /**设置显示
  639. * @param string $is_show
  640. * @param string $id
  641. */
  642. public function set_show($is_show = '', $id = '')
  643. {
  644. ($is_show == '' || $id == '') && Json::fail('缺少参数');
  645. $res = LivePlayback::where(['id' => $id])->update(['is_show' => (int)$is_show]);
  646. if ($res) {
  647. return Json::successful($is_show == 1 ? '显示成功' : '隐藏成功');
  648. } else {
  649. return Json::fail($is_show == 1 ? '显示失败' : '隐藏失败');
  650. }
  651. }
  652. /**
  653. * 设置某个字段
  654. * @param int $stream_name
  655. * @param string $field
  656. * @param string $value
  657. */
  658. public function set_playback_value($field = '',$id=0, $value = '')
  659. {
  660. if (!$id || !$field) return Json::fail('缺少参数');
  661. $res = LivePlayback::where(['id' => $id])->update([$field => $value]);
  662. if ($res)
  663. return Json::successful('编辑成功');
  664. else
  665. return Json::fail('编辑失败');
  666. }
  667. /**
  668. * 设置某个字段
  669. * @param int $stream_name
  670. * @param string $field
  671. * @param string $value
  672. */
  673. public function set_value($stream_name = 0, $field = '', $value = '')
  674. {
  675. if (!$stream_name || !$field) return Json::fail('缺少参数');
  676. $res = LiveStudio::where('stream_name', $stream_name)->update([$field => $value]);
  677. if ($res)
  678. return Json::successful('设置成功');
  679. else
  680. return Json::fail('设置失败');
  681. }
  682. public function set_record($stream_name = 0, $record_id = 0, $field = '', $value = '')
  683. {
  684. if (!$stream_name || !$record_id || !$field) return Json::fail('缺少参数');
  685. $res = LivePlayback::where(['stream_name' => $stream_name, 'RecordId' => $record_id])->update([$field => $value]);
  686. if ($value == 1) {
  687. LiveStudio::where(['stream_name' => $stream_name])->update(['playback_record_id' => $record_id, 'is_playback' => 1]);
  688. LivePlayback::where(['stream_name' => $stream_name])->where( 'RecordId',"neq",$record_id)->update([$field => 0]);
  689. }else{
  690. LiveStudio::where(['stream_name' => $stream_name])->update(['playback_record_id' => "", 'is_playback' => 0]);
  691. }
  692. if ($res)
  693. return Json::successful('设置成功');
  694. else
  695. return Json::fail('设置失败');
  696. }
  697. /**
  698. * 直播回放
  699. * @param string $record_url
  700. * @return mixed|void
  701. */
  702. public function live_record_look($record_url = '')
  703. {
  704. if (!$record_url) return $this->failed('缺少回放地址');
  705. $this->assign('record_url', $record_url);
  706. return $this->fetch();
  707. }
  708. /**
  709. * 下载引导页面
  710. * @param string $record_url
  711. * @return mixed|void
  712. */
  713. public function download($record_url = '')
  714. {
  715. if (!$record_url) return $this->failed('缺少回放地址');
  716. $this->assign('record_url', $record_url);
  717. return $this->fetch();
  718. }
  719. /**
  720. * 评论页面
  721. * @param int $special_id
  722. * @return mixed|void
  723. * @throws \think\db\exception\DataNotFoundException
  724. * @throws \think\db\exception\ModelNotFoundException
  725. * @throws \think\exception\DbException
  726. */
  727. public function comment_list($special_id = 0)
  728. {
  729. if (!$special_id) return $this->failed('缺少参数');
  730. $specialInfo = SpecialModel::get($special_id);
  731. if (!$specialInfo) return $this->failed('查找的专题不存在');
  732. if ($specialInfo->is_del) return $this->failed('专题已经删除');
  733. $liveInfo = LiveStudio::where(['special_id' => $special_id])->find();
  734. if (!$liveInfo) return $this->failed('直播不存在!');
  735. if ($liveInfo->is_del) return $this->failed('直播间已删除!');
  736. $this->assign('live_id', $liveInfo->id);
  737. return $this->fetch();
  738. }
  739. /**
  740. * 获取直播评论列表
  741. */
  742. public function get_live_comment_list()
  743. {
  744. $where = parent::getMore([
  745. ['live_id', 0],
  746. ['page', 1],
  747. ['limit', 20],
  748. ['nickname', ''],
  749. ['start_time', ''],
  750. ['end_time', ''],
  751. ]);
  752. if (!$where['live_id']) return Json::fail('缺少直播间id');
  753. return Json::successlayui(LiveBarrage::getLiveCommentList($where));
  754. }
  755. /**
  756. * 设置评论隐藏显示
  757. *
  758. * @return json
  759. */
  760. public function set_show_comment($is_show = '', $id = '')
  761. {
  762. ($is_show == '' || $id == '') && Json::fail('缺少参数');
  763. $res = LiveBarrage::where(['id' => $id])->update(['is_show' => (int)$is_show]);
  764. if ($res) {
  765. return Json::successful('设置成功');
  766. } else {
  767. return Json::fail('设置失败');
  768. }
  769. }
  770. /**
  771. * 任务关联列表
  772. * @param int $special_id
  773. * @return mixed|void
  774. * @throws \think\db\exception\DataNotFoundException
  775. * @throws \think\db\exception\ModelNotFoundException
  776. * @throws \think\exception\DbException
  777. */
  778. public function relation_task($special_id = 0)
  779. {
  780. $specialInfo = SpecialModel::get($special_id);
  781. if (!$specialInfo) return $this->failed('专题不存在');
  782. $liveInfo = LiveStudio::where('special_id', $special_id)->find();
  783. if (!$liveInfo) return $this->failed('直播间不存在');
  784. if ($liveInfo->is_del) return $this->failed('直播间已删除!');
  785. $this->assign('live_id', $liveInfo->id);
  786. return $this->fetch();
  787. }
  788. /**
  789. * 任务关联列表展示
  790. * @throws Exception
  791. * @throws \think\db\exception\DataNotFoundException
  792. * @throws \think\db\exception\ModelNotFoundException
  793. * @throws \think\exception\DbException
  794. */
  795. public function get_relation_task()
  796. {
  797. $where = parent::getMore([
  798. ['live_id', 0],
  799. ['title', ''],
  800. ['start_time', ''],
  801. ['end_time', ''],
  802. ['page', 1],
  803. ['limit', 20],
  804. ]);
  805. if (!$where['live_id']) return Json::fail('缺少参数');
  806. return Json::successlayui(SpecialTask::getRelationTask($where));
  807. }
  808. /**
  809. * 保存直播任务关联
  810. * @param int $live_id
  811. * @param int $special_id
  812. * @return mixed|void
  813. * @throws \think\db\exception\DataNotFoundException
  814. * @throws \think\db\exception\ModelNotFoundException
  815. * @throws \think\exception\DbException
  816. */
  817. public function save_task($live_id = 0, $special_id = 0)
  818. {
  819. if (!$live_id) return $this->failed('缺少参数');
  820. $liveInfo = LiveStudio::get($live_id);
  821. if (!$liveInfo) return $this->failed('直播间不存在');
  822. if ($special_id) {
  823. $list = SpecialCourse::where('is_show', 1)->where('special_id', $special_id)->field(['id', 'course_name'])->select();
  824. $opens = [];
  825. foreach ($list as $item) {
  826. $opens [] = ['value' => $item['id'], 'label' => $item['course_name']];
  827. }
  828. $f[] = Form::input('special_id', '专题id', $special_id)->disabled(true);
  829. $f[] = Form::input('title', '任务标题', $liveInfo->getData('live_title'));
  830. $f[] = Form::frameImageOne('image', '任务封面图', Url::build('admin/widget.images/index', array('fodder' => 'image')), $liveInfo->getData('live_image'))->icon('image')->width('100%')->height('550px');
  831. $f[] = Form::number('sort', '排序', 0);
  832. $form = Form::make_post_form('关联任务', $f, Url::build('set_task', array('live_id' => $live_id)), 3);
  833. $this->assign(compact('form'));
  834. return $this->fetch('public/form-builder');
  835. } else {
  836. $this->assign('grade_list', Grade::where(['is_del'=>0,'is_show'=>1])->order('sort desc')->field(['id', 'name'])->select()->toArray());
  837. $this->assign('live_id', $live_id);
  838. return $this->fetch();
  839. }
  840. }
  841. /**
  842. * @param int $grade_id
  843. * @throws \think\db\exception\DataNotFoundException
  844. * @throws \think\db\exception\ModelNotFoundException
  845. * @throws \think\exception\DbException
  846. */
  847. public function get_subject_list($grade_id = 0)
  848. {
  849. if (!$grade_id) return Json::fail('缺少参数');
  850. $subjectlist = SpecialSubject::where(['grade_id' => $grade_id, 'is_show' => 1, 'is_del' => 0])->order('sort desc')->select();
  851. return Json::successful($subjectlist);
  852. }
  853. /**
  854. * @param int $subject_id
  855. * @throws \think\db\exception\DataNotFoundException
  856. * @throws \think\db\exception\ModelNotFoundException
  857. * @throws \think\exception\DbException
  858. */
  859. public function get_special_list($subject_id = false, $live_goods_list = false)
  860. {
  861. $where['is_show'] = 1;
  862. $where['is_del'] = 0;
  863. if ($subject_id) $where['subject_id'] = $subject_id;
  864. if (!$live_goods_list) {
  865. $dataList = $specialList = Special::where($where)->order('sort desc')->select();
  866. }else{
  867. $dataList = array();
  868. $specialList = Special::where($where)->whereIn('type',[1,2,3,5])->order('type desc')->select();
  869. foreach($specialList as $k => $v) {
  870. $dataList[$k]['value'] = $v['id'];
  871. $dataList[$k]['title'] = SPECIAL_TYPE[$v['type']]."--".$v['title'];
  872. }
  873. }
  874. return Json::successful($dataList);
  875. }
  876. public function move_live_admin() {
  877. $parm = parent::getMore([
  878. 'special_id',
  879. 'admin_id'
  880. ]);
  881. if (!$parm['special_id'] || !$parm['admin_id']) {
  882. Json::fail('缺少参数');
  883. }
  884. $special_info = Special::get(['id' => $parm['special_id']]);
  885. if (!$special_info) Json::fail('直播间不存在');
  886. if ($special_info['admin_id'] == $parm['admin_id']) return Json::successful('转移成功');
  887. $special_info->save(['admin_id' => $parm['admin_id']]);
  888. return Json::successful('转移成功');
  889. }
  890. /**
  891. * 新增直播任务
  892. * @param int $live_id
  893. */
  894. public function set_task($live_id = 0)
  895. {
  896. if (!$live_id) return Json::fail('缺少直播id');
  897. $data = parent::postMore([
  898. ['coures_id', ''],
  899. ['title', ''],
  900. ['image', ''],
  901. ['sort', 0],
  902. ['is_show', 1],
  903. ['special_id',0]
  904. ]);
  905. if (!$data['special_id']) return Json::fail('关联专题Id缺失');
  906. if (!$data['title']) return Json::fail('请输入任务标题!');
  907. if (!$data['image']) return Json::fail('请上传图片');
  908. $data['add_time'] = time();
  909. $data['live_id'] = $live_id;
  910. $special_id = LiveStudio::where('id', $live_id)->value('special_id');
  911. $data['is_pay'] = SpecialModel::where(['type' => SPECIAL_LIVE, 'id' => $special_id])->value('pay_type');
  912. if (SpecialTask::set($data))
  913. return Json::successful('保存成功');
  914. else
  915. return Json::fail('保存失败');
  916. }
  917. /**直播推荐(课程)
  918. * @return mixed
  919. */
  920. public function live_goods()
  921. {
  922. $live_id = $this->request->get('live_id',0);
  923. $this->assign('live_id', $live_id);
  924. return $this->fetch();
  925. }
  926. /**直播推荐列表数据
  927. * @return mixed
  928. */
  929. public function live_goods_list($live_id = false)
  930. {
  931. $where = parent::getMore([
  932. ['page', 1],
  933. ['live_id', 0],
  934. ['store_name', ""],
  935. ['limit', 20],
  936. ['order', ''],
  937. ['is_show', ''],
  938. ]);
  939. if ($live_id) $where['live_id'] = $live_id;
  940. return Json::successlayui(LiveGoods::getLiveGoodsList($where));
  941. }
  942. /**直播推荐(商品)
  943. * @return mixed
  944. */
  945. public function live_store()
  946. {
  947. $live_id = $this->request->get('live_id',0);
  948. $this->assign('live_id', $live_id);
  949. return $this->fetch();
  950. }
  951. /**直播推荐列表数据
  952. * @return mixed
  953. */
  954. public function live_store_list($live_id = false)
  955. {
  956. $where = parent::getMore([
  957. ['page', 1],
  958. ['live_id', 0],
  959. ['store_name', ""],
  960. ['limit', 20],
  961. ['order', ''],
  962. ['is_show', ''],
  963. ]);
  964. if ($live_id) $where['live_id'] = $live_id;
  965. return Json::successlayui(LiveGoods::getLiveStoreProductList($where));
  966. }
  967. /**直播打赏
  968. * @return mixed
  969. */
  970. public function live_reward()
  971. {
  972. $gold_info = SystemConfigService::more(['gold_name','gold_image']);
  973. $role_sign = get_login_role();
  974. $where['l.is_del'] = 0;
  975. if (isset($role_sign['role_sign']) && $role_sign['role_sign'] == "anchor") {
  976. $admin_id = get_login_id()['admin_id'];
  977. $where['s.admin_id'] = $admin_id;
  978. }
  979. $live_studio = LiveStudio::alias('l')->where($where)->join('__SPECIAL__ s','l.special_id = s.id')->field('l.id,l.live_title')->select();
  980. $live_studio = $live_studio ? $live_studio->toArray() : [];
  981. $this->assign("year",getMonth('y'));
  982. $this->assign("live_studio",json_encode($live_studio));
  983. $this->assign("gold_info",$gold_info);
  984. return $this->fetch();
  985. }
  986. /**礼物管理
  987. * @return mixed
  988. */
  989. public function live_gift()
  990. {
  991. $list=LiveGift::liveGiftList();
  992. $this->assign("list",$list);
  993. return $this->fetch();
  994. }
  995. /**添加礼物
  996. * @return mixed
  997. * @throws \FormBuilder\exception\FormBuilderException
  998. * @throws \think\exception\DbException
  999. */
  1000. public function create($id=0)
  1001. {
  1002. if ($id) $gift = LiveGift::get($id);
  1003. $form = Form::create(Url::build('save',['id'=>$id]), [
  1004. Form::input('live_gift_name', '礼物名称', isset($gift) ? $gift->live_gift_name : ''),
  1005. Form::number('live_gift_price', '礼物价格(虚拟货币)', isset($gift) ? $gift->live_gift_price : ''),
  1006. Form::checkbox('live_gift_num', '赠送数量列表', isset($gift) ? json_decode($gift->live_gift_num) : [])->options([
  1007. ['label' => '1', 'value' => 1],
  1008. ['label' => '5', 'value' => 5],
  1009. ['label' => '10', 'value' => 10],
  1010. ['label' => '20', 'value' => 20],
  1011. ['label' => '66', 'value' => 66],
  1012. ['label' => '99', 'value' => 99],
  1013. ['label' => '520', 'value' => 520],
  1014. ['label' => '999', 'value' => 999],
  1015. ['label' => '1314', 'value' => 1314]
  1016. ]),
  1017. Form::frameImageOne('live_gift_show_img', '图标(100*100px)', Url::build('admin/widget.images/index', array('fodder' => 'live_gift_show_img')), isset($gift) ? $gift->live_gift_show_img : '')->icon('image')->width('70%')->height('500px'),
  1018. Form::number('sort', '排序', isset($gift) ? $gift->sort : 0),
  1019. Form::radio('is_show', '状态',isset($gift) ? $gift->is_show : 1)->options([['label' => '显示', 'value' => 1], ['label' => '隐藏', 'value' => 0]])
  1020. ]);
  1021. $form->setMethod('post')->setTitle($id ? '修改礼物':'添加礼物')->setSuccessScript('parent.layer.close(parent.layer.getFrameIndex(window.name));parent.$(".J_iframe:visible")[0].contentWindow.location.reload()');
  1022. $this->assign(compact('form'));
  1023. return $this->fetch('public/form-builder');
  1024. }
  1025. /**
  1026. * 保存数据
  1027. */
  1028. public function save($id)
  1029. {
  1030. $post = parent::postMore([
  1031. ['live_gift_name', ''],
  1032. ['live_gift_price', 0],
  1033. ['live_gift_num', []],
  1034. ['live_gift_show_img', ''],
  1035. ['is_show', 1],
  1036. ['sort', 0],
  1037. ]);
  1038. if (!$post['live_gift_name']) return Json::fail('请输入礼物名称');
  1039. if (bcsub($post['live_gift_price'],0,0)<=0) return Json::fail('请输入礼物价格');
  1040. if (count($post['live_gift_num'])<1) return Json::fail('请选择赠送数量列表');
  1041. if (!$post['live_gift_show_img']) return Json::fail('请选择礼物图标');
  1042. $post['live_gift_num']=json_encode($post['live_gift_num']);
  1043. $post['add_time']=time();
  1044. if(!$id){
  1045. $res=LiveGift::set($post);
  1046. if ($res) {
  1047. return Json::successful('添加成功');
  1048. }else {
  1049. return Json::fail('添加失败');
  1050. }
  1051. }else{
  1052. $res=LiveGift::edit($post,$id);
  1053. if ($res) {
  1054. return Json::successful('修改成功');
  1055. }else {
  1056. return Json::fail('修改失败');
  1057. }
  1058. }
  1059. }
  1060. /**礼物是否显示快捷操作
  1061. * @param string $is_show
  1062. * @param string $id
  1063. * @return mixed
  1064. */
  1065. public function set_gift_show($is_show = '', $id = '')
  1066. {
  1067. ($is_show == '' || $id == '') && Json::fail('缺少参数');
  1068. $res = LiveGift::where(['id' => $id])->update(['is_show' => (int)$is_show]);
  1069. if ($res) {
  1070. return Json::successful($is_show == 1 ? '显示成功' : '隐藏成功');
  1071. } else {
  1072. return Json::fail($is_show == 1 ? '显示失败' : '隐藏失败');
  1073. }
  1074. }
  1075. /**
  1076. * 直播礼物列表
  1077. */
  1078. public function live_gift_list()
  1079. {
  1080. return Json::successlayui(LiveGift::liveGiftList());
  1081. }
  1082. /**直播礼物
  1083. * @throws \think\db\exception\DataNotFoundException
  1084. * @throws \think\db\exception\ModelNotFoundException
  1085. * @throws \think\exception\DbException
  1086. */
  1087. public function liveGiftList()
  1088. {
  1089. $data=LiveGift::order('sort ASC')->select();
  1090. return Json::successful($data);
  1091. }
  1092. /**直播推荐列表数据
  1093. * @return mixed
  1094. */
  1095. public function live_reward_list()
  1096. {
  1097. $where = parent::getMore([
  1098. ['page', 1],
  1099. ['user_info', ""],
  1100. ['limit', 20],
  1101. ['order', ''],
  1102. ['live_id', 0],
  1103. ['gift_id', 0],
  1104. ['date', 0],
  1105. ]);
  1106. //根据账号身份获取各自的列表数据
  1107. $role_sign = get_login_role();
  1108. if (isset($role_sign['role_sign']) && $role_sign['role_sign'] == "anchor") {
  1109. $where['admin_id'] = get_login_id()['admin_id'];
  1110. }
  1111. return Json::successlayui(LiveReward::getLiveRewardList($where));
  1112. }
  1113. /**
  1114. * 获取头部订单金额等信息
  1115. * return json
  1116. *
  1117. */
  1118. public function getBadge()
  1119. {
  1120. $where = parent::postMore([
  1121. ['page', 1],
  1122. ['user_info', ""],
  1123. ['limit', 20],
  1124. ['order', ''],
  1125. ['live_id', 0],
  1126. ['gift_id', 0],
  1127. ['date', 0],
  1128. ]);
  1129. return Json::successful(LiveReward::getBadge($where));
  1130. }
  1131. }