選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。
 
 
 
 

153 行
6.5 KiB

  1. <?php
  2. header("Access-Control-Allow-Origin:*");
  3. $post = $_POST;
  4. $time = date("Y-m-d H:i:s",time());
  5. if($post['user_type'] == 0){
  6. $post['channel_id'] = empty($post['channel_id'])?0:$post['channel_id'];
  7. $post['teamwork'] = empty($post['teamwork'])?0:$post['teamwork'];
  8. if(!empty($post['channel_name']) && !empty($post['linkman']) && !empty($post['com_tel']) && !empty($post['channel_admin'])){
  9. $sql = "insert into base_customer(CHAN_QUALITY,ORG_ID,CHAN_NAME,CHAN_SHORT,CHAN_TYPE,AREA_ID,LINKMAN,LINK_TEL,RESMAN,SELA_TYPE,STATUS,CHAN_AGREEMENT,USER_TYPE,CREATE_TIME)
  10. values(2,0,'$post[channel_name]','$post[teamwork]',$post[saleStyle],$post[cantonal],'$post[linkman]',$post[com_tel],'$post[channel_admin]','$post[saleStyle_company]',0,$post[channel_id],0,'$time')";
  11. $result = $pdo ->exec($sql);
  12. if($result){
  13. $sql = "select CUST_ID from base_customer where CREATE_TIME = '$time'";
  14. $result=$pdo->query($sql);
  15. if($result){
  16. $arr = $result->fetchAll(PDO::FETCH_ASSOC);
  17. $cust_id = $arr[0]['CUST_ID'];
  18. $password = md5("Zzcx8888");
  19. $sql = "insert into base_user(USER_PASSWORD,CREATE_TIME,STATUS)
  20. values('$password','$time',1)";
  21. $result = $pdo ->exec($sql);
  22. if($result){
  23. $sql = "select ID from base_user where CREATE_TIME = '$time'";
  24. $result=$pdo->query($sql);
  25. if($result){
  26. $arr = $result->fetchAll(PDO::FETCH_ASSOC);
  27. $id = $arr[0]['ID'];
  28. $sql = "update base_customer set USER_ID = $id where CUST_ID = $cust_id";
  29. $result=$pdo->exec($sql);
  30. if($result){
  31. $code = 0;
  32. $info = 'success';
  33. $massge = '成功';
  34. $list = array('cust_id' => $cust_id,'user_id' => $id);
  35. }else{
  36. $code = -6;
  37. $info = 'fail';
  38. $massge = '失败';
  39. $list = '';
  40. }
  41. }else{
  42. $code = -7;
  43. $info = 'fail';
  44. $massge = '失败';
  45. $list = '';
  46. }
  47. }else{
  48. $code = -8;
  49. $info = 'fail';
  50. $massge = '失败';
  51. $list = '4';
  52. }
  53. }else{
  54. $code = -1;
  55. $info = 'fail';
  56. $massge = '失败';
  57. $list = '3';
  58. }
  59. }else{
  60. $code = -1;
  61. $info = 'fail';
  62. $massge = '失败';
  63. $list =$sql;
  64. }
  65. }else{
  66. $code = -1;
  67. $info = 'fail';
  68. $massge = '失败';
  69. $list = '1';
  70. }
  71. }else{
  72. if(!empty($post['agency_name']) && !empty($post['linkman_id']) && !empty($post['tel_personal']) && !empty($post['principal_personal'])){
  73. $post['com_name'] = empty($post['com_name'])?0:$post['com_name'];
  74. $sql = "insert into base_customer(CHAN_QUALITY,ORG_ID,CHAN_NAME,CHAN_TYPE,AREA_ID,LINKMAN,LINK_TEL,RESMAN,SELA_TYPE,STATUS,ID_CARD,COM_NAME,USER_TYPE,CREATE_TIME)
  75. values(0,0,'$post[agency_name]',$post[saleStyle_personal],$post[cantonal],'$post[agency_name]',$post[tel_personal],'$post[principal_personal]',$post[saleStyle_personal_channel],0,$post[linkman_id],'$post[com_name]',1,'$time')";
  76. $result = $pdo ->exec($sql);
  77. if($result){
  78. $sql = "select CUST_ID from base_customer where CREATE_TIME = '$time'";
  79. $result=$pdo->query($sql);
  80. if($result){
  81. $arr = $result->fetchAll(PDO::FETCH_ASSOC);
  82. $cust_id = $arr[0]['CUST_ID'];
  83. $password = md5("Zzcx8888");
  84. $sql = "insert into base_user(USER_PASSWORD,CREATE_TIME,STATUS)
  85. values('$password','$time',1)";
  86. $result = $pdo ->exec($sql);
  87. if($result){
  88. $sql = "select ID from base_user where CREATE_TIME = '$time'";
  89. $result=$pdo->query($sql);
  90. if($result){
  91. $arr = $result->fetchAll(PDO::FETCH_ASSOC);
  92. $id = $arr[0]['ID'];
  93. $sql = "update base_customer set USER_ID = $id where CUST_ID = $cust_id";
  94. $result=$pdo->exec($sql);
  95. if($result){
  96. $code = 0;
  97. $info = 'success';
  98. $massge = '成功';
  99. $list = array('cust_id' => $cust_id,'user_id' => $id);
  100. }else{
  101. $code = -6;
  102. $info = 'fail';
  103. $massge = '失败';
  104. $list = '6';
  105. }
  106. }else{
  107. $code = -7;
  108. $info = 'fail';
  109. $massge = '失败';
  110. $list = '5';
  111. }
  112. }else{
  113. $code = -8;
  114. $info = 'fail';
  115. $massge = '失败';
  116. $list = '4';
  117. }
  118. }else{
  119. $code = -1;
  120. $info = 'fail';
  121. $massge = '失败';
  122. $list = '3';
  123. }
  124. }else{
  125. $code = -1;
  126. $info = 'fail';
  127. $massge = '失败';
  128. $list = '';
  129. }
  130. }else{
  131. $code = -1;
  132. $info = 'fail';
  133. $massge = '失败';
  134. $list = '1';
  135. }
  136. }
  137. $json['code'] = $code;
  138. $json['info'] = $info;
  139. $json['massge'] = $massge;
  140. $json['list'] = $list;
  141. echo json_encode($json);
  142. ?>