customers.php 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998
  1. <?php
  2. require_once 'conn.php';
  3. checkLogin();
  4. // 辅助函数
  5. function textDecode($str) {
  6. return htmlspecialchars_decode($str, ENT_QUOTES);
  7. }
  8. function htmlDecode($str) {
  9. return htmlspecialchars_decode($str, ENT_QUOTES);
  10. }
  11. $act = $_GET['act'] ?? '';
  12. $urlStr = '';
  13. // 处理保存操作
  14. if ($act == "save") {
  15. $isedit = false;
  16. $id = $_POST['id'] ?? '';
  17. if (!empty($id) && is_numeric($id)) {
  18. $isedit = true;
  19. }
  20. // 获取表单数据 - 客户基本信息
  21. $cs_code = textEncode($_POST['cs_code']);
  22. $cs_company = textEncode($_POST['cs_company']);
  23. $cs_belong = $_POST['cs_belong'];
  24. $cs_country = $_POST['cs_country'];
  25. $cs_from = $_POST['cs_from'];
  26. $cs_state = $_POST['cs_state'];
  27. $cs_deal = $_POST['cs_deal'];
  28. $cs_type = $_POST['cs_type'] ?? 5;
  29. $cs_belongclient = $_POST['cs_belongclient'] ?? 0;
  30. $no_content = htmlEncode($_POST['no_content']);
  31. $allowedit = isset($_POST['allowedit']) ? 1 : 0;
  32. $cs_address = textEncode($_POST['cs_address'] ?? '');
  33. $mytag = textEncode($_POST['mytag'] ?? '');
  34. $mytag = str_replace(['&#60;&#47;span&#62;&#60;span&#62;', '&#60;&#47;span&#62;', '&#60;span&#62;'], [',', '', ''], $mytag);
  35. $mytag = explode(',', $mytag);
  36. // 获取联系人信息
  37. $contacts = $_POST['contact'] ?? [];
  38. // 验证必填字段
  39. if (empty($cs_code)) {
  40. echo "<script>alert('客户编码不能为空');history.back();</script>";
  41. exit;
  42. }
  43. if ($cs_country == 0) {
  44. echo "<script>alert('这是哪个国家的客户?');history.back();</script>";
  45. exit;
  46. }
  47. if ($cs_from == "0") {
  48. echo "<script>alert('请填写客户来源!');history.back();</script>";
  49. exit;
  50. }
  51. // 自动检测来源
  52. if (strpos($cs_code, ';1688') !== false) {
  53. $cs_from = 1; // 1688
  54. }
  55. if (strpos($cs_code, ';阿里') !== false) {
  56. $cs_from = 2; // International station
  57. }
  58. if (strpos($cs_code, '官网') !== false) {
  59. $cs_from = 3; // Website
  60. }
  61. // 验证联系方式
  62. $primary_contact = !empty($contacts) ? current($contacts) : [];
  63. if ($allowedit != 1) {
  64. // 阿里巴巴验证
  65. if (($cs_from == 1 || $cs_from == 2) && empty($primary_contact['alibaba_1'])) {
  66. echo "<script>alert('阿里旺旺为必填项');history.back();</script>";
  67. exit;
  68. }
  69. // 官网来源验证
  70. if ($cs_from == 3) {
  71. $has_required = false;
  72. for ($i = 1; $i <= 3; $i++) {
  73. if (!empty($primary_contact['tel_' . $i]) ||
  74. !empty($primary_contact['whatsapp_' . $i]) ||
  75. !empty($primary_contact['wechat_' . $i])) {
  76. $has_required = true;
  77. break;
  78. }
  79. }
  80. if (!$has_required) {
  81. echo "<script>alert('电话和WhatsApp为必填项');history.back();</script>";
  82. exit;
  83. }
  84. }
  85. // 市场客户验证
  86. if ($cs_from == 8) {
  87. $has_wechat = false;
  88. for ($i = 1; $i <= 3; $i++) {
  89. if (!empty($primary_contact['wechat_' . $i])) {
  90. $has_wechat = true;
  91. break;
  92. }
  93. }
  94. if (!$has_wechat) {
  95. echo "<script>alert('微信为必填项');history.back();</script>";
  96. exit;
  97. }
  98. }
  99. // Facebook验证
  100. if ($cs_from == 12) {
  101. $has_facebook = false;
  102. for ($i = 1; $i <= 3; $i++) {
  103. if (!empty($primary_contact['facebook_' . $i])) {
  104. $has_facebook = true;
  105. break;
  106. }
  107. }
  108. if (!$has_facebook) {
  109. echo "<script>alert('Facebook为必填项');history.back();</script>";
  110. exit;
  111. }
  112. }
  113. }
  114. if ($isedit) {
  115. // 验证客户所有权
  116. $sql = "SELECT cs_chain FROM customer WHERE id = $id";
  117. $result = mysqli_query($conn, $sql);
  118. if ($row = mysqli_fetch_assoc($result)) {
  119. $cs_chain = $row['cs_chain'];
  120. $chain_array = explode(',', $cs_chain);
  121. $last_item = end($chain_array);
  122. if ($last_item != $cs_belong) {
  123. $cs_chain .= ",$cs_belong";
  124. }
  125. // 更新客户基本信息
  126. $sql = "UPDATE customer SET
  127. cs_code = '$cs_code',
  128. cs_company = '$cs_company',
  129. cs_belong = '$cs_belong',
  130. cs_country = '$cs_country',
  131. cs_address = '$cs_address',
  132. cs_from = '$cs_from',
  133. cs_state = '$cs_state',
  134. cs_deal = '$cs_deal',
  135. cs_type = '$cs_type',
  136. cs_belongclient = '$cs_belongclient',
  137. cs_note = '$no_content',
  138. allowedit = $allowedit,
  139. cs_chain = '$cs_chain',
  140. cs_updatetime = NOW()";
  141. // 处理cs_dealdate
  142. if ($cs_deal == 3) {
  143. $sql .= ", cs_dealdate = CASE WHEN cs_dealdate IS NULL THEN NOW() ELSE cs_dealdate END";
  144. }
  145. $sql .= " WHERE id = $id";
  146. mysqli_query($conn, $sql);
  147. // 处理联系人信息
  148. $existingContactIds = [];
  149. foreach ($contacts as $contact) {
  150. if (!empty($contact['id'])) {
  151. $existingContactIds[] = (int)$contact['id'];
  152. }
  153. }
  154. // 删除不再使用的联系人记录
  155. if (!empty($existingContactIds)) {
  156. $idsToKeep = implode(',', $existingContactIds);
  157. $deleteContactsSql = "DELETE FROM customer_contact WHERE customer_id = $id AND id NOT IN ($idsToKeep)";
  158. } else {
  159. $deleteContactsSql = "DELETE FROM customer_contact WHERE customer_id = $id";
  160. }
  161. mysqli_query($conn, $deleteContactsSql);
  162. // 更新或添加联系人信息
  163. foreach ($contacts as $contact) {
  164. $contact_id = !empty($contact['id']) ? (int)$contact['id'] : 0;
  165. $contact_name = textEncode($contact['contact_name'] ?? '');
  166. // 准备SQL字段和值
  167. $fields = ['contact_name'];
  168. $values = ["'" . mysqli_real_escape_string($conn, $contact_name) . "'"];
  169. $updates = ["contact_name = '" . mysqli_real_escape_string($conn, $contact_name) . "'"];
  170. // 处理所有联系方式类型
  171. $methodTypes = ['tel', 'email', 'whatsapp', 'wechat', 'linkedin', 'facebook', 'alibaba'];
  172. foreach ($methodTypes as $type) {
  173. for ($i = 1; $i <= 3; $i++) {
  174. $field = $type . '_' . $i;
  175. $format_field = $field . '_format';
  176. $bu_field = $field . '_bu';
  177. $value = textEncode($contact[$field] ?? '');
  178. $format_value = ($type == 'tel' || $type == 'whatsapp') ? numFormat($value) : '';
  179. $bu_value = textEncode($contact[$bu_field] ?? $value);
  180. // 添加字段名
  181. $fields[] = $field;
  182. $fields[] = $bu_field;
  183. if ($type == 'tel' || $type == 'whatsapp') {
  184. $fields[] = $format_field;
  185. }
  186. // 添加值
  187. $values[] = "'" . mysqli_real_escape_string($conn, $value) . "'";
  188. $values[] = "'" . mysqli_real_escape_string($conn, $bu_value) . "'";
  189. if ($type == 'tel' || $type == 'whatsapp') {
  190. $values[] = "'" . mysqli_real_escape_string($conn, $format_value) . "'";
  191. }
  192. // 添加更新语句
  193. $updates[] = $field . " = '" . mysqli_real_escape_string($conn, $value) . "'";
  194. $updates[] = $bu_field . " = '" . mysqli_real_escape_string($conn, $bu_value) . "'";
  195. if ($type == 'tel' || $type == 'whatsapp') {
  196. $updates[] = $format_field . " = '" . mysqli_real_escape_string($conn, $format_value) . "'";
  197. }
  198. }
  199. }
  200. if ($contact_id > 0) {
  201. // 更新已有联系人
  202. $updateContactSql = "UPDATE customer_contact SET " .
  203. implode(", ", $updates) . ", updated_at = NOW() " .
  204. "WHERE id = $contact_id AND customer_id = $id";
  205. mysqli_query($conn, $updateContactSql);
  206. } else {
  207. // 添加新联系人
  208. $insertContactSql = "INSERT INTO customer_contact (" .
  209. implode(", ", $fields) . ", customer_id, created_at, updated_at) VALUES (" .
  210. implode(", ", $values) . ", $id, NOW(), NOW())";
  211. mysqli_query($conn, $insertContactSql);
  212. }
  213. }
  214. // 更新标签
  215. mysqli_query($conn, "DELETE FROM tagtable WHERE customerId = $id");
  216. foreach ($mytag as $tag) {
  217. if (!empty(trim($tag))) {
  218. $tagSql = "INSERT INTO tagtable (tagName, employeeId, customerId) VALUES ('" .
  219. mysqli_real_escape_string($conn, $tag) . "', " .
  220. $_SESSION['employee_id'] . ", $id)";
  221. mysqli_query($conn, $tagSql);
  222. }
  223. }
  224. $page = $_GET['Page'] ?? '';
  225. $keys = urlencode($_GET['Keys'] ?? '');
  226. header("Location: ?keys=$keys&Page=$page$urlStr");
  227. exit;
  228. }
  229. } else {
  230. // 创建新记录
  231. // 插入客户基本信息
  232. $sql = "INSERT INTO customer (
  233. cs_code, cs_company, cs_country, cs_address, cs_from,
  234. cs_belong, cs_state, cs_deal, cs_type, cs_belongclient,
  235. cs_note, allowedit, cs_chain, cs_addtime, cs_updatetime,
  236. is_silent, cs_dealdate
  237. ) VALUES (
  238. '$cs_code', '$cs_company', '$cs_country', '$cs_address', '$cs_from',
  239. '$cs_belong', '$cs_state', '$cs_deal', '$cs_type', '$cs_belongclient',
  240. '$no_content', $allowedit, '$cs_belong', NOW(), NOW(),
  241. 0, " . ($cs_deal == 3 ? "NOW()" : "NULL") . "
  242. )";
  243. mysqli_query($conn, $sql);
  244. $new_customer_id = mysqli_insert_id($conn);
  245. // 插入联系人信息
  246. if ($new_customer_id > 0) {
  247. foreach ($contacts as $contact) {
  248. $contact_name = textEncode($contact['contact_name'] ?? '');
  249. // 准备SQL字段和值
  250. $fields = ['contact_name'];
  251. $values = ["'" . mysqli_real_escape_string($conn, $contact_name) . "'"];
  252. // 处理所有联系方式类型
  253. $methodTypes = ['tel', 'email', 'whatsapp', 'wechat', 'linkedin', 'facebook', 'alibaba'];
  254. foreach ($methodTypes as $type) {
  255. for ($i = 1; $i <= 3; $i++) {
  256. $field = $type . '_' . $i;
  257. $format_field = $field . '_format';
  258. $bu_field = $field . '_bu';
  259. $value = textEncode($contact[$field] ?? '');
  260. $format_value = ($type == 'tel' || $type == 'whatsapp') ? numFormat($value) : '';
  261. $bu_value = textEncode($contact[$bu_field] ?? $value);
  262. // 添加字段名
  263. $fields[] = $field;
  264. $fields[] = $bu_field;
  265. if ($type == 'tel' || $type == 'whatsapp') {
  266. $fields[] = $format_field;
  267. }
  268. // 添加值
  269. $values[] = "'" . mysqli_real_escape_string($conn, $value) . "'";
  270. $values[] = "'" . mysqli_real_escape_string($conn, $bu_value) . "'";
  271. if ($type == 'tel' || $type == 'whatsapp') {
  272. $values[] = "'" . mysqli_real_escape_string($conn, $format_value) . "'";
  273. }
  274. }
  275. }
  276. // 添加新联系人
  277. $insertContactSql = "INSERT INTO customer_contact (" .
  278. implode(", ", $fields) . ", customer_id, created_at, updated_at) VALUES (" .
  279. implode(", ", $values) . ", $new_customer_id, NOW(), NOW())";
  280. mysqli_query($conn, $insertContactSql);
  281. }
  282. // 保存标签
  283. foreach ($mytag as $tag) {
  284. if (!empty(trim($tag))) {
  285. $tagSql = "INSERT INTO tagtable (tagName, employeeId, customerId) VALUES ('" .
  286. mysqli_real_escape_string($conn, $tag) . "', " .
  287. $_SESSION['employee_id'] . ", $new_customer_id)";
  288. mysqli_query($conn, $tagSql);
  289. }
  290. }
  291. $page = $_GET['Page'] ?? '';
  292. $keys = urlencode($_GET['Keys'] ?? '');
  293. header("Location: ?keys=$keys&Page=$page$urlStr");
  294. exit;
  295. }
  296. }
  297. }
  298. // 处理编辑操作
  299. if ($act == "edit") {
  300. $id = $_GET['id'] ?? '';
  301. $isedit = false;
  302. if (!empty($id) && is_numeric($id)) {
  303. $isedit = true;
  304. }
  305. if ($isedit) {
  306. // 联合查询客户基本信息和联系人信息
  307. $sql = "SELECT c.*,
  308. cc.id as contact_id, cc.contact_name,
  309. cc.tel_1, cc.tel_1_format, cc.tel_1_bu,
  310. cc.tel_2, cc.tel_2_format, cc.tel_2_bu,
  311. cc.tel_3, cc.tel_3_format, cc.tel_3_bu,
  312. cc.email_1, cc.email_1_bu,
  313. cc.email_2, cc.email_2_bu,
  314. cc.email_3, cc.email_3_bu,
  315. cc.whatsapp_1, cc.whatsapp_1_format, cc.whatsapp_1_bu,
  316. cc.whatsapp_2, cc.whatsapp_2_format, cc.whatsapp_2_bu,
  317. cc.whatsapp_3, cc.whatsapp_3_format, cc.whatsapp_3_bu,
  318. cc.wechat_1, cc.wechat_1_bu,
  319. cc.wechat_2, cc.wechat_2_bu,
  320. cc.wechat_3, cc.wechat_3_bu,
  321. cc.linkedin_1, cc.linkedin_1_bu,
  322. cc.linkedin_2, cc.linkedin_2_bu,
  323. cc.linkedin_3, cc.linkedin_3_bu,
  324. cc.facebook_1, cc.facebook_1_bu,
  325. cc.facebook_2, cc.facebook_2_bu,
  326. cc.facebook_3, cc.facebook_3_bu,
  327. cc.alibaba_1, cc.alibaba_1_bu,
  328. cc.alibaba_2, cc.alibaba_2_bu,
  329. cc.alibaba_3, cc.alibaba_3_bu
  330. FROM customer c
  331. LEFT JOIN customer_contact cc ON c.id = cc.customer_id
  332. WHERE c.id = $id";
  333. $result = mysqli_query($conn, $sql);
  334. if ($row = mysqli_fetch_assoc($result)) {
  335. $cs_code = textDecode($row['cs_code']);
  336. $cs_company = textDecode($row['cs_company']);
  337. $cs_name = textDecode($row['contact_name']);
  338. $cs_country = $row['cs_country'];
  339. $cs_from = $row['cs_from'];
  340. $cs_tel = textDecode($row['tel_1']);
  341. $cs_telBu = textDecode($row['tel_1_bu']);
  342. $cs_email = textDecode($row['email_1']);
  343. $cs_emailBu = textDecode($row['email_1_bu']);
  344. $cs_whatsapp = textDecode($row['whatsapp_1']);
  345. $cs_whatsappBu = textDecode($row['whatsapp_1_bu']);
  346. $cs_wechat = textDecode($row['wechat_1']);
  347. $cs_wechatBu = textDecode($row['wechat_1_bu']);
  348. $cs_linkedin = textDecode($row['linkedin_1']);
  349. $cs_linkedinBu = textDecode($row['linkedin_1_bu']);
  350. $cs_facebook = textDecode($row['facebook_1']);
  351. $cs_facebookBu = textDecode($row['facebook_1_bu']);
  352. $cs_alibaba = textDecode($row['alibaba_1']);
  353. $cs_alibabaBu = textDecode($row['alibaba_1_bu']);
  354. $cs_address = textDecode($row['cs_address']);
  355. $cs_addtime = $row['cs_addtime'];
  356. $cs_updatetime = $row['cs_updatetime'];
  357. $cs_belong = $row['cs_belong'];
  358. $cs_state = $row['cs_state'];
  359. $cs_deal = $row['cs_deal'];
  360. $cs_note = htmlDecode($row['cs_note']);
  361. $allowedit = $row['allowedit'];
  362. }
  363. }
  364. }
  365. // 处理批量操作
  366. if ($act == "postchk") {
  367. if (isset($_POST['chkbox']) && isset($_POST['chkact'])) {
  368. $chkact = $_POST['chkact'];
  369. $ids = implode(',', array_map('intval', $_POST['chkbox']));
  370. switch($chkact) {
  371. case "0":
  372. case "1":
  373. $sql = "UPDATE customer SET cs_state = $chkact WHERE id IN ($ids)";
  374. break;
  375. case "-1":
  376. // 删除客户记录和联系人记录(依靠外键级联删除)
  377. $sql = "DELETE FROM customer WHERE id IN ($ids)";
  378. break;
  379. }
  380. if (isset($sql)) {
  381. mysqli_query($conn, $sql);
  382. }
  383. $keys = urlencode($_GET['Keys'] ?? '');
  384. $page = $_GET['Page'] ?? '';
  385. header("Location: ?keys=$keys&Page=$page$urlStr");
  386. exit;
  387. }
  388. }
  389. // 处理筛选条件
  390. $fliterQudao = $_GET['fliterQudao'] ?? '';
  391. $fliterDeal = $_GET['fliterDeal'] ?? '';
  392. $fliterTeam = $_GET['fliterTeam'] ?? '';
  393. $fliterContact = $_GET['fliterContact'] ?? '';
  394. $fliterEmployee = $_GET['fliterEmployee'] ?? '';
  395. $fliterStr = "";
  396. if (!empty($fliterQudao)) {
  397. $fliterStr .= " AND c.cs_from = " . intval($fliterQudao);
  398. $urlStr .= "&fliterQudao=" . $fliterQudao;
  399. }
  400. if (!empty($fliterDeal)) {
  401. $fliterStr .= " AND c.cs_deal = " . intval($fliterDeal);
  402. $urlStr .= "&fliterDeal=" . $fliterDeal;
  403. }
  404. if (!empty($fliterTeam)) {
  405. $fliterStr .= " AND (c.cs_belong = " . intval($fliterTeam) .
  406. " OR c.cs_belong IN (SELECT id FROM employee WHERE em_role = " . intval($fliterTeam) . "))";
  407. $urlStr .= "&fliterTeam=" . $fliterTeam;
  408. }
  409. if (!empty($fliterEmployee)) {
  410. $fliterStr .= " AND c.cs_belong = " . intval($fliterEmployee);
  411. $urlStr .= "&fliterEmployee=" . $fliterEmployee;
  412. }
  413. if (!empty($fliterContact)) {
  414. switch ($fliterContact) {
  415. case "1": $fliterStr .= " AND (cc.tel_1 != '' OR cc.tel_2 != '' OR cc.tel_3 != '')"; break;
  416. case "2": $fliterStr .= " AND (cc.wechat_1 != '' OR cc.wechat_2 != '' OR cc.wechat_3 != '')"; break;
  417. case "3": $fliterStr .= " AND (cc.whatsapp_1 != '' OR cc.whatsapp_2 != '' OR cc.whatsapp_3 != '')"; break;
  418. case "4": $fliterStr .= " AND (cc.email_1 != '' OR cc.email_2 != '' OR cc.email_3 != '')"; break;
  419. case "5": $fliterStr .= " AND (cc.linkedin_1 != '' OR cc.linkedin_2 != '' OR cc.linkedin_3 != '')"; break;
  420. case "6": $fliterStr .= " AND (cc.facebook_1 != '' OR cc.facebook_2 != '' OR cc.facebook_3 != '')"; break;
  421. case "7": $fliterStr .= " AND (cc.alibaba_1 != '' OR cc.alibaba_2 != '' OR cc.alibaba_3 != '')"; break;
  422. }
  423. $urlStr .= "&fliterContact=" . $fliterContact;
  424. }
  425. // 搜索和排序
  426. $keys = $_GET['Keys'] ?? '';
  427. $keyscode = textEncode($keys);
  428. $page = $_GET['Page'] ?? 1;
  429. $ord = $_GET['Ord'] ?? '';
  430. $ordStr = !empty($ord) ? "$ord," : "";
  431. // 构建查询SQL - 修改为联合查询
  432. $sqlStr = "SELECT c.id, c.cs_code, c.cs_company, c.cs_country, c.cs_address, c.cs_from,
  433. c.cs_deal, c.cs_addtime, c.cs_updatetime, c.cs_belong, c.cs_note, c.cs_claimFrom,
  434. c.cs_chain, c.cs_dealdate, c.cs_type, c.cs_belongclient, c.allowedit,
  435. cc.id as contact_id, cc.contact_name,
  436. cc.tel_1, cc.tel_1_format, cc.tel_1_bu,
  437. cc.tel_2, cc.tel_2_format, cc.tel_2_bu,
  438. cc.tel_3, cc.tel_3_format, cc.tel_3_bu,
  439. cc.email_1, cc.email_1_bu,
  440. cc.email_2, cc.email_2_bu,
  441. cc.email_3, cc.email_3_bu,
  442. cc.whatsapp_1, cc.whatsapp_1_format, cc.whatsapp_1_bu,
  443. cc.whatsapp_2, cc.whatsapp_2_format, cc.whatsapp_2_bu,
  444. cc.whatsapp_3, cc.whatsapp_3_format, cc.whatsapp_3_bu,
  445. cc.wechat_1, cc.wechat_1_bu,
  446. cc.wechat_2, cc.wechat_2_bu,
  447. cc.wechat_3, cc.wechat_3_bu,
  448. cc.linkedin_1, cc.linkedin_1_bu,
  449. cc.linkedin_2, cc.linkedin_2_bu,
  450. cc.linkedin_3, cc.linkedin_3_bu,
  451. cc.facebook_1, cc.facebook_1_bu,
  452. cc.facebook_2, cc.facebook_2_bu,
  453. cc.facebook_3, cc.facebook_3_bu,
  454. cc.alibaba_1, cc.alibaba_1_bu,
  455. cc.alibaba_2, cc.alibaba_2_bu,
  456. cc.alibaba_3, cc.alibaba_3_bu
  457. FROM customer c
  458. LEFT JOIN customer_contact cc ON c.id = cc.customer_id
  459. WHERE 1=1";
  460. if (!empty($keyscode)) {
  461. $sqlStr .= " AND (c.cs_code LIKE '%$keyscode%'
  462. OR cc.contact_name LIKE '%$keyscode%'
  463. OR cc.tel_1 LIKE '%$keyscode%'
  464. OR cc.tel_2 LIKE '%$keyscode%'
  465. OR cc.tel_3 LIKE '%$keyscode%'
  466. OR cc.email_1 LIKE '%$keyscode%'
  467. OR cc.email_2 LIKE '%$keyscode%'
  468. OR cc.email_3 LIKE '%$keyscode%'
  469. OR cc.wechat_1 LIKE '%$keyscode%'
  470. OR cc.wechat_2 LIKE '%$keyscode%'
  471. OR cc.wechat_3 LIKE '%$keyscode%'
  472. OR cc.whatsapp_1_format LIKE '%$keyscode%'
  473. OR cc.whatsapp_2_format LIKE '%$keyscode%'
  474. OR cc.whatsapp_3_format LIKE '%$keyscode%'
  475. OR cc.linkedin_1 LIKE '%$keyscode%'
  476. OR cc.linkedin_2 LIKE '%$keyscode%'
  477. OR cc.linkedin_3 LIKE '%$keyscode%'
  478. OR cc.facebook_1 LIKE '%$keyscode%'
  479. OR cc.facebook_2 LIKE '%$keyscode%'
  480. OR cc.facebook_3 LIKE '%$keyscode%'
  481. OR cc.alibaba_1 LIKE '%$keyscode%'
  482. OR cc.alibaba_2 LIKE '%$keyscode%'
  483. OR cc.alibaba_3 LIKE '%$keyscode%')";
  484. }
  485. $sqlStr .= " $fliterStr ORDER BY {$ordStr}c.cs_updatetime DESC";
  486. ?>
  487. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  488. <html xmlns="http://www.w3.org/1999/xhtml">
  489. <head>
  490. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  491. <title>客户列表</title>
  492. <link rel="stylesheet" href="css/common.css" type="text/css" />
  493. <link rel="stylesheet" href="css/alert.css" type="text/css" />
  494. <script src="js/jquery-1.7.2.min.js"></script>
  495. <script src="js/js.js"></script>
  496. <style>
  497. body {
  498. margin: 0;
  499. padding: 20px;
  500. background: #fff;
  501. }
  502. #man_zone {
  503. margin-left: 0;
  504. }
  505. </style>
  506. </head>
  507. <body>
  508. <div id="man_zone">
  509. <?php
  510. $keys = $_GET['Keys'] ?? '';
  511. $keys = str_replace([" ", "+"], "", $keys);
  512. $keyscode = textEncode($keys);
  513. $page = $_GET['Page'] ?? 1;
  514. $filters = [
  515. 'Country' => $_GET['fliterCountry'] ?? '',
  516. 'Qudao' => $_GET['fliterQudao'] ?? '',
  517. 'Deal' => $_GET['fliterDeal'] ?? '',
  518. 'Business' => $_GET['fliterBusiness'] ?? '',
  519. 'Contact' => $_GET['fliterContact'] ?? ''
  520. ];
  521. $filterStr = "";
  522. $urlStr = "";
  523. // Build filter conditions
  524. if (!empty($filters['Country'])) {
  525. $filterStr .= " AND c.cs_country=" . (int)$filters['Country'];
  526. $urlStr .= "&fliterCountry=" . $filters['Country'];
  527. }
  528. if (!empty($filters['Qudao'])) {
  529. $filterStr .= " AND c.cs_from=" . (int)$filters['Qudao'];
  530. $urlStr .= "&fliterQudao=" . $filters['Qudao'];
  531. }
  532. if (!empty($filters['Deal'])) {
  533. $filterStr .= " AND c.cs_deal=" . (int)$filters['Deal'];
  534. $urlStr .= "&fliterDeal=" . $filters['Deal'];
  535. }
  536. if (!empty($filters['Business'])) {
  537. $filterStr .= " AND c.cs_type=" . (int)$filters['Business'];
  538. $urlStr .= "&fliterBusiness=" . $filters['Business'];
  539. }
  540. if (!empty($filters['Contact'])) {
  541. switch ($filters['Contact']) {
  542. case "1": $filterStr .= " AND (cc.tel_1 != '' OR cc.tel_2 != '' OR cc.tel_3 != '')"; break;
  543. case "2": $filterStr .= " AND (cc.wechat_1 != '' OR cc.wechat_2 != '' OR cc.wechat_3 != '')"; break;
  544. case "3": $filterStr .= " AND (cc.whatsapp_1 != '' OR cc.whatsapp_2 != '' OR cc.whatsapp_3 != '')"; break;
  545. case "4": $filterStr .= " AND (cc.email_1 != '' OR cc.email_2 != '' OR cc.email_3 != '')"; break;
  546. case "5": $filterStr .= " AND (cc.linkedin_1 != '' OR cc.linkedin_2 != '' OR cc.linkedin_3 != '')"; break;
  547. case "6": $filterStr .= " AND (cc.facebook_1 != '' OR cc.facebook_2 != '' OR cc.facebook_3 != '')"; break;
  548. case "7": $filterStr .= " AND (cc.alibaba_1 != '' OR cc.alibaba_2 != '' OR cc.alibaba_3 != '')"; break;
  549. }
  550. $urlStr .= "&fliterContact=" . $filters['Contact'];
  551. }
  552. $keys = urlencode($keys);
  553. $hrefstr = "?keys=" . $keys;
  554. ?>
  555. <form id="form1" method="post" action="?act=postchk&Keys=<?= $keys ?>&Page=<?= $page ?>" onSubmit="return false">
  556. <div class="fastSelect clear">
  557. <H1>搜索条件</H1>
  558. <div class="selectItem">
  559. <label>区域</label>
  560. <select name="fliterCountry" class="filterSearch">
  561. <option value="">请选择国家地区</option>
  562. <?php
  563. $result = $conn->query("SELECT id, countryName FROM country");
  564. while ($row = $result->fetch_assoc()) {
  565. $selected = ($filters['Country'] == $row['id']) ? ' selected' : '';
  566. echo "<option value=\"{$row['id']}\"$selected>{$row['countryName']}</option>";
  567. }
  568. ?>
  569. </select>
  570. </div>
  571. <div class="selectItem">
  572. <label>来源渠道</label>
  573. <select name="fliterQudao" class="filterSearch">
  574. <option value="">请选择渠道</option>
  575. <?php
  576. $result = $conn->query("SELECT id, ch_name FROM qudao");
  577. while ($row = $result->fetch_assoc()) {
  578. $selected = ($filters['Qudao'] == $row['id']) ? ' selected' : '';
  579. echo "<option value=\"{$row['id']}\"$selected>{$row['ch_name']}</option>";
  580. }
  581. ?>
  582. </select>
  583. </div>
  584. <div class="selectItem">
  585. <label>跟进阶段</label>
  586. <select name="fliterDeal" class="filterSearch">
  587. <option value="">请选择</option>
  588. <option value="1"<?= ($filters['Deal'] == "1") ? ' selected' : '' ?>>背景调查</option>
  589. <option value="2"<?= ($filters['Deal'] == "2") ? ' selected' : '' ?>>明确需求</option>
  590. <option value="3"<?= ($filters['Deal'] == "3") ? ' selected' : '' ?>>已成交</option>
  591. </select>
  592. </div>
  593. <div class="selectItem">
  594. <label>客户类型</label>
  595. <select name="fliterBusiness" class="filterSearch">
  596. <option value="">请选择</option>
  597. <?php
  598. $result = $conn->query("SELECT id, businessType FROM clienttype");
  599. while ($row = $result->fetch_assoc()) {
  600. $selected = ($filters['Business'] == $row['id']) ? ' selected' : '';
  601. echo "<option value=\"{$row['id']}\"$selected>{$row['businessType']}</option>";
  602. }
  603. ?>
  604. </select>
  605. </div>
  606. <div class="selectItem">
  607. <label>联系方式</label>
  608. <select name="fliterContact" class="filterSearch">
  609. <option value="">请选择</option>
  610. <option value="1"<?= ($filters['Contact'] == "1") ? ' selected' : '' ?>>电话</option>
  611. <option value="2"<?= ($filters['Contact'] == "2") ? ' selected' : '' ?>>微信</option>
  612. <option value="3"<?= ($filters['Contact'] == "3") ? ' selected' : '' ?>>WhatsApp</option>
  613. <option value="4"<?= ($filters['Contact'] == "4") ? ' selected' : '' ?>>邮箱</option>
  614. <option value="5"<?= ($filters['Contact'] == "5") ? ' selected' : '' ?>>领英</option>
  615. <option value="6"<?= ($filters['Contact'] == "6") ? ' selected' : '' ?>>Facebook</option>
  616. <option value="7"<?= ($filters['Contact'] == "7") ? ' selected' : '' ?>>阿里巴巴</option>
  617. </select>
  618. </div>
  619. <div class="inputSearch">
  620. <input type="text" id="keys" class="inputTxt"
  621. value="<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>"
  622. onFocus="if(this.value == '<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>'){this.value='';}"
  623. onBlur="if(this.value == ''){this.value='<?= empty($keyscode) ? '请输入搜索关键词' : $keyscode ?>';}"
  624. onKeyDown="if(event.keyCode==13){location.href='?Keys='+encodeURIComponent(document.getElementById('keys').value)}" />
  625. <input type="button" id="searchgo" class="searchgo" value="go"
  626. onClick="location.href='?Keys='+encodeURIComponent(document.getElementById('keys').value)" />
  627. </div>
  628. </div>
  629. <div class="table2 em<?= $_SESSION['employee_id'] ?>">
  630. <div class="theader">
  631. <div class="col1"><input type="checkbox" name="chkall" id="chkall" onClick="chkboxall(this,'chkbox')" /></div>
  632. <div class="col2">序号</div>
  633. <div class="col3">客户编号</div>
  634. <div class="col4">渠道来源</div>
  635. <div class="col5">区域</div>
  636. <div class="col6">客户类型</div>
  637. <div class="col6">跟进阶段</div>
  638. <div class="colmark">颜色标记</div>
  639. <div class="col6">录入时间</div>
  640. <div class="col9">操作</div>
  641. </div>
  642. <?php
  643. $sql = "SELECT c.id, c.cs_code, c.cs_company, c.cs_country, c.cs_address, c.cs_from,
  644. c.cs_deal, c.cs_addtime, c.cs_updatetime, c.cs_belong, c.cs_note, c.cs_claimFrom,
  645. c.cs_chain, c.cs_dealdate, c.cs_type, c.cs_belongclient, c.allowedit,c.colortag,
  646. cc.id as contact_id, cc.contact_name,
  647. cc.tel_1, cc.tel_1_format, cc.tel_1_bu,
  648. cc.tel_2, cc.tel_2_format, cc.tel_2_bu,
  649. cc.tel_3, cc.tel_3_format, cc.tel_3_bu,
  650. cc.email_1, cc.email_1_bu,
  651. cc.email_2, cc.email_2_bu,
  652. cc.email_3, cc.email_3_bu,
  653. cc.whatsapp_1, cc.whatsapp_1_format, cc.whatsapp_1_bu,
  654. cc.whatsapp_2, cc.whatsapp_2_format, cc.whatsapp_2_bu,
  655. cc.whatsapp_3, cc.whatsapp_3_format, cc.whatsapp_3_bu,
  656. cc.wechat_1, cc.wechat_1_bu,
  657. cc.wechat_2, cc.wechat_2_bu,
  658. cc.wechat_3, cc.wechat_3_bu,
  659. cc.linkedin_1, cc.linkedin_1_bu,
  660. cc.linkedin_2, cc.linkedin_2_bu,
  661. cc.linkedin_3, cc.linkedin_3_bu,
  662. cc.facebook_1, cc.facebook_1_bu,
  663. cc.facebook_2, cc.facebook_2_bu,
  664. cc.facebook_3, cc.facebook_3_bu,
  665. cc.alibaba_1, cc.alibaba_1_bu,
  666. cc.alibaba_2, cc.alibaba_2_bu,
  667. cc.alibaba_3, cc.alibaba_3_bu
  668. FROM customer c
  669. LEFT JOIN customer_contact cc ON c.id = cc.customer_id
  670. WHERE c.is_silent=0 AND c.cs_deal>0 AND c.cs_belong=" . (int)$_SESSION['employee_id'];
  671. $searchPattern = mysqli_real_escape_string($conn, $keyscode);
  672. if(!empty($searchPattern)) {
  673. $sql .= " AND (c.cs_code LIKE '%$searchPattern%'
  674. OR cc.contact_name LIKE '%$searchPattern%'
  675. OR cc.tel_1 LIKE '%$searchPattern%'
  676. OR cc.tel_2 LIKE '%$searchPattern%'
  677. OR cc.tel_3 LIKE '%$searchPattern%'
  678. OR cc.email_1 LIKE '%$searchPattern%'
  679. OR cc.email_2 LIKE '%$searchPattern%'
  680. OR cc.email_3 LIKE '%$searchPattern%'
  681. OR cc.wechat_1 LIKE '%$searchPattern%'
  682. OR cc.wechat_2 LIKE '%$searchPattern%'
  683. OR cc.wechat_3 LIKE '%$searchPattern%'
  684. OR cc.whatsapp_1_format LIKE '%$searchPattern%'
  685. OR cc.whatsapp_2_format LIKE '%$searchPattern%'
  686. OR cc.whatsapp_3_format LIKE '%$searchPattern%'
  687. OR cc.linkedin_1 LIKE '%$searchPattern%'
  688. OR cc.linkedin_2 LIKE '%$searchPattern%'
  689. OR cc.linkedin_3 LIKE '%$searchPattern%'
  690. OR cc.facebook_1 LIKE '%$searchPattern%'
  691. OR cc.facebook_2 LIKE '%$searchPattern%'
  692. OR cc.facebook_3 LIKE '%$searchPattern%'
  693. OR cc.alibaba_1 LIKE '%$searchPattern%'
  694. OR cc.alibaba_2 LIKE '%$searchPattern%'
  695. OR cc.alibaba_3 LIKE '%$searchPattern%')";
  696. }
  697. $sql .= " $filterStr ORDER BY c.colortag DESC, c.id DESC";
  698. $result = mysqli_query($conn, $sql);
  699. // Pagination logic
  700. $perPage = 20;
  701. $totalRecords = mysqli_num_rows($result);
  702. $totalPages = max(1, ceil($totalRecords / $perPage));
  703. $page = max(1, min((int)$page, $totalPages));
  704. $offset = max(0, ($page - 1) * $perPage);
  705. // Add pagination to query
  706. $sql .= " LIMIT $offset, $perPage";
  707. $result = mysqli_query($conn, $sql);
  708. if (mysqli_num_rows($result) > 0) {
  709. $tempNum = $offset;
  710. while ($row = mysqli_fetch_assoc($result)) {
  711. $tempNum++;
  712. ?>
  713. <div class="tline color<?= $row['colortag'] ?>">
  714. <div class="col1" align="center"><input type="checkbox" name="chkbox" value="<?= $row['id'] ?>" /></div>
  715. <div class="col2"><?= $tempNum ?></div>
  716. <div class="col3 slidepanel"><?= $row['cs_code'] ?>
  717. <?php if ($row['cs_claimFrom'] > 0): ?>
  718. <img src="../images/yijiao.png" class="handover" title="来自认领">
  719. <?php endif; ?>
  720. </div>
  721. <div class="col4">
  722. <?php
  723. $qudao = $conn->query("SELECT ch_name FROM qudao WHERE id=" . (int)$row['cs_from']);
  724. echo $qudao->num_rows > 0 ? $qudao->fetch_assoc()['ch_name'] : '未填写';
  725. ?>
  726. </div>
  727. <div class="col5">
  728. <?php
  729. $country = $conn->query("SELECT countryName FROM country WHERE id=" . (int)$row['cs_country']);
  730. echo $country->num_rows > 0 ? $country->fetch_assoc()['countryName'] : '未填写';
  731. ?>
  732. </div>
  733. <div class="col6">
  734. <?php
  735. $clientType = $conn->query("SELECT businessType FROM clienttype WHERE id=" . (int)$row['cs_type']);
  736. echo $clientType->num_rows > 0 ? $clientType->fetch_assoc()['businessType'] : '未填写';
  737. ?>
  738. </div>
  739. <div class="col6">
  740. <?php
  741. switch ($row['cs_deal']) {
  742. case 3: echo '<span style="color:red;">成交</span>'; break;
  743. case 2: echo '明确需求'; break;
  744. case 1: echo '背景调查'; break;
  745. default: echo '无响应';
  746. }
  747. ?>
  748. </div>
  749. <div class="colmark colormark">
  750. <ul class="colorlist" data-id="<?= $row['id'] ?>">
  751. <li value="1" class="color1"></li>
  752. <li value="2" class="color2"></li>
  753. <li value="3" class="color3"></li>
  754. <li value="4" class="color4"></li>
  755. <li value="0" class="color0"></li>
  756. </ul>
  757. </div>
  758. <div class="col6"><?= $row['cs_addtime'] ?></div>
  759. <div class="col9">
  760. <a href="customerEdit.php?Keys=<?= $keys ?>&fliterDeal=<?= $filters['Deal'] ?>&fliterBusiness=<?= $filters['Business'] ?>&Page=<?= $page ?>&act=edit&id=<?= $row['id'] ?>" class="ico_edit ico">修改</a>
  761. <a href="order_add.php?customer_id=<?= $row['id'] ?>" class="ico_add ico">添加订单</a>
  762. </div>
  763. </div>
  764. <div class="notepanel clear">
  765. <div class="noteItem">联系方式</div>
  766. <div class="lx">
  767. <div class="tel">
  768. <?php if(!empty($row['tel_1'])): ?>
  769. <div><?= $row['tel_1'] ?></div>
  770. <?php endif; ?>
  771. <?php if(!empty($row['tel_2'])): ?>
  772. <div><?= $row['tel_2'] ?></div>
  773. <?php endif; ?>
  774. <?php if(!empty($row['tel_3'])): ?>
  775. <div><?= $row['tel_3'] ?></div>
  776. <?php endif; ?>
  777. </div>
  778. <div class="mail">
  779. <?php if(!empty($row['email_1'])): ?>
  780. <div><a href="mailto:<?= $row['email_1'] ?>"><?= $row['email_1'] ?></a></div>
  781. <?php endif; ?>
  782. <?php if(!empty($row['email_2'])): ?>
  783. <div><a href="mailto:<?= $row['email_2'] ?>"><?= $row['email_2'] ?></a></div>
  784. <?php endif; ?>
  785. <?php if(!empty($row['email_3'])): ?>
  786. <div><a href="mailto:<?= $row['email_3'] ?>"><?= $row['email_3'] ?></a></div>
  787. <?php endif; ?>
  788. </div>
  789. <div class="whatsapp">
  790. <?php if(!empty($row['whatsapp_1'])): ?>
  791. <div><?= $row['whatsapp_1'] ?></div>
  792. <?php endif; ?>
  793. <?php if(!empty($row['whatsapp_2'])): ?>
  794. <div><?= $row['whatsapp_2'] ?></div>
  795. <?php endif; ?>
  796. <?php if(!empty($row['whatsapp_3'])): ?>
  797. <div><?= $row['whatsapp_3'] ?></div>
  798. <?php endif; ?>
  799. </div>
  800. <div class="wechat">
  801. <?php if(!empty($row['wechat_1'])): ?>
  802. <div><?= $row['wechat_1'] ?></div>
  803. <?php endif; ?>
  804. <?php if(!empty($row['wechat_2'])): ?>
  805. <div><?= $row['wechat_2'] ?></div>
  806. <?php endif; ?>
  807. <?php if(!empty($row['wechat_3'])): ?>
  808. <div><?= $row['wechat_3'] ?></div>
  809. <?php endif; ?>
  810. </div>
  811. <div class="linkedin">
  812. <?php if(!empty($row['linkedin_1'])): ?>
  813. <div><?= $row['linkedin_1'] ?></div>
  814. <?php endif; ?>
  815. <?php if(!empty($row['linkedin_2'])): ?>
  816. <div><?= $row['linkedin_2'] ?></div>
  817. <?php endif; ?>
  818. <?php if(!empty($row['linkedin_3'])): ?>
  819. <div><?= $row['linkedin_3'] ?></div>
  820. <?php endif; ?>
  821. </div>
  822. <div class="facebook">
  823. <?php if(!empty($row['facebook_1'])): ?>
  824. <div><?= $row['facebook_1'] ?></div>
  825. <?php endif; ?>
  826. <?php if(!empty($row['facebook_2'])): ?>
  827. <div><?= $row['facebook_2'] ?></div>
  828. <?php endif; ?>
  829. <?php if(!empty($row['facebook_3'])): ?>
  830. <div><?= $row['facebook_3'] ?></div>
  831. <?php endif; ?>
  832. </div>
  833. <div class="alibaba">
  834. <?php if(!empty($row['alibaba_1'])): ?>
  835. <div><?= $row['alibaba_1'] ?></div>
  836. <?php endif; ?>
  837. <?php if(!empty($row['alibaba_2'])): ?>
  838. <div><?= $row['alibaba_2'] ?></div>
  839. <?php endif; ?>
  840. <?php if(!empty($row['alibaba_3'])): ?>
  841. <div><?= $row['alibaba_3'] ?></div>
  842. <?php endif; ?>
  843. </div>
  844. </div>
  845. <div class="noteItem2">备注</div>
  846. <div class="notecontent"><?= htmlUnCode($row['cs_note']) ?></div>
  847. </div>
  848. <?php
  849. }
  850. } else {
  851. if (empty($keys)) {
  852. echo '<tr><div align="center" colspan="9">Sorry,当前暂无信息</div></tr>';
  853. } else {
  854. echo '<tr><div align="center" colspan="9"><a href="?">Sorry,没有找到"' .
  855. htmlspecialcharsFix($keyscode) . '"相关的信息,点击返回</a></div></tr>';
  856. }
  857. }
  858. ?>
  859. <div colspan="9">
  860. <div class="showpagebox">
  861. <?php
  862. if ($totalPages > 1) {
  863. $pageName = "?Keys=$keys$urlStr&";
  864. $pageLen = 3;
  865. if ($page > 1) {
  866. echo "<a href=\"{$pageName}Page=1\">首页</a>";
  867. echo "<a href=\"{$pageName}Page=" . ($page - 1) . "\">上一页</a>";
  868. }
  869. if ($pageLen * 2 + 1 >= $totalPages) {
  870. $startPage = 1;
  871. $endPage = $totalPages;
  872. } else {
  873. if ($page <= $pageLen + 1) {
  874. $startPage = 1;
  875. $endPage = $pageLen * 2 + 1;
  876. } else {
  877. $startPage = $page - $pageLen;
  878. $endPage = $page + $pageLen;
  879. }
  880. if ($page + $pageLen > $totalPages) {
  881. $startPage = $totalPages - $pageLen * 2;
  882. $endPage = $totalPages;
  883. }
  884. }
  885. for ($i = $startPage; $i <= $endPage; $i++) {
  886. if ($i == $page) {
  887. echo "<a class=\"current\">$i</a>";
  888. } else {
  889. echo "<a href=\"{$pageName}Page=$i\">$i</a>";
  890. }
  891. }
  892. if ($page < $totalPages) {
  893. if ($totalPages - $page > $pageLen) {
  894. echo "<a href=\"{$pageName}Page=$totalPages\">...$totalPages</a>";
  895. }
  896. echo "<a href=\"{$pageName}Page=" . ($page + 1) . "\">下一页</a>";
  897. echo "<a href=\"{$pageName}Page=$totalPages\">尾页</a>";
  898. }
  899. }
  900. ?>
  901. </div>
  902. <?php require_once 'postchkbox.php'; ?>
  903. </div>
  904. </div>
  905. </form>
  906. </div>
  907. </body>
  908. </html>