Merge pull request 'master' (#42) from master into dev
Reviewed-on: #42
This commit is contained in:
commit
1b92b0f40f
@ -16,7 +16,7 @@ namespace app\api\controller;
|
|||||||
use app\api\lists\recharge\RechargeLists;
|
use app\api\lists\recharge\RechargeLists;
|
||||||
use app\api\logic\RechargeLogic;
|
use app\api\logic\RechargeLogic;
|
||||||
use app\api\validate\RechargeValidate;
|
use app\api\validate\RechargeValidate;
|
||||||
|
use app\common\model\company\CompanyAccountLog;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 充值控制器
|
* 充值控制器
|
||||||
@ -36,6 +36,18 @@ class RechargeController extends BaseApiController
|
|||||||
{
|
{
|
||||||
return $this->dataLists(new RechargeLists());
|
return $this->dataLists(new RechargeLists());
|
||||||
}
|
}
|
||||||
|
public function deposit_lists()
|
||||||
|
{
|
||||||
|
$params=$this->request->param();
|
||||||
|
$list=CompanyAccountLog::where('company_id',$this->userId)->page($params['page_no'],15)->select();
|
||||||
|
$datas=[];
|
||||||
|
foreach($list as $k=>$v){
|
||||||
|
$datas[$k]['create_time']=$v['create_time'];
|
||||||
|
$datas[$k]['order_amount']=$v['change_amount'];
|
||||||
|
$datas[$k]['tips']='充值保证金'.$v['change_amount'];
|
||||||
|
}
|
||||||
|
return $this->success('ok',['count'=>0,'extend'=>[],'lists'=>$datas,'page_no'=>$params['page_no'],'page_size'=>$params['page_size']]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -228,7 +228,7 @@ class TaskController extends BaseApiController
|
|||||||
if($res>200){
|
if($res>200){
|
||||||
return $this->fail('定位坐标大于200米,请重新打卡。'.$res.'米');
|
return $this->fail('定位坐标大于200米,请重新打卡。'.$res.'米');
|
||||||
}
|
}
|
||||||
$res = App(RemoteController::class)->coordinate($datas, $parmas['terminus']['lnglat'][0], $parmas['terminus']['lnglat'][1]);
|
$res_two = App(RemoteController::class)->coordinate($datas, $parmas['terminus']['lnglat'][0], $parmas['terminus']['lnglat'][1]);
|
||||||
if($res===false){
|
if($res===false){
|
||||||
return $this->fail('GPS无轨迹');
|
return $this->fail('GPS无轨迹');
|
||||||
}
|
}
|
||||||
@ -240,9 +240,9 @@ class TaskController extends BaseApiController
|
|||||||
}
|
}
|
||||||
$res = App(RemoteController::class)->calculateDistance($task['extend']['transfer']['lnglat'][0],$task['extend']['transfer']['lnglat'][1], $parmas['transfer']['lnglat'][0], $parmas['transfer']['lnglat'][1]);
|
$res = App(RemoteController::class)->calculateDistance($task['extend']['transfer']['lnglat'][0],$task['extend']['transfer']['lnglat'][1], $parmas['transfer']['lnglat'][0], $parmas['transfer']['lnglat'][1]);
|
||||||
if($res>200){
|
if($res>200){
|
||||||
return $this->fail('定位坐标大于100米,请重新打卡。'.$res.'米');
|
return $this->fail('定位坐标大于200米,请重新打卡。'.$res.'米');
|
||||||
}
|
}
|
||||||
$res = App(RemoteController::class)->coordinate($datas, $parmas['transfer']['lnglat'][0], $parmas['transfer']['lnglat'][1]);
|
$res_two = App(RemoteController::class)->coordinate($datas, $parmas['transfer']['lnglat'][0], $parmas['transfer']['lnglat'][1]);
|
||||||
if($res===false){
|
if($res===false){
|
||||||
return $this->fail('GPS无轨迹');
|
return $this->fail('GPS无轨迹');
|
||||||
}
|
}
|
||||||
@ -251,7 +251,7 @@ class TaskController extends BaseApiController
|
|||||||
if (isset($task['extend']['update']['terminus']) && isset($task['extend']['update']['transfer'])) {
|
if (isset($task['extend']['update']['terminus']) && isset($task['extend']['update']['transfer'])) {
|
||||||
$data['status'] = 3;
|
$data['status'] = 3;
|
||||||
}
|
}
|
||||||
if($res<200){
|
if($res_two<1000){
|
||||||
$data['extend'] = json_encode($task['extend']);
|
$data['extend'] = json_encode($task['extend']);
|
||||||
Task::where('id', $parmas['id'])->update($data);
|
Task::where('id', $parmas['id'])->update($data);
|
||||||
return $this->success('更新成功');
|
return $this->success('更新成功');
|
||||||
|
@ -49,6 +49,9 @@ class RechargeLogic extends BaseLogic
|
|||||||
if(isset($params['task_id']) &&$params['task_id']>0){
|
if(isset($params['task_id']) &&$params['task_id']>0){
|
||||||
$data['extend']=json_encode(['task_id'=>$params['task_id'],'type'=>1]);
|
$data['extend']=json_encode(['task_id'=>$params['task_id'],'type'=>1]);
|
||||||
}
|
}
|
||||||
|
if(isset($params['type']) &&$params['type']==300){
|
||||||
|
$data['change_type']=300;
|
||||||
|
}
|
||||||
$order = RechargeOrder::create($data);
|
$order = RechargeOrder::create($data);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
@ -16,6 +16,7 @@ namespace app\common\logic;
|
|||||||
|
|
||||||
use app\common\enum\PayEnum;
|
use app\common\enum\PayEnum;
|
||||||
use app\common\enum\user\AccountLogEnum;
|
use app\common\enum\user\AccountLogEnum;
|
||||||
|
use app\common\model\Company;
|
||||||
use app\common\model\company\CompanyAccountLog;
|
use app\common\model\company\CompanyAccountLog;
|
||||||
use app\common\model\recharge\RechargeOrder;
|
use app\common\model\recharge\RechargeOrder;
|
||||||
use app\common\model\task\Task;
|
use app\common\model\task\Task;
|
||||||
@ -72,6 +73,24 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
Task::where('id', $order['extend']['task_id'])->update(['status' => 3,'extend'=>json_encode($extend)]);
|
Task::where('id', $order['extend']['task_id'])->update(['status' => 3,'extend'=>json_encode($extend)]);
|
||||||
TaskTemplate::where('id', $find['template_id'])->update(['over_decimal' => $order->order_amount]);
|
TaskTemplate::where('id', $find['template_id'])->update(['over_decimal' => $order->order_amount]);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
if($order['change_type']==300){
|
||||||
|
$company=Company::where('user_id',$order['user_id'])->find();
|
||||||
|
$left_amount= $company['deposit']+$order->order_amount;
|
||||||
|
$datas = [
|
||||||
|
'order_sn' => $order->sn,
|
||||||
|
'user_id' => $order->user_id,
|
||||||
|
'company_id' => $company['id']??0,
|
||||||
|
'change_type' => 300,
|
||||||
|
'change_object' => 2,
|
||||||
|
'action' => 1,
|
||||||
|
'change_amount' => $order->order_amount,
|
||||||
|
'left_amount' =>$left_amount,
|
||||||
|
'remark' => '保证金充值',
|
||||||
|
];
|
||||||
|
CompanyAccountLog::create($datas);
|
||||||
|
Company::where('id',$company['id'])->update(['deposit'=>$left_amount]);
|
||||||
|
}else{
|
||||||
// 增加用户累计充值金额及用户余额
|
// 增加用户累计充值金额及用户余额
|
||||||
$user = User::findOrEmpty($order->user_id);
|
$user = User::findOrEmpty($order->user_id);
|
||||||
$user->total_recharge_amount += $order->order_amount;
|
$user->total_recharge_amount += $order->order_amount;
|
||||||
@ -87,6 +106,8 @@ class PayNotifyLogic extends BaseLogic
|
|||||||
$order->sn,
|
$order->sn,
|
||||||
'用户充值'
|
'用户充值'
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 更新充值订单状态
|
// 更新充值订单状态
|
||||||
|
Loading…
x
Reference in New Issue
Block a user