1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- declare (strict_types = 1);
- namespace app\command;
- use think\console\Command;
- use think\console\Input;
- use think\console\input\Argument;
- use think\console\input\Option;
- use think\console\Output;
- use think\facade\Cache;use think\facade\Db;
- class reportTips extends Command
- {
- protected function configure()
- {
- // 指令配置
- $this->setName('reporttips')
- ->setDescription('the reporttips command');
- }
- protected function execute(Input $input, Output $output)
- {
- // 指令输出
- $sttime = Cache::get("repotTips");
- if($sttime==1) return '';
- Cache::set("repotTips",1,1800);
- $this->GetData();
- $date=date('Y-m-d H:i:s');
- $output->writeln("[{$date}] 更新数据成功");
- }
- private function GetData(){
- $daprtid = [52,53,56];
- $companyNo='GS2203161855277894';
- $temp=[];
- $depart= Db::connect("mysql_sys")->name("company_item")->where(["id"=>$daprtid])->column("name","id");
- foreach ($depart as $item=>$name){
- $uidArr =getUidByDepartId($item);
- $where=["ownerid"=>$uidArr,"companyNo"=>$companyNo,"platform_type"=>1];
- $tem=[
- "depart"=>$name,
- "wpay_fee"=>Db::name("qrd_info")->where($where)->sum('wpay_fee'),
- "wpay_ainv_fee"=>Db::name("qrd_info")->where($where)->where(["inv_status"=>[2,3]])->sum('wpay_fee'),
- "ainv_fee"=>Db::name("qrd_info")->where($where)->where(function ($query){
- $query->whereOr([['inv_status','<>',3],['pay_status','<>',3]]);
- })->sum('ainv_fee'),
- "apay_fee"=>Db::name("qrd_info")->where($where)->where(function ($query){
- $query->whereOr([['inv_status','<>',3],['pay_status','<>',3]]);
- })->sum('apay_fee'),
- "ainv_apay_fee"=>Db::name("qrd_info")->where($where)->where(function ($query){
- $query->whereOr([['inv_status','<>',3],['pay_status','<>',3]]);
- })->sum(Db::raw("ainv_fee - apay_fee")),
- "wpay_send_fee"=>Db::name("qrd_info")->where($where)->where(["sendStatus"=>1])->sum('wpay_fee'),
- "winv_fee"=>Db::name("qrd_info")->where($where)->sum('winv_fee'),
- "inv_fee"=>Db::name("qrd_info")->where($where)->sum('inv_fee'),
- "winv_asend_fee"=>Db::name("qrd_info")->where($where)->where(["sendStatus"=>[2,3]])->sum('winv_fee'),
- "winv_two_month"=>Db::name("qrd_info")->where($where)->where(["sendStatus"=>[2,3]])->where("createdTime","<=",date("Y-m-d H:i:s",time()-60*24*3600))->sum("winv_fee"),
- "wpay_six_month"=>Db::name("qrd_info")->where($where)->where("createdTime","<=",date("Y-m-d H:i:s",time()-180*24*3600))->sum("wpay_fee")
- ];
- $temp[]=$tem;
- }
- Cache::set("pay_inv_stat",$temp);
- }
- }
|