Team.php
4.2 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/**
* Created by PhpStorm.
* User: 86132
* Date: 2020/7/6
* Time: 10:13
*/
namespace app\api\controller;
use app\common\model\Company;
use think\Db;
use app\common\controller\Api;
/**
* 团队接口
*/
class Team extends Api
{
protected $noNeedLogin = ['*'];
protected $noNeedRight = '*';
public function _initialize()
{
parent::_initialize();
}
/**
* @ApiTitle (团队接口-类型,行业展示)
* @ApiSummary (类型,行业展示)
* @ApiMethod (POST)
* @ApiRoute (/api/Team/TypeIndustryList)
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
"data": [
{
"type2": [
{
"type": "类型",
"type_id": "id"
]
},
{
"industrys": [
{
"industry": "行业",
"industry_id": "id"
}
]
}
]
})
*/
public function TypeIndustryList()
{
$type = Db::name('type')->select();
$industry = Db::name('industry')->select();
foreach ($type as $k => $v) {
$type1[$k]['type'] = $v['type'];
$type1[$k]['type_id'] = $v['id'];
}
foreach ($industry as $k => $v) {
$industry1[$k]['industry'] = $v['industry'];
$industry1[$k]['industry_id'] = $v['id'];
}
$return[]['types'] = $type1;
$return[]['industrys'] = $industry1;
$this->success('成功', $return);
}
/**
* @ApiTitle (团队接口-申请公司团队)
* @ApiSummary (申请公司团队)
* @ApiMethod (POST)
* @ApiRoute (/api/Team/ApplicationCompanyTeam)
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
* @ApiParams (name="company_name", type="integer", required=true, description="公司名")
* @ApiParams (name="credit", type="integer", required=true, description="公司信用代码")
* @ApiParams (name="company_address", type="string", required=true, description="公司地址")
* @ApiParams (name="address_con", type="string", required=true, description="公司详细地址")
* @ApiParams (name="invoice_address", type="string", required=true, description="开票地址")
* @ApiParams (name="bank_name", type="string", required=true, description="银行名称")
* @ApiParams (name="bank_num", type="string", required=true, description="银行账号")
* @ApiParams (name="company_tel", type="string", required=true, description="公司电话")
* @ApiParams (name="type_id", type="int", required=true, description="类型")
* @ApiParams (name="industry_id", type="int", required=true, description="行业")
* @ApiParams (name="business_avatar", type="string", required=true, description="营业执照")
* @ApiReturnParams (name="code", type="integer", required=true, sample="0")
* @ApiReturnParams (name="msg", type="string", required=true, sample="返回成功")
* @ApiReturn ({
'code':'1',
'msg':'返回成功'
"data": "1"
})
*/
public function ApplicationCompanyTeam()
{
$user_id = $this->is_token($this->request->header());
$param = $this->request->param();
$data = [
'company_name' => $param['company_name'],
'credit' => $param['credit'],
'company_address' => $param['company_address'],
'address_con' => $param['address_con'],
'invoice_address' => $param['invoice_address'],
'bank_name' => $param['bank_name'],
'bank_num' => $param['bank_num'],
'company_tel' => $param['company_tel'],
'type_id' => $param['type_id'],
'industry_id' => $param['industry_id'],
'business_avatar' => $param['business_avatar'],
'status' => 2,
'company_holder' => $user_id
];
$model = new Company();
$res = $model->save($data);
if ($res) {
$this->success('成功', 1);
} else {
$this->error('失败', 0);
}
}
}