123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- <?php
- namespace app\api\controller;
- use think\Console;
- use think\Db;
- use think\Request;
- use app\common\model\User as Users;
- use think\facade\Validate;
- use app\common\controller\Api;
- class User extends Api
- {
-
- public function wechat_login(){
- $code = input('code');
- if (!$code) $this->error('code为空');
- $rawData = input('rawData');
- $result = Users::wechatLogin($code,$rawData);
- if ($result['code']){
- $this->success($result['msg'],$result['data']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function userinfo(){
- $this->check_login();
- $userinfo = Users::getUserInfo();
- $this->success('成功',$userinfo);
- }
-
- public function perfect_information_one(){
- $this->check_login();
- $data = input();
- if (!Validate::regex($data['phone'], "^1\d{10}$")) {
- $this->error('手机号格式错误');
- }
- $data['imgs'] = implode(',',$data['imgs']);
-
- $data['age'] = date('Y',time())-date('Y',strtotime($data['date_of_birth']));
- $result = Users::perfectInformation($data);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function perfect_information_two(){
- $this->check_login();
- $data = input();
- if (isset($data['introduce_myself_imgs']))
- $data['introduce_myself_imgs'] = implode(',',$data['introduce_myself_imgs']);
- if (isset($data['family_background_imgs']))
- $data['family_background_imgs'] = implode(',',$data['family_background_imgs']);
- if (isset($data['interests_hobbies_imgs']))
- $data['interests_hobbies_imgs'] = implode(',',$data['interests_hobbies_imgs']);
- if (isset($data['love_imgs']))
- $data['love_imgs'] = implode(',',$data['love_imgs']);
- if (isset($data['other_half_imgs']))
- $data['other_half_imgs'] = implode(',',$data['other_half_imgs']);
- if (isset($data['why_single_imgs']))
- $data['why_single_imgs'] = implode(',',$data['why_single_imgs']);
- if (isset($data['look_life_imgs']))
- $data['look_life_imgs'] = implode(',',$data['look_life_imgs']);
- $result = Users::perfectInformation($data);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function perfect_information_three(){
- $this->check_login();
- $data = input();
- $data['label'] = implode(',',$data['label']);
- $result = Users::perfectInformation($data);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function requirements_to_other(){
- $this->check_login();
- $data = input();
- if (!$data['hope_age'] || !$data['hope_height'] || !$data['hope_city'] || !$data['hope_hometown'] || !$data['hope_marriage'])
- $this->error('参数错误');
- $result = Users::perfectInformation($data);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function real_auth(){
- $this->check_login();
- $data = input();
- if (!$data['real_auth_img'] || !$data['real_auth_name'] || !$data['real_auth_id'])
- $this->error('参数错误');
- $data['real_auth_img'] = implode(',',$data['real_auth_img']);
- if (!Users::check_auth(1))
- $this->error('已认证成功');
- $result = Users::perfectInformation($data);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function work_auth(){
- $this->check_login();
- $data = input();
- if (!$data['work_auth_img'] || !$data['work_auth_company_name'] || !$data['shielding_colleagues_switch'])
- $this->error('参数错误');
- $data['work_auth_img'] = implode(',',$data['work_auth_img']);
- if (!Users::check_auth(2))
- $this->error('已认证成功');
- $result = Users::perfectInformation($data);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function education_auth(){
- $this->check_login();
- $data = input();
- if (!$data['education_auth_img'] || !$data['education_auth_school'] || !$data['education'])
- $this->error('参数错误');
- $data['education_auth_img'] = implode(',',$data['education_auth_img']);
- if (!Users::check_auth(3))
- $this->error('已认证成功');
- $result = Users::perfectInformation($data);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function cardiac_area(){
- $this->check_login();
- $Nowpage = input('page') ? input('page') : 1;
- $limits = input("limit") ? input("limit") : 10;
- $result = Users::cardiacArea($Nowpage,$limits);
- $this->success($result['msg'],$result['data']);
- }
-
- public function elect_area(){
- $this->check_login();
- $Nowpage = input('page') ? input('page') : 1;
- $limits = input("limit") ? input("limit") : 10;
- $result = Users::electArea($Nowpage,$limits);
- $this->success($result['msg'],$result['data']);
- }
-
- public function my_integral(){
- $this->check_login();
- $Nowpage = input('page') ? input('page') : 1;
- $limits = input("limit") ? input("limit") : 10;
- $type = input('type');
- $result = Users::myIntegral($Nowpage,$limits,$type);
- $this->success($result['msg'],$result['data']);
- }
-
- public function message(){
- $this->check_login();
- $Nowpage = input('page') ? input('page') : 1;
- $limits = input("limit") ? input("limit") : 10;
- $result = Users::message($Nowpage,$limits);
- $this->success($result['msg'],$result['data']);
- }
-
- public function read_message(){
- $this->check_login();
- $message_id = input('message_id');
- if (!$message_id) $this->error('消息ID为空');
- $result = Users::readMessage($message_id);
- $this->success($result['msg'],$result['data']);
- }
-
- public function message_count(){
- $result = Users::messageCount();
- $this->success($result['msg'],$result['data']);
- }
-
- public function privacy_settings(){
- $this->check_login();
- $data = input();
- $result = Users::perfectInformation($data);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function collect_user(){
- $this->check_login();
- $user_id = intval(input('user_id'));
- if (!$user_id) $this->error('用户ID为空!');
- $result = Users::collectUser($user_id);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function del_collect_user(){
- $this->check_login();
- $user_id = intval(input('user_id'));
- if (!$user_id) $this->error('用户ID为空!');
- $result = Users::delCollectUser($user_id);
- if ($result['code']){
- $this->success($result['msg']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function collect_list(){
- $this->check_login();
- $result = Users::collectList();
- if ($result['code']){
- $this->success($result['msg'],$result['data']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function privilege_price_list(){
- $result = Users::privilegePriceList();
- $this->success($result['msg'],$result['data']);
- }
-
- public function open_privilege(){
- $this->check_login();
- $privilege_id = intval(input('privilege_id'));
- if (!$privilege_id) $this->error('参数错误');
- $result = Users::openPrivilege($privilege_id);
- if ($result['code']){
- $this->success($result['msg'],$result['data']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function want_to_me_list(){
- $this->check_login();
- $Nowpage = input('page',1);
- $limits = input("limit",10);
- $result = Users::wantToMeList($Nowpage,$limits);
- $this->success($result['msg'],$result['data']);
- }
-
- public function receive_want_know(){
- $this->check_login();
- $result = Users::ReceiveWantKnow();
- $this->success($result['msg'],$result['data']);
- }
-
- public function apply_want_know(){
- $this->check_login();
- $result = Users::ApplyWantKnow();
- $this->success($result['msg'],$result['data']);
- }
-
- public function want_know_detail(){
- $this->check_login();
- $id = intval(input('id'));
- if (!$id) $this->error('参数错误');
- $result = Users::WantKnowDetail($id);
- $this->success($result['msg'],$result['data']);
- }
-
- public function friend_list(){
- $this->check_login();
- $result = Users::FriendList();
- $this->success($result['msg'],$result['data']);
- }
-
- public function icon_list(){
- $this->check_login();
- $result = Users::IconList();
- $this->success($result['msg'],$result['data']);
- }
-
- public function cancellation_account(){
- $result = Users::cancellationAccount();
- if ($result['code']){
- $this->success($result['msg'],$result['data']);
- }else{
- $this->error($result['msg']);
- }
- }
-
- public function login_out(){
- app()->session->clear();
- app()->session->destroy();
- $this->success('退出登录成功!');
- }
- }
|