作者 郭鑫

功能、接口上传

正在显示 37 个修改的文件 包含 4418 行增加318 行删除
@@ -15,9 +15,40 @@ use think\Db; @@ -15,9 +15,40 @@ use think\Db;
15 use think\Request; 15 use think\Request;
16 use think\Loader; 16 use think\Loader;
17 use SmsDemo; 17 use SmsDemo;
  18 +use api\portal\model\CodeModel;
18 19
19 class CommonController extends HomeBaseController 20 class CommonController extends HomeBaseController
20 { 21 {
  22 +// connect 1 登录注册 ,2其他
  23 + public function _initialize()
  24 + {
  25 + if($this->request->param('connect')){
  26 + $connect = $this->request->param('connect');
  27 + }else{
  28 + $connect = 2;
  29 + }
  30 + if($connect == 2){
  31 + $where_firstMember['token'] = $this->request->param('token');
  32 + $firstMember = Db::name('Member')->where($where_firstMember)->field('id,update_time')->find();
  33 + if($firstMember){
  34 + if(($firstMember['update_time']+604800) < time() ){
  35 + $firstStr = rand(1000,9999).time().rand(100,999);
  36 + $firstData['token'] = $this->md5($firstStr);
  37 + $firstData['update_time'] = time();
  38 + $firstData['status'] = 1;
  39 + $firstLogin = Db::name('Member')->where($where_firstMember)->update($firstData);
  40 + if($firstLogin){
  41 + $this->apiResponse('0','请重新登录');
  42 + }else{
  43 + $this->apiResponse('0','token重置失败');
  44 + }
  45 + }
  46 + }else{
  47 + $this->apiResponse('0','暂未注册');
  48 + }
  49 + }
  50 +
  51 + }
21 /** 52 /**
22 * API返回信息格式函数 ;0失败,1成功,-1需要登录 53 * API返回信息格式函数 ;0失败,1成功,-1需要登录
23 * @param string $code 54 * @param string $code
@@ -50,6 +81,28 @@ class CommonController extends HomeBaseController @@ -50,6 +81,28 @@ class CommonController extends HomeBaseController
50 $response = SmsDemo::sendSms($tel,$code,$modelVal); 81 $response = SmsDemo::sendSms($tel,$code,$modelVal);
51 return $response; 82 return $response;
52 } 83 }
  84 +// 发送验证码
  85 +// $tel 手机号
  86 +// $code 短信模板
  87 +// $type 类型
  88 + public function SmsResult($tel,$code,$type){
  89 +// $tel = $request->param('tel');
  90 +// $code = 'SMS_137416617';
  91 + $modelVal = rand(1000,9999);
  92 + $sendResult = $this->sendLogin($tel,$code,$modelVal);
  93 + $add_code['tel'] = $tel;
  94 + $add_code['code'] = $modelVal;
  95 + $add_code['type'] = $type;
  96 + $model_code = new CodeModel();
  97 + $save_code = $model_code->save($add_code);
  98 + if(!$save_code){
  99 + $this->apiResponse('0','验证码获取失败');
  100 + }
  101 + if(($sendResult->Code) != 'OK'){
  102 + $this->apiResponse('0','注册失败');
  103 + }
  104 + }
  105 +
53 106
54 // 用户登录 107 // 用户登录
55 public function isLogin(){ 108 public function isLogin(){
@@ -64,4 +117,10 @@ class CommonController extends HomeBaseController @@ -64,4 +117,10 @@ class CommonController extends HomeBaseController
64 } 117 }
65 } 118 }
66 119
  120 +// 生成订单随机数
  121 + public function getmath(){
  122 + $return = rand(1000,9999).time().rand(1000,9999);
  123 + return $return;
  124 + }
  125 +
67 } 126 }
@@ -51,7 +51,7 @@ class IndexController extends CommonController @@ -51,7 +51,7 @@ class IndexController extends CommonController
51 ->find(); 51 ->find();
52 $final['process']['content'] = htmlspecialchars_decode($final['process']['content']); 52 $final['process']['content'] = htmlspecialchars_decode($final['process']['content']);
53 // 3. 最新成交 53 // 3. 最新成交
54 - 54 +// Db::name('Agency')->where()
55 55
56 56
57 57
@@ -10,12 +10,13 @@ namespace api\portal\controller; @@ -10,12 +10,13 @@ namespace api\portal\controller;
10 10
11 use api\portal\model\PortalPostModel; 11 use api\portal\model\PortalPostModel;
12 use cmf\controller\RestBaseController; 12 use cmf\controller\RestBaseController;
  13 +use api\portal\model\MemberModel;
13 use think\Db; 14 use think\Db;
14 use think\Request; 15 use think\Request;
15 use think\Loader; 16 use think\Loader;
16 17
17 /** 18 /**
18 - * @title 用户接口 19 + * @title 中介接口
19 * @description 接口说明 20 * @description 接口说明
20 * @group 接口分组 21 * @group 接口分组
21 */ 22 */
@@ -43,45 +44,65 @@ class IntermediaryController extends CommonController @@ -43,45 +44,65 @@ class IntermediaryController extends CommonController
43 * @param name:name type:int require:1 default: other: desc:姓名 44 * @param name:name type:int require:1 default: other: desc:姓名
44 * @param name:tel type:int require:1 default: other: desc:手机号 45 * @param name:tel type:int require:1 default: other: desc:手机号
45 * @param name:password type:int require:1 default: other: desc:密码 46 * @param name:password type:int require:1 default: other: desc:密码
  47 + * @param name:code type:int require:1 default: other: desc:验证码
  48 + * @param name:city type:int require:1 default: other: desc:城市
  49 + * @param name:company type:int require:1 default: other: desc:所属公司
  50 + * @param name:store type:int require:1 default: other: desc:门店
  51 + * @param name:quarters type:int require:1 default: other: desc:服务小区
46 */ 52 */
47 53
48 public function join(Request $request) 54 public function join(Request $request)
49 { 55 {
50 if($request->Post()){ 56 if($request->Post()){
51 // 验证 57 // 验证
52 - $validate = Loader::validate('Intermediary');  
53 - if(!$validate->scene('add')->check($_POST)){ 58 + $validate = Loader::validate('User');
  59 + if(!$validate->scene('intermediary')->check($_POST)){
54 return json(array('code'=>0,'msg'=>$validate->getError())); 60 return json(array('code'=>0,'msg'=>$validate->getError()));
55 } 61 }
56 -// 密码  
57 - $_POST['password'] = $this->md5($_POST['password']); 62 + $data['password'] = $this->md5($_POST['password']);
  63 + $sure_password = $this->md5($_POST['sure_password']);
58 // 确认密码 64 // 确认密码
59 - if($_POST['password'] != $_POST['sure_password']){ 65 + if($data['password'] != $sure_password){
60 $this->apiResponse('0','两次密码不一致'); 66 $this->apiResponse('0','两次密码不一致');
61 } 67 }
62 -// 短信验证码(未完) 68 +
  69 +// 验证码
  70 + $data['tel'] = $_POST['tel'];
  71 + $code = $request->param('code');
  72 + $where_code['tel'] = $data['tel'];
  73 + $where_code['type'] = 1;
  74 + $where_code['create_time'] = array('lt',(time()+300));
  75 + $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
  76 + if(!$find_code){
  77 + $this->apiResponse('0','验证码错误,请重新获取');
  78 + }
  79 + if($code != $find_code['code']){
  80 + $this->apiResponse('0','验证码错误,请重新获取');
  81 + }else{
  82 + Db::name('Code')->where($where_code)->delete();
  83 + }
  84 + $data['name'] = $_POST['name'];
63 85
64 // 判断手机号是否已注册 86 // 判断手机号是否已注册
65 - $user = new MemberModel($_POST);  
66 - $where_user['tel'] = $_POST['tel']; 87 + $user = new MemberModel();
  88 + $where_user['tel'] = $data['tel'];
67 $is_isset = $user->where($where_user)->find(); 89 $is_isset = $user->where($where_user)->find();
68 if($is_isset){ 90 if($is_isset){
69 $this->apiResponse('0','您已注册过,请直接登录'); 91 $this->apiResponse('0','您已注册过,请直接登录');
70 } 92 }
71 - echo "<pre/>";  
72 - print_r('1111');  
73 - die;  
74 - $str = rand('1000,9999').time().rand('100,999');  
75 - $_POST['token'] = $this->md5($str);  
76 - $add = $user->allowField(true)->save(); 93 + $str = rand(1000,9999).time().rand(100,999);
  94 + $data['token'] = $this->md5($str);
  95 + $data['type'] = 2;
  96 + $data['city'] = $request->param('city');
  97 + $data['company'] = $request->param('company');
  98 + $data['store'] = $request->param('store');
  99 + $data['quarters'] = $request->param('quarters');
  100 +
  101 + $add = $user->allowField(true)->save($data);
77 if($add){ 102 if($add){
78 - echo "<pre/>";  
79 - print_r('1');  
80 - die; 103 + $this->apiResponse('1','注册成功');
81 }else{ 104 }else{
82 - echo "<pre/>";  
83 - print_r('2');  
84 - die; 105 + $this->apiResponse('0','注册失败');
85 } 106 }
86 107
87 }else{ 108 }else{
@@ -90,7 +111,7 @@ class IntermediaryController extends CommonController @@ -90,7 +111,7 @@ class IntermediaryController extends CommonController
90 // $list = $service->publishedArticle(1,1)->toArray(); 111 // $list = $service->publishedArticle(1,1)->toArray();
91 $where_pro['status'] = 1; 112 $where_pro['status'] = 1;
92 $where_pro['type'] = 2; 113 $where_pro['type'] = 2;
93 - $list = Db::name('Protocol')->where($where_pro)->order("update_time desc")->find(); 114 + $list = Db::name('Protocol')->where($where_pro)->order("update_time desc")->field("title,content")->find();
94 // 推荐人(未完) 115 // 推荐人(未完)
95 116
96 117
@@ -103,45 +124,313 @@ class IntermediaryController extends CommonController @@ -103,45 +124,313 @@ class IntermediaryController extends CommonController
103 } 124 }
104 } 125 }
105 126
  127 +// 中介个人中心左侧信息
  128 + public function left($token){
  129 + $where_member['token'] = $token;
  130 + $where_member['status'] = 1;
  131 + $member = Db::name('Member')->where($where_member)->field('name,id,start,reputation,company,store,quarters,tel,city')->find();
  132 + if(!$member){
  133 + $this->apiResponse('0','用户信息错误');
  134 + }
  135 +// 查询签到信息
  136 + $where_checkin['agency_id'] = $member['id'];
  137 + $tme_str = date('Y-m-d',time());
  138 + $where_checkin['create_time'] = strtotime($tme_str);
  139 + $is_check = Db::name('Checkin')->where($where_checkin)->find();
  140 + if($is_check){
  141 + $member['is_checkin'] = 1;
  142 + }else{
  143 + $member['is_checkin'] = 0;
  144 + }
  145 + return $member;
  146 + }
  147 +
106 148
107 -// 登录  
108 - public function login(Request $request){  
109 - if($request->post()){  
110 -// 登录验证  
111 -// 判空  
112 - $tel = $request->param('tel');  
113 - $password = $request->param('password');  
114 - $true = $request->param('true');  
115 - $token = $request->param('token');  
116 - if(empty($tel)){  
117 - $this->apiResponse('0','手机号不能为空');  
118 - }else if(empty($password)){  
119 - $this->apiResponse('0','密码不能为空');  
120 - }else if(empty($true)){  
121 - $this->apiResponse('0','验证码不能为空'); 149 + /**
  150 + * @title 中介个人中心首页(over)
  151 + * @description 接口说明
  152 + * @author 开发者
  153 + * @url /api/portal/Intermediary/myIndex
  154 + * @method POST
  155 + * @param name:token type:int require:1 default: other: desc:token
  156 + * @param name:page type:int require:1 default: other: desc:页码
  157 + */
  158 + public function myIndex(Request $request){
  159 + $token = $request->param('token');
  160 + $member = $this->left($token);
  161 + $final['intermediary'] = $member;
  162 + $where_need['city'] = $member['city'];
  163 + $where_need['status'] = 2;
  164 + $where_need['quarters'] = array('like','%'.$member['quarters'].'%');
  165 + $page = $request->param('page');
  166 + $need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time,people")->limit(10)->page($page)->select()->toArray();
  167 + if($need_list){
  168 + $final['intermediary_need'] = $need_list;
  169 + }else{
  170 + $final['intermediary_need'] = array();
  171 + }
  172 + $this->apiResponse('1','成功',$final);
  173 + }
  174 +
  175 +
  176 + /**
  177 + * @title 中介个人中心匹配需求详情(over)
  178 + * @description 接口说明
  179 + * @author 开发者
  180 + * @url /api/portal/Intermediary/mySend
  181 + * @method POST
  182 + * @param name:token type:int require:1 default: other: desc:token
  183 + * @param name:need_id type:int require:1 default: other: desc:需求id
  184 + */
  185 + public function mySend(Request $request){
  186 + $token = $request->param('token');
  187 + $member = $this->left($token);
  188 + $final['intermediary'] = $member;
  189 + if(!$request->param('need_id')){
  190 + $this->apiResponse('0','请选择需求id');
  191 + }
  192 + $where_need['id'] = $request->param('need_id');
  193 + $where_need['status'] = 2;
  194 + $need_list = Db::name('UserNeed')->where($where_need)
  195 + ->field("id,user_id,city,quarters,room,floor,house_type,renovation,area,is_first,loan,contract,quotation_time,create_time,people")
  196 + ->find();
  197 + if($need_list){
  198 + $final['intermediary_need'] = $need_list;
  199 + }else{
  200 + $final['intermediary_need'] = array();
  201 + }
  202 + $this->apiResponse('1','成功',$final);
  203 + }
  204 +
  205 +// 查询中介报价
  206 +// $need_id 需求id
  207 + public function agencyOffer($user_id,$need_id){
  208 + $where_agency['status'] = 2;
  209 + $where_agency['create_time'] = array('lt',time());
  210 + $where_agency['need_id'] = $need_id;
  211 + $agency_list = Db::name('Agency')
  212 + ->where($where_agency)
  213 + ->field("id,housing_price,assessment_tax,security_tax,else_tax,service_charge")
  214 + ->select()->toArray();
  215 + $final_list = array();
  216 + $add_arr = array();
  217 + if($agency_list){
  218 + foreach ($agency_list as $agencyk=>$agencyv){
  219 + $final_list[$agencyk]['need_id'] = $need_id;
  220 + $final_list[$agencyk]['agency_id'] = $agencyv['id'];
  221 + $final_list[$agencyk]['user_id'] = $user_id;
  222 + $money = $agencyv['housing_price']*10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'] ;
  223 + $money_arr[] = $money;
  224 + $fianlMoney = substr($money, 0,-4);
  225 + $final_list[$agencyk]['true_money'] = $money;
  226 + $final_list[$agencyk]['money'] = $fianlMoney;
122 } 227 }
123 -// 验证  
124 - $where_member['tel'] = $tel;  
125 - $where_member['password'] = $password;  
126 -// $where_member['token'] = $token;  
127 - $member = Db::name('Member')->where($where_member)->find();  
128 - if($member){  
129 - if($member['token'] != $token){  
130 - $this->apiResponse('0','登录失败'); 228 + sort($money_arr);
  229 + foreach ($final_list as $finalk=>$finalv){
  230 + if($finalv['true_money'] == $money_arr[0]){
  231 + $add_arr['need_id'] = $finalv['need_id'];
  232 + $add_arr['agency_id'] = $finalv['agency_id'];
  233 + $add_arr['user_id'] = $finalv['user_id'];
  234 + $add_arr['money'] = $finalv['money'];
  235 + $add_arr['create_time'] = time();
  236 + $add_arr['update_time'] = time();
131 } 237 }
132 - if($member['update_time'] >= (time()+604800)){  
133 - $this->apiResponse('0','请重新登录');  
134 - }else{  
135 - $this->apiResponse('1','登录成功');  
136 - }  
137 - }else{  
138 - $this->apiResponse('0','您输入的账号或密码不正确');  
139 } 238 }
  239 + $save = Db::name('See')->insertGetId($add_arr);
  240 + $return['id'] = $save;
  241 + $return['money'] = $add_arr['money'];
  242 + $return['time'] = time();
  243 + return $return;
  244 + }
  245 + }
  246 +
  247 +
  248 +
  249 +
  250 +// 透视卡
  251 +//token
  252 +//need_id
  253 + public function see(Request $request){
  254 + $data = $request->param();
  255 + $user = $this->left($data['token']);
  256 + $user_id = $user['id'];
  257 +// 购买支付
  258 +
  259 +
  260 +
  261 +// 成功加入记录
  262 +// 加订单
  263 + $add = array();
  264 + $add['name'] = '购买透视卡';
  265 + $add['order_sn'] = $this->getmath();
  266 + $add['type'] = 3;
  267 + $add['need_id'] = $data['need_id'];
  268 + $add['is_get'] = 2;
  269 +// 查询透视卡金额
  270 + $add['money'] = 2;
  271 +
  272 + $add['status'] = 1;
  273 + $add['create_time'] = time();
  274 + $add['update_time'] = time();
  275 + $order_id = Db::name('Order')->insertGetId($add);
  276 + if(!$order_id){
  277 + $this->apiResponse('0','购买失败');
  278 + }
  279 +
  280 +// 支付成功
  281 +// 修改订单状态
  282 + $where_order['order_sn'] = $data['order_sn'];
  283 + $save['update_time'] = time();
  284 + $save['pay_time'] = time();
  285 + $is_save = Db::name('Order')->where($where_order)->update($save);
  286 + if($is_save){
  287 + return true;
  288 + }else{
  289 + return false;
  290 + }
  291 +// 查询报价
  292 + $money = $this->agencyOffer($user_id,$data['need_id']);
  293 +
  294 + }
140 295
  296 + /**
  297 + * @title 中介个人中心我的报价
  298 + * @description 接口说明
  299 + * @author 开发者
  300 + * @url /api/portal/Intermediary/myMoney
  301 + * @method POST
  302 + * @param name:token type:int require:1 default: other: desc:token
  303 + * @param name:page type:int require:1 default: other: desc:页码
  304 + */
  305 + public function myMoney(Request $request){
  306 + $data = $request->param();
  307 + $my = $this->left($data['token']);
  308 + $final['intermediary'] = $my;
  309 + $where_need['agency_id'] = $my['id'];
  310 + $page = $data['page'];
  311 + $need = Db::name('Agency')->where($where_need)->limit(10)->page($page)->select()->toArray();
  312 + if($need){
  313 + $final['need'] = $need;
  314 + }else{
  315 + $final['need'] = array();
  316 + }
  317 + $this->apiResponse('1','成功',$final);
  318 + }
141 319
  320 + /**
  321 + * @title 中介个人中心我的报价详情
  322 + * @description 接口说明
  323 + * @author 开发者
  324 + * @url /api/portal/Intermediary/myDetail
  325 + * @method POST
  326 + * @param name:token type:int require:1 default: other: desc:token
  327 + * @param name:intermediaryNeed_id type:int require:1 default: other: desc:报价id
  328 + */
  329 + public function myDetail(Request $request){
  330 + $data = $request->param();
  331 + $my = $this->left($data['token']);
  332 + $final['intermediary'] = $my;
  333 + $where_need['agency_id'] = $my['id'];
  334 + $where_need['i.id'] = $data['intermediaryNeed_id'];
  335 + $need = Db::name('Agency')->alias('i')
  336 + ->where($where_need)
  337 + ->join("hp_user_need u",'u.id = i.need_id')
  338 + ->find();
  339 + if($need){
  340 + $final['need'] = $need;
142 }else{ 341 }else{
143 -// 返回验证码图片 342 + $final['need'] = array();
  343 + }
  344 + $this->apiResponse('1','成功',$final);
  345 + }
144 346
  347 +
  348 +
  349 + /**
  350 + * @title 中介个人中心我的资料
  351 + * @description 接口说明
  352 + * @author 开发者
  353 + * @url /api/portal/Intermediary/myDetail
  354 + * @method POST
  355 + * @param name:token type:int require:1 default: other: desc:token
  356 + * @param name:intermediaryNeed_id type:int require:1 default: other: desc:报价id
  357 + */
  358 + public function mySelf(Request $request){
  359 + $data = $request->param();
  360 + $my = $this->left($data['token']);
  361 + $final['intermediary'] = $my;
  362 + $where_card['user_id'] = $my['id'];
  363 + $where_card['status'] = 1;
  364 + $card = Db::name('Card')->where($where_card)->select()->toArray();
  365 + $final['card'] = $card;
  366 + $this->apiResponse('1','成功',$final);
  367 + }
  368 +
  369 + /**
  370 + * @title 中介资料修改
  371 + * @description 接口说明
  372 + * @author 开发者
  373 + * @url /api/portal/Intermediary/myIndex
  374 + * @method POST
  375 + * @param name:token type:int require:1 default: other: desc:token
  376 + * @param name:company type:int require:1 default: other: desc:所属公司
  377 + * @param name:store type:int require:1 default: other: desc:门店
  378 + * @param name:quarters type:int require:1 default: other: desc:服务小区
  379 + * @return data:''@
  380 + * @data status:'状态(1->待发布,2->已发布,待报价,3->已成交,4->未交保证金,5->已过期,6->未选择中介,7->中介未确认,8->报价人数不足,9->删除)'
  381 + */
  382 + public function myChange(Request $request){
  383 +
  384 + $update_member = $request->param();
  385 + $update_member['status'] = 1;
  386 + $update_member['type'] = 2;
  387 + $model = new MemberModel();
  388 + $member = $model->update($update_member);
  389 + if(!$member){
  390 + $this->apiResponse('0','更新失败');
  391 + }else{
  392 + $this->apiResponse('1','更新成功');
  393 + }
  394 +
  395 + }
  396 +
  397 +
  398 + /**
  399 + * @title 中介签到
  400 + * @description 接口说明
  401 + * @author 开发者
  402 + * @url /api/portal/Intermediary/checkIn
  403 + * @method POST
  404 + * @param name:token type:int require:1 default: other: desc:token
  405 + * @return data:''@
  406 + */
  407 + public function checkIn(Request $request){
  408 + $data = $request->param();
  409 + $mes = $this->left($data['token']);
  410 + if($mes['is_checkin'] == 0){
  411 + $add['agency_id'] = $mes['id'];
  412 + $time = date('Y-m-d',time());
  413 + $add['create_time'] = strtotime($time);
  414 + $add['update_time'] = time();
  415 + $result = Db::name('Checkin')->insertGetId($add);
  416 + if($request){
  417 + $where_addStart['id'] = $mes['id'];
  418 + $addStart = Db::name('Member')->where($where_addStart)->setInc('start',1);
  419 + if($addStart){
  420 + $this->apiResponse('1','签到成功');
  421 + }else{
  422 + $this->apiResponse('0','签到失败');
  423 + }
  424 + }else{
  425 + $this->apiResponse('0','签到失败');
  426 + }
  427 + }else{
  428 + $this->apiResponse('0','您已签到');
145 } 429 }
146 } 430 }
  431 +
  432 +
  433 +
  434 +
  435 +
147 } 436 }
1 -<?php  
2 -// +----------------------------------------------------------------------  
3 -// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]  
4 -// +----------------------------------------------------------------------  
5 -// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.  
6 -// +----------------------------------------------------------------------  
7 -// | Author: wuwu <15093565100@163.com>  
8 -// +----------------------------------------------------------------------  
9 -namespace api\portal\controller;  
10 -  
11 -use api\portal\model\MemberModel;  
12 -use api\portal\model\PortalPostModel;  
13 -use cmf\controller\RestBaseController;  
14 -use think\Db;  
15 -use think\Request;  
16 -use think\Loader;  
17 -use think\Config;  
18 -use think\captcha\Captcha;  
19 -use think\Url;  
20 -use SmsDemo;  
21 -//use think\Route;  
22 -/**  
23 - * @title 用户接口  
24 - * @description 接口说明  
25 - * @group 接口分组  
26 - */  
27 -  
28 -class IntermediaryNeedController extends CommonController  
29 -{  
30 - protected $postModel;  
31 - public function __construct(PortalPostModel $postModel)  
32 - {  
33 - parent::__construct();  
34 - $this->postModel = $postModel;  
35 - }  
36 - /**  
37 - * @title 用户发布需求的保证金  
38 - * @description 接口说明  
39 - * @author 开发者  
40 - * @url /api/portal/UserNeed/payMoney  
41 - * @method POST  
42 - * @param name:city type:int require:1 default: other: desc:地区  
43 - * @param name:quarters type:int require:1 default: other: desc:小区  
44 - * @param name:password type:int require:1 default: other: desc:密码  
45 - */  
46 - public function payMoney(Request $request){  
47 - $data = $request->param();  
48 - if(!$data['city'] || !$data['area'] ){  
49 - $this->apiResponse('0','城市、面积不能为空');  
50 - }  
51 - $city = $data['city'];  
52 - $area = $data['area'];  
53 - $where_money[''] =  
54 - Db::name('MoneyRule')->where()  
55 - }  
56 -  
57 -  
58 - /**  
59 - * @title 用户发布需求  
60 - * @description 接口说明  
61 - * @author 开发者  
62 - * @url /api/portal/UserNeed/send  
63 - * @method POST  
64 - * @param name:city type:int require:1 default: other: desc:地区  
65 - * @param name:quarters type:int require:1 default: other: desc:小区  
66 - * @param name:password type:int require:1 default: other: desc:密码  
67 - */  
68 - public function send(Request $request)  
69 - {  
70 - if($request->Post()){  
71 - $data = $request->param();  
72 -// 判空,处理  
73 -// 加数据库  
74 - }else{  
75 -// 问答内容  
76 - $where_pro['status'] = 1;  
77 - $list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->find();  
78 - if($list){  
79 - $this->apiResponse('1','成功',$list);  
80 - }else{  
81 - $this->apiResponse('0','暂无内容');  
82 - }  
83 -  
84 - }  
85 - }  
86 -  
87 -  
88 -  
89 -  
90 -}  
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Author: wuwu <15093565100@163.com>
  8 +// +----------------------------------------------------------------------
  9 +namespace api\portal\controller;
  10 +
  11 +use api\portal\model\AgencyModel;
  12 +use api\portal\model\OrderModel;
  13 +use api\portal\model\UserNeedModel;
  14 +use api\portal\model\MemberModel;
  15 +use api\portal\model\PortalPostModel;
  16 +use cmf\controller\RestBaseController;
  17 +use think\Db;
  18 +use think\Request;
  19 +use think\Loader;
  20 +use think\Config;
  21 +use think\captcha\Captcha;
  22 +use think\Url;
  23 +use SmsDemo;
  24 +//use think\Route;
  25 +/**
  26 + * @title 中介需求接口
  27 + * @description 接口说明
  28 + * @group 接口分组
  29 + */
  30 +
  31 +class IntermediaryneedController extends CommonController
  32 +{
  33 + protected $postModel;
  34 + public function __construct(PortalPostModel $postModel)
  35 + {
  36 + parent::__construct();
  37 + $this->postModel = $postModel;
  38 + }
  39 + /**
  40 + * @title 中介报价时保证金金额(填完房价调用;每次修改重新调用)
  41 + * @description 接口说明
  42 + * @author 开发者
  43 + * @url /api/portal/Intermediaryneed/payMoney
  44 + * @method POST
  45 + * @param name:housing_price type:int require:1 default: other: desc:房价
  46 + * @param name:token type:int require:1 default: other: desc:token
  47 + */
  48 + public function payMoney(Request $request){
  49 + $data = $request->param();
  50 + $where_inteRule['status'] = 1;
  51 + $where_inteRule['low'] = array('gt',$data['housing_price']);
  52 + $where_inteRule['height'] = array('lt',$data['housing_price']);
  53 + $inte_money = Db::name('IntermediaryRule')->where($where_inteRule)->field('money')->find();
  54 + if(!$inte_money){
  55 + $this->apiResponse('0','保证金获取失败');
  56 + }else{
  57 + $this->apiResponse('1','成功',$inte_money['money']);
  58 + }
  59 + }
  60 +
  61 +
  62 + /**
  63 + * @title 匹配需求
  64 + * @description 接口说明
  65 + * @author 开发者
  66 + * @url /api/portal/Intermediaryneed/sendNeed
  67 + * @method POST
  68 + * @param name:token type:int require:1 default: other: desc:token
  69 + * @return data:''@
  70 + * @data city:'地区'
  71 + * @data quarters:'小区'
  72 + * @data room:'具体房号'
  73 + * @data floor:'楼层'
  74 + * @data house_type:'户型'
  75 + * @data renovation:'装修'
  76 + * @data quotation_time:'报价时间(天)'
  77 + * @data create_time:'发布时间'
  78 + * @data people:'报价人数'
  79 + */
  80 + public function sendNeed(Request $request){
  81 + $data = $request->param();
  82 + $where_member['token'] = $data['token'];
  83 +// 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配)
  84 + $member_find = Db::name('Member')->where($where_member)->field("city,quarters")->find();
  85 + if(!$member_find){
  86 + $this->apiResponse('0','用户信息错误');
  87 + }
  88 + $where_need['city'] = $member_find['city'];
  89 + $where_need['status'] = 2;
  90 + $where_need['quarters'] = array('like','%'.$member_find['quarters'].'%');
  91 + $need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters,room,floor,house_type,renovation,quotation_time,create_time")->select()->toArray();
  92 + if($need_list){
  93 + $this->apiResponse('1','成功',$need_list);
  94 + }else{
  95 + $this->apiResponse('0','该地区暂无匹配需求');
  96 + }
  97 +
  98 + }
  99 +
  100 + /**
  101 + * @title 中介报价
  102 + * @description 接口说明
  103 + * @author 开发者
  104 + * @url /api/portal/Intermediaryneed/send
  105 + * @method POST
  106 + * @param name:need_id type:varchar require:1 default: other: desc:需求id
  107 + * @param name:housing_price type:varchar require:1 default: other: desc:房价
  108 + * @param name:assessment_tax type:varchar require:1 default: other: desc:评估税
  109 + * @param name:value_added_tax type:int require:1 default: other: desc:增值税
  110 + * @param name:security_tax type:varchar require:1 default: other: desc:贷款担保税
  111 + * @param name:deed_tax type:varchar require:1 default: other: desc:契税
  112 + * @param name:else_tax type:varchar require:1 default: other: desc:其他税费
  113 + * @param name:personal_income_tax type:tinyint require:1 default: other: desc:个税
  114 + * @param name:service_charge type:tinyint require:1 default: other: desc:居间服务费
  115 + * @param name:else type:int require:1 default: other: desc:备注
  116 + * @param name:token type:varchar require:1 default: other: desc:token
  117 + * @return data:''@
  118 + * @data is_loan:'全款'
  119 + * @data is_contract:'非包干价'
  120 + */
  121 + public function send(Request $request)
  122 + {
  123 + if($request->Post('token') && $request->Post('housing_price')){
  124 +// 判空,处理
  125 + $validate = Loader::validate('IntermediaryNeed');
  126 + if(!$validate->scene('offer')->check($_POST)){
  127 + return json(array('code'=>0,'msg'=>$validate->getError()));
  128 + }
  129 +// 加数据库
  130 + $data = $request->Post();
  131 + $model = new AgencyModel();
  132 + $where_mem['token'] = $data['token'];
  133 + $mem_id = Db::name('Member')->where($where_mem)->field('id')->find();
  134 + $data['agency_id'] = $mem_id['id'];
  135 +// 判断是否已发布过
  136 + $where_isIsset['need_id'] = $data['need_id'];
  137 + $where_isIsset['agency_id'] = $mem_id['id'];
  138 + $find_isset = $model->where($where_isIsset)->find();
  139 + if($find_isset){
  140 + $this->apiResponse('0','该房屋您已参与报价');
  141 + }
  142 +
  143 + $data['all_price'] = $data['housing_price']*10000 + $data['assessment_tax'] + $data['value_added_tax'] + $data['security_tax'] + $data['deed_tax'] + $data['else_tax'] + $data['personal_income_tax'] + $data['service_charge'];
  144 +// 查询中介保证金
  145 + $where_inteRule['status'] = 1;
  146 + $where_inteRule['low'] = array('lt',$data['housing_price']);
  147 + $where_inteRule['height'] = array('egt',$data['housing_price']);
  148 + $inte_money = Db::name('IntermediaryRule')->where($where_inteRule)->field('money')->find();
  149 + if(!$inte_money){
  150 + $this->apiResponse('0','保证金获取失败');
  151 + }else{
  152 + $data['deposit'] = $inte_money['money'];
  153 + }
  154 + unset($data['token']);
  155 + $save = $model->save($data);
  156 + $final['intermediaryNeed_id'] = $model->getLastInsID();
  157 +
  158 + if($save){
  159 + $this->apiResponse('1','添加成功',$final);
  160 + }else{
  161 + $this->apiResponse('0','添加失败');
  162 + }
  163 + }else{
  164 +// 问答内容
  165 + $where_pro['status'] = 1;
  166 + $where_pro['type'] = 2;
  167 + $list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->field("title,content,id,type")->select()->toArray();
  168 + foreach ($list as $lk=>$lv){
  169 + $list[$lk]['content'] = htmlspecialchars_decode($lv['content']);
  170 + }
  171 + if($list){
  172 + $final['content'] = $list;
  173 +// 查询用户发布需求
  174 + if(!$request->param('need_id')){
  175 + $this->apiResponse('0','请选择报价房屋');
  176 + }
  177 + $where_need['id'] = $request->param('need_id');
  178 + $where_need['status'] = 2;
  179 + $need = Db::name('UserNeed')->where($where_need)->field("loan,contract")->find();
  180 + if(!$need){
  181 + $this->apiResponse('0','该需求暂不可报价');
  182 + }
  183 +// 全款
  184 + if($need['loan'] == 2 ){
  185 + $final['is_loan'] = 1;
  186 + }
  187 +// 包干价
  188 + if($need['contract'] == 2 ){
  189 + $final['is_contract'] = 1;
  190 + }
  191 + $this->apiResponse('1','成功',$final);
  192 + }else{
  193 + $this->apiResponse('0','暂无内容');
  194 + }
  195 + }
  196 + }
  197 +
  198 +
  199 +// 报价支付(付款成功,报价人数+1)
  200 + public function needPay(Request $request){
  201 +// 添加订单
  202 + Db::startTrans();
  203 + $data = $request->param();
  204 + if(!$data['need_id']){
  205 + $this->apiResponse('0','需求不能为空');
  206 + }
  207 +// 查询金额
  208 + $where_need['id'] = $data['need_id'];
  209 + $where_need['status'] = 1;
  210 + $should_pay = Db::name('UserNeed')->where($where_need)->field('pay_money')->find();
  211 + if(!$should_pay){
  212 + $this->apiResponse('0','需求错误');
  213 + }else{
  214 + if(!$should_pay['pay_money']){
  215 + $this->apiResponse('0','诚意金金额有误');
  216 + }
  217 + }
  218 +// 拼字度
  219 + $add['need_id'] = $data['need_id'];
  220 + $add['money'] = $should_pay['pay_money'];
  221 + $add['name'] = '诚意金缴纳';
  222 + $add['type'] = 1;
  223 + $add['is_get'] = 2;
  224 + $add['status'] = 1;
  225 +// 加入数据库
  226 + $model = new OrderModel();
  227 + $save = $model->save($add);
  228 + if($save){
  229 + Db::commit();
  230 + }else{
  231 + Db::rollback();
  232 + }
  233 +// 支付(未完)
  234 +echo "<pre/>";
  235 +print_r('3333');
  236 +die;
  237 +// 更改订单状态
  238 +// 成功
  239 + $update['pay_time'] = time();
  240 + $update['status'] = time();
  241 + $update = $model->isUpdate(true)->allowField(true)->save($update);
  242 + if($update){
  243 + $this->apiResponse('1','支付成功');
  244 + }
  245 +
  246 + }
  247 +
  248 +
  249 +
  250 +
  251 +
  252 +
  253 +}
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Author: wuwu <15093565100@163.com>
  8 +// +----------------------------------------------------------------------
  9 +namespace api\portal\controller;
  10 +
  11 +
  12 +use cmf\controller\HomeBaseController;
  13 +use api\portal\model\PortalPostModel;
  14 +use cmf\controller\RestBaseController;
  15 +use think\Db;
  16 +use think\Request;
  17 +use think\Loader;
  18 +use think\Config;
  19 +use think\captcha\Captcha;
  20 +use think\Url;
  21 +use SmsDemo;
  22 +//use think\Route;
  23 +/**
  24 + * @title 30分钟后发布
  25 + * @description 接口说明
  26 + * @group 接口分组
  27 + */
  28 +
  29 +class ThirdsendController extends HomeBaseController
  30 +{
  31 + protected $postModel;
  32 + public function __construct(PortalPostModel $postModel)
  33 + {
  34 + parent::__construct();
  35 + $this->postModel = $postModel;
  36 + }
  37 +
  38 +// 查询中介报价
  39 +// $need_id 需求id
  40 + public function Offer($user_id,$need_id){
  41 + $where_agency['status'] = 2;
  42 + $where_agency['create_time'] = array('lt',time());
  43 + $where_agency['need_id'] = $need_id;
  44 + $agency_list = Db::name('Agency')
  45 + ->where($where_agency)
  46 +// ->field("id,housing_price,assessment_tax,security_tax,else_tax,service_charge")
  47 + ->select()->toArray();
  48 + if($agency_list){
  49 + foreach ($agency_list as $agencyk=>$agencyv){
  50 +// $final_list[$agencyk] = $agencyv;
  51 +// $final_list[$agencyk]['agency_id'] = $agencyv['id'];
  52 +// $final_list[$agencyk]['user_id'] = $user_id;
  53 + $money = $agencyv['housing_price']*10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'] ;
  54 + $money_arr[] = $money;
  55 + $fianlMoney = substr($money, 0,-4);
  56 + $agency_list[$agencyk]['true_money'] = $money;
  57 +// $final_list[$agencyk]['money'] = $fianlMoney;
  58 + }
  59 + sort($money_arr);
  60 + if(count($money_arr) > 3 ){
  61 + foreach ($agency_list as $finalk=>$finalv){
  62 + foreach ($money_arr as $monryk=>$moneyv){
  63 + if($finalv['true_money'] == $moneyv){
  64 + $return[] = $finalv;
  65 + }
  66 + }
  67 + }
  68 + }else{
  69 + $save['status'] = 8;
  70 + }
  71 +
  72 + return $return;
  73 + }
  74 + }
  75 +
  76 +
  77 +
  78 +// 30分钟后发布
  79 + public function thirdSend(){
  80 + Db::startTrans();
  81 + $where_need['status'] = 1;
  82 + $userNeedList = Db::name('UserNeed')->where($where_need)->field('id,create_time')->select()->toArray();
  83 + $time = time();
  84 + $change_arr = array();
  85 + foreach ($userNeedList as $userk=>$userv){
  86 + if($userv['create_time'] <= ($time+60) && $userv['create_time'] >= $time){
  87 + $change_arr[] = $userv['id'];
  88 + }
  89 + }
  90 + if($change_arr){
  91 + $where_save['id'] = array('in',$change_arr);
  92 + $save['status'] = 2;
  93 + $save['update_time'] = time();
  94 + $fianl_save = Db::name('UserNeed')->where($where_save)->update($save);
  95 + if($fianl_save){
  96 + Db::commit();
  97 + }else{
  98 + Db::rollback();
  99 + }
  100 + }
  101 + }
  102 +
  103 +// 规定时间结束报价
  104 + public function over()
  105 + {
  106 + Db::startTrans();
  107 +// 查询用户发布需求信息
  108 + $where_need['status'] = 2;
  109 + $userNeedList = Db::name('UserNeed')->where($where_need)->field('id,quotation_time,create_time')->select()->toArray();
  110 + $change_arr = array();
  111 + $time = time();
  112 + $time = '1529734985';
  113 +// 循环需求,查询相应报价
  114 + foreach ($userNeedList as $uNeedk => $uNeedv) {
  115 + $final_time = $uNeedv['create_time'] + $uNeedv['quotation_time'] * 86400;
  116 + if ($final_time <= ($time + 60) && $final_time >= $time) {
  117 + $us_middleid = $uNeedv['id'];
  118 + $where_agency['a.status'] = 2;
  119 + $where_agency['a.create_time'] = array('lt', time());
  120 + $where_agency['a.need_id'] = $uNeedv['id'];
  121 + $where_agency['m.type'] = 2;
  122 + $where_agency['m.status'] = 1;
  123 + $agency_list = Db::name('Agency')->alias('a')
  124 + ->where($where_agency)
  125 + ->join("hp_Member m", 'm.id = a.agency_id')
  126 + ->field('a.*,m.company')
  127 + ->select()->toArray();
  128 +// 查询品牌企业
  129 + $where_brand['status'] = 1;
  130 + $band_list = Db::name('Brand')->where($where_brand)->column('name');
  131 + $agen_arr = array();
  132 + $money_arr = array();
  133 + if ($agency_list) {
  134 + // 判断是否超过三个报价人
  135 + if (count($agency_list) >= 3) {
  136 +// 查询三人中是否有品牌中介
  137 +// 循环匹配品牌企业
  138 + foreach ($agency_list as $agencyk => $agencyv) {
  139 + foreach ($band_list as $brak => $brav) {
  140 +// 判断是否在品牌企业中
  141 + if (strstr($brav, $agencyv['company']) !== false) {
  142 +// 存在
  143 + $agen_money = $agencyv['housing_price'] * 10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'];
  144 + if (empty($agen_arr)) {
  145 + $agen_arr[0]['money'] = $agen_money;
  146 + $agen_arr[0]['id'] = $agencyv['id'];
  147 + } else {
  148 +// 判断大小
  149 + if ($agen_money < $agen_arr[0]['money']) {
  150 + $agen_arr[0]['money'] = $agen_money;
  151 + $agen_arr[0]['id'] = $agencyv['id'];
  152 +
  153 + }
  154 + }
  155 + }
  156 + }
  157 +// 取出前三报价
  158 + $money = $agencyv['housing_price'] * 10000 + $agencyv['assessment_tax'] + $agencyv['security_tax'] + $agencyv['else_tax'] + $agencyv['service_charge'];
  159 + $money_list[$agencyv['id']] = $money;
  160 + }
  161 + asort($money_list);
  162 + $k = 0;
  163 + foreach ($money_list as $mok => $mov) {
  164 + if ($k < 3) {
  165 + $fin_list[$k]['id'] = $mok;
  166 + $fin_list[$k]['money'] = $mov;
  167 + $fin_arr[] = $mok;
  168 + }
  169 + $k += 1;
  170 + }
  171 + $ag_id = implode(',', $fin_arr);
  172 + $userSave_status['status'] = 5;
  173 + $agencySave_status['status'] = 4;
  174 +
  175 + } else {
  176 +// 报价小于3人,更改订单状态,报价失败
  177 + $userSave_status['status'] = 4;
  178 + $agencySave_status['status'] = 7;
  179 + }
  180 + } else {
  181 +// 没有报价
  182 + $userSave_status['status'] = 4;
  183 + $agencySave_status['status'] = 7;
  184 +
  185 + }
  186 + $us_id = implode(',', $us_middleid);
  187 +// 插入数据库
  188 +// 用户需求表
  189 + $where_us['id'] = array('in', $us_id);
  190 + $fianl_Ussave = Db::name('UserNeed')->where($where_us)->update($userSave_status);
  191 + if(!$fianl_Ussave){
  192 + Db::rollback();
  193 + }
  194 +// 中介报价表
  195 + $where_ag['id'] = array('in', $ag_id);
  196 + $fianl_Agsave = Db::name('Agency')->where($where_ag)->update($agencySave_status);
  197 + if(!$fianl_Agsave){
  198 + Db::rollback();
  199 + }else{
  200 + Db::commit();
  201 + }
  202 +
  203 + }
  204 +
  205 + }
  206 + }
  207 +
  208 +// 三天用户选择
  209 + public function userChoose(){
  210 + Db::startTrans();
  211 +// 查询用户发布需求信息
  212 + $where_need['status'] = 2;
  213 + $userNeedList = Db::name('UserNeed')->where($where_need)->field('id,quotation_time,create_time')->select()->toArray();
  214 +
  215 +
  216 +
  217 + }
  218 +
  219 +
  220 +
  221 +
  222 +// 三天中介确认
  223 + public function intermediaryChoose(){
  224 +
  225 + }
  226 +
  227 +
  228 +
  229 +
  230 +}
