作者 魏强

项目测试问题修改提交

... ... @@ -222,9 +222,9 @@ class AlipayController extends NotifyCommonController
$this->changeOrderStatus($where,$data['trade_no'],3,'pc支付宝支付');
$status = Db::name('Order')->where($where)->value('status');
if($status == 2) {
$this->redirect('http://bifangjia.com/pay/PayResult.html');
$this->redirect('http://'.$_SERVER['HTTP_HOST'].'/pay/PayResult.html');
} else {
$this->redirect('http://bifangjia.com');
$this->redirect('http://'.$_SERVER['HTTP_HOST']);
}
}
}
... ...
... ... @@ -216,9 +216,9 @@ class AlipaywapController extends NotifyCommonController
$this->changeOrderStatus($where,$data['trade_no'],4,'手机支付宝支付');
$status = Db::name('Order')->where($where)->value('status');
if($status == 2) {
$this->redirect('http://m.bifangjia.com');
$this->redirect('http://'.$_SERVER['HTTP_HOST']);
} else {
$this->redirect('http://m.bifangjia.com');
$this->redirect('http://'.$_SERVER['HTTP_HOST']);
}
}
}
... ...
... ... @@ -114,7 +114,13 @@ class CommonController extends HomeBaseController
$sendResult = $this->sendLogin($tel,$code,$modelVal);
$mes = $sendResult->Message;
if($mes != 'OK'){
$this->apiResponse('0',$mes);
if($mes == '触发分钟级流控Permits:1'){
$this->apiResponse('0','请在一分钟后获取验证码');
}else if($mes == '触发小时级流控Permits:5'){
$this->apiResponse('0', '请在一小时后获取验证码');
}else{
$this->apiResponse('0', $mes);
}
}
$add_code['tel'] = $tel;
$add_code['code'] = $modelVal;
... ...
... ... @@ -90,7 +90,8 @@ class IntermediaryController extends CommonController
$code = $request->param('code');
$where_code['tel'] = $data['tel'];
$where_code['type'] = 1;
$where_code['create_time'] = array('lt',(time()+300));
$where_code['status'] = 1;
$where_code['create_time'] = array('egt',(time()-300));
$find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
if(!$find_code){
$this->apiResponse('0','验证码错误,请重新获取');
... ... @@ -98,7 +99,9 @@ class IntermediaryController extends CommonController
if($code != $find_code['code']){
$this->apiResponse('0','验证码错误,请重新获取');
}else{
Db::name('Code')->where($where_code)->delete();
$update_code['status'] = 9;
$update_code['update_time'] = time();
Db::name('Code')->where($where_code)->update($update_code);
}
// $data['name'] = $_POST['name'];
... ... @@ -179,7 +182,8 @@ class IntermediaryController extends CommonController
$update_first['phone_link'] = $get_urlphone;
$add = $user->allowField(true)->save($update_first);
if($add_first && $add){
$this->apiResponse('1','注册成功');
$final['token'] = $data_add['token'];
$this->apiResponse('1','注册成功',$final);
}else{
$this->apiResponse('0','注册失败');
}
... ... @@ -712,6 +716,14 @@ class IntermediaryController extends CommonController
public function orderDetail(Request $request){
$data = $request->param();
$user = $this->left($data['token']);
$where_card['user_id'] = $user['id'];
$where_card['status'] = array('neq',9);
$card = Db::name('Card')->where($where_card)->find();
if($card){
$final['is_card'] = 1;
}else{
$final['is_card'] = 0;
}
$where_umoney['user_id'] = $user['id'];
$where_umoney['status'] = array('neq',9);
$order_list = Db::name('MoneyDetail')->where($where_umoney)->select()->toArray();
... ...
... ... @@ -142,27 +142,28 @@ class ThirdsendController extends HomeBaseController
$where_need['status'] = 2;
$where_need['id'] = $data['need_id'];
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,pay_time')->find();
$time = time();
if($time < $userNeedList['pay_time']+1800){
$this->apiResponse('0','未到发布时间');
}else{
if(!empty($userNeedList)) {
$time = time();
$sendTime = intval($userNeedList['pay_time']+1797);
if($time < $sendTime){
$this->apiResponse('0','未到发布时间',['now'=>$time,'pay'=>$sendTime]);
}else{
// 查询父级
$where_save['id'] = $data['need_id'];
$save['status'] = 3;
$save['update_time'] = time();
$fianl_save = Db::name('UserNeed')->where($where_save)->update($save);
if($fianl_save){
Db::commit();
$where_return['id'] = $data['need_id'];
$return = Db::name('UserNeed')->where($where_return)->find();
$where_save['id'] = $data['need_id'];
$save['status'] = 3;
$save['update_time'] = time();
$fianl_save = Db::name('UserNeed')->where($where_save)->update($save);
if($fianl_save){
Db::commit();
$where_return['id'] = $data['need_id'];
$return = Db::name('UserNeed')->where($where_return)->find();
// 发送短信
$this->sendNeed($data['need_id']);
$this->apiResponse('1','成功',$return);
}else{
Db::rollback();
$this->apiResponse('0','失败');
$this->sendNeed($data['need_id']);
$this->apiResponse('1','成功',$return);
}else{
Db::rollback();
$this->apiResponse('0','失败');
}
}
}
}
... ... @@ -615,23 +616,25 @@ class ThirdsendController extends HomeBaseController
Db::startTrans();
$where_need['status'] = 2;
$userNeedList = Db::name('UserNeed')->where($where_need)->field('id,pay_time')->select()->toArray();
$time = time();
$change_arr = array();
foreach ($userNeedList as $userk=>$userv){
if($time >= $userv['pay_time']+1800){
$this->sendNeed($userv['id']);
$change_arr[] = $userv['id'];
if(!empty($userNeedList)) {
$time = time();
$change_arr = array();
foreach ($userNeedList as $userk=>$userv){
if($time >= $userv['pay_time']+1800){
$this->sendNeed($userv['id']);
$change_arr[] = $userv['id'];
}
}
}
if($change_arr){
$where_save['id'] = array('in',$change_arr);
$save['status'] = 3;
$save['update_time'] = time();
$fianl_save = Db::name('UserNeed')->where($where_save)->update($save);
if($fianl_save){
Db::commit();
}else{
Db::rollback();
if($change_arr){
$where_save['id'] = array('in',$change_arr);
$save['status'] = 3;
$save['update_time'] = time();
$fianl_save = Db::name('UserNeed')->where($where_save)->update($save);
if($fianl_save){
Db::commit();
}else{
Db::rollback();
}
}
}
}
... ... @@ -1268,7 +1271,7 @@ class ThirdsendController extends HomeBaseController
public function sendNeed($need_id){
header("Content-Type: text/html;charset=utf-8");
$where_need['id'] = $need_id;
$where_need['status'] = 3;
$where_need['status'] = 2;
$need_list = Db::name('UserNeed')->where($where_need)->field("id,city,quarters")->find();
$final_arr = array();
$code = 'SMS_137674888';
... ... @@ -1291,14 +1294,15 @@ class ThirdsendController extends HomeBaseController
}
}
}
$json_tel = json_encode($final_tel,JSON_UNESCAPED_UNICODE);
$json_mes = json_encode($final_mes,JSON_UNESCAPED_UNICODE);
$json_autograph = json_encode($final_autograph,JSON_UNESCAPED_UNICODE);
$res_mes = $this->sendLogin($json_tel,$code,$json_mes,$json_autograph);
if($res_mes != 'OK'){
$this->apiResponse('0',$res_mes);
if(!empty($final_tel)){
$json_tel = json_encode($final_tel,JSON_UNESCAPED_UNICODE);
$json_mes = json_encode($final_mes,JSON_UNESCAPED_UNICODE);
$json_autograph = json_encode($final_autograph,JSON_UNESCAPED_UNICODE);
$res_mes = $this->sendLogin($json_tel,$code,$json_mes,$json_autograph);
if($res_mes != 'OK'){
$this->apiResponse('0',$res_mes);
}
}
}
// 添加推荐人余额
... ...
... ... @@ -195,6 +195,7 @@ class UserController extends CommonController
$code = $request->param('code');
$where_code['tel'] = $data['tel'];
$where_code['type'] = 1;
$where_code['status'] = 1;
$where_code['create_time'] = array('egt',(time()-300));
$find_code = Db::name('Code')->where($where_code)->order('create_time desc')->field('code')->find();
if(!$find_code){
... ... @@ -579,12 +580,20 @@ class UserController extends CommonController
if($user_id){
if($data['newPassword'] == $data['sureNewPassword']){
$where_update['id'] = $user_id['id'];
$middleStr = rand(1000,9999).time().rand(100,999);
$update['token'] = $this->md5($middleStr);
// $middleStr = rand(1000,9999).time().rand(100,999);
// $update['token'] = $this->md5($middleStr);
$update['password'] = $this->md5($data['newPassword']);
$is_update = Db::name('Member')->where($where_update)->update($update);
$update['update_time'] = time();
$check['password'] = $data['newPassword'];
$validate = Loader::validate('User');
if (!$validate->scene('pass')->check($check)) {
$this->apiResponse('0', $validate->getError());
}else{
$is_update = Db::name('Member')->where($where_update)->update($update);
}
if($is_update){
$final['token'] = $update['token'];
$final['token'] = $data['token'];
$this->apiResponse('1','成功',$final);
}else{
$this->apiResponse('0','修改失败');
... ... @@ -621,20 +630,23 @@ class UserController extends CommonController
if(empty($data['code'])){
$this->apiResponse('0','请输入短信验证码');
}
$where_mem['tel'] = $data['tel'];
$where_mem['status'] = array('neq',9);
$is = Db::name('Member')->where($where_mem)->field('id')->find();
if(!$is){
$this->apiResponse('0','该手机号暂未注册');
}
// 验证手机验证码
$where_Code['tel'] = $data['tel'];
$where_Code['type'] = 2;
$where_Code['status'] = 1;
$where_Code['create_time'] = array('egt',(time()-300));
$code = Db::name('Code')->where($where_Code)->order('create_time desc')->find();
if($code['code'] != $data['code']){
$this->apiResponse('0','短信验证码错误');
}else{
$this->apiResponse('1','成功');
$where_mem['tel'] = $data['tel'];
$where_mem['status'] = array('neq',9);
$is = Db::name('Member')->where($where_mem)->field('id')->find();
if(!$is){
$this->apiResponse('0','该手机号暂未注册');
}else{
$this->apiResponse('1','成功');
}
}
}else{
... ... @@ -650,7 +662,7 @@ class UserController extends CommonController
* @title 密码找回第二步(sure)
* @description 接口说明
* @author 开发者
* @url /api/portal/User/findPassword
* @url /api/portal/User/findPasswordNext
* @method POST
* @param name:tel type:int require:1 default: other: desc:手机号
* @param name:newPassword type:int require:1 default: other: desc:新密码
... ... @@ -675,6 +687,11 @@ class UserController extends CommonController
if(!$is){
$this->apiResponse('0','该手机号暂未注册');
}
$choose['password'] = $data['newPassword'];
$validate = Loader::validate('User');
if (!$validate->scene('pass')->check($choose)) {
$this->apiResponse('0', $validate->getError());
}
if($data['newPassword'] == $data['sureNewPassword']){
$where_update['tel'] = $data['tel'];
$middleStr = rand(1000,9999).time().rand(100,999);
... ... @@ -682,7 +699,7 @@ class UserController extends CommonController
$update['password'] = $this->md5($data['newPassword']);
$is_update = Db::name('Member')->where($where_update)->update($update);
if($is_update){
$this->apiResponse('1','成功',$update['token']);
$this->apiResponse('1','密码重置成功',$update['token']);
}else{
$this->apiResponse('0','修改失败');
}
... ... @@ -788,11 +805,18 @@ class UserController extends CommonController
public function myCard(Request $request){
$data = $request->param();
$user = $this->myleft($data['token']);
if(!empty($data['bank_id']) && !empty($data['card_num'])){
if(!empty($data['card_num'])){
if(empty($data['bank_id'])){
$this->apiResponse('0','请选择银行名称');
}
if(strlen($data['card_num']) <16 && strlen($data['card_num']) >20){
$this->apiResponse('0', '银行卡号为16-20位!');
}
// 验证码
$where_code['type'] = 5;
$where_code['status'] = 1;
$where_code['tel'] = $user['tel'];
$where_code['create_time'] = array('egt',(time()-300));
$code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find();
if(!$code){
$this->apiResponse('0','请先获取验证码');
... ... @@ -802,6 +826,10 @@ class UserController extends CommonController
}
if($code['code'] != $data['code']){
$this->apiResponse('0','验证码错误');
}else{
$updateCode['status'] = 9;
$updateCode['update_time'] = time();
Db::name('Code')->where($where_code)->update($updateCode);
}
// $where_findC['card_num'] = $data['card_num'];
$where_findC['user_id'] = $user['id'];
... ... @@ -810,6 +838,10 @@ class UserController extends CommonController
if($is_issetCard){
$this->apiResponse('0','您已绑定银行卡');
}
if(empty($data['bank_id'])){
$this->apiResponse('0','请选择银行名称');
}
$add['bank_id'] = $data['bank_id'];
$add['card_num'] = $data['card_num'];
$add['create_time'] = time();
... ... @@ -850,10 +882,17 @@ class UserController extends CommonController
$this->apiResponse('0','银行卡id不能为空');
}
if(!empty($data['bank_id'])){
if(empty($data['card_num'])){
$this->apiResponse('0','银行卡号不能为空');
}
if(strlen($data['card_num']) <16 && strlen($data['card_num']) >20){
$this->apiResponse('0', '银行卡号为16-20位!');
}
// 验证码
$where_code['type'] = 5;
$where_code['status'] = 1;
$where_code['tel'] = $user['tel'];
$where_code['create_time'] = array('egt',(time()-300));
$code = Db::name('Code')->where($where_code)->order('create_time desc')->limit(1)->find();
if(!$code){
$this->apiResponse('0','请先获取验证码');
... ... @@ -863,6 +902,10 @@ class UserController extends CommonController
}
if($code['code'] != $data['code']){
$this->apiResponse('0','验证码错误');
}else{
$updateCode['status'] = 9;
$updateCode['update_time'] = time();
Db::name('Code')->where($where_code)->update($updateCode);
}
$where_add['id'] = $data['card_id'];
$add['bank_id'] = $data['bank_id'];
... ...
... ... @@ -32,7 +32,7 @@ class UserValidate extends Validate
'tel.require' => '手机号不能为空!',
'tel.regex' => '手机号格式不正确!',
'password.require' => '密码不能为空!',
'password.length' => '密码长度为6-16位!',
'password.length' => '密码长度为6-16位11!',
'password.alphaNum' => '密码格式不正确!',
'sure_password.require' => '确认密码不能为空!',
... ... @@ -48,6 +48,7 @@ class UserValidate extends Validate
// 'edit' => ['tel','password','name','sure_password'],
'user' => ['tel','password','name','sure_password'],
'intermediary' => ['tel','password','name','sure_password','city','company','store','quarters'],
'pass' => ['password'],
];
}
\ No newline at end of file
... ...
... ... @@ -59,15 +59,21 @@ class CommonController extends HomeBaseController
public function upload() {
header("Access-Control-Allow-Origin: *");
if ($this->request->isPost()) {
$uploader = new Upload();
// return ["code"=>40004, "msg"=>$this->request->param(), "data"=>[$this->request->file()]];
$result = $uploader->upload();
if ($result === false) {
echo json_encode(["code"=>40004, "msg"=>$uploader->getError(), "data"=>[]]);exit;
} else {
echo json_encode(["code"=>1, "msg"=>"上传成功!", "data"=>[$result]]);exit;
$data = $this->request->file();
$fileInfoFirst = $data['file']->getInfo();
$changekb = $fileInfoFirst['size'] * 0.0009766;
if($changekb > 50){
echo json_encode(["code"=>0, "message"=>'仅支持图片小于50KB', "data"=>[]]);exit;
}else if($fileInfoFirst['type'] != "image/jpeg" && $fileInfoFirst['type'] != "image/png"){
echo json_encode(["code"=>0, "message"=>'图片类型不正确', "data"=>[]]);exit;
}else{
$uploader = new Upload();
$result = $uploader->upload();
if ($result === false) {
echo json_encode(["code"=>0, "message"=>$uploader->getError(), "data"=>[]]);exit;
} else {
echo json_encode(["code"=>1, "message"=>"上传成功!", "data"=>[$result]]);exit;
}
}
}
}
... ...