DedeV6移动版
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

view.php 4.6KB

il y a 2 ans
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * 手机端文档页
  4. *
  5. * @version $id:view.php 10:46 2023年1月10日 xushubieli $
  6. * @package DedeBIZ.Libraries
  7. * @copyright Copyright (c) 2022, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. define('DEDEMOB', 'Y');
  12. require_once(dirname(__FILE__)."/../system/common.inc.php");
  13. require_once(DEDEINC.'/archive/archives.class.php');
  14. $t1 = ExecTime();
  15. if (empty($okview)) $okview = '';
  16. if (isset($arcID)) $aid = $arcID;
  17. if (!isset($dopost)) $dopost = '';
  18. $app = (isset($app) && is_numeric($app) ? $app : 0);
  19. $arcID = $aid = (isset($aid) && is_numeric($aid)) ? $aid : 0;
  20. if ($aid==0) die(" Request Error! ");
  21. $arc = new Archives($aid);
  22. if ($arc->IsError) ParamError();
  23. //检查阅读权限
  24. $needMoney = $arc->Fields['money'];
  25. $needRank = $arc->Fields['arcrank'];
  26. require_once(DEDEINC.'/memberlogin.class.php');
  27. $cfg_ml = new MemberLogin();
  28. if ($needRank < 0 && $arc->Fields['mid'] != $cfg_ml->M_ID) {
  29. ShowMsg('文档未审核,暂时无法浏览', 'javascript:;');
  30. exit();
  31. }
  32. //设置了权限限制的文章
  33. //arctitle msgtitle moremsg
  34. if ($needMoney>0 || $needRank>1) {
  35. $arctitle = $arc->Fields['title'];
  36. $arclink = $cfg_phpurl.'/view.php?aid='.$arc->ArcID;
  37. $arcLinktitle = "<a href=\"{$arclink}\">".$arctitle."</a>";
  38. $description = $arc->Fields["description"];
  39. $pubdate = GetDateTimeMk($arc->Fields["pubdate"]);
  40. //会员级别不足
  41. if (($needRank>1 && $cfg_ml->M_Rank < $needRank && $arc->Fields['mid']!=$cfg_ml->M_ID)) {
  42. $dsql->Execute('me' , "SELECT * FROM `#@__arcrank` ");
  43. while($row = $dsql->GetObject('me'))
  44. {
  45. $memberTypes[$row->rank] = $row->membername;
  46. }
  47. $memberTypes[0] = "游客或没权限会员";
  48. $msgtitle = "您没有权限浏览文档:{$arctitle}";
  49. $moremsg = "该文档需要<span class='text-primary'>".$memberTypes[$needRank]."</span>金币才能浏览,您目前金币".$memberTypes[$cfg_ml->M_Rank]."</span>";
  50. include_once(DEDETEMPLATE.'/plus/view_msg.htm');
  51. exit();
  52. }
  53. //需要金币的情况
  54. if ($needMoney > 0 && $arc->Fields['mid'] != $cfg_ml->M_ID) {
  55. $sql = "SELECT aid,money FROM `#@__member_operation` WHERE buyid='ARCHIVE".$aid."' AND mid='".$cfg_ml->M_ID."'";
  56. $row = $dsql->GetOne($sql);
  57. //未购买过此文章
  58. if (!is_array($row)) {
  59. if ($cfg_ml->M_Money=='' || $needMoney > $cfg_ml->M_Money) {
  60. $msgtitle = "您没有权限浏览文档:{$arctitle}";
  61. $moremsg = "该文档需要<span class='text-primary'>".$needMoney."</span>金币才能浏览,您目前金币".$cfg_ml->M_Money."</span>";
  62. include_once(DEDETEMPLATE.'/plus/view_msg.htm');
  63. $arc->Close();
  64. exit();
  65. } else {
  66. if ($dopost=='buy') {
  67. $inquery = "INSERT INTO `#@__member_operation`(mid,oldinfo,money,mtime,buyid,product,pname) VALUES ('".$cfg_ml->M_ID."','$arctitle','$needMoney','".time()."', 'ARCHIVE".$aid."', 'archive',''); ";
  68. if ($dsql->ExecuteNoneQuery($inquery)) {
  69. $inquery = "UPDATE `#@__member` SET money=money-$needMoney WHERE mid='".$cfg_ml->M_ID."'";
  70. if (!$dsql->ExecuteNoneQuery($inquery)) {
  71. showmsg('购买失败,请返回', -1);
  72. exit;
  73. }
  74. if (defined('UC_APPID')) {
  75. include_once DEDEROOT.'/api/uc.func.php';
  76. $row = $dsql->GetOne("SELECT `scores`,`userid` FROM `#@__member` WHERE `mid`='".$cfg_ml->M_ID."'");
  77. uc_credit_note($row['userid'],-$needMoney,'money');
  78. }
  79. showmsg('购买成功,购买扣点不会重扣金币', '/apps/view.php?aid='.$aid);
  80. exit;
  81. } else {
  82. showmsg('购买失败,请返回', -1);
  83. exit;
  84. }
  85. }
  86. $msgtitle = "扣金币购买阅读";
  87. $moremsg = "该文档需要付费<span class='text-primary'>".$needMoney."</span>金币,您目前金币<span class='text-primary'>".$cfg_ml->M_Money."<br><a href='/apps/view.php?aid=".$aid."&dopost=buy' target='_blank'>确认付点阅读</a>" ;
  88. include_once($cfg_basedir.$cfg_templets_dir."/plus/view_msg.htm");
  89. $arc->Close();
  90. exit();
  91. }
  92. }
  93. }//金币处理付处理
  94. }
  95. $arc->Display();
  96. ?>