Index.php 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090
  1. <?php
  2. namespace app\api\controller;
  3. use app\common\controller\Api;
  4. use fast\Random;
  5. use think\Db;
  6. use \think\Log;
  7. use Redis;
  8. use app\common\library\Sms as Smslib;
  9. use app\common\library\Token;
  10. /**
  11. * 首页接口
  12. */
  13. class Index extends Api
  14. {
  15. protected $noNeedLogin = ['zhiyint_registration','index','contactus','tcpTest','getAppShare','getWebsiteInfo','getUserCharmRankList','getPartyHotList','searchUsers','getInviteCode','getEdition','getInviteImg','getWebsiteInfoForMini','getBankList','getSwitch','getBootAnimation', 'tencentcall', 'getversion', 'getversionZx', 'getiosversion'];
  16. protected $noNeedRight = ['*'];
  17. public function index(){
  18. echo 'apisuccess';
  19. exit;
  20. }
  21. /**
  22. * 首页
  23. *
  24. */
  25. public function outMemberFromRoom()
  26. {
  27. // 强制关闭需要退出正在房间的用户
  28. $tenim = new \app\api\controller\Tenim();
  29. $tenim->outMemberFromRoom(4);
  30. $this->success('请求成功');
  31. }
  32. protected function getRealIpAddr() {
  33. if (!empty($_SERVER['HTTP_CLIENT_IP'])) //check ip from share internet
  34. {
  35. $ip=$_SERVER['HTTP_CLIENT_IP'];
  36. }
  37. elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) //to check ip is pass from proxy
  38. {
  39. $ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
  40. }
  41. else
  42. {
  43. $ip=$_SERVER['REMOTE_ADDR'];
  44. }
  45. return $ip;
  46. }
  47. /**
  48. * 三方接口
  49. *
  50. */
  51. public function zhiyint_registration()
  52. {
  53. $iparr = ["182.37.138.94","18.162.169.63","18.166.207.228","18.167.62.130","18.163.198.60","18.163.33.249","16.163.157.213", "43.198.99.226", "43.198.98.100", "18.163.210.144", "18.167.165.212", "18.166.28.150", "16.163.99.187", "18.163.210.126", "43.198.84.109", "18.163.182.173", "16.162.109.227", "16.162.87.8", "18.162.111.92", "18.166.214.252"];
  54. $ip = $this->getRealIpAddr();
  55. if(!in_array($ip,$iparr)) {
  56. echo json_encode(['error' => "IP not found"]); exit;
  57. }
  58. $UserId = $this->request->request("UserId",'');
  59. $data = json_decode(file_get_contents('php://input'), true);
  60. $UserId = $data['UserId'];
  61. if($UserId)
  62. {
  63. $times = Db::name("user")->where("username",$UserId)->value("createtime");
  64. if(!$times)
  65. {
  66. echo json_encode(['error' => "User ID not found"]); exit;
  67. }
  68. $data = [
  69. 'RegistrationTime' => date("Y-m-d H:i:s",$times)
  70. ];
  71. echo json_encode($data); exit;
  72. }
  73. $data = [
  74. 'error' => "User ID not found"
  75. ];
  76. echo json_encode($data);
  77. }
  78. // /**
  79. // * 生成不重复的随机数字字母组合
  80. // */
  81. // function getUinqueNo($length = 8) {
  82. // $newid = Random::build("alnum",$length);
  83. //// if(in_array($newid,$nos)) {
  84. //// $this->getUinqueNo(8);
  85. //// }
  86. // return $newid;
  87. // }
  88. /**
  89. * 获取用户协议等
  90. */
  91. public function getWebsiteInfo() {
  92. $params = $this->request->request("params"); //内容
  93. if($params == "boxGiftLogo") {
  94. echo $this->success("获取成功!",$this->httpurl(config("site.".$params)));
  95. exit;
  96. }
  97. echo "<html><body>";
  98. echo config("site.".$params);
  99. echo "</body></html>";exit;
  100. }
  101. /**
  102. * 获取用户协议等 小程序
  103. */
  104. public function getWebsiteInfoForMini() {
  105. $params = $this->request->request("params"); //内容
  106. $res = config("site.".$params);
  107. if($params == "boxGiftLogo") $res = $this->httpurl(config("site.".$params));
  108. $this->success("获取成功!",$res);
  109. }
  110. /**
  111. * 联系我们
  112. */
  113. public function contactus() {
  114. $list = \app\common\model\Config::where(["group"=>"basic","name"=>["in",["email","mobile"]]])->select();
  115. $data = [];
  116. foreach($list as $k => $v) {
  117. $v["name"] == "email" && $data["email"] = $v["value"];
  118. $v["name"] == "mobile" && $data["mobile"] = $v["value"];
  119. }
  120. $this->success("获取成功!",$data);
  121. }
  122. /*
  123. * 获取系统消息列表
  124. */
  125. public function getMessage() {
  126. $page = $this->request->request('page',1); // 分页
  127. $pageNum = $this->request->request('pageNum',10); // 分页
  128. // 分页搜索构建
  129. $pageStart = ($page-1)*$pageNum;
  130. $flag = $this->request->request("flag",1,"intval"); //标识:1=只取一条,0=全部
  131. $user_id = $this->auth->id;
  132. $obj = \app\common\model\Message::where(["user_id"=>$user_id])->order("createtime","desc")->limit($pageStart,$pageNum);
  133. if($flag == 1) {
  134. $list = $obj->find();
  135. $list || $list = [];
  136. $list && $list["createtime"] = $this->get_last_time($list["createtime"]);
  137. } else {
  138. $list = $obj->select();
  139. if($list) foreach($list as $k => &$v) {
  140. $v["createtime"] = $this->get_last_time($v["createtime"]);
  141. }
  142. }
  143. $this->success("获取成功!",$list);
  144. }
  145. /**
  146. * 删除系统消息
  147. */
  148. public function delMessage() {
  149. $id = $this->request->request("id",0,"intval"); //消息ID
  150. if($id <= 0) {
  151. $this->error("参数传入错误!");
  152. }
  153. $res = \app\common\model\Message::where(["id"=>$id,"user_id"=>$this->auth->id])->delete();
  154. if($res) {
  155. $this->success("删除成功!");
  156. } else {
  157. $this->error("删除失败!");
  158. }
  159. }
  160. /**
  161. * 获取主播魅力值排行
  162. */
  163. public function getUserCharmRankList() {
  164. $time = $this->request->request("time",0,"intval"); //时间筛选 1=小时榜,2=今日榜,3=本周榜,4=月榜
  165. if(!in_array($time,[1,2,3,4])) {
  166. $this->error("参数传入错误!");
  167. }
  168. $hour = strtotime(date("Y-m-d H:00:00"));
  169. $today = strtotime(date("Y-m-d 00:00:00"));
  170. $weekend = strtotime('monday this week');
  171. // $weekend = mktime(0, 0 , 0,date("m"),date("d")-date("w")+1,date("Y"));
  172. $month = strtotime(date("Y-m-01 00:00:00"));
  173. // 剩余时间
  174. $thistime = time();
  175. switch ($time) {
  176. case 1:
  177. $redtime = 3600-($thistime - $hour);
  178. break;
  179. case 2:
  180. $redtime = 3600*24-($thistime - $today);
  181. break;
  182. case 3:
  183. $redtime = 3600*24*7-($thistime - $weekend);
  184. break;
  185. case 4:
  186. $monthend = mktime(23,59,59,date("m"),date("t"),date("Y"));
  187. $redtime = ($monthend - $month)-($thistime - $month);
  188. break;
  189. }
  190. $timeArr = [1=>$hour,2=>$today,3=>$weekend,4=>$month];
  191. $where = [];
  192. $where["a.createtime"] = ["gt",$timeArr[$time]];
  193. $list = \app\common\model\UserCharmRank::alias("a")
  194. ->field("p.id,sum(a.charm) as charm,u.avatar,u.nickname,u.gender,u.level")
  195. ->where($where)
  196. ->join("hx_user u","u.id = a.user_id")
  197. ->join("hx_party p","p.user_id = a.user_id")
  198. ->group("a.user_id")
  199. ->order("charm","desc")
  200. ->limit(100)
  201. ->select();
  202. $data = [];
  203. $data["redtime"] = $redtime;
  204. $data["data"] = $list;
  205. $this->success("获取成功!",$data);
  206. }
  207. /**
  208. * 获取派对热度排序
  209. */
  210. public function getPartyHotList() {
  211. // 剩余时间
  212. $thistime = time();
  213. $hour = strtotime(date("Y-m-d H:00:00"));
  214. $redtime = 3600-($thistime - $hour);
  215. $where = [];
  216. $where["a.createtime"] = ["gt",$hour];
  217. $where["p.room_type"] = 1;
  218. $list = \app\common\model\PartyHot::alias("a")
  219. ->field("sum(a.hot) as hot,p.id,u.avatar,p.party_name,p.party_logo")
  220. ->where($where)
  221. ->join("hx_party p","p.id = a.party_id")
  222. ->join("hx_user u","u.id = p.user_id")
  223. ->group("a.party_id")
  224. ->order("hot","desc")
  225. ->limit(100)
  226. ->select();
  227. $data = [];
  228. $data["redtime"] = $redtime;
  229. $data["data"] = $list;
  230. $this->success("获取成功!",$data);
  231. }
  232. /**
  233. * 首页搜索
  234. */
  235. public function searchUsers() {
  236. $search = $this->request->request("search"); //关键词筛选
  237. if(!$search) {
  238. $this->error("请输入搜索内容!");
  239. }
  240. // 搜索派对
  241. global $whereOr;
  242. $where = [];
  243. $whereOr["party_id"] = $search;
  244. $whereOr["party_name"] = ["like","%$search%"];
  245. $where["room_type"] = 1;
  246. $partyList = \app\common\model\Party::field("id,party_logo,party_id,party_name")
  247. ->where($where)
  248. ->where(function ($query) {
  249. global $whereOr;
  250. $query->whereOr($whereOr);
  251. })->order("party_hot","desc")->select();
  252. // 搜索直播间
  253. global $whereOrlive;
  254. $where = [];
  255. $whereOrlive["party_id"] = $search;
  256. $whereOrlive["party_name"] = ["like","%$search%"];
  257. $where["room_type"] = 2;
  258. $liveList = \app\common\model\Party::field("id,party_logo,party_id,party_name")
  259. ->where($where)
  260. ->where(function ($query) {
  261. global $whereOrlive;
  262. $query->whereOr($whereOrlive);
  263. })
  264. ->order("party_hot","desc")->select();
  265. // 相关用户
  266. $where = [];
  267. $where["a.nickname"] = ["like","%$search%"];
  268. $where["a.u_id"] = $search;
  269. $userList = \app\common\model\User::alias("a")->field("id,avatar,nickname,u_id,f.fans")
  270. ->join("hx_view_fans f","f.user_id = a.id","left")
  271. ->order("a.is_online,a.noble,a.level")
  272. ->whereOr($where)->select();
  273. $res = [];
  274. $res["partylist"] = $partyList;
  275. $res["livelist"] = $liveList;
  276. $res["userlist"] = $userList;
  277. $this->success("获取成功!",$res);
  278. }
  279. /**
  280. * 获取下载二维码和邀请码
  281. */
  282. public function getInviteCode() {
  283. // 获取二维码
  284. $qrcode = $this->httpurl(config("site.qrcode"));
  285. $miniqrcode = $this->httpurl(config("site.miniqrcode"));
  286. // 获取用户邀请码
  287. $inviteCode = \app\common\model\User::where(["id"=>$this->auth->id])->value("invite_no");
  288. $host = $_SERVER["REQUEST_SCHEME"]."://".$_SERVER["HTTP_HOST"];
  289. $downlowdLink = $host."/index/index/appJump?t=wlt".rand(10,999).Random::alpha(8);
  290. $this->success("获取成功!",["qrcode"=>$qrcode,"miniqrcode"=>$miniqrcode,"inviteCode"=>$inviteCode,"downlowdLink"=>$downlowdLink]);
  291. }
  292. /**
  293. * 获取app分享海报
  294. */
  295. public function getAppShare() {
  296. $this->success("获取成功!",["url"=>$this->httpurl(config("site.appShare"))]);
  297. }
  298. /**
  299. * 获取开机动画(暂时关闭)
  300. */
  301. private function getBootAnimation() {
  302. $this->success("获取成功!",["url"=>$this->httpurl(config("site.bootAnimationUrl")),"time"=>floatval(config("site.bootAnimationTime"))]);
  303. }
  304. /**
  305. * 获取版本更新信息
  306. */
  307. public function getEdition() {
  308. // 获取二维码
  309. $is_force = config("site.is_force");
  310. $apkUrl = config("site.apk_url");
  311. $apkName = config("site.apkName");
  312. $desc = config("site.desc");
  313. $versionCode = config("site.versionCode");
  314. $this->success("获取成功!",["versionCode"=>$versionCode,"isForceUpdate"=>$is_force,"apkUrl"=>$apkUrl,"apkName"=>$apkName,"desc"=>$desc]);
  315. }
  316. /**
  317. * 获取邀请图片
  318. */
  319. public function getInviteImg() {
  320. $plat = $this->request->request("plat",1); //平台:1=小程序,2=app
  321. if(!in_array($plat,[1,2])) $this->error("参数错误");
  322. // 获取用户的邀请码
  323. $invitecode = \app\common\model\User::where(["id"=>$this->auth->id])->value("invite_no");
  324. // 文字图片合成
  325. $bigImgPath = $this->httpurlLocal('/assets/img/inviteimg.jpeg');
  326. $img = imagecreatefromstring(file_get_contents($bigImgPath));
  327. //字体文件
  328. $font = realpath('./assets/fonts/lato/lato-black.ttf');
  329. //字体颜色(RGB)
  330. $black = imagecolorallocate($img, 217, 76, 41);
  331. //字体大小
  332. $fontSize = 30;
  333. //旋转角度
  334. $circleSize = 0;
  335. //左边距
  336. $left = 275;
  337. //上边距
  338. $top = 540;
  339. imagefttext($img, $fontSize, $circleSize, $left, $top, $black, $font, $invitecode);
  340. $filename = date("YmdH").".jpeg";
  341. $path = "/uploads/qrcode/".$filename;
  342. $file = $_SERVER['DOCUMENT_ROOT'] . $path;//打开文件准备写入
  343. list($bgWidth, $bgHight, $bgType) = getimagesize($bigImgPath);
  344. switch ($bgType) {
  345. case 1://gif
  346. header('Content-Type:image/gif');
  347. imagegif($img,$file);
  348. break;
  349. case 2://jpg
  350. header('Content-Type:image/jpg');
  351. imagejpeg($img,$file);
  352. break;
  353. case 3://jpg
  354. header('Content-Type:image/png');
  355. imagepng($img,$file);
  356. break;
  357. default:
  358. break;
  359. }
  360. //销毁照片
  361. imagedestroy($img);
  362. // 图片和二维码合成
  363. $qrcode = $plat == 1 ? config("site.miniqrcode"):config("site.qrcode");
  364. $background = $file;
  365. $target = $this->httpurl($qrcode);
  366. $background_iamge = imagecreatefromstring(file_get_contents($background));
  367. $target_image = imagecreatefromstring(file_get_contents($target));
  368. list($target_width, $target_height, $target_type) = getimagesize($target);
  369. imagecopymerge($background_iamge , $target_image , 250, 700, 0, 0, $target_width, $target_height, 100);
  370. list($background_width, $background_height, $background_type) = getimagesize($background);
  371. switch ($background_type) {
  372. case 1://gif
  373. header('Content-Type:image/gif');
  374. imagegif($background_iamge,$file);
  375. break;
  376. case 2://jpg
  377. header('Content-Type:image/jpg');
  378. imagejpeg($background_iamge,$file);
  379. break;
  380. case 3://jpg
  381. header('Content-Type:image/png');
  382. imagepng($background_iamge,$file);
  383. break;
  384. default:
  385. break;
  386. }
  387. $savepath = $this->httpurlLocal($path);
  388. $this->success("获取成功!",$savepath);
  389. }
  390. /**
  391. * 获取银行列表
  392. */
  393. public function getBankList() {
  394. $this->success("获取成功!",["banklist"=>\app\common\model\Bank::select()]);
  395. }
  396. /**
  397. * 获取开关配置
  398. */
  399. public function getSwitch() {
  400. $this->success("获取成功!",["switch"=>config("site.switch")]);
  401. }
  402. /**
  403. * 评论时间转换
  404. * @param null $time
  405. * @return false|string
  406. */
  407. private function get_last_time($time = NULL) {
  408. $text = '';
  409. $time = $time === NULL || $time > time() ? time() : intval($time);
  410. $t = time() - $time; //时间差 (秒)
  411. $y = date('Y', $time)-date('Y', time());//是否跨年
  412. switch($t){
  413. case $t == 0:
  414. $text = '刚刚';
  415. break;
  416. case $t < 60:
  417. $text = $t . '秒前'; // 一分钟内
  418. break;
  419. case $t < 60 * 60:
  420. $text = floor($t / 60) . '分钟前'; //一小时内
  421. break;
  422. case $t < 60 * 60 * 24:
  423. $text = floor($t / (60 * 60)) . '小时前'; // 一天内
  424. break;
  425. case $t < 60 * 60 * 24 * 3:
  426. $text = floor($time/(60*60*24)) ==1 ?'昨天 ' . date('H:i', $time) : '前天 ' . date('H:i', $time) ; //昨天和前天
  427. break;
  428. case $t < 60 * 60 * 24 * 30:
  429. $text = date('m月d日 H:i', $time); //一个月内
  430. break;
  431. case $t < 60 * 60 * 24 * 365&&$y==0:
  432. $text = date('m月d日', $time); //一年内
  433. break;
  434. default:
  435. $text = date('Y年m月d日', $time); //一年以前
  436. break;
  437. }
  438. return $text;
  439. }
  440. //轮播图
  441. public function banner() {
  442. $type = input('type', 0, 'intval'); //类型:0=交友轮播图,1=动态轮播图
  443. $list = Db::name('banner')->field('id, title, image, url')->where(['status' => 1, 'type' => $type])->order('weigh', 'desc')->select();
  444. $list = list_domain_image($list, ['image']);
  445. $this->success('轮播图', $list);
  446. }
  447. //谁看过我汇总
  448. public function visitlist(){
  449. $time = Db::name('user_visit_time')->where(['user_id' => $this->auth->id])->value('visittime');
  450. $where = [];
  451. if ($time) {
  452. $where['updatetime'] = ['gt', $time];
  453. }
  454. $list = [];
  455. $count = Db::name('user_visit')->where(['to_uid' => $this->auth->id])->where($where)->count('id');
  456. if ($count) {
  457. $uid_list = Db::name('user_visit')->field('uid')->where(['to_uid' => $this->auth->id])->where($where)->limit(9)->column('uid');
  458. $mt_user = Db::name('user');
  459. foreach ($uid_list as &$v) {
  460. $avatar = $mt_user->where(['id' => $v])->value('avatar');
  461. $list[] = one_domain_image($avatar);
  462. }
  463. }
  464. $data['count'] = $count;
  465. $data['list'] = $list;
  466. $this->success('success',$data);
  467. }
  468. //筛选年龄段
  469. public function agerange() {
  470. $list = [
  471. [
  472. 'id' => 0,
  473. 'title' => '不限'
  474. ],
  475. [
  476. 'id' => 1,
  477. 'title' => '18-25岁'
  478. ],
  479. [
  480. 'id' => 2,
  481. 'title' => '25-30岁'
  482. ],
  483. [
  484. 'id' => 3,
  485. 'title' => '30-35岁'
  486. ],
  487. [
  488. 'id' => 4,
  489. 'title' => '35-40岁'
  490. ],
  491. [
  492. 'id' => 5,
  493. 'title' => '40-45岁'
  494. ],
  495. [
  496. 'id' => 6,
  497. 'title' => '45-50岁'
  498. ],
  499. [
  500. 'id' => 7,
  501. 'title' => '50岁以上'
  502. ]
  503. ];
  504. $this->success('筛选年龄段', $list);
  505. }
  506. //推荐/附近/新人
  507. public function nearuser()
  508. {
  509. // if(empty($this->auth->longitude) || empty($this->auth->latitude)){
  510. // // $this->success('success',[]);
  511. // $this->error('请先开启定位');
  512. // }
  513. // $type = input('type', 0, 'intval'); //类型: 0附近 1缘分
  514. $type = input('type', 0, 'intval'); //类型: 0推荐 1附近 2新人
  515. $age_id = input('age_id', 0, 'intval'); //年龄段
  516. // $agemin = input('agemin', 0, 'intval'); //最小年龄
  517. // $agemax = input('agemax', 100, 'intval'); //最大年龄
  518. //经过地图测算和公式推算,经度纬度 0.1即为11公里
  519. $map = [
  520. 'user.gender' => $this->auth->gender == 1 ? 0 : 1,// 查询异性
  521. 'user.status' => 1,
  522. 'user.is_kefu' => 0,
  523. 'user.id' => ['neq',$this->auth->id],
  524. // 'user.cityname' => $this->auth->cityname,
  525. // 'user.longitude' => ['between',[$this->auth->longitude - 0.1,$this->auth->longitude + 0.1]],
  526. // 'user.latitude' => ['between',[$this->auth->latitude - 0.1,$this->auth->latitude + 0.1]],
  527. // 'user.is_online|user.is_livebc' => 1, //完全不考虑直播与语聊的权重,只用活跃做排序
  528. // 'user.active_time' => ['gt',time()-86400],
  529. ];
  530. //排序
  531. $order = 'user.is_active desc, user.active_time desc';
  532. if (in_array($type,[0,1])) {
  533. if ($this->auth->gender == 1) {
  534. // $order = 'user.is_active desc, user.active_time desc, uw.get_money desc';
  535. $order = 'user.is_active desc, user.active_time desc';
  536. } else {
  537. // $order = 'user.is_active desc, user.active_time desc, uw.pay_money desc';
  538. $order = 'user.is_active desc, user.active_time desc';
  539. }
  540. }
  541. if ($type == 0) {
  542. // $map['user.cityname'] = $this->auth->cityname; //同城
  543. if ($this->auth->gender == 1) {
  544. $map['user.is_recommend'] = 1;
  545. }
  546. //$order = 'user.is_active desc, uw.pay_money desc,uw.get_money desc';
  547. } elseif ($type == 1) {
  548. // $map['user.longitude'] = ['between',[$this->auth->longitude - 0.1,$this->auth->longitude + 0.1]];
  549. // $map['user.latitude'] = ['between',[$this->auth->latitude - 0.1,$this->auth->latitude + 0.1]];
  550. } else {
  551. $map['user.createtime'] = ['egt', time() - 86400 * 30];
  552. // $order = 'user.createtime desc';
  553. }
  554. if ($age_id > 0 && $age_id < 8) {
  555. if ($age_id == 1) {
  556. $agemin = 18;
  557. $agemax = 25;
  558. } elseif ($age_id == 2) {
  559. $agemin = 25;
  560. $agemax = 30;
  561. } elseif ($age_id == 3) {
  562. $agemin = 30;
  563. $agemax = 35;
  564. } elseif ($age_id == 4) {
  565. $agemin = 35;
  566. $agemax = 40;
  567. } elseif ($age_id == 5) {
  568. $agemin = 40;
  569. $agemax = 45;
  570. } elseif ($age_id == 6) {
  571. $agemin = 45;
  572. $agemax = 50;
  573. } elseif ($age_id == 7) {
  574. $agemin = 50;
  575. $agemax = 200;
  576. }
  577. $map['user.birthday'] = ['between', [time() - $agemax * 31536000, time() - $agemin * 31536000]];
  578. }
  579. //dump($map);
  580. $field = [
  581. 'user.id','user.nickname','user.birthday','user.height','user.longitude','user.latitude','user.avatar','user.bio','user.gender','user.idcard_status', 'user.real_status', 'user.job_id', 'user.is_active', 'user.wages_id', 'user.is_recommend', 'user.cityname', 'user.hometown_cityid', 'user.is_hideaddress'
  582. ];
  583. //$list = Db::name('user')->alias('user')->field($field)->where($map)->order($order)->autopage()->select();
  584. $list = Db::name('user')->alias('user')->field($field)
  585. //->join('user_wallet uw','uw.user_id = user.id','LEFT')
  586. ->where($map)->order($order)->autopage()->select();
  587. $list = list_domain_image($list,['avatar']);
  588. $mt_enum_job = Db::name('enum_job'); //职业
  589. $mt_enum_wages = Db::name('enum_wages'); //收入
  590. $mt_user_wallet = Db::name('user_wallet'); //vip
  591. $mt_user_greet = Db::name('user_greet'); //是否打过招呼
  592. $mt_wealth_level = Db::name('wealth_level'); //财富等级
  593. $mt_area = Db::name('area'); //城市
  594. $time = time();
  595. $hometown_cityid = [];//城市ids
  596. $user_to_id = [];//打招呼ids
  597. foreach ($list as $key=>$val){
  598. $hometown_cityid[] = $val['hometown_cityid'];
  599. $user_to_id[] = $val['id'];
  600. }
  601. // 城市
  602. $mt_areas = $mt_area->field(['id','name'])->whereIn('id',$hometown_cityid)->select();
  603. $mt_areas = array_column($mt_areas ?? [],'name','id');
  604. // 是否打过招呼
  605. $mt_user_greets = $mt_user_greet->field(['user_to_id','count(id) as num'])->where('user_id', $this->auth->id)->whereIn('user_to_id',$user_to_id)->group('user_to_id')->select();
  606. $mt_user_greets = array_column($mt_user_greets ?? [],'num','user_to_id');
  607. // 是否是vip
  608. $mt_user_wallets = $mt_user_wallet->field(['id','user_id','vip_endtime','pay_money'])->whereIn('user_id',$user_to_id)->select();
  609. // 财富等级
  610. $mt_wealth_levels = $mt_wealth_level->order('id desc')->select();
  611. $mt_wealth_levels = array_column($mt_wealth_levels ?? [],'name','value');
  612. foreach($list as $key => &$v) {
  613. if ($this->auth->gender == 1) { //用户是男的
  614. $age = birthtime_to_age($v['birthday']);
  615. // $job = $mt_enum_job->where(['id' => $v['job_id']])->value('name');
  616. // $v['desc'] = $distance . ' · ' . $age . '岁';
  617. $v['desc'] = '';
  618. if ($age > 0) {
  619. $v['desc'] = $age . '岁';
  620. } else {
  621. $v['desc'] = '18岁';
  622. }
  623. if ($v['height']) {
  624. $v['desc'] .= ' | ' . $v['height'];
  625. }
  626. // if ($job) {
  627. // $v['desc'] .= ' · ' . $job;
  628. // }
  629. if ($type == 1) {
  630. // $distance = $this->calc_map_distance([$this->auth->longitude, $this->auth->latitude], [$v['longitude'], $v['latitude']]);
  631. // $v['desc'] .= ' | ' . $distance;
  632. $v['desc'] .= ' | 10km+';
  633. }
  634. } else {
  635. if ($type != 1) {
  636. $v['desc'] = $v['bio'] ?: '暂未设置个性签名';
  637. } else {
  638. $age = birthtime_to_age($v['birthday']);
  639. // $wages = $mt_enum_wages->where(['id' => $v['wages_id']])->value('name');
  640. // $v['desc'] = $distance . ' · ' . $age . '岁';
  641. $v['desc'] = '';
  642. if ($age > 0) {
  643. $v['desc'] = $age . '岁';
  644. } else {
  645. $v['desc'] = '18岁';
  646. }
  647. if ($v['hometown_cityid']) {
  648. $hometown_city = $mt_areas[$v['hometown_cityid']] ?? '';
  649. $hometown_city = ($hometown_city && $v['is_hideaddress'] == 0) ? $hometown_city : '';
  650. if ($hometown_city) {
  651. $v['desc'] .= ' | ' . $hometown_city;
  652. }
  653. }
  654. // if ($wages) {
  655. // $v['desc'] .= ' · ' . $wages;
  656. // }
  657. }
  658. }
  659. //查询是否打过招呼
  660. $count = $mt_user_greets[$v['id']] ?? 0;
  661. if ($count) {
  662. $v['is_chat'] = 1; //是否打过招呼: 1是 0否
  663. } else {
  664. $v['is_chat'] = 0; //是否打过招呼: 1是 0否
  665. }
  666. $vip_endtime = 0;
  667. $pay_money = 0;
  668. foreach ($mt_user_wallets as $kk=>$vv){
  669. if ($vv['user_id'] == $v['id']) {
  670. $vip_endtime = $vv['vip_endtime'];
  671. $pay_money = $vv['pay_money'];
  672. break;
  673. }
  674. }
  675. if ($vip_endtime >= $time) {
  676. $v['is_vip'] = 1; //是否是vip: 1是 0否
  677. } else {
  678. $v['is_vip'] = 0; //是否是vip: 1是 0否
  679. }
  680. //查询财富等级
  681. if (!empty($mt_wealth_levels)) {
  682. $name = '';
  683. foreach ($mt_wealth_levels as $kkk=>$vvv){
  684. if ($pay_money > $kkk){
  685. $name = $vvv;
  686. break;
  687. }
  688. }
  689. $v['wealth_level'] = $name;
  690. } else {
  691. $v['wealth_level'] = '';
  692. }
  693. }
  694. $this->success('success',$list);
  695. }
  696. /**
  697. * calc_map_distance() , 根据地图上的两个点各自的x,y坐标,计算出2点之间的直线距离
  698. * @param array $point_1 第1个点的x,y坐标 array( 101 , 202 )
  699. * @param array $point_2 第2个点的x,y坐标 array( 101 , 202 )
  700. * @param bool $calc_as_string 是否计算为字符串公里距离 , 如果未否返回数字
  701. * @return float | false | string
  702. */
  703. private function calc_map_distance( $point_1=array( ) , $point_2=array( ) , $calc_as_string=false ) {
  704. if( empty( $point_1 ) || empty( $point_2 ) ){
  705. return false;
  706. }
  707. // 经纬度不存在,或者经纬度超过最大范围 +-180 , +-90 ,返回false
  708. $p1_x = $point_1[0];
  709. $p1_y = $point_1[1];
  710. $p2_x = $point_2[0];
  711. $p2_y = $point_2[1];
  712. if(
  713. $p1_x < -180 || $p1_x > 180
  714. || $p2_x < -180 || $p2_x > 180
  715. || $p1_y < -90 || $p1_y > 90
  716. || $p2_y < -90 || $p2_y > 90
  717. || $p1_x == '' || $p1_y == ''
  718. || $p2_x == '' || $p2_y == ''
  719. ){
  720. return '距离未知';
  721. }
  722. // 根据2点各自的坐标,计算2点之间直线距离的公式
  723. $distance = round(6378.138*2*asin(sqrt(pow(sin(( $p1_x *pi()/180-$p2_x*pi()/180)/2),2)+cos( $p1_x *pi()/180)*cos($p2_x*pi()/180)* pow(sin(( $p1_y *pi()/180-$p2_y*pi()/180)/2),2)))*1000);
  724. // 是否计算为字符串公里距离
  725. if( !$calc_as_string ){
  726. return (string)round( $distance / 1000 , 1 ) . 'km';
  727. }
  728. // 如果计算为字符串公里距离
  729. if( $distance / 1000 > 1 ){
  730. $k = (string)round( $distance / 1000 , 1 );
  731. $m = (string)$distance % 1000 ;
  732. // $distance = "{$k}公里{$m}米";
  733. $distance = "{$k}km";
  734. }
  735. else{
  736. $distance = "{$distance}m";
  737. }
  738. return $distance;
  739. }
  740. //打招呼/搭讪
  741. public function greet() {
  742. if ($this->auth->gender == 0 && $this->auth->real_status != 1 && $this->auth->idcard_status != 1) {
  743. $this->error('请先完成实名认证或真人认证');
  744. }
  745. $other_uid = input('user_id', 0, 'intval');
  746. if(!$other_uid) {
  747. $this->error(__('Invalid parameters'));
  748. }
  749. if($other_uid == $this->auth->id){
  750. $this->error('这是您自己');
  751. }
  752. $checkuser = Db::name('user')->find($other_uid);
  753. if(empty($checkuser)) {
  754. $this->error('此用户不存在');
  755. }
  756. $map = [
  757. 'user_id' => $this->auth->id,
  758. 'user_to_id' => $other_uid,
  759. ];
  760. // 取消限制 2023年12月14日 18点47分
  761. // $check = Db::name('user_greet')->where($map)->find();
  762. // if($check){
  763. // $this->error('已经打过招呼了');
  764. // }
  765. $map['createtime'] = time();
  766. Db::startTrans();
  767. $id = Db::name('user_greet')->insertGetId($map);
  768. if (!$id) {
  769. Db::rollback();
  770. $this->error('您的网络开小差了~');
  771. }
  772. //tag任务赠送金币
  773. //搭讪奖励
  774. $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,24);
  775. if($task_rs === false){
  776. Db::rollback();
  777. $this->error('完成任务赠送奖励失败');
  778. }
  779. Db::commit();
  780. $gift_greet = Db::name('gift_greet')->find();
  781. if ($gift_greet) {
  782. $gift_greet['special'] = one_domain_image($gift_greet['special']);
  783. $gift_greet['image'] = one_domain_image($gift_greet['image']);
  784. } else {
  785. $gift_greet = (object)[];
  786. }
  787. $this->success('操作成功', $gift_greet);
  788. }
  789. //女号私信异性完成任务
  790. public function girlchattask() {
  791. if ($this->auth->gender != 0) { //只有女生可以
  792. $this->error('您的网络开小差啦~');
  793. }
  794. //检测用户
  795. $to_user_id = input_post('to_user_id');
  796. $to_user_info = Db::name('user')->field('id,real_status,gender,free_video,free_audio,free_typing,chat_price,is_kefu')->where('id',$to_user_id)->find();
  797. if(!$to_user_info){
  798. $this->error('不存在的用户');
  799. }
  800. if ($to_user_info['is_kefu'] == 1 || $this->auth->is_kefu == 1) { //我是客服或者对方是客服
  801. $this->success('success');
  802. }
  803. if ($to_user_info['gender'] != 1) {
  804. $this->error('性别异常~');
  805. }
  806. $task_rs = \app\common\model\TaskLog::tofinish($this->auth->id,23);
  807. if($task_rs === false){
  808. $this->error('完成任务赠送奖励失败');
  809. }
  810. $this->success('success');
  811. }
  812. //腾讯内容审核回调方法
  813. public function tencentcall() {
  814. $content = file_get_contents('php://input');
  815. $content = json_decode($content, true);
  816. error_log(print_r($content, 1) . PHP_EOL, 3, './tencentcall3.txt');
  817. if (isset($content['Scene']) && $content['CtxcbResult'] == 1) { //语音文件: 只返回违规的数据; 处理方式: 撤回
  818. $tenim = new Tenim;
  819. $rs = $tenim->withdraw_message($content['From_Account'], $content['ContactItem']['To_Account'], $content['MsgID']);
  820. // error_log(print_r($rs, 1) . PHP_EOL, 3, './tencentcall4.txt');
  821. } elseif (isset($content['TaskId'])) { //音视频通话: 返回所有数据; 处理方式: 强制退出im, 清空token
  822. if ($content['Status'] == 'RUNNING') {
  823. //该字段用于返回所查询内容的任务状态。取值:FINISH(任务已完成)、PENDING (任务等待中)、RUNNING (任务进行中)、ERROR (任务出错)、CANCELLED (任务已取消)。
  824. if ($content['ImageSegments']) { //图片(视频)审核结果
  825. $image_info = $content['ImageSegments'][0]['Result'];
  826. if ($image_info['Label'] != 'Normal') {
  827. //该字段用于返回检测结果所对应的恶意标签。返回值:Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义违规;以及其他令人反感、不安全或不适宜的内容类型。
  828. $url = $image_info['Url']; //图片地址https://cos.ap-guangzhou.myqcloud.com/tianyu-cms-ap-guangzhou-1312781550/segment-/trtc/1400758343/screenshot_1431291856_2_1669880705.jpg?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDU2hLdl3CBZnuZ1rugInQEXxleKiEtIgHzkXoQu9u_1LZ_Cr9CmyRstQ34Fs_0ktH%2F20221201%2Fap-guangzhou%2Fs3%2Faws4_request&X-Amz-Date=20221201T074505Z&X-Amz-Expires=43200&X-Amz-Security-Token=HuyqAZVXXBWnWFOJZNLYInkTvVfFNqRab1d55d6d8642abaaa3d1c727ba06bd0eg37ybZOWCCsEawceCDvRAt1WL91GOzLIcdyC_DDX80alqE3M1GoQfUYRBETYm7eFxQ_wylmfSaomUU5hylq3twTxz9joT9g2rLfXhBmPeuvBia3n30gHeJtUeHJ7kaKjTDzZzPcq-B3t6hRximMVjKfQ9rKnJpjJGDKh-yqIpEUvyqFFl6Cf3d4lDoF87xwAAPya7Q2tMfZsMCyfgIMEqghMnGgWDMn9fMvDLl_82uGt8kK2TBGVymmeSx9GDGrDqBNo-hMC_EFR9jEUs87aDaD_gTNr2vLypRx87GnJhYCW7i-ExcfDfayKjXWy8LZeOtkc2Y0qDvzrEqcf5GtNBLPhgDzkbRyFgiWe99WsIrXH4RMlONiFitvvNAmWGvbv&X-Amz-SignedHeaders=host&X-Amz-Signature=e3b2a479c08d3fae95782e4bd62d88242726e095a771c28f38ccc7ed96c79d56
  829. //获取违规用户id
  830. $url = explode('?', $url);
  831. $url = $url[0];
  832. $user_id_url = explode('/', $url);
  833. $user_id_url = $user_id_url[count($user_id_url) - 1];
  834. $user_id_arr = explode('_', $user_id_url);
  835. $user_id = $user_id_arr[2];
  836. //退出im
  837. $tenIm = new Tenim();
  838. $tenIm->loginoutim($user_id);
  839. //清空token
  840. Token::clear($user_id);
  841. $tiaoshi = $user_id . '---' . $content['TaskId'] . '---' .$image_info['Label'] .'---'. date('Y-m-d H:i:s');
  842. error_log(print_r($tiaoshi, 1) . PHP_EOL, 3, './dayin1.txt');
  843. }
  844. } elseif ($content['AudioSegments']) { //音频审核结果
  845. $audio_info = $content['AudioSegments'][0]['Result'];
  846. if ($audio_info['Label'] != 'Normal') {
  847. //该字段用于返回检测结果所对应的恶意标签。返回值:Porn:色情,Abuse:谩骂,Ad:广告,Custom:自定义违规;以及其他令人反感、不安全或不适宜的内容类型。
  848. $url = $audio_info['Url']; //音频地址https://cos.ap-guangzhou.myqcloud.com/tianyu-cms-ap-guangzhou-1312781550/segment-/trtc/1400758343/audio_1431291856_354_1669880708.mp3?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIDU2hLdl3CBZnuZ1rugInQEXxleKiEtIgHzkXoQu9u_1LZ_Cr9CmyRstQ34Fs_0ktH%2F20221201%2Fap-guangzhou%2Fs3%2Faws4_request&X-Amz-Date=20221201T074520Z&X-Amz-Expires=43200&X-Amz-Security-Token=HuyqAZVXXBWnWFOJZNLYInkTvVfFNqRab1d55d6d8642abaaa3d1c727ba06bd0eg37ybZOWCCsEawceCDvRAt1WL91GOzLIcdyC_DDX80alqE3M1GoQfUYRBETYm7eFxQ_wylmfSaomUU5hylq3twTxz9joT9g2rLfXhBmPeuvBia3n30gHeJtUeHJ7kaKjTDzZzPcq-B3t6hRximMVjKfQ9rKnJpjJGDKh-yqIpEUvyqFFl6Cf3d4lDoF87xwAAPya7Q2tMfZsMCyfgIMEqghMnGgWDMn9fMvDLl_82uGt8kK2TBGVymmeSx9GDGrDqBNo-hMC_EFR9jEUs87aDaD_gTNr2vLypRx87GnJhYCW7i-ExcfDfayKjXWy8LZeOtkc2Y0qDvzrEqcf5GtNBLPhgDzkbRyFgiWe99WsIrXH4RMlONiFitvvNAmWGvbv&X-Amz-SignedHeaders=host&X-Amz-Signature=b1965689653813b59824647292565ec9297a7e81950bb88d8cbeb95f8393c1ca
  849. //获取违规用户id
  850. $url = explode('?', $url);
  851. $url = $url[0];
  852. $user_id_url = explode('/', $url);
  853. $user_id_url = $user_id_url[count($user_id_url) - 1];
  854. $user_id_arr = explode('_', $user_id_url);
  855. $user_id = $user_id_arr[2];
  856. //退出im
  857. $tenIm = new Tenim();
  858. $tenIm->loginoutim($user_id);
  859. //清空token
  860. Token::clear($user_id);
  861. $tiaoshi = $user_id . '---' . $content['TaskId'] . '---' .$audio_info['Label'] .'---'. date('Y-m-d H:i:s');
  862. error_log(print_r($tiaoshi, 1) . PHP_EOL, 3, './dayin2.txt');
  863. }
  864. }
  865. }
  866. }
  867. }
  868. //头条
  869. public function headlines() {
  870. $time = strtotime(date('Y-m-d', time()));
  871. //聊天送礼物
  872. $list1 = Db::name('gift_user_typing')->field('id, user_id, user_to_id, gift_name')->where(['createtime' => ['egt', $time]])->order('price desc, id desc')/*->page($this->page, $this->listrow)*/->select();
  873. //动态送礼物
  874. $list2 = Db::name('gift_user_dongtai')->field('id, user_id, user_to_id, gift_name')->where(['createtime' => ['egt', $time]])->order('price desc, id desc')/*->page($this->page, $this->listrow)*/->select();
  875. $list = array_merge($list1, $list2);
  876. if ($list) {
  877. $mt_user = Db::name('user');
  878. foreach ($list as &$v) {
  879. $user_info= $mt_user->field('nickname, avatar')->where(['id' => $v['user_id']])->find();
  880. $v['from_nickname'] = '有缘人';//$user_info['nickname'];
  881. $v['avatar'] = one_domain_image($user_info['avatar']);
  882. $v['to_nickname'] = '有缘人';//$mt_user->where(['id' => $v['user_to_id']])->value('nickname');
  883. }
  884. }
  885. $this->success('头条', $list);
  886. }
  887. //查询每天弹出搭讪框次数
  888. public function freegreetnum() {
  889. $user = $this->auth->getUser();
  890. if (isset($user['is_kefu']) && $user['is_kefu'] == 1){
  891. $data['free_greet_num'] = 0;
  892. $data['vip_free_greet_num'] = 0;
  893. $data['boy_free_greet_num'] = 0;
  894. $data['boy_vip_free_greet_num'] = 0;
  895. }else{
  896. //非会员每天弹出搭讪框次数
  897. $data['free_greet_num'] = config('site.free_greet_num') > 0 ? config('site.free_greet_num') : 5;
  898. //vip每天弹出搭讪框次数
  899. $data['vip_free_greet_num'] = config('site.vip_free_greet_num') > 0 ? config('site.vip_free_greet_num') : 5;
  900. // 男性 非会员每天弹出搭讪框次数
  901. $data['boy_free_greet_num'] = config('site.boy_free_greet_num') > 0 ? config('site.boy_free_greet_num') : 1;
  902. // 男性 vip每天弹出搭讪框次数
  903. $data['boy_vip_free_greet_num'] = config('site.boy_vip_free_greet_num') > 0 ? config('site.boy_vip_free_greet_num') : 1;
  904. }
  905. $this->success('success', $data);
  906. }
  907. /**
  908. * 男性打招呼内容
  909. * @return void
  910. * @throws \think\db\exception\DataNotFoundException
  911. * @throws \think\db\exception\ModelNotFoundException
  912. * @throws \think\exception\DbException
  913. */
  914. public function greetBoy()
  915. {
  916. $data = Db::name('user_greet_boy')->select();
  917. $this->success('success', $data);
  918. }
  919. //首页顶部分类名称
  920. public function typename() {
  921. $typename = config('site.typename');
  922. $typename = explode(',', $typename);
  923. $data[] = $typename[0] ? : '推荐';
  924. $data[] = $typename[1] ? : '附近';
  925. $data[] = $typename[2] ? : '新人';
  926. $this->success('sussess', $data);
  927. }
  928. //获取版本更新信息
  929. public function getversion() {
  930. // 获取二维码
  931. $is_force = config("site.is_force"); //是否强制更新 1是 0否
  932. $apk_url = config("site.apk_url"); //下载链接
  933. $apk_name = config("site.apk_name"); //apk更新标题
  934. $apk_desc = config("site.apk_desc"); //apk更新描述
  935. $version_code = config("site.version_code"); //版本迭代号
  936. $data['is_force'] = $is_force;
  937. $data['apk_url'] = $apk_url;
  938. $data['apk_name'] = $apk_name;
  939. $data['apk_desc'] = $apk_desc;
  940. $data['version_code'] = $version_code;
  941. $this->success('Success', $data);
  942. }
  943. // 获取版本更新信息(知心app)
  944. public function getversionZx() {
  945. // 获取二维码
  946. $is_force = config("site.is_force_zx"); //是否强制更新 1是 0否
  947. $apk_url = config("site.apk_url_zx"); //下载链接
  948. $apk_name = config("site.apk_name_zx"); //apk更新标题
  949. $apk_desc = config("site.apk_desc_zx"); //apk更新描述
  950. $version_code = config("site.version_code_zx"); //版本迭代号
  951. $data['is_force'] = $is_force;
  952. $data['apk_url'] = $apk_url;
  953. $data['apk_name'] = str_replace('知音','知心',$apk_name);
  954. $data['apk_desc'] = $apk_desc;
  955. $data['version_code'] = $version_code;
  956. $this->success('Success', $data);
  957. }
  958. //获取ios版本更新信息
  959. public function getiosversion() {
  960. // 获取二维码
  961. $is_force = config("site.ios_is_force"); //是否强制更新 1是 0否
  962. $apk_url = config("site.ios_apk_url"); //下载链接
  963. $apk_name = config("site.ios_apk_name"); //apk更新标题
  964. $apk_desc = config("site.ios_apk_desc"); //apk更新描述
  965. $version_code = config("site.ios_version_code"); //版本迭代号
  966. $data['is_force'] = $is_force;
  967. $data['apk_url'] = $apk_url;
  968. $data['apk_name'] = $apk_name;
  969. $data['apk_desc'] = $apk_desc;
  970. $data['version_code'] = $version_code;
  971. $this->success('Success', $data);
  972. }
  973. }