正在显示
3 个修改的文件
包含
65 行增加
和
4 行删除
@@ -10,6 +10,7 @@ namespace app\portal\controller; | @@ -10,6 +10,7 @@ namespace app\portal\controller; | ||
10 | 10 | ||
11 | 11 | ||
12 | use app\portal\model\IndentModel; | 12 | use app\portal\model\IndentModel; |
13 | +use app\portal\model\LogisticsModel; | ||
13 | use cmf\controller\HomeBaseController; | 14 | use cmf\controller\HomeBaseController; |
14 | 15 | ||
15 | class LoadController extends HomeBaseController | 16 | class LoadController extends HomeBaseController |
@@ -32,9 +33,8 @@ class LoadController extends HomeBaseController | @@ -32,9 +33,8 @@ class LoadController extends HomeBaseController | ||
32 | dump(cache('data')); | 33 | dump(cache('data')); |
33 | } | 34 | } |
34 | public function notify(){ | 35 | public function notify(){ |
35 | - | ||
36 | - $RequestType = $_POST['RequestType']; | ||
37 | - $RequestData = $_POST['RequestData']; | 36 | + $RequestType = empty($_POST['RequestType']) ? 0: $_POST['RequestType']; |
37 | + $RequestData = empty($_POST['RequestData']) ? 0: $_POST['RequestData']; | ||
38 | if(empty($RequestType)){ | 38 | if(empty($RequestType)){ |
39 | $this->error('error'); | 39 | $this->error('error'); |
40 | } | 40 | } |
@@ -42,10 +42,21 @@ class LoadController extends HomeBaseController | @@ -42,10 +42,21 @@ class LoadController extends HomeBaseController | ||
42 | $this->error('error'); | 42 | $this->error('error'); |
43 | } | 43 | } |
44 | $result = json_decode($RequestData,true); | 44 | $result = json_decode($RequestData,true); |
45 | + $indentModel = new IndentModel(); | ||
46 | + foreach($result['data'] as $key => $vo){ | ||
47 | + $indent = $indentModel->findData(['logistic_code'=>$vo['LogisticCode']]); | ||
48 | + if(!empty($indent)){ | ||
49 | + if($vo['state'] >=1 && $vo['state'] != 4){ | ||
50 | + if($indent['state'] == 2){ | ||
51 | + $indentModel->updateData(['id'=>$indent['id']],['state'=>5]); | ||
52 | + } | ||
53 | + } | ||
54 | + } | ||
55 | + } | ||
45 | cache('result',$result); | 56 | cache('result',$result); |
46 | $bird = config('bird'); | 57 | $bird = config('bird'); |
47 | $date = date("Y-m-d H:i:s",time()); | 58 | $date = date("Y-m-d H:i:s",time()); |
48 | - $data = '{ "EBusinessID": "test1472267", "UpdateTime": "'.$date.'", "Success": true, "Reason": ""}'; | 59 | + $data = '{ "EBusinessID": "'.$bird['EBusinessID'].'", "UpdateTime": "'.$date.'", "Success": true, "Reason": ""}'; |
49 | cache('data',$data); | 60 | cache('data',$data); |
50 | return $data; | 61 | return $data; |
51 | } | 62 | } |
@@ -40,6 +40,17 @@ class IndentModel extends Model | @@ -40,6 +40,17 @@ class IndentModel extends Model | ||
40 | } | 40 | } |
41 | 41 | ||
42 | /** | 42 | /** |
43 | + * 更新 | ||
44 | + * @param $where | ||
45 | + * @param $data | ||
46 | + * @return IndentModel | ||
47 | + */ | ||
48 | + public function updateData($where,$data){ | ||
49 | + $result = $this->where($where)->update($data); | ||
50 | + return $result; | ||
51 | + } | ||
52 | + | ||
53 | + /** | ||
43 | * 删除订单 | 54 | * 删除订单 |
44 | * @param $where | 55 | * @param $where |
45 | * @return int | 56 | * @return int |
app/portal/model/LogisticsModel.php
0 → 100644
1 | +<?php | ||
2 | +/** | ||
3 | + * Created by PhpStorm. | ||
4 | + * User: Administrator | ||
5 | + * Date: 2019/6/8 | ||
6 | + * Time: 14:34 | ||
7 | + */ | ||
8 | + | ||
9 | +namespace app\portal\model; | ||
10 | + | ||
11 | + | ||
12 | +use think\Model; | ||
13 | + | ||
14 | +class LogisticsModel extends Model | ||
15 | +{ | ||
16 | + /** | ||
17 | + * 获取单条数据 | ||
18 | + * @param $where | ||
19 | + * @return array|false|\PDOStatement|string|Model | ||
20 | + * @throws \think\db\exception\DataNotFoundException | ||
21 | + * @throws \think\db\exception\ModelNotFoundException | ||
22 | + * @throws \think\exception\DbException | ||
23 | + */ | ||
24 | + public function findData($where){ | ||
25 | + $data = $this->where($where)->find(); | ||
26 | + return $data; | ||
27 | + } | ||
28 | + | ||
29 | + /** | ||
30 | + * 更新 | ||
31 | + * @param $where | ||
32 | + * @param $data | ||
33 | + * @return LogisticsModel | ||
34 | + */ | ||
35 | + public function updateData($where,$data){ | ||
36 | + $result = $this->where($where)->update($data); | ||
37 | + return $result; | ||
38 | + } | ||
39 | +} |
-
请 注册 或 登录 后发表评论