作者 魏强

项目测试问题修改提交

@@ -222,9 +222,9 @@ class AlipayController extends NotifyCommonController @@ -222,9 +222,9 @@ class AlipayController extends NotifyCommonController
222 $this->changeOrderStatus($where,$data['trade_no'],3,'pc支付宝支付'); 222 $this->changeOrderStatus($where,$data['trade_no'],3,'pc支付宝支付');
223 $status = Db::name('Order')->where($where)->value('status'); 223 $status = Db::name('Order')->where($where)->value('status');
224 if($status == 2) { 224 if($status == 2) {
225 - $this->redirect('http://bifangjia.com/pay/PayResult.html'); 225 + $this->redirect('http://'.$_SERVER['HTTP_HOST'].'/pay/PayResult.html');
226 } else { 226 } else {
227 - $this->redirect('http://bifangjia.com'); 227 + $this->redirect('http://'.$_SERVER['HTTP_HOST']);
228 } 228 }
229 } 229 }
230 } 230 }
@@ -216,9 +216,9 @@ class AlipaywapController extends NotifyCommonController @@ -216,9 +216,9 @@ class AlipaywapController extends NotifyCommonController
216 $this->changeOrderStatus($where,$data['trade_no'],4,'手机支付宝支付'); 216 $this->changeOrderStatus($where,$data['trade_no'],4,'手机支付宝支付');
217 $status = Db::name('Order')->where($where)->value('status'); 217 $status = Db::name('Order')->where($where)->value('status');
218 if($status == 2) { 218 if($status == 2) {
219 - $this->redirect('http://m.bifangjia.com'); 219 + $this->redirect('http://'.$_SERVER['HTTP_HOST']);
220 } else { 220 } else {
221 - $this->redirect('http://m.bifangjia.com'); 221 + $this->redirect('http://'.$_SERVER['HTTP_HOST']);
222 } 222 }
223 } 223 }
224 } 224 }
@@ -114,7 +114,13 @@ class CommonController extends HomeBaseController @@ -114,7 +114,13 @@ class CommonController extends HomeBaseController
114 $sendResult = $this->sendLogin($tel,$code,$modelVal); 114 $sendResult = $this->sendLogin($tel,$code,$modelVal);
115 $mes = $sendResult->Message; 115 $mes = $sendResult->Message;
116 if($mes != 'OK'){ 116 if($mes != 'OK'){
117 - $this->apiResponse('0',$mes); 117 + if($mes == '触发分钟级流控Permits:1'){
  118 + $this->apiResponse('0','请在一分钟后获取验证码');
  119 + }else if($mes == '触发小时级流控Permits:5'){
  120 + $this->apiResponse('0', '请在一小时后获取验证码');
  121 + }else{
  122 + $this->apiResponse('0', $mes);
  123 + }
118 } 124 }
119 $add_code['tel'] = $tel; 125 $add_code['tel'] = $tel;
120 $add_code['code'] = $modelVal; 126 $add_code['code'] = $modelVal;
@@ -90,7 +90,8 @@ class IntermediaryController extends CommonController @@ -90,7 +90,8 @@ class IntermediaryController extends CommonController
90 $code = $request->param('code'); 90 $code = $request->param('code');
91 $where_code['tel'] = $data['tel']; 91 $where_code['tel'] = $data['tel'];
92 $where_code['type'] = 1; 92 $where_code['type'] = 1;
93 - $where_code['create_time'] = array('lt',(time()+300)); 93 + $where_code['status'] = 1;
  94 + $where_code['create_time'] = array('egt',(time()-300));