@@ -8,6 +8,7 @@ @@ -8,6 +8,7 @@
8 // +---------------------------------------------------------------------- 8 // +----------------------------------------------------------------------
9 namespace api\portal\controller; 9 namespace api\portal\controller;
10 10
  11 +
11 use api\portal\model\MemberModel; 12 use api\portal\model\MemberModel;
12 use api\portal\model\PortalPostModel; 13 use api\portal\model\PortalPostModel;
13 use cmf\controller\RestBaseController; 14 use cmf\controller\RestBaseController;
@@ -35,30 +36,77 @@ class UserController extends CommonController @@ -35,30 +36,77 @@ class UserController extends CommonController
35 } 36 }
36 37
37 // 验证码图片 38 // 验证码图片
38 - function getImgUrl($id = "") 39 + public function getImgUrl($id = "")
39 { 40 {
40 \think\Route::get('captcha/[:id]', "\\think\\captcha\\CaptchaController@index"); 41 \think\Route::get('captcha/[:id]', "\\think\\captcha\\CaptchaController@index");
41 \think\Validate::extend('captcha', function ($value, $id = "") { 42 \think\Validate::extend('captcha', function ($value, $id = "") {
42 return captcha_check($value, $id, (array)\think\Config::get('captcha')); 43 return captcha_check($value, $id, (array)\think\Config::get('captcha'));
43 }); 44 });
  45 +
44 $middle_url = \think\Url::build('/captcha/new' . ($id ? "/{$id}" : '')); 46 $middle_url = \think\Url::build('/captcha/new' . ($id ? "/{$id}" : ''));
45 $rand = str_replace(".","",substr(microtime(true),-5)).rand(1000,9999); 47 $rand = str_replace(".","",substr(microtime(true),-5)).rand(1000,9999);
46 $imgUrl = $middle_url."&time=".$rand; 48 $imgUrl = $middle_url."&time=".$rand;
47 return $imgUrl; 49 return $imgUrl;
48 } 50 }
49 -// 获取短信验证码 51 +
  52 +
  53 +
  54 + /**
  55 + * @title 获取短信验证码(用户注册/中介注册)
  56 + * @description 接口说明
  57 + * @author 开发者
  58 + * @url /api/portal/User/getSmsResult
  59 + * @method POST
  60 + * @param name:tel type:int require:1 default: other: desc:手机号
  61 + * @param name:imgCode type:int require:1 default: other:genre=2时传 desc:图片验证码
  62 + * @param name:genre type:int require:1 default: other: desc:类型(1->用户注册/中介注册,2->密码找回,3->发布需求,4->修改手机号,5->绑定银行卡)
  63 + * @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:1
  64 + * @param name:token type:int require:1 default: other: desc:token
  65 + */
  66 +// 获取短信验证码(登录)
50 public function getSmsResult(Request $request){ 67 public function getSmsResult(Request $request){
51 // 短信验证码 68 // 短信验证码
  69 + if(!$request->param('tel')){
  70 + $this->apiResponse('0','请输入手机号');
  71 + }else{
52 $tel = $request->param('tel'); 72 $tel = $request->param('tel');
53 - $code = 'SMS_137416617';  
54 - $modelVal = rand(1000,9999);  
55 - $sendResult = $this->sendLogin($tel,$code,$modelVal);  
56 - if(($sendResult->Code) != 'OK'){  
57 - $this->apiResponse('0','注册失败');  
58 - }else{  
59 - $_SESSION('code',$modelVal);  
60 - $_SESSION('tel',$tel); 73 + }
  74 +
  75 + if(!$request->param('genre')){
  76 + $this->apiResponse('0','请选择类型');
  77 + }else{
  78 + $genre = $request->param('genre');
  79 + if($genre == 1 ){
  80 + $code = 'SMS_137416617';
  81 + $type = 1;
  82 + }else if($genre == 2 ){
  83 + // 验证图形验证码
  84 + // 验证码
  85 + session_start();
  86 + if(!$request->param('imgCode')){
  87 + $this->apiResponse('0','请先输入图形验证码');
  88 + }
  89 + $result = cmf_captcha_check($request->param('imgCode'));
  90 + if(!$result) {
  91 + $this->apiResponse('0','验证码错误');
  92 + }
  93 + $code = 'SMS_137411611';
  94 + $type = 2;
  95 + }else if($genre == 3 ){
  96 + $code = 'SMS_137426773';
  97 + $type = 3;
  98 + }else if($genre == 4 ){
  99 + $code = 'SMS_137421639';
  100 + $type = 4;
  101 + }else if($genre == 5 ){
  102 + $code = 'SMS_137416654';
  103 + $type = 5;
61 } 104 }
  105 +
  106 + $tel = $request->param('tel');
  107 + }
  108 +
  109 + $this->SmsResult($tel,$code,$type);
62 } 110 }
63 111
64 /** 112 /**
@@ -71,41 +119,41 @@ class UserController extends CommonController @@ -71,41 +119,41 @@ class UserController extends CommonController
71 * @param name:tel type:int require:1 default: other: desc:手机号 119 * @param name:tel type:int require:1 default: other: desc:手机号
72 * @param name:password type:int require:1 default: other: desc:密码 120 * @param name:password type:int require:1 default: other: desc:密码
73 * @param name:sure_password type:int require:1 default: other: desc:确认密码 121 * @param name:sure_password type:int require:1 default: other: desc:确认密码
  122 + * @param name:code type:int require:1 default: other: desc:验证码
  123 + * @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:1
  124 + * @return data:'token'
74 */ 125 */
75 public function join(Request $request) 126 public function join(Request $request)
76 { 127 {
77 - if($request->Post()){ 128 + if($request->Post() && $request->Post('name')) {
78 // 验证 129 // 验证
79 $validate = Loader::validate('User'); 130 $validate = Loader::validate('User');
80 - if(!$validate->scene('add')->check($_POST)){  
81 - return json(array('code'=>0,'msg'=>$validate->getError())); 131 + if (!$validate->scene('user')->check($_POST)) {
  132 + return json(array('code' => 0, 'msg' => $validate->getError()));
82 } 133 }
83 $data['password'] = $this->md5($_POST['password']); 134 $data['password'] = $this->md5($_POST['password']);
84 $sure_password = $this->md5($_POST['sure_password']); 135 $sure_password = $this->md5($_POST['sure_password']);
85 // 确认密码 136 // 确认密码
86 - if($data['password'] != $sure_password){  
87 - $this->apiResponse('0','两次密码不一致');  
88 - }  
89 - // 密码  
90 -  
91 -// 短信验证码  
92 -// $tel = $request->param('tel');  
93 -// $code = 'SMS_137416617';  
94 -// $modelVal = rand(1000,9999);  
95 -// $sendResult = $this->sendLogin($tel,$code,$modelVal);  
96 -// if(($sendResult->Code) != 'OK'){  
97 -// $this->apiResponse('0','注册失败');  
98 -// } 137 + if ($data['password'] != $sure_password) {
  138 + $this->apiResponse('0', '两次密码不一致');
  139 + }
  140 +
  141 +// 验证码
99 $data['tel'] = $_POST['tel']; 142 $data['tel'] = $_POST['tel'];
100 $code = $request->param('code'); 143 $code = $request->param('code');
101 - if($data['tel'] != $_SESSION['tel']){ 144 + $where_code['tel'] = $data['tel'];
  145 + $where_code['type'] = 1;
  146 + $where_code['create_time'] = array('lt',(time()+300));
  147 + $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
  148 + if(!$find_code){
  149 + $this->apiResponse('0','验证码错误,请重新获取1');
  150 + }
  151 + if($code != $find_code['code']){
102 $this->apiResponse('0','验证码错误,请重新获取'); 152 $this->apiResponse('0','验证码错误,请重新获取');
103 }else{ 153 }else{
104 - if($code != $_SESSION['code']){  
105 - $this->apiResponse('0','验证码错误,请重新获取');  
106 - } 154 + Db::name('Code')->where($where_code)->delete();
107 } 155 }
108 - unset($_SESSION['code']); 156 +
109 $data['name'] = $_POST['name']; 157 $data['name'] = $_POST['name'];
110 158
111 // 判断手机号是否已注册 159 // 判断手机号是否已注册
@@ -117,17 +165,29 @@ class UserController extends CommonController @@ -117,17 +165,29 @@ class UserController extends CommonController
117 } 165 }
118 $str = rand(1000,9999).time().rand(100,999); 166 $str = rand(1000,9999).time().rand(100,999);
119 $data['token'] = $this->md5($str); 167 $data['token'] = $this->md5($str);
  168 + $data['type'] = 1;
  169 + $data['start'] = 50;
120 $add = $user->allowField(true)->save($data); 170 $add = $user->allowField(true)->save($data);
121 if($add){ 171 if($add){
122 - $this->apiResponse('1','注册成功'); 172 + $startAdd['detail'] = '注册获得';
  173 + $startAdd['star'] = 50;
  174 + $startAdd['type'] = 1;
  175 + $startAdd['create_time'] = time();
  176 + $startAdd['update_time'] = time();
  177 + $star = Db::name('StartDetail')->insertGetId($startAdd);
  178 + if($star){
  179 + $this->apiResponse('1','注册成功',$data['token']);
  180 + }else{
  181 +
  182 + }
  183 +
  184 +
123 }else{ 185 }else{
124 $this->apiResponse('0','注册失败'); 186 $this->apiResponse('0','注册失败');
125 } 187 }
126 188
127 }else{ 189 }else{
128 // 服务协议 190 // 服务协议
129 -// $service = new PostService();  
130 -// $list = $service->publishedArticle(1,1)->toArray();  
131 $where_pro['status'] = 1; 191 $where_pro['status'] = 1;
132 $where_pro['type'] = 1; 192 $where_pro['type'] = 1;
133 $list = Db::name('Protocol')->where($where_pro)->order("update_time desc")->field("title,content")->find(); 193 $list = Db::name('Protocol')->where($where_pro)->order("update_time desc")->field("title,content")->find();
@@ -143,15 +203,27 @@ class UserController extends CommonController @@ -143,15 +203,27 @@ class UserController extends CommonController
143 } 203 }
144 } 204 }
145 205
146 - 206 + /**
  207 + * @title 用户登录
  208 + * @description 接口说明
  209 + * @author 开发者
  210 + * @url /api/portal/User/login
  211 + * @method POST
  212 + * @param name:tel type:int require:1 default: other: desc:手机号
  213 + * @param name:password type:int require:1 default: other: desc:密码
  214 + * @param name:imgCode type:int require:1 default: other: desc:验证码
  215 + * @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:1
  216 + * @return data:''@
  217 + * @data type:'1->用户,2->中介'
  218 + */
