审查视图

app/portal/controller/LoadController.php 2.0 KB
王晓刚 authored
1 2 3 4 5 6 7 8 9 10 11 12
<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2019/6/7
 * Time: 16:48
 */

namespace app\portal\controller;


use app\portal\model\IndentModel;
王晓刚 authored
13
use app\portal\model\LogisticsModel;
王晓刚 authored
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
use cmf\controller\HomeBaseController;

class LoadController extends HomeBaseController
{
    public function index(){
        $indentModel = new IndentModel();
        $where['state'] = ['eq',2];
        $data = $indentModel->selectData($where);
        if(!empty($data)){
            foreach($data as $key => $vo){
                $birdController = new BirdController();
                $result = $birdController->getOrder($vo['id']);
            }
        }
    }
王晓刚 authored
29
    public function test(){
王晓刚 authored
30 31
        dump(cache('a1'));
        dump(cache('yuyue1'));
王晓刚 authored
32 33
        dump(cache('dingyue1'));
        dump(cache('b'));
王晓刚 authored
34 35
        dump(cache('result'));
        dump(cache('result_data'));
王晓刚 authored
36
    }
王晓刚 authored
37
    public function notify(){
王晓刚 authored
38 39
        $RequestType = empty($_POST['RequestType']) ? 0: $_POST['RequestType'];
        $RequestData = empty($_POST['RequestData']) ? 0: $_POST['RequestData'];
王晓刚 authored
40 41 42 43 44
        if(empty($RequestType)){
            $this->error('error');
        }
        if($RequestType != 101){
            $this->error('error');
王晓刚 authored
45
        }
王晓刚 authored
46
        $result = json_decode($RequestData,true);
王晓刚 authored
47
        cache('result',$result);
王晓刚 authored
48
        cache('result_data',$result['Data']);
王晓刚 authored
49
        $indentModel = new IndentModel();
王晓刚 authored
50
        foreach($result['Data'] as $key => $vo){
王晓刚 authored
51 52
            $indent = $indentModel->findData(['logistic_code'=>$vo['LogisticCode']]);
            if(!empty($indent)){
王晓刚 authored
53
                if($vo['State'] >=1 && $vo['State'] != 4){
王晓刚 authored
54 55 56 57 58 59
                    if($indent['state'] == 2){
                        $indentModel->updateData(['id'=>$indent['id']],['state'=>5]);
                    }
                }
            }
        }
王晓刚 authored
60 61
        $bird = config('bird');
        $date = date("Y-m-d H:i:s",time());
王晓刚 authored
62
        $data = '{ "EBusinessID": "'.$bird['EBusinessID'].'", "UpdateTime": "'.$date.'", "Success": true, "Reason": ""}';
王晓刚 authored
63
        cache('data',$data);
王晓刚 authored
64
        return $data;
王晓刚 authored
65
    }
王晓刚 authored
66
}