切换导航条
此项目
正在载入...
登录
郭盛
/
enterprise
·
提交
转到一个项目
GitLab
转到仪表盘
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
何书鹏
4 years ago
提交
b7d1a53775d96b83305e45bea7428fadc8bfdfc7
1 个父辈
e25a45ac
1 个管道 的构建
通过
耗费 0 秒
密卷是否已购买
变更
2
构建
1
隐藏空白字符变更
内嵌
并排对比
正在显示
2 个修改的文件
包含
73 行增加
和
3 行删除
application/mobile/controller/Secret.php
public/mobile.html
application/mobile/controller/Secret.php
查看文件 @
b7d1a53
...
...
@@ -11,6 +11,7 @@ use app\mobile\model\CompanyUser;
use
addons\epay\library\Service
;
use
app\mobile\model\Question
;
use
app\mobile\model\QuestionAnswer
;
use
app\mobile\model\User
;
/**
* 密卷接口
...
...
@@ -42,15 +43,62 @@ class Secret extends Api
"title": "测试密卷", //密卷标题
"do_num": 20, //做过人数
"current_price": "10.00", //现价
"original_price": "10000.00" //原价
"original_price": "10000.00", //原价
"is_buy": 0 //是否已购买:0=否,1=是
}]
})
*/
public
function
index
()
{
$list
=
$this
->
model
->
order
(
'createtime desc'
)
->
select
();
// 我加入的企业购买的密卷
$company_secret_list
=
SecretOrder
::
alias
(
'a'
)
->
join
(
'mobile_company_user b'
,
'b.company_id = a.company_id'
)
->
where
(
'b.user_id'
,
$this
->
auth
->
id
)
->
where
(
'b.status'
,
'1'
)
->
field
(
'a.id,a.company_id,a.people_num,a.is_top'
)
->
select
();
// 查询我是否可以享受企业密卷(按企业审核时间排队,没在队伍里就无法享受企业密卷)
$secret_id_arr
=
[];
foreach
(
$company_secret_list
as
$v
)
{
if
(
$v
[
'is_top'
]
==
'1'
){
$secret_id_arr
[]
=
$v
[
'id'
];
continue
;
}
$user_id_arr
=
CompanyUser
::
where
(
'company_id'
,
$v
[
'company_id'
])
->
where
(
'status'
,
'1'
)
->
order
(
'updatetime asc'
)
->
limit
(
$v
[
'people_num'
])
->
column
(
'user_id'
);
if
(
in_array
(
$this
->
auth
->
id
,
$user_id_arr
)){
$secret_id_arr
[]
=
$v
[
'id'
];
}
}
// 查找所有我购买的和企业购买的密卷
$secret_order
=
SecretOrder
::
where
(
function
(
$query
)
use
(
$secret_id_arr
){
$query
->
where
(
'user_id'
,
$this
->
auth
->
id
)
->
whereor
(
'id'
,
'in'
,
$secret_id_arr
);
})
->
where
(
'pay_status'
,
'1'
)
->
limit
(
1
)
->
buildSql
();
$list
=
$this
->
model
->
alias
(
's'
)
->
join
([
$secret_order
=>
'so'
],
'so.secret_id = s.id'
,
'left'
)
->
field
(
"
s.*,
if(so.id > 0,1,0) is_buy
"
)
->
order
(
'createtime desc'
)
->
select
();
foreach
(
$list
as
$v
)
{
$v
->
visible
([
'id'
,
'title'
,
'do_num'
,
'current_price'
,
'original_price'
]);
$v
->
visible
([
'id'
,
'title'
,
'do_num'
,
'current_price'
,
'original_price'
])
->
append
([
'is_buy'
]);
}
$this
->
success
(
'成功'
,
$list
);
}
...
...
@@ -87,6 +135,28 @@ class Secret extends Api
}
/**
* @ApiTitle (获取用户身份)
* @ApiSummary (获取用户身份)
* @ApiMethod (POST)
*
* @ApiHeaders (name=token, type=string, required=true, description="请求的Token")
*
* @ApiReturn({
"code": 1,
"msg": "成功",
"time": "1599739316",
"data": {
"group_id": 1, //0=普通用户,1=企业用户
}
})
*/
public
function
getUserIdentity
()
{
$group_id
=
User
::
where
(
'id'
,
$this
->
auth
->
id
)
->
value
(
'group_id'
);
$this
->
success
(
'成功'
,
compact
(
'group_id'
));
}
/**
* @ApiTitle (选择规格)
* @ApiSummary (选择规格)
* @ApiMethod (POST)
...
...
public/mobile.html
查看文件 @
b7d1a53
此 diff 太大无法显示。
请
注册
或
登录
后发表评论