147 // 登录 219 // 登录
148 public function login(Request $request){ 220 public function login(Request $request){
149 - if($request->post()){ 221 + if($request->post() && $request->Post('tel')){
150 // 登录验证 222 // 登录验证
151 // 判空 223 // 判空
152 $tel = $request->param('tel'); 224 $tel = $request->param('tel');
153 $password = $request->param('password'); 225 $password = $request->param('password');
154 - $true = $request->param('true'); 226 + $true = $request->param('imgCode');
155 $token = $request->param('token'); 227 $token = $request->param('token');
156 if(empty($tel)){ 228 if(empty($tel)){
157 $this->apiResponse('0','手机号不能为空'); 229 $this->apiResponse('0','手机号不能为空');
@@ -161,46 +233,59 @@ class UserController extends CommonController @@ -161,46 +233,59 @@ class UserController extends CommonController
161 $this->apiResponse('0','验证码不能为空'); 233 $this->apiResponse('0','验证码不能为空');
162 } 234 }
163 // 验证 235 // 验证
  236 +// 验证码
  237 + session_start();
  238 + $result = cmf_captcha_check($true);
  239 + if(!$result) {
  240 + $this->apiResponse('0','验证码错误');
  241 + }
  242 +// 手机、密码
  243 +// $member_model = new MemberModel();
164 $where_member['tel'] = $tel; 244 $where_member['tel'] = $tel;
165 - $where_member['password'] = $password;  
166 -// $where_member['token'] = $token;  
167 - $member = Db::name('Member')->where($where_member)->find(); 245 + $where_member['password'] = $this->md5($password);
  246 + $token_str = rand(1000,9999).time().rand(100,999);
  247 + $update_member['token'] = $this->md5($token_str);
  248 + $update_member['update_time'] = time();
  249 + $member = Db::name('Member')->where($where_member)->update($update_member);
168 if($member){ 250 if($member){
169 - if($member['token'] != $token){  
170 - $this->apiResponse('0','登录失败');  
171 - }  
172 - if($member['update_time'] >= (time()+604800)){  
173 - $this->apiResponse('0','请重新登录');  
174 - }else{  
175 - $this->apiResponse('1','登录成功');  
176 - } 251 + $this->apiResponse('1','登录成功',$member);
177 }else{ 252 }else{
178 $this->apiResponse('0','您输入的账号或密码不正确'); 253 $this->apiResponse('0','您输入的账号或密码不正确');
179 } 254 }
180 -  
181 -  
182 }else{ 255 }else{
183 // 返回验证码图片 256 // 返回验证码图片
184 - 257 + $img = $this->getImgUrl();
  258 + $this->apiResponse('1','成功',$img);
185 } 259 }
186 } 260 }
187 261
188 262
189 - 263 + /**
  264 + * @title 用户退出登录
  265 + * @description 接口说明
  266 + * @author 开发者
  267 + * @url /api/portal/User/outLogin
  268 + * @method POST
  269 + * @param name:user_id type:int require:1 default: other: desc:user_id
  270 + * @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:2
  271 + * @param name:token type:int require:1 default: other: desc:token
  272 + */
190 // 退出登录 273 // 退出登录
191 public function outLogin(Request $request){ 274 public function outLogin(Request $request){
192 // 重置token 275 // 重置token
193 - $str = rand('1000,9999').time().rand('100,999'); 276 + $str = rand(1000,9999).time().rand(100,999);
194 $change['token'] = $this->md5($str); 277 $change['token'] = $this->md5($str);
195 $where_member['id'] = $request->param('user_id'); 278 $where_member['id'] = $request->param('user_id');
196 $where_member['token'] = $request->param('token'); 279 $where_member['token'] = $request->param('token');
197 $model = new MemberModel(); 280 $model = new MemberModel();
198 $member = $model->where($where_member)->find(); 281 $member = $model->where($where_member)->find();
199 if($member){ 282 if($member){
200 - $change['id'] = $request->param('user_id');  
201 - $update = $model->isUpdate(true)->allowField(true)->save($change); 283 + $where_change['id'] = $request->param('user_id');
  284 +// $update = $model->isUpdate(true)->allowField(true)->save($change);
  285 + $change['update_time'] = time();
  286 + $update = $model->where($where_change)->update($change);
202 if($update){ 287 if($update){
203 - unset($_SESSION['user_id']); 288 +// unset($_SESSION['user_id']);
204 $this->apiResponse('1','退出成功'); 289 $this->apiResponse('1','退出成功');
205 }else{ 290 }else{
206 $this->apiResponse('0','退出失败'); 291 $this->apiResponse('0','退出失败');
@@ -209,6 +294,490 @@ class UserController extends CommonController @@ -209,6 +294,490 @@ class UserController extends CommonController
209 $this->apiResponse('0','用户信息错误'); 294 $this->apiResponse('0','用户信息错误');
210 } 295 }
211 } 296 }
212 -// 修改密码 297 +
  298 + /**
  299 + * @title 用户修改密码
  300 + * @description 接口说明
  301 + * @author 开发者
  302 + * @url /api/portal/User/changePassword
  303 + * @method POST
  304 + * @param name:password type:int require:1 default: other: desc:旧密码
  305 + * @param name:newPassword type:int require:1 default: other: desc:新密码
  306 + * @param name:sureNewPassword type:int require:1 default: other: desc:确认新密码
  307 + * @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:2
  308 + * @param name:token type:int require:1 default: other: desc:token
  309 + */
  310 + // 修改密码
  311 + public function changePassword(Request $request){
  312 + $data = $request->param();
  313 + if(empty($data['password'])){
  314 + $this->apiResponse('0','请输入原密码');
  315 + }
  316 + if(empty($data['newPassword'])){
  317 + $this->apiResponse('0','请输入新密码');
  318 + }
  319 + if(empty($data['sureNewPassword'])){
  320 + $this->apiResponse('0','请输入确认新密码');
  321 + }
  322 + $where_member['password'] = $this->md5($data['password']);
  323 + $where_member['id'] = $data['user_id'];
  324 + $user_id = Db::name('Member')->where($where_member)->field('id')->find();
  325 + if($user_id){
  326 + if($data['newPassword'] == $data['sureNewPassword']){
  327 + $where_update['id'] = $user_id['id'];
  328 + $middleStr = rand(1000,9999).time().rand(100,999);
  329 + $update['token'] = $this->md5($middleStr);
  330 + $update['password'] = $this->md5($data['newPassword']);
  331 + $is_update = Db::name('Member')->where($where_update)->update($update);
  332 + if($is_update){
  333 + $this->apiResponse('1','成功',$update['token']);
  334 + }else{
  335 + $this->apiResponse('0','修改失败');
  336 + }
  337 + }else{
  338 + $this->apiResponse('0','两次密码输入不一致');
  339 + }
  340 + }else{
  341 + $this->apiResponse('0','原密码输入错误');
  342 + }
  343 + }
  344 +
  345 +
  346 + /**
  347 + * @title 密码找回
  348 + * @description 接口说明
  349 + * @author 开发者
  350 + * @url /api/portal/User/findPassword
  351 + * @method POST
  352 + * @param name:tel type:int require:1 default: other: desc:手机号
  353 + * @param name:imgCode type:int require:1 default: other: desc:图片验证码
  354 + * @param name:code type:int require:1 default: other: desc:短信验证码
  355 + * @param name:newPassword type:int require:1 default: other: desc:新密码
  356 + * @param name:sureNewPassword type:int require:1 default: other: desc:确认新密码
  357 + * @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:2
  358 + */
  359 + public function findPassword(Request $request){
  360 + $data = $request->param();
  361 + if($data){
  362 + if(empty($data['tel'])){
  363 + $this->apiResponse('0','请输入手机号');
  364 + }
  365 + if(empty($data['imgCode'])){
  366 + $this->apiResponse('0','请输入图片验证码');
  367 + }
  368 + if(empty($data['code'])){
  369 + $this->apiResponse('0','请输入短信验证码');
  370 + }
  371 + if(empty($data['newPassword'])){
  372 + $this->apiResponse('0','请输入新密码');
  373 + }
  374 + if(empty($data['sureNewPassword'])){
  375 + $this->apiResponse('0','请输入确认新密码');
  376 + }
  377 +// 验证手机验证码
  378 + $where_Code['tel'] = $data['tel'];
  379 + $where_Code['type'] = 2;
  380 + $code = Db::name('Code')->where($where_Code)->order('create_time desc')->find();
  381 + if($code['code'] != $data['code']){
  382 + $this->apiResponse('0','短信验证码错误');
  383 + }
  384 + $where_tel['tel'] = $data['tel'];
  385 + $is_isset = Db::name('Member')->where($where_tel)->field('id')->find();
  386 + if(!$is_isset){
  387 + $this->apiResponse('0','该手机号暂未注册');
  388 + }
  389 + if($data['newPassword'] == $data['sureNewPassword']){
  390 + $where_update['tel'] = $data['tel'];
  391 + $middleStr = rand(1000,9999).time().rand(100,999);
  392 + $update['token'] = $this->md5($middleStr);
  393 + $update['password'] = $this->md5($data['newPassword']);
  394 + $is_update = Db::name('Member')->where($where_update)->update($update);
  395 + if($is_update){
  396 + $this->apiResponse('1','成功',$update['token']);
  397 + }else{
  398 + $this->apiResponse('0','修改失败');
  399 + }
  400 + }else{
  401 + $this->apiResponse('0','两次密码输入不一致');
  402 + }
  403 +
  404 + }else{
  405 + // 返回验证码图片
  406 + $img = $this->getImgUrl();
  407 + $this->apiResponse('1','成功',$img);
  408 + }
  409 + }
  410 +
  411 +
  412 +
  413 + /**
  414 + * @title 绑定银行卡
  415 + * @description 接口说明
  416 + * @author 开发者
  417 + * @url /api/portal/User/myCard
  418 + * @method POST
  419 + * @param name:token type:int require:1 default: other: desc:token
  420 + * @param name:card_name type:int require:1 default: other: desc:银行名称
  421 + * @param name:card_num type:int require:1 default: other: desc:银行卡号
  422 + */
  423 + public function myCard(Request $request){
  424 + $data = $request->param();
  425 + $where_member['token'] = $data['token'];
  426 + $where_member['status'] = 1;
  427 + $member = Db::name('Member')->where($where_member)->field('id,name,tel')->find();
  428 + if(!empty($data['card_num'])){
  429 +// 验证码
  430 + $where_code['type'] = 5;
  431 + $code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find();
  432 + if($code != $data['code']){
  433 + $this->apiResponse('0','验证码错误');
  434 + }
  435 + $add['card_name'] = $data['card_name'];
  436 + $add['card_num'] = $data['card_num'];
  437 + $add['create_time'] = time();
  438 + $add['update_time'] = time();
  439 + $add['user_id'] = $member['id'];
  440 + $add_final = Db::name('Card')->insertGetId($add);
  441 + if($add_final){
  442 + $this->apiResponse('1','成功',$add_final);
  443 + }else{
  444 + $this->apiResponse('0','添加失败');
  445 + }
  446 + }else{
  447 + $this->apiResponse('1','成功',$member);
  448 + }
  449 + }
  450 +
  451 + /**
  452 + * @title 银行卡解除绑定
  453 + * @description 接口说明
  454 + * @author 开发者
  455 + * @url /api/portal/User/delMyCard
  456 + * @method POST
  457 + * @param name:token type:int require:1 default: other: desc:token
  458 + * @param name:card_id type:int require:1 default: other: desc:银行id
  459 + */
  460 + public function delMyCard(Request $request){
  461 + $data = $request->param();
  462 + $where_mem['token'] = $data['token'];
  463 + $where_mem['status'] = 1;
  464 + $user_id = Db::name('Member')->where($where_mem)->field('id')->find();
  465 + $where_card['status'] = 1;
  466 + $where_card['user_id'] = $user_id['id'];
  467 + $where_card['id'] = $data['card_id'];
  468 + $card = Db::name('Card')->where($where_card)->find();
  469 + if($card){
  470 + $save['status'] = 9;
  471 + $save['create_time'] = time();
  472 + $where_cardNext['id'] = $data['card_id'];
  473 + $card = Db::name('Card')->where($where_cardNext)->update($save);
  474 + if($card){
  475 + $this->apiResponse('1','成功');
  476 + }else{
  477 + $this->apiResponse('0','解除绑定失败');
  478 + }
  479 +
  480 + }else{
  481 + $this->apiResponse('0','解除绑定失败');
  482 + }
  483 + }
  484 +
  485 +
  486 +
  487 + /**
  488 + * @title 用户个人中心首页(over)
  489 + * @description 接口说明
  490 + * @author 开发者
  491 + * @url /api/portal/User/myIndex
  492 + * @method POST
  493 + * @param name:token type:int require:1 default: other: desc:token
  494 + */
  495 + public function myIndex(Request $request){
  496 + $token = $request->param('token');
  497 + $where_member['token'] = $token;
  498 + $where_member['status'] = 1;
  499 + $member = Db::name('Member')->where($where_member)->field('tel,id')->find();
  500 + if(!$member){
  501 + $this->apiResponse('0','用户信息错误');
  502 + }
  503 + $final['user'] = $member;
  504 + $where_userNeed['user_id'] = $member['id'];
  505 + $user_need = Db::name('UserNeed')->where($where_userNeed)->order('create_time desc')->select();
  506 + if($user_need){
  507 + $final['user_need'] = $user_need;
  508 + }else{
  509 + $final['user_need'] = array();
  510 + }
  511 + $this->apiResponse('1','成功',$final);
  512 + }
  513 +
  514 +
  515 +
  516 +
  517 +
  518 +
  519 +
  520 +// 用户信息
  521 + public function myleft($token){
  522 + $where_member['token'] = $token;
  523 + $where_member['status'] = 1;
  524 + $member = Db::name('Member')->where($where_member)->field('tel,id,name,referee_tel')->find();
  525 + if(!$member){
  526 + $this->apiResponse('0','用户信息错误');
  527 + }
  528 + return $member;
  529 + }
  530 +
  531 +
  532 +
  533 + /**
  534 + * @title 用户个人中心我的比价/比价详情(over)
  535 + * @description 接口说明
  536 + * @author 开发者
  537 + * @url /api/portal/User/myIndex
  538 + * @method POST
  539 + * @param name:token type:int require:1 default: other: desc:token
  540 + * @return data:''@
  541 + * @data status:'状态(1->待发布,2->已发布,待报价,3->已成交,4->未交保证金,5->已过期,6->未选择中介,7->中介未确认,8->报价人数不足,9->删除)'
  542 + */
  543 + public function myNeed(Request $request){
  544 + $token = $request->param('token');
  545 + $member = $this->myleft($token);
  546 + $final['user'] = $member;
  547 + $where_userNeed['user_id'] = $member['id'];
  548 + $where_userNeed['status'] = array('neq',9);
  549 + $user_need = Db::name('UserNeed')->where($where_userNeed)->order('create_time desc')->select();
  550 + if($user_need){
  551 + $final['user_need'] = $user_need;
  552 + }else{
  553 + $final['user_need'] = array();
  554 + }
  555 + $final['user'] = $member;
  556 + $this->apiResponse('1','成功',$final);
  557 + }
  558 +
  559 +
  560 + /**
  561 + * @title 我的比价明细
  562 + * @description 接口说明
  563 + * @author 开发者
  564 + * @url /api/portal/User/compareDetail
  565 + * @method POST
  566 + * @param name:token type:int require:1 default: other: desc:token
  567 + * @param name:need_id type:int require:1 default: other: desc:需求id
  568 + */
  569 + public function compareDetail(Request $request){
  570 + $token = $request->param('token');
  571 + $member = $this->myleft($token);
  572 + $data = $request->param();
  573 + $where_need['id'] = $data['need_id'];
  574 + $where_need['user_id'] = $member['id'];
  575 + $where_need['status'] = 5;
  576 + $userNeed = Db::name('UserNeed')->where($where_need)->find();
  577 + $final['need'] = $userNeed;
  578 + $final['user'] = $member;
  579 + if($userNeed){
  580 +// 查询报价
  581 + $where_agency['need_id'] = $data['need_id'];
  582 + $where_agency['status'] = 4;
  583 + $agency = Db::name('Agency')->alias('a')
  584 + ->where($where_agency)
  585 + ->join("hp_Member m", 'm.id = a.agency_id')
  586 + ->field('a.*,a.id as agency_id,
  587 + m.id as user_id,m.name,m.company,m.store,m.tel,m.reputation,m.start')
  588 + ->select()->toArray();
  589 + if($agency){
  590 + $final['agency'] = $agency;
  591 + $this->apiResponse('1','成功',$final);
  592 + }else{
  593 + $this->apiResponse('0','中介报价有误');
  594 + }
  595 + }else{
  596 + $this->apiResponse('0','当前状态不支持查看报价');
  597 + }
  598 +
  599 +
  600 + }
  601 +
  602 + /**
  603 + * @title 我的资料
  604 + * @description 接口说明
  605 + * @author 开发者
  606 + * @url /api/portal/User/myMes
  607 + * @method POST
  608 + * @param name:token type:int require:1 default: other: desc:token
  609 + * @param name:need_id type:int require:1 default: other: desc:需求id
  610 + * @param name:agency_id type:int require:1 default: other: desc:中介报价id
  611 + * @return data:''@
  612 + */
  613 + public function myMes(Request $request){
  614 + $data = $request->param();
  615 + $user = $this->myleft($data['token']);
  616 +// $where_member['status'] = 1;
  617 +// $where_member['id'] = $user['id'];
  618 +// $member = Db::name('Member')->where($where_member)->field('referee_tel')->find();
  619 + $where_card['status'] = 1;
  620 + $where_card['user_id'] = $user['id'];
  621 + $card = Db::name('Card')->where($where_card)->field('referee_tel')->find();
  622 + $final['card'] = $card;
  623 + $final['user'] = $user;
  624 + if($card){
  625 + $this->apiResponse('1','成功',$final);
  626 + }else{
  627 + $this->apiResponse('0','失败');
  628 + }
  629 +
  630 + }
  631 +
  632 +
  633 + /**
  634 + * @title 确认成交
  635 + * @description 接口说明
  636 + * @author 开发者
  637 + * @url /api/portal/User/sureAgency
  638 + * @method POST
  639 + * @param name:token type:int require:1 default: other: desc:token
  640 + * @param name:need_id type:int require:1 default: other: desc:需求id
  641 + * @param name:agency_id type:int require:1 default: other: desc:中介报价id
  642 + * @return data:''@
  643 + */
  644 + public function sureAgency(Request $request){
  645 + $data = $request->param();
  646 + if(!$data['need_id'] || !$data['agency_id'] ){
  647 + $this->apiResponse('0','参数错误');
  648 + }
  649 + $where_bid['need_id'] = $data['need_id'];
  650 + $where_bid['id'] = $data['agency_id'];
  651 + $where_bid['status'] = 4;
  652 + $is_isset = Db::name('Agency')->where($where_bid)->find();
  653 + if($is_isset){
  654 + $where_ag['id'] = $data['agency_id'];
  655 + $add['status'] = 5;
  656 + $add['update_time'] = time();
  657 + $save = Db::name('Agency')->where($where_ag)->update($add);
  658 + if($save){
  659 + $this->apiResponse('1','操作失败');
  660 + }else{
  661 + $this->apiResponse('0','成交失败');
  662 + }
  663 + }else{
  664 + $this->apiResponse('0','报价选择有误');
  665 + }
  666 + }
  667 +
  668 +
  669 + /**
  670 + * @title 查看评价
  671 + * @description 接口说明
  672 + * @author 开发者
  673 + * @url /api/portal/User/comment
  674 + * @method POST
  675 + * @param name:token type:int require:1 default: other: desc:token
  676 + * @param name:agency_id type:int require:1 default: other: desc:中介id
  677 + */
  678 + public function comment(Request $request){
  679 + $data = $request->param();
  680 + $where_isset['id'] = $data['agency_id'];
  681 + $agency_id = Db::name('Member')->where($where_isset)->field('id,name,pic,reputation,start')->find();
  682 + if($agency_id){
  683 + $where_comment['c.agency_id'] = $agency_id['id'];
  684 + $where_comment['c.status'] = 1;
  685 + $comment = Db::name('Comment')->alias('c')
  686 + ->where($where_comment)
  687 + ->join("hp_member m",'m.id = c.user_id')
  688 + ->field('m.tel , c.content,c.create_time')
  689 + ->select()->toArray();
  690 + if($comment){
  691 + foreach ($comment as $ck=>$cv){
  692 + $middle = str_split($cv['tel'],3);
  693 + $comment[$ck]['tel'] = $middle[0].'********';
  694 + }
  695 + $this->apiResponse('1','成功',$comment);
  696 + }else{
  697 + $this->apiResponse('1','暂无评价');
  698 + }
  699 + }else{
  700 + $this->apiResponse('0','中介不存在');
  701 + }
  702 +
  703 + }
  704 +
  705 +
  706 +
  707 +
  708 + /**
  709 + * @title 投诉
  710 + * @description 接口说明
  711 + * @author 开发者
  712 + * @url /api/portal/User/complaint
  713 + * @method POST
  714 + * @param name:token type:int require:1 default: other: desc:token
  715 + * @param name:need_id type:int require:1 default: other: desc:需求id
  716 + * @param name:agency_id type:int require:1 default: other: desc:中介报价id
  717 + * @param name:intermediary_id type:int require:1 default: other: desc:中介id
  718 + * @param name:content type:int require:1 default: other: desc:投诉内容
  719 + * @param name:type type:int require:1 default: other: desc:1->用户投诉,2->中介投诉
  720 + */
  721 + public function complaint(Request $request){
  722 + $token = $request->param('token');
  723 + $member = $this->myleft($token);
  724 + $final['user'] = $member;
  725 + $data = $request->param();
  726 + $where_isset['user_id'] = $member['id'];
  727 + $where_isset['need_id'] = $data['need_id'];
  728 + $where_isset['agency_id'] = $data['agency_id'];
  729 + $where_isset['intermediary_id'] = $data['intermediary_id'];
  730 + $is_isset= Db::name('Complaint')->where($where_isset)->field('id')->find();
  731 + if($is_isset){
  732 + $this->apiResponse('0','您已投诉');
  733 + }
  734 +
  735 + $add['user_id'] = $member['id'];
  736 + $add['need_id'] = $data['need_id'];
  737 +
  738 + $add['agency_id'] = $data['agency_id'];
  739 + $add['intermediary_id'] = $data['intermediary_id'];
  740 + $add['content'] = $data['content'];
  741 + $add['type'] = $data['type'];
  742 +
  743 + $is_add = Db::name('Complaint')->insertGetId($add);
  744 + if($is_add){
  745 + $final['complaint_id'] = $is_add;
  746 + $this->apiResponse('1','投诉成功',$final);
  747 + }else{
  748 + $this->apiResponse('0','投诉失败');
  749 + }
  750 + }
  751 +
  752 + /**
  753 + * @title 我的账户
  754 + * @description 接口说明
  755 + * @author 开发者
  756 + * @url /api/portal/User/orderDetail
  757 + * @method POST
  758 + * @param name:token type:int require:1 default: other: desc:token
  759 + */
  760 + public function orderDetail(Request $request){
  761 + $data = $request->param();
  762 + $get_msg = $this->myleft($data['token']);
  763 + $where_order['user_id'] = $get_msg['id'];
  764 + $where_order['status'] = array('neq',9);
  765 + $order_list = Db::name('UsermoneyDetail')->where($where_order)->select()->toArray();
  766 + if($order_list){
  767 + foreach ($order_list as $ok=>$ov){
  768 +
  769 + }
  770 +
  771 +
  772 + }else{
  773 + $result = array();
  774 + }
  775 + }
  776 +
  777 +
  778 +
  779 +
  780 +
  781 +
213 782
214 } 783 }
1 -<?php  
2 -// +----------------------------------------------------------------------  
3 -// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]  
4 -// +----------------------------------------------------------------------  
5 -// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.  
6 -// +----------------------------------------------------------------------  
7 -// | Author: wuwu <15093565100@163.com>  
8 -// +----------------------------------------------------------------------  
9 -namespace api\portal\controller;  
10 -  
11 -use api\portal\model\MemberModel;  
12 -use api\portal\model\PortalPostModel;  
13 -use cmf\controller\RestBaseController;  
14 -use think\Db;  
15 -use think\Request;  
16 -use think\Loader;  
17 -use think\Config;  
18 -use think\captcha\Captcha;  
19 -use think\Url;  
20 -use SmsDemo;  
21 -//use think\Route;  
22 -/**  
23 - * @title 用户接口  
24 - * @description 接口说明  
25 - * @group 接口分组  
26 - */  
27 -  
28 -class UserNeedController extends CommonController  
29 -{  
30 - protected $postModel;  
31 - public function __construct(PortalPostModel $postModel)  
32 - {  
33 - parent::__construct();  
34 - $this->postModel = $postModel;  
35 - }  
36 - /**  
37 - * @title 用户发布需求的保证金  
38 - * @description 接口说明  
39 - * @author 开发者  
40 - * @url /api/portal/UserNeed/payMoney  
41 - * @method POST  
42 - * @param name:city type:int require:1 default: other: desc:地区  
43 - * @param name:quarters type:int require:1 default: other: desc:小区  
44 - * @param name:password type:int require:1 default: other: desc:密码  
45 - */  
46 - public function payMoney(Request $request){  
47 - $data = $request->param();  
48 - if(!$data['city'] || !$data['area'] ){  
49 - $this->apiResponse('0','城市、面积不能为空');  
50 - }  
51 - $city = $data['city'];  
52 - $area = $data['area'];  
53 -  
54 - }  
55 -  
56 -  
57 - /**  
58 - * @title 用户发布需求  
59 - * @description 接口说明  
60 - * @author 开发者  
61 - * @url /api/portal/UserNeed/send  
62 - * @method POST  
63 - * @param name:city type:int require:1 default: other: desc:地区  
64 - * @param name:quarters type:int require:1 default: other: desc:小区  
65 - * @param name:password type:int require:1 default: other: desc:密码  
66 - */  
67 - public function send(Request $request)  
68 - {  
69 - if($request->Post()){  
70 - $data = $request->param();  
71 -// 判空,处理  
72 -// 加数据库  
73 - }else{  
74 -// 问答内容  
75 - $where_pro['status'] = 1;  
76 - $list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->find();  
77 - if($list){  
78 - $this->apiResponse('1','成功',$list);  
79 - }else{  
80 - $this->apiResponse('0','暂无内容');  
81 - }  
82 -  
83 - }  
84 - }  
85 -  
86 -  
87 -  
88 -  
89 -}  
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Author: wuwu <15093565100@163.com>
  8 +// +----------------------------------------------------------------------
  9 +namespace api\portal\controller;
  10 +
  11 +use api\portal\model\UserNeedModel;
  12 +use api\portal\model\PortalPostModel;
  13 +use cmf\controller\RestBaseController;
  14 +use think\Db;
  15 +use think\Request;
  16 +use think\Loader;
  17 +use think\Config;
  18 +use think\captcha\Captcha;
  19 +use think\Url;
  20 +use SmsDemo;
  21 +//use think\Route;
  22 +/**
  23 + * @title 用户需求接口
  24 + * @description 接口说明
  25 + * @group 接口分组
  26 + */
  27 +
  28 +class UserneedController extends CommonController
  29 +{
  30 + protected $postModel;
  31 + public function __construct(PortalPostModel $postModel)
  32 + {
  33 + parent::__construct();
  34 + $this->postModel = $postModel;
  35 + }
  36 +
  37 + /**
  38 + * @title 用户发布需求时保证金金额(填完地区,小区调用;每次修改重新调用)
  39 + * @description 接口说明
  40 + * @author 开发者
  41 + * @url /api/portal/UserNeed/payMoney
  42 + * @method POST
  43 + * @param name:city type:int require:1 default: other: desc:地区
  44 + * @param name:area type:int require:1 default: other: desc:面积
  45 + */
  46 + public function payMoney(Request $request){
  47 + $data = $request->param();
  48 + if(!$data['city'] || !$data['area'] ){
  49 + $this->apiResponse('0','城市、面积不能为空');
  50 + }
  51 + $city = $data['city'];
  52 + $area = $data['area'];
  53 +// 查询地区
  54 + $where_area['area_name'] = array('like',"%$city%");
  55 +// $where_area['parent_id'] = 0;
  56 + $city_id = Db::name('Areas')->where($where_area)->field('area_id')->find();
  57 + $where_money['city'] = array('like',"%".$city_id['area_id'].'%');
  58 + $where_money['status'] = 1;
  59 + $where_money['low_area'] = array('lt',$area);
  60 + $where_money['height_area'] = array('egt',$area);
  61 + $money = Db::name('MoneyRule')->where($where_money)->field('money')->find();
  62 + if(!$money){
  63 + $where_elsemoney['city'] = 0;
  64 + $where_elsemoney['status'] = 1;
  65 + $where_elsemoney['low_area'] = array('lt',$area);
  66 + $where_elsemoney['height_area'] = array('egt',$area);
  67 + $elsemoney = Db::name('MoneyRule')->where($where_elsemoney)->field('money')->find();
  68 + if($elsemoney){
  69 + $this->apiResponse('1','成功',$elsemoney['money']);
  70 + }else{
  71 + $this->apiResponse('0','保证金获取失败');
  72 + }
  73 + }else{
  74 + $this->apiResponse('1','成功',$money['money']);
  75 + }
  76 + }
  77 +
  78 +
  79 + /**
  80 + * @title 用户发布需求
  81 + * @description 接口说明
  82 + * @author 开发者
  83 + * @url /api/portal/UserNeed/send
  84 + * @method POST
  85 + * @param name:city type:varchar require:1 default: other: desc:地区(省-市-区)
  86 + * @param name:quarters type:varchar require:1 default: other: desc:小区
  87 + * @param name:room type:varchar require:1 default: other: desc:具体房号(1-1-1)
  88 + * @param name:floor type:int require:1 default: other: desc:楼层
  89 + * @param name:house_type type:varchar require:1 default: other: desc:户型
  90 + * @param name:renovation type:varchar require:1 default: other: desc:装修
  91 + * @param name:area type:varchar require:1 default: other: desc:建筑面积
  92 + * @param name:is_first type:tinyint require:1 default: other: desc:是否首套房(1->首套房,2->两套及以上)
  93 + * @param name:loan type:tinyint require:1 default: other: desc:贷款(1->贷款,2->全款)
  94 + * @param name:contract type:tinyint require:1 default: other: desc:是否是包干价(1->是,2->否)
  95 + * @param name:quotation_time type:int require:1 default: other: desc:报价时间
  96 + * @param name:name type:varchar require:1 default: other: desc:联系人姓名
  97 + * @param name:tel type:varchar require:1 default: other: desc:联系人电话
  98 + * @param name:code type:int require:1 default: other: desc:验证码
  99 + * @param name:else type:int require:1 default: other: desc:备注
  100 + * @param name:need_id type:int require:1 default: other:修改需求时传 desc:需求id
  101 + * @return data:''@
  102 + * @data type:'1->包干价,2->问答'
  103 + * @data need_id:'需求id'
  104 + */
  105 + public function send(Request $request)
  106 + {
  107 + if($request->Post('token') && $request->Post('name')){
  108 +// $data = $request->param();
  109 +// 判空,处理
  110 + $validate = Loader::validate('UserNeed');
  111 + if(!$validate->check($_POST)){
  112 + return json(array('code'=>0,'msg'=>$validate->getError()));
  113 + }
  114 +// 加数据库
  115 + $data = $request->Post();
  116 +// 保证金
  117 + $city = $data['city'];
  118 + $area = $data['area'];
  119 +// 查询地区
  120 + $where_area['area_name'] = array('like',"%$city%");
  121 + $city_id = Db::name('Areas')->where($where_area)->field('area_id')->find();
  122 + $where_money['city'] = array('like',"%".$city_id['area_id'].'%');
  123 + $where_money['status'] = 1;
  124 + $where_money['low_area'] = array('lt',$area);
  125 + $where_money['height_area'] = array('egt',$area);
  126 + $money = Db::name('MoneyRule')->where($where_money)->field('money')->find();
  127 + if(!$money){
  128 + $where_elsemoney['city'] = 0;
  129 + $where_elsemoney['status'] = 1;
  130 + $where_elsemoney['low_area'] = array('lt',$area);
  131 + $where_elsemoney['height_area'] = array('egt',$area);
  132 + $elsemoney = Db::name('MoneyRule')->where($where_elsemoney)->field('money')->find();
  133 + if($elsemoney){
  134 + $data['pay_money'] = $elsemoney['money'];
  135 + }else{
  136 + $this->apiResponse('0','保证金获取失败');
  137 + }
  138 + }else{
  139 + $data['pay_money'] = $money['money'];
  140 + }
  141 + $where_mem['token'] = $data['token'];
  142 + $mem_id = Db::name('Member')->where($where_mem)->field('id')->find();
  143 + $data['user_id'] = $mem_id['id'];
  144 + $model = new UserNeedModel();
  145 +// 添加
  146 + unset($data['code']);
  147 + unset($data['connect']);
  148 + unset($data['token']);
  149 + $save = $model->save($data);
  150 +
  151 + if($save){
  152 + $final['userNeed_id'] = $model->getLastInsID();
  153 + $this->apiResponse('1','添加成功',$final);
  154 + }else{
  155 + $this->apiResponse('0','添加失败');
  156 + }
  157 + }else{
  158 +
  159 +// 问答内容
  160 + $where_pro['status'] = 1;
  161 + $list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->field("title,content,id,type")->select()->toArray();
  162 + foreach ($list as $lk=>$lv){
  163 + $list[$lk]['content'] = htmlspecialchars_decode($lv['content']);
  164 + }
  165 + if($list){
  166 + $this->apiResponse('1','成功',$list);
  167 + }else{
  168 + $this->apiResponse('0','暂无内容');
  169 + }
  170 +
  171 +
  172 + }
  173 + }
  174 + /**
  175 + * @title 用户修改需求
  176 + * @description 接口说明
  177 + * @author 开发者
  178 + * @url /api/portal/UserNeed/send
  179 + * @method POST
  180 + * @param name:city type:varchar require:1 default: other: desc:地区(省-市-区)
  181 + * @param name:quarters type:varchar require:1 default: other: desc:小区
  182 + * @param name:room type:varchar require:1 default: other: desc:具体房号(1-1-1)
  183 + * @param name:floor type:int require:1 default: other: desc:楼层
  184 + * @param name:house_type type:varchar require:1 default: other: desc:户型
  185 + * @param name:renovation type:varchar require:1 default: other: desc:装修
  186 + * @param name:area type:varchar require:1 default: other: desc:建筑面积
  187 + * @param name:is_first type:tinyint require:1 default: other: desc:是否首套房(1->首套房,2->两套及以上)
  188 + * @param name:loan type:tinyint require:1 default: other: desc:贷款(1->贷款,2->全款)
  189 + * @param name:contract type:tinyint require:1 default: other: desc:是否是包干价(1->是,2->否)
  190 + * @param name:quotation_time type:int require:1 default: other: desc:报价时间
  191 + * @param name:name type:varchar require:1 default: other: desc:联系人姓名
  192 + * @param name:tel type:varchar require:1 default: other: desc:联系人电话
  193 + * @param name:code type:int require:1 default: other: desc:验证码
  194 + * @param name:else type:int require:1 default: other: desc:备注
  195 + * @param name:need_id type:int require:1 default: other:修改需求时传 desc:需求id
  196 + * @return data:''@
  197 + * @data type:'1->包干价,2->问答'
  198 + * @data need_id:'需求id'
  199 + */
  200 + public function changeSend(Request $request)
  201 + {
  202 + if($request->Post('token') && $request->Post('name')){
  203 +// $data = $request->param();
  204 +// 判空,处理
  205 + $validate = Loader::validate('UserNeed');
  206 + if(!$validate->check($_POST)){
  207 + return json(array('code'=>0,'msg'=>$validate->getError()));
  208 + }
  209 +// 加数据库
  210 + $data = $request->Post();
  211 +// 保证金
  212 + $city = $data['city'];
  213 + $area = $data['area'];
  214 +// 查询地区
  215 + $where_area['area_name'] = array('like',"%$city%");
  216 + $city_id = Db::name('Areas')->where($where_area)->field('area_id')->find();
  217 + $where_money['city'] = array('like',"%".$city_id['area_id'].'%');
  218 + $where_money['status'] = 1;
  219 + $where_money['low_area'] = array('lt',$area);
  220 + $where_money['height_area'] = array('egt',$area);
  221 + $money = Db::name('MoneyRule')->where($where_money)->field('money')->find();
  222 + if(!$money){
  223 + $where_elsemoney['city'] = 0;
  224 + $where_elsemoney['status'] = 1;
  225 + $where_elsemoney['low_area'] = array('lt',$area);
  226 + $where_elsemoney['height_area'] = array('egt',$area);
  227 + $elsemoney = Db::name('MoneyRule')->where($where_elsemoney)->field('money')->find();
  228 + if($elsemoney){
  229 + $data['pay_money'] = $elsemoney['money'];
  230 + }else{
  231 + $this->apiResponse('0','保证金获取失败');
  232 + }
  233 + }else{
  234 + $data['pay_money'] = $money['money'];
  235 + }
  236 + $where_mem['token'] = $data['token'];
  237 + $mem_id = Db::name('Member')->where($where_mem)->field('id')->find();
  238 + $data['user_id'] = $mem_id['id'];
  239 + $model = new UserNeedModel();
  240 +
  241 +// 修改
  242 + $where_need['userNeed_id'] = $request->param('need_id');
  243 + $where_need['status'] = 1;
  244 + $need = Db::name('UserNeed')->where($where_need)->find();
  245 + if(!$need){
  246 + $this->apiResponse('0','该需求不可修改');
  247 + }else{
  248 + unset($data['code']);
  249 + unset($data['connect']);
  250 + unset($data['token']);
  251 + $data['id'] = $data['need_id'];
  252 + $save = $model->isUpdate(true)->allowField(true)->save($data);
  253 + }
  254 + if($save){
  255 + $final['need_id'] = $model->getLastInsID();;
  256 + $this->apiResponse('1','添加成功',$final);
  257 + }else{
  258 + $this->apiResponse('0','添加失败');
  259 + }
  260 +
  261 +
  262 + }else{
  263 + $data = $request->param();
  264 + $where_need['id'] = $request->param('need_id');
  265 + $where_need['status'] = 1;
  266 + $where_mem['token'] = $data['token'];
  267 + $mem_id = Db::name('Member')->where($where_mem)->field('id')->find();
  268 + $where_need['user_id'] = $mem_id['id'];
  269 + $list['need'] = Db::name('UserNeed')->where($where_need)->find();
  270 + if(!$list['need']){
  271 + $this->apiResponse('0','该需求不可修改');
  272 + }
  273 +// 问答内容
  274 + $where_pro['status'] = 1;
  275 + $list['list'] = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->field("title,content,id,type")->select()->toArray();
  276 + foreach ($list as $lk=>$lv){
  277 + $list[$lk]['content'] = htmlspecialchars_decode($lv['content']);
  278 + }
  279 + if($list){
  280 + $this->apiResponse('1','成功',$list);
  281 + }else{
  282 + $this->apiResponse('0','暂无内容');
  283 + }
  284 +
  285 +
  286 + }
  287 + }
  288 +
  289 +
  290 +
  291 +
  292 +
  293 +
  294 +// 发布需求支付
  295 + public function needPay(Request $request){
  296 +// 添加订单
  297 + Db::startTrans();
  298 + $data = $request->param();
  299 + if(!$data['need_id']){
  300 + $this->apiResponse('0','需求不能为空');
  301 + }
  302 +// 查询金额
  303 + $where_need['id'] = $data['need_id'];
  304 + $where_need['status'] = 1;
  305 + $should_pay = Db::name('UserNeed')->where($where_need)->field('pay_money')->find();
  306 + if(!$should_pay){
  307 + $this->apiResponse('0','需求错误');
  308 + }else{
  309 + if(!$should_pay['pay_money']){
  310 + $this->apiResponse('0','诚意金金额有误');
  311 + }
  312 + }
  313 +// 拼字度
  314 + $add['need_id'] = $data['need_id'];
  315 + $add['money'] = $should_pay['pay_money'];
  316 + $add['name'] = '诚意金缴纳';
  317 + $add['type'] = 1;
  318 + $add['is_get'] = 2;
  319 + $add['status'] = 1;
  320 +// 加入数据库
  321 + $model = new OrderModel();
  322 + $save = $model->save($add);
  323 + if($save){
  324 + Db::commit();
  325 + }else{
  326 + Db::rollback();
  327 + }
  328 +// 支付(未完)
  329 + echo "<pre/>";
  330 + print_r('3333');
  331 + die;
  332 +// 更改订单状态
  333 +// 成功
  334 + $update['pay_time'] = time();
  335 + $update['status'] = time();
  336 + $update = $model->isUpdate(true)->allowField(true)->save($update);
  337 + if($update){
  338 + $this->apiResponse('1','支付成功');
  339 + }
  340 +
  341 + }
  342 +
  343 +
  344 +
  345 +}
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 老猫 <thinkcmf@126.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace api\portal\model;
  12 +
  13 +//use api\admin\model\RouteModel;
  14 +use think\Model;
  15 +
  16 +class AgencyModel extends Model
  17 +{
  18 + protected $autoWriteTimestamp = true;
  19 +
  20 +}
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 老猫 <thinkcmf@126.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace api\portal\model;
  12 +
  13 +//use api\admin\model\RouteModel;
  14 +use think\Model;
  15 +
  16 +class CodeModel extends Model
  17 +{
  18 + protected $autoWriteTimestamp = true;
  19 +
  20 +}
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 老猫 <thinkcmf@126.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace api\portal\model;
  12 +
  13 +//use api\admin\model\RouteModel;
  14 +use think\Model;
  15 +
  16 +class OrderModel extends Model
  17 +{
  18 + protected $autoWriteTimestamp = true;
  19 +
  20 +}
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 老猫 <thinkcmf@126.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace api\portal\model;
  12 +
  13 +//use api\admin\model\RouteModel;
  14 +use think\Model;
  15 +
  16 +class UserNeedModel extends Model
  17 +{
  18 + protected $autoWriteTimestamp = true;
  19 +
  20 +}
@@ -7,6 +7,7 @@ Route::get('portal/categories/subCategories', 'portal/Categories/subCategories') @@ -7,6 +7,7 @@ Route::get('portal/categories/subCategories', 'portal/Categories/subCategories')
7 Route::resource('portal/articles', 'portal/Articles'); 7 Route::resource('portal/articles', 'portal/Articles');
8 Route::resource('portal/pages', 'portal/Pages'); 8 Route::resource('portal/pages', 'portal/Pages');
9 Route::resource('portal/userArticles', 'portal/UserArticles'); 9 Route::resource('portal/userArticles', 'portal/UserArticles');
  10 +Route::resource('portal/IntermediaryNeed', 'portal/IntermediaryNeed');
10 11
11 Route::get('portal/search', 'portal/Articles/search'); 12 Route::get('portal/search', 'portal/Articles/search');
12 Route::get('portal/articles/my', 'portal/Articles/my'); 13 Route::get('portal/articles/my', 'portal/Articles/my');
@@ -12,27 +12,21 @@ namespace api\portal\validate; @@ -12,27 +12,21 @@ namespace api\portal\validate;
12 12
13 use think\Validate; 13 use think\Validate;
14 14
15 -class IntermediaryValidate extends Validate 15 +class IntermediaryNeedValidate extends Validate
16 { 16 {
17 protected $rule = [ 17 protected $rule = [
18 - 'name' => ['require','length:2,4','chs'],  
19 - 'password' => ['require','length:6,16'],  
20 - 'tel' => ['regex'=>'/13[123569]{1}\d{8}|15[1235689]\d{8}|188\d{8}/','require'], 18 + 'need_id' => 'require',
  19 + 'housing_price' => 'require',
21 ]; 20 ];
22 protected $message = [ 21 protected $message = [
23 - 'name.require' => '姓名不能为空!',  
24 - 'name.length' => '姓名为2-4个汉字!',  
25 - 'name.chs' => '姓名只能是汉字!',  
26 - 'tel.require' => '手机号不能为空!',  
27 - 'tel.regex' => '手机号格式不正确!',  
28 - 'password.require' => '密码不能为空!',  
29 - 'password.length' => '密码长度为6-16位!', 22 + 'need_id.require' => '需求id不能为空!',
  23 + 'housing_price.require' => '房价不能为空!',
30 24
31 ]; 25 ];
32 26
33 protected $scene = [ 27 protected $scene = [
34 - 'add' => ['name','tel','password'],  
35 - 'edit' => ['tel','password','name'], 28 + 'offer' => ['need_id','housing_price'],
  29 +
36 ]; 30 ];
37 31
38 } 32 }
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 小夏 < 449134904@qq.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace api\portal\validate;
  12 +
  13 +use think\Validate;
  14 +
  15 +class UserNeedValidate extends Validate
  16 +{
  17 + protected $rule = [
  18 + 'city' => 'require',
  19 + 'quarters' => 'require',
  20 +// 'room' => 'require',
  21 +// 'floor' => 'require',
  22 + 'house_type' => 'require',
  23 + 'renovation' => 'require',
  24 + 'area' => 'require',
  25 + 'is_first' => 'require',
  26 + 'loan' => 'require',
  27 + 'quotation_time' => 'require',
  28 + 'name' => 'require',
  29 + 'tel' => 'require',
  30 + 'code' => 'require',
  31 + 'contract' => 'require',
  32 + ];
  33 + protected $message = [
  34 + 'city.require' => '地区不能为空!',
  35 + 'quarters.require' => '小区不能为空!',
  36 +// 'room.length' => '房号不能为空!',
  37 +// 'floor.length' => '楼层不能为空!',
  38 + 'house_type.require' => '户型不能为空!',
  39 + 'renovation.require' => '装修不能为空!',
  40 + 'area.require' => '建筑面积不能为空!',
  41 + 'is_first.require' => '是否首套房不能为空!',
  42 + 'loan.require' => '贷款不能为空!',
  43 + 'quotation_time.require' => '报价时间不能为空!',
  44 + 'name.require' => '联系人姓名不能为空!',
  45 + 'tel.require' => '联系人电话不能为空!',
  46 + 'code.require' => '验证码不能为空!',
  47 + 'contract.require' => '请选择是否包干价!',
  48 + ];
  49 +
  50 + protected $scene = [
  51 +
  52 + ];
  53 +
  54 +}
@@ -18,7 +18,12 @@ class UserValidate extends Validate @@ -18,7 +18,12 @@ class UserValidate extends Validate
18 'name' => ['require','length:2,4','chs'], 18 'name' => ['require','length:2,4','chs'],
19 'password' => ['require','length:6,16'], 19 'password' => ['require','length:6,16'],
20 'tel' => ['regex'=>'/13[123569]{1}\d{8}|15[1235689]\d{8}|18\d{9}/','require'], 20 'tel' => ['regex'=>'/13[123569]{1}\d{8}|15[1235689]\d{8}|18\d{9}/','require'],
21 - 'sure_password' => 'require' 21 + 'sure_password' => 'require',
  22 +
  23 + 'city' => 'require',
  24 + 'company' => 'require',
  25 + 'store' => 'require',
  26 + 'quarters' => 'require',
22 ]; 27 ];
23 protected $message = [ 28 protected $message = [
24 'name.require' => '姓名不能为空!', 29 'name.require' => '姓名不能为空!',
@@ -30,11 +35,18 @@ class UserValidate extends Validate @@ -30,11 +35,18 @@ class UserValidate extends Validate
30 'password.length' => '密码长度为6-16位!', 35 'password.length' => '密码长度为6-16位!',
31 'sure_password.require' => '确认密码不能为空!', 36 'sure_password.require' => '确认密码不能为空!',
32 37
  38 + 'city.require' => '城市不能为空!',
  39 + 'company.require' => '所属公司不能为空!',
  40 + 'store.require' => '门店不能为空!',
  41 + 'quarters.require' => '服务小区不能为空!',
  42 +
33 ]; 43 ];
34 44
35 protected $scene = [ 45 protected $scene = [
36 - 'add' => ['name','tel','password','sure_password'],  
37 - 'edit' => ['tel','password','name','sure_password'], 46 +// 'add' => ['name','tel','password','sure_password'],
  47 +// 'edit' => ['tel','password','name','sure_password'],
  48 + 'user' => ['tel','password','name','sure_password'],
  49 + 'intermediary' => ['tel','password','name','sure_password','city','company','store','quarters'],
38 ]; 50 ];
39 51
40 } 52 }
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 老猫 <thinkcmf@126.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace app\portal\controller;
  12 +
  13 +use app\portal\model\BrandModel;
  14 +use app\portal\model\CooperationModel;
  15 +use app\portal\model\ProcessModel;
  16 +use cmf\controller\AdminBaseController;
  17 +use app\portal\model\PortalTagModel;
  18 +use app\portal\service\PostService;
  19 +use think\Db;
  20 +use think\Request;
  21 +use think\Loader;
  22 +
  23 +class BrandController extends AdminBaseController
  24 +{
  25 + /**
  26 + * 列表(暂无用)
  27 + * @adminMenu(
  28 + * 'name' => '文章管理',
  29 + * 'parent' => 'portal/AdminIndex/default',
  30 + * 'display'=> true,
  31 + * 'hasView'=> true,
  32 + * 'order' => 10000,
  33 + * 'icon' => '',
  34 + * 'remark' => '文章列表',
  35 + * 'param' => ''
  36 + * )
  37 + */
  38 + public function index(Request $request)
  39 + {
  40 + $where_coo['status'] = 1;
  41 +// $where_coo = array();
  42 + if($request->post()){
  43 + $search = $request->post();
  44 + if($search['start_time']){
  45 + $start = strtotime($search['start_time']);
  46 + if($search['end_time']){
  47 + $end = strtotime($search['end_time']);
  48 + }else{
  49 + $end = time();
  50 + }
  51 + $where_coo['update_time'] = array('between',"$start,$end");
  52 + $this->assign('start_time',date('Y-m-d H:i',$start));
  53 + $this->assign('end_time',date('Y-m-d H:i',$end));
  54 + }
  55 + if($search['keyword']){
  56 + $where_coo['name'] = array('like',"%".$search['keyword']."%");
  57 + $this->assign('keyword',$search['keyword']);
  58 + }
  59 + }
  60 + $coo_list = Db::name('Brand')->where($where_coo)->order('score desc , create_time desc')->select()->toArray();
  61 + $this->assign('list',$coo_list);
  62 + return $this->fetch();
  63 + }
  64 +
  65 +
  66 + /**
  67 + * 添加、修改
  68 + * @adminMenu(
  69 + * 'name' => '添加文章',
  70 + * 'parent' => 'index',
  71 + * 'display'=> false,
  72 + * 'hasView'=> true,
  73 + * 'order' => 10000,
  74 + * 'icon' => '',
  75 + * 'remark' => '添加文章',
  76 + * 'param' => ''
  77 + * )
  78 + */
  79 + public function add(Request $request)
  80 + {
  81 + if($request->post()){
  82 +// 添加数据
  83 + $data = $request->post();
  84 + if($request->Post('id')){
  85 +// 修改
  86 + $add['name'] = $data['name'];
  87 + $add['score'] = $data['score'];
  88 + $validate = Loader::validate('Brand');
  89 + if(!$validate->scene('edit')->check($add)){
  90 + $mes = $validate->getError();
  91 + $this->error("$mes");
  92 + }
  93 + $add['id'] = $request->param('id');
  94 + $model = new BrandModel();
  95 + $final = $model->isUpdate(true)->allowField(true)->save($add);
  96 + }else{
  97 +// 添加
  98 + $add['name'] = $data['name'];
  99 + $add['score'] = $data['score'];
  100 + $validate = Loader::validate('Brand');
  101 + if(!$validate->scene('add')->check($add)){
  102 + $mes = $validate->getError();
  103 + $this->error("$mes");
  104 + }
  105 + $model = new BrandModel();
  106 + $final = $model->save($add);
  107 + }
  108 + if($final){
  109 + $this->success('成功',url('index'));
  110 + }else{
  111 + $this->error('失败');
  112 + }
  113 + }else{
  114 + $where_find['id'] = $request->param('id');
  115 + $list = Db::name('Brand')->where($where_find)->find();
  116 + $this->assign('list',$list);
  117 + return $this->fetch('add');
  118 + }
  119 + }
  120 +
  121 +// 删除
  122 + public function del(Request $request){
  123 + $ids = $this->request->post();
  124 + $id = $request->param('id');
  125 + if($ids){
  126 + $add_del['id'] = array('in',$ids['ids']);
  127 + }else if($id){
  128 + $add_del['id'] = $request->param('id');
  129 + }else{
  130 + $this->error('删除失败');
  131 + }
  132 + $add_del['status'] = 9;
  133 + $model = new BrandModel();
  134 + $del = $model->isUpdate(true)->allowField(true)->save($add_del);
  135 + if($del){
  136 + $this->success('删除成功',url('index'));
  137 + }else{
  138 + $this->error('删除失败');
  139 + }
  140 + }
  141 +
  142 +}
