国内流行的内容管理系统(CMS)多端全媒体解决方案 https://www.dedebiz.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.9KB

  1. <?php
  2. /**
  3. * 配送方式设置
  4. *
  5. * @version $Id: shops_delivery.php 1 15:46 2010年7月20日Z tianya $
  6. * @package DedeCMS.Administrator
  7. * @copyright Copyright (c) 2020, DedeBIZ.COM
  8. * @license https://www.dedebiz.com/license
  9. * @link https://www.dedebiz.com
  10. */
  11. require_once(dirname(__FILE__)."/config.php");
  12. CheckPurview('shops_Delivery');
  13. require_once DEDEINC.'/datalistcp.class.php';
  14. if(!isset($do)) $do ='';
  15. if($do=='add')
  16. {
  17. if( empty($dname) || (strlen($dname) > 100) )
  18. {
  19. ShowMsg("请填写配送方式名称!","-1");
  20. exit();
  21. }
  22. $price = preg_replace("#[^.0-9]#", "", $price);
  23. if($price < 0.01)
  24. {
  25. $price = '0.00';
  26. }
  27. $des = cn_substrR($des,255);
  28. $InQuery = "INSERT INTO `#@__shops_delivery`(`dname`,`price`,`des`) VALUES ('$dname','$price','$des');";
  29. $result = $dsql->ExecuteNoneQuery($InQuery);
  30. if($result)
  31. {
  32. ShowMsg("成功添加一个配送方式!","shops_delivery.php");
  33. }
  34. else
  35. {
  36. ShowMsg("添加配送方式时发生SQL错误!","-1");
  37. }
  38. exit();
  39. } else if ($do == 'del')
  40. {
  41. $id = intval($id);
  42. $dsql->ExecuteNoneQuery("DELETE FROM `#@__shops_delivery` WHERE pid='$id'");
  43. ShowMsg("已删除当前配送方式!","shops_delivery.php");
  44. exit();
  45. } else if ($do == 'edit')
  46. {
  47. foreach($pid as $id)
  48. {
  49. $id = intval($id);
  50. $row = $dsql->GetOne("SELECT pid,dname,price,des FROM `#@__shops_delivery` WHERE pid='$id' LIMIT 0,1");
  51. if(!is_array($row))
  52. {
  53. continue;
  54. }
  55. $dname = ${"m_dname".$id};
  56. $price = ${"m_price".$id};
  57. $des = ${"m_des".$id};
  58. if( empty($dname) || (strlen($dname) > 100) )
  59. {
  60. $dname = addslashes($row['dname']);
  61. }
  62. $price = preg_replace("#[^.0-9]#", "", $price);
  63. if(empty($price))
  64. {
  65. $price = $row['price'];
  66. }
  67. if(empty($des))
  68. {
  69. $des = addslashes($row['des']);
  70. }
  71. else
  72. {
  73. $des = cn_substrR($des,255);
  74. }
  75. $dsql->ExecuteNoneQuery("UPDATE `#@__shops_delivery` SET dname='$dname',price='$price',des='$des' WHERE pid='$id'");
  76. }
  77. ShowMsg("成功修改配送方式!","shops_delivery.php");
  78. exit();
  79. }
  80. $deliveryarr = array();
  81. $dsql->SetQuery("SELECT pid,dname,price,des FROM `#@__shops_delivery` ORDER BY orders ASC");
  82. $dsql->Execute();
  83. while($row = $dsql->GetArray())
  84. {
  85. $deliveryarr[] = $row;
  86. }
  87. $dlist = new DataListCP();
  88. $dlist->pageSize = 25; //设定每页显示记录数(默认25条)
  89. //这两句的顺序不能更换
  90. $dlist->SetTemplate(DEDEADMIN."/templets/shops_delivery.htm"); //载入模板
  91. $dlist->SetSource("SELECT `pid`,`dname`,`price`,`des` FROM `#@__shops_delivery` ORDER BY `orders` ASC"); // 设定查询SQL
  92. $dlist->Display(); //显示