正在显示
11 个修改的文件
包含
282 行增加
和
62 行删除
@@ -24,6 +24,22 @@ use think\Loader; | @@ -24,6 +24,22 @@ use think\Loader; | ||
24 | 24 | ||
25 | class ArticleController extends CommonController | 25 | class ArticleController extends CommonController |
26 | { | 26 | { |
27 | + | ||
28 | + /* | ||
29 | +* 长度处理 | ||
30 | +* */ | ||
31 | + public function changeLen($text,$number,$numberNext){ | ||
32 | + $change_html = strip_tags(htmlspecialchars_decode($text)); | ||
33 | + $sub_text_first = mb_substr($change_html,0,$number,'utf-8'); | ||
34 | + | ||
35 | + if(strlen($change_html) >= $numberNext){ | ||
36 | + $sub_text = $sub_text_first.'...'; | ||
37 | + }else{ | ||
38 | + $sub_text = $sub_text_first; | ||
39 | + } | ||
40 | + return $sub_text; | ||
41 | + } | ||
42 | + | ||
27 | /** | 43 | /** |
28 | * @title 文章列表 | 44 | * @title 文章列表 |
29 | * @description 接口说明 | 45 | * @description 接口说明 |
@@ -41,11 +57,11 @@ class ArticleController extends CommonController | @@ -41,11 +57,11 @@ class ArticleController extends CommonController | ||
41 | */ | 57 | */ |
42 | public function index(Request $request) | 58 | public function index(Request $request) |
43 | { | 59 | { |
44 | - $size = 2; | 60 | + $size = 8; |
61 | + $cart_arr = array(); | ||
62 | + $choose = array(); | ||
45 | $page = $request->param('page'); | 63 | $page = $request->param('page'); |
46 | $where_cate['status'] = 1; | 64 | $where_cate['status'] = 1; |
47 | - $catrgory = Db::name('PortalCategory')->where($where_cate)->field('id,name')->select()->toArray(); | ||
48 | - $final['cate'] = $catrgory; | ||
49 | $where_connect['j.status'] = 1; | 65 | $where_connect['j.status'] = 1; |
50 | $where_connect['p.post_status'] = 1; | 66 | $where_connect['p.post_status'] = 1; |
51 | $where_connect['j.category_id'] = $_POST['articleType']; | 67 | $where_connect['j.category_id'] = $_POST['articleType']; |
@@ -56,10 +72,29 @@ class ArticleController extends CommonController | @@ -56,10 +72,29 @@ class ArticleController extends CommonController | ||
56 | ->join("PortalPost p","p.id = j.post_id") | 72 | ->join("PortalPost p","p.id = j.post_id") |
57 | ->page("$page,$size") | 73 | ->page("$page,$size") |
58 | ->select()->toArray(); | 74 | ->select()->toArray(); |
59 | - | ||
60 | foreach ($article_list as $artk=>$artv){ | 75 | foreach ($article_list as $artk=>$artv){ |
76 | + $article_list[$artk]['post_title'] = $this->changeLen($artv['post_title'],25,70); | ||
61 | $article_list[$artk]['create_time'] = date('Y-m-d H:i:s',$artv['create_time']); | 77 | $article_list[$artk]['create_time'] = date('Y-m-d H:i:s',$artv['create_time']); |
62 | } | 78 | } |
79 | + | ||
80 | + $where_next['j.status'] = 1; | ||
81 | + $where_next['p.post_status'] = 1; | ||
82 | + $article_next = Db::name('PortalCategoryPost')->alias('j') | ||
83 | + ->where($where_next) | ||
84 | + ->field("j.post_id,j.category_id , c.name , p.post_title,p.create_time") | ||
85 | + ->join("PortalCategory c","c.id = j.category_id") | ||
86 | + ->join("PortalPost p","p.id = j.post_id") | ||
87 | + ->select()->toArray(); | ||
88 | + foreach ($article_next as $nextk=>$nextv){ | ||
89 | + if(!in_array($nextv['category_id'],$choose)){ | ||
90 | + $middle['id'] = $nextv['category_id']; | ||
91 | + $middle['name'] = $this->changeLen($nextv['name'],10,30); | ||
92 | + $choose[] = $nextv['category_id']; | ||
93 | + $cart_arr[] = $middle; | ||
94 | + } | ||
95 | + } | ||
96 | + | ||
97 | + $final['cate'] = $cart_arr; | ||
63 | if(empty($article_list)){ | 98 | if(empty($article_list)){ |
64 | $this->apiResponse('1','暂无数据'); | 99 | $this->apiResponse('1','暂无数据'); |
65 | }else{ | 100 | }else{ |
@@ -57,20 +57,20 @@ class IndexController extends CommonController | @@ -57,20 +57,20 @@ class IndexController extends CommonController | ||
57 | ->field("content") | 57 | ->field("content") |
58 | ->order('create_time desc') | 58 | ->order('create_time desc') |
59 | ->find(); | 59 | ->find(); |
60 | - $final['process']['content'] = htmlspecialchars_decode($final['process']['content']); | 60 | + $final['process']['content'] = cmf_replace_content_file_url(htmlspecialchars_decode($final['process']['content'])); |
61 | // 3. 最新成交 | 61 | // 3. 最新成交 |
62 | $where_new['status'] = 1; | 62 | $where_new['status'] = 1; |
63 | $final['new'] = Db::name('New')->where($where_new)->order('score desc')->select()->toArray(); | 63 | $final['new'] = Db::name('New')->where($where_new)->order('score desc')->select()->toArray(); |
64 | // 4. 合作企业 | 64 | // 4. 合作企业 |
65 | $where_coo['status'] = 1; | 65 | $where_coo['status'] = 1; |
66 | - $final['coop'] = Db::name('Cooperation')->where($where_coo)->order("score desc , create_time desc")->field('pic,jump')->select()->toArray(); | 66 | + $final['coop'] = Db::name('Cooperation')->where($where_coo)->order("score desc , create_time desc")->field('pic,jump')->limit(10)->select()->toArray(); |
67 | foreach ($final['coop'] as $coopk=>$coopv){ | 67 | foreach ($final['coop'] as $coopk=>$coopv){ |
68 | - if(empty($member['pic'])){ | ||
69 | - $pic = "../themes/simpleboot3/public/assets/images/house.jpg"; | 68 | + if(empty($coopv['pic'])){ |
69 | + $final['coop'][$coopk]['pic'] = "../themes/simpleboot3/public/assets/images/house.jpg"; | ||
70 | }else{ | 70 | }else{ |
71 | - $pic = $coopv['pic']; | 71 | + $final['coop'][$coopk]['pic'] = cmf_get_image_url($coopv['pic']); |
72 | } | 72 | } |
73 | - $final['coop'][$coopk]['pic'] = cmf_get_image_url($pic); | 73 | + |
74 | } | 74 | } |
75 | // 5. 文章 | 75 | // 5. 文章 |
76 | $where_cate['c.delete_time'] = 0; | 76 | $where_cate['c.delete_time'] = 0; |
@@ -30,6 +30,18 @@ class IntermediaryController extends CommonController | @@ -30,6 +30,18 @@ class IntermediaryController extends CommonController | ||
30 | parent::__construct(); | 30 | parent::__construct(); |
31 | $this->postModel = $postModel; | 31 | $this->postModel = $postModel; |
32 | } | 32 | } |
33 | + // 获取ip地址 | ||
34 | + function getIP(){ | ||
35 | + global $ip; | ||
36 | + if (getenv("HTTP_CLIENT_IP")) | ||
37 | + $ip = getenv("HTTP_CLIENT_IP"); | ||
38 | + else if(getenv("HTTP_X_FORWARDED_FOR")) | ||
39 | + $ip = getenv("HTTP_X_FORWARDED_FOR"); | ||
40 | + else if(getenv("REMOTE_ADDR")) | ||
41 | + $ip = getenv("REMOTE_ADDR"); | ||
42 | + else $ip = "Unknow"; | ||
43 | + return $ip; | ||
44 | + } | ||
33 | 45 | ||
34 | // 登录,注册 | 46 | // 登录,注册 |
35 | //tel 手机号 | 47 | //tel 手机号 |
@@ -64,12 +76,12 @@ class IntermediaryController extends CommonController | @@ -64,12 +76,12 @@ class IntermediaryController extends CommonController | ||
64 | // 验证 | 76 | // 验证 |
65 | $validate = Loader::validate('User'); | 77 | $validate = Loader::validate('User'); |
66 | if(!$validate->scene('intermediary')->check($data)){ | 78 | if(!$validate->scene('intermediary')->check($data)){ |
67 | - return json(array('code'=>0,'message'=>$validate->getError())); | 79 | + $this->apiResponse('0',$validate->getError()); |
68 | } | 80 | } |
69 | $data_add['password'] = $this->md5($data['password']); | 81 | $data_add['password'] = $this->md5($data['password']); |
70 | $sure_password = $this->md5($data['sure_password']); | 82 | $sure_password = $this->md5($data['sure_password']); |
71 | // 确认密码 | 83 | // 确认密码 |
72 | - if($data['password'] != $sure_password){ | 84 | + if($data_add['password'] != $sure_password){ |
73 | $this->apiResponse('0','两次密码不一致'); | 85 | $this->apiResponse('0','两次密码不一致'); |
74 | } | 86 | } |
75 | 87 | ||
@@ -100,11 +112,16 @@ class IntermediaryController extends CommonController | @@ -100,11 +112,16 @@ class IntermediaryController extends CommonController | ||
100 | 112 | ||
101 | $str = rand(1000,9999).time().rand(100,999); | 113 | $str = rand(1000,9999).time().rand(100,999); |
102 | $data_add['token'] = $this->md5($str); | 114 | $data_add['token'] = $this->md5($str); |
115 | + $data_add['name'] = $data['name']; | ||
116 | + $data_add['tel'] = $data['tel']; | ||
103 | $data_add['type'] = 2; | 117 | $data_add['type'] = 2; |
118 | + $data_add['reputation'] = 50; | ||
119 | + $data_add['start'] = 50; | ||
104 | $data_add['city'] = $request->param('city'); | 120 | $data_add['city'] = $request->param('city'); |
105 | $data_add['company'] = $request->param('company'); | 121 | $data_add['company'] = $request->param('company'); |
106 | $data_add['store'] = $request->param('store'); | 122 | $data_add['store'] = $request->param('store'); |
107 | $data_add['quarters'] = $request->param('quarters'); | 123 | $data_add['quarters'] = $request->param('quarters'); |
124 | + $data['create_ip'] = $this->getIP(); | ||
108 | if(!empty($data['parent_id'])){ | 125 | if(!empty($data['parent_id'])){ |
109 | $data_add['referee_id'] = $data['parent_id']; | 126 | $data_add['referee_id'] = $data['parent_id']; |
110 | $data_add['referee_tel'] = $data['parent_tel']; | 127 | $data_add['referee_tel'] = $data['parent_tel']; |
@@ -819,7 +836,7 @@ class IntermediaryController extends CommonController | @@ -819,7 +836,7 @@ class IntermediaryController extends CommonController | ||
819 | $where_addParentNext['id'] = $agency_referee; | 836 | $where_addParentNext['id'] = $agency_referee; |
820 | $needReferee_addNext['money'] = $reward['number']+$agency['amoney']; | 837 | $needReferee_addNext['money'] = $reward['number']+$agency['amoney']; |
821 | $needReferee_addNext['getmoney_id'] = $agency['amid']; | 838 | $needReferee_addNext['getmoney_id'] = $agency['amid']; |
822 | - $add_parentNext = Db::name('Member')->where($needReferee_addNext)->update($needReferee_addNext); | 839 | + $add_parentNext = Db::name('Member')->where($where_addParentNext)->update($needReferee_addNext); |
823 | if (!$add_parentNext) { | 840 | if (!$add_parentNext) { |
824 | Db::rollback(); | 841 | Db::rollback(); |
825 | $this->apiResponse('0', '确认失败2'); | 842 | $this->apiResponse('0', '确认失败2'); |
@@ -80,7 +80,7 @@ class IntermediaryneedController extends CommonController | @@ -80,7 +80,7 @@ class IntermediaryneedController extends CommonController | ||
80 | public function sendNeed(Request $request){ | 80 | public function sendNeed(Request $request){ |
81 | $data = $request->param(); | 81 | $data = $request->param(); |
82 | $page = $data['page']; | 82 | $page = $data['page']; |
83 | - $size = 2; | 83 | + $size = 4; |
84 | $where_member['token'] = $data['token']; | 84 | $where_member['token'] = $data['token']; |
85 | // 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配) | 85 | // 查询,匹配:省市区县精确匹配,小区名模糊匹配(只要有连续字匹配,就算匹配) |
86 | $member_find = Db::name('Member')->where($where_member)->field("id,city,quarters")->find(); | 86 | $member_find = Db::name('Member')->where($where_member)->field("id,city,quarters")->find(); |
@@ -599,6 +599,107 @@ class UserController extends CommonController | @@ -599,6 +599,107 @@ class UserController extends CommonController | ||
599 | 599 | ||
600 | 600 | ||
601 | /** | 601 | /** |
602 | + * @title 密码找回第一步(sure) | ||
603 | + * @description 接口说明 | ||
604 | + * @author 开发者 | ||
605 | + * @url /api/portal/User/findPasswordFirst | ||
606 | + * @method POST | ||
607 | + * @param name:tel type:int require:1 default: other: desc:手机号 | ||
608 | + * @param name:imgCode type:int require:1 default: other: desc:图片验证码 | ||
609 | + * @param name:code type:int require:1 default: other: desc:短信验证码 | ||
610 | + * @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:1 | ||
611 | + */ | ||
612 | + public function findPasswordFirst(Request $request){ | ||
613 | + $data = $request->param(); | ||
614 | + if($data){ | ||
615 | + if(empty($data['tel'])){ | ||
616 | + $this->apiResponse('0','请输入手机号'); | ||
617 | + } | ||
618 | + if(empty($data['imgCode'])){ | ||
619 | + $this->apiResponse('0','请输入图片验证码'); | ||
620 | + } | ||
621 | + if(empty($data['code'])){ | ||
622 | + $this->apiResponse('0','请输入短信验证码'); | ||
623 | + } | ||
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 | +// 验证手机验证码 | ||
631 | + $where_Code['tel'] = $data['tel']; | ||
632 | + $where_Code['type'] = 2; | ||
633 | + $code = Db::name('Code')->where($where_Code)->order('create_time desc')->find(); | ||
634 | + if($code['code'] != $data['code']){ | ||
635 | + $this->apiResponse('0','短信验证码错误'); | ||
636 | + }else{ | ||
637 | + $this->apiResponse('1','成功'); | ||
638 | + } | ||
639 | + | ||
640 | + }else{ | ||
641 | + // 返回验证码图片 | ||
642 | + $img = $this->getImgUrl(); | ||
643 | + $this->apiResponse('1','成功',$img); | ||
644 | + } | ||
645 | + } | ||
646 | + | ||
647 | + | ||
648 | + | ||
649 | + /** | ||
650 | + * @title 密码找回第二步(sure) | ||
651 | + * @description 接口说明 | ||
652 | + * @author 开发者 | ||
653 | + * @url /api/portal/User/findPassword | ||
654 | + * @method POST | ||
655 | + * @param name:tel type:int require:1 default: other: desc:手机号 | ||
656 | + * @param name:newPassword type:int require:1 default: other: desc:新密码 | ||
657 | + * @param name:sureNewPassword type:int require:1 default: other: desc:确认新密码 | ||
658 | + * @param name:connect type:int require:1 default: other:1 登录注册 ,2其他 desc:1 | ||
659 | + */ | ||
660 | + public function findPasswordNext(Request $request){ | ||
661 | + $data = $request->param(); | ||
662 | + if($data){ | ||
663 | + if(empty($data['tel'])){ | ||
664 | + $this->apiResponse('0','请输入手机号'); | ||
665 | + } | ||
666 | + if(empty($data['newPassword'])){ | ||
667 | + $this->apiResponse('0','请输入新密码'); | ||
668 | + } | ||
669 | + if(empty($data['sureNewPassword'])){ | ||
670 | + $this->apiResponse('0','请输入确认新密码'); | ||
671 | + } | ||
672 | + $where_mem['tel'] = $data['tel']; | ||
673 | + $where_mem['status'] = array('neq',9); | ||
674 | + $is = Db::name('Member')->where($where_mem)->field('id')->find(); | ||
675 | + if(!$is){ | ||
676 | + $this->apiResponse('0','该手机号暂未注册'); | ||
677 | + } | ||
678 | + if($data['newPassword'] == $data['sureNewPassword']){ | ||
679 | + $where_update['tel'] = $data['tel']; | ||
680 | + $middleStr = rand(1000,9999).time().rand(100,999); | ||
681 | + $update['token'] = $this->md5($middleStr); | ||
682 | + $update['password'] = $this->md5($data['newPassword']); | ||
683 | + $is_update = Db::name('Member')->where($where_update)->update($update); | ||
684 | + if($is_update){ | ||
685 | + $this->apiResponse('1','成功',$update['token']); | ||
686 | + }else{ | ||
687 | + $this->apiResponse('0','修改失败'); | ||
688 | + } | ||
689 | + }else{ | ||
690 | + $this->apiResponse('0','两次密码输入不一致'); | ||
691 | + } | ||
692 | + | ||
693 | + }else{ | ||
694 | + // 返回验证码图片 | ||
695 | + $img = $this->getImgUrl(); | ||
696 | + $this->apiResponse('1','成功',$img); | ||
697 | + } | ||
698 | + } | ||
699 | + | ||
700 | + | ||
701 | + | ||
702 | + /** | ||
602 | * @title 密码找回(sure) | 703 | * @title 密码找回(sure) |
603 | * @description 接口说明 | 704 | * @description 接口说明 |
604 | * @author 开发者 | 705 | * @author 开发者 |
@@ -635,6 +736,7 @@ class UserController extends CommonController | @@ -635,6 +736,7 @@ class UserController extends CommonController | ||
635 | if(!$is){ | 736 | if(!$is){ |
636 | $this->apiResponse('0','该手机号暂未注册'); | 737 | $this->apiResponse('0','该手机号暂未注册'); |
637 | } | 738 | } |
739 | + | ||
638 | // 验证手机验证码 | 740 | // 验证手机验证码 |
639 | $where_Code['tel'] = $data['tel']; | 741 | $where_Code['tel'] = $data['tel']; |
640 | $where_Code['type'] = 2; | 742 | $where_Code['type'] = 2; |
@@ -671,6 +773,7 @@ class UserController extends CommonController | @@ -671,6 +773,7 @@ class UserController extends CommonController | ||
671 | 773 | ||
672 | 774 | ||
673 | 775 | ||
776 | + | ||
674 | /** | 777 | /** |
675 | * @title 绑定银行卡(sure) | 778 | * @title 绑定银行卡(sure) |
676 | * @description 接口说明 | 779 | * @description 接口说明 |
@@ -911,7 +1014,7 @@ class UserController extends CommonController | @@ -911,7 +1014,7 @@ class UserController extends CommonController | ||
911 | $where_comment['need_id'] = $unv['id']; | 1014 | $where_comment['need_id'] = $unv['id']; |
912 | $where_comment['user_id'] = $unv['user_id']; | 1015 | $where_comment['user_id'] = $unv['user_id']; |
913 | $where_comment['status'] = 1; | 1016 | $where_comment['status'] = 1; |
914 | - $comment = Db::name('Comment')->where($where_comment)->field('is_comment,create_time')->find(); | 1017 | + $comment = Db::name('Comment')->where($where_comment)->field('is_comment,create_time,content')->find(); |
915 | if($comment){ | 1018 | if($comment){ |
916 | // 判断是否超过30天 | 1019 | // 判断是否超过30天 |
917 | if(time() > ($comment['create_time'] + 2592000)){ | 1020 | if(time() > ($comment['create_time'] + 2592000)){ |
@@ -923,6 +1026,7 @@ class UserController extends CommonController | @@ -923,6 +1026,7 @@ class UserController extends CommonController | ||
923 | $user_need[$unk]['comment'] = 1; | 1026 | $user_need[$unk]['comment'] = 1; |
924 | } | 1027 | } |
925 | } | 1028 | } |
1029 | + $user_need[$unk]['comment_content'] = $comment['content']; | ||
926 | }else{ | 1030 | }else{ |
927 | $user_need[$unk]['comment'] = 2; | 1031 | $user_need[$unk]['comment'] = 2; |
928 | } | 1032 | } |
@@ -1029,7 +1133,7 @@ class UserController extends CommonController | @@ -1029,7 +1133,7 @@ class UserController extends CommonController | ||
1029 | ->where($where_agency) | 1133 | ->where($where_agency) |
1030 | ->join("hp_Member m", 'm.id = a.agency_id') | 1134 | ->join("hp_Member m", 'm.id = a.agency_id') |
1031 | ->field('a.*,a.id as intermediary_id, | 1135 | ->field('a.*,a.id as intermediary_id, |
1032 | - m.id as user_id,m.name,m.company,m.store,m.tel,m.reputation,m.start') | 1136 | + m.id as user_id,m.name,m.company,m.pic,m.store,m.tel,m.reputation,m.start') |
1033 | ->select()->toArray(); | 1137 | ->select()->toArray(); |
1034 | if($agency){ | 1138 | if($agency){ |
1035 | foreach ($agency as $agek=>$agev){ | 1139 | foreach ($agency as $agek=>$agev){ |
@@ -1040,6 +1144,9 @@ class UserController extends CommonController | @@ -1040,6 +1144,9 @@ class UserController extends CommonController | ||
1040 | $agency[$agek]['deed_tax'] = $this->getStr($agev['deed_tax']); | 1144 | $agency[$agek]['deed_tax'] = $this->getStr($agev['deed_tax']); |
1041 | $agency[$agek]['personal_income_tax'] = $this->getStr($agev['personal_income_tax']); | 1145 | $agency[$agek]['personal_income_tax'] = $this->getStr($agev['personal_income_tax']); |
1042 | $agency[$agek]['else_tax'] = $this->getStr($agev['else_tax']); | 1146 | $agency[$agek]['else_tax'] = $this->getStr($agev['else_tax']); |
1147 | + if(!empty($agev['pic'])) { | ||
1148 | + $agency[$agek]['pic'] = cmf_get_asset_url($agev['pic']); | ||
1149 | + } | ||
1043 | } | 1150 | } |
1044 | $final['agency'] = $agency; | 1151 | $final['agency'] = $agency; |
1045 | $this->apiResponse('1','成功',$final); | 1152 | $this->apiResponse('1','成功',$final); |
@@ -1318,7 +1425,7 @@ class UserController extends CommonController | @@ -1318,7 +1425,7 @@ class UserController extends CommonController | ||
1318 | $find = Db::name('UserNeed')->alias('n') | 1425 | $find = Db::name('UserNeed')->alias('n') |
1319 | ->where($where_find) | 1426 | ->where($where_find) |
1320 | ->join("Agency a",'a.need_id = n.id') | 1427 | ->join("Agency a",'a.need_id = n.id') |
1321 | - ->field("a.id as intermediary_id") | 1428 | + ->field("a.agency_id,a.id as intermediary_id") |
1322 | ->find(); | 1429 | ->find(); |
1323 | if($find){ | 1430 | if($find){ |
1324 | $where_first['id'] = $data['need_id']; | 1431 | $where_first['id'] = $data['need_id']; |
@@ -1377,8 +1484,17 @@ class UserController extends CommonController | @@ -1377,8 +1484,17 @@ class UserController extends CommonController | ||
1377 | public function getMoney(Request $request){ | 1484 | public function getMoney(Request $request){ |
1378 | Db::startTrans(); | 1485 | Db::startTrans(); |
1379 | $data = $request->param(); | 1486 | $data = $request->param(); |
1487 | + | ||
1380 | $where_member['token'] = $data['token']; | 1488 | $where_member['token'] = $data['token']; |
1381 | $member = Db::name('Member')->where($where_member)->field('id,money,type')->find(); | 1489 | $member = Db::name('Member')->where($where_member)->field('id,money,type')->find(); |
1490 | + $where_card['user_id'] = $member['id']; | ||
1491 | + $where_card['status'] = 1; | ||
1492 | + $card = Db::name('Card')->where($where_card)->find(); | ||
1493 | + if(!$card){ | ||
1494 | + $this->apiResponse('0','请先绑定银行卡'); | ||
1495 | + }else{ | ||
1496 | + $final['card'] = $card; | ||
1497 | + } | ||
1382 | if($member['money'] <= 0){ | 1498 | if($member['money'] <= 0){ |
1383 | $this->apiResponse('0','用户余额不足'); | 1499 | $this->apiResponse('0','用户余额不足'); |
1384 | } | 1500 | } |
@@ -1388,14 +1504,7 @@ class UserController extends CommonController | @@ -1388,14 +1504,7 @@ class UserController extends CommonController | ||
1388 | Db::rollback(); | 1504 | Db::rollback(); |
1389 | $this->apiResponse('0','用户信息错误'); | 1505 | $this->apiResponse('0','用户信息错误'); |
1390 | } | 1506 | } |
1391 | - $where_card['user_id'] = $member['id']; | ||
1392 | - $where_card['status'] = 1; | ||
1393 | - $card = Db::name('Card')->where($where_card)->find(); | ||
1394 | - if(!$card){ | ||
1395 | - $this->apiResponse('0','请先绑定银行卡'); | ||
1396 | - }else{ | ||
1397 | - $final['card'] = $card; | ||
1398 | - } | 1507 | + |
1399 | $where_umoney['user_id'] = $member['id']; | 1508 | $where_umoney['user_id'] = $member['id']; |
1400 | $where_umoney['user_type'] = $member['type']; | 1509 | $where_umoney['user_type'] = $member['type']; |
1401 | // if($member['type'] == 1){ | 1510 | // if($member['type'] == 1){ |
@@ -1446,9 +1555,15 @@ class UserController extends CommonController | @@ -1446,9 +1555,15 @@ class UserController extends CommonController | ||
1446 | ->join('Bank b','b.id=c.bank_id') | 1555 | ->join('Bank b','b.id=c.bank_id') |
1447 | ->where($where_card) | 1556 | ->where($where_card) |
1448 | ->field('b.name,c.card_num')->find(); | 1557 | ->field('b.name,c.card_num')->find(); |
1558 | + if(!$card){ | ||
1559 | + $final['is_getmoney'] = 0; | ||
1560 | + }else{ | ||
1561 | + $final['is_getmoney'] = 1; | ||
1562 | + } | ||
1449 | $final['card'] = $card; | 1563 | $final['card'] = $card; |
1450 | $where_umoney['user_id'] = $user['id']; | 1564 | $where_umoney['user_id'] = $user['id']; |
1451 | $where_umoney['status'] = array('neq',9); | 1565 | $where_umoney['status'] = array('neq',9); |
1566 | + $where_umoney['order_type'] = array('in','6,7'); | ||
1452 | $order_list = Db::name('MoneyDetail')->where($where_umoney)->field('id,title,money,update_time,type')->select()->toArray(); | 1567 | $order_list = Db::name('MoneyDetail')->where($where_umoney)->field('id,title,money,update_time,type')->select()->toArray(); |
1453 | $final['user'] = $user; | 1568 | $final['user'] = $user; |
1454 | if($order_list){ | 1569 | if($order_list){ |
@@ -76,6 +76,51 @@ class UserneedController extends CommonController | @@ -76,6 +76,51 @@ class UserneedController extends CommonController | ||
76 | } | 76 | } |
77 | } | 77 | } |
78 | 78 | ||
79 | + /** | ||
80 | + * @title 用户发布需求验证(sure) | ||
81 | + * @description 接口说明 | ||
82 | + * @author 开发者 | ||
83 | + * @url /api/portal/UserNeed/judge | ||
84 | + * @method POST | ||
85 | + * @param name:name type:varchar require:1 default: other: desc:联系人姓名 | ||
86 | + * @param name:tel type:varchar require:1 default: other: desc:联系人电话 | ||
87 | + * @param name:code type:int require:1 default: other: desc:验证码 | ||
88 | + * @param name:token type:varchar require:1 default: other: desc:token | ||
89 | + * @return data:'' | ||
90 | + */ | ||
91 | + public function judge(Request $request){ | ||
92 | + $data = $request->param(); | ||
93 | + if(empty($data['name'])){ | ||
94 | + $this->apiResponse('0','联系人姓名不能为空'); | ||
95 | + } | ||
96 | + if(empty($data['tel'])){ | ||
97 | + $this->apiResponse('0','联系人电话不能为空'); | ||
98 | + } | ||
99 | + | ||
100 | + if(empty($data['code'])){ | ||
101 | + $this->apiResponse('0','验证码不能为空'); | ||
102 | + }else{ | ||
103 | + $code = $data['code']; | ||
104 | + } | ||
105 | + $where_code['tel'] = $data['tel']; | ||
106 | + $where_code['type'] = 3; | ||
107 | + $where_code['status'] = 1; | ||
108 | + $where_code['create_time'] = array('egt',(time()-300)); | ||
109 | + $find_code = Db::name('Code')->where($where_code)->order('create_time')->field('code')->find(); | ||
110 | + if(!$find_code){ | ||
111 | + $this->apiResponse('0','验证码错误,请重新获取'); | ||
112 | + } | ||
113 | + if($code != $find_code['code']){ | ||
114 | + $this->apiResponse('0','验证码错误,请重新获取'); | ||
115 | + }else{ | ||
116 | + $updateCode['status'] = 9; | ||
117 | + Db::name('Code')->where($where_code)->update($updateCode); | ||
118 | + $this->apiResponse('1','成功'); | ||
119 | + } | ||
120 | + } | ||
121 | + | ||
122 | + | ||
123 | + | ||
79 | 124 | ||
80 | /** | 125 | /** |
81 | * @title 用户发布需求(sure) | 126 | * @title 用户发布需求(sure) |
@@ -97,6 +142,7 @@ class UserneedController extends CommonController | @@ -97,6 +142,7 @@ class UserneedController extends CommonController | ||
97 | * @param name:name type:varchar require:1 default: other: desc:联系人姓名 | 142 | * @param name:name type:varchar require:1 default: other: desc:联系人姓名 |
98 | * @param name:tel type:varchar require:1 default: other: desc:联系人电话 | 143 | * @param name:tel type:varchar require:1 default: other: desc:联系人电话 |
99 | * @param name:code type:int require:1 default: other: desc:验证码 | 144 | * @param name:code type:int require:1 default: other: desc:验证码 |
145 | + * @param name:gener type:int require:1 default: other: desc:类型(1->PC,2->手机) | ||
100 | * @param name:else type:int require:1 default: other: desc:备注 | 146 | * @param name:else type:int require:1 default: other: desc:备注 |
101 | * @param name:token type:varchar require:1 default: other: desc:token | 147 | * @param name:token type:varchar require:1 default: other: desc:token |
102 | * @return data:''@ | 148 | * @return data:''@ |
@@ -111,34 +157,40 @@ class UserneedController extends CommonController | @@ -111,34 +157,40 @@ class UserneedController extends CommonController | ||
111 | // 判空,处理 | 157 | // 判空,处理 |
112 | $validate = Loader::validate('UserNeed'); | 158 | $validate = Loader::validate('UserNeed'); |
113 | if(!$validate->check($_POST)){ | 159 | if(!$validate->check($_POST)){ |
114 | - return json(array('code'=>0,'message'=>$validate->getError())); | 160 | + $this->apiResponse('0',$validate->getError()); |
115 | } | 161 | } |
116 | // 加数据库 | 162 | // 加数据库 |
117 | - | ||
118 | $data = $request->Post(); | 163 | $data = $request->Post(); |
119 | - if(empty($data['code'])){ | ||
120 | - Db::rollback(); | ||
121 | - $this->apiResponse('0','验证码不能为空'); | ||
122 | - }else{ | ||
123 | - $code = $data['code']; | ||
124 | - } | ||
125 | - $where_code['tel'] = $data['tel']; | ||
126 | - $where_code['type'] = 3; | ||
127 | - $where_code['status'] = 1; | ||
128 | - $where_code['create_time'] = array('egt',(time()-300)); | ||
129 | - $find_code = Db::name('Code')->where($where_code)->order('create_time')->field('code')->find(); | ||
130 | - if(!$find_code){ | ||
131 | - Db::rollback(); | ||
132 | - $this->apiResponse('0','验证码错误,请重新获取'); | ||
133 | - } | ||
134 | - if($code != $find_code['code']){ | ||
135 | - Db::rollback(); | ||
136 | - $this->apiResponse('0','验证码错误,请重新获取'); | 164 | + if(empty($data['gener'])){ |
165 | + $this->apiResponse('0','请传类型'); | ||
137 | }else{ | 166 | }else{ |
138 | - $updateCode['status'] = 9; | ||
139 | - Db::name('Code')->where($where_code)->update($updateCode); | 167 | + if($data['gener'] == 2){ |
168 | + if(empty($data['code'])){ | ||
169 | + Db::rollback(); | ||
170 | + $this->apiResponse('0','验证码不能为空'); | ||
171 | + }else{ | ||
172 | + $code = $data['code']; | ||
173 | + } | ||
174 | + $where_code['tel'] = $data['tel']; | ||
175 | + $where_code['type'] = 3; | ||
176 | + $where_code['status'] = 1; | ||
177 | + $where_code['create_time'] = array('egt',(time()-300)); | ||
178 | + $find_code = Db::name('Code')->where($where_code)->order('create_time')->field('code')->find(); | ||
179 | + if(!$find_code){ | ||
180 | + Db::rollback(); | ||
181 | + $this->apiResponse('0','验证码错误,请重新获取'); | ||
182 | + } | ||
183 | + if($code != $find_code['code']){ | ||
184 | + Db::rollback(); | ||
185 | + $this->apiResponse('0','验证码错误,请重新获取'); | ||
186 | + }else{ | ||
187 | + $updateCode['status'] = 9; | ||
188 | + Db::name('Code')->where($where_code)->update($updateCode); | ||
189 | + } | ||
190 | + } | ||
140 | } | 191 | } |
141 | 192 | ||
193 | + | ||
142 | // 保证金 | 194 | // 保证金 |
143 | $city = $data['city']; | 195 | $city = $data['city']; |
144 | $area = $data['area']; | 196 | $area = $data['area']; |
@@ -175,7 +227,10 @@ class UserneedController extends CommonController | @@ -175,7 +227,10 @@ class UserneedController extends CommonController | ||
175 | $data['user_id'] = $mem_id['id']; | 227 | $data['user_id'] = $mem_id['id']; |
176 | $model = new UserNeedModel(); | 228 | $model = new UserNeedModel(); |
177 | // 添加 | 229 | // 添加 |
178 | - unset($data['code']); | 230 | + if($data['gener'] == 2){ |
231 | + unset($data['code']); | ||
232 | + } | ||
233 | + unset($data['gener']); | ||
179 | unset($data['connect']); | 234 | unset($data['connect']); |
180 | unset($data['token']); | 235 | unset($data['token']); |
181 | $save = $model->save($data); | 236 | $save = $model->save($data); |
@@ -27,7 +27,6 @@ class UserNeedValidate extends Validate | @@ -27,7 +27,6 @@ class UserNeedValidate extends Validate | ||
27 | 'quotation_time' => 'require', | 27 | 'quotation_time' => 'require', |
28 | 'name' => 'require', | 28 | 'name' => 'require', |
29 | 'tel' => 'require', | 29 | 'tel' => 'require', |
30 | - 'code' => 'require', | ||
31 | 'contract' => 'require', | 30 | 'contract' => 'require', |
32 | ]; | 31 | ]; |
33 | protected $message = [ | 32 | protected $message = [ |
@@ -43,7 +42,6 @@ class UserNeedValidate extends Validate | @@ -43,7 +42,6 @@ class UserNeedValidate extends Validate | ||
43 | 'quotation_time.require' => '报价时间不能为空!', | 42 | 'quotation_time.require' => '报价时间不能为空!', |
44 | 'name.require' => '联系人姓名不能为空!', | 43 | 'name.require' => '联系人姓名不能为空!', |
45 | 'tel.require' => '联系人电话不能为空!', | 44 | 'tel.require' => '联系人电话不能为空!', |
46 | - 'code.require' => '验证码不能为空!', | ||
47 | 'contract.require' => '请选择是否包干价!', | 45 | 'contract.require' => '请选择是否包干价!', |
48 | ]; | 46 | ]; |
49 | 47 |
@@ -63,7 +63,7 @@ class BannerController extends AdminBaseController | @@ -63,7 +63,7 @@ class BannerController extends AdminBaseController | ||
63 | } | 63 | } |
64 | } | 64 | } |
65 | $coo_list = Db::name('Banner')->where($where_coo)->order('score desc , create_time desc') | 65 | $coo_list = Db::name('Banner')->where($where_coo)->order('score desc , create_time desc') |
66 | - ->paginate(1,false,['query'=>$arr]); | 66 | + ->paginate(10,false,['query'=>$arr]); |
67 | // ->select()->toArray(); | 67 | // ->select()->toArray(); |
68 | $page = $coo_list->render(); | 68 | $page = $coo_list->render(); |
69 | $this->assign('page',$page); | 69 | $this->assign('page',$page); |
@@ -41,17 +41,17 @@ class IndexController extends CommonController | @@ -41,17 +41,17 @@ class IndexController extends CommonController | ||
41 | // ]; | 41 | // ]; |
42 | // $this->redirect($back['alipay_url']); | 42 | // $this->redirect($back['alipay_url']); |
43 | 43 | ||
44 | - $data = [ | ||
45 | - 'out_trade_no'=>'2018072798495757', | ||
46 | - 'trade_no'=>'2018072721001004410589897579', | ||
47 | - 'out_request_no'=>'2018072798495757', | ||
48 | - 'refund_amount'=>0.01, | ||
49 | - 'refund_reason'=>'中介报价少于3人退款' | ||
50 | - ]; | ||
51 | - $alipay = controller('Alipay'); | ||
52 | - $result = $alipay->refundquery($data); | ||
53 | - $object = $result->alipay_trade_fastpay_refund_query_response; | ||
54 | - var_dump($result->alipay_trade_fastpay_refund_query_response); | 44 | +// $data = [ |
45 | +// 'out_trade_no'=>'2018072798495757', | ||
46 | +// 'trade_no'=>'2018072721001004410589897579', | ||
47 | +// 'out_request_no'=>'2018072798495757', | ||
48 | +// 'refund_amount'=>0.01, | ||
49 | +// 'refund_reason'=>'中介报价少于3人退款' | ||
50 | +// ]; | ||
51 | +// $alipay = controller('Alipay'); | ||
52 | +// $result = $alipay->refundquery($data); | ||
53 | +// $object = $result->alipay_trade_fastpay_refund_query_response; | ||
54 | +// var_dump($result->alipay_trade_fastpay_refund_query_response); | ||
55 | 55 | ||
56 | // echo "<pre/>"; | 56 | // echo "<pre/>"; |
57 | // print_r('7777'); | 57 | // print_r('7777'); |
此 diff 太大无法显示。
此 diff 太大无法显示。
-
请 注册 或 登录 后发表评论