customer.php 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <?php
  2. class customer_c extends Control
  3. {
  4. function __construct()
  5. {
  6. parent::Control();
  7. $this->load_model("customer");
  8. }
  9. //兼容PHP4的写法
  10. function customer_c()
  11. {
  12. $this->__construct();
  13. }
  14. //会员列表
  15. function index_f()
  16. {
  17. sys_popedom("customer:list","tpl");
  18. $pageid = $this->trans_lib->int(SYS_PAGEID);
  19. $offset = $pageid>0 ? ($pageid-1)*SYS_PSIZE : 0;
  20. $condition = " 1=1 ";
  21. $startdate = $this->trans_lib->safe("startdate");
  22. $page_url = $this->url("customer");
  23. if($startdate)
  24. {
  25. $this->tpl->assign("startdate",$startdate);
  26. $condition .= " AND postdate>='".strtotime($startdate)."'";
  27. $page_url .= "startdate=".rawurlencode($startdate)."&";
  28. }
  29. $enddate = $this->trans_lib->safe("enddate");
  30. if($enddate)
  31. {
  32. $this->tpl->assign("enddate",$enddate);
  33. $condition .= " AND postdate<='".strtotime($enddate)."'";
  34. $page_url .= "enddate=".rawurlencode($enddate)."&";
  35. }
  36. $status = $this->trans_lib->int("status");
  37. if($status)
  38. {
  39. $this->tpl->assign("status",$status);
  40. if($status==1){
  41. $sta=1;
  42. }
  43. elseif($status==3){
  44. $sta=2;
  45. }
  46. else{
  47. $sta=0;
  48. }
  49. $condition .= " AND status='".$sta."'";
  50. $page_url .= "status=".$status."&";
  51. }
  52. $keytype = $this->trans_lib->safe("keytype");
  53. $keywords = $this->trans_lib->safe("keywords");
  54. if($keytype && $keywords)
  55. {
  56. $this->tpl->assign("keytype",$keytype);
  57. $this->tpl->assign("keywords",$keywords);
  58. $condition .= " AND ".$keytype." LIKE '%".$keywords."%' ";
  59. $page_url .= "keytype=".rawurlencode($keytype)."&keywords=".rawurlencode($keywords)."&";
  60. }
  61. $total = $this->customer_m->get_count($condition);
  62. $rslist = $this->customer_m->get_list($offset,$condition);
  63. $this->tpl->assign("total",$total);
  64. $this->tpl->assign("rslist",$rslist);
  65. $pagelist = $this->page_lib->page($page_url,$total);
  66. $this->tpl->assign("pagelist",$pagelist);
  67. $this->tpl->display("customer/list.html");
  68. }
  69. function set_f()
  70. {
  71. $id = $this->trans_lib->int("id");
  72. if($id)
  73. {
  74. sys_popedom("customer:modify","tpl");
  75. $rs = $this->customer_m->get_one($id);
  76. $this->tpl->assign("rs",$rs);
  77. }
  78. else
  79. {
  80. sys_popedom("customer:add","tpl");
  81. }
  82. $this->tpl->display("customer/set.html");
  83. }
  84. //存储信息
  85. function setok_f()
  86. {
  87. $id = $this->trans_lib->int("id");
  88. if($id)
  89. {
  90. sys_popedom("customer:modify","tpl");
  91. }
  92. else
  93. {
  94. sys_popedom("customer:add","tpl");
  95. }
  96. $array = array();
  97. $array["uid"] = $this->trans_lib->safe("uid");
  98. $array["daofang"] = $this->trans_lib->safe("daofang");
  99. $array["dfnote"] = $this->trans_lib->html("dfnote");
  100. $array["renchou"] = $this->trans_lib->safe("renchou");
  101. $array["rcnote"] = $this->trans_lib->html("rcnote");
  102. $array["rengou"] = $this->trans_lib->safe("rengou");
  103. $array["rgnote"] = $this->trans_lib->html("rgnote");
  104. $array["qianyue"] = $this->trans_lib->safe("qianyue");
  105. $array["qynote"] = $this->trans_lib->html("qynote");
  106. $array["huikuan"] = $this->trans_lib->safe("huikuan");
  107. $array["hknote"] = $this->trans_lib->html("hknote");
  108. $array["guwenname"] = $this->trans_lib->safe("guwenname");
  109. $array["guwentel"] = $this->trans_lib->safe("guwentel");
  110. $array["uname"] = $this->trans_lib->safe("uname");
  111. $array["username"] = $this->trans_lib->safe("username");
  112. $array["cellphone"] = $this->trans_lib->safe("cellphone");
  113. $array["proname"] = $this->trans_lib->safe("proname");
  114. $array["appointment_date"] = $this->trans_lib->safe("appointment_date");
  115. $array["appointment_time"] = $this->trans_lib->safe("appointment_time");
  116. $array["postdate"] = $this->system_time;
  117. $insert_id = $this->customer_m->save($array,$id);
  118. error("推荐人信息添加/存储成功",site_url("customer"));
  119. }
  120. function ajax_status_f()
  121. {
  122. $id = $this->trans_lib->int("id");
  123. if(!$id)
  124. {
  125. exit("error:没有指定ID");
  126. }
  127. sys_popedom("customer:check","ajax");
  128. $rs = $this->customer_m->get_one($id);
  129. if($rs["status"]==1)
  130. {
  131. $status=2;
  132. }
  133. elseif($rs["status"]==2)
  134. {
  135. $status=0;
  136. }
  137. else
  138. {
  139. $status=1;
  140. }
  141. $this->customer_m->set_status($id,$status);
  142. exit("ok");
  143. }
  144. function ajax_del_f()
  145. {
  146. $id = $this->trans_lib->int("id");
  147. if(!$id)
  148. {
  149. exit("error:没有指定ID");
  150. }
  151. sys_popedom("customer:delete","ajax");
  152. $this->customer_m->del($id);
  153. exit("ok");
  154. }
  155. function pl_status_f()
  156. {
  157. sys_popedom("customer:check","ajax");
  158. $id = $this->trans_lib->safe("id");
  159. $status = $this->trans_lib->int("status");
  160. $this->customer_m->status($id,$status);
  161. exit("ok");
  162. }
  163. function del_f()
  164. {
  165. sys_popedom("customer:delete","ajax");
  166. $id = $this->trans_lib->safe("id");
  167. if(!$id)
  168. {
  169. exit("操作错误,没有指定ID!");
  170. }
  171. $this->customer_m->del($id);
  172. exit("ok");
  173. }
  174. function pl_del_f()
  175. {
  176. sys_popedom("customer:delete","ajax");
  177. $id = $this->trans_lib->safe("id");
  178. if(!$id)
  179. {
  180. exit("操作错误,没有指定ID!");
  181. }
  182. $this->customer_m->pl_del($id);
  183. exit("ok");
  184. }
  185. }
  186. ?>