@@ -57,13 +57,28 @@ class MoneyController extends AdminBaseController @@ -57,13 +57,28 @@ class MoneyController extends AdminBaseController
57 $this->assign('keyword',$search['keyword']); 57 $this->assign('keyword',$search['keyword']);
58 } 58 }
59 } 59 }
  60 +
  61 +
  62 +
60 $coo_list = Db::name('MoneyRule')->alias('r') 63 $coo_list = Db::name('MoneyRule')->alias('r')
61 ->where($where_coo) 64 ->where($where_coo)
62 - ->join("hp_areas a",'a.area_id = r.city')  
63 - ->field("a.area_name , r.id as id, r.low_area,r.height_area,r.money,r.create_time,r.update_time") 65 +// ->join("hp_areas a",'a.area_id = r.city')
  66 +// ->field("a.area_name , r.id as id, r.low_area,r.height_area,r.money,r.create_time,r.update_time")
  67 + ->field("r.city, r.id as id, r.low_area,r.height_area,r.money,r.create_time,r.update_time")
64 ->order('create_time desc') 68 ->order('create_time desc')
65 ->select()->toArray(); 69 ->select()->toArray();
  70 + foreach ($coo_list as $coolk=>$coolv){
  71 + $where_findarea['area_id'] = array('in',$coolv['city']);
  72 +// $where_findarea['parent_id'] = 0;
  73 + $name_arr = Db::name('Areas')->where($where_findarea)->field('area_name')->select();
  74 + $middlearr = array();
  75 + foreach ($name_arr as $namek=>$namev){
  76 + $middlearr[] = $namev['area_name'];
  77 + }
  78 + $name_str = implode(',',$middlearr);
66 79
  80 + $coo_list[$coolk]['area_name'] = $name_str;
  81 + }
