国内流行的内容管理系统(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.

95 lines
3.0KB

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