94 $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find(); 95 $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
95 if(!$find_code){ 96 if(!$find_code){
96 $this->apiResponse('0','验证码错误,请重新获取'); 97 $this->apiResponse('0','验证码错误,请重新获取');
@@ -98,7 +99,9 @@ class IntermediaryController extends CommonController @@ -98,7 +99,9 @@ class IntermediaryController extends CommonController
98 if($code != $find_code['code']){ 99 if($code != $find_code['code']){
99 $this->apiResponse('0','验证码错误,请重新获取'); 100 $this->apiResponse('0','验证码错误,请重新获取');
100 }else{ 101 }else{
101 - Db::name('Code')->where($where_code)->delete(); 102 + $update_code['status'] = 9;
  103 + $update_code['update_time'] = time();
  104 + Db::name('Code')->where($where_code)->update($update_code);
102 } 105 }
103 // $data['name'] = $_POST['name']; 106 // $data['name'] = $_POST['name'];
104 107
@@ -179,7 +182,8 @@ class IntermediaryController extends CommonController @@ -179,7 +182,8 @@ class IntermediaryController extends CommonController
179 $update_first['phone_link'] = $get_urlphone; 182 $update_first['phone_link'] = $get_urlphone;
180 $add = $user->allowField(true)->save($update_first); 183 $add = $user->allowField(true)->save($update_first);
181 if($add_first && $add){ 184 if($add_first && $add){
182 - $this->apiResponse('1','注册成功'); 185 + $final['token'] = $data_add['token'];
  186 + $this->apiResponse('1','注册成功',$final);
183 }else{ 187 }else{
184 $this->apiResponse('0','注册失败'); 188 $this->apiResponse('0','注册失败');
185 } 189 }
@@ -712,6 +716,14 @@ class IntermediaryController extends CommonController @@ -712,6 +716,14 @@ class IntermediaryController extends CommonController
712 public function orderDetail(Request $request){ 716 public function orderDetail(Request $request){
713 $data = $request->param(); 717 $data = $request->param();
714 $user = $this->left($data['token']); 718 $user = $this->left($data['token']);
  719 + $where_card['user_id'] = $user['id'];
  720 + $where_card['status'] = array('neq',9);
  721 + $card = Db::name('Card')->where($where_card)->find();
  722 + if($card){
  723 + $final['is_card'] = 1;
  724 + }else{
  725 + $final['is_card'] = 0;
  726 + }
715 $where_umoney['user_id'] = $user['id']; 727 $where_umoney['user_id'] = $user['id'];
716 $where_umoney['status'] = array('neq',9); 728 $where_umoney['status'] = array('neq',9);
717 $order_list = Db::name('MoneyDetail')->where($where_umoney)->select()->toArray(); 729 $order_list = Db::name('MoneyDetail')->where($where_umoney)->select()->toArray();
@@ -142,27 +142,28 @@ class ThirdsendController extends HomeBaseController @@ -142,27 +142,28 @@ class ThirdsendController extends HomeBaseController
142 $where_need['status'] = 2; 142 $where_need['status'] = 2;
143 $where_need['id'] = $data['need_id']; 143 $where_need['id'] = $data['need_id'];
144 $userNeedList = Db::name('UserNeed')->where($where_need)->field('id,pay_time')->find(); 144 $userNeedList = Db::name('UserNeed')->where($where_need)->field('id,pay_time')->find();
145 - $time = time();  
146 - if($time < $userNeedList['pay_time']+1800){  
147 - $this->apiResponse('0','未到发布时间');  
148 - }else{ 145 + if(!empty($userNeedList)) {
  146 + $time = time();
  147 + $sendTime = intval($userNeedList['pay_time']+1797);
  148 + if($time < $sendTime){
  149 + $this->apiResponse('0','未到发布时间',['now'=>$time,'pay'=>$sendTime]);
  150 + }else{
149 // 查询父级 151 // 查询父级
150 -  
151 -  
152 - $where_save['id'] = $data['need_id'];  
153 - $save['status'] = 3;  
154 - $save['update_time'] = time();  
155 - $fianl_save = Db::name('UserNeed')->where($where_save)->update($save);  
156 - if($fianl_save){  
157 - Db::commit();  
158 - $where_return['id'] = $data['need_id'];  
159 - $return = Db::name('UserNeed')->where($where_return)->find(); 152 + $where_save['id'] = $data['need_id'];
  153 + $save['status'] = 3;
  154 + $save['update_time'] = time();
  155 + $fianl_save = Db::name('UserNeed')->where($where_save)->update($save);
  156 + if($fianl_save){
  157 + Db::commit();
  158 + $where_return['id'] = $data['need_id'];
  159 + $return = Db::name('UserNeed')->where($where_return)->find();
160 // 发送短信 160 // 发送短信
161 - $this->sendNeed($data['need_id']);  
162 - $this->apiResponse('1','成功',$return);  
163 - }else{  
164 - Db::rollback();  
165 - $this->apiResponse('0','失败'); 161 + $this->sendNeed($data['need_id']);
  162 + $this->apiResponse('1','成功',$return);
  163 + }else{
  164 + Db::rollback();
  165 + $this->apiResponse('0','失败');
  166 + }
166 } 167 }
167 } 168 }
168 } 169 }
@@ -615,23 +616,25 @@ class ThirdsendController extends HomeBaseController @@ -615,23 +616,25 @@ class ThirdsendController extends HomeBaseController
615 Db::startTrans(); 616 Db::startTrans();
616 $where_need['status'] = 2; 617 $where_need['status'] = 2;
617 $userNeedList = Db::name('UserNeed')->where($where_need)->field('id,pay_time')->select()->toArray(); 618 $userNeedList = Db::name('UserNeed')->where($where_need)->field('id,pay_time')->select()->toArray();
618 - $time = time();  
619 - $change_arr = array();  
620 - foreach ($userNeedList as $userk=>$userv){  
621 - if($time >= $userv['pay_time']+1800){  
622 - $this->sendNeed($userv['id']);  
623 - $change_arr[] = $userv['id']; 619 + if(!empty($userNeedList)) {
  620 + $time = time();
  621 + $change_arr = array();
  622 + foreach ($userNeedList as $userk=>$userv){
  623 + if($time >= $userv['pay_time']+1800){
  624 + $this->sendNeed($userv['id']);
  625 + $change_arr[] = $userv['id'];
  626 + }
624 } 627 }
625 - }  
626 - if($change_arr){  
627 - $where_save['id'] = array('in',$change_arr);  
628 - $save['status'] = 3;  
629 - $save['update_time'] = time();  
630 - $fianl_save = Db::name('UserNeed')->where($where_save)->update($save);  
631 - if($fianl_save){  
632 - Db::commit();  
633 - }else{  
634 - Db::rollback(); 628 + if($change_arr){
  629 + $where_save['id'] = array('in',$change_arr);
  630 + $save['status'] = 3;
  631 + $save['update_time'] = time();
  632 + $fianl_save = Db::name('UserNeed')->where($where_save)->update($save);
  633 + if($fianl_save){
  634 + Db::commit();
  635 + }else{
  636 + Db::rollback();
  637 + }
635 } 638 }
636 } 639 }
637 } 640 }
@@ -1268,7 +1271,7 @@ class ThirdsendController extends HomeBaseController @@ -1268,7 +1271,7 @@ class ThirdsendController extends HomeBaseController
1268 public function sendNeed($need_id){ 1271 public function sendNeed($need_id){
1269 header("Content-Type: text/html;charset=utf-8"); 1272 header("Content-Type: text/html;charset=utf-8");
1270 $where_need['id'] = $need_id; 1273 $where_need['id'] = $need_id;
1271 - $where_need['status'] = 3; 1274 + $where_need['status'] = 2;
1272 $need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters")->find(); 1275 $need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters")->find();
1273 $final_arr = array(); 1276 $final_arr = array();
1274 $code = 'SMS_137674888'; 1277 $code = 'SMS_137674888';
@@ -1291,14 +1294,15 @@ class ThirdsendController extends HomeBaseController @@ -1291,14 +1294,15 @@ class ThirdsendController extends HomeBaseController
1291 } 1294 }
1292 } 1295 }
1293 } 1296 }
1294 - $json_tel = json_encode($final_tel,JSON_UNESCAPED_UNICODE);  
1295 - $json_mes = json_encode($final_mes,JSON_UNESCAPED_UNICODE);  
1296 - $json_autograph = json_encode($final_autograph,JSON_UNESCAPED_UNICODE);  
1297 - $res_mes = $this->sendLogin($json_tel,$code,$json_mes,$json_autograph);  
1298 - if($res_mes != 'OK'){  
1299 - $this->apiResponse('0',$res_mes); 1297 + if(!empty($final_tel)){
  1298 + $json_tel = json_encode($final_tel,JSON_UNESCAPED_UNICODE);
  1299 + $json_mes = json_encode($final_mes,JSON_UNESCAPED_UNICODE);
  1300 + $json_autograph = json_encode($final_autograph,JSON_UNESCAPED_UNICODE);
  1301 + $res_mes = $this->sendLogin($json_tel,$code,$json_mes,$json_autograph);
  1302 + if($res_mes != 'OK'){
  1303 + $this->apiResponse('0',$res_mes);
  1304 + }
1300 } 1305 }
1301 -  
1302 } 1306 }
1303 1307
1304 // 添加推荐人余额 1308 // 添加推荐人余额
@@ -195,6 +195,7 @@ class UserController extends CommonController @@ -195,6 +195,7 @@ class UserController extends CommonController
195 $code = $request->param('code'); 195 $code = $request->param('code');
196 $where_code['tel'] = $data['tel']; 196 $where_code['tel'] = $data['tel'];
197 $where_code['type'] = 1; 197 $where_code['type'] = 1;
  198 + $where_code['status'] = 1;
