Index.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use fast\Random;
  5. use think\Collection;
  6. use \think\Log;
  7. use Redis;
  8. use app\common\library\Sms as Smslib;
  9. use app\common\service\TenimService;
  10. /**
  11. * 首页接口
  12. */
  13. class Index extends Api
  14. {
  15. protected $noNeedLogin = ['index','contactus','tcpTest','getAppShare','getWebsiteInfo','getUserCharmRankList',
  16. 'getPartyHotList','searchUsers','getInviteCode','getEdition','getInviteImg','getWebsiteInfoForMini','getBankList',
  17. 'getSwitch','ageList','starList','bannerList'];
  18. protected $noNeedRight = ['*'];
  19. /**
  20. * 首页
  21. *
  22. */
  23. public function index()
  24. {
  25. // 强制关闭需要退出正在房间的用户
  26. $tenim = new \app\api\controller\Tenim();
  27. $tenim->outMemberFromRoom(4);
  28. $this->success('请求成功');
  29. }
  30. // /**
  31. // * 生成不重复的随机数字字母组合
  32. // */
  33. // function getUinqueNo($length = 8) {
  34. // $newid = Random::build("alnum",$length);
  35. //// if(in_array($newid,$nos)) {
  36. //// $this->getUinqueNo(8);
  37. //// }
  38. // return $newid;
  39. // }
  40. /**
  41. * 获取用户协议等
  42. */
  43. public function getWebsiteInfo() {
  44. $params = $this->request->request("params"); //内容
  45. if($params == "boxGiftLogo") {
  46. echo $this->success("获取成功!",$this->httpurl(config("site.".$params)));
  47. exit;
  48. }
  49. echo "<html><body>";
  50. echo config("site.".$params);
  51. echo "</body></html>";exit;
  52. }
  53. /**
  54. * 获取用户协议等 小程序
  55. */
  56. public function getWebsiteInfoForMini() {
  57. $params = $this->request->request("params"); //内容
  58. $res = config("site.".$params);
  59. if($params == "boxGiftLogo") $res = $this->httpurl(config("site.".$params));
  60. $this->success("获取成功!",$res);
  61. }
  62. /**
  63. * 联系我们
  64. */
  65. public function contactus() {
  66. $list = \app\common\model\Config::where(["group"=>"basic","name"=>["in",["email","mobile"]]])->select();
  67. $data = [];
  68. foreach($list as $k => $v) {
  69. $v["name"] == "email" && $data["email"] = $v["value"];
  70. $v["name"] == "mobile" && $data["mobile"] = $v["value"];
  71. }
  72. $this->success("获取成功!",$data);
  73. }
  74. /*
  75. * 获取系统消息列表
  76. */
  77. public function getMessage() {
  78. $page = $this->request->request('page',1); // 分页
  79. $pageNum = $this->request->request('pageNum',10); // 分页
  80. // 分页搜索构建
  81. $pageStart = ($page-1)*$pageNum;
  82. $flag = $this->request->request("flag",1,"intval"); //标识:1=只取一条,0=全部
  83. $user_id = $this->auth->id;
  84. $obj = \app\common\model\Message::where(["user_id"=>$user_id])->order("createtime","desc")->limit($pageStart,$pageNum);
  85. if($flag == 1) {
  86. $list = $obj->find();
  87. $list || $list = [];
  88. $list && $list["createtime"] = $this->get_last_time($list["createtime"]);
  89. } else {
  90. $list = $obj->select();
  91. if($list) foreach($list as $k => &$v) {
  92. $v["createtime"] = $this->get_last_time($v["createtime"]);
  93. }
  94. }
  95. $this->success("获取成功!",$list);
  96. }
  97. /**
  98. * 删除系统消息
  99. */
  100. public function delMessage() {
  101. $id = $this->request->request("id",0,"intval"); //消息ID
  102. if($id <= 0) {
  103. $this->error("参数传入错误!");
  104. }
  105. $res = \app\common\model\Message::where(["id"=>$id,"user_id"=>$this->auth->id])->delete();
  106. if($res) {
  107. $this->success("删除成功!");
  108. } else {
  109. $this->error("删除失败!");
  110. }
  111. }
  112. /**
  113. * 获取主播魅力值排行
  114. */
  115. public function getUserCharmRankList() {
  116. $time = $this->request->request("time",0,"intval"); //时间筛选 1=小时榜,2=今日榜,3=本周榜,4=月榜
  117. if(!in_array($time,[1,2,3,4])) {
  118. $this->error("参数传入错误!");
  119. }
  120. $hour = strtotime(date("Y-m-d H:00:00"));
  121. $today = strtotime(date("Y-m-d 00:00:00"));
  122. $weekend = strtotime('monday this week');
  123. // $weekend = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y"));
  124. $month = strtotime(date("Y-m-01 00:00:00"));
  125. // 剩余时间
  126. $thistime = time();
  127. switch ($time) {
  128. case 1:
  129. $redtime = 3600-($thistime - $hour);
  130. break;
  131. case 2:
  132. $redtime = 3600*24-($thistime - $today);
  133. break;
  134. case 3:
  135. $redtime = 3600*24*7-($thistime - $weekend);
  136. break;
  137. case 4:
  138. $monthend = mktime(23,59,59,date("m"),date("t"),date("Y"));
  139. $redtime = ($monthend - $month)-($thistime - $month);
  140. break;
  141. }
  142. $timeArr = [1=>$hour,2=>$today,3=>$weekend,4=>$month];
  143. $where = [];
  144. $where["a.createtime"] = ["gt",$timeArr[$time]];
  145. $list = \app\common\model\UserCharmRank::alias("a")
  146. ->field("a.party_id as id,sum(a.charm) as charm,u.avatar,u.nickname,u.gender,u.level,u.is_live")
  147. ->where($where)
  148. ->join("hx_user u","u.id = a.user_id",'LEFT')
  149. // ->join("hx_party p","p.user_id = a.user_id",'LEFT')
  150. ->group("a.user_id")
  151. ->order("charm","desc")
  152. ->limit(100)
  153. ->select();
  154. $data = [];
  155. $data["redtime"] = $redtime;
  156. $data["data"] = $list;
  157. $this->success("获取成功!",$data);
  158. }
  159. /**
  160. * 获取收礼排行
  161. */
  162. public function getUserGiftRank() {
  163. $time = $this->request->request("time",0,"intval"); //时间筛选 1=小时榜,2=今日榜,3=本周榜,4=月榜
  164. if(!in_array($time,[1,2,3,4])) {
  165. $this->error("参数传入错误!");
  166. }
  167. $hour = strtotime(date("Y-m-d H:00:00"));
  168. $today = strtotime(date("Y-m-d 00:00:00"));
  169. $weekend = strtotime('monday this week');
  170. $month = strtotime(date("Y-m-01 00:00:00"));
  171. // 剩余时间
  172. $thistime = time();
  173. switch ($time) {
  174. case 1:
  175. $redtime = 3600-($thistime - $hour);
  176. break;
  177. case 2:
  178. $redtime = 3600*24-($thistime - $today);
  179. break;
  180. case 3:
  181. $redtime = 3600*24*7-($thistime - $weekend);
  182. break;
  183. case 4:
  184. $monthend = mktime(23,59,59,date("m"),date("t"),date("Y"));
  185. $redtime = ($monthend - $month)-($thistime - $month);
  186. break;
  187. }
  188. $timeArr = [1=>$hour,2=>$today,3=>$weekend,4=>$month];
  189. $where = [];
  190. $where["a.createtime"] = ["gt",$timeArr[$time]];
  191. $list = model('GiftUserParty')->alias("a")
  192. ->field("sum(a.value) as total_price,u.avatar,u.nickname")
  193. ->where($where)
  194. ->join("hx_user u","u.id = a.user_id")
  195. ->group("a.user_to_id")
  196. ->order("total_price","desc")
  197. ->limit(100)
  198. ->select();
  199. $data = [];
  200. $data["redtime"] = $redtime;
  201. $data["data"] = $list;
  202. $this->success("获取成功!",$data);
  203. }
  204. /**
  205. * 获取消费排行
  206. */
  207. public function getUserPayRank() {
  208. $time = $this->request->request("time",0,"intval"); //时间筛选 1=小时榜,2=今日榜,3=本周榜,4=月榜
  209. if(!in_array($time,[1,2,3,4])) {
  210. $this->error("参数传入错误!");
  211. }
  212. $hour = strtotime(date("Y-m-d H:00:00"));
  213. $today = strtotime(date("Y-m-d 00:00:00"));
  214. $weekend = strtotime('monday this week');
  215. $month = strtotime(date("Y-m-01 00:00:00"));
  216. // 剩余时间
  217. $thistime = time();
  218. switch ($time) {
  219. case 1:
  220. $redtime = 3600-($thistime - $hour);
  221. break;
  222. case 2:
  223. $redtime = 3600*24-($thistime - $today);
  224. break;
  225. case 3:
  226. $redtime = 3600*24*7-($thistime - $weekend);
  227. break;
  228. case 4:
  229. $monthend = mktime(23,59,59,date("m"),date("t"),date("Y"));
  230. $redtime = ($monthend - $month)-($thistime - $month);
  231. break;
  232. }
  233. $timeArr = [1=>$hour,2=>$today,3=>$weekend,4=>$month];
  234. $where = [];
  235. $where["a.type"] = ["in",[0,2,3,5,6,11,13]];//查看wallet.php文件
  236. $where["a.createtime"] = ["gt",$timeArr[$time]];
  237. $list = model('UserJewelLog')->alias("a")
  238. ->field("sum(a.value) as total_price,u.avatar,u.nickname")
  239. ->where($where)
  240. ->join("hx_user u","u.id = a.user_id")
  241. ->group("a.user_id")
  242. ->order("total_price","desc")
  243. ->limit(100)
  244. ->select();
  245. $data = [];
  246. $data["redtime"] = $redtime;
  247. $data["data"] = $list;
  248. $this->success("获取成功!",$data);
  249. }
  250. /**
  251. * 获取派对热度排序
  252. */
  253. public function getPartyHotList() {
  254. // 剩余时间
  255. $thistime = time();
  256. $hour = strtotime(date("Y-m-d H:00:00"));
  257. $redtime = 3600-($thistime - $hour);
  258. $where = [];
  259. $where["a.createtime"] = ["gt",$hour];
  260. $where["p.room_type"] = 1;
  261. $list = \app\common\model\PartyHot::alias("a")
  262. ->field("sum(a.hot) as hot,p.id,u.avatar,p.party_name,p.party_logo")
  263. ->where($where)
  264. ->join("hx_party p","p.id = a.party_id")
  265. ->join("hx_user u","u.id = p.user_id")
  266. ->group("a.party_id")
  267. ->order("hot","desc")
  268. ->limit(100)
  269. ->select();
  270. $data = [];
  271. $data["redtime"] = $redtime;
  272. $data["data"] = $list;
  273. $this->success("获取成功!",$data);
  274. }
  275. /**
  276. * 首页搜索
  277. */
  278. public function searchUsers() {
  279. $search = $this->request->request("search"); //关键词筛选
  280. if(!$search) {
  281. $this->error("请输入搜索内容!");
  282. }
  283. // 搜索派对
  284. global $whereOr;
  285. $where = [];
  286. $whereOr["party_id"] = $search;
  287. $whereOr["party_name"] = ["like","%$search%"];
  288. $where["room_type"] = 1;
  289. $partyList = \app\common\model\Party::field("id,party_logo,party_id,party_name")
  290. ->where($where)
  291. ->where(function ($query) {
  292. global $whereOr;
  293. $query->whereOr($whereOr);
  294. })->order("party_hot","desc")->select();
  295. // 搜索直播间
  296. global $whereOrlive;
  297. $where = [];
  298. $whereOrlive["party_id"] = $search;
  299. $whereOrlive["party_name"] = ["like","%$search%"];
  300. $where["room_type"] = 2;
  301. $liveList = \app\common\model\Party::field("id,party_logo,party_id,party_name")
  302. ->where($where)
  303. ->where(function ($query) {
  304. global $whereOrlive;
  305. $query->whereOr($whereOrlive);
  306. })
  307. ->order("party_hot","desc")->select();
  308. // 相关用户
  309. $where = [];
  310. $where["a.nickname"] = ["like","%$search%"];
  311. $where["a.u_id"] = $search;
  312. $userList = \app\common\model\User::alias("a")->field("id,avatar,nickname,u_id,f.fans")
  313. ->join("hx_view_fans f","f.user_id = a.id","left")
  314. ->order("a.is_online,a.noble,a.level")
  315. ->whereOr($where)->select();
  316. $res = [];
  317. $res["partylist"] = $partyList;
  318. $res["livelist"] = $liveList;
  319. $res["userlist"] = $userList;
  320. $this->success("获取成功!",$res);
  321. }
  322. /**
  323. * 首页搜索
  324. */
  325. public function searchList() {
  326. $search = $this->request->request("search"); //关键词筛选
  327. if(!$search) {
  328. $this->error("请输入搜索内容!");
  329. }
  330. // 搜索房间(派对和直播)
  331. global $whereOr;
  332. $where = [];
  333. $whereOr["party_id"] = $search;
  334. $whereOr["party_name"] = ["like","%$search%"];
  335. //$where['is_online'] = 1;
  336. $where['status'] = 1;
  337. $partyList = \app\common\model\Party::field("id,party_logo,party_id,party_name")
  338. ->where($where)
  339. ->where(function ($query) {
  340. global $whereOr;
  341. $query->whereOr($whereOr);
  342. })->order("party_hot","desc")->select();
  343. $partyList = collection($partyList)->toArray();
  344. if (!empty($partyList)) {//在线信息
  345. $partyListIds = array_column($partyList,'id');
  346. $tenimService = new TenimService();
  347. $partyParams = ['party_ids'=>$partyListIds];
  348. $partyRes = $tenimService->getRoomUser($partyParams);
  349. if ($partyRes['status'] == 1) {
  350. foreach ($partyList as $pKey => &$pVal) {
  351. if (isset($partyRes['data'][$pVal['id']])) {
  352. $pVal['member_list'] = $partyRes['data'][$pVal['id']]['member_list'];
  353. $pVal['online_num'] = $partyRes['data'][$pVal['id']]['online_num'];
  354. }
  355. }
  356. }
  357. }
  358. // 家族
  359. $guildWhere['status'] = 1;
  360. $guildWhere['name'] = ["like","%$search%"];
  361. $guildList = model('Guild')->where($guildWhere)->with(['guildmember'=>function($gquery){
  362. $gquery->where(['status'=>1]);
  363. }])->field('id,g_id,name,image')->select();
  364. if (!empty($guildList)) {
  365. $userField = 'id,nickname,avatar';
  366. foreach ($guildList as $gKey => &$gVal) {
  367. $userData =[];
  368. if (isset($gVal['guildmember'])) {
  369. $memberUids = array_column($gVal['guildmember'],'user_id');
  370. $userWhere['is_online'] = 1;
  371. $userWhere['id'] = ['in',$memberUids];
  372. $userData = model('User')->field($userField)->where($userWhere)->select();
  373. }
  374. $gVal['member_list'] = $userData;
  375. $gVal['online_num'] = count($userData);
  376. unset($gVal['guildmember']);
  377. }
  378. }
  379. // 相关用户
  380. $where = [];
  381. $where["a.nickname"] = ["like","%$search%"];
  382. $where["a.u_id"] = $search;
  383. $userList = \app\common\model\User::alias("a")->field("id,avatar,nickname,u_id,f.fans")
  384. ->join("hx_view_fans f","f.user_id = a.id","left")
  385. ->order("a.is_online,a.noble,a.level")
  386. ->whereOr($where)->select();
  387. $res = [];
  388. $res["roomlist"] = $partyList;
  389. $res["guildlist"] = $guildList;
  390. $res["userlist"] = $userList;
  391. $this->success("获取成功!",$res);
  392. }
  393. /**
  394. * 获取下载二维码和邀请码
  395. */
  396. public function getInviteCode() {
  397. // 获取二维码
  398. $host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
  399. $qrcode = $this->httpurl($host.config("site.qrcode"));
  400. $miniqrcode = $this->httpurl($host.config("site.miniqrcode"));
  401. // 获取用户邀请码
  402. $inviteCode = \app\common\model\User::where(["id"=>$this->auth->id])->value("invite_no");
  403. $downlowdLink = $host."/index/index/appJump?t=wlt".rand(10,999).Random::alpha(8);
  404. $this->success("获取成功!",["qrcode"=>$qrcode,"miniqrcode"=>$miniqrcode,"inviteCode"=>$inviteCode,"downlowdLink"=>$downlowdLink]);
  405. }
  406. /**
  407. * 获取app分享海报
  408. */
  409. public function getAppShare() {
  410. $this->success("获取成功!",["url"=>$this->httpurl(config("site.appShare"))]);
  411. }
  412. /**
  413. * 获取版本更新信息
  414. */
  415. public function getEdition() {
  416. // 获取二维码
  417. $is_force = config("site.is_force");
  418. $apkUrl = config("site.apkUrl");
  419. $apkName = config("site.apkName");
  420. $desc = config("site.desc");
  421. $versionCode = config("site.versionCode");
  422. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  423. }
  424. /**
  425. * 获取邀请图片
  426. */
  427. public function getInviteImg() {
  428. $plat = $this->request->request("plat",1); //平台:1=小程序,2=app
  429. if(!in_array($plat,[1,2])) $this->error("参数错误");
  430. // 获取用户的邀请码
  431. $invitecode = \app\common\model\User::where(["id"=>$this->auth->id])->value("invite_no");
  432. // 文字图片合成
  433. $bigImgPath = $this->httpurlLocal('/assets/img/inviteimg.jpeg');
  434. $img = imagecreatefromstring(file_get_contents($bigImgPath));
  435. //字体文件
  436. $font = realpath('./assets/fonts/lato/lato-black.ttf');
  437. //字体颜色(RGB)
  438. $black = imagecolorallocate($img, 217, 76, 41);
  439. //字体大小
  440. $fontSize = 30;
  441. //旋转角度
  442. $circleSize = 0;
  443. //左边距
  444. $left = 275;
  445. //上边距
  446. $top = 540;
  447. imagefttext($img, $fontSize, $circleSize, $left, $top, $black, $font, $invitecode);
  448. $filename = date("YmdH").".jpeg";
  449. $path = "/uploads/qrcode/".$filename;
  450. $file = $_SERVER['DOCUMENT_ROOT'] . $path;//打开文件准备写入
  451. list($bgWidth, $bgHight, $bgType) = getimagesize($bigImgPath);
  452. switch ($bgType) {
  453. case 1://gif
  454. header('Content-Type:image/gif');
  455. imagegif($img,$file);
  456. break;
  457. case 2://jpg
  458. header('Content-Type:image/jpg');
  459. imagejpeg($img,$file);
  460. break;
  461. case 3://jpg
  462. header('Content-Type:image/png');
  463. imagepng($img,$file);
  464. break;
  465. default:
  466. break;
  467. }
  468. //销毁照片
  469. imagedestroy($img);
  470. // 图片和二维码合成
  471. $qrcode = $plat == 1 ? config("site.miniqrcode"):config("site.qrcode");
  472. $background = $file;
  473. $target = $this->httpurl($qrcode);
  474. $background_iamge = imagecreatefromstring(file_get_contents($background));
  475. $target_image = imagecreatefromstring(file_get_contents($target));
  476. list($target_width, $target_height, $target_type) = getimagesize($target);
  477. imagecopymerge($background_iamge , $target_image , 250, 700, 0, 0, $target_width, $target_height, 100);
  478. list($background_width, $background_height, $background_type) = getimagesize($background);
  479. switch ($background_type) {
  480. case 1://gif
  481. header('Content-Type:image/gif');
  482. imagegif($background_iamge,$file);
  483. break;
  484. case 2://jpg
  485. header('Content-Type:image/jpg');
  486. imagejpeg($background_iamge,$file);
  487. break;
  488. case 3://jpg
  489. header('Content-Type:image/png');
  490. imagepng($background_iamge,$file);
  491. break;
  492. default:
  493. break;
  494. }
  495. $savepath = $this->httpurlLocal($path);
  496. $this->success("获取成功!",$savepath);
  497. }
  498. /**
  499. * 获取银行列表
  500. */
  501. public function getBankList() {
  502. $this->success("获取成功!",["banklist"=>\app\common\model\Bank::select()]);
  503. }
  504. /**
  505. * 获取开关配置
  506. */
  507. public function getSwitch() {
  508. $this->success("获取成功!",["switch"=>config("site.switch")]);
  509. }
  510. /**
  511. * 评论时间转换
  512. * @param null $time
  513. * @return false|string
  514. */
  515. private function get_last_time($time = NULL) {
  516. $text = '';
  517. $time = $time === NULL || $time > time() ? time() : intval($time);
  518. $t = time() - $time; //时间差 (秒)
  519. $y = date('Y', $time)-date('Y', time());//是否跨年
  520. switch($t){
  521. case $t == 0:
  522. $text = '刚刚';
  523. break;
  524. case $t < 60:
  525. $text = $t . '秒前'; // 一分钟内
  526. break;
  527. case $t < 60 * 60:
  528. $text = floor($t / 60) . '分钟前'; //一小时内
  529. break;
  530. case $t < 60 * 60 * 24:
  531. $text = floor($t / (60 * 60)) . '小时前'; // 一天内
  532. break;
  533. case $t < 60 * 60 * 24 * 3:
  534. $text = floor($time/(60*60*24)) ==1 ?'昨天 ' . date('H:i', $time) : '前天 ' . date('H:i', $time) ; //昨天和前天
  535. break;
  536. case $t < 60 * 60 * 24 * 30:
  537. $text = date('m月d日 H:i', $time); //一个月内
  538. break;
  539. case $t < 60 * 60 * 24 * 365&&$y==0:
  540. $text = date('m月d日', $time); //一年内
  541. break;
  542. default:
  543. $text = date('Y年m月d日', $time); //一年以前
  544. break;
  545. }
  546. return $text;
  547. }
  548. /**
  549. * 年龄段列表
  550. * @return void
  551. */
  552. public function ageList()
  553. {
  554. try {
  555. $field = 'id,name';
  556. $where['status'] = 1;
  557. $result = model('Age')->field($field)->where($where)->order('weigh asc')->select();
  558. $this->success('获取成功',$result);
  559. } catch (Exception $e) {
  560. $this->error($e->getMessage());
  561. }
  562. }
  563. /**
  564. * 星座列表
  565. * @return void
  566. */
  567. public function starList()
  568. {
  569. try {
  570. $field = 'id,name,image';
  571. $where['status'] = 1;
  572. $result = model('Constellation')->field($field)->where($where)->order('weigh asc')->select();
  573. if (!$result) {
  574. $result = list_domain_image($result,['image']);
  575. }
  576. $this->success('获取成功',$result);
  577. } catch (Exception $e) {
  578. $this->error($e->getMessage());
  579. }
  580. }
  581. /**
  582. * 轮播图列表
  583. * @return void
  584. */
  585. public function bannerList()
  586. {
  587. try {
  588. $field = 'id,title,image,url';
  589. $where['status'] = 1;
  590. $result = model('Banner')->field($field)->where($where)->order('weigh asc')->select();
  591. if (!$result) {
  592. $result = list_domain_image($result,['image']);
  593. }
  594. $this->success('获取成功',$result);
  595. } catch (Exception $e) {
  596. $this->error($e->getMessage());
  597. }
  598. }
  599. }