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
18ed0222
Commit
18ed0222
authored
Oct 03, 2018
by
wanggang
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
20d4ebd3
24b51f56
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
54 additions
and
44 deletions
+54
-44
application/api/controller/Order.php
+27
-34
application/api/controller/Project.php
+21
-3
application/api/controller/User.php
+2
-2
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 @
18ed0222
...
...
@@ -188,42 +188,35 @@ class Order extends Base
}
$data
[
'order_id'
]
=
intval
(
$order
->
id
);
$data
[
'total_fee'
]
=
doubleval
(
$order
->
total_fee
);
//生成订单
//TODO::关闭支付接口
//
生成订单
//
TODO::关闭支付接口
// // 更新订单号-防止签名失败
// $order->out_trade_no = (new \WxPayConfig())->GetMerchantId() . time() . $order->id;
//
// $input = new \WxPayUnifiedOrder();
// $input->SetBody($order->title);
// $input->SetAttach($order->id);
// $input->SetOut_trade_no($order->out_trade_no);
// $input->SetTotal_fee(floatval($order->total_fee) * 100); // 单位为分
// $input->SetTime_start(date("YmdHis"));
// $input->SetTime_expire(date("YmdHis", time() + 600));
// // $input->SetGoods_tag("wx-xcx");
// $input->SetNotify_url(config('wx_pay.notify_url'));
// $input->SetTrade_type("JSAPI");
// $input->SetOpenid($this->userinfo[1]);
// $unifiedOrder = \WxPayApi::unifiedOrder($input);
// if ($unifiedOrder["return_code"] == 'FAIL') {
// return ['code' => 1, 'msg' => $unifiedOrder['return_msg']];
// }
// // 保存 prepay_id 用于发送模版消息
// $order->prepay_id = $unifiedOrder['prepay_id'];
// $order->save();
// $jsApiParameters = $this->GetJsApiParameters($unifiedOrder);
// if ($jsApiParameters) {
// return ['code' => 0, 'msg' => '支付参数', 'data' => $data, 'result' => json_decode($jsApiParameters)];
// } else {
// throw new \Exception('订单签名失败');
// }
//TODO::删除测试代码 --------------------开始
$order
->
out_trade_no
=
(
new
\WxPayConfig
())
->
GetMerchantId
()
.
time
()
.
$order
->
id
;
$user
=
UserModel
::
get
(
$this
->
userinfo
[
0
]);
$user
->
is_vip
=
1
;
$user
->
vip_endtime
=
$vip_endtime
;
$user
->
save
();
//----------------------------------------结束
$input
=
new
\WxPayUnifiedOrder
();
$input
->
SetBody
(
$order
->
title
);
$input
->
SetAttach
(
$order
->
id
);
$input
->
SetOut_trade_no
(
$order
->
out_trade_no
);
$input
->
SetTotal_fee
(
floatval
(
$order
->
total_fee
)
*
100
);
// 单位为分
$input
->
SetTime_start
(
date
(
"YmdHis"
));
$input
->
SetTime_expire
(
date
(
"YmdHis"
,
time
()
+
600
));
// $input->SetGoods_tag("wx-xcx");
$input
->
SetNotify_url
(
config
(
'wx_pay.notify_url'
));
$input
->
SetTrade_type
(
"JSAPI"
);
$input
->
SetOpenid
(
$this
->
userinfo
[
1
]);
$unifiedOrder
=
\WxPayApi
::
unifiedOrder
(
$input
);
if
(
$unifiedOrder
[
"return_code"
]
==
'FAIL'
)
{
return
[
'code'
=>
1
,
'msg'
=>
$unifiedOrder
[
'return_msg'
]];
}
// 保存 prepay_id 用于发送模版消息
$order
->
prepay_id
=
$unifiedOrder
[
'prepay_id'
];
$order
->
save
();
$jsApiParameters
=
$this
->
GetJsApiParameters
(
$unifiedOrder
);
if
(
$jsApiParameters
)
{
return
[
'code'
=>
0
,
'msg'
=>
'支付参数'
,
'data'
=>
$data
,
'result'
=>
json_decode
(
$jsApiParameters
)];
}
else
{
throw
new
\Exception
(
'订单签名失败'
);
}
Db
::
commit
();
}
catch
(
\Exception
$e
)
{
...
...
application/api/controller/Project.php
View file @
18ed0222
...
...
@@ -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'
=>
'没有更多'
];
return
[
'code'
=>
0
,
'msg'
=>
'success'
,
'data'
=>
$newProjects
];
...
...
@@ -236,7 +236,7 @@ class Project extends Base
if
(
$data
->
delete
())
{
$project
->
collect_num
--
;
$project
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'取消收藏成功!'
];
return
[
'code'
=>
0
,
'msg'
=>
'取消收藏成功!'
,
'collect'
=>
'remove'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'取消收藏失败,请重试!'
];
}
...
...
@@ -249,7 +249,7 @@ class Project extends Base
if
(
$result
)
{
$project
->
collect_num
++
;
$project
->
save
();
return
[
'code'
=>
0
,
'msg'
=>
'收藏成功!'
];
return
[
'code'
=>
0
,
'msg'
=>
'收藏成功!'
,
'collect'
=>
'add'
];
}
else
{
return
[
'code'
=>
1
,
'msg'
=>
'收藏失败,请重试!'
];
}
...
...
@@ -291,6 +291,24 @@ class Project extends Base
if
(
!
$project
)
{
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
];
}
...
...
application/api/controller/User.php
View file @
18ed0222
...
...
@@ -152,7 +152,6 @@ class User extends Base
}
}
public
function
index
()
{
//用户UID
...
...
@@ -201,7 +200,8 @@ class User extends Base
if
(
$list
->
isEmpty
())
{
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
];
}
...
...
application/common/model/Project.php
View file @
18ed0222
...
...
@@ -42,7 +42,7 @@ class Project extends BaseModel
//未结束
return
'剩余'
.
ceil
((
$endTime
-
time
())
/
86400
)
.
'天'
;
}
else
{
return
'
结束,预约下一
次'
;
return
'
预约下
次'
;
}
}
elseif
(
$data
[
'type'
]
==
2
)
{
//商家
...
...
application/common/model/User.php
View file @
18ed0222
...
...
@@ -30,11 +30,10 @@ class User extends BaseModel
}
}
//用户收藏多对多
//
用户收藏多对多
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 @
18ed0222
...
...
@@ -36,6 +36,7 @@
美行者 商家入驻H5网页
<br/>
美行者 商家入驻H5网页
<br/>
美行者 商家入驻H5网页
<br/>
<img
style=
"height:200px;width:200px;"
src=
"http://jq.hthymedia.com/upload/201809/1537433486.jpeg"
/>
</div>
</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