198 $where_code['create_time'] = array('egt',(time()-300)); 199 $where_code['create_time'] = array('egt',(time()-300));
199 $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find(); 200 $find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
200 if(!$find_code){ 201 if(!$find_code){
@@ -579,12 +580,20 @@ class UserController extends CommonController @@ -579,12 +580,20 @@ class UserController extends CommonController
579 if($user_id){ 580 if($user_id){
580 if($data['newPassword'] == $data['sureNewPassword']){ 581 if($data['newPassword'] == $data['sureNewPassword']){
581 $where_update['id'] = $user_id['id']; 582 $where_update['id'] = $user_id['id'];
582 - $middleStr = rand(1000,9999).time().rand(100,999);  
583 - $update['token'] = $this->md5($middleStr); 583 +// $middleStr = rand(1000,9999).time().rand(100,999);
  584 +// $update['token'] = $this->md5($middleStr);
584 $update['password'] = $this->md5($data['newPassword']); 585 $update['password'] = $this->md5($data['newPassword']);
585 - $is_update = Db::name('Member')->where($where_update)->update($update); 586 + $update['update_time'] = time();
  587 +
  588 + $check['password'] = $data['newPassword'];
  589 + $validate = Loader::validate('User');
  590 + if (!$validate->scene('pass')->check($check)) {
  591 + $this->apiResponse('0', $validate->getError());
  592 + }else{
  593 + $is_update = Db::name('Member')->where($where_update)->update($update);
  594 + }
586 if($is_update){ 595 if($is_update){
587 - $final['token'] = $update['token']; 596 + $final['token'] = $data['token'];
588 $this->apiResponse('1','成功',$final); 597 $this->apiResponse('1','成功',$final);
589 }else{ 598 }else{
590 $this->apiResponse('0','修改失败'); 599 $this->apiResponse('0','修改失败');
@@ -621,20 +630,23 @@ class UserController extends CommonController @@ -621,20 +630,23 @@ class UserController extends CommonController
621 if(empty($data['code'])){ 630 if(empty($data['code'])){
622 $this->apiResponse('0','请输入短信验证码'); 631 $this->apiResponse('0','请输入短信验证码');
623 } 632 }
624 - $where_mem['tel'] = $data['tel'];  
625 - $where_mem['status'] = array('neq',9);  
626 - $is = Db::name('Member')->where($where_mem)->field('id')->find();  
627 - if(!$is){  
628 - $this->apiResponse('0','该手机号暂未注册');  
629 - }  
630 // 验证手机验证码 633 // 验证手机验证码
631 $where_Code['tel'] = $data['tel']; 634 $where_Code['tel'] = $data['tel'];
632 $where_Code['type'] = 2; 635 $where_Code['type'] = 2;
  636 + $where_Code['status'] = 1;
  637 + $where_Code['create_time'] = array('egt',(time()-300));
633 $code = Db::name('Code')->where($where_Code)->order('create_time desc')->find(); 638 $code = Db::name('Code')->where($where_Code)->order('create_time desc')->find();
634 if($code['code'] != $data['code']){ 639 if($code['code'] != $data['code']){
635 $this->apiResponse('0','短信验证码错误'); 640 $this->apiResponse('0','短信验证码错误');
636 }else{ 641 }else{
637 - $this->apiResponse('1','成功'); 642 + $where_mem['tel'] = $data['tel'];
  643 + $where_mem['status'] = array('neq',9);
  644 + $is = Db::name('Member')->where($where_mem)->field('id')->find();
  645 + if(!$is){
  646 + $this->apiResponse('0','该手机号暂未注册');
  647 + }else{
  648 + $this->apiResponse('1','成功');
  649 + }
638 } 650 }
639 651
640 }else{ 652 }else{
@@ -650,7 +662,7 @@ class UserController extends CommonController @@ -650,7 +662,7 @@ class UserController extends CommonController
650 * @title 密码找回第二步(sure) 662 * @title 密码找回第二步(sure)
651 * @description 接口说明 663 * @description 接口说明
652 * @author 开发者 664 * @author 开发者
653 - * @url /api/portal/User/findPassword 665 + * @url /api/portal/User/findPasswordNext
654 * @method POST 666 * @method POST
655 * @param name:tel type:int require:1 default: other: desc:手机号 667 * @param name:tel type:int require:1 default: other: desc:手机号
656 * @param name:newPassword type:int require:1 default: other: desc:新密码 668 * @param name:newPassword type:int require:1 default: other: desc:新密码
@@ -675,6 +687,11 @@ class UserController extends CommonController @@ -675,6 +687,11 @@ class UserController extends CommonController
675 if(!$is){ 687 if(!$is){
676 $this->apiResponse('0','该手机号暂未注册'); 688 $this->apiResponse('0','该手机号暂未注册');
677 } 689 }
  690 + $choose['password'] = $data['newPassword'];
  691 + $validate = Loader::validate('User');
  692 + if (!$validate->scene('pass')->check($choose)) {
  693 + $this->apiResponse('0', $validate->getError());
  694 + }
678 if($data['newPassword'] == $data['sureNewPassword']){ 695 if($data['newPassword'] == $data['sureNewPassword']){
679 $where_update['tel'] = $data['tel']; 696 $where_update['tel'] = $data['tel'];
680 $middleStr = rand(1000,9999).time().rand(100,999); 697 $middleStr = rand(1000,9999).time().rand(100,999);
@@ -682,7 +699,7 @@ class UserController extends CommonController @@ -682,7 +699,7 @@ class UserController extends CommonController
682 $update['password'] = $this->md5($data['newPassword']); 699 $update['password'] = $this->md5($data['newPassword']);
683 $is_update = Db::name('Member')->where($where_update)->update($update); 700 $is_update = Db::name('Member')->where($where_update)->update($update);
684 if($is_update){ 701 if($is_update){
685 - $this->apiResponse('1','成功',$update['token']); 702 + $this->apiResponse('1','密码重置成功',$update['token']);
686 }else{ 703 }else{
687 $this->apiResponse('0','修改失败'); 704 $this->apiResponse('0','修改失败');
688 } 705 }
@@ -788,11 +805,18 @@ class UserController extends CommonController @@ -788,11 +805,18 @@ class UserController extends CommonController
788 public function myCard(Request $request){ 805 public function myCard(Request $request){
789 $data = $request->param(); 806 $data = $request->param();
790 $user = $this->myleft($data['token']); 807 $user = $this->myleft($data['token']);
791 - if(!empty($data['bank_id']) && !empty($data['card_num'])){ 808 + if(!empty($data['card_num'])){
  809 + if(empty($data['bank_id'])){
  810 + $this->apiResponse('0','请选择银行名称');
  811 + }
  812 + if(strlen($data['card_num']) <16 && strlen($data['card_num']) >20){
  813 + $this->apiResponse('0', '银行卡号为16-20位!');
  814 + }
792 // 验证码 815 // 验证码
793 $where_code['type'] = 5; 816 $where_code['type'] = 5;
794 $where_code['status'] = 1; 817 $where_code['status'] = 1;
795 $where_code['tel'] = $user['tel']; 818 $where_code['tel'] = $user['tel'];
  819 + $where_code['create_time'] = array('egt',(time()-300));
796 $code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find(); 820 $code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find();
797 if(!$code){ 821 if(!$code){
798 $this->apiResponse('0','请先获取验证码'); 822 $this->apiResponse('0','请先获取验证码');
@@ -802,6 +826,10 @@ class UserController extends CommonController @@ -802,6 +826,10 @@ class UserController extends CommonController
802 } 826 }
803 if($code['code'] != $data['code']){ 827 if($code['code'] != $data['code']){
804 $this->apiResponse('0','验证码错误'); 828 $this->apiResponse('0','验证码错误');
  829 + }else{
  830 + $updateCode['status'] = 9;
  831 + $updateCode['update_time'] = time();
  832 + Db::name('Code')->where($where_code)->update($updateCode);
805 } 833 }
806 // $where_findC['card_num'] = $data['card_num']; 834 // $where_findC['card_num'] = $data['card_num'];
807 $where_findC['user_id'] = $user['id']; 835 $where_findC['user_id'] = $user['id'];
@@ -810,6 +838,10 @@ class UserController extends CommonController @@ -810,6 +838,10 @@ class UserController extends CommonController
810 if($is_issetCard){ 838 if($is_issetCard){
811 $this->apiResponse('0','您已绑定银行卡'); 839 $this->apiResponse('0','您已绑定银行卡');
812 } 840 }
  841 + if(empty($data['bank_id'])){
  842 + $this->apiResponse('0','请选择银行名称');
  843 + }
  844 +
813 $add['bank_id'] = $data['bank_id']; 845 $add['bank_id'] = $data['bank_id'];
814 $add['card_num'] = $data['card_num']; 846 $add['card_num'] = $data['card_num'];
815 $add['create_time'] = time(); 847 $add['create_time'] = time();
@@ -850,10 +882,17 @@ class UserController extends CommonController @@ -850,10 +882,17 @@ class UserController extends CommonController
850 $this->apiResponse('0','银行卡id不能为空'); 882 $this->apiResponse('0','银行卡id不能为空');
851 } 883 }
852 if(!empty($data['bank_id'])){ 884 if(!empty($data['bank_id'])){
  885 + if(empty($data['card_num'])){
  886 + $this->apiResponse('0','银行卡号不能为空');
  887 + }
  888 + if(strlen($data['card_num']) <16 && strlen($data['card_num']) >20){
  889 + $this->apiResponse('0', '银行卡号为16-20位!');
  890 + }
853 // 验证码 891 // 验证码
854 $where_code['type'] = 5; 892 $where_code['type'] = 5;
855 $where_code['status'] = 1; 893 $where_code['status'] = 1;
856 $where_code['tel'] = $user['tel']; 894 $where_code['tel'] = $user['tel'];
  895 + $where_code['create_time'] = array('egt',(time()-300));
857 $code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find(); 896 $code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find();
858 if(!$code){ 897 if(!$code){
859 $this->apiResponse('0','请先获取验证码'); 898 $this->apiResponse('0','请先获取验证码');
@@ -863,6 +902,10 @@ class UserController extends CommonController @@ -863,6 +902,10 @@ class UserController extends CommonController
863 } 902 }
864 if($code['code'] != $data['code']){ 903 if($code['code'] != $data['code']){
865 $this->apiResponse('0','验证码错误'); 904 $this->apiResponse('0','验证码错误');
  905 + }else{
  906 + $updateCode['status'] = 9;
  907 + $updateCode['update_time'] = time();
  908 + Db::name('Code')->where($where_code)->update($updateCode);
866 } 909 }
867 $where_add['id'] = $data['card_id']; 910 $where_add['id'] = $data['card_id'];
868 $add['bank_id'] = $data['bank_id']; 911 $add['bank_id'] = $data['bank_id'];
@@ -32,7 +32,7 @@ class UserValidate extends Validate @@ -32,7 +32,7 @@ class UserValidate extends Validate
32 'tel.require' => '手机号不能为空!', 32 'tel.require' => '手机号不能为空!',
33 'tel.regex' => '手机号格式不正确!', 33 'tel.regex' => '手机号格式不正确!',
34 'password.require' => '密码不能为空!', 34 'password.require' => '密码不能为空!',
35 - 'password.length' => '密码长度为6-16位!', 35 + 'password.length' => '密码长度为6-16位11!',
36 'password.alphaNum' => '密码格式不正确!', 36 'password.alphaNum' => '密码格式不正确!',
37 'sure_password.require' => '确认密码不能为空!', 37 'sure_password.require' => '确认密码不能为空!',
38 38
@@ -48,6 +48,7 @@ class UserValidate extends Validate @@ -48,6 +48,7 @@ class UserValidate extends Validate
48 // 'edit' => ['tel','password','name','sure_password'], 48 // 'edit' => ['tel','password','name','sure_password'],
49 'user' => ['tel','password','name','sure_password'], 49 'user' => ['tel','password','name','sure_password'],
50 'intermediary' => ['tel','password','name','sure_password','city','company','store','quarters'], 50 'intermediary' => ['tel','password','name','sure_password','city','company','store','quarters'],
  51 + 'pass' => ['password'],
51 ]; 52 ];
52 53
53 } 54 }
@@ -59,15 +59,21 @@ class CommonController extends HomeBaseController @@ -59,15 +59,21 @@ class CommonController extends HomeBaseController
59 public function upload() { 59 public function upload() {
60 header("Access-Control-Allow-Origin: *"); 60 header("Access-Control-Allow-Origin: *");
61 if ($this->request->isPost()) { 61 if ($this->request->isPost()) {
62 - $uploader = new Upload();  
63 -// return ["code"=>40004, "msg"=>$this->request->param(), "data"=>[$this->request->file()]];  
64 -  
65 - $result = $uploader->upload();  
66 -  
67 - if ($result === false) {  
68 - echo json_encode(["code"=>40004, "msg"=>$uploader->getError(), "data"=>[]]);exit;  
69 - } else {  
70 - echo json_encode(["code"=>1, "msg"=>"上传成功!", "data"=>[$result]]);exit; 62 + $data = $this->request->file();
  63 + $fileInfoFirst = $data['file']->getInfo();
  64 + $changekb = $fileInfoFirst['size'] * 0.0009766;
  65 + if($changekb > 50){
  66 + echo json_encode(["code"=>0, "message"=>'仅支持图片小于50KB', "data"=>[]]);exit;
  67 + }else if($fileInfoFirst['type'] != "image/jpeg" && $fileInfoFirst['type'] != "image/png"){
  68 + echo json_encode(["code"=>0, "message"=>'图片类型不正确', "data"=>[]]);exit;
  69 + }else{
  70 + $uploader = new Upload();
  71 + $result = $uploader->upload();
  72 + if ($result === false) {
  73 + echo json_encode(["code"=>0, "message"=>$uploader->getError(), "data"=>[]]);exit;
  74 + } else {
  75 + echo json_encode(["code"=>1, "message"=>"上传成功!", "data"=>[$result]]);exit;
  76 + }
71 } 77 }
72 } 78 }
73 } 79 }