ProofreadingLogic.php
2.6 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
namespace App\Http\Logic\Bside\Setting;
use App\Http\Logic\Bside\BaseLogic;
use App\Models\Project\Country;
use App\Models\WebSetting\Proofreading;
use App\Models\WebSetting\WebSettingCountry;
use Illuminate\Support\Facades\DB;
class ProofreadingLogic extends BaseLogic
{
public function __construct()
{
parent::__construct();
$this->model = new Proofreading();
$this->param = $this->requestAll;
}
/**
* @name :(校队列表)proofreadingList
* @author :lyh
* @method :post
* @time :2023/6/12 11:06
*/
public function proofreadingList($map,$p,$row,$order = 'created_at',$filed = ['*']){
$list = $this->model->lists($map,$p,$row,$order,$filed);
return $this->success($list);
}
/**
* @name :(保存翻译校队)proofreadingSave
* @author :lyh
* @method :post
* @time :2023/6/12 11:03
*/
public function proofreadingSave(){
DB::beginTransaction();
try {
//删除以前的数据
$this->model->del(['project_id'=>$this->user['project_id'],'language_id'=>$this->param['language_id'],'type'=>$this->param['type']]);
foreach ($this->param['data'] as $k => $v){
$v['created_at'] = date('Y-m-d H:i:s');
$v['updated_at'] = date('Y-m-d H:i:s');
$v['project_id'] = $this->user['project_id'];
$v['language_id'] = $this->param['language_id'];
$v['type'] = $this->param['type'];
$v['alias'] = $this->param['alias'];
$this->param['data'][$k] = $v;
}
//新增
$this->model->insert($this->param['data']);
DB::commit();
}catch (\Exception $e){
DB::rollBack();
$this->fail('error');
}
return $this->success();
}
/**
* @name :(项目已选中多语言国家列表)countryLanguageList
* @author :lyh
* @method :post
* @time :2023/6/12 15:54
*/
public function countryLanguageList($map,$order = 'created_at'){
$map['project_id'] = $this->user['project_id'];
$projectCountryModel = new Country();
$countryInfo = $projectCountryModel->read($map);
$list = [];
if(!empty($countryInfo['country_lists'])){
$countryArr = explode(",",$countryInfo['country_lists']);
$webCountryModel = new WebSettingCountry();
$list = $webCountryModel->list(['id'=>['in',$countryArr]]);
}
return $this->success($list);
}
}