Index.php
1.0 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
namespace addons\qyexternal\controller;
use think\addons\Controller;
use think\Request;
use Weasy\Core\Corp;
class Index extends Controller
{
public function index(Request $request)
{
$corp = new Corp($request->get("id"));
$corp->go($request);
}
/**
* @Note: 数据同步
* @Author: Ghaoo
* @param Request $request
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\ModelNotFoundException
* @throws \think\exception\DbException
*/
public function sync(Request $request)
{
$ret = false;
if ($request->has("all")) {
foreach (\addons\qyexternal\model\Corp::all() as $val) {
$corp = new Corp($val["id"]);
$ret = $corp->sync($request->request("type"));
}
} else {
$corp = new Corp($request->request("id"));
$ret = $corp->sync($request->request("type"));
}
if ($ret) {
$this->success("同步成功");
}
}
}