作者 sgj
1 个管道 的构建 通过 耗费 5 秒

test api

... ... @@ -114,7 +114,7 @@ class OrderController extends HomeBaseController{
}
public function getPrice($users_id,$start_time,$end_time){
public function getPriceDRN($users_id,$start_time,$end_time){
$cost=Db::name('cost')->where('id',1)->find();
$interval = Db::name('interval')->where('id',1)->find();
$is_free=Db::name('users')->where('id',$users_id)->find()['is_free'];
... ... @@ -256,7 +256,7 @@ class OrderController extends HomeBaseController{
* @throws \think\exception\DbException
*/
public function onlyGetPrice($users_id,$start_time,$end_time){
public function onlyGetPriceDRN($users_id,$start_time,$end_time){
$cost=Db::name('cost')->where('id',1)->find();
$interval = Db::name('interval')->where('id',1)->find();
$is_free=Db::name('users')->where('id',$users_id)->find()['is_free'];
... ... @@ -404,6 +404,7 @@ class OrderController extends HomeBaseController{
return $price;
}
/**
* 宋国杰
* @title 计算价格
* @description 微信统一下单
* @author 董瑞恩
... ... @@ -415,12 +416,12 @@ class OrderController extends HomeBaseController{
*
* @return data:返回用于调用支付的参数
*/
public function getPriceSGJ(){
public function getPrice($users_id,$start_time,$end_time){
/*先获取跨越天数*/
$users_id='11';
$data=input();
$start_time=$data['start_time']??'1545084020';
$end_time=$data['end_time']??time();
// $start_time=$data['start_time']??'1545084020';
// $end_time=$data['end_time']??time();
$spend=$this->timediff($start_time,$end_time);
if ($spend['min']!=0||$spend['sex']!=0){
$spend['hour']++;
... ... @@ -451,12 +452,22 @@ class OrderController extends HomeBaseController{
return $allPirce;
}
public function getOnlyPriceSGJ(){
/**
* 宋国杰
* @param $users_id
* @param $start_time
* @param $end_time
* @return float|int|mixed
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function onlyGetPrice($users_id,$start_time,$end_time){
/*先获取跨越天数*/
$users_id='11';
$data=input();
$start_time=$data['start_time']??'1545084020';
$end_time=$data['end_time']??time();
// $users_id='11';
// $data=input();
// $start_time=$data['start_time']??'1545084020';
// $end_time=$data['end_time']??time();
$spend=$this->timediff($start_time,$end_time);
if ($spend['min']!=0||$spend['sex']!=0){
$spend['hour']++;
... ... @@ -471,14 +482,13 @@ class OrderController extends HomeBaseController{
$time=$time+3600;
}
if ($price>$cost['ceiling']){
$price=$cost['ceiling'];
$free=0;
}else{
if ($cost['free']==1 && $is_free==0){
$free=$this->getPriceByTime($start_time,$interval['end_time'],$interval['start_time'],$interval['price'],$cost['cost']);
Db::name('users')->where('id',$users_id)->update(['is_free'=>1]);
// Db::name('users')->where('id',$users_id)->update(['is_free'=>1]);
}else{
$free=0;
}
... ... @@ -488,6 +498,8 @@ class OrderController extends HomeBaseController{
}
public function getPriceBytime($time,$first_time,$second_time,$cost1,$cost2){
$first_time=strtotime($first_time);
$second_time=strtotime($second_time);
... ...