TradeController.class.php 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602
  1. <?php
  2. /* 交易中心 */
  3. namespace Home\Controller;
  4. class TradeController extends HomeController
  5. {
  6. protected function _initialize()
  7. {
  8. parent::_initialize();
  9. $allow_action=array("index","bborder","bbhistoryorder","tradelist","ordinary","ordinaryh","trans","transinfo","upbbbuy","getprice","upbbsell","clearorder","tradebill","billinfo");
  10. if(!in_array(ACTION_NAME,$allow_action)){
  11. $this->error(L("非法操作!"));
  12. }
  13. }
  14. //取消委托订单
  15. public function clearorder($oid=null){
  16. if(checkstr($oid)){
  17. $this->ajaxReturn(['code'=>0,'info'=>L('缺少重要参数')]);
  18. }
  19. $oinfo = M("bborder")->where(array('id'=>$oid))->find();
  20. if(empty($oinfo)){
  21. $this->ajaxReturn(['code'=>0,'info'=>L('委托订单不存在')]);
  22. }
  23. $uid = $oinfo['uid'];
  24. $type = $oinfo['type'];
  25. //买入委托
  26. if($type == 1){
  27. $coin = "usdt";
  28. $num = $oinfo['usdtnum'];
  29. //出售委托
  30. }elseif($type == 2){
  31. $coin = strtolower($oinfo['coin']);
  32. $num = $oinfo['coinnum'];
  33. }
  34. $upre = M("bborder")->where(array('id'=>$oid))->save(array('status'=>3,'tradetime'=>date("Y-m-d H:i:s",time())));
  35. $coind = $coin."d";
  36. //把冻结的资产转移到可用资产里
  37. $decre = M("user_coin")->where(array('userid'=>$uid))->setDec($coind,$num);
  38. $incre = M("user_coin")->where(array('userid'=>$uid))->setInc($coin,$num);
  39. if($upre && $decre && $incre){
  40. $this->ajaxReturn(['code'=>1,'info'=>L('订单已撤消')]);
  41. }else{
  42. $this->ajaxReturn(['code'=>0,'info'=>L('订单撤消失败')]);
  43. }
  44. }
  45. //订单中心币币订单
  46. public function bborder(){
  47. $uid = userid();
  48. if($uid <= 0){
  49. $this->redirect('Login/index');
  50. }
  51. //全总未交易委托
  52. $list = M("bborder")->where(array('uid'=>$uid,'ordertype'=>1,'status'=>1))->order('id desc')->select();
  53. $this->assign('list',$list);
  54. $this->display();
  55. }
  56. //全部委托订单及交易记录
  57. public function bbhistoryorder(){
  58. $uid = userid();
  59. if($uid <= 0){
  60. $this->redirect('Login/index');
  61. }
  62. //全部交易记录
  63. $list = M("bborder")->where("uid = {$uid} and status != 1")->order('id desc')->select();
  64. $this->assign('list',$list);
  65. $this->display();
  66. }
  67. //成交详情
  68. public function billinfo($id = null){
  69. $uid = userid();
  70. if($uid <= 0){
  71. $this->redirect('Login/index');
  72. }
  73. $info = M("bborder")->where(array('id'=>$id))->find();
  74. $this->assign('info',$info);
  75. $this->display();
  76. }
  77. //全部委托订单及交易记录
  78. public function tradebill(){
  79. $uid = userid();
  80. if($uid <= 0){
  81. $this->redirect('Login/index');
  82. }
  83. //全总未交易委托
  84. $list = M("bborder")->where(array('uid'=>$uid,'ordertype'=>1,'status'=>1))->order('id desc')->select();
  85. $this->assign('list',$list);
  86. //全部交易记录
  87. $alllist = M("bborder")->where("uid = {$uid} and status != 1")->order('id desc')->select();
  88. $this->assign('alllist',$alllist);
  89. //全部成交记录
  90. $finishlist = M("bborder")->where(array('uid'=>$uid,'status'=>2))->order('id desc')->select();
  91. $this->assign('finishlist',$finishlist);
  92. $this->display();
  93. }
  94. //币币交易出售处理
  95. public function upbbsell($symbol=null,$mprice=null,$mnum=null,$musdt=null,$selltype=null,$type=null){
  96. if(checkstr($symbol)||checkstr($mprice)||checkstr($mnum)||checkstr($musdt)||checkstr($buytype)||checkstr($type)){
  97. $this->ajaxReturn(['code'=>0,'info'=>L('您输入的信息有误')]);
  98. }
  99. //判断是否开市
  100. $nowtime = date('H:i',time());
  101. $bbset = M("bbsetting")->where(array('id'=>1))->find();
  102. $kstime = explode("~",$bbset['bb_kstime']);
  103. $start = $kstime[0];
  104. $end = $kstime[1];
  105. if($nowtime < $start || $nowtime > $end){
  106. $this->ajaxReturn(['code'=>0,'info'=>L('未开市')]);
  107. }
  108. //判断登陆
  109. $uid = userid();
  110. $uinfo = M("user")->where(array('id'=>$uid))->field("id,username,rzstatus,is_tax,taxstatus")->find();
  111. if(empty($uinfo)){
  112. $this->ajaxReturn(['code'=>0,'info'=>L('请先登录')]);
  113. }
  114. if($uinfo['rzstatus'] != 2){
  115. $this->ajaxReturn(['code'=>0,'info'=>L('请先完成实名认证')]);
  116. }
  117. //检查该会员是不是需要缴纳税金,如有需要检查有没有缴纳
  118. if($uinfo['is_tax'] == 1){
  119. if($uinfo['taxstatus'] != 1){
  120. $this->ajaxReturn(['code'=>3]);
  121. }
  122. }
  123. if($symbol == ''){
  124. $this->ajaxReturn(['code'=>0,'info'=>L('缺少重要参数')]);
  125. }
  126. $arr = explode("/",$symbol);
  127. $coin = $arr[0];
  128. if($coin == "UKB"){
  129. $marketinfo = M("ctmarket")->where(array('coinname'=>"ukb"))->field("state")->find();
  130. if($marketinfo['state'] != 1){
  131. $this->ajaxReturn(['code'=>0,'info'=>L('禁止交易')]);
  132. }
  133. }
  134. $lowercname = strtolower($arr[0]);
  135. $lowercoin = strtolower($arr[0]).strtolower($arr[1]);
  136. $coinname = strtoupper($coin);
  137. //查手续费比例
  138. $coininfo = M("coin")->where(array('name'=>$coinname))->field("bbsxf")->find();
  139. $sxf = $coininfo['bbsxf'];
  140. if($sxf < 0){
  141. $sxf = 0;
  142. }
  143. //查账户余额
  144. $minfo = M("user_coin")->where(array('userid'=>$uid))->find();
  145. $coin_blance = $minfo[$lowercname];
  146. if($coin_blance < $mnum){
  147. $this->ajaxReturn(['code'=>0,'info'=>L($lowercname.'余额不足')]);
  148. }
  149. //限价必须有出售数量 限价单价
  150. if($selltype == 1){
  151. if($mnum <= 0){
  152. $this->ajaxReturn(['code'=>0,'info'=>L('请输入出售额度')]);
  153. }
  154. if($mprice <= 0){
  155. $this->ajaxReturn(['code'=>0,'info'=>L('请输入限价价格')]);
  156. }
  157. //写入交易记录
  158. $xjdata['uid'] = $uid;
  159. $xjdata['account'] = $uinfo['username'];
  160. $xjdata['type'] = 2;
  161. $xjdata['ordertype'] = 1;
  162. $xjdata['symbol'] = $symbol;
  163. $xjdata['coin'] = $coin;
  164. $xjdata['coinnum'] = $mnum;
  165. $xjdata['xjprice'] = $mprice;
  166. $xjdata['addtime'] = date("Y-m-d H:i:s",time());
  167. $xjdata['coin'] = $coin;
  168. $xjdata['status'] = 1;
  169. $xjdata['sxfbl'] = $sxf;
  170. $addre = M("bborder")->add($xjdata);
  171. //把资产转入冻结字段
  172. $decre = M("user_coin")->where(array('userid'=>$uid))->setDec($lowercname,$mnum);
  173. $incre = M("user_coin")->where(array('userid'=>$uid))->setInc($lowercname."d",$mnum);
  174. if($addre && $decre && $incre){
  175. $this->ajaxReturn(['code'=>1,'info'=> L('订单委托成功')]);
  176. }else{
  177. $this->ajaxReturn(['code'=>0,'info'=> L('订单委托失败')]);
  178. }
  179. //市价 出售数量,获取当前单价
  180. }elseif($selltype == 2){
  181. if($mnum <= 0){
  182. $this->ajaxReturn(['code'=>0,'info'=>L('请输入出售额度')]);
  183. }
  184. if($coin == "UKB"){
  185. $priceinfo = M("market")->where(array('name'=>"ukb_usdt"))->field("new_price")->find();
  186. $close = $priceinfo['new_price'];//现价
  187. }else{
  188. //获取当前交易对价格
  189. $url = "https://api.huobi.pro/market/history/kline?period=1day&size=1&symbol=".$lowercoin;
  190. $result = $this->getprice($url);
  191. $pdata = $result['data'][0];
  192. $close = $pdata['close'];//现价
  193. }
  194. //求出卖出所得USDT
  195. $allusdt = $mnum * $close;
  196. //手续费
  197. $sxfnum = $allusdt * $sxf / 100;
  198. //实际到账USDT
  199. $tusdt = $allusdt - $sxfnum;
  200. //写入交易记录
  201. $sjdata['uid'] = $uid;
  202. $sjdata['account'] = $uinfo['username'];
  203. $sjdata['type'] = 2;
  204. $sjdata['ordertype'] = 2;
  205. $sjdata['symbol'] = $symbol;
  206. $sjdata['coin'] = $coin;
  207. $sjdata['coinnum'] = $mnum;
  208. $sjdata['usdtnum'] = $tusdt;
  209. $sjdata['price'] = $close;
  210. $sjdata['xjprice'] = $close;
  211. $sjdata['addtime'] = date("Y-m-d H:i:s",time());
  212. $sjdata['tradetime'] = date("Y-m-d H:i:s",time());
  213. $sjdata['fee'] = $sxfnum;
  214. $sjdata['sxfbl'] = $sxf;
  215. $sjdata['status'] = 2;
  216. $addre = M("bborder")->add($sjdata);
  217. //扣除卖出额度并写入日志
  218. $decre = M("user_coin")->where(array('userid'=>$uid))->setDec($lowercname,$mnum);
  219. $cbill['uid'] = $uid;
  220. $cbill['username'] = $uinfo['username'];
  221. $cbill['num'] = $mnum;
  222. $cbill['coinname'] = $lowercname;
  223. $cbill['afternum'] = $minfo[$lowercname] - $mnum;
  224. $cbill['type'] = 10;
  225. $cbill['addtime'] = date("Y-m-d H:i:s",time());
  226. $cbill['st'] = 2;
  227. $cbill['remark'] = L('币币交易出售').$coin;
  228. $cbillre = M("bill")->add($cbill);
  229. //增加USDT数量并写入日志
  230. $incre = M("user_coin")->where(array('userid'=>$uid))->setInc("usdt",$tusdt);
  231. $ubill['uid'] = $uid;
  232. $ubill['username'] = $uinfo['username'];
  233. $ubill['num'] = $tusdt;
  234. $ubill['coinname'] = "usdt";
  235. $ubill['afternum'] = $minfo['usdt'] + $tusdt;
  236. $ubill['type'] = 9;
  237. $ubill['addtime'] = date("Y-m-d H:i:s",time());
  238. $ubill['st'] = 1;
  239. $ubill['remark'] = L('币币交易出售').$coin;
  240. $ubillre = M("bill")->add($ubill);
  241. if($addre && $decre && $cbillre && $incre && $ubillre){
  242. $this->ajaxReturn(['code'=>1,"info"=>L('出售成功')]);
  243. }else{
  244. $this->ajaxReturn(['code'=>0,"info"=>L('出售失败')]);
  245. }
  246. }
  247. }
  248. //币币交易购买处理
  249. public function upbbbuy($symbol=null,$mprice=null,$mnum=null,$musdt=null,$buytype=null,$type=null){
  250. if(checkstr($symbol)||checkstr($mprice)||checkstr($mnum)||checkstr($musdt)||checkstr($buytype)||checkstr($type)){
  251. $this->ajaxReturn(['code'=>0,'info'=>L('您输入的信息有误')]);
  252. }
  253. //判断是否开市
  254. $nowtime = date('H:i',time());
  255. $bbset = M("bbsetting")->where(array('id'=>1))->find();
  256. $kstime = explode("~",$bbset['bb_kstime']);
  257. $start = $kstime[0];
  258. $end = $kstime[1];
  259. if($nowtime < $start || $nowtime > $end){
  260. $this->ajaxReturn(['code'=>0,'info'=>L('未开市')]);
  261. }
  262. $uid = userid();
  263. $uinfo = M("user")->where(array('id'=>$uid))->field("id,username,rzstatus,is_tax,taxstatus")->find();
  264. if(empty($uinfo)){
  265. $this->ajaxReturn(['code'=>0,'info'=>L('请先登录')]);
  266. }
  267. if($uinfo['rzstatus'] != 2){
  268. $this->ajaxReturn(['code'=>0,'info'=>L('请先完成实名认证')]);
  269. }
  270. //检查该会员是不是需要缴纳税金,如有需要检查有没有缴纳
  271. if($uinfo['is_tax'] == 1){
  272. if($uinfo['taxstatus'] != 1){
  273. $this->ajaxReturn(['code'=>3]);
  274. }
  275. }
  276. if($symbol == ''){
  277. $this->ajaxReturn(['code'=>0,'info'=>L('缺少重要参数')]);
  278. }
  279. $arr = explode("/",$symbol);
  280. $coin = $arr[0];
  281. if($coin == "UKB"){
  282. $marketinfo = M("ctmarket")->where(array('coinname'=>"ukb"))->field("state")->find();
  283. if($marketinfo['state'] != 1){
  284. $this->ajaxReturn(['code'=>0,'info'=>L('禁止交易')]);
  285. }
  286. }
  287. $lowercoin = strtolower($arr[0]).strtolower($arr[1]);
  288. $coinname = strtoupper($coin);
  289. $coininfo = M("coin")->where(array('name'=>$coinname))->field("bbsxf")->find();
  290. $sxf = $coininfo['bbsxf'];
  291. if($sxf < 0){
  292. $sxf = 0;
  293. }
  294. //需要查会员的账号USDT余额
  295. $minfo = M("user_coin")->where(array('userid'=>$uid))->find();
  296. if($musdt > $minfo['usdt']){
  297. $this->ajaxReturn(['code'=>0,'info'=>L('USDT余额不足')]);
  298. }
  299. //限价必须有单价,USDT量
  300. //市价必须有USDT量,再获取当前最新单价
  301. if($buytype == 1){//限价
  302. if($mprice <= 0){
  303. $this->ajaxReturn(['code'=>0,'info'=>L('请输入限价价格')]);
  304. }
  305. if($musdt <= 0){
  306. $this->ajaxReturn(['code'=>0,'info'=>L('请输入买入金额')]);
  307. }
  308. $xjdata['uid'] = $uid;
  309. $xjdata['account'] = $uinfo['username'];
  310. $xjdata['type'] = 1;
  311. $xjdata['ordertype'] = 1;
  312. $xjdata['symbol'] = $symbol;
  313. $xjdata['coin'] = $coin;
  314. $xjdata['usdtnum'] = $musdt;
  315. $xjdata['xjprice'] = $mprice;
  316. $xjdata['addtime'] = date("Y-m-d H:i:s",time());
  317. $xjdata['coin'] = $coin;
  318. $xjdata['status'] = 1;
  319. $xjdata['sxfbl'] = $sxf;
  320. //添加限价委托记录
  321. $addre = M("bborder")->add($xjdata);
  322. //把USDT转入冻结字段
  323. $decre = M("user_coin")->where(array('userid'=>$uid))->setDec('usdt',$musdt);
  324. $incre = M("user_coin")->where(array('userid'=>$uid))->setInc('usdtd',$musdt);
  325. if($addre && $decre && $incre){
  326. $this->ajaxReturn(['code'=>1,'info'=> L('订单委托成功')]);
  327. }
  328. }elseif($buytype == 2){//市价
  329. if($musdt <= 0){
  330. $this->ajaxReturn(['code'=>0,'info'=>L('请输入买入金额')]);
  331. }
  332. if($coin == "UKB"){
  333. $priceinfo = M("market")->where(array('name'=>"ukb_usdt"))->field("new_price")->find();
  334. $close = $priceinfo['new_price'];//现价
  335. }else{
  336. //获取当前交易对价格
  337. $url = "https://api.huobi.pro/market/history/kline?period=1day&size=1&symbol=".$lowercoin;
  338. $result = $this->getprice($url);
  339. $pdata = $result['data'][0];
  340. $close = $pdata['close'];//现价
  341. }
  342. //计算买入币的量
  343. $coinnum = sprintf("%.8f",($musdt / $close));
  344. //计算手续费
  345. $sxfnum = $coinnum * $sxf / 100;
  346. //实际到账号的币量
  347. $tnum = $coinnum - $sxfnum;
  348. $sjdata['uid'] = $uid;
  349. $sjdata['account'] = $uinfo['username'];
  350. $sjdata['type'] = 1;
  351. $sjdata['ordertype'] = 2;
  352. $sjdata['symbol'] = $symbol;
  353. $sjdata['coin'] = $coin;
  354. $sjdata['coinnum'] = $coinnum;
  355. $sjdata['usdtnum'] = $musdt;
  356. $sjdata['price'] = $close;
  357. $sjdata['xjprice'] = $close;
  358. $sjdata['addtime'] = date("Y-m-d H:i:s",time());
  359. $sjdata['tradetime'] = date("Y-m-d H:i:s",time());
  360. $sjdata['fee'] = $sxfnum;
  361. $sjdata['sxfbl'] = $sxf;
  362. $sjdata['status'] = 2;
  363. $lowercoin = strtolower($coin);
  364. //生成交易记录
  365. $addre = M("bborder")->add($sjdata);
  366. //扣除USDT额度并写日志
  367. $decre = M("user_coin")->where(array('userid'=>$uid))->setDec('usdt',$musdt);
  368. $ubill['uid'] = $uid;
  369. $ubill['username'] = $uinfo['username'];
  370. $ubill['num'] = $musdt;
  371. $ubill['coinname'] = "usdt";
  372. $ubill['afternum'] = $minfo['usdt'] - $musdt;
  373. $ubill['type'] = 9;
  374. $ubill['addtime'] = date("Y-m-d H:i:s",time());
  375. $ubill['st'] = 2;
  376. $ubill['remark'] = L('币币交易购买').$coin;
  377. $ubillre = M("bill")->add($ubill);
  378. //增加币种额度并写日志
  379. $incre = M("user_coin")->where(array('userid'=>$uid))->setInc($lowercoin,$tnum);
  380. $cbill['uid'] = $uid;
  381. $cbill['username'] = $uinfo['username'];
  382. $cbill['num'] = $coinnum;
  383. $cbill['coinname'] = $lowercoin;
  384. $cbill['afternum'] = $minfo[$lowercoin] + $coinnum;
  385. $cbill['type'] = 10;
  386. $cbill['addtime'] = date("Y-m-d H:i:s",time());
  387. $cbill['st'] = 1;
  388. $cbill['remark'] = L('币币交易购买').$coin;
  389. $cbillre = M("bill")->add($cbill);
  390. if($addre && $decre && $ubillre && $incre && $cbillre){
  391. $this->ajaxReturn(['code'=>1,'info'=>L('交易成功')]);
  392. }else{
  393. $this->ajaxReturn(['code'=>0,'info'=>L('交易失败')]);
  394. }
  395. }
  396. }
  397. //获取行情数据
  398. public function getprice($api){
  399. $ch = curl_init();
  400. curl_setopt($ch, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);
  401. curl_setopt ($ch, CURLOPT_URL, $api );
  402. curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
  403. curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT,10);
  404. $result = json_decode(curl_exec($ch),true);
  405. return $result;
  406. }
  407. //币币交易详情页面
  408. public function transinfo(){
  409. $uid = userid();
  410. $symbol = trim(I('get.symbol'));
  411. $coin = strtolower($symbol);
  412. $minfo = M("user_coin")->where(array('userid'=>$uid))->find();
  413. $usdt_blance = $minfo['usdt'];
  414. $coin_blance = $minfo[$coin];
  415. $this->assign('usdt_blance',$usdt_blance);
  416. $this->assign('coin_blance',$coin_blance);
  417. $this->assign('uid',$uid);
  418. $coinname = $symbol."/"."USDT";
  419. $this->assign('coinname',$coinname);
  420. $this->assign('symbol',$symbol);
  421. $where['ordertype'] = 1;
  422. $where['status'] = 1;
  423. $where['uid'] = $uid;
  424. $where['coin'] = array('eq',$symbol);
  425. $list = M("bborder")->where($where)->select();
  426. $this->assign('list',$list);
  427. $this->display();
  428. }
  429. //币币交易页面
  430. public function trans(){
  431. $uid = userid();
  432. $this->assign('uid',$uid);
  433. $sytx = trim(I('get.sytx'));
  434. $txarr = explode('/',$sytx);
  435. $symbol = $txarr[0];
  436. $market = strtolower($txarr[0].$txarr[1]);
  437. if($symbol == ''){
  438. $symbol = 'btc';
  439. }
  440. if($market == ''){
  441. $market = 'btcusdt';
  442. }
  443. $upmarket = strtoupper($symbol)."/USDT";
  444. $this->assign('upmarket',$upmarket);
  445. $this->assign('market', $market);
  446. $this->assign('smybol',$symbol);
  447. $lowercoin = strtolower($symbol);
  448. $cmarket = M("ctmarket")->where(array('coinname'=>$lowercoin))->field("state")->find();
  449. $state = $cmarket['state'];
  450. $this->assign('state',$state);
  451. $this->display();
  452. }
  453. //交易市场
  454. public function index(){
  455. $uid = userid();
  456. $list = M("ctmarket")->where(array('status'=>1))->field("coinname,id")->select();
  457. $this->assign("market",$list);
  458. $symbol = trim(I('get.symbol'));
  459. if($symbol == ''){
  460. $symbol = 'btc';
  461. }
  462. $coin = strtolower($symbol);
  463. $minfo = M("user_coin")->where(array('userid'=>$uid))->find();
  464. $usdt_blance = $minfo['usdt'];
  465. $coin_blance = $minfo[$coin];
  466. $this->assign('usdt_blance',$usdt_blance);
  467. $this->assign('coin_blance',$coin_blance);
  468. $this->assign('uid',$uid);
  469. $coinname = strtoupper($symbol)."/"."USDT";
  470. $this->assign('coinname',$coinname);
  471. $this->assign('symbol',$symbol);
  472. $this->assign('list',$list);
  473. $market= $coin.'usdt';
  474. $this->assign('market',$market);
  475. $this->display();
  476. }
  477. /**
  478. * 普通K线图
  479. */
  480. public function ordinaryh($market = NULL)
  481. {
  482. if($market == ''){
  483. $market = "btcusdt";
  484. }
  485. $this->assign('market', $market);
  486. $this->display();
  487. }
  488. /**
  489. * 普通K线图
  490. */
  491. public function ordinary($market = NULL)
  492. {
  493. if($market == ''){
  494. $market = "btcusdt";
  495. }
  496. $this->assign('market', $market);
  497. $this->display();
  498. }
  499. /**
  500. * 专业K线图
  501. * @param [type] $market [description]
  502. * @return [type] [description]
  503. */
  504. public function specialty($market = NULL)
  505. {
  506. // 过滤非法字符----------------S
  507. if (checkstr($market)) {
  508. $this->error(L('您输入的信息有误'));
  509. }
  510. // 过滤非法字符----------------E
  511. if (!$market) {
  512. $market = C('market_mr');
  513. }
  514. $this->assign('market', $market);
  515. $this->display();
  516. }
  517. }
  518. ?>