67 $this->assign('list',$coo_list); 82 $this->assign('list',$coo_list);
68 return $this->fetch(); 83 return $this->fetch();
69 } 84 }
@@ -77,7 +92,7 @@ class MoneyController extends AdminBaseController @@ -77,7 +92,7 @@ class MoneyController extends AdminBaseController
77 if($request->Post('id')){ 92 if($request->Post('id')){
78 // 修改 93 // 修改
79 $add['low_area'] = $data['low_area']; 94 $add['low_area'] = $data['low_area'];
80 - $add['city'] = $data['city']; 95 + $add['city'] = implode(',',$data['city']);
81 $add['height_area'] = $data['height_area']; 96 $add['height_area'] = $data['height_area'];
82 $add['money'] = $data['money']; 97 $add['money'] = $data['money'];
83 $validate = Loader::validate('Money'); 98 $validate = Loader::validate('Money');
@@ -91,7 +106,7 @@ class MoneyController extends AdminBaseController @@ -91,7 +106,7 @@ class MoneyController extends AdminBaseController
91 }else{ 106 }else{
92 // 添加 107 // 添加
93 $add['low_area'] = $data['low_area']; 108 $add['low_area'] = $data['low_area'];
94 - $add['city'] = $data['city']; 109 + $add['city'] = implode(',',$data['city']);
95 $add['height_area'] = $data['height_area']; 110 $add['height_area'] = $data['height_area'];
96 $add['money'] = $data['money']; 111 $add['money'] = $data['money'];
97 $validate = Loader::validate('Money'); 112 $validate = Loader::validate('Money');
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 老猫 <thinkcmf@126.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace app\portal\controller;
  12 +use cmf\controller\AdminBaseController;
  13 +use app\portal\model\NeedAnswerModel;
  14 +use app\portal\model\MemberModel;
  15 +use app\portal\model\UserModel;
  16 +use app\portal\service\PostService;
  17 +use think\Db;
  18 +use think\Request;
  19 +use think\Loader;
  20 +/**
  21 + * @title 保证金内容管理
  22 + * @description 接口说明
  23 + * @group 接口分组
  24 + */
  25 +
  26 +class NeedController extends AdminBaseController
  27 +{
  28 +// 列表
  29 + public function user(Request $request)
  30 + {
  31 + $where_coo['status'] = 1;
  32 + $where_coo['type'] = 2;
  33 +// $where_coo = array();
  34 + if($request->post()){
  35 + $search = $request->post();
  36 + if($search['start_time']){
  37 + $start = strtotime($search['start_time']);
  38 + if($search['end_time']){
  39 + $end = strtotime($search['end_time']);
  40 + }else{
  41 + $end = time();
  42 + }
  43 + $where_coo['update_time'] = array('between',"$start,$end");
  44 + $this->assign('start_time',date('Y-m-d H:i',$start));
  45 + $this->assign('end_time',date('Y-m-d H:i',$end));
  46 + }
  47 + if($search['keyword']){
  48 + $where_coo['title'] = array('like',"%".$search['keyword']."%");
  49 + $this->assign('keyword',$search['keyword']);
  50 + }
  51 + }
  52 + $coo_list = Db::name('NeedAnswer')->where($where_coo)
  53 + ->order('score desc , create_time desc')
  54 + ->select()->toArray();
  55 + if($coo_list){
  56 + foreach ($coo_list as $k=>$v){
  57 + $coo_list[$k]['content'] = htmlspecialchars_decode($v['content']);
  58 + }
  59 + }
  60 +
  61 + $this->assign('list',$coo_list);
  62 + return $this->fetch();
  63 + }
  64 +
  65 +
  66 + public function add(Request $request)
  67 + {
  68 + if($request->post()){
  69 +// 添加数据
  70 + $data = $request->post();
  71 + if($request->Post('id')){
  72 +// 修改
  73 + $add['content'] = $data['content'];
  74 + $add['title'] = $data['title'];
  75 + $add['score'] = $data['score'];
  76 + $add['type'] = 2;
  77 + $validate = Loader::validate('NeedAnswer');
  78 + if(!$validate->scene('edit')->check($add)){
  79 + $mes = $validate->getError();
  80 + $this->error("$mes");
  81 + }
  82 + $add['id'] = $request->param('id');
  83 + $model = new NeedAnswerModel();
  84 + $final = $model->isUpdate(true)->allowField(true)->save($add);
  85 + }else{
  86 +// 添加
  87 + $add['content'] = $data['content'];
  88 + $add['title'] = $data['title'];
  89 + $add['score'] = $data['score'];
  90 + $add['type'] = 2;
  91 + $validate = Loader::validate('NeedAnswer');
  92 + if(!$validate->scene('add')->check($add)){
  93 + $mes = $validate->getError();
  94 + $this->error("$mes");
  95 + }
  96 +
  97 + $model = new NeedAnswerModel();
  98 + $final = $model->save($add);
  99 + }
  100 + if($final){
  101 + $this->success('成功',url('index'));
  102 + }else{
  103 + $this->error('失败');
  104 + }
  105 + }else{
  106 + $where_find['type'] = $request->param('id');
  107 + $list = Db::name('NeedAnswer')->where($where_find)->find();
  108 + if($list){
  109 + $list['content'] = htmlspecialchars_decode($list['content']);
  110 + }
  111 + $this->assign('list',$list);
  112 + return $this->fetch('add');
  113 + }
  114 + }
  115 +
  116 +
  117 + // 删除
  118 + public function del(Request $request){
  119 + $ids = $this->request->post();
  120 + $id = $request->param('id');
  121 + if($ids){
  122 + $add_del['id'] = array('in',$ids['ids']);
  123 + }else if($id){
  124 + $add_del['id'] = $request->param('id');
  125 + }else{
  126 + $this->error('删除失败');
  127 + }
  128 + $add_del['status'] = 9;
  129 + $model = new NeedAnswerModel();
  130 + $del = $model->isUpdate(true)->allowField(true)->save($add_del);
  131 + if($del){
  132 + $this->success('删除成功',url('index'));
  133 + }else{
  134 + $this->error('删除失败');
  135 + }
  136 + }
  137 +
  138 +}
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 老猫 <thinkcmf@126.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace app\portal\model;
  12 +
  13 +use app\admin\model\RouteModel;
  14 +use think\Model;
  15 +
  16 +class BrandModel extends Model
  17 +{
  18 + protected $autoWriteTimestamp = true;
  19 +
  20 +}
  1 +<?php
  2 +// +----------------------------------------------------------------------
  3 +// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
  4 +// +----------------------------------------------------------------------
  5 +// | Copyright (c) 2013-2018 http://www.thinkcmf.com All rights reserved.
  6 +// +----------------------------------------------------------------------
  7 +// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
  8 +// +----------------------------------------------------------------------
  9 +// | Author: 小夏 < 449134904@qq.com>
  10 +// +----------------------------------------------------------------------
  11 +namespace app\portal\validate;
  12 +
  13 +use think\Validate;
  14 +
  15 +class BrandValidate extends Validate
  16 +{
  17 + protected $rule = [
  18 + 'name' => 'require',
  19 + ];
  20 + protected $message = [
  21 + 'name.require' => '内容不为空!',
  22 + ];
  23 +
  24 + protected $scene = [
  25 +
  26 + ];
  27 +
  28 +}
@@ -12,6 +12,7 @@ namespace app\user\controller; @@ -12,6 +12,7 @@ namespace app\user\controller;
12 12
13 use cmf\controller\AdminBaseController; 13 use cmf\controller\AdminBaseController;
14 use think\Db; 14 use think\Db;
  15 +use think\Request;
15 16
16 class AdminOauthController extends AdminBaseController 17 class AdminOauthController extends AdminBaseController
17 { 18 {
@@ -31,6 +32,7 @@ class AdminOauthController extends AdminBaseController @@ -31,6 +32,7 @@ class AdminOauthController extends AdminBaseController
31 */ 32 */
32 public function index() 33 public function index()
33 { 34 {
  35 +
34 $oauthUserQuery = Db::name('third_party_user'); 36 $oauthUserQuery = Db::name('third_party_user');
35 37
36 $lists = $oauthUserQuery->field('a.*,u.user_nickname,u.sex,u.avatar')->alias('a')->join('__USER__ u', 'a.user_id = u.id')->where("status", 1)->order("create_time DESC")->paginate(10); 38 $lists = $oauthUserQuery->field('a.*,u.user_nickname,u.sex,u.avatar')->alias('a')->join('__USER__ u', 'a.user_id = u.id')->where("status", 1)->order("create_time DESC")->paginate(10);
@@ -42,6 +44,50 @@ class AdminOauthController extends AdminBaseController @@ -42,6 +44,50 @@ class AdminOauthController extends AdminBaseController
42 return $this->fetch(); 44 return $this->fetch();
43 } 45 }
44 46
  47 + public function user()
  48 + {
  49 +// 用户
  50 + $where_member['type'] = 1;
  51 + $lists = Db::name('Member')->where($where_member)->select()->toArray();
  52 + foreach ($lists as $lk=>$lv){
  53 + $where_referee['id'] = $lv['referee_id'];
  54 + $referee = Db::name('Member')->where($where_referee)->field('id,name')->find();
  55 + if($referee){
  56 + $lists[$lk]['referee_name'] = $referee['name'];
  57 + }else{
  58 + $lists[$lk]['referee_name'] = '';
  59 + }
  60 + }
  61 + // 获取分页显示
  62 +// $page = $lists->render();
  63 + $this->assign('lists', $lists);
  64 +// $this->assign('page', $page);
  65 + // 渲染模板输出
  66 + return $this->fetch();
  67 + }
  68 +
  69 + public function intermediary()
  70 + {
  71 +
  72 +// 中介
  73 + $where_member['type'] = 2;
  74 + $lists = Db::name('Member')->where($where_member)->select()->toArray();
  75 + foreach ($lists as $lk=>$lv){
  76 + $where_referee['id'] = $lv['referee_id'];
  77 + $referee = Db::name('Member')->where($where_referee)->field('id,name')->find();
  78 + if($referee){
  79 + $lists[$lk]['referee_name'] = $referee['name'];
  80 + }else{
  81 + $lists[$lk]['referee_name'] = '';
  82 + }
  83 + }
  84 + // 获取分页显示
  85 +// $page = $lists->render();
  86 + $this->assign('lists', $lists);
  87 +// $this->assign('page', $page);
  88 + // 渲染模板输出
  89 + return $this->fetch();
  90 + }
45 /** 91 /**
46 * 后台删除第三方用户绑定 92 * 后台删除第三方用户绑定
47 * @adminMenu( 93 * @adminMenu(
@@ -64,6 +110,22 @@ class AdminOauthController extends AdminBaseController @@ -64,6 +110,22 @@ class AdminOauthController extends AdminBaseController
64 Db::name("third_party_user")->where("id", $id)->delete(); 110 Db::name("third_party_user")->where("id", $id)->delete();
65 $this->success("删除成功!", "admin_oauth/index"); 111 $this->success("删除成功!", "admin_oauth/index");
66 } 112 }
  113 +// 删除
  114 + public function del(Request $request)
  115 + {
  116 + $where_member['id'] = $request->param('id');
  117 + $is_isset = Db::name('Member')->where($where_member)->field('status')->find();
  118 + if(!$is_isset){
  119 + $this->error('用户信息错误!');
  120 + }
  121 + $save['status'] = 8;
  122 + $save['update_time'] = time();
  123 + $update = Db::name('Member')->where($where_member)->update($save);
  124 + if($update){
  125 + $this->success("删除成功!", "admin_oauth/intermediary");
  126 + }else{
  127 + $this->error('删除失败!');
  128 + }
67 129
68 - 130 + }
69 } 131 }
  1 +#animationTipBox {
  2 + font-family: "Microsoft Yahei","微软雅黑",Arial,Tahoma;
  3 + font-size: 14px;
  4 + width: 250px;
  5 + height: auto;
  6 + background-color: #fff;
  7 + border-radius: 8px;
  8 + position: fixed;
  9 + left: 50%;
  10 + top: 50%;
  11 + margin-left: -125px;
  12 + margin-top: -85px;
  13 + z-index: 1001;
  14 + -webkit-animation: alertAnimation .3s ease-in-out 0 1;
  15 + -moz-animation: alertAnimation .3s ease-in-out 0 1;
  16 + animation: alertAnimation .3s ease-in-out 0 1
  17 +}
  18 +
  19 +#sm-load {
  20 + width: 20px;
  21 + height: 20px;
  22 + padding: 0;
  23 + background: 0;
  24 + padding: 0;
  25 + position: relative;
  26 + float: left;
  27 + vertical-align: middle;
  28 + margin-right: 5px;
  29 + top: 0;
  30 + left: 0;
  31 + margin: 0;
  32 + -webkit-animation: none;
  33 + -moz-animation: none;
  34 + animation: none
  35 +}
  36 +
  37 +#sm-load .load {
  38 + width: 20px;
  39 + height: 20px;
  40 + border: 0;
  41 + margin: 0 auto;
  42 + top: 0
  43 +}
  44 +
  45 +#sm-load .icon_box {
  46 + margin: 0 auto
  47 +}
  48 +
  49 +#sm-load .load .cirBox1,#sm-load .load .cirBox2,#sm-load .load .cirBox3 {
  50 + width: 20px;
  51 + height: 20px;
  52 + position: absolute;
  53 + left: 0;
  54 + top: 0
  55 +}
  56 +
  57 +#sm-load .load .cirBox1>div,#sm-load .load .cirBox2>div,#sm-load .load .cirBox3>div {
  58 + width: 4px;
  59 + height: 4px;
  60 + border-radius: 100%;
  61 + background-color: #fff;
  62 + position: absolute
  63 +}
  64 +
  65 +#sm-load .load .icon_box {
  66 + width: 20px;
  67 + height: 20px
  68 +}
  69 +
  70 +#animationTipBox .icon {
  71 + position: relative;
  72 + width: 80px;
  73 + height: 80px;
  74 + border-radius: 50px;
  75 + border: 4px solid #6c3;
  76 + margin: 15px auto 5px auto
  77 +}
  78 +
  79 +#animationTipBox .icon_box {
  80 + width: 80px;
  81 + height: 80px;
  82 + margin: 0 auto;
  83 + text-align: center;
  84 + position: relative
  85 +}
  86 +
  87 +.tip .icon {
  88 + width: 80px;
  89 + height: 80px;
  90 + background-color: #6c3;
  91 + border-radius: 100%;
  92 + color: #fff;
  93 + font-size: 80px;
  94 + text-align: center;
  95 + line-height: 80px
  96 +}
  97 +
  98 +#animationTipBox .lose .icon {
  99 + border-color: #ff9090
  100 +}
  101 +
  102 +#animationTipBox .lose .icon_box {
  103 + -webkit-animation: lose_Animation .5s;
  104 + -moz-animation: lose_Animation .5s;
  105 + animation: lose_Animation .5s
  106 +}
  107 +
  108 +#animationTipBox .dec_txt {
  109 + font-size: 16px;
  110 + text-align: center;
  111 + color: #666;
  112 + line-height: 26px;
  113 + height: 37px;
  114 + padding: 5px 0 10px 0
  115 +}
  116 +
  117 +.success .line_short {
  118 + width: 25px;
  119 + height: 5px;
  120 + position: absolute;
  121 + left: 10px;
  122 + top: 44px;
  123 + border-radius: 4px;
  124 + background-color: #6c3;
  125 + -webkit-transform: rotate(45deg);
  126 + -moz-transform: rotate(45deg);
  127 + transform: rotate(45deg);
  128 + -webkit-animation: success_short_Animation .65s;
  129 + -moz-animation: success_short_Animation .65s;
  130 + animation: success_short_Animation .65s
  131 +}
  132 +
  133 +.success .line_long {
  134 + width: 47px;
  135 + height: 5px;
  136 + position: absolute;
  137 + right: 4px;
  138 + top: 36px;
  139 + border-radius: 4px;
  140 + background-color: #6c3;
  141 + -webkit-transform: rotate(-45deg);
  142 + -moz-transform: rotate(-45deg);
  143 + transform: rotate(-45deg);
  144 + -webkit-animation: success_long_Animation .65s;
  145 + -moz-animation: success_long_Animation .65s;
  146 + animation: success_long_Animation .65s
  147 +}
  148 +
  149 +.lose .line_left,.lose .line_right {
  150 + width: 47px;
  151 + height: 5px;
  152 + position: absolute;
  153 + left: 14px;
  154 + top: 37px;
  155 + border-radius: 4px;
  156 + background-color: #ff9090;
  157 + -webkit-transform: rotate(45deg);
  158 + -moz-transform: rotate(45deg);
  159 + transform: rotate(45deg)
  160 +}
  161 +
  162 +.lose .line_right {
  163 + right: 11px;
  164 + top: 37px;
  165 + -webkit-transform: rotate(-45deg);
  166 + -moz-transform: rotate(-45deg);
  167 + transform: rotate(-45deg)
  168 +}
  169 +
  170 +@keyframes alertAnimation {
  171 + 0% {
  172 + transform: scale(0.5)
  173 + }
  174 +
  175 + 45% {
  176 + transform: scale(1.25)
  177 + }
  178 +
  179 + 80% {
  180 + transform: scale(0.95)
  181 + }
  182 +
  183 + 100% {
  184 + transform: scale(1)
  185 + }
  186 +}
  187 +
  188 +@-webkit-keyframes alertAnimation {
  189 + 0% {
  190 + -webkit-transform: scale(0.5)
  191 + }
  192 +
  193 + 45% {
  194 + -webkit-transform: scale(1.25)
  195 + }
  196 +
  197 + 80% {
  198 + -webkit-transform: scale(0.95)
  199 + }
  200 +
  201 + 100% {
  202 + -webkit-transform: scale(1)
  203 + }
  204 +}
  205 +
  206 +@-moz-keyframes alertAnimation {
  207 + 0% {
  208 + -moz-transform: scale(0.5)
  209 + }
  210 +
  211 + 45% {
  212 + -moz-transform: scale(1.25)
  213 + }
  214 +
  215 + 80% {
  216 + -moz-transform: scale(0.95)
  217 + }
  218 +
  219 + 100% {
  220 + -moz-transform: scale(1)
  221 + }
  222 +}
  223 +
  224 +@-webkit-keyframes success_short_Animation {
  225 + 0% {
  226 + width: 0;
  227 + left: 1px;
  228 + top: 19px
  229 + }
  230 +
  231 + 54% {
  232 + width: 0;
  233 + left: 1px;
  234 + top: 19px
  235 + }
  236 +
  237 + 70% {
  238 + width: 50px;
  239 + left: -4px;
  240 + top: 37px
  241 + }
  242 +
  243 + 84% {
  244 + width: 17px;
  245 + left: 21px;
  246 + top: 48px
  247 + }
  248 +
  249 + 100% {
  250 + width: 25px;
  251 + left: 14px;
  252 + top: 45px
  253 + }
  254 +}
  255 +
  256 +@-moz-keyframes success_short_Animation {
  257 + 0% {
  258 + width: 0;
  259 + left: 1px;
  260 + top: 19px
  261 + }
  262 +
  263 + 54% {
  264 + width: 0;
  265 + left: 1px;
  266 + top: 19px
  267 + }
  268 +
  269 + 70% {
  270 + width: 50px;
  271 + left: -4px;
  272 + top: 37px
  273 + }
  274 +
  275 + 84% {
  276 + width: 17px;
  277 + left: 21px;
  278 + top: 48px
  279 + }
  280 +
  281 + 100% {
  282 + width: 25px;
  283 + left: 14px;
  284 + top: 45px
  285 + }
  286 +}
  287 +
  288 +@keyframes success_short_Animation {
  289 + 0% {
  290 + width: 0;
  291 + left: 1px;
  292 + top: 19px
  293 + }
  294 +
  295 + 54% {
  296 + width: 0;
  297 + left: 1px;
  298 + top: 19px
  299 + }
  300 +
  301 + 70% {
  302 + width: 50px;
  303 + left: -4px;
  304 + top: 37px
  305 + }
  306 +
  307 + 84% {
  308 + width: 17px;
  309 + left: 21px;
  310 + top: 48px
  311 + }
  312 +
  313 + 100% {
  314 + width: 25px;
  315 + left: 14px;
  316 + top: 45px
  317 + }
  318 +}
  319 +
  320 +@-webkit-keyframes success_long_Animation {
  321 + 0% {
  322 + width: 0;
  323 + right: 46px;
  324 + top: 54px
  325 + }
  326 +
  327 + 65% {
  328 + width: 0;
  329 + right: 46px;
  330 + top: 54px
  331 + }
  332 +
  333 + 84% {
  334 + width: 55px;
  335 + right: 0;
  336 + top: 35px
  337 + }
  338 +
  339 + 100% {
  340 + width: 47px;
  341 + right: 8px;
  342 + top: 38px
  343 + }
  344 +}
  345 +
  346 +@-moz-keyframes success_long_Animation {
  347 + 0% {
  348 + width: 0;
  349 + right: 46px;
  350 + top: 54px
  351 + }
  352 +
  353 + 65% {
  354 + width: 0;
  355 + right: 46px;
  356 + top: 54px
  357 + }
  358 +
  359 + 84% {
  360 + width: 55px;
  361 + right: 0;
  362 + top: 35px
  363 + }
  364 +
  365 + 100% {
  366 + width: 47px;
  367 + right: 8px;
  368 + top: 38px
  369 + }
  370 +}
  371 +
  372 +@keyframes success_long_Animation {
  373 + 0% {
  374 + width: 0;
  375 + right: 46px;
  376 + top: 54px
  377 + }
  378 +
  379 + 65% {
  380 + width: 0;
  381 + right: 46px;
  382 + top: 54px
  383 + }
  384 +
  385 + 84% {
  386 + width: 55px;
  387 + right: 0;
  388 + top: 35px
  389 + }
  390 +
  391 + 100% {
  392 + width: 47px;
  393 + right: 8px;
  394 + top: 38px
  395 + }
  396 +}
  397 +
  398 +@-webkit-keyframes lose_Animation {
  399 + 0% {
  400 + -webkit-transform: scale(0.6);
  401 + opacity: .2
  402 + }
  403 +
  404 + 50% {
  405 + -webkit-transform: scale(0.6);
  406 + opacity: .5
  407 + }
  408 +
  409 + 80% {
  410 + -webkit-transform: scale(1.15);
  411 + opacity: .8
  412 + }
  413 +
  414 + 100% {
  415 + -webkit-transform: scale(1);
  416 + opacity: 1.0
  417 + }
  418 +}
  419 +
  420 +@-moz-keyframes lose_Animation {
  421 + 0% {
  422 + -moz-transform: scale(0.6);
  423 + opacity: .2
  424 + }
  425 +
  426 + 50% {
  427 + -moz-transform: scale(0.6);
  428 + opacity: .5
  429 + }
  430 +
  431 + 80% {
  432 + -moz-transform: scale(1.15);
  433 + opacity: .8
  434 + }
  435 +
  436 + 100% {
  437 + -moz-transform: scale(1);
  438 + opacity: 1.0
  439 + }
  440 +}
  441 +
  442 +@keyframes lose_Animation {
  443 + 0% {
  444 + transform: scale(0.6);
  445 + opacity: .2
  446 + }
  447 +
  448 + 50% {
  449 + transform: scale(0.6);
  450 + opacity: .5
  451 + }
  452 +
  453 + 80% {
  454 + transform: scale(1.15);
  455 + opacity: .8
  456 + }
  457 +
  458 + 100% {
  459 + transform: scale(1);
  460 + opacity: 1.0
  461 + }
  462 +}
  463 +
  464 +@-webkit-keyframes load_Animation {
  465 + 0% {
  466 + -webkit-transform: scale(0.6);
  467 + opacity: .2
  468 + }
  469 +
  470 + 50% {
  471 + -webkit-transform: scale(0.6);
  472 + opacity: .5
  473 + }
  474 +
  475 + 80% {
  476 + -webkit-transform: scale(1.15);
  477 + opacity: .8
  478 + }
  479 +
  480 + 100% {
  481 + -webkit-transform: scale(1);
  482 + opacity: 1.0
  483 + }
  484 +}
  485 +
  486 +@-moz-keyframes load_Animation {
  487 + 0% {
  488 + -moz-transform: scale(0.6);
  489 + opacity: .2
  490 + }
  491 +
  492 + 50% {
  493 + -moz-transform: scale(0.6);
  494 + opacity: .5
  495 + }
  496 +
  497 + 80% {
  498 + -moz-transform: scale(1.15);
  499 + opacity: .8
  500 + }
  501 +
  502 + 100% {
  503 + -moz-transform: scale(1);
  504 + opacity: 1.0
  505 + }
  506 +}
  507 +
  508 +@keyframes load_Animation {
  509 + 0% {
  510 + transform: scale(0.6);
  511 + opacity: .2
  512 + }
  513 +
  514 + 50% {
  515 + transform: scale(0.6);
  516 + opacity: .5
  517 + }
  518 +
  519 + 80% {
  520 + transform: scale(1.15);
  521 + opacity: .8
  522 + }
  523 +
  524 + 100% {
  525 + transform: scale(1);
  526 + opacity: 1.0
  527 + }
  528 +}
  529 +
  530 +.load {
  531 + position: relative;
  532 + width: 60px;
  533 + height: 80px;
  534 + border-radius: 50px;
  535 + border: 4px solid #fff;
  536 + margin: 15px auto 5px auto;
  537 + top: 10px
  538 +}
  539 +
  540 +.load .icon_box {
  541 + margin: 10px auto;
  542 + width: 60px;
  543 + height: 60px
  544 +}
  545 +
  546 +.load .cirBox1,.load .cirBox2,.load .cirBox3 {
  547 + width: 60px;
  548 + height: 60px;
  549 + position: absolute;
  550 + left: 0;
  551 + top: 0
  552 +}
  553 +
  554 +.load .cirBox1>div,.load .cirBox2>div,.load .cirBox3>div {
  555 + width: 10px;
  556 + height: 10px;
  557 + border-radius: 100%;
  558 + background-color: #ccc;
  559 + position: absolute
  560 +}
  561 +
  562 +.load .cirBox1 {
  563 + -webkit-transform: rotate(30deg);
  564 + -moz-transform: rotate(30deg);
  565 + transform: rotate(30deg)
  566 +}
  567 +
  568 +.load .cirBox2 {
  569 + -webkit-transform: rotate(60deg);
  570 + -moz-transform: rotate(60deg);
  571 + transform: rotate(60deg)
  572 +}
  573 +
  574 +.load .cirBox3 {
  575 + -webkit-transform: rotate(90deg);
  576 + -moz-transform: rotate(90deg);
  577 + transform: rotate(90deg)
  578 +}
  579 +
  580 +.load .cir1 {
  581 + left: 0;
  582 + top: 0
  583 +}
  584 +
  585 +.load .cir2 {
  586 + right: 0;
  587 + top: 0
  588 +}
  589 +
  590 +.load .cir3 {
  591 + right: 0;
  592 + bottom: 0
  593 +}
  594 +
  595 +.load .cir4 {
  596 + left: 0;
  597 + bottom: 0
  598 +}
  599 +
  600 +.load .cir1,.load .cir2,.load .cir3,.load .cir4 {
  601 + -webkit-animation: cir_Animation 1.2s ease 0 infinite;
  602 + -moz-animation: cir_Animation 1.2s ease 0 infinite;
  603 + animation: cir_Animation 1.2s ease 0 infinite
  604 +}
  605 +
  606 +.cirBox1 .cir2 {
  607 + -webkit-animation-delay: -1.1s;
  608 + -moz-animation-delay: -1.1s;
  609 + animation-delay: -1.1s
  610 +}
  611 +
  612 +.cirBox1 .cir3 {
  613 + -webkit-animation-delay: -0.8s;
  614 + -moz-animation-delay: -0.8s;
  615 + animation-delay: -0.8s
  616 +}
  617 +
  618 +.cirBox1 .cir4 {
  619 + -webkit-animation-delay: -0.5s;
  620 + -moz-animation-delay: -0.5s;
  621 + animation-delay: -0.5s
  622 +}
  623 +
  624 +.cirBox2 .cir2 {
  625 + -webkit-animation-delay: -1.0s;
  626 + -moz-animation-delay: -1.0s;
  627 + animation-delay: -1.0s
  628 +}
  629 +
  630 +.cirBox2 .cir3 {
  631 + -webkit-animation-delay: -0.7s;
  632 + -moz-animation-delay: -0.7s;
  633 + animation-delay: -0.7s
  634 +}
  635 +
  636 +.cirBox2 .cir4 {
  637 + -webkit-animation-delay: -0.4s;
  638 + -moz-animation-delay: -0.4s;
  639 + animation-delay: -0.4s
  640 +}
  641 +
  642 +.cirBox3 .cir2 {
  643 + -webkit-animation-delay: -0.9s;
  644 + -moz-animation-delay: -0.9s;
  645 + animation-delay: -0.9s
  646 +}
  647 +
  648 +.cirBox3 .cir3 {
  649 + -webkit-animation-delay: -0.6s;
  650 + -moz-animation-delay: -0.6s;
  651 + animation-delay: -0.6s
  652 +}
  653 +
  654 +.cirBox3 .cir4 {
  655 + -webkit-animation-delay: -0.3s;
  656 + -moz-animation-delay: -0.3s;
  657 + animation-delay: -0.3s
  658 +}
  659 +
  660 +@-webkit-keyframes cir_Animation {
  661 + 0%,80%,100% {
  662 + -webkit-transform: scale(0.4)
  663 + }
  664 +
  665 + 40% {
  666 + -webkit-transform: scale(1.0)
  667 + }
  668 +}
  669 +
  670 +.mask {
  671 + width: 100%;
  672 + height: 100%;
  673 + background-color: #000;
  674 + opacity: .8;
  675 + position: fixed;
  676 + left: 0;
  677 + top: 0;
  678 + z-index: 1000
  679 +}
  680 +
  681 +#animationTipBox .okoButton {
  682 + width: 80px;
  683 + display: block;
  684 + height: 35px;
  685 + margin: 0 auto;
  686 + border: 0;
  687 + padding: 0;
  688 + border-radius: 5px;
  689 + background: #6c3;
  690 + color: #fff;
  691 + font-size: 22px;
  692 +}
  693 +
  694 +#animationTipBox .redOkoButton {
  695 + background: #ff9090
  696 +}
  1 +/*
  2 + * @弹出提示层 ( 加载动画(load), 提示动画(tip), 成功(success), 错误(error), )
  3 + * @method tipBox
  4 + * @description 默认配置参数
  5 + * @time 2014-12-19
  6 + * @param {Number} width -宽度
  7 + * @param {Number} height -高度
  8 + * @param {String} str -默认文字
  9 + * @param {Object} windowDom -载入窗口 默认当前窗口
  10 + * @param {Number} setTime -定时消失(毫秒) 默认为0 不消失
  11 + * @param {Boolean} hasMask -是否显示遮罩
  12 + * @param {Boolean} hasMaskWhite -显示白色遮罩
  13 + * @param {Boolean} clickDomCancel -点击空白取消
  14 + * @param {Function} callBack -回调函数 (只在开启定时消失时才生效)
  15 + * @param {Function} hasBtn -显示按钮
  16 + * @param {String} type -动画类型 (加载,成功,失败,提示)
  17 + * @example
  18 + * new TipBox();
  19 + * new TipBox({type:'load',setTime:1000,callBack:function(){ alert(..) }});
  20 +*/
  21 +function TipBox(cfg){
  22 + this.config = {
  23 + width : 250,
  24 + height : 170,
  25 + str : '正在处理',
  26 + windowDom : window,
  27 + setTime : 0,
  28 + hasMask : true,
  29 + hasMaskWhite : false,
  30 + clickDomCancel : false,
  31 + callBack : null,
  32 + hasBtn : false,
  33 + type : 'success'
  34 + }
  35 + $.extend(this.config,cfg);
  36 +
  37 + //存在就retrun
  38 + if(TipBox.prototype.boundingBox) return;
  39 +
  40 + //初始化
  41 + this.render(this.config.type);
  42 + return this;
  43 +};
  44 +
  45 +//外层box
  46 +TipBox.prototype.boundingBox = null;
  47 +
  48 +//渲染
  49 +TipBox.prototype.render = function(tipType,container){
  50 + this.renderUI(tipType);
  51 +
  52 + //绑定事件
  53 + this.bindUI();
  54 +
  55 + //初始化UI
  56 + this.syncUI();
  57 + $(container || this.config.windowDom.document.body).append(TipBox.prototype.boundingBox);
  58 +};
  59 +
  60 +//渲染UI
  61 +TipBox.prototype.renderUI = function(tipType){
  62 + TipBox.prototype.boundingBox = $("<div id='animationTipBox'></div>");
  63 + tipType == 'load' && this.loadRenderUI();
  64 + tipType == 'success' && this.successRenderUI();
  65 + tipType == 'error' && this.errorRenderUI();
  66 + tipType == 'tip' && this.tipRenderUI();
  67 + TipBox.prototype.boundingBox.appendTo(this.config.windowDom.document.body);
  68 +
  69 + //是否显示遮罩
  70 + if(this.config.hasMask){
  71 + this.config.hasMaskWhite ? this._mask = $("<div class='mask_white'></div>") : this._mask = $("<div class='mask'></div>");
  72 + this._mask.appendTo(this.config.windowDom.document.body);
  73 + }
  74 + // 是否显示按钮
  75 + if(this.config.hasBtn){
  76 + this.config.height = 206;
  77 + $('#animationTipBox').css("margin-top","103px");
  78 + switch(this.config.type){
  79 + case 'success':$(".success").after("<button class='okoButton'>ok</button>");
  80 + break;
  81 + case 'error':$(".lose").after("<button class='okoButton redOkoButton'>ok</button>");
  82 + break;
  83 + case 'tip':$(".tip").after("<button class='okoButton'>ok</button>");
  84 + break;
  85 + default: break;
  86 + }
  87 + $('button.okoButton').on('click',function(){_this.close(); window.location.href= '';});
  88 + }
  89 + //定时消失
  90 + _this = this;
  91 + !this.config.setTime && typeof this.config.callBack === "function" && (this.config.setTime = 1);
  92 + this.config.setTime && setTimeout( function(){ _this.close(); }, _this.config.setTime );
  93 +};
  94 +
  95 +TipBox.prototype.bindUI = function(){
  96 + _this = this;
  97 +
  98 + //点击空白立即取消
  99 + this.config.clickDomCancel && this._mask && this._mask.click(function(){_this.close(); });
  100 +};
  101 +TipBox.prototype.syncUI = function(){
  102 + TipBox.prototype.boundingBox.css({
  103 + width : this.config.width+'px',
  104 + height : this.config.height+'px',
  105 + marginLeft : "-"+(this.config.width/2)+'px',
  106 + marginTop : "-"+(this.config.height/2)+'px'
  107 + });
  108 +};
  109 +
  110 +//提示效果UI
  111 +TipBox.prototype.tipRenderUI = function(){
  112 + var tip = "<div class='tip'>";
  113 + tip +=" <div class='icon'>i</div>";
  114 + tip +=" <div class='dec_txt'>"+this.config.str+"</div>";
  115 + tip += "</div>";
  116 + TipBox.prototype.boundingBox.append(tip);
  117 +};
  118 +
  119 +//成功效果UI
  120 +TipBox.prototype.successRenderUI = function(){
  121 + var suc = "<div class='success'>";
  122 + suc +=" <div class='icon'>";
  123 + suc += "<div class='line_short'></div>";
  124 + suc += "<div class='line_long'></div> ";
  125 + suc += "</div>";
  126 + suc +=" <div class='dec_txt'>"+this.config.str+"</div>";
  127 + suc += "</div>";
  128 + TipBox.prototype.boundingBox.append(suc);
  129 +};
  130 +
  131 +//错误效果UI
  132 +TipBox.prototype.errorRenderUI = function(){
  133 + var err = "<div class='lose'>";
  134 + err += " <div class='icon'>";
  135 + err += " <div class='icon_box'>";
  136 + err += " <div class='line_left'></div>";
  137 + err += " <div class='line_right'></div>";
  138 + err += " </div>";
  139 + err += " </div>";
  140 + err += "<div class='dec_txt'>"+this.config.str+"</div>";
  141 + err += "</div>";
  142 + TipBox.prototype.boundingBox.append(err);
  143 +};
  144 +
  145 +//加载动画load UI
  146 +TipBox.prototype.loadRenderUI = function(){
  147 + var load = "<div class='load'>";
  148 + load += "<div class='icon_box'>";
  149 + for(var i = 1; i < 4; i++ ){
  150 + load += "<div class='cirBox"+i+"'>";
  151 + load += "<div class='cir1'></div>";
  152 + load += "<div class='cir2'></div>";
  153 + load += "<div class='cir3'></div>";
  154 + load += "<div class='cir4'></div>";
  155 + load += "</div>";
  156 + }
  157 + load += "</div>";
  158 + load += "</div>";
  159 + load += "<div class='dec_txt'>"+this.config.str+"</div>";
  160 + TipBox.prototype.boundingBox.append(load);
  161 +};
  162 +
  163 +//关闭
  164 +TipBox.prototype.close = function(){
  165 + TipBox.prototype.destroy();
  166 + this.destroy();
  167 + this.config.setTime && typeof this.config.callBack === "function" && this.config.callBack();
  168 +};
  169 +
  170 +//销毁
  171 +TipBox.prototype.destroy = function(){
  172 + this._mask && this._mask.remove();
  173 + TipBox.prototype.boundingBox && TipBox.prototype.boundingBox.remove();
  174 + TipBox.prototype.boundingBox = null;
  175 +};
  1 +/* Zepto v1.1.3 - zepto event ajax form ie - zeptojs.com/license */
  2 +var Zepto=function(){function L(t){return null==t?String(t):j[T.call(t)]||"object"}function Z(t){return"function"==L(t)}function $(t){return null!=t&&t==t.window}function _(t){return null!=t&&t.nodeType==t.DOCUMENT_NODE}function D(t){return"object"==L(t)}function R(t){return D(t)&&!$(t)&&Object.getPrototypeOf(t)==Object.prototype}function M(t){return"number"==typeof t.length}function k(t){return s.call(t,function(t){return null!=t})}function z(t){return t.length>0?n.fn.concat.apply([],t):t}function F(t){return t.replace(/::/g,"/").replace(/([A-Z]+)([A-Z][a-z])/g,"$1_$2").replace(/([a-z\d])([A-Z])/g,"$1_$2").replace(/_/g,"-").toLowerCase()}function q(t){return t in f?f[t]:f[t]=new RegExp("(^|\\s)"+t+"(\\s|$)")}function H(t,e){return"number"!=typeof e||c[F(t)]?e:e+"px"}function I(t){var e,n;return u[t]||(e=a.createElement(t),a.body.appendChild(e),n=getComputedStyle(e,"").getPropertyValue("display"),e.parentNode.removeChild(e),"none"==n&&(n="block"),u[t]=n),u[t]}function V(t){return"children"in t?o.call(t.children):n.map(t.childNodes,function(t){return 1==t.nodeType?t:void 0})}function U(n,i,r){for(e in i)r&&(R(i[e])||A(i[e]))?(R(i[e])&&!R(n[e])&&(n[e]={}),A(i[e])&&!A(n[e])&&(n[e]=[]),U(n[e],i[e],r)):i[e]!==t&&(n[e]=i[e])}function B(t,e){return null==e?n(t):n(t).filter(e)}function J(t,e,n,i){return Z(e)?e.call(t,n,i):e}function X(t,e,n){null==n?t.removeAttribute(e):t.setAttribute(e,n)}function W(e,n){var i=e.className,r=i&&i.baseVal!==t;return n===t?r?i.baseVal:i:void(r?i.baseVal=n:e.className=n)}function Y(t){var e;try{return t?"true"==t||("false"==t?!1:"null"==t?null:/^0/.test(t)||isNaN(e=Number(t))?/^[\[\{]/.test(t)?n.parseJSON(t):t:e):t}catch(i){return t}}function G(t,e){e(t);for(var n in t.childNodes)G(t.childNodes[n],e)}var t,e,n,i,C,N,r=[],o=r.slice,s=r.filter,a=window.document,u={},f={},c={"column-count":1,columns:1,"font-weight":1,"line-height":1,opacity:1,"z-index":1,zoom:1},l=/^\s*<(\w+|!)[^>]*>/,h=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,p=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,d=/^(?:body|html)$/i,m=/([A-Z])/g,g=["val","css","html","text","data","width","height","offset"],v=["after","prepend","before","append"],y=a.createElement("table"),x=a.createElement("tr"),b={tr:a.createElement("tbody"),tbody:y,thead:y,tfoot:y,td:x,th:x,"*":a.createElement("div")},w=/complete|loaded|interactive/,E=/^[\w-]*$/,j={},T=j.toString,S={},O=a.createElement("div"),P={tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},A=Array.isArray||function(t){return t instanceof Array};return S.matches=function(t,e){if(!e||!t||1!==t.nodeType)return!1;var n=t.webkitMatchesSelector||t.mozMatchesSelector||t.oMatchesSelector||t.matchesSelector;if(n)return n.call(t,e);var i,r=t.parentNode,o=!r;return o&&(r=O).appendChild(t),i=~S.qsa(r,e).indexOf(t),o&&O.removeChild(t),i},C=function(t){return t.replace(/-+(.)?/g,function(t,e){return e?e.toUpperCase():""})},N=function(t){return s.call(t,function(e,n){return t.indexOf(e)==n})},S.fragment=function(e,i,r){var s,u,f;return h.test(e)&&(s=n(a.createElement(RegExp.$1))),s||(e.replace&&(e=e.replace(p,"<$1></$2>")),i===t&&(i=l.test(e)&&RegExp.$1),i in b||(i="*"),f=b[i],f.innerHTML=""+e,s=n.each(o.call(f.childNodes),function(){f.removeChild(this)})),R(r)&&(u=n(s),n.each(r,function(t,e){g.indexOf(t)>-1?u[t](e):u.attr(t,e)})),s},S.Z=function(t,e){return t=t||[],t.__proto__=n.fn,t.selector=e||"",t},S.isZ=function(t){return t instanceof S.Z},S.init=function(e,i){var r;if(!e)return S.Z();if("string"==typeof e)if(e=e.trim(),"<"==e[0]&&l.test(e))r=S.fragment(e,RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(a,e)}else{if(Z(e))return n(a).ready(e);if(S.isZ(e))return e;if(A(e))r=k(e);else if(D(e))r=[e],e=null;else if(l.test(e))r=S.fragment(e.trim(),RegExp.$1,i),e=null;else{if(i!==t)return n(i).find(e);r=S.qsa(a,e)}}return S.Z(r,e)},n=function(t,e){return S.init(t,e)},n.extend=function(t){var e,n=o.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach(function(n){U(t,n,e)}),t},S.qsa=function(t,e){var n,i="#"==e[0],r=!i&&"."==e[0],s=i||r?e.slice(1):e,a=E.test(s);return _(t)&&a&&i?(n=t.getElementById(s))?[n]:[]:1!==t.nodeType&&9!==t.nodeType?[]:o.call(a&&!i?r?t.getElementsByClassName(s):t.getElementsByTagName(e):t.querySelectorAll(e))},n.contains=function(t,e){return t!==e&&t.contains(e)},n.type=L,n.isFunction=Z,n.isWindow=$,n.isArray=A,n.isPlainObject=R,n.isEmptyObject=function(t){var e;for(e in t)return!1;return!0},n.inArray=function(t,e,n){return r.indexOf.call(e,t,n)},n.camelCase=C,n.trim=function(t){return null==t?"":String.prototype.trim.call(t)},n.uuid=0,n.support={},n.expr={},n.map=function(t,e){var n,r,o,i=[];if(M(t))for(r=0;r<t.length;r++)n=e(t[r],r),null!=n&&i.push(n);else for(o in t)n=e(t[o],o),null!=n&&i.push(n);return z(i)},n.each=function(t,e){var n,i;if(M(t)){for(n=0;n<t.length;n++)if(e.call(t[n],n,t[n])===!1)return t}else for(i in t)if(e.call(t[i],i,t[i])===!1)return t;return t},n.grep=function(t,e){return s.call(t,e)},window.JSON&&(n.parseJSON=JSON.parse),n.each("Boolean Number String Function Array Date RegExp Object Error".split(" "),function(t,e){j["[object "+e+"]"]=e.toLowerCase()}),n.fn={forEach:r.forEach,reduce:r.reduce,push:r.push,sort:r.sort,indexOf:r.indexOf,concat:r.concat,map:function(t){return n(n.map(this,function(e,n){return t.call(e,n,e)}))},slice:function(){return n(o.apply(this,arguments))},ready:function(t){return w.test(a.readyState)&&a.body?t(n):a.addEventListener("DOMContentLoaded",function(){t(n)},!1),this},get:function(e){return e===t?o.call(this):this[e>=0?e:e+this.length]},toArray:function(){return this.get()},size:function(){return this.length},remove:function(){return this.each(function(){null!=this.parentNode&&this.parentNode.removeChild(this)})},each:function(t){return r.every.call(this,function(e,n){return t.call(e,n,e)!==!1}),this},filter:function(t){return Z(t)?this.not(this.not(t)):n(s.call(this,function(e){return S.matches(e,t)}))},add:function(t,e){return n(N(this.concat(n(t,e))))},is:function(t){return this.length>0&&S.matches(this[0],t)},not:function(e){var i=[];if(Z(e)&&e.call!==t)this.each(function(t){e.call(this,t)||i.push(this)});else{var r="string"==typeof e?this.filter(e):M(e)&&Z(e.item)?o.call(e):n(e);this.forEach(function(t){r.indexOf(t)<0&&i.push(t)})}return n(i)},has:function(t){return this.filter(function(){return D(t)?n.contains(this,t):n(this).find(t).size()})},eq:function(t){return-1===t?this.slice(t):this.slice(t,+t+1)},first:function(){var t=this[0];return t&&!D(t)?t:n(t)},last:function(){var t=this[this.length-1];return t&&!D(t)?t:n(t)},find:function(t){var e,i=this;return e="object"==typeof t?n(t).filter(function(){var t=this;return r.some.call(i,function(e){return n.contains(e,t)})}):1==this.length?n(S.qsa(this[0],t)):this.map(function(){return S.qsa(this,t)})},closest:function(t,e){var i=this[0],r=!1;for("object"==typeof t&&(r=n(t));i&&!(r?r.indexOf(i)>=0:S.matches(i,t));)i=i!==e&&!_(i)&&i.parentNode;return n(i)},parents:function(t){for(var e=[],i=this;i.length>0;)i=n.map(i,function(t){return(t=t.parentNode)&&!_(t)&&e.indexOf(t)<0?(e.push(t),t):void 0});return B(e,t)},parent:function(t){return B(N(this.pluck("parentNode")),t)},children:function(t){return B(this.map(function(){return V(this)}),t)},contents:function(){return this.map(function(){return o.call(this.childNodes)})},siblings:function(t){return B(this.map(function(t,e){return s.call(V(e.parentNode),function(t){return t!==e})}),t)},empty:function(){return this.each(function(){this.innerHTML=""})},pluck:function(t){return n.map(this,function(e){return e[t]})},show:function(){return this.each(function(){"none"==this.style.display&&(this.style.display=""),"none"==getComputedStyle(this,"").getPropertyValue("display")&&(this.style.display=I(this.nodeName))})},replaceWith:function(t){return this.before(t).remove()},wrap:function(t){var e=Z(t);if(this[0]&&!e)var i=n(t).get(0),r=i.parentNode||this.length>1;return this.each(function(o){n(this).wrapAll(e?t.call(this,o):r?i.cloneNode(!0):i)})},wrapAll:function(t){if(this[0]){n(this[0]).before(t=n(t));for(var e;(e=t.children()).length;)t=e.first();n(t).append(this)}return this},wrapInner:function(t){var e=Z(t);return this.each(function(i){var r=n(this),o=r.contents(),s=e?t.call(this,i):t;o.length?o.wrapAll(s):r.append(s)})},unwrap:function(){return this.parent().each(function(){n(this).replaceWith(n(this).children())}),this},clone:function(){return this.map(function(){return this.cloneNode(!0)})},hide:function(){return this.css("display","none")},toggle:function(e){return this.each(function(){var i=n(this);(e===t?"none"==i.css("display"):e)?i.show():i.hide()})},prev:function(t){return n(this.pluck("previousElementSibling")).filter(t||"*")},next:function(t){return n(this.pluck("nextElementSibling")).filter(t||"*")},html:function(t){return 0===arguments.length?this.length>0?this[0].innerHTML:null:this.each(function(e){var i=this.innerHTML;n(this).empty().append(J(this,t,e,i))})},text:function(e){return 0===arguments.length?this.length>0?this[0].textContent:null:this.each(function(){this.textContent=e===t?"":""+e})},attr:function(n,i){var r;return"string"==typeof n&&i===t?0==this.length||1!==this[0].nodeType?t:"value"==n&&"INPUT"==this[0].nodeName?this.val():!(r=this[0].getAttribute(n))&&n in this[0]?this[0][n]:r:this.each(function(t){if(1===this.nodeType)if(D(n))for(e in n)X(this,e,n[e]);else X(this,n,J(this,i,t,this.getAttribute(n)))})},removeAttr:function(t){return this.each(function(){1===this.nodeType&&X(this,t)})},prop:function(e,n){return e=P[e]||e,n===t?this[0]&&this[0][e]:this.each(function(t){this[e]=J(this,n,t,this[e])})},data:function(e,n){var i=this.attr("data-"+e.replace(m,"-$1").toLowerCase(),n);return null!==i?Y(i):t},val:function(t){return 0===arguments.length?this[0]&&(this[0].multiple?n(this[0]).find("option").filter(function(){return this.selected}).pluck("value"):this[0].value):this.each(function(e){this.value=J(this,t,e,this.value)})},offset:function(t){if(t)return this.each(function(e){var i=n(this),r=J(this,t,e,i.offset()),o=i.offsetParent().offset(),s={top:r.top-o.top,left:r.left-o.left};"static"==i.css("position")&&(s.position="relative"),i.css(s)});if(0==this.length)return null;var e=this[0].getBoundingClientRect();return{left:e.left+window.pageXOffset,top:e.top+window.pageYOffset,width:Math.round(e.width),height:Math.round(e.height)}},css:function(t,i){if(arguments.length<2){var r=this[0],o=getComputedStyle(r,"");if(!r)return;if("string"==typeof t)return r.style[C(t)]||o.getPropertyValue(t);if(A(t)){var s={};return n.each(A(t)?t:[t],function(t,e){s[e]=r.style[C(e)]||o.getPropertyValue(e)}),s}}var a="";if("string"==L(t))i||0===i?a=F(t)+":"+H(t,i):this.each(function(){this.style.removeProperty(F(t))});else for(e in t)t[e]||0===t[e]?a+=F(e)+":"+H(e,t[e])+";":this.each(function(){this.style.removeProperty(F(e))});return this.each(function(){this.style.cssText+=";"+a})},index:function(t){return t?this.indexOf(n(t)[0]):this.parent().children().indexOf(this[0])},hasClass:function(t){return t?r.some.call(this,function(t){return this.test(W(t))},q(t)):!1},addClass:function(t){return t?this.each(function(e){i=[];var r=W(this),o=J(this,t,e,r);o.split(/\s+/g).forEach(function(t){n(this).hasClass(t)||i.push(t)},this),i.length&&W(this,r+(r?" ":"")+i.join(" "))}):this},removeClass:function(e){return this.each(function(n){return e===t?W(this,""):(i=W(this),J(this,e,n,i).split(/\s+/g).forEach(function(t){i=i.replace(q(t)," ")}),void W(this,i.trim()))})},toggleClass:function(e,i){return e?this.each(function(r){var o=n(this),s=J(this,e,r,W(this));s.split(/\s+/g).forEach(function(e){(i===t?!o.hasClass(e):i)?o.addClass(e):o.removeClass(e)})}):this},scrollTop:function(e){if(this.length){var n="scrollTop"in this[0];return e===t?n?this[0].scrollTop:this[0].pageYOffset:this.each(n?function(){this.scrollTop=e}:function(){this.scrollTo(this.scrollX,e)})}},scrollLeft:function(e){if(this.length){var n="scrollLeft"in this[0];return e===t?n?this[0].scrollLeft:this[0].pageXOffset:this.each(n?function(){this.scrollLeft=e}:function(){this.scrollTo(e,this.scrollY)})}},position:function(){if(this.length){var t=this[0],e=this.offsetParent(),i=this.offset(),r=d.test(e[0].nodeName)?{top:0,left:0}:e.offset();return i.top-=parseFloat(n(t).css("margin-top"))||0,i.left-=parseFloat(n(t).css("margin-left"))||0,r.top+=parseFloat(n(e[0]).css("border-top-width"))||0,r.left+=parseFloat(n(e[0]).css("border-left-width"))||0,{top:i.top-r.top,left:i.left-r.left}}},offsetParent:function(){return this.map(function(){for(var t=this.offsetParent||a.body;t&&!d.test(t.nodeName)&&"static"==n(t).css("position");)t=t.offsetParent;return t})}},n.fn.detach=n.fn.remove,["width","height"].forEach(function(e){var i=e.replace(/./,function(t){return t[0].toUpperCase()});n.fn[e]=function(r){var o,s=this[0];return r===t?$(s)?s["inner"+i]:_(s)?s.documentElement["scroll"+i]:(o=this.offset())&&o[e]:this.each(function(t){s=n(this),s.css(e,J(this,r,t,s[e]()))})}}),v.forEach(function(t,e){var i=e%2;n.fn[t]=function(){var t,o,r=n.map(arguments,function(e){return t=L(e),"object"==t||"array"==t||null==e?e:S.fragment(e)}),s=this.length>1;return r.length<1?this:this.each(function(t,a){o=i?a:a.parentNode,a=0==e?a.nextSibling:1==e?a.firstChild:2==e?a:null,r.forEach(function(t){if(s)t=t.cloneNode(!0);else if(!o)return n(t).remove();G(o.insertBefore(t,a),function(t){null==t.nodeName||"SCRIPT"!==t.nodeName.toUpperCase()||t.type&&"text/javascript"!==t.type||t.src||window.eval.call(window,t.innerHTML)})})})},n.fn[i?t+"To":"insert"+(e?"Before":"After")]=function(e){return n(e)[t](this),this}}),S.Z.prototype=n.fn,S.uniq=N,S.deserializeValue=Y,n.zepto=S,n}();window.Zepto=Zepto,void 0===window.$&&(window.$=Zepto),function(t){function l(t){return t._zid||(t._zid=e++)}function h(t,e,n,i){if(e=p(e),e.ns)var r=d(e.ns);return(s[l(t)]||[]).filter(function(t){return!(!t||e.e&&t.e!=e.e||e.ns&&!r.test(t.ns)||n&&l(t.fn)!==l(n)||i&&t.sel!=i)})}function p(t){var e=(""+t).split(".");return{e:e[0],ns:e.slice(1).sort().join(" ")}}function d(t){return new RegExp("(?:^| )"+t.replace(" "," .* ?")+"(?: |$)")}function m(t,e){return t.del&&!u&&t.e in f||!!e}function g(t){return c[t]||u&&f[t]||t}function v(e,i,r,o,a,u,f){var h=l(e),d=s[h]||(s[h]=[]);i.split(/\s/).forEach(function(i){if("ready"==i)return t(document).ready(r);var s=p(i);s.fn=r,s.sel=a,s.e in c&&(r=function(e){var n=e.relatedTarget;return!n||n!==this&&!t.contains(this,n)?s.fn.apply(this,arguments):void 0}),s.del=u;var l=u||r;s.proxy=function(t){if(t=j(t),!t.isImmediatePropagationStopped()){t.data=o;var i=l.apply(e,t._args==n?[t]:[t].concat(t._args));return i===!1&&(t.preventDefault(),t.stopPropagation()),i}},s.i=d.length,d.push(s),"addEventListener"in e&&e.addEventListener(g(s.e),s.proxy,m(s,f))})}function y(t,e,n,i,r){var o=l(t);(e||"").split(/\s/).forEach(function(e){h(t,e,n,i).forEach(function(e){delete s[o][e.i],"removeEventListener"in t&&t.removeEventListener(g(e.e),e.proxy,m(e,r))})})}function j(e,i){return(i||!e.isDefaultPrevented)&&(i||(i=e),t.each(E,function(t,n){var r=i[t];e[t]=function(){return this[n]=x,r&&r.apply(i,arguments)},e[n]=b}),(i.defaultPrevented!==n?i.defaultPrevented:"returnValue"in i?i.returnValue===!1:i.getPreventDefault&&i.getPreventDefault())&&(e.isDefaultPrevented=x)),e}function T(t){var e,i={originalEvent:t};for(e in t)w.test(e)||t[e]===n||(i[e]=t[e]);return j(i,t)}var n,e=1,i=Array.prototype.slice,r=t.isFunction,o=function(t){return"string"==typeof t},s={},a={},u="onfocusin"in window,f={focus:"focusin",blur:"focusout"},c={mouseenter:"mouseover",mouseleave:"mouseout"};a.click=a.mousedown=a.mouseup=a.mousemove="MouseEvents",t.event={add:v,remove:y},t.proxy=function(e,n){if(r(e)){var i=function(){return e.apply(n,arguments)};return i._zid=l(e),i}if(o(n))return t.proxy(e[n],e);throw new TypeError("expected function")},t.fn.bind=function(t,e,n){return this.on(t,e,n)},t.fn.unbind=function(t,e){return this.off(t,e)},t.fn.one=function(t,e,n,i){return this.on(t,e,n,i,1)};var x=function(){return!0},b=function(){return!1},w=/^([A-Z]|returnValue$|layer[XY]$)/,E={preventDefault:"isDefaultPrevented",stopImmediatePropagation:"isImmediatePropagationStopped",stopPropagation:"isPropagationStopped"};t.fn.delegate=function(t,e,n){return this.on(e,t,n)},t.fn.undelegate=function(t,e,n){return this.off(e,t,n)},t.fn.live=function(e,n){return t(document.body).delegate(this.selector,e,n),this},t.fn.die=function(e,n){return t(document.body).undelegate(this.selector,e,n),this},t.fn.on=function(e,s,a,u,f){var c,l,h=this;return e&&!o(e)?(t.each(e,function(t,e){h.on(t,s,a,e,f)}),h):(o(s)||r(u)||u===!1||(u=a,a=s,s=n),(r(a)||a===!1)&&(u=a,a=n),u===!1&&(u=b),h.each(function(n,r){f&&(c=function(t){return y(r,t.type,u),u.apply(this,arguments)}),s&&(l=function(e){var n,o=t(e.target).closest(s,r).get(0);return o&&o!==r?(n=t.extend(T(e),{currentTarget:o,liveFired:r}),(c||u).apply(o,[n].concat(i.call(arguments,1)))):void 0}),v(r,e,u,a,s,l||c)}))},t.fn.off=function(e,i,s){var a=this;return e&&!o(e)?(t.each(e,function(t,e){a.off(t,i,e)}),a):(o(i)||r(s)||s===!1||(s=i,i=n),s===!1&&(s=b),a.each(function(){y(this,e,s,i)}))},t.fn.trigger=function(e,n){return e=o(e)||t.isPlainObject(e)?t.Event(e):j(e),e._args=n,this.each(function(){"dispatchEvent"in this?this.dispatchEvent(e):t(this).triggerHandler(e,n)})},t.fn.triggerHandler=function(e,n){var i,r;return this.each(function(s,a){i=T(o(e)?t.Event(e):e),i._args=n,i.target=a,t.each(h(a,e.type||e),function(t,e){return r=e.proxy(i),i.isImmediatePropagationStopped()?!1:void 0})}),r},"focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select keydown keypress keyup error".split(" ").forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.trigger(e)}}),["focus","blur"].forEach(function(e){t.fn[e]=function(t){return t?this.bind(e,t):this.each(function(){try{this[e]()}catch(t){}}),this}}),t.Event=function(t,e){o(t)||(e=t,t=e.type);var n=document.createEvent(a[t]||"Events"),i=!0;if(e)for(var r in e)"bubbles"==r?i=!!e[r]:n[r]=e[r];return n.initEvent(t,i,!0),j(n)}}(Zepto),function(t){function l(e,n,i){var r=t.Event(n);return t(e).trigger(r,i),!r.isDefaultPrevented()}function h(t,e,i,r){return t.global?l(e||n,i,r):void 0}function p(e){e.global&&0===t.active++&&h(e,null,"ajaxStart")}function d(e){e.global&&!--t.active&&h(e,null,"ajaxStop")}function m(t,e){var n=e.context;return e.beforeSend.call(n,t,e)===!1||h(e,n,"ajaxBeforeSend",[t,e])===!1?!1:void h(e,n,"ajaxSend",[t,e])}function g(t,e,n,i){var r=n.context,o="success";n.success.call(r,t,o,e),i&&i.resolveWith(r,[t,o,e]),h(n,r,"ajaxSuccess",[e,n,t]),y(o,e,n)}function v(t,e,n,i,r){var o=i.context;i.error.call(o,n,e,t),r&&r.rejectWith(o,[n,e,t]),h(i,o,"ajaxError",[n,i,t||e]),y(e,n,i)}function y(t,e,n){var i=n.context;n.complete.call(i,e,t),h(n,i,"ajaxComplete",[e,n]),d(n)}function x(){}function b(t){return t&&(t=t.split(";",2)[0]),t&&(t==f?"html":t==u?"json":s.test(t)?"script":a.test(t)&&"xml")||"text"}function w(t,e){return""==e?t:(t+"&"+e).replace(/[&?]{1,2}/,"?")}function E(e){e.processData&&e.data&&"string"!=t.type(e.data)&&(e.data=t.param(e.data,e.traditional)),!e.data||e.type&&"GET"!=e.type.toUpperCase()||(e.url=w(e.url,e.data),e.data=void 0)}function j(e,n,i,r){return t.isFunction(n)&&(r=i,i=n,n=void 0),t.isFunction(i)||(r=i,i=void 0),{url:e,data:n,success:i,dataType:r}}function S(e,n,i,r){var o,s=t.isArray(n),a=t.isPlainObject(n);t.each(n,function(n,u){o=t.type(u),r&&(n=i?r:r+"["+(a||"object"==o||"array"==o?n:"")+"]"),!r&&s?e.add(u.name,u.value):"array"==o||!i&&"object"==o?S(e,u,i,n):e.add(n,u)})}var i,r,e=0,n=window.document,o=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,s=/^(?:text|application)\/javascript/i,a=/^(?:text|application)\/xml/i,u="application/json",f="text/html",c=/^\s*$/;t.active=0,t.ajaxJSONP=function(i,r){if(!("type"in i))return t.ajax(i);var f,h,o=i.jsonpCallback,s=(t.isFunction(o)?o():o)||"jsonp"+ ++e,a=n.createElement("script"),u=window[s],c=function(e){t(a).triggerHandler("error",e||"abort")},l={abort:c};return r&&r.promise(l),t(a).on("load error",function(e,n){clearTimeout(h),t(a).off().remove(),"error"!=e.type&&f?g(f[0],l,i,r):v(null,n||"error",l,i,r),window[s]=u,f&&t.isFunction(u)&&u(f[0]),u=f=void 0}),m(l,i)===!1?(c("abort"),l):(window[s]=function(){f=arguments},a.src=i.url.replace(/\?(.+)=\?/,"?$1="+s),n.head.appendChild(a),i.timeout>0&&(h=setTimeout(function(){c("timeout")},i.timeout)),l)},t.ajaxSettings={type:"GET",beforeSend:x,success:x,error:x,complete:x,context:null,global:!0,xhr:function(){return new window.XMLHttpRequest},accepts:{script:"text/javascript, application/javascript, application/x-javascript",json:u,xml:"application/xml, text/xml",html:f,text:"text/plain"},crossDomain:!1,timeout:0,processData:!0,cache:!0},t.ajax=function(e){var n=t.extend({},e||{}),o=t.Deferred&&t.Deferred();for(i in t.ajaxSettings)void 0===n[i]&&(n[i]=t.ajaxSettings[i]);p(n),n.crossDomain||(n.crossDomain=/^([\w-]+:)?\/\/([^\/]+)/.test(n.url)&&RegExp.$2!=window.location.host),n.url||(n.url=window.location.toString()),E(n),n.cache===!1&&(n.url=w(n.url,"_="+Date.now()));var s=n.dataType,a=/\?.+=\?/.test(n.url);if("jsonp"==s||a)return a||(n.url=w(n.url,n.jsonp?n.jsonp+"=?":n.jsonp===!1?"":"callback=?")),t.ajaxJSONP(n,o);var j,u=n.accepts[s],f={},l=function(t,e){f[t.toLowerCase()]=[t,e]},h=/^([\w-]+:)\/\//.test(n.url)?RegExp.$1:window.location.protocol,d=n.xhr(),y=d.setRequestHeader;if(o&&o.promise(d),n.crossDomain||l("X-Requested-With","XMLHttpRequest"),l("Accept",u||"*/*"),(u=n.mimeType||u)&&(u.indexOf(",")>-1&&(u=u.split(",",2)[0]),d.overrideMimeType&&d.overrideMimeType(u)),(n.contentType||n.contentType!==!1&&n.data&&"GET"!=n.type.toUpperCase())&&l("Content-Type",n.contentType||"application/x-www-form-urlencoded"),n.headers)for(r in n.headers)l(r,n.headers[r]);if(d.setRequestHeader=l,d.onreadystatechange=function(){if(4==d.readyState){d.onreadystatechange=x,clearTimeout(j);var e,i=!1;if(d.status>=200&&d.status<300||304==d.status||0==d.status&&"file:"==h){s=s||b(n.mimeType||d.getResponseHeader("content-type")),e=d.responseText;try{"script"==s?(1,eval)(e):"xml"==s?e=d.responseXML:"json"==s&&(e=c.test(e)?null:t.parseJSON(e))}catch(r){i=r}i?v(i,"parsererror",d,n,o):g(e,d,n,o)}else v(d.statusText||null,d.status?"error":"abort",d,n,o)}},m(d,n)===!1)return d.abort(),v(null,"abort",d,n,o),d;if(n.xhrFields)for(r in n.xhrFields)d[r]=n.xhrFields[r];var T="async"in n?n.async:!0;d.open(n.type,n.url,T,n.username,n.password);for(r in f)y.apply(d,f[r]);return n.timeout>0&&(j=setTimeout(function(){d.onreadystatechange=x,d.abort(),v(null,"timeout",d,n,o)},n.timeout)),d.send(n.data?n.data:null),d},t.get=function(){return t.ajax(j.apply(null,arguments))},t.post=function(){var e=j.apply(null,arguments);return e.type="POST",t.ajax(e)},t.getJSON=function(){var e=j.apply(null,arguments);return e.dataType="json",t.ajax(e)},t.fn.load=function(e,n,i){if(!this.length)return this;var a,r=this,s=e.split(/\s/),u=j(e,n,i),f=u.success;return s.length>1&&(u.url=s[0],a=s[1]),u.success=function(e){r.html(a?t("<div>").html(e.replace(o,"")).find(a):e),f&&f.apply(r,arguments)},t.ajax(u),this};var T=encodeURIComponent;t.param=function(t,e){var n=[];return n.add=function(t,e){this.push(T(t)+"="+T(e))},S(n,t,e),n.join("&").replace(/%20/g,"+")}}(Zepto),function(t){t.fn.serializeArray=function(){var n,e=[];return t([].slice.call(this.get(0).elements)).each(function(){n=t(this);var i=n.attr("type");"fieldset"!=this.nodeName.toLowerCase()&&!this.disabled&&"submit"!=i&&"reset"!=i&&"button"!=i&&("radio"!=i&&"checkbox"!=i||this.checked)&&e.push({name:n.attr("name"),value:n.val()})}),e},t.fn.serialize=function(){var t=[];return this.serializeArray().forEach(function(e){t.push(encodeURIComponent(e.name)+"="+encodeURIComponent(e.value))}),t.join("&")},t.fn.submit=function(e){if(e)this.bind("submit",e);else if(this.length){var n=t.Event("submit");this.eq(0).trigger(n),n.isDefaultPrevented()||this.get(0).submit()}return this}}(Zepto),function(t){"__proto__"in{}||t.extend(t.zepto,{Z:function(e,n){return e=e||[],t.extend(e,t.fn),e.selector=n||"",e.__Z=!0,e},isZ:function(e){return"array"===t.type(e)&&"__Z"in e}});try{getComputedStyle(void 0)}catch(e){var n=getComputedStyle;window.getComputedStyle=function(t){try{return n(t)}catch(e){return null}}}}(Zepto);
  3 +/* |xGv00|76e366be624ab0accdb9172bccdb3102 */
  1 +<include file="public@header"/>
  2 +<style type="text/css">
  3 + .pic-list li {
  4 + margin-bottom: 5px;
  5 + }
  6 +</style>
  7 +</head>
  8 +<body>
  9 +<div class="wrap js-check-wrap">
  10 + <ul class="nav nav-tabs">
  11 + <li><a href="{:url('Brand/index')}">品牌中介列表</a></li>
  12 + <li class="active"><a href="{:url('Brand/add')}">添加品牌中介</a></li>
  13 + </ul>
  14 + <form action="{:url('Brand/add')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
  15 + <div class="row">
  16 + <div class="col-md-9">
  17 + <table class="table table-bordered">
  18 + <input class="form-control" type="hidden" name="id"
  19 + value="{$list['id']}"/>
  20 + <tr>
  21 + <th width="15%">品牌企业名</th>
  22 + <td><input class="form-control" type="text" name="name"
  23 + value="{$list['name']}" placeholder="请输入品牌企业名"/>
  24 +
  25 + </td>
  26 + </tr>
  27 + <tr>
  28 + <th width="10%">排序</th>
  29 + <td><input class="form-control" type="text" name="score"
  30 + value="{$list['score']}" placeholder="请输入排序,数字越大越靠前"/>
  31 +
  32 + </td>
  33 + </tr>
  34 + <!--<tr>-->
  35 + <!--<th>排序</th>-->
  36 + <!--<td>-->
  37 + <!--<input class="form-control" type="text" name="score"-->
  38 + <!--value="{$list['score']}" placeholder="请输入排序,数字越大越靠前"/>-->
  39 + <!--</td>-->
  40 + <!--</tr>-->
  41 +
  42 +
  43 + </table>
  44 + <div class="form-group">
  45 + <div class="col-sm-offset-2 col-sm-10">
  46 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
  47 + <a class="btn btn-default" href="{:url('Brand/index')}">{:lang('BACK')}</a>
  48 + </div>
  49 + </div>
  50 + </div>
  51 + </div>
  52 + </form>
  53 +</div>
  54 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  55 +<script type="text/javascript">
  56 + //编辑器路径定义
  57 + var editorURL = GV.WEB_ROOT;
  58 +</script>
  59 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  60 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  61 +<script type="text/javascript">
  62 + $(function () {
  63 +
  64 + editorcontent = new baidu.editor.ui.Editor();
  65 + editorcontent.render('content');
  66 + try {
  67 + editorcontent.sync();
  68 + } catch (err) {
  69 + }
  70 +
  71 + $('.btn-cancel-thumbnail').click(function () {
  72 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  73 + $('#thumbnail').val('');
  74 + });
  75 +
  76 + });
  77 +
  78 + // function doSelectCategory() {
  79 + // var selectedCategoriesId = $('#js-categories-id-input').val();
  80 + // openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', {
  81 + // area: ['700px', '400px'],
  82 + // btn: ['确定', '取消'],
  83 + // yes: function (index, layero) {
  84 + // //do something
  85 + //
  86 + // var iframeWin = window[layero.find('iframe')[0]['name']];
  87 + // var selectedCategories = iframeWin.confirm();
  88 + // if (selectedCategories.selectedCategoriesId.length == 0) {
  89 + // layer.msg('请选择分类');
  90 + // return;
  91 + // }
  92 + // $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
  93 + // $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
  94 + // //console.log(layer.getFrameIndex(index));
  95 + // layer.close(index); //如果设定了yes回调,需进行手工关闭
  96 + // }
  97 + // });
  98 + // }
  99 +</script>
  100 +</body>
  101 +</html>
  1 +<include file="public@header"/>
  2 +</head>
  3 +<body>
  4 +<div class="wrap js-check-wrap">
  5 + <ul class="nav nav-tabs">
  6 + <li class="active"><a href="javascript:;">品牌中介列表</a></li>
  7 + <li><a href="{:url('Brand/add')}">添加品牌中介</a></li>
  8 + </ul>
  9 + <form class="well form-inline margin-top-20" method="post" action="{:url('Brand/index')}">
  10 + <!--分类:-->
  11 + <!--<select class="form-control" name="category" style="width: 140px;">-->
  12 + <!--<option value='0'>全部</option>-->
  13 + <!--{$category_tree|default=''}-->
  14 + <!--</select> &nbsp;&nbsp;-->
  15 + 时间:
  16 + <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
  17 + value="{$start_time|default=''}"
  18 + style="width: 140px;" autocomplete="off">-
  19 + <input type="text" class="form-control js-bootstrap-datetime" name="end_time"
  20 + value="{$end_time|default=''}"
  21 + style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
  22 + 关键字:
  23 + <input type="text" class="form-control" name="keyword" style="width: 200px;"
  24 + value="{$keyword|default=''}" placeholder="请输入品牌中介名称">
  25 + <input type="submit" class="btn btn-primary" value="搜索"/>
  26 + <a class="btn btn-danger" href="{:url('Brand/index')}">清空</a>
  27 + </form>
  28 + <form class="js-ajax-form" action="" method="post">
  29 + <div class="table-actions">
  30 + <!--<notempty name="category">-->
  31 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  32 + <!--data-action="{:url('AdminArticle/listOrder')}">{:lang('SORT')}-->
  33 + <!--</button>-->
  34 + <!--</notempty>-->
  35 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  36 + <!--data-action="{:url('AdminArticle/publish',array('yes'=>1))}" data-subcheck="true">发布-->
  37 + <!--</button>-->
  38 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  39 + <!--data-action="{:url('AdminArticle/publish',array('no'=>1))}" data-subcheck="true">取消发布-->
  40 + <!--</button>-->
  41 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  42 + <!--data-action="{:url('AdminArticle/top',array('yes'=>1))}" data-subcheck="true">置顶-->
  43 + <!--</button>-->
  44 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  45 + <!--data-action="{:url('AdminArticle/top',array('no'=>1))}" data-subcheck="true">取消置顶-->
  46 + <!--</button>-->
  47 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  48 + <!--data-action="{:url('AdminArticle/recommend',array('yes'=>1))}" data-subcheck="true">推荐-->
  49 + <!--</button>-->
  50 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  51 + <!--data-action="{:url('AdminArticle/recommend',array('no'=>1))}" data-subcheck="true">取消推荐-->
  52 + <!--</button>-->
  53 + <!--
  54 + <notempty name="category">
  55 + <button class="btn btn-primary btn-sm js-articles-move" type="button">批量移动</button>
  56 + </notempty>
  57 + <button class="btn btn-primary btn-sm js-articles-copy" type="button">批量复制</button>
  58 + -->
  59 + <button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
  60 + data-action="{:url('Brand/del')}" data-subcheck="true" data-msg="您确定删除吗?">
  61 + {:lang('DELETE')}
  62 + </button>
  63 + </div>
  64 + <table class="table table-hover table-bordered table-list">
  65 + <thead>
  66 + <tr>
  67 + <th width="15">
  68 + <label>
  69 + <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
  70 + </label>
  71 + </th>
  72 + <notempty name="category">
  73 + <th width="50">{:lang('SORT')}</th>
  74 + </notempty>
  75 + <th width="50">ID</th>
  76 + <th>品牌中介名</th>
  77 + <th>排序</th>
  78 + <!--<th>排序</th>-->
  79 + <th width="130">更新时间</th>
  80 + <th width="130">发布时间</th>
  81 + <!--<th width="70">状态</th>-->
  82 + <th width="90">操作</th>
  83 + </tr>
  84 + </thead>
  85 + <foreach name="list" item="list">
  86 + <tr>
  87 + <td>
  88 + <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
  89 + value="{$list.id}" title="ID:{$list.id}">
  90 + </td>
  91 +
  92 + <td>{$list.id}</td>
  93 + <td>
  94 + {$list.name}
  95 + </td>
  96 + <td>
  97 + {$list.score}
  98 + </td>
  99 + <td>
  100 + {:date('Y-m-d H:i',$list['update_time'])}
  101 + </td>
  102 + <td>
  103 + {:date('Y-m-d H:i',$list['create_time'])}
  104 + <!--<empty name="vo.published_time">-->
  105 + <!--未发布-->
  106 + <!--<else/>-->
  107 + <!--{:date('Y-m-d H:i',$list['published_time'])}-->
  108 + <!--</empty>-->
  109 +
  110 + </td>
  111 +
  112 + <td>
  113 + <a href="{:url('Brand/add',array('id'=>$list['id']))}">{:lang('EDIT')}</a>
  114 + <a href="{:url('Brand/del',array('id'=>$list['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
  115 + </td>
  116 + </tr>
  117 + </foreach>
  118 +
  119 + </table>
  120 +
  121 + <ul class="pagination">{$page|default=''}</ul>
  122 + </form>
  123 +</div>
  124 +<script src="__STATIC__/js/admin.js"></script>
  125 +<script>
  126 +
  127 + function reloadPage(win) {
  128 + win.location.reload();
  129 + }
  130 +
  131 + $(function () {
  132 + setCookie("refersh_time", 0);
  133 + Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
  134 + //批量复制
  135 + $('.js-articles-copy').click(function (e) {
  136 + var ids = [];
  137 + $("input[name='ids[]']").each(function () {
  138 + if ($(this).is(':checked')) {
  139 + ids.push($(this).val());
  140 + }
  141 + });
  142 +
  143 + if (ids.length == 0) {
  144 + art.dialog.through({
  145 + id: 'error',
  146 + icon: 'error',
  147 + content: '您没有勾选信息,无法进行操作!',
  148 + cancelVal: '关闭',
  149 + cancel: true
  150 + });
  151 + return false;
  152 + }
  153 +
  154 + ids = ids.join(',');
  155 + art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
  156 + title: "批量复制",
  157 + width: "300px"
  158 + });
  159 + });
  160 + //批量移动
  161 + $('.js-articles-move').click(function (e) {
  162 + var ids = [];
  163 + $("input[name='ids[]']").each(function () {
  164 + if ($(this).is(':checked')) {
  165 + ids.push($(this).val());
  166 + }
  167 + });
  168 +
  169 + if (ids.length == 0) {
  170 + art.dialog.through({
  171 + id: 'error',
  172 + icon: 'error',
  173 + content: '您没有勾选信息,无法进行操作!',
  174 + cancelVal: '关闭',
  175 + cancel: true
  176 + });
  177 + return false;
  178 + }
  179 +
  180 + ids = ids.join(',');
  181 + art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
  182 + title: "批量移动",
  183 + width: "300px"
  184 + });
  185 + });
  186 + });
  187 + });
  188 +</script>
  189 +</body>
  190 +</html>
