UserNeedController.php
2.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
<?php
// +----------------------------------------------------------------------
// | ThinkCMF [ WE CAN DO IT MORE SIMPLE ]
// +----------------------------------------------------------------------
// | Copyright (c) 2013-2017 http://www.thinkcmf.com All rights reserved.
// +----------------------------------------------------------------------
// | Author: wuwu <15093565100@163.com>
// +----------------------------------------------------------------------
namespace api\portal\controller;
use api\portal\model\MemberModel;
use api\portal\model\PortalPostModel;
use cmf\controller\RestBaseController;
use think\Db;
use think\Request;
use think\Loader;
use think\Config;
use think\captcha\Captcha;
use think\Url;
use SmsDemo;
//use think\Route;
/**
* @title 用户接口
* @description 接口说明
* @group 接口分组
*/
class UserNeedController extends CommonController
{
protected $postModel;
public function __construct(PortalPostModel $postModel)
{
parent::__construct();
$this->postModel = $postModel;
}
/**
* @title 用户发布需求的保证金
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/payMoney
* @method POST
* @param name:city type:int require:1 default: other: desc:地区
* @param name:quarters type:int require:1 default: other: desc:小区
* @param name:password type:int require:1 default: other: desc:密码
*/
public function payMoney(Request $request){
$data = $request->param();
if(!$data['city'] || !$data['area'] ){
$this->apiResponse('0','城市、面积不能为空');
}
$city = $data['city'];
$area = $data['area'];
}
/**
* @title 用户发布需求
* @description 接口说明
* @author 开发者
* @url /api/portal/UserNeed/send
* @method POST
* @param name:city type:int require:1 default: other: desc:地区
* @param name:quarters type:int require:1 default: other: desc:小区
* @param name:password type:int require:1 default: other: desc:密码
*/
public function send(Request $request)
{
if($request->Post()){
$data = $request->param();
// 判空,处理
// 加数据库
}else{
// 问答内容
$where_pro['status'] = 1;
$list = Db::name('NeedAnswer')->where($where_pro)->order("update_time desc")->find();
if($list){
$this->apiResponse('1','成功',$list);
}else{
$this->apiResponse('0','暂无内容');
}
}
}
}