Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
I
introducer
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
introducer
Commits
d4303c1a
Commit
d4303c1a
authored
Jun 08, 2023
by
sugar
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'dev' of
http://rungit.jxdsy.cn:10000/sugar/introducer
into dev
parents
e1a70261
6f1f2467
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
21 deletions
+40
-21
application/api/controller/Users.php
application/api/controller/Users.php
+40
-21
No files found.
application/api/controller/Users.php
View file @
d4303c1a
...
...
@@ -18,6 +18,7 @@ use app\admin\model\users\Users as UsersModel;
use
app\admin\model\users\UsersAddr
;
use
app\admin\model\users\UserTranfer
;
use
app\admin\model\users\Withdraw
;
use
app\admin\model\users\Agent
as
AgentModel
;
use
app\api\model\PaymentLogModel
;
use
app\common\controller\Api
;
use
app\lib\utils\ErrorInfo
;
...
...
@@ -163,9 +164,26 @@ class Users extends Api
}
$userinfo
[
'invite_device_num'
]
=
\app\admin\model\order\Order
::
where
([
'share_id'
=>
$uid
,
'sale_status'
=>
2
])
->
sum
(
'num'
);
//推广设备数
$userinfo
[
'recharge_amount'
]
=
Config
::
get
(
'site.recharge_gift_pack'
);
$this
->
success
(
'获取用户信息成功'
,
[
'userinfo'
=>
$userinfo
]);
}
/**
* 身份接口
*/
public
function
getUserLevel
()
{
$uid
=
$this
->
auth
->
id
;
if
(
!
$uid
)
{
$this
->
error
(
'用户不存在'
);
}
$agentInfo
=
AgentModel
::
where
([
'agent_user_id'
=>
$uid
,
'status'
=>
1
,
'level'
=>
[
'>'
,
0
]])
->
find
();
if
(
!
$agentInfo
)
{
$agentInfo
[
'level'
]
=
0
;
$this
->
success
(
'获取用户信息成功'
,
[
'agentInfo'
=>
$agentInfo
]);
}
$this
->
success
(
'获取用户信息成功'
,
[
'agentInfo'
=>
$agentInfo
]);
}
/**
* 我的收入(包括单个设备的收入)
*/
...
...
@@ -473,22 +491,22 @@ class Users extends Api
{
$page
=
$this
->
request
->
post
(
'page'
,
1
);
$order_type
=
$this
->
request
->
post
(
'order_type'
,
7
);
//7=服务中心奖,8=推广奖励
$orderlist
=
\app\admin\model\order\Order
::
where
([
'order_type'
=>
$order_type
,
'user_id'
=>
$this
->
auth
->
id
])
$orderlist
=
\app\admin\model\order\Order
::
where
([
'order_type'
=>
$order_type
,
'user_id'
=>
$this
->
auth
->
id
])
->
field
(
'need_pay,FROM_UNIXTIME(createtime,"%Y-%m-%d %H:%i") as createtime'
)
->
page
(
$page
)
->
limit
(
$this
->
pageSize
)
->
select
();
foreach
(
$orderlist
as
$key
=>
$val
){
if
(
$order_type
==
7
)
{
foreach
(
$orderlist
as
$key
=>
$val
)
{
if
(
$order_type
==
7
)
{
$orderlist
[
$key
][
'title'
]
=
'服务中心奖记录'
;
}
else
{
}
else
{
$orderlist
[
$key
][
'title'
]
=
'推荐奖励记录'
;
}
}
$extend_money_sum
=
\app\admin\model\order\Order
::
where
([
'order_type'
=>
8
,
'user_id'
=>
$this
->
auth
->
id
])
->
sum
(
'need_pay'
);
//推广奖励总额
$service_money_sum
=
\app\admin\model\order\Order
::
where
([
'order_type'
=>
7
,
'user_id'
=>
$this
->
auth
->
id
])
->
sum
(
'need_pay'
);
//服务中心奖励总额
$total_money
=
$extend_money_sum
+
$service_money_sum
;
//累计总金额
$this
->
success
(
'获取成功'
,
[
'orderlist'
=>
$orderlist
,
'extend_money_sum'
=>
sprintf
(
'%.2f'
,
$extend_money_sum
),
'service_money_sum'
=>
sprintf
(
'%.2f'
,
$service_money_sum
),
'total_money'
=>
sprintf
(
'%.2f'
,
$total_money
)]);
$extend_money_sum
=
\app\admin\model\order\Order
::
where
([
'order_type'
=>
8
,
'user_id'
=>
$this
->
auth
->
id
])
->
sum
(
'need_pay'
);
//推广奖励总额
$service_money_sum
=
\app\admin\model\order\Order
::
where
([
'order_type'
=>
7
,
'user_id'
=>
$this
->
auth
->
id
])
->
sum
(
'need_pay'
);
//服务中心奖励总额
$total_money
=
$extend_money_sum
+
$service_money_sum
;
//累计总金额
$this
->
success
(
'获取成功'
,
[
'orderlist'
=>
$orderlist
,
'extend_money_sum'
=>
sprintf
(
'%.2f'
,
$extend_money_sum
),
'service_money_sum'
=>
sprintf
(
'%.2f'
,
$service_money_sum
),
'total_money'
=>
sprintf
(
'%.2f'
,
$total_money
)]);
}
/**
...
...
@@ -672,7 +690,7 @@ class Users extends Api
$is_default
=
$this
->
request
->
post
(
'is_default'
,
0
);
$name
=
$this
->
request
->
post
(
'name'
,
''
);
if
(
$is_default
==
1
)
{
UsersAddr
::
where
([
'user_id'
=>
$this
->
auth
->
id
,
'is_default'
=>
1
])
->
update
([
'is_default'
=>
0
]);
UsersAddr
::
where
([
'user_id'
=>
$this
->
auth
->
id
,
'is_default'
=>
1
])
->
update
([
'is_default'
=>
0
]);
}
$user_addr
=
[
'user_id'
=>
$this
->
auth
->
id
,
...
...
@@ -707,7 +725,7 @@ class Users extends Api
'address'
=>
$params
[
'address'
],
];
if
(
isset
(
$params
[
'is_default'
])
&&
$params
[
'is_default'
]
==
1
)
{
UsersAddr
::
where
([
'user_id'
=>
$this
->
auth
->
id
,
'is_default'
=>
1
])
->
update
([
'is_default'
=>
0
]);
UsersAddr
::
where
([
'user_id'
=>
$this
->
auth
->
id
,
'is_default'
=>
1
])
->
update
([
'is_default'
=>
0
]);
}
$res
=
UsersAddr
::
where
([
'id'
=>
$params
[
'addr_id'
]])
->
update
(
$user_addr
);
$this
->
success
(
'修改成功'
,
[
'user_addr'
=>
$res
]);
...
...
@@ -728,20 +746,21 @@ class Users extends Api
/**
* 获取手机号
*/
public
function
getUsersMobile
(){
$code
=
$this
->
request
->
post
(
"code"
);
if
(
empty
(
$code
)){
public
function
getUsersMobile
()
{
$code
=
$this
->
request
->
post
(
"code"
);
if
(
empty
(
$code
))
{
$this
->
error
(
"参数错误"
);
}
$error
=
new
ErrorInfo
();
$phonenumber
=
WXPayConstants
::
getuserphonenumber
(
$code
,
$error
);
if
(
$error
->
code
<
0
)
{
$error
=
new
ErrorInfo
();
$phonenumber
=
WXPayConstants
::
getuserphonenumber
(
$code
,
$error
);
if
(
$error
->
code
<
0
)
{
$this
->
error
(
$error
->
msg
);
}
if
(
!
$this
->
auth
->
mobile
)
{
$res
=
UsersModel
::
where
([
'id'
=>
$this
->
auth
->
id
])
->
update
([
'mobile'
=>
$phonenumber
]);
if
(
!
$this
->
auth
->
mobile
)
{
$res
=
UsersModel
::
where
([
'id'
=>
$this
->
auth
->
id
])
->
update
([
'mobile'
=>
$phonenumber
]);
}
$this
->
success
(
"获取成功"
,
$phonenumber
);
$this
->
success
(
"获取成功"
,
$phonenumber
);
}
/**
...
...
@@ -750,7 +769,7 @@ class Users extends Api
public
function
myBill
()
{
$page
=
$this
->
request
->
param
(
'page'
,
1
);
$type
=
$this
->
request
->
param
(
'type'
,
9
);
//9购物金
$type
=
$this
->
request
->
param
(
'type'
,
9
);
//9购物金
$heatos
=
$this
->
request
->
param
(
'heatos'
,
0
);
//1正数收入,-1负数支出
$where
=
[];
$where
[
'user_id'
]
=
$this
->
auth
->
id
;
...
...
@@ -764,7 +783,7 @@ class Users extends Api
->
limit
(
$this
->
pageSize
)
->
order
(
'createtime desc'
)
->
select
();
// $userinfo = UsersModel::where(['id' => $this->auth->id])->field('money,commission,agent_money,coupon_money')->find();
// $userinfo = UsersModel::where(['id' => $this->auth->id])->field('money,commission,agent_money,coupon_money')->find();
if
(
empty
(
$userdetailmoneys
))
{
$this
->
error
(
'暂无账单明细'
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment