ZhaoshangController.class.php 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257
  1. <?php
  2. /**
  3. * 小梦科技资源nanodreamtech.com
  4. *
  5. * ==========================================================================
  6. * @link https://www.nanodreamtech.com/
  7. * @copyright Copyright (c) 2015 liofis.com.
  8. * @license https://www.nanodreamtech.com/license.html License
  9. * ==========================================================================
  10. *
  11. * @author fish
  12. *
  13. */
  14. namespace Home\Controller;
  15. use Think\Controller;
  16. class ZhaoshangController extends Controller {
  17. protected function _initialize()
  18. {
  19. $site_logo = M('config')->where( array('name' => 'SITE_ICON') )->find();
  20. $site_c = M('config')->where( array('name' => 'SITE_NAME') )->find();
  21. $site_tel = M('config')->where( array('name' => 'site_tel') )->find();
  22. $site_woketime = M('config')->where( array('name' => 'site_woketime') )->find();
  23. $site_qqun = M('config')->where( array('name' => 'site_qqun') )->find();
  24. $this->site_c = $site_c;
  25. $this->site_logo = $site_logo;
  26. $this->site_tel = $site_tel;
  27. $this->site_woketime = $site_woketime;
  28. $this->site_qqun = $site_qqun;
  29. }
  30. public function index()
  31. {
  32. $this->display();
  33. }
  34. /**
  35. * 个人入驻申请
  36. */
  37. public function iddEntry()
  38. {
  39. $this->display();
  40. }
  41. /**
  42. 个人入驻提交
  43. **/
  44. public function idd_sub()
  45. {
  46. $result = array('code' => 1);
  47. $data = I('post.');
  48. session('idd_sub', $data);
  49. echo json_encode($result);
  50. die();
  51. }
  52. /**
  53. 商家入驻申请
  54. **/
  55. public function bus_sub()
  56. {
  57. $result = array('code' => 1);
  58. $data = I('post.');
  59. session('bus_sub', $data);
  60. echo json_encode($result);
  61. die();
  62. }
  63. /**
  64. 个人入驻店铺资料
  65. **/
  66. public function idd_qualification()
  67. {
  68. $goods_category = M('goods_category')->where( array('pid' => 0) )->select();
  69. $this->goods_category = $goods_category;
  70. $this->next_url = U('Zhaoshang/idd_quali_sub');
  71. $this->display('qualification');
  72. }
  73. /**
  74. 商家入驻店铺资料提交
  75. **/
  76. public function bus_quali_sub()
  77. {
  78. $data = I('post.');
  79. $bus_subdata = session('bus_sub');
  80. $result = array('code' => 0);
  81. if(empty($bus_subdata))
  82. {
  83. $result['msg'] = '请返回上一步填写资料';
  84. echo json_encode($result);
  85. die();
  86. }
  87. $ck_apply_name = M('apply')->where( array('store_name' => $data['store_name']) )->find();
  88. if(!empty($ck_apply_name))
  89. {
  90. $result['msg'] = '该店铺名称已经被申请';
  91. echo json_encode($result);
  92. die();
  93. }
  94. $ck_apply_mobile = M('apply')->where( array('mobile' => $bus_subdata['admin_mobile']) )->find();
  95. if(!empty($ck_apply_mobile))
  96. {
  97. $result['msg'] = '该手机号已经申请入驻';
  98. echo json_encode($result);
  99. die();
  100. }
  101. $ckname = M('seller')->where( array('s_true_name' =>$data['store_name']) )->find();
  102. if(!empty($ckname))
  103. {
  104. $result['msg'] = '该店铺名称已经存在';
  105. echo json_encode($result);
  106. die();
  107. }
  108. $ckmobile = M('seller')->where( array('s_mobile' =>$bus_subdata['admin_mobile']) )->find();
  109. if(!empty($ckname))
  110. {
  111. $result['msg'] = '该手机号已经被店铺注册';
  112. echo json_encode($result);
  113. die();
  114. }
  115. $apply_data = array();
  116. $apply_data['username'] = htmlspecialchars($bus_subdata['admin_real_name']);
  117. $apply_data['member_id'] = 0;
  118. $apply_data['mobile'] = htmlspecialchars($bus_subdata['admin_mobile']);
  119. $apply_data['email'] = htmlspecialchars($bus_subdata['admin_email']);
  120. $apply_data['store_name'] = htmlspecialchars($data['store_name']);
  121. $apply_data['city'] = htmlspecialchars($data['city_name']);
  122. $apply_data['category_id'] = htmlspecialchars($data['store_category']);
  123. $apply_data['type'] = 1;
  124. $apply_data['state'] = 0;
  125. $apply_data['addtime'] = time();
  126. $aid = M('apply')->add($apply_data);
  127. $rel_data = array_merge($data, $bus_subdata);
  128. $apply_relship_data = array();
  129. $apply_relship_data['aid'] = $aid;
  130. $apply_relship_data['seller_id'] = 0;
  131. $apply_relship_data['rel_data'] = serialize($rel_data);
  132. $apply_relship_data['addtime'] = time();
  133. M('apply_relship')->add($apply_relship_data);
  134. $result['code'] =1;
  135. echo json_encode($result);
  136. die();
  137. }
  138. /**
  139. 个人入驻店铺资料提交
  140. **/
  141. public function idd_quali_sub()
  142. {
  143. $data = I('post.');
  144. $idd_subdata = session('idd_sub');
  145. $result = array('code' => 0);
  146. if(empty($idd_subdata))
  147. {
  148. $result['msg'] = '请返回上一步填写资料';
  149. echo json_encode($result);
  150. die();
  151. }
  152. $ck_apply_name = M('apply')->where( array('store_name' => $data['store_name']) )->find();
  153. if(!empty($ck_apply_name))
  154. {
  155. $result['msg'] = '该店铺名称已经被申请';
  156. echo json_encode($result);
  157. die();
  158. }
  159. $ck_apply_mobile = M('apply')->where( array('mobile' => $idd_subdata['admin_mobile']) )->find();
  160. if(!empty($ck_apply_mobile))
  161. {
  162. $result['msg'] = '该手机号已经申请入驻';
  163. echo json_encode($result);
  164. die();
  165. }
  166. $ckname = M('seller')->where( array('s_true_name' =>$data['store_name']) )->find();
  167. if(!empty($ckname))
  168. {
  169. $result['msg'] = '该店铺名称已经存在';
  170. echo json_encode($result);
  171. die();
  172. }
  173. $ckmobile = M('seller')->where( array('s_mobile' =>$idd_subdata['admin_mobile']) )->find();
  174. if(!empty($ckname))
  175. {
  176. $result['msg'] = '该手机号已经被店铺注册';
  177. echo json_encode($result);
  178. die();
  179. }
  180. $apply_data = array();
  181. $apply_data['username'] = htmlspecialchars($idd_subdata['admin_real_name']);
  182. $apply_data['member_id'] = 0;
  183. $apply_data['mobile'] = htmlspecialchars($idd_subdata['admin_mobile']);
  184. $apply_data['email'] = htmlspecialchars($idd_subdata['admin_email']);
  185. $apply_data['store_name'] = htmlspecialchars($data['store_name']);
  186. $apply_data['city'] = htmlspecialchars($data['city_name']);
  187. $apply_data['category_id'] = htmlspecialchars($data['store_category']);
  188. $apply_data['state'] = 0;
  189. $apply_data['addtime'] = time();
  190. $aid = M('apply')->add($apply_data);
  191. $rel_data = array_merge($data, $idd_subdata);
  192. $apply_relship_data = array();
  193. $apply_relship_data['aid'] = $aid;
  194. $apply_relship_data['seller_id'] = 0;
  195. $apply_relship_data['rel_data'] = serialize($rel_data);
  196. $apply_relship_data['addtime'] = time();
  197. M('apply_relship')->add($apply_relship_data);
  198. $result['code'] =1;
  199. echo json_encode($result);
  200. die();
  201. }
  202. /**
  203. 申请成功
  204. **/
  205. public function resultCheck()
  206. {
  207. $this->display();
  208. }
  209. /**
  210. 商家入驻店铺资料
  211. **/
  212. public function bus_qualification()
  213. {
  214. $goods_category = M('goods_category')->where( array('pid' => 0) )->select();
  215. $this->goods_category = $goods_category;
  216. $this->next_url = U('Zhaoshang/bus_quali_sub');
  217. $this->display('qualification');
  218. }
  219. /**
  220. * 商家入驻申请
  221. */
  222. public function busEntry()
  223. {
  224. $this->display();
  225. }
  226. }