AiccWeChatLogic.php
1.3 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
44
<?php
namespace App\Http\Logic\Aside\Aicc;
use App\Enums\Common\Code;
use App\Http\Logic\Logic;
use App\Models\AICC\AiccWechat;
use Illuminate\Support\Facades\DB;
class AiccWeChatLogic extends Logic
{
public function saveData($data)
{
$wx = new AiccWechat();
DB::beginTransaction();
try {
$status = $wx->saveData($data);
DB::commit();
} catch (\Exception $e) {
DB::rollBack();
$e->getMessage();
errorLog('V6与AICC关联失败', $wx, $e);
$this->fail('请检查操作是否正确!', Code::SERVER_MYSQL_ERROR);
}
return $status;
}
/**
* @return array
*/
public function AiccWeChatLists($page = 1, $perPage = 15)
{
$status = 1; # 1 - 正常, 0 - 禁用
$lists = AiccWechat::query()->where('status', $status)
->whereNotNull('project_id')
->whereNotNull('wx_user_id')
->paginate($perPage, ['project_id', 'wx_id', 'wx_user_id'], 'page', $page);
$items = $lists->Items();
$totalPage = $lists->lastPage();
$total = $lists->total();
$currentPage = $lists->currentPage();
return compact('total', 'items', 'totalPage', 'currentPage');
}
}