Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
backend
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
亲子游项目
backend
Commits
24b51f56
Commit
24b51f56
authored
Oct 02, 2018
by
汪睦雄
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改接口
parent
7ce83c00
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
56 additions
and
46 deletions
+56
-46
application/api/controller/Order.php
+28
-35
application/api/controller/Project.php
+21
-3
application/api/controller/User.php
+3
-3
application/common/model/Project.php
+1
-1
application/common/model/User.php
+2
-4
application/mob/view/index/shopjoin.html
+1
-0
No files found.
application/api/controller/Order.php
View file @
24b51f56
...
@@ -188,42 +188,35 @@ class Order extends Base
...
@@ -188,42 +188,35 @@ class Order extends Base
}
}
$data
[
'order_id'
]
=
intval
(
$order
->
id
);
$data
[
'order_id'
]
=
intval
(
$order
->
id
);
$data
[
'total_fee'
]
=
doubleval
(
$order
->
total_fee
);
$data
[
'total_fee'
]
=
doubleval
(
$order
->
total_fee
);
//生成订单
//
生成订单
//TODO::关闭支付接口
//
TODO::关闭支付接口
// // 更新订单号-防止签名失败
// // 更新订单号-防止签名失败
// $order->out_trade_no = (new \WxPayConfig())->GetMerchantId() . time() . $order->id;
$order
->
out_trade_no
=
(
new
\WxPayConfig
())
->
GetMerchantId
()
.
time
()
.
$order
->
id
;
//
// $input = new \WxPayUnifiedOrder();
$input
=
new
\WxPayUnifiedOrder
();
// $input->SetBody($order->title);
$input
->
SetBody
(
$order
->
title
);
// $input->SetAttach($order->id);
$input
->
SetAttach
(
$order
->
id
);
// $input->SetOut_trade_no($order->out_trade_no);
$input
->
SetOut_trade_no
(
$order
->
out_trade_no
);
// $input->SetTotal_fee(floatval($order->total_fee) * 100); // 单位为分
$input
->
SetTotal_fee
(
floatval
(
$order
->
total_fee
)
*
100
);
// 单位为分
// $input->SetTime_start(date("YmdHis"));
$input
->
SetTime_start
(
date
(
"YmdHis"
));
// $input->SetTime_expire(date("YmdHis", time() + 600));
$input
->
SetTime_expire
(
date
(
"YmdHis"
,
time
()
+
600
));
// // $input->SetGoods_tag("wx-xcx");
// $input->SetGoods_tag("wx-xcx");
// $input->SetNotify_url(config('wx_pay.notify_url'));
$input
->
SetNotify_url
(
config
(
'wx_pay.notify_url'
));
// $input->SetTrade_type("JSAPI");
$input
->
SetTrade_type
(
"JSAPI"
);
// $input->SetOpenid($this->userinfo[1]);
$input
->
SetOpenid
(
$this
->
userinfo
[
1
]);
// $unifiedOrder = \WxPayApi::unifiedOrder($input);
$unifiedOrder
=
\WxPayApi
::
unifiedOrder
(
$input
);
// if ($unifiedOrder["return_code"] == 'FAIL') {
if
(
$unifiedOrder
[
"return_code"
]
==
'FAIL'
)
{
// return ['code' => 1, 'msg' => $unifiedOrder['return_msg']];
return
[
'code'
=>
1
,
'msg'
=>
$unifiedOrder
[
'return_msg'
]];
// }
}
// // 保存 prepay_id 用于发送模版消息
// 保存 prepay_id 用于发送模版消息
// $order->prepay_id = $unifiedOrder['prepay_id'];
$order
->
prepay_id
=
$unifiedOrder
[
'prepay_id'
];
// $order->save();
$order
->
save
();
// $jsApiParameters = $this->GetJsApiParameters($unifiedOrder);
$jsApiParameters
=
$this
->
GetJsApiParameters
(
$unifiedOrder
);
// if ($jsApiParameters) {
if
(
$jsApiParameters
)
{
// return ['code' => 0, 'msg' => '支付参数', 'data' => $data, 'result' => json_decode($jsApiParameters)];
return
[
'code'
=>
0
,
'msg'
=>
'支付参数'
,
'data'
=>
$data
,
'result'
=>
json_decode
(
$jsApiParameters
)];
// } else {
}
else
{
// throw new \Exception('订单签名失败');
throw
new
\Exception
(
'订单签名失败'
);
// }
}
//TODO::删除测试代码 --------------------开始
$user
=
UserModel
::
get
(
$this
->
userinfo
[
0
]);
$user
->
is_vip
=
1
;
$user
->
vip_endtime
=
$vip_endtime
;
$user
->
save
();
//----------------------------------------结束
Db
::
commit
();
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
}
catch
(
\Exception
$e
)
{
...
...
application/api/controller/Project.php
View file @
24b51f56
...
@@ -154,7 +154,7 @@ class Project extends Base
...
@@ -154,7 +154,7 @@ class Project extends Base
});
});
}
}
$newProjects
=
$newProjects
?
collection
(
$newProjects
)
->
visible
([
'id'
,
'title'
,
'poster'
,
'
night_num'
,
'price
'
])
->
toArray
()
:
[];
$newProjects
=
$newProjects
?
collection
(
$newProjects
)
->
visible
([
'id'
,
'title'
,
'poster'
,
'
sign_limits'
,
'night_num'
,
'tags'
,
'price'
,
'vip_price'
,
'type'
,
'location'
,
'latitude'
,
'longitude'
])
->
append
([
'sign_endtime_str
'
])
->
toArray
()
:
[];
if
(
!
$newProjects
)
return
[
'code'
=>
1
,
'msg'
=>
'没有更多'
];
if
(
!
$newProjects
)
return
[
'code'
=>
1
,
'msg'
=>
'没有更多'
];
return
[
'code'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$newProjects
];
return
[
'code'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$newProjects
];
...
@@ -236,7 +236,7 @@ class Project extends Base
...
@@ -236,7 +236,7 @@ class Project extends Base
if
(
$data
->
delete
())
{
if
(
$data
->
delete
())
{
$project
->
collect_num
--
;
$project
->
collect_num
--
;
$project
->
save
();
$project
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'取消收藏成功!'
];
return
[
'code'
=>
0
,
'msg'
=>
'取消收藏成功!'
,
'collect'
=>
'remove'
];
}
else
{
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'取消收藏失败,请重试!'
];
return
[
'code'
=>
1
,
'msg'
=>
'取消收藏失败,请重试!'
];
}
}
...
@@ -249,7 +249,7 @@ class Project extends Base
...
@@ -249,7 +249,7 @@ class Project extends Base
if
(
$result
)
{
if
(
$result
)
{
$project
->
collect_num
++
;
$project
->
collect_num
++
;
$project
->
save
();
$project
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'收藏成功!'
];
return
[
'code'
=>
0
,
'msg'
=>
'收藏成功!'
,
'collect'
=>
'add'
];
}
else
{
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'收藏失败,请重试!'
];
return
[
'code'
=>
1
,
'msg'
=>
'收藏失败,请重试!'
];
}
}
...
@@ -291,6 +291,24 @@ class Project extends Base
...
@@ -291,6 +291,24 @@ class Project extends Base
if
(
!
$project
)
{
if
(
!
$project
)
{
return
[
'code'
=>
1
,
'msg'
=>
'该活动或商家不存在!'
];
return
[
'code'
=>
1
,
'msg'
=>
'该活动或商家不存在!'
];
}
}
// 是否过期
$endTime
=
strtotime
(
$project
[
'sign_endtime'
]);
// 正常
$project
[
'status'
]
=
0
;
$project
[
'status_text'
]
=
'立即报名'
;
if
(
strtotime
(
$project
[
'sign_endtime'
])
>
time
())
{
// 已过期
$project
[
'status'
]
=
1
;
$project
[
'status_text'
]
=
'预约下次'
;
}
else
{
if
(
intval
(
$project
[
'sign_limits'
])
<=
intval
(
$project
[
'sign_num'
]))
{
// 已售罄
$project
[
'status'
]
=
2
;
$project
[
'status_text'
]
=
'已售罄'
;
}
}
// 是否收藏了本活动
$project
[
'is_collect'
]
=
UserCollectionModel
::
get
([
'uid'
=>
$this
->
userinfo
[
0
],
'pid'
=>
input
(
'post.id'
)])
?
true
:
false
;
return
[
'code'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$project
];
return
[
'code'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$project
];
}
}
...
...
application/api/controller/User.php
View file @
24b51f56
...
@@ -152,7 +152,6 @@ class User extends Base
...
@@ -152,7 +152,6 @@ class User extends Base
}
}
}
}
public
function
index
()
public
function
index
()
{
{
//用户UID
//用户UID
...
@@ -196,12 +195,13 @@ class User extends Base
...
@@ -196,12 +195,13 @@ class User extends Base
$uid
=
$this
->
userinfo
[
0
];
$uid
=
$this
->
userinfo
[
0
];
$p
=
input
(
'post.p/d'
,
1
);
$p
=
input
(
'post.p/d'
,
1
);
$page
=
input
(
'post.page/d'
,
8
);
$page
=
input
(
'post.page/d'
,
8
);
$list
=
collection
(
UserModel
::
get
(
$uid
)
->
project
()
->
page
(
$p
,
$page
)
->
select
());
$list
=
collection
(
UserModel
::
get
(
$uid
)
->
project
()
->
page
(
$p
,
$page
)
->
select
());
if
(
$list
->
isEmpty
())
{
if
(
$list
->
isEmpty
())
{
return
[
'code'
=>
1
,
'msg'
=>
'没有更多'
];
return
[
'code'
=>
1
,
'msg'
=>
'没有更多'
];
}
}
$list
=
$list
->
visible
([
'title'
,
'night_num'
,
'price'
,
'vip_price'
,
'poster'
,])
->
append
([
'sign_endtime_str'
]);
$list
=
$list
->
visible
([
'id'
,
'title'
,
'poster'
,
'sign_limits'
,
'night_num'
,
'tags'
,
'price'
,
'vip_price'
,
'type'
,
'location'
,
'latitude'
,
'longitude'
])
->
append
([
'sign_endtime_str'
]);
return
[
'code'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$list
];
return
[
'code'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$list
];
}
}
...
...
application/common/model/Project.php
View file @
24b51f56
...
@@ -42,7 +42,7 @@ class Project extends BaseModel
...
@@ -42,7 +42,7 @@ class Project extends BaseModel
//未结束
//未结束
return
'剩余'
.
ceil
((
$endTime
-
time
())
/
86400
)
.
'天'
;
return
'剩余'
.
ceil
((
$endTime
-
time
())
/
86400
)
.
'天'
;
}
else
{
}
else
{
return
'
结束,预约下一
次'
;
return
'
预约下
次'
;
}
}
}
elseif
(
$data
[
'type'
]
==
2
)
{
}
elseif
(
$data
[
'type'
]
==
2
)
{
//商家
//商家
...
...
application/common/model/User.php
View file @
24b51f56
...
@@ -30,11 +30,10 @@ class User extends BaseModel
...
@@ -30,11 +30,10 @@ class User extends BaseModel
}
}
}
}
//用户收藏多对多
//
用户收藏多对多
public
function
project
()
public
function
project
()
{
{
return
$this
->
belongsToMany
(
'Project'
,
'user_collections'
,
'pid'
,
'uid'
);
return
$this
->
belongsToMany
(
'Project'
,
'user_collections'
,
'pid'
,
'uid'
);
}
}
}
}
\ No newline at end of file
application/mob/view/index/shopjoin.html
View file @
24b51f56
...
@@ -36,6 +36,7 @@
...
@@ -36,6 +36,7 @@
美行者 商家入驻H5网页
<br/>
美行者 商家入驻H5网页
<br/>
美行者 商家入驻H5网页
<br/>
美行者 商家入驻H5网页
<br/>
美行者 商家入驻H5网页
<br/>
美行者 商家入驻H5网页
<br/>
<img
style=
"height:200px;width:200px;"
src=
"http://jq.hthymedia.com/upload/201809/1537433486.jpeg"
/>
</div>
</div>
</section>
</section>
...
...
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