@@ -20,11 +20,10 @@ @@ -20,11 +20,10 @@
20 <tr> 20 <tr>
21 <th width="20%">城市</th> 21 <th width="20%">城市</th>
22 <td> 22 <td>
23 - <select name="city" style="border: 1px solid #dce4ec; width: 15%;">  
24 - <volist name="area" id="area">  
25 - <option name="area" value="{$area.area_id}" <eq name="list.city" value="$area.area_id">selected</eq>>{$area.area_name}</option>  
26 - </volist>  
27 - </select> 23 + <volist name="area" id="area">
  24 + <input type="checkbox" name="city[]" value="{$area.area_id}" <eq name="list.city" value="$area.area_id">checked</eq>> {$area.area_name}
  25 + </volist>
  26 +
28 </td> 27 </td>
29 </tr> 28 </tr>
30 <tr> 29 <tr>
@@ -91,7 +91,9 @@ @@ -91,7 +91,9 @@
91 </td> 91 </td>
92 92
93 <td>{$list.id}</td> 93 <td>{$list.id}</td>
94 - <td>{$list.area_name}</td> 94 + <td>
  95 + {$list.area_name}
  96 + </td>
95 <td> 97 <td>
96 {$list.low_area} 98 {$list.low_area}
97 </td> 99 </td>
  1 +<include file="public@header"/>
  2 +<style type="text/css">
  3 + .pic-list li {
  4 + margin-bottom: 5px;
  5 + }
  6 +</style>
  7 +</head>
  8 +<body>
  9 +<div class="wrap js-check-wrap">
  10 + <ul class="nav nav-tabs">
  11 + <li><a href="{:url('UserNeed/index')}">保证金说明列表</a></li>
  12 + <li class="active"><a href="{:url('UserNeed/add')}">添加保证金说明</a></li>
  13 + </ul>
  14 + <form action="{:url('UserNeed/add')}" method="post" class="form-horizontal js-ajax-form margin-top-20">
  15 + <div class="row">
  16 + <div class="col-md-9">
  17 + <table class="table table-bordered">
  18 + <input class="form-control" type="hidden" name="id"
  19 + value="{$list['id']}"/>
  20 + <tr>
  21 + <th>标题<span class="form-required">*</span></th>
  22 + <td>
  23 + <input class="form-control" type="text" name="title"
  24 + id="title" value="{$list['title']}" placeholder="请输入标题"/>
  25 + </td>
  26 + </tr>
  27 + <tr>
  28 + <th width="10%">内容<span class="form-required">*</span></th>
  29 + <td>
  30 + <script type="text/plain" id="content" name="content">{$list['content']}</script>
  31 + </td>
  32 + </tr>
  33 + <tr>
  34 + <th>排序</th>
  35 + <td>
  36 + <input class="form-control" type="text" name="score"
  37 + value="{$list['score']}" placeholder="请输入排序,数字越大越靠前"/>
  38 + </td>
  39 + </tr>
  40 +
  41 +
  42 + </table>
  43 + <div class="form-group">
  44 + <div class="col-sm-offset-2 col-sm-10">
  45 + <button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
  46 + <a class="btn btn-default" href="{:url('UserNeed/index')}">{:lang('BACK')}</a>
  47 + </div>
  48 + </div>
  49 + </div>
  50 + </div>
  51 + </form>
  52 +</div>
  53 +<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
  54 +<script type="text/javascript">
  55 + //编辑器路径定义
  56 + var editorURL = GV.WEB_ROOT;
  57 +</script>
  58 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.config.js"></script>
  59 +<script type="text/javascript" src="__STATIC__/js/ueditor/ueditor.all.min.js"></script>
  60 +<script type="text/javascript">
  61 + $(function () {
  62 +
  63 + editorcontent = new baidu.editor.ui.Editor();
  64 + editorcontent.render('content');
  65 + try {
  66 + editorcontent.sync();
  67 + } catch (err) {
  68 + }
  69 +
  70 + $('.btn-cancel-thumbnail').click(function () {
  71 + $('#thumbnail-preview').attr('src', '__TMPL__/public/assets/images/default-thumbnail.png');
  72 + $('#thumbnail').val('');
  73 + });
  74 +
  75 + });
  76 +
  77 + // function doSelectCategory() {
  78 + // var selectedCategoriesId = $('#js-categories-id-input').val();
  79 + // openIframeLayer("{:url('AdminCategory/select')}?ids=" + selectedCategoriesId, '请选择分类', {
  80 + // area: ['700px', '400px'],
  81 + // btn: ['确定', '取消'],
  82 + // yes: function (index, layero) {
  83 + // //do something
  84 + //
  85 + // var iframeWin = window[layero.find('iframe')[0]['name']];
  86 + // var selectedCategories = iframeWin.confirm();
  87 + // if (selectedCategories.selectedCategoriesId.length == 0) {
  88 + // layer.msg('请选择分类');
  89 + // return;
  90 + // }
  91 + // $('#js-categories-id-input').val(selectedCategories.selectedCategoriesId.join(','));
  92 + // $('#js-categories-name-input').val(selectedCategories.selectedCategoriesName.join(' '));
  93 + // //console.log(layer.getFrameIndex(index));
  94 + // layer.close(index); //如果设定了yes回调,需进行手工关闭
  95 + // }
  96 + // });
  97 + // }
  98 +</script>
  99 +</body>
  100 +</html>
  1 +<include file="public@header"/>
  2 +</head>
  3 +<body>
  4 +<div class="wrap js-check-wrap">
  5 + <ul class="nav nav-tabs">
  6 + <li class="active"><a href="javascript:;">保证金说明列表</a></li>
  7 + <li><a href="{:url('UserNeed/add')}">添加保证金说明</a></li>
  8 + </ul>
  9 + <form class="well form-inline margin-top-20" method="post" action="{:url('UserNeed/index')}">
  10 + <!--分类:-->
  11 + <!--<select class="form-control" name="category" style="width: 140px;">-->
  12 + <!--<option value='0'>全部</option>-->
  13 + <!--{$category_tree|default=''}-->
  14 + <!--</select> &nbsp;&nbsp;-->
  15 + 时间:
  16 + <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
  17 + value="{$start_time|default=''}"
  18 + style="width: 140px;" autocomplete="off">-
  19 + <input type="text" class="form-control js-bootstrap-datetime" name="end_time"
  20 + value="{$end_time|default=''}"
  21 + style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
  22 + 关键字:
  23 + <input type="text" class="form-control" name="keyword" style="width: 200px;"
  24 + value="{$keyword|default=''}" placeholder="请输入说明标题">
  25 + <input type="submit" class="btn btn-primary" value="搜索"/>
  26 + <a class="btn btn-danger" href="{:url('UserNeed/index')}">清空</a>
  27 + </form>
  28 + <form class="js-ajax-form" action="" method="post">
  29 + <div class="table-actions">
  30 + <!--<notempty name="category">-->
  31 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  32 + <!--data-action="{:url('AdminArticle/listOrder')}">{:lang('SORT')}-->
  33 + <!--</button>-->
  34 + <!--</notempty>-->
  35 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  36 + <!--data-action="{:url('AdminArticle/publish',array('yes'=>1))}" data-subcheck="true">发布-->
  37 + <!--</button>-->
  38 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  39 + <!--data-action="{:url('AdminArticle/publish',array('no'=>1))}" data-subcheck="true">取消发布-->
  40 + <!--</button>-->
  41 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  42 + <!--data-action="{:url('AdminArticle/top',array('yes'=>1))}" data-subcheck="true">置顶-->
  43 + <!--</button>-->
  44 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  45 + <!--data-action="{:url('AdminArticle/top',array('no'=>1))}" data-subcheck="true">取消置顶-->
  46 + <!--</button>-->
  47 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  48 + <!--data-action="{:url('AdminArticle/recommend',array('yes'=>1))}" data-subcheck="true">推荐-->
  49 + <!--</button>-->
  50 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  51 + <!--data-action="{:url('AdminArticle/recommend',array('no'=>1))}" data-subcheck="true">取消推荐-->
  52 + <!--</button>-->
  53 + <!--
  54 + <notempty name="category">
  55 + <button class="btn btn-primary btn-sm js-articles-move" type="button">批量移动</button>
  56 + </notempty>
  57 + <button class="btn btn-primary btn-sm js-articles-copy" type="button">批量复制</button>
  58 + -->
  59 + <button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
  60 + data-action="{:url('UserNeed/del')}" data-subcheck="true" data-msg="您确定删除吗?">
  61 + {:lang('DELETE')}
  62 + </button>
  63 + </div>
  64 + <table class="table table-hover table-bordered table-list">
  65 + <thead>
  66 + <tr>
  67 + <th width="15">
  68 + <label>
  69 + <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
  70 + </label>
  71 + </th>
  72 + <notempty name="category">
  73 + <th width="50">{:lang('SORT')}</th>
  74 + </notempty>
  75 + <th width="50">ID</th>
  76 + <th width="10%">标题</th>
  77 + <th>内容</th>
  78 + <th>排序</th>
  79 + <th width="130">更新时间</th>
  80 + <th width="130">发布时间</th>
  81 + <!--<th width="70">状态</th>-->
  82 + <th width="90">操作</th>
  83 + </tr>
  84 + </thead>
  85 + <foreach name="list" item="list">
  86 + <tr>
  87 + <td>
  88 + <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
  89 + value="{$list.id}" title="ID:{$list.id}">
  90 + </td>
  91 +
  92 + <td>{$list.id}</td>
  93 + <td>
  94 + {$list.title}
  95 + </td>
  96 + <td>
  97 + {$list.content}
  98 + </td>
  99 + <td>
  100 + {$list.score}
  101 + </td>
  102 + <td>
  103 + {:date('Y-m-d H:i',$list['update_time'])}
  104 + </td>
  105 + <td>
  106 + {:date('Y-m-d H:i',$list['create_time'])}
  107 + <!--<empty name="vo.published_time">-->
  108 + <!--未发布-->
  109 + <!--<else/>-->
  110 + <!--{:date('Y-m-d H:i',$list['published_time'])}-->
  111 + <!--</empty>-->
  112 +
  113 + </td>
  114 +
  115 + <td>
  116 + <a href="{:url('UserNeed/add',array('id'=>$list['id']))}">{:lang('EDIT')}</a>
  117 + <a href="{:url('UserNeed/del',array('id'=>$list['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
  118 + </td>
  119 + </tr>
  120 + </foreach>
  121 +
  122 + </table>
  123 +
  124 + <ul class="pagination">{$page|default=''}</ul>
  125 + </form>
  126 +</div>
  127 +<script src="__STATIC__/js/admin.js"></script>
  128 +<script>
  129 +
  130 + function reloadPage(win) {
  131 + win.location.reload();
  132 + }
  133 +
  134 + $(function () {
  135 + setCookie("refersh_time", 0);
  136 + Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
  137 + //批量复制
  138 + $('.js-articles-copy').click(function (e) {
  139 + var ids = [];
  140 + $("input[name='ids[]']").each(function () {
  141 + if ($(this).is(':checked')) {
  142 + ids.push($(this).val());
  143 + }
  144 + });
  145 +
  146 + if (ids.length == 0) {
  147 + art.dialog.through({
  148 + id: 'error',
  149 + icon: 'error',
  150 + content: '您没有勾选信息,无法进行操作!',
  151 + cancelVal: '关闭',
  152 + cancel: true
  153 + });
  154 + return false;
  155 + }
  156 +
  157 + ids = ids.join(',');
  158 + art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
  159 + title: "批量复制",
  160 + width: "300px"
  161 + });
  162 + });
  163 + //批量移动
  164 + $('.js-articles-move').click(function (e) {
  165 + var ids = [];
  166 + $("input[name='ids[]']").each(function () {
  167 + if ($(this).is(':checked')) {
  168 + ids.push($(this).val());
  169 + }
  170 + });
  171 +
  172 + if (ids.length == 0) {
  173 + art.dialog.through({
  174 + id: 'error',
  175 + icon: 'error',
  176 + content: '您没有勾选信息,无法进行操作!',
  177 + cancelVal: '关闭',
  178 + cancel: true
  179 + });
  180 + return false;
  181 + }
  182 +
  183 + ids = ids.join(',');
  184 + art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
  185 + title: "批量移动",
  186 + width: "300px"
  187 + });
  188 + });
  189 + });
  190 + });
  191 +</script>
  192 +</body>
  193 +</html>
  1 +<include file="public@header"/>
  2 +</head>
  3 +<body>
  4 +<div class="wrap js-check-wrap">
  5 + <ul class="nav nav-tabs">
  6 + <li class="active"><a href="javascript:;">保证金说明列表</a></li>
  7 + <li><a href="{:url('UserNeed/add')}">添加保证金说明</a></li>
  8 + </ul>
  9 + <form class="well form-inline margin-top-20" method="post" action="{:url('UserNeed/index')}">
  10 + <!--分类:-->
  11 + <!--<select class="form-control" name="category" style="width: 140px;">-->
  12 + <!--<option value='0'>全部</option>-->
  13 + <!--{$category_tree|default=''}-->
  14 + <!--</select> &nbsp;&nbsp;-->
  15 + 时间:
  16 + <input type="text" class="form-control js-bootstrap-datetime" name="start_time"
  17 + value="{$start_time|default=''}"
  18 + style="width: 140px;" autocomplete="off">-
  19 + <input type="text" class="form-control js-bootstrap-datetime" name="end_time"
  20 + value="{$end_time|default=''}"
  21 + style="width: 140px;" autocomplete="off"> &nbsp; &nbsp;
  22 + 关键字:
  23 + <input type="text" class="form-control" name="keyword" style="width: 200px;"
  24 + value="{$keyword|default=''}" placeholder="请输入说明标题">
  25 + <input type="submit" class="btn btn-primary" value="搜索"/>
  26 + <a class="btn btn-danger" href="{:url('UserNeed/index')}">清空</a>
  27 + </form>
  28 + <form class="js-ajax-form" action="" method="post">
  29 + <div class="table-actions">
  30 + <!--<notempty name="category">-->
  31 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  32 + <!--data-action="{:url('AdminArticle/listOrder')}">{:lang('SORT')}-->
  33 + <!--</button>-->
  34 + <!--</notempty>-->
  35 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  36 + <!--data-action="{:url('AdminArticle/publish',array('yes'=>1))}" data-subcheck="true">发布-->
  37 + <!--</button>-->
  38 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  39 + <!--data-action="{:url('AdminArticle/publish',array('no'=>1))}" data-subcheck="true">取消发布-->
  40 + <!--</button>-->
  41 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  42 + <!--data-action="{:url('AdminArticle/top',array('yes'=>1))}" data-subcheck="true">置顶-->
  43 + <!--</button>-->
  44 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  45 + <!--data-action="{:url('AdminArticle/top',array('no'=>1))}" data-subcheck="true">取消置顶-->
  46 + <!--</button>-->
  47 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  48 + <!--data-action="{:url('AdminArticle/recommend',array('yes'=>1))}" data-subcheck="true">推荐-->
  49 + <!--</button>-->
  50 + <!--<button class="btn btn-primary btn-sm js-ajax-submit" type="submit"-->
  51 + <!--data-action="{:url('AdminArticle/recommend',array('no'=>1))}" data-subcheck="true">取消推荐-->
  52 + <!--</button>-->
  53 + <!--
  54 + <notempty name="category">
  55 + <button class="btn btn-primary btn-sm js-articles-move" type="button">批量移动</button>
  56 + </notempty>
  57 + <button class="btn btn-primary btn-sm js-articles-copy" type="button">批量复制</button>
  58 + -->
  59 + <button class="btn btn-danger btn-sm js-ajax-submit" type="submit"
  60 + data-action="{:url('UserNeed/del')}" data-subcheck="true" data-msg="您确定删除吗?">
  61 + {:lang('DELETE')}
  62 + </button>
  63 + </div>
  64 + <table class="table table-hover table-bordered table-list">
  65 + <thead>
  66 + <tr>
  67 + <th width="15">
  68 + <label>
  69 + <input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x">
  70 + </label>
  71 + </th>
  72 + <notempty name="category">
  73 + <th width="50">{:lang('SORT')}</th>
  74 + </notempty>
  75 + <th width="50">ID</th>
  76 + <th width="10%">标题</th>
  77 + <th>内容</th>
  78 + <th>排序</th>
  79 + <th width="130">更新时间</th>
  80 + <th width="130">发布时间</th>
  81 + <!--<th width="70">状态</th>-->
  82 + <th width="90">操作</th>
  83 + </tr>
  84 + </thead>
  85 + <foreach name="list" item="list">
  86 + <tr>
  87 + <td>
  88 + <input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]"
  89 + value="{$list.id}" title="ID:{$list.id}">
  90 + </td>
  91 +
  92 + <td>{$list.id}</td>
  93 + <td>
  94 + {$list.title}
  95 + </td>
  96 + <td>
  97 + {$list.content}
  98 + </td>
  99 + <td>
  100 + {$list.score}
  101 + </td>
  102 + <td>
  103 + {:date('Y-m-d H:i',$list['update_time'])}
  104 + </td>
  105 + <td>
  106 + {:date('Y-m-d H:i',$list['create_time'])}
  107 + <!--<empty name="vo.published_time">-->
  108 + <!--未发布-->
  109 + <!--<else/>-->
  110 + <!--{:date('Y-m-d H:i',$list['published_time'])}-->
  111 + <!--</empty>-->
  112 +
  113 + </td>
  114 +
  115 + <td>
  116 + <a href="{:url('UserNeed/add',array('id'=>$list['id']))}">{:lang('EDIT')}</a>
  117 + <a href="{:url('UserNeed/del',array('id'=>$list['id']))}" class="js-ajax-delete">{:lang('DELETE')}</a>
  118 + </td>
  119 + </tr>
  120 + </foreach>
  121 +
  122 + </table>
  123 +
  124 + <ul class="pagination">{$page|default=''}</ul>
  125 + </form>
  126 +</div>
  127 +<script src="__STATIC__/js/admin.js"></script>
  128 +<script>
  129 +
  130 + function reloadPage(win) {
  131 + win.location.reload();
  132 + }
  133 +
  134 + $(function () {
  135 + setCookie("refersh_time", 0);
  136 + Wind.use('ajaxForm', 'artDialog', 'iframeTools', function () {
  137 + //批量复制
  138 + $('.js-articles-copy').click(function (e) {
  139 + var ids = [];
  140 + $("input[name='ids[]']").each(function () {
  141 + if ($(this).is(':checked')) {
  142 + ids.push($(this).val());
  143 + }
  144 + });
  145 +
  146 + if (ids.length == 0) {
  147 + art.dialog.through({
  148 + id: 'error',
  149 + icon: 'error',
  150 + content: '您没有勾选信息,无法进行操作!',
  151 + cancelVal: '关闭',
  152 + cancel: true
  153 + });
  154 + return false;
  155 + }
  156 +
  157 + ids = ids.join(',');
  158 + art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=copy&ids=" + ids, {
  159 + title: "批量复制",
  160 + width: "300px"
  161 + });
  162 + });
  163 + //批量移动
  164 + $('.js-articles-move').click(function (e) {
  165 + var ids = [];
  166 + $("input[name='ids[]']").each(function () {
  167 + if ($(this).is(':checked')) {
  168 + ids.push($(this).val());
  169 + }
  170 + });
  171 +
  172 + if (ids.length == 0) {
  173 + art.dialog.through({
  174 + id: 'error',
  175 + icon: 'error',
  176 + content: '您没有勾选信息,无法进行操作!',
  177 + cancelVal: '关闭',
  178 + cancel: true
  179 + });
  180 + return false;
  181 + }
  182 +
  183 + ids = ids.join(',');
  184 + art.dialog.open("__ROOT__/index.php?g=portal&m=AdminArticle&a=move&old_term_id={$term.term_id|default=0}&ids=" + ids, {
  185 + title: "批量移动",
  186 + width: "300px"
  187 + });
  188 + });
  189 + });
  190 + });
  191 +</script>
  192 +</body>
  193 +</html>
  1 +<include file="public@header"/>
  2 +<link rel="stylesheet" href="__STATIC__/install/css/mdialog.css">
  3 +<style>
  4 + .popup{
  5 + width: 250px;
  6 + height: 100px;
  7 + background-color: rgba(0,0,0,0.5);
  8 + position: fixed;
  9 + top: 50%;
  10 + transform: translateY(-50px);
  11 + left: 0;
  12 + right: 0;
  13 + margin: 0 auto;
  14 + border-radius: 5px;
  15 + color: #ffffff;
  16 + }
  17 + .popup p{
  18 + text-align: center;
  19 + margin-top: 20px;
  20 + }
  21 + .popup span{
  22 + text-align: center;
  23 + line-height: 30px;
  24 + cursor: pointer;
  25 + }
  26 + .popup .queding{
  27 + display: inline-block;
  28 + width: 80px;
  29 + height: 30px;
  30 + background-color: #1E9FFF;
  31 + border-radius: 3px;
  32 + }
  33 + .popup span:hover{
  34 + opacity: 0.8;
  35 + }
  36 + .popup .quxiao{
  37 + display: inline-block;
  38 + width: 80px;
  39 + height: 30px;
  40 + ckground-color: #9cb945 ;
  41 + color: #333333;
  42 + border-radius: 3px;
  43 + background-color:#fff;
  44 + margin-left: 35px;
  45 + }
  46 + .btn_list{
  47 + margin: 0 auto;
  48 + width: 200px;
  49 + }
  50 +</style>
  51 +</head>
  52 +<body>
  53 +<div class="wrap">
  54 + <ul class="nav nav-tabs">
  55 + <li class="active"><a>{:lang('USER_OAUTHADMIN_INDEX')}</a></li>
  56 + </ul>
  57 + <form method="post" class="js-ajax-form margin-top-20">
  58 + <table class="table table-hover table-bordered">
  59 + <thead>
  60 + <tr>
  61 + <th>ID</th>
  62 + <th>姓名</th>
  63 + <th>手机号</th>
  64 + <th>城市</th>
  65 + <th>所属公司</th>
  66 + <th>门店</th>
  67 + <th>服务小区</th>
  68 + <th>推荐人</th>
  69 + <th>推荐人id</th>
  70 + <th>创建时间</th>
  71 + <th>更新时间</th>
  72 + <th>状态</th>
  73 + <th align="center">操作</th>
  74 + </tr>
  75 + </thead>
  76 + <tbody>
  77 + <foreach name="lists" item="vo">
  78 + <tr>
  79 + <td>{$vo.id}</td>
  80 + <td>{$vo.name}</td>
  81 + <td>{$vo.tel}</td>
  82 + <td>{$vo.city}</td>
  83 + <td>{$vo.company}</td>
  84 + <td>{$vo.store}</td>
  85 + <td>{$vo.quarters}</td>
  86 + <td>
  87 + <empty name="vo.referee_name">
  88 + 暂无
  89 + </empty>
  90 + {$vo.referee_name}
  91 + </td>
  92 + <td>
  93 + <empty name="vo.referee_name">
  94 + 暂无
  95 + </empty>
  96 + {$vo.referee_id}
  97 + </td>
  98 +
  99 + <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
  100 + <td>{:date('Y-m-d H:i:s',$vo['update_time'])}</td>
  101 + <td>
  102 + <eq name="vo.status" value="1">
  103 + 正常
  104 + </eq>
  105 + <eq name="vo.status" value="8">
  106 + 已拉黑
  107 + </eq>
  108 + <eq name="vo.status" value="9">
  109 + 已删除
  110 + </eq>
  111 + </td>
  112 + <td>
  113 + <eq name="vo.status" value="1">
  114 + <span class="black" style="color: #18BC9C; text-decoration:underline;" index="{$vo.id}">拉黑</span>
  115 + </eq>
  116 + <eq name="vo.status" value="8">
  117 + <span style="color:#aaaaaa;" index="{$vo.id}">已拉黑</span>
  118 + </eq>
  119 + <eq name="vo.status" value="9">
  120 + <span style="color:#aaaaaa;" index="{$vo.id}">已删除</span>
  121 + </eq>
  122 + </td>
  123 + </tr>
  124 + </foreach>
  125 + </tbody>
  126 + </table>
  127 +
  128 + </form>
  129 + <div class="popup" style="display: none;">
  130 + <p>确认拉黑该用户</p>
  131 + <div class="btn_list">
  132 + <span class="queding">确认</span>
  133 + <span class="quxiao">取消</span>
  134 + </div>
  135 + </div>
  136 +
  137 +</div>
  138 +<script src="__STATIC__/js/admin.js"></script>
  139 +<script src="__STATIC__/js/layer/layer.js"></script>
  140 +<script type="text/javascript" src="__STATIC__/js/zepto.min.js"></script>
  141 +<script type="text/javascript" src="__STATIC__/js/mdialog.js"></script>
  142 +<script type="">
  143 + $('.black').click(function () {
  144 + var id = $('.black').attr('index');
  145 + $('.popup').css('display','block');
  146 + // 删除
  147 + $('.queding').click(function () {
  148 + $.ajax({
  149 + type:"POST",
  150 + url:"{:url('AdminOauth/del')}",
  151 + data:{
  152 + "id":id,
  153 + },
  154 + success:function (data) {
  155 + new TipBox({type:'success',str:'操作成功',hasBtn:true});
  156 + $('.popup').css('display','none');
  157 + },
  158 + error:function () {
  159 + new TipBox({type:'error',str:'对不起,出错了!',hasBtn:true});
  160 + $('.popup').css('display','none');
  161 + }
  162 + })
  163 + })
  164 + })
  165 + $('.quxiao').click(function () {
  166 + $('.popup').css('display','none');
  167 + })
  168 +</script>
  169 +</body>
  170 +</html>
  1 +<include file="public@header"/>
  2 +<link rel="stylesheet" href="__STATIC__/install/css/mdialog.css">
  3 +<style>
  4 + .popup{
  5 + width: 250px;
  6 + height: 100px;
  7 + background-color: rgba(0,0,0,0.5);
  8 + position: fixed;
  9 + top: 50%;
  10 + transform: translateY(-50px);
  11 + left: 0;
  12 + right: 0;
  13 + margin: 0 auto;
  14 + border-radius: 5px;
  15 + color: #ffffff;
  16 + }
  17 + .popup p{
  18 + text-align: center;
  19 + margin-top: 20px;
  20 + }
  21 + .popup span{
  22 + text-align: center;
  23 + line-height: 30px;
  24 + cursor: pointer;
  25 + }
  26 + .popup .queding{
  27 + display: inline-block;
  28 + width: 80px;
  29 + height: 30px;
  30 + background-color: #1E9FFF;
  31 + border-radius: 3px;
  32 + }
  33 + .popup span:hover{
  34 + opacity: 0.8;
  35 + }
  36 + .popup .quxiao{
  37 + display: inline-block;
  38 + width: 80px;
  39 + height: 30px;
  40 + ckground-color: #9cb945 ;
  41 + color: #333333;
  42 + border-radius: 3px;
  43 + background-color:#fff;
  44 + margin-left: 35px;
  45 + }
  46 + .btn_list{
  47 + margin: 0 auto;
  48 + width: 200px;
  49 + }
  50 +</style>
  51 +</head>
  52 +<body>
  53 +<div class="wrap">
  54 + <ul class="nav nav-tabs">
  55 + <li class="active"><a>{:lang('USER_OAUTHADMIN_INDEX')}</a></li>
  56 + </ul>
  57 + <form method="post" class="js-ajax-form margin-top-20">
  58 + <table class="table table-hover table-bordered">
  59 + <thead>
  60 + <tr>
  61 + <th>ID</th>
  62 + <th>姓名</th>
  63 + <th>手机号</th>
  64 + <th>推荐人</th>
  65 + <th>推荐人id</th>
  66 + <th>创建时间</th>
  67 + <th>更新时间</th>
  68 + <th>状态</th>
  69 + <th align="center">操作</th>
  70 + </tr>
  71 + </thead>
  72 + <tbody>
  73 + <foreach name="lists" item="vo">
  74 + <tr>
  75 + <td>{$vo.id}</td>
  76 + <td>{$vo.name}</td>
  77 + <td>{$vo.tel}</td>
  78 + <td>
  79 + <empty name="vo.referee_name">
  80 + 暂无
  81 + </empty>
  82 + {$vo.referee_name}
  83 + </td>
  84 + <td>
  85 + <empty name="vo.referee_name">
  86 + 暂无
  87 + </empty>
  88 + {$vo.referee_id}
  89 + </td>
  90 +
  91 + <td>{:date('Y-m-d H:i:s',$vo['create_time'])}</td>
  92 + <td>{:date('Y-m-d H:i:s',$vo['update_time'])}</td>
  93 + <td>
  94 + <eq name="vo.status" value="1">
  95 + 正常
  96 + </eq>
  97 + <eq name="vo.status" value="8">
  98 + 已拉黑
  99 + </eq>
  100 + <eq name="vo.status" value="9">
  101 + 已删除
  102 + </eq>
  103 + </td>
  104 + <td>
  105 + <eq name="vo.status" value="1">
  106 + <span class="black" style="color: #18BC9C; text-decoration:underline;" index="{$vo.id}">拉黑</span>
  107 + </eq>
  108 + <eq name="vo.status" value="8">
  109 + <span style="color:#aaaaaa;" index="{$vo.id}">已拉黑</span>
  110 + </eq>
  111 + <eq name="vo.status" value="9">
  112 + <span style="color:#aaaaaa;" index="{$vo.id}">已删除</span>
  113 + </eq>
  114 + </td>
  115 + </tr>
  116 + </foreach>
  117 + </tbody>
  118 + </table>
  119 +
  120 + </form>
  121 + <div class="popup" style="display: none;">
  122 + <p>确认拉黑该用户</p>
  123 + <div class="btn_list">
  124 + <span class="queding">确认</span>
  125 + <span class="quxiao">取消</span>
  126 + </div>
  127 + </div>
  128 +
  129 +</div>
  130 +<script src="__STATIC__/js/admin.js"></script>
  131 +<script src="__STATIC__/js/layer/layer.js"></script>
  132 +<script type="text/javascript" src="__STATIC__/js/zepto.min.js"></script>
  133 +<script type="text/javascript" src="__STATIC__/js/mdialog.js"></script>
  134 +<script type="">
  135 + $('.black').click(function () {
  136 + var id = $('.black').attr('index');
  137 + $('.popup').css('display','block');
  138 + // 删除
  139 + $('.queding').click(function () {
  140 + $.ajax({
  141 + type:"POST",
  142 + url:"{:url('AdminOauth/del')}",
  143 + data:{
  144 + "id":id,
  145 + },
  146 + success:function (data) {
  147 + new TipBox({type:'success',str:'操作成功',hasBtn:true});
  148 + $('.popup').css('display','none');
  149 + },
  150 + error:function () {
  151 + new TipBox({type:'error',str:'对不起,出错了!',hasBtn:true});
  152 + $('.popup').css('display','none');
  153 + }
  154 + })
  155 + })
  156 + })
  157 + $('.quxiao').click(function () {
  158 + $('.popup').css('display','none');
  159 + })
  160 +
  161 +</script>
  162 +</body>
  163 +</html>
@@ -112,12 +112,12 @@ class Captcha @@ -112,12 +112,12 @@ class Captcha
112 if (empty($code) || empty($secode)) { 112 if (empty($code) || empty($secode)) {
113 return false; 113 return false;
114 } 114 }
  115 +
115 // session 过期 116 // session 过期
116 if (time() - $secode['verify_time'] > $this->expire) { 117 if (time() - $secode['verify_time'] > $this->expire) {
117 Session::delete($key, ''); 118 Session::delete($key, '');
118 return false; 119 return false;
119 } 120 }
120 -  
121 if ($this->authcode(strtoupper($code)) == $secode['verify_code']) { 121 if ($this->authcode(strtoupper($code)) == $secode['verify_code']) {
122 $this->reset && Session::delete($key, ''); 122 $this->reset && Session::delete($key, '');
123 return true; 123 return true;
@@ -13,6 +13,9 @@ class Doc @@ -13,6 +13,9 @@ class Doc
13 'api\\portal\\controller\\IndexController', 13 'api\\portal\\controller\\IndexController',
14 'api\\portal\\controller\\ArticleController', 14 'api\\portal\\controller\\ArticleController',
15 'api\\portal\\controller\\UserController', 15 'api\\portal\\controller\\UserController',
  16 + 'api\\portal\\controller\\UserneedController',
  17 + 'api\\portal\\controller\\IntermediaryneedController',
  18 + 'api\\portal\\controller\\IntermediaryController',
16 ], 19 ],
17 'filter_method'=>['_empty'], 20 'filter_method'=>['_empty'],
18 'return_format' => [ 21 'return_format' => [