SiteUrl.php 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687
  1. <?php
  2. /*****初始路由*************/
  3. namespace app\common\components;
  4. use Yii;
  5. use yii\helpers\Url;
  6. class SiteUrl {
  7. //首页
  8. public static function home($share_no='')
  9. {
  10. if(!empty($share_no))
  11. {
  12. return Url::to(['/web/default/index',Yii::$app->params['shareArgName']=>$share_no],true);
  13. }
  14. else
  15. {
  16. return Url::to(['/web/default/index'],true);
  17. }
  18. }
  19. //栏目展示
  20. public static function catlist()
  21. {
  22. return Url::to(['/web/default/catlist'],true);
  23. }
  24. //用户中心首页
  25. public static function ucenter()
  26. {
  27. $url = Url::to(['/ucenter/default/index'],true);
  28. return $url;
  29. }
  30. public static function loginhome($refer_page='')
  31. {
  32. if(!empty($refer_page))
  33. {
  34. $url = Url::to(['/ucenter/default/loginhome',Yii::$app->params['referPageName']=>$refer_page],true);
  35. }
  36. else
  37. {
  38. return Url::to(['/ucenter/default/loginhome'],true);
  39. }
  40. return $url;
  41. }
  42. public static function login($refer_page='')
  43. {
  44. if(!empty($refer_page))
  45. {
  46. $url = Url::to(['/ucenter/default/login',Yii::$app->params['referPageName']=>$refer_page],true);
  47. }
  48. else
  49. {
  50. $url = Url::to(['/ucenter/default/login'],true);
  51. }
  52. return $url;
  53. }
  54. public static function logout()
  55. {
  56. return Url::to(['/ucenter/default/logout'],true);
  57. }
  58. public static function register()
  59. {
  60. return Url::to(['/ucenter/default/register'],true);
  61. }
  62. public static function forgetpwd()
  63. {
  64. return Url::to(['/ucenter/default/forgetpwd'],true);
  65. }
  66. //账号设置
  67. public static function myaccount($tab=null)
  68. {
  69. if(empty($tab))
  70. {
  71. return Url::to(['/ucenter/default/account'],true);
  72. }
  73. else
  74. {
  75. return Url::to(['/ucenter/default/account','tab'=>$tab],true);
  76. }
  77. }
  78. //实名认证
  79. public static function certindex()
  80. {
  81. return Url::to(['/ucenter/default/certindex'],true);
  82. }
  83. //个人认证
  84. public static function certuser()
  85. {
  86. return Url::to(['/ucenter/default/certuser'],true);
  87. }
  88. //企业认证
  89. public static function certorg()
  90. {
  91. return Url::to(['/ucenter/default/certorg'],true);
  92. }
  93. //充值金币
  94. public static function coincharge($refer_page='')
  95. {
  96. if(!empty($refer_page))
  97. {
  98. $url = Url::to(['/ucenter/default/coincharge',Yii::$app->params['referPageName']=>$refer_page],true);
  99. }
  100. else
  101. {
  102. $url = Url::to(['/ucenter/default/coincharge'],true);
  103. }
  104. return $url;
  105. }
  106. //金币日志
  107. public static function coinlog($type=1)
  108. {
  109. $url = Url::to(['/ucenter/default/coinlog','type'=>$type],true);
  110. return $url;
  111. }
  112. //现金日志
  113. public static function moneylog()
  114. {
  115. $url = Url::to(['/ucenter/default/moneylog'],true);
  116. return $url;
  117. }
  118. //积分日志
  119. public static function pointlog()
  120. {
  121. $url = Url::to(['/ucenter/default/pointlog'],true);
  122. return $url;
  123. }
  124. //我的下载
  125. public static function docpaylog()
  126. {
  127. $url = Url::to(['/ucenter/default/docpaylog'],true);
  128. return $url;
  129. }
  130. //我的收藏
  131. public static function myfavorite()
  132. {
  133. $url = Url::to(['/ucenter/default/myfavorite'],true);
  134. return $url;
  135. }
  136. //我的关注
  137. public static function myfocus()
  138. {
  139. $url = Url::to(['/ucenter/default/myfocus'],true);
  140. return $url;
  141. }
  142. //我的足迹
  143. public static function myhistory()
  144. {
  145. $url = Url::to(['/ucenter/default/myhistory'],true);
  146. return $url;
  147. }
  148. //我的订单
  149. public static function myorder($status=null)
  150. {
  151. if($status!=null)
  152. {
  153. $url = Url::to(['/ucenter/default/myorder','status'=>$status],true);
  154. }
  155. else
  156. {
  157. $url = Url::to(['/ucenter/default/myorder'],true);
  158. }
  159. return $url;
  160. }
  161. //收货地址
  162. public static function myaddress()
  163. {
  164. $url = Url::to(['/ucenter/default/myaddress'],true);
  165. return $url;
  166. }
  167. //我的邀请注册
  168. public static function myinvite($tab=1)
  169. {
  170. if($tab!=null)
  171. {
  172. $url = Url::to(['/ucenter/default/myinvite','tab'=>$tab],true);
  173. }
  174. else
  175. {
  176. $url = Url::to(['/ucenter/default/myinvite'],true);
  177. }
  178. return $url;
  179. }
  180. //我的消息
  181. public static function mymsg($type=1)
  182. {
  183. $url = Url::to(['/ucenter/default/mymsg','type'=>$type],true);
  184. return $url;
  185. }
  186. //提现账户
  187. public static function setbank($type=1)
  188. {
  189. $url = Url::to(['/ucenter/default/setbank','type'=>$type],true);
  190. return $url;
  191. }
  192. //余额提现
  193. public static function withdraw($tab=1)
  194. {
  195. $url = Url::to(['/ucenter/default/withdraw','tab'=>$tab],true);
  196. return $url;
  197. }
  198. //联系我们
  199. public static function contact()
  200. {
  201. $url = Url::to(['/ucenter/default/contact'],true);
  202. return $url;
  203. }
  204. //我的钱包
  205. public static function wallet()
  206. {
  207. $url = Url::to(['/ucenter/default/wallet'],true);
  208. return $url;
  209. }
  210. //上传文档
  211. public static function upload()
  212. {
  213. $url = Url::to(['/ucenter/uploader/single'],true);
  214. return $url;
  215. }
  216. //上传合辑
  217. public static function uploadcol()
  218. {
  219. $url = Url::to(['/ucenter/uploader/collect'],true);
  220. return $url;
  221. }
  222. //批量上传
  223. public static function multiupload()
  224. {
  225. $url = Url::to(['/ucenter/uploader/multi'],true);
  226. return $url;
  227. }
  228. //发布资源
  229. public static function uploadsource()
  230. {
  231. $url = Url::to(['/ucenter/uploader/source'],true);
  232. return $url;
  233. }
  234. //开通VIP
  235. public static function vip($refer_page='')
  236. {
  237. if(!empty($refer_page))
  238. {
  239. $url = Url::to(['/web/default/vip',Yii::$app->params['referPageName']=>$refer_page],true);
  240. }
  241. else
  242. {
  243. $url = Url::to(['/web/default/vip'],true);
  244. }
  245. return $url;
  246. }
  247. //生成关注公众号二维码(PC右侧浮动)
  248. public static function mpSubCode()
  249. {
  250. $url = Url::to(['/openauth/mpsub'],true);
  251. return $url;
  252. }
  253. //公众号授权登录(h5)
  254. public static function mpLogin($scene_id=NULL,$redirect=0,$uauth=null)
  255. {
  256. $bd_vid = \app\common\helpers\Cookie::getCookie('bd_vid');
  257. if($redirect>0)
  258. {
  259. if(!empty($uauth))
  260. {
  261. if(!empty($bd_vid))
  262. {
  263. $url = Url::to(['/ucenter/default/mplogin','scene_id'=>$scene_id,'redirect'=>$redirect,'uauth'=>$uauth,'bd_vid'=>$bd_vid],true);
  264. }
  265. else
  266. {
  267. $url = Url::to(['/ucenter/default/mplogin','scene_id'=>$scene_id,'redirect'=>$redirect,'uauth'=>$uauth],true);
  268. }
  269. }
  270. else
  271. {
  272. if(!empty($bd_vid))
  273. {
  274. $url = Url::to(['/ucenter/default/mplogin', 'scene_id' => $scene_id, 'redirect' => $redirect,'bd_vid'=>$bd_vid], true);
  275. }
  276. else
  277. {
  278. $url = Url::to(['/ucenter/default/mplogin', 'scene_id' => $scene_id, 'redirect' => $redirect], true);
  279. }
  280. }
  281. }
  282. else
  283. {
  284. if(!empty($uauth))
  285. {
  286. if(!empty($bd_vid))
  287. {
  288. $url = Url::to(['/ucenter/default/mplogin','scene_id'=>$scene_id,'uauth'=>$uauth,'bd_vid'=>$bd_vid],true);
  289. }
  290. else
  291. {
  292. $url = Url::to(['/ucenter/default/mplogin','scene_id'=>$scene_id,'uauth'=>$uauth],true);
  293. }
  294. }
  295. else
  296. {
  297. if(!empty($bd_vid))
  298. {
  299. $url = Url::to(['/ucenter/default/mplogin', 'scene_id' => $scene_id,'bd_vid'=>$bd_vid], true);
  300. }
  301. else
  302. {
  303. $url = Url::to(['/ucenter/default/mplogin', 'scene_id' => $scene_id], true);
  304. }
  305. }
  306. }
  307. return $url;
  308. }
  309. //绑定公众号(h5)
  310. public static function bindmp($hash=NULL)
  311. {
  312. $url = Url::to(['/ucenter/default/bindmp',Yii::$app->params['authHashName']=>$hash],true);
  313. return $url;
  314. }
  315. //搜索中转
  316. public static function searchSwitch()
  317. {
  318. return Url::to(['/web/default/searchswitch'],true);
  319. }
  320. //搜索
  321. public static function search($model_id,$keywords='')
  322. {
  323. return Url::to(['/web/default/search', 'model_id' => $model_id,'kw'=>urlencode($keywords)],true);
  324. }
  325. //搜索
  326. public static function searchForWeixin($model_id,$keywords='')
  327. {
  328. return Url::to(['/web/default/search', 'model_id' => $model_id,'kw'=>$keywords],true);
  329. }
  330. //文档列表
  331. public static function docList($cat_id=null)
  332. {
  333. if(empty($cat_id))
  334. {
  335. $url = Url::to(['/doc/default/list'],true);
  336. }
  337. else
  338. {
  339. $url = Url::to(['/doc/default/list'],true);
  340. $url = MultiSearchUrl::getSelfInstance(array('url'=>$url,'conditions'=>array('c'=>$cat_id),'filterAll'=>true))->createSearchCondition();
  341. }
  342. return $url;
  343. }
  344. //文档详情
  345. public static function docDetail($id,$order_sn='')
  346. {
  347. if(!empty($order_sn))
  348. {
  349. $url = Url::to(['/doc/default/detail','id'=>$id,'order_sn'=>$order_sn],true);
  350. }
  351. else
  352. {
  353. $url = Url::to(['/doc/default/detail','id'=>$id],true);
  354. }
  355. return $url;
  356. }
  357. //合辑列表
  358. public static function colList($cat_id=null)
  359. {
  360. if(empty($cat_id))
  361. {
  362. $url = Url::to(['/doc/default/collist'],true);
  363. }
  364. else
  365. {
  366. $url = Url::to(['/doc/default/collist'],true);
  367. $url = MultiSearchUrl::getSelfInstance(array('url'=>$url,'conditions'=>array('c'=>$cat_id),'filterAll'=>true))->createSearchCondition();
  368. }
  369. return $url;
  370. }
  371. //合辑详情
  372. public static function colDetail($id,$order_sn='')
  373. {
  374. if(!empty($order_sn))
  375. {
  376. $url = Url::to(['/doc/default/coldetail','id'=>$id,'order_sn'=>$order_sn],true);
  377. }
  378. else
  379. {
  380. $url = Url::to(['/doc/default/coldetail','id'=>$id],true);
  381. }
  382. return $url;
  383. }
  384. //个人主页
  385. public static function uHome($user_id)
  386. {
  387. $url = Url::to(['/web/default/uhome','user_id'=>$user_id],true);
  388. return $url;
  389. }
  390. //tag链接
  391. public static function tagLink($pinyin,$model_id=null)
  392. {
  393. if($model_id)
  394. {
  395. $url = Url::to(['/web/default/tag', 'model_id' => $model_id,'pinyin'=>$pinyin],true);
  396. }
  397. else
  398. {
  399. $url = Url::to(['/web/default/tag','pinyin'=>$pinyin],true);
  400. }
  401. return $url;
  402. }
  403. //资讯首页
  404. public static function newsHome()
  405. {
  406. $url = Url::to(['/cms/news/home'],true);
  407. return $url;
  408. }
  409. //资讯列表
  410. public static function newsList($cat_id=null)
  411. {
  412. if(empty($cat_id))
  413. {
  414. $url = Url::to(['/cms/news/list'],true);
  415. }
  416. else
  417. {
  418. $url = Url::to(['/cms/news/list'],true);
  419. $url = MultiSearchUrl::getSelfInstance(array('url'=>$url,'conditions'=>array('c'=>$cat_id),'filterAll'=>true))->createSearchCondition();
  420. }
  421. return $url;
  422. }
  423. //资讯详情
  424. public static function newsDetail($id)
  425. {
  426. $url = Url::to(['/cms/news/detail','id'=>$id],true);
  427. return $url;
  428. }
  429. //生成带下载码的链接(用于微信回复消息)
  430. public static function downByLink($downcode,$direct=0)
  431. {
  432. if(!empty($direct))
  433. {
  434. $downurl = Url::to(['/ajax/downdoc','downcode'=>$downcode,'direct'=>$direct],true);
  435. }
  436. else
  437. {
  438. $downurl = Url::to(['/ajax/downdoc','downcode'=>$downcode],true);
  439. }
  440. $url = Url::to(['/web/default/linkdown','downurl'=>base64_encode($downurl)],true);
  441. return $url;
  442. }
  443. //生成文档下载链接
  444. public static function docDownByCode($downcode,$direct=0)
  445. {
  446. if(!empty($direct))
  447. {
  448. $downurl = Url::to(['/ajax/downdoc','downcode'=>$downcode,'direct'=>$direct],true);
  449. }
  450. else
  451. {
  452. $downurl = Url::to(['/ajax/downdoc','downcode'=>$downcode],true);
  453. }
  454. return $downurl;
  455. }
  456. //单页
  457. public static function page($cat_id=0)
  458. {
  459. if($cat_id>0)
  460. {
  461. $url = Url::to(['/web/default/page','cat_id'=>$cat_id],true);
  462. }
  463. else
  464. {
  465. $url = Url::to(['/web/default/page'],true);
  466. }
  467. return $url;
  468. }
  469. //公告详情
  470. public static function announce($id=0)
  471. {
  472. if($id>0)
  473. {
  474. $url = Url::to(['/web/default/announce','id'=>$id],true);
  475. }
  476. else
  477. {
  478. $url = Url::to(['/web/default/announce'],true);
  479. }
  480. return $url;
  481. }
  482. //创作首页
  483. public static function writerindex()
  484. {
  485. $url = Url::to(['/ucenter/writer/index'],true);
  486. return $url;
  487. }
  488. //我的上传
  489. public static function myupload()
  490. {
  491. return Url::to(['/ucenter/writer/myupload'],true);
  492. }
  493. //管理文档
  494. public static function mydoc()
  495. {
  496. return Url::to(['/ucenter/writer/mydoc'],true);
  497. }
  498. //我的出售
  499. public static function mysales()
  500. {
  501. return Url::to(['/ucenter/writer/mysales'],true);
  502. }
  503. /*********************分销中心**********************/
  504. public static function mycommission()
  505. {
  506. return Url::to(['/ucenter/commission/index'],true);
  507. }
  508. public static function commissionteam($level=1)
  509. {
  510. return Url::to(['/ucenter/commission/team','level'=>$level],true);
  511. }
  512. public static function commissionorders()
  513. {
  514. return Url::to(['/ucenter/commission/orders'],true);
  515. }
  516. public static function commissionlogs($type=1)
  517. {
  518. $url = Url::to(['/ucenter/commission/logs','type'=>$type],true);
  519. return $url;
  520. }
  521. /******************下面是只用在手机端****************/
  522. public static function myinfo()
  523. {
  524. return Url::to(['/ucenter/default/myinfo'],true);
  525. }
  526. public static function changepwd()
  527. {
  528. return Url::to(['/ucenter/default/changepwd'],true);
  529. }
  530. public static function bindaccount()
  531. {
  532. return Url::to(['/ucenter/default/bindaccount'],true);
  533. }
  534. //绑定微信登录
  535. public static function tobindmp($scene_id)
  536. {
  537. $url = Url::to(['/ucenter/default/tobindmp','scene_id'=>$scene_id],true);
  538. return $url;
  539. }
  540. //绑定微信消息
  541. public static function bindmpmsg($scene_id)
  542. {
  543. $url = Url::to(['/ucenter/default/bindmpmsg','scene_id'=>$scene_id],true);
  544. return $url;
  545. }
  546. //绑定手机号
  547. public static function bindmob()
  548. {
  549. return Url::to(['/ucenter/default/bindmob'],true);
  550. }
  551. //绑定邮箱
  552. public static function bindemail($refer_page = '')
  553. {
  554. if(!empty($refer_page))
  555. {
  556. $url = Url::to(['/ucenter/default/bindemail',Yii::$app->params['referPageName']=>$refer_page],true);
  557. }
  558. else
  559. {
  560. $url = Url::to(['/ucenter/default/bindemail'],true);
  561. }
  562. return $url;
  563. }
  564. //收益中心
  565. public static function income()
  566. {
  567. return Url::to(['/ucenter/default/income'],true);
  568. }
  569. //积分兑换金币
  570. public static function point2coin()
  571. {
  572. return Url::to(['/ucenter/default/point2coin'],true);
  573. }
  574. //金币兑换现金
  575. public static function coin2money()
  576. {
  577. return Url::to(['/ucenter/default/coin2money'],true);
  578. }
  579. //问题帮助
  580. public static function help()
  581. {
  582. return Url::to(['/ucenter/default/help'],true);
  583. }
  584. //举报
  585. public static function report($table_name,$data_id)
  586. {
  587. $url = Url::to(['/ucenter/default/report','table_name'=>$table_name,'data_id'=>$data_id],true);
  588. return $url;
  589. }
  590. }