LiveService.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535
  1. <?php
  2. // +----------------------------------------------------------------------
  3. // | LARAVEL8.0 框架 [ LARAVEL ][ RXThinkCMF ]
  4. // +----------------------------------------------------------------------
  5. // | 版权所有 2017~2021 LARAVEL研发中心
  6. // +----------------------------------------------------------------------
  7. // | 官方网站: http://www.laravel.cn
  8. // +----------------------------------------------------------------------
  9. // | Author: laravel开发员 <laravel.qq.com>
  10. // +----------------------------------------------------------------------
  11. namespace App\Services;
  12. use AlibabaCloud\Tea\Exception\TeaUnableRetryError;
  13. use AlibabaCloud\SDK\Dysmsapi\V20170525\Dysmsapi;
  14. use App\Models\LiveModel;
  15. use App\Models\MemberModel;
  16. use App\Models\VideoCollectModel;
  17. use App\Services\Api\MemberCollectService;
  18. use App\Services\Api\VideoCollectService;
  19. use Darabonba\OpenApi\Models\Config;
  20. use AlibabaCloud\SDK\Dysmsapi\V20170525\Models\SendSmsRequest;
  21. use AlibabaCloud\Tea\Utils\Utils\RuntimeOptions;
  22. use Illuminate\Support\Facades\DB;
  23. /**
  24. * 在线直播服务管理-服务类
  25. * @author laravel开发员
  26. * @since 2020/11/11
  27. * Class LiveService
  28. * @package App\Services
  29. */
  30. class LiveService extends BaseService
  31. {
  32. // 静态对象
  33. protected static $instance = null;
  34. /**
  35. * 构造函数
  36. * @author laravel开发员
  37. * @since 2020/11/11
  38. * ConfigService constructor.
  39. */
  40. public function __construct()
  41. {
  42. $this->model = new LiveModel();
  43. }
  44. /**
  45. * 静态入口
  46. * @return SmsService|static|null
  47. */
  48. public static function make()
  49. {
  50. if (!self::$instance) {
  51. self::$instance = new static();
  52. }
  53. return self::$instance;
  54. }
  55. /**
  56. * 列表数据
  57. * @param $params
  58. * @param int $pageSize
  59. * @return array
  60. */
  61. public function getDataList($params, $pageSize = 18, $field = '', $userId=0)
  62. {
  63. $where = ['a.mark' => 1,'a.status'=>1,'b.mark'=>1];
  64. $field = $field? $field : 'lev_a.*';
  65. $order = 'rand()';
  66. $model = $this->model->with(['member'])->from('live as a')
  67. ->leftJoin('member as b', 'b.id', '=', 'a.user_id')
  68. ->where($where)
  69. ->where(function ($query) use ($params) {
  70. $type = isset($params['type']) ? $params['type'] : 0;
  71. if ($type > 0) {
  72. $query->where('a.type', $type);
  73. }
  74. $categoryId = isset($params['category_id']) ? $params['category_id'] : 0;
  75. if ($categoryId > 0) {
  76. $query->where('a.category_id', $categoryId);
  77. }
  78. $uid = isset($params['user_id']) ? $params['user_id'] : 0;
  79. if ($uid > 0) {
  80. $query->where('a.user_id', $uid);
  81. }
  82. })
  83. ->where(function ($query) use ($params) {
  84. $keyword = isset($params['kw']) ? $params['kw'] : '';
  85. if ($keyword) {
  86. $query->where('a.title', 'like', "%{$keyword}%")
  87. ->orWhere('a.description', 'like', "%{$keyword}%")
  88. ->orWhere('b.nickname', 'like', "%{$keyword}%");
  89. }
  90. })->where(function ($query) use ($userId) {
  91. if ($userId) {
  92. $query->where('a.visible_users', '=', '')
  93. ->orWhere('a.visible_users', 'like',"%{$userId},%")
  94. ->orWhere('a.manage_users', 'like',"%{$userId},%");
  95. }
  96. });
  97. // 推荐的数据
  98. $countModel = clone $model;
  99. $total = $countModel->where(function($query) use($params, $userId){
  100. // 推荐视频数据
  101. $isRecommend = isset($params['is_recommend']) ? $params['is_recommend'] : 0;
  102. if ($isRecommend > 0) {
  103. $recommendData = VideoCollectService::make()->getRecommendData($userId);
  104. $uids = isset($recommendData['uids'])? $recommendData['uids'] : []; // 按用户推荐
  105. $category = isset($recommendData['category'])? $recommendData['category'] : []; // 按标签推荐
  106. if($uids){
  107. $query->orWhere(function($query) use($uids){
  108. $query->whereIn('a.user_id', $uids);
  109. });
  110. }
  111. if($category){
  112. $query->orWhere(function($query) use($category){
  113. $query->whereIn('a.category_id', $category);
  114. });
  115. }
  116. }
  117. })->count('a.id');
  118. if($total > 0){
  119. // 关联推荐数据
  120. $list = $countModel->selectRaw($field)
  121. ->orderByRaw($order)
  122. ->paginate($pageSize > 0 ? $pageSize : 9999999);
  123. }else{
  124. // 默认推荐数据
  125. $list = $model->selectRaw($field)
  126. ->orderByRaw($order)
  127. ->paginate($pageSize > 0 ? $pageSize : 9999999);
  128. }
  129. $list = $list ? $list->toArray() : [];
  130. if ($list && $list['data']) {
  131. foreach ($list['data'] as &$item) {
  132. $item['time_text'] = isset($item['create_time']) ? dateFormat($item['create_time'], 'Y-m-d H:i') : '';
  133. $member = isset($item['member'])? $item['member'] : [];
  134. if($member){
  135. $member['avatar'] = isset($member['avatar']) && $member['avatar']? get_image_url($member['avatar']) : get_image_url('/images/member/logo.png');
  136. }
  137. $item['like_num'] = isset($item['like_num']) && $item['like_num']? intval($item['like_num']) : 0;
  138. $item['views'] = isset($item['views']) && $item['views']? intval($item['views']) : 0;
  139. $item['member'] = $member;
  140. }
  141. }
  142. return [
  143. 'pageSize' => $pageSize,
  144. 'total' => isset($list['total']) ? $list['total'] : 0,
  145. 'list' => isset($list['data']) ? $list['data'] : []
  146. ];
  147. }
  148. /**
  149. * 详情
  150. * @param $id
  151. * @param $userId
  152. * @return \Illuminate\Database\Eloquent\Builder|\Illuminate\Database\Eloquent\Model|object|null
  153. */
  154. public function getInfo($id, $userId)
  155. {
  156. $info = $this->model->with(['member'])->where(['id'=> $id,'mark'=>1])->first();
  157. if($info && isset($info['member'])){
  158. if(isset($info['member']['avatar'])){
  159. $info['member']['avatar'] = $info['member']['avatar']? $info['member']['avatar'] : '/images/member/logo.png';
  160. $info['member']['avatar'] = get_image_url($info['member']['avatar']);
  161. }
  162. if($info['user_id'] == $userId){
  163. $info['is_follow'] = 1;
  164. }else{
  165. $checkFollow = MemberCollectService::make()->checkCollect($userId, $info['user_id'], 1);
  166. $info['is_follow'] = $checkFollow? 1 : 0;
  167. }
  168. // 观看权限
  169. $info['view_limit'] = 0;
  170. // 浏览历史
  171. if(!VideoCollectService::make()->getCollectCacheInfo($userId, $id, 1, 2)){
  172. $data = [
  173. 'user_id'=> $userId,
  174. 'type'=> 1,
  175. 'source_type'=> 2,
  176. 'collect_id'=> $id,
  177. 'collect_uid'=> isset($info['user_id'])? $info['user_id'] : 0,
  178. 'tags'=> isset($info['tags'])? $info['tags'] : '',
  179. 'create_time'=> time(),
  180. 'status'=> 1,
  181. ];
  182. VideoCollectModel::insert($data);
  183. RedisService::clear("caches:videos:recommend:{$userId}_2");
  184. RedisService::clear("caches:member:fans:{$userId}_{$id}_2");
  185. RedisService::clear("caches:live:users_{$id}_{$userId}");
  186. }
  187. // 更新播放量
  188. if(!RedisService::get("caches:live:player:{$userId}_{$id}")){
  189. $this->model->where(['id'=> $id])->update(['views'=>DB::raw('views + 1'),'update_time'=>time()]);
  190. RedisService::set("caches:live:player:{$userId}_{$id}", ['user_id'=> $userId,'id'=>$id], rand(600, 1800));
  191. $info['views'] += 1;
  192. }
  193. // 结束直播
  194. /*if($info['create_time'] <= time() - 2 * 86400 && $info['status'] == 1){
  195. $this->model->where(['id'=> $id])->update(['status'=>2,'update_time'=>time()]);
  196. $info['status'] = 2;
  197. }*/
  198. }
  199. return $info;
  200. }
  201. /**
  202. * 获取直播间在线观众数据
  203. * @param $params
  204. * @param $pageSize
  205. * @param int $userId
  206. * @return array|mixed
  207. */
  208. public function getUserList($params, $pageSize=200, $userId=0)
  209. {
  210. $liveId = isset($params['live_id'])? $params['live_id'] : 0;
  211. $cachekey = "caches:live:users_{$liveId}_{$userId}";
  212. $datas = RedisService::get($cachekey);
  213. if($datas || RedisService::exists($cachekey)){
  214. return $datas? $datas : [
  215. 'current' => ['user_id'=> $userId,'rank'=>0,'reward_total'=>0],
  216. 'rank_limit'=> 200,
  217. 'total' => 0,
  218. 'list' => []
  219. ];
  220. }
  221. $rankNum = ConfigService::make()->getConfigByCode('live_show_rank', 200);
  222. $rankNum = $rankNum>20 && $rankNum <= 300? $rankNum : 200;
  223. $model = MemberModel::from('member as a')
  224. ->leftJoin('video_collect as b',function($join) use($liveId){
  225. $join->on('a.id','=','b.user_id')
  226. ->where(['b.type'=>1,'b.collect_id'=> $liveId,'b.source_type'=>2,'b.status'=>1,'b.mark'=>1]);
  227. })
  228. ->where(['a.status'=>1,'a.mark'=>1])
  229. ->where('b.id','>', 0)
  230. ->select(['a.id','a.nickname','a.avatar','a.member_level','a.gender','a.intro','a.status','b.create_time','b.reward_total','b.collect_id as live_id']);
  231. $countModel = clone $model;
  232. $total = $countModel->groupBy('a.id')->count('a.id');
  233. $datas = $model->groupBy('a.id')
  234. ->orderBy('b.reward_total','desc')
  235. ->orderBy('b.create_time','asc')
  236. ->limit($rankNum)->get();
  237. $datas = $datas? $datas->toArray() : [];
  238. $rankData = ['user_id'=> $userId,'rank'=>0,'reward_total'=>0];
  239. if ($datas) {
  240. foreach ($datas as $k=> &$item) {
  241. $item['time_text'] = isset($item['create_time']) ? dateFormat($item['create_time'], 'Y-m-d H:i') : '';
  242. $item['avatar'] = isset($item['avatar']) && $item['avatar']? get_image_url($item['avatar']) : get_image_url('/images/member/logo.png');
  243. $item['reward_total'] = isset($item['reward_total']) && $item['reward_total']? format_num(intval($item['reward_total'])) : 0;
  244. if($item['id'] == $userId){
  245. $rankData['rank'] = ($k+1)>$rankNum? 0 : ($k+1);
  246. $rankData['reward_total'] = $item['reward_total']? format_num(intval($item['reward_total'])) : 0;
  247. }
  248. }
  249. // 用户排名在200名外的数据
  250. if($rankData['rank'] <= 0 && $rankData['reward_total']<=0 && count($datas) > $rankNum){
  251. $rewardTotal = VideoCollectModel::where(['user_id'=> $userId,'type'=>1,'collect_id'=> $liveId,'source_type'=>2,'status'=>1,'mark'=>1])
  252. ->value('reward_total');
  253. $rankData['reward_total'] = $rewardTotal? format_num(intval($rewardTotal)) : 0;
  254. }
  255. $totalText = $total>=10000 && $total<=100000? intval($total/10000).'万' : intval($total);
  256. RedisService::set($cachekey, ['current' => $rankData,'rank_limit'=> $rankNum,'total'=> $total,'total_text'=>$totalText,'list'=> $datas], rand(3,5));
  257. }
  258. return [
  259. 'current' => $rankData,
  260. 'rank_limit'=> $rankNum,
  261. 'total' => $total,
  262. 'total_text' => $total>=10000 && $total<=100000? intval($total/10000).'万' : intval($total),
  263. 'list' => $datas
  264. ];
  265. }
  266. /**
  267. * 更新播放浏览历史
  268. * @param $userId 用户ID
  269. * @param $id 视频ID
  270. * @return false
  271. */
  272. public function updatePlay($userId, $id)
  273. {
  274. // 浏览历史
  275. if(!VideoCollectService::make()->getCollectCacheInfo($userId, $id, 1,2)){
  276. $info = $this->model->from('live as a')
  277. ->where(['a.id'=> $id,'a.mark'=>1])
  278. ->select(['a.id','a.category','a.user_id'])
  279. ->first();
  280. if(empty($info)){
  281. return false;
  282. }
  283. $data = [
  284. 'user_id'=> $userId,
  285. 'type'=> 1,
  286. 'source_type'=> 2,
  287. 'collect_id'=> $id,
  288. 'category_id'=> isset($info['category'])? $info['category'] : 0,
  289. 'collect_uid'=> isset($info['user_id'])? $info['user_id'] : 0,
  290. 'create_time'=> time(),
  291. 'status'=> 1,
  292. ];
  293. VideoCollectModel::insert($data);
  294. RedisService::set("caches:videos:collect:temp_{$userId}_{$id}_1_2", $data, rand(10,30));
  295. RedisService::clear("caches:videos:recommend:{$userId}_1_2");
  296. RedisService::clear("caches:member:fans:{$userId}_{$id}_2");
  297. RedisService::clear("caches:live:users_{$id}_{$userId}");
  298. }
  299. // 更新播放量
  300. if(!RedisService::get("caches:player:live:{$userId}_{$id}")){
  301. $this->model->where(['id'=> $id])->update(['views'=>DB::raw('views + 1'),'update_time'=>time()]);
  302. RedisService::set("caches:player:live:{$userId}_{$id}", ['user_id'=> $userId,'id'=>$id], rand(6*3600, 86400));
  303. }
  304. $this->error = 1010;
  305. return true;
  306. }
  307. /**
  308. * 缓存数据
  309. * @param $id
  310. * @param int $status
  311. * @return array|mixed
  312. */
  313. public function getCacheInfo($id, $status=0)
  314. {
  315. $cacheKey = "caches:live:info:{$id}_{$status}";
  316. $info = RedisService::get($cacheKey);
  317. if($info){
  318. return $info;
  319. }
  320. $where = ['id' => $id, 'mark' => 1];
  321. if($status){
  322. $where['status'] = $status;
  323. }
  324. $info = $this->model->where($where)
  325. ->select(['id','user_id','create_time','end_time','views','reward_num','reward_total','like_num'])
  326. ->first();
  327. $info = $info? $info->toArray() : [];
  328. if($info){
  329. RedisService::set($cacheKey, $info, rand(3, 5));
  330. }
  331. return $info;
  332. }
  333. /**
  334. * 状态设置
  335. * @return bool
  336. */
  337. public function status()
  338. {
  339. $id = request()->post('id', 0);
  340. $status = request()->post('status', 2);
  341. if ($id && !$info = $this->getCacheInfo($id)) {
  342. $this->error = 2981;
  343. return false;
  344. }
  345. $updateData = ['status'=>$status, 'update_time'=> time()];
  346. if($status == 2){
  347. $updateData['end_time'] = time();
  348. }
  349. if($this->model->where(['id'=> $id,'mark'=>1])->update($updateData)){
  350. $this->error = 1002;
  351. $time = $info['end_time']? intval($info['end_time'] - $info['create_time']) : intval(time() - $info['create_time']);
  352. $info['status'] = $status;
  353. $info['live_hour'] = $time > 3600 ? intval($time/3600) : 0;
  354. $info['live_minute'] = $time%3600? intval($time%3600/60) : 0;
  355. $info['time_text'] = date('H:i', $info['create_time']);
  356. $info['end_time_text'] = date('H:i', $info['end_time']? $info['end_time'] : time());
  357. $info['fans_num'] = MemberCollectService::make()->getViewFansCountByType($info['user_id'], $id, 2);
  358. $info['new_fans'] = MemberCollectService::make()->getNewFansCount($info['user_id'], $id,2, $info['create_time']);
  359. return $info;
  360. }
  361. $this->error = 1003;
  362. return true;
  363. }
  364. /**
  365. * 获取直播推流/拉流地址
  366. * @param $streamName
  367. * @param string $appName
  368. * @param string $playType
  369. * @param int $expireTime
  370. * @return array
  371. */
  372. public function getLiveUrl($streamName, $appName = 'xlapp', $playType = 'rtmp', $expireTime = 1440)
  373. {
  374. $cachekey = "caches:live:urls:{$streamName}_{$appName}_{$playType}";
  375. $datas = RedisService::get($cachekey);
  376. if($datas){
  377. return $datas;
  378. }
  379. $playUrls = [];
  380. //未开启鉴权Key的情况下
  381. $pushDomain = ConfigService::make()->getConfigByCode('live_push_url');
  382. $playDomain = ConfigService::make()->getConfigByCode('live_play_url');
  383. $pushKey = ConfigService::make()->getConfigByCode('push_url_key');
  384. $playKey = ConfigService::make()->getConfigByCode('play_url_key');
  385. $timeStamp = time() + $expireTime * 60;
  386. if ($pushKey == '') {
  387. $pushUrl = 'rtmp://' . $pushDomain . '/' . $appName . '/' . $streamName;
  388. } else {
  389. $sstring = '/' . $appName . '/' . $streamName . '-' . $timeStamp . '-0-0-' . $pushKey;
  390. $md5hash = md5($sstring);
  391. $pushUrl = 'rtmp://' . $pushDomain . '/' . $appName . '/' . $streamName . '?auth_key=' . $timeStamp . '-0-0-' . $md5hash;
  392. }
  393. if ($playKey == '') {
  394. $playUrls['rtmp'] = 'rtmp://' . $playDomain . '/' . $appName . '/' . $streamName;
  395. $playUrls['flv'] = 'http://' . $playDomain . '/' . $appName . '/' . $streamName . '.flv';
  396. $playUrls['hls'] = 'http://' . $playDomain . '/' . $appName . '/' . $streamName . '.m3u8';
  397. } else {
  398. $rtmpSstring = '/' . $appName . '/' . $streamName . '-' . $timeStamp . '-0-0-' . $playKey;
  399. $rtmpMd5hash = md5($rtmpSstring);
  400. $playUrls['rtmp'] = 'rtmp://' . $playDomain . '/' . $appName . '/' . $streamName . '?auth_key=' . $timeStamp . '-0-0-' . $rtmpMd5hash;
  401. $flvSstring = '/' . $appName . '/' . $streamName . '.flv-' . $timeStamp . '-0-0-' . $playKey;
  402. $flvMd5hash = md5($flvSstring);
  403. $playUrls['flv'] = 'http://' . $playDomain . '/' . $appName . '/' . $streamName . '.flv?auth_key=' . $timeStamp . '-0-0-' . $flvMd5hash;
  404. $hlsSstring = '/' . $appName . '/' . $streamName . '.m3u8-' . $timeStamp . '-0-0-' . $playKey;
  405. $hlsMd5hash = md5($hlsSstring);
  406. $playUrls['hls'] = 'http://' . $playDomain . '/' . $appName . '/' . $streamName . '.m3u8?auth_key=' . $timeStamp . '-0-0-' . $hlsMd5hash;
  407. }
  408. $datas = [
  409. 'push_url' => $pushUrl,
  410. 'play_url' => isset($playUrls[$playType]) ? $playUrls[$playType] : '',
  411. 'play_urls' => $playUrls,
  412. ];
  413. RedisService::set($cachekey, $datas, 1800);
  414. return $datas;
  415. }
  416. /**
  417. * 创建直播间
  418. * @param $userId 直逼用户
  419. * @param $params
  420. * @return array|false
  421. */
  422. public function create($userId, $params)
  423. {
  424. $liveLevel = ConfigService::make()->getConfigByCode('live_open_level');
  425. $liveLevel = $liveLevel > 0 ? $liveLevel : 0;
  426. $userInfo = MemberModel::where(['id' => $userId, 'mark' => 1])->select(['id', 'nickname', 'member_level', 'status'])->first();
  427. $status = isset($userInfo['status']) ? $userInfo['status'] : 0;
  428. $nickname = isset($userInfo['nickname']) ? $userInfo['nickname'] : '';
  429. $memberLevel = isset($userInfo['member_level']) ? $userInfo['member_level'] : 0;
  430. if (empty($userInfo) || $status != 1) {
  431. $this->error = 2024;
  432. return false;
  433. }
  434. if($memberLevel < $liveLevel){
  435. $this->error = 2040;
  436. return false;
  437. }
  438. // 验证是否有开播中断播的继续播
  439. $data = [
  440. 'type' => isset($params['type']) ? intval($params['type']) : 1,
  441. 'user_id' => $userId,
  442. 'title' => isset($params['title']) && $params['title'] ? trim($params['title']) : $nickname.'正在直播',
  443. 'description' => isset($params['description']) && $params['description'] ? trim($params['description']) : lang('我正在直播,快来看看吧'),
  444. 'category' => isset($params['category']) ? intval($params['category']) : 0,
  445. 'visible_type' => isset($params['visible_type']) ? intval($params['visible_type']) : 0,
  446. 'visible_users' => isset($params['visible_users']) ? trim($params['visible_users']) : '',
  447. 'chat_type' => isset($params['chat_type']) ? intval($params['chat_type']) : 0,
  448. 'chat_status' => isset($params['chat_status']) ? intval($params['chat_status']) : 1,
  449. 'pay_status' => isset($params['pay_status']) ? intval($params['pay_status']) : 1,
  450. 'open_area' => isset($params['open_area']) ? intval($params['open_area']) : 1,
  451. 'view_allow' => isset($params['view_allow']) ? intval($params['view_allow']) : 1,
  452. 'push_url' => isset($params['push_url']) ? trim($params['push_url']) : '',
  453. 'play_url' => isset($params['play_url']) ? trim($params['play_url']) : '',
  454. 'update_time'=> time(),
  455. 'status' =>1,
  456. 'mark'=>1,
  457. ];
  458. if($liveId = $this->model->where(['user_id'=> $userId,'status'=>1,'mark'=>1])->orderBy('create_time','desc')->value('id')){
  459. if(!$this->model->where(['user_id'=> $userId,'status'=>1,'mark'=>1])->update($data)){
  460. $this->error = 2042;
  461. return false;
  462. }
  463. }else{
  464. $data['create_time'] = time();
  465. $this->model->where(['user_id'=> $userId,'mark'=>1])->update(['status'=>2,'update_time'=>time()]);
  466. if(!$liveId = $this->model->insertGetId($data)){
  467. $this->error = 2042;
  468. return false;
  469. }
  470. }
  471. $data['id'] = $liveId;
  472. $data['member'] = MemberModel::where(['id'=> $userId])->select(['id','nickname','avatar','status'])->first();
  473. $data['member'] = $data['member']? $data['member'] : [];
  474. $data['member']['is_follow'] = 1;
  475. if(isset($data['member']['avatar'])){
  476. $data['member']['avatar'] = $data['member']['avatar']? $data['member']['avatar'] : '/images/member/logo.png';
  477. $data['member']['avatar'] = get_image_url($data['member']['avatar']);
  478. }
  479. $this->error = 2041;
  480. return $data;
  481. }
  482. }