Compare commits
490 Commits
master-yaj
...
master
Author | SHA1 | Date | |
---|---|---|---|
aa0bc2101d | |||
![]() |
28f8330db8 | ||
![]() |
eb987e1086 | ||
![]() |
d632a0e023 | ||
![]() |
756fd5264d | ||
![]() |
8eed8ad43e | ||
![]() |
364c45099a | ||
![]() |
1d85dcc2d5 | ||
![]() |
4f9944c3a6 | ||
![]() |
9176344524 | ||
![]() |
c5ab197447 | ||
40c0e562d5 | |||
![]() |
3bcb7884db | ||
![]() |
7ea70eb693 | ||
d85c4dd495 | |||
0d15c095fe | |||
693e7216a9 | |||
![]() |
904a591e12 | ||
![]() |
f3b4046796 | ||
![]() |
2899ccf213 | ||
4a00f6f397 | |||
![]() |
a26ef0d02f | ||
![]() |
2fccc0fbe6 | ||
![]() |
126231eff6 | ||
![]() |
dc0510a4c4 | ||
![]() |
185a8580a0 | ||
![]() |
9f07b29de3 | ||
![]() |
95bdf0ef65 | ||
![]() |
8d15c136f2 | ||
![]() |
56e57969fb | ||
![]() |
597a3006be | ||
![]() |
4a7da20ffa | ||
![]() |
ceb3a3d48d | ||
![]() |
5e52fe7be7 | ||
![]() |
266953c4d2 | ||
![]() |
358bc3e098 | ||
![]() |
b44958ebbe | ||
![]() |
ad8bec449c | ||
![]() |
ad6cd8ce6e | ||
![]() |
977e7534ce | ||
![]() |
ad1e79b55f | ||
![]() |
7b882767f3 | ||
![]() |
c8f6fd4888 | ||
![]() |
ae017204b7 | ||
![]() |
d2c76df104 | ||
![]() |
83dfd17485 | ||
![]() |
2ab3422a0e | ||
![]() |
e57e7052e9 | ||
![]() |
4d2dfa3540 | ||
![]() |
1fc6696e70 | ||
![]() |
3b856cd25c | ||
![]() |
7f3b99005c | ||
![]() |
120e40c6e6 | ||
![]() |
7a3c482870 | ||
![]() |
5f3e46b4a2 | ||
![]() |
26c6108281 | ||
![]() |
a146eef523 | ||
![]() |
15eeb531d4 | ||
![]() |
55512fc40f | ||
b92e51c2e2 | |||
![]() |
456f77ece8 | ||
39b3e28e07 | |||
![]() |
247500c10d | ||
![]() |
8354517e9c | ||
319691ae73 | |||
![]() |
02a59a82e0 | ||
![]() |
9f8e86b932 | ||
![]() |
baf70cbf46 | ||
![]() |
2b309ced64 | ||
13199b51a0 | |||
![]() |
4b7b43a1d1 | ||
![]() |
e9c86f43cc | ||
![]() |
448d1a301a | ||
3f307fff4b | |||
![]() |
eecc48ad9a | ||
![]() |
44ae2a7487 | ||
![]() |
083e39cad3 | ||
![]() |
f77339f949 | ||
![]() |
8ccaecceb9 | ||
![]() |
5f1675abf4 | ||
ecd3e5d009 | |||
![]() |
ebdfc81b16 | ||
![]() |
5aca95ef79 | ||
![]() |
9b534e6c32 | ||
![]() |
066e8c4382 | ||
![]() |
91e77b712c | ||
369478622c | |||
![]() |
7783254f1a | ||
![]() |
b0058752d4 | ||
![]() |
d2667977f9 | ||
![]() |
2f99915481 | ||
![]() |
99b3c18a8e | ||
![]() |
89ce6e2281 | ||
![]() |
cdb46846a4 | ||
![]() |
ddfcb98b60 | ||
![]() |
97c885e249 | ||
![]() |
16423d0185 | ||
![]() |
d54aa707aa | ||
![]() |
8ac05f8fa3 | ||
![]() |
995ede0dff | ||
![]() |
f8bda77d0c | ||
![]() |
7bd126f091 | ||
![]() |
d802ff0c75 | ||
![]() |
93adb3d543 | ||
![]() |
55aa3159ee | ||
![]() |
ad80574645 | ||
![]() |
13ae414917 | ||
![]() |
0c54ba8c34 | ||
![]() |
0e7c4434ff | ||
![]() |
d85687169d | ||
![]() |
134765255d | ||
![]() |
a3cdb43f1c | ||
![]() |
6f9ef8c79f | ||
![]() |
f327cfa298 | ||
![]() |
9d422a2d45 | ||
1ff270db8b | |||
![]() |
3f791f3134 | ||
![]() |
759a9d4eb5 | ||
![]() |
6926465e04 | ||
![]() |
8357942b41 | ||
![]() |
e419d84b60 | ||
![]() |
5993ecef3c | ||
![]() |
d09758fa98 | ||
![]() |
6c44af1cf0 | ||
![]() |
78b7c8ea0a | ||
![]() |
cdde963325 | ||
![]() |
3d249a63ae | ||
![]() |
959f7d642f | ||
![]() |
a9b29f03e8 | ||
![]() |
c9d14e48cb | ||
![]() |
92f2abfc11 | ||
![]() |
d7a76319af | ||
![]() |
20d01ac6d9 | ||
![]() |
4daa667d6c | ||
![]() |
35f6dcf591 | ||
![]() |
cc999b400f | ||
![]() |
a2d65de03e | ||
![]() |
98103e40dd | ||
![]() |
6d08fba3a2 | ||
![]() |
0c9cb2a0d7 | ||
![]() |
04d478d880 | ||
![]() |
cd40872bc2 | ||
![]() |
4582e4b30f | ||
![]() |
b78ec65632 | ||
![]() |
b4c6f00ffe | ||
![]() |
75585f8e5f | ||
![]() |
e05552b206 | ||
![]() |
843f41c7cf | ||
![]() |
75d34b1a84 | ||
![]() |
2c26571b2e | ||
![]() |
f9aa235b66 | ||
![]() |
0552ae8ebd | ||
![]() |
0240331c6f | ||
![]() |
a9cd078339 | ||
2515fcc436 | |||
b98bbefcfc | |||
dbcffd626a | |||
![]() |
50ee9c7282 | ||
![]() |
8860d5eefe | ||
![]() |
70f3e6d83e | ||
![]() |
b4afce7c10 | ||
![]() |
190128c91b | ||
![]() |
edfeccf5df | ||
![]() |
ef8e453162 | ||
![]() |
35de09d273 | ||
![]() |
4e48919944 | ||
![]() |
0689f844d9 | ||
![]() |
cae380f93e | ||
![]() |
746b9dcb37 | ||
![]() |
96e2673ad3 | ||
d264bbbf33 | |||
![]() |
617d69d34c | ||
![]() |
43dc941e10 | ||
d6f6b70a0e | |||
![]() |
29ed839407 | ||
![]() |
4e52bcce2a | ||
![]() |
1e97e3f536 | ||
![]() |
a822dc5eae | ||
![]() |
1c8fd0153c | ||
![]() |
36a04096b1 | ||
![]() |
4617aea97e | ||
![]() |
95ef57c67a | ||
![]() |
819802b389 | ||
![]() |
0d8e60d862 | ||
![]() |
fa1923bb1e | ||
![]() |
f4daf29d0c | ||
![]() |
089a449f3a | ||
![]() |
a3dd939548 | ||
![]() |
fad8725593 | ||
![]() |
c8675a6bd1 | ||
![]() |
531531a3e5 | ||
![]() |
b193499086 | ||
![]() |
91bc6676ce | ||
![]() |
d280ac6248 | ||
![]() |
d6d0625943 | ||
![]() |
a84d83fa14 | ||
![]() |
7b0f5a2c87 | ||
![]() |
cf05fd0060 | ||
![]() |
fec4e43438 | ||
![]() |
e580102b5d | ||
![]() |
e8e389c78e | ||
![]() |
5eea9476db | ||
![]() |
9bda876532 | ||
![]() |
4038608ddc | ||
![]() |
31961f5727 | ||
![]() |
880d4ef27a | ||
![]() |
1fc4748f7e | ||
![]() |
126a836761 | ||
![]() |
bac39abb5b | ||
![]() |
7761d9f08f | ||
![]() |
047deaa6a4 | ||
![]() |
16b0cd32e7 | ||
![]() |
0c6c098c45 | ||
![]() |
3485c47561 | ||
![]() |
bc8e8a42fa | ||
![]() |
75e81fa463 | ||
![]() |
01289b0a12 | ||
![]() |
e9d9367d47 | ||
![]() |
00c9488f55 | ||
![]() |
e788111ce7 | ||
![]() |
2d82830a56 | ||
![]() |
23059469e0 | ||
![]() |
76860ba871 | ||
![]() |
aeb98c2585 | ||
![]() |
6dd332e699 | ||
![]() |
22e9c99d16 | ||
![]() |
de5c213172 | ||
![]() |
9b558bb32d | ||
![]() |
132480a46e | ||
![]() |
ba2cbec8b7 | ||
![]() |
4c39f93728 | ||
![]() |
36b06e99de | ||
![]() |
313caadeb7 | ||
![]() |
3b5ef1aef9 | ||
![]() |
b11f827cd1 | ||
![]() |
71896602fe | ||
![]() |
75d3818820 | ||
![]() |
bb686752ef | ||
![]() |
cee7211f2e | ||
![]() |
3764507e39 | ||
![]() |
30326c94f3 | ||
![]() |
5b79502943 | ||
![]() |
c7057e7697 | ||
![]() |
c293d798bd | ||
![]() |
d23a720eb2 | ||
![]() |
324fa8c422 | ||
![]() |
a59628e998 | ||
![]() |
86b17eafb5 | ||
![]() |
0d0d0a7e17 | ||
![]() |
dd880d2d0e | ||
![]() |
dd769ef814 | ||
![]() |
3ae45bea91 | ||
![]() |
e94ad8deeb | ||
![]() |
53b5e4c1ee | ||
![]() |
8b0768501b | ||
![]() |
e287c5db12 | ||
![]() |
081ace2c53 | ||
![]() |
2ae4a48c68 | ||
![]() |
d5c4a0bb0a | ||
![]() |
db2b170dff | ||
![]() |
664d014573 | ||
![]() |
6c38905c87 | ||
![]() |
121bc09cdf | ||
![]() |
80696495c0 | ||
![]() |
52989f8e46 | ||
![]() |
1b85e99dda | ||
![]() |
0bb0c9fc90 | ||
![]() |
b8d73e8e76 | ||
![]() |
fe791825d8 | ||
![]() |
9fb911b5fd | ||
![]() |
72069c7915 | ||
![]() |
6b8d91f0b4 | ||
![]() |
f2ce24e6a0 | ||
![]() |
2ba37f1ebf | ||
![]() |
b537209e97 | ||
![]() |
9cf71dc95f | ||
![]() |
1386e7783b | ||
![]() |
edbf90498a | ||
![]() |
dc9356c42f | ||
![]() |
848061d20f | ||
![]() |
64768d3302 | ||
![]() |
ee78dc4a7d | ||
![]() |
0c36e8dbc0 | ||
![]() |
5869879e93 | ||
![]() |
9d3ec12d9e | ||
![]() |
4d284266fa | ||
![]() |
b304b24b8f | ||
![]() |
3ba50e9ea9 | ||
![]() |
3fb014450b | ||
![]() |
a754b76549 | ||
![]() |
afcb9f6c24 | ||
![]() |
cc1039465a | ||
![]() |
eb076b4953 | ||
![]() |
ca1a923965 | ||
![]() |
e7e0dd9a9b | ||
![]() |
48afda8d39 | ||
![]() |
edfc17b274 | ||
![]() |
c5193d8b78 | ||
![]() |
6d3cf47c71 | ||
![]() |
a34a4e0bd4 | ||
![]() |
98bf3edbab | ||
![]() |
76b75f566d | ||
![]() |
0c1766b270 | ||
![]() |
09a0ee4cc1 | ||
![]() |
fafc964faf | ||
![]() |
b188458b9b | ||
![]() |
1b404f8429 | ||
![]() |
2fc2368767 | ||
![]() |
4aff89c800 | ||
![]() |
29d966699d | ||
![]() |
1df5fe5d53 | ||
![]() |
34d9873703 | ||
![]() |
26117a4b58 | ||
![]() |
8ee1eb10ab | ||
![]() |
e28a09df90 | ||
![]() |
076fbd6713 | ||
![]() |
db92550f99 | ||
![]() |
61c5a57f29 | ||
f2f2210fc9 | |||
![]() |
1d0d0f1be2 | ||
![]() |
7dd98c2b3d | ||
![]() |
c61f3ca783 | ||
![]() |
9fbc20f3fa | ||
![]() |
4d73a75ce6 | ||
![]() |
53cccbceb5 | ||
![]() |
b65c686f18 | ||
![]() |
990b752339 | ||
![]() |
dd9a0b5b21 | ||
![]() |
f29a6f525f | ||
![]() |
50857f7186 | ||
![]() |
068d203240 | ||
![]() |
d09658305d | ||
![]() |
6dd816c0b7 | ||
![]() |
9f1467ca3a | ||
![]() |
6af8ff4f71 | ||
![]() |
02f1b63096 | ||
![]() |
f7dc74b3fc | ||
![]() |
d52a918109 | ||
![]() |
6f1de215c1 | ||
![]() |
328aa375a9 | ||
![]() |
8a0e4a0b4b | ||
![]() |
cda01503f7 | ||
![]() |
1f50fa8f4d | ||
![]() |
49d68f4eee | ||
![]() |
c73d2a7422 | ||
![]() |
73f79b6036 | ||
186f2029c6 | |||
![]() |
3f164288ac | ||
![]() |
d9bcd0fa27 | ||
![]() |
d51e8bc895 | ||
![]() |
f6a207cb61 | ||
![]() |
538ca07f4b | ||
![]() |
332c7ed494 | ||
![]() |
92b4c1355a | ||
![]() |
5c4a77fc9c | ||
![]() |
cdf2c3eed7 | ||
![]() |
ea0ddac967 | ||
![]() |
17818c0a84 | ||
![]() |
e1d6aced4c | ||
![]() |
45e2ac2e14 | ||
![]() |
3c79f88de1 | ||
![]() |
9f92573c8d | ||
![]() |
0eb6d8607d | ||
![]() |
374d8ea6f6 | ||
![]() |
00f49b08f0 | ||
![]() |
96ce4310e4 | ||
![]() |
eba3732a72 | ||
![]() |
f9b081d4d4 | ||
![]() |
6ee37ae389 | ||
![]() |
8da2085806 | ||
![]() |
4a0b9cfbae | ||
![]() |
ff602c7d6b | ||
![]() |
50a9195cdd | ||
![]() |
98dd3970e7 | ||
![]() |
c98f561022 | ||
![]() |
d2fa4826cc | ||
![]() |
6a2853b6a4 | ||
![]() |
c148c5fcc7 | ||
![]() |
36e902a2af | ||
![]() |
45419c7c35 | ||
![]() |
edfdcd96ab | ||
![]() |
9a47e8e728 | ||
![]() |
7d73fe7d8b | ||
![]() |
c731fa3976 | ||
![]() |
4ca0700e96 | ||
![]() |
2183507283 | ||
![]() |
0f2c0e0982 | ||
![]() |
83ccb3ae92 | ||
![]() |
9d24f39dfa | ||
![]() |
406a8555e0 | ||
![]() |
6144dea271 | ||
![]() |
a652dd2a54 | ||
![]() |
e66e0d1a68 | ||
![]() |
1bc49b39fa | ||
![]() |
d89974dd51 | ||
![]() |
89606dc0a3 | ||
![]() |
d79fabc563 | ||
![]() |
c117168eb5 | ||
![]() |
790d357c49 | ||
![]() |
52f386c61b | ||
![]() |
121de0459d | ||
![]() |
814f7f2821 | ||
![]() |
5c1273ba4c | ||
![]() |
1713b3f187 | ||
![]() |
775fabd126 | ||
![]() |
9b498de149 | ||
![]() |
85cc16a8cd | ||
![]() |
8f3c7a2a45 | ||
![]() |
ee01071f92 | ||
![]() |
62f53f1e19 | ||
![]() |
60defd526b | ||
![]() |
18c7338903 | ||
![]() |
a000ab203c | ||
![]() |
9f1c440ab7 | ||
![]() |
d5c109e0a4 | ||
![]() |
75c7cd4d6b | ||
![]() |
9049b0784f | ||
![]() |
e44c0c202d | ||
![]() |
fb92e4106a | ||
![]() |
2fb707edad | ||
![]() |
b13b8eceef | ||
![]() |
e9434ace57 | ||
![]() |
4339b0265e | ||
![]() |
ffeb73f820 | ||
![]() |
cd407fe401 | ||
![]() |
07bf892d67 | ||
![]() |
edd8d051f9 | ||
![]() |
bd248fc2cb | ||
![]() |
5178b6079d | ||
![]() |
a537f98180 | ||
![]() |
8b56240eaa | ||
![]() |
5b48be926e | ||
![]() |
beed5aef29 | ||
![]() |
43802d4b23 | ||
![]() |
ad93d3f05c | ||
![]() |
170bf379ae | ||
![]() |
8fb9aeddbe | ||
![]() |
a85a59cbd9 | ||
![]() |
9dde757e8a | ||
![]() |
a9b62cbdd6 | ||
![]() |
c5f35f6532 | ||
![]() |
0ca38971e0 | ||
![]() |
3dba51a7b3 | ||
![]() |
f3467e9dd8 | ||
![]() |
951861c36e | ||
![]() |
60c95e000e | ||
![]() |
074cad1ca4 | ||
![]() |
c8af6af007 | ||
![]() |
cbda2c026f | ||
![]() |
38690a5c9a | ||
![]() |
9149c3d634 | ||
![]() |
16fc88fb9b | ||
![]() |
f75900d0b8 | ||
![]() |
7601aca958 | ||
![]() |
674c057b1f | ||
![]() |
37dabba9a1 | ||
![]() |
6b246e6838 | ||
![]() |
6e90abe2b3 | ||
![]() |
0a7e3f6356 | ||
![]() |
4ee45bdf08 | ||
![]() |
d615e50733 | ||
![]() |
00dc9c1c0a | ||
![]() |
7acd784349 | ||
![]() |
32d0c15469 | ||
![]() |
364ad31f15 | ||
![]() |
c3546dd83e | ||
![]() |
b34eec7c68 | ||
![]() |
fe312ed117 | ||
![]() |
ecfaf3c1bf | ||
![]() |
29d0715d80 | ||
![]() |
f68298958c | ||
![]() |
cee7b56ab0 | ||
![]() |
aa0e5c9ae6 | ||
![]() |
cb6c7730a8 | ||
![]() |
7f5a326a85 | ||
![]() |
20555862b6 | ||
![]() |
b08274f2f7 | ||
![]() |
74ff44a8ad | ||
![]() |
84c1407168 | ||
![]() |
68e261ea0b | ||
![]() |
c1908d8178 | ||
![]() |
1f468b61d2 | ||
![]() |
108a8f36f2 | ||
![]() |
f1a6d17923 | ||
![]() |
c31b4ad335 | ||
![]() |
414f6435ca | ||
![]() |
45624625f4 | ||
![]() |
217c0166cd | ||
![]() |
9fb8a0e279 | ||
![]() |
b580c85738 |
@ -388,12 +388,17 @@ class CompanyController extends BaseAdminController
|
||||
// $master_email=substr(md5(uniqid()),rand(0, 22),10)."@lihai.com";
|
||||
// }
|
||||
|
||||
// 根据street码查询所属镇农科公司
|
||||
$company_select=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$params['street']], true);
|
||||
if(empty($company_select)) {
|
||||
throw new Exception('当前区域无镇农科公司');
|
||||
// 市级供应链直接和海之农签约
|
||||
if (isset($params['type_id']) && $params['type_id'] == 12) {
|
||||
$company = Company::where(['company_name' => '泸州市海之农科技有限公司'])->find();
|
||||
} else {
|
||||
// 根据street码查询所属镇农科公司
|
||||
$company_select=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$params['street']], true);
|
||||
if(empty($company_select)) {
|
||||
throw new Exception('当前区域无镇农科公司');
|
||||
}
|
||||
$company=$company_select[0];
|
||||
}
|
||||
$company=$company_select[0];
|
||||
$data = [
|
||||
'mer_intention_id' => $params['mer_intention_id']??'', // 商城商户入驻申请id,签约完成后回调使用
|
||||
'company_name' => $params['company_name']??'',
|
||||
@ -504,12 +509,13 @@ class CompanyController extends BaseAdminController
|
||||
'sn' => generate_sn(CompanyAccountLog::class, 'sn', 20),
|
||||
'user_id' => 0,
|
||||
'company_id' => $param['company_id'],
|
||||
'change_type' => 300,
|
||||
'change_object' => 2,
|
||||
'change_type' => CompanyAccountLog::COMPANY_DEPOSIT,
|
||||
'change_object' => CompanyAccountLog::DEPOSIT,
|
||||
'action' => 1,
|
||||
'change_amount' => $param['deposit'],
|
||||
'left_amount' =>$left_amount,
|
||||
'remark' => '后台押金转账凭证充值',
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($datas);
|
||||
|
||||
|
@ -4,9 +4,17 @@ namespace app\adminapi\controller\approve;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\approve\ApproveLists;
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\logic\AccountLogLogic;
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\common\model\Approve;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use think\facade\Db;
|
||||
|
||||
class ApproveController extends BaseAdminController
|
||||
@ -16,14 +24,24 @@ class ApproveController extends BaseAdminController
|
||||
return $this->dataLists(new ApproveLists());
|
||||
}
|
||||
|
||||
public function lists2()
|
||||
{
|
||||
return $this->success('成功',(new ApproveLists())->lists2());
|
||||
}
|
||||
|
||||
public function lists3()
|
||||
{
|
||||
return $this->success('成功',(new ApproveLists())->lists3());
|
||||
}
|
||||
public function audit()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param(); // id check_status remark
|
||||
$params = $this->request->param(); // id check_status remark amount
|
||||
$approve = Approve::find($params['id']);
|
||||
if (!$approve) {
|
||||
$this->fail('数据不存在');
|
||||
}
|
||||
|
||||
Db::startTrans();
|
||||
// 拒绝通过 要让用户今天可以继续做任务
|
||||
if ($params['check_status'] == 3) {
|
||||
@ -31,23 +49,111 @@ class ApproveController extends BaseAdminController
|
||||
}
|
||||
// 修改任务完成状态
|
||||
if ($params['check_status'] == 2) {
|
||||
$this->pass($approve);
|
||||
if ($approve->type == Approve::APPROVE_TYPE_7) {
|
||||
$taskTemplate = TaskTemplate::where(['id'=>$approve->business_id])->find();
|
||||
// 提前完成
|
||||
if ($taskTemplate['day_count'] < $taskTemplate['stage_day_one']) {
|
||||
if (bccomp($params['amount'], 300000, 2) == -1) {
|
||||
return $this->fail('该任务提前完成条件:销售总额必须达到30万元及以上');
|
||||
} else {
|
||||
// 提前完成标识
|
||||
$extend = $taskTemplate['extend'];
|
||||
$extend['early_finish'] = 1;
|
||||
$taskTemplate->extend = json_encode($extend);
|
||||
$taskTemplate->save();
|
||||
$this->pass($approve, $params);
|
||||
}
|
||||
} else {
|
||||
$this->pass($approve, $params);
|
||||
}
|
||||
} else {
|
||||
$this->pass($approve, $params);
|
||||
}
|
||||
|
||||
}
|
||||
Db::commit();
|
||||
return $this->success('审核成功');
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
return $this->fail($e->getMessage());
|
||||
return $this->fail($e->getFile().$e->getLine().$e->getMessage());
|
||||
}
|
||||
}
|
||||
// 通过
|
||||
private function pass($approve)
|
||||
private function pass($approve, $params=[])
|
||||
{
|
||||
Db::startTrans();
|
||||
$approve->check_status = 2;
|
||||
$approve->update_time = time();
|
||||
$approve->save();
|
||||
// 任务
|
||||
$task = Task::find($approve['task_id']);
|
||||
if ($task['status'] == 2) {
|
||||
$task->status = 3;
|
||||
$task->save();
|
||||
}
|
||||
Db::commit();
|
||||
|
||||
// 镇合伙人公司任务-数字农贸宣传业务、加工业务的建设和招商工作任务 结算
|
||||
if ($approve->type == Approve::APPROVE_TYPE_4) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealTaskMarketingDirector10($taskSchedulePlan, $approve);
|
||||
}
|
||||
|
||||
if ($approve->type == Approve::APPROVE_TYPE_5) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealVillageTask6($taskSchedulePlan);
|
||||
}
|
||||
|
||||
if ($approve->type == Approve::APPROVE_TYPE_6) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealVillageTask8($taskSchedulePlan);
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_7) {
|
||||
// 需要手动输入销售总额
|
||||
$approve->amount = $params['amount'];
|
||||
$approve->save();
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_8) {
|
||||
// 需要手动输入申请的政策补贴金额
|
||||
$approve->amount = $params['amount'];
|
||||
$approve->save();
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::masterTask7Settlement($taskSchedulePlan);
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_9) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::masterTask8Settlement($taskSchedulePlan);
|
||||
}
|
||||
}
|
||||
|
||||
// 拒绝
|
||||
@ -74,4 +180,248 @@ class ApproveController extends BaseAdminController
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* 股金任务审批
|
||||
*/
|
||||
public function shareholderMoneyTaskAudit()
|
||||
{
|
||||
// try {
|
||||
$params = $this->request->param(); // id check_status remark
|
||||
$approve = Approve::find($params['id']);
|
||||
if (!empty($approve)) {
|
||||
$this->fail('数据不存在');
|
||||
}
|
||||
// 拒绝通过 要让用户今天可以继续做任务
|
||||
if ($params['check_status'] == 3) {
|
||||
$this->refuse1($params, $approve);
|
||||
}
|
||||
if ($params['check_status'] == 2) {
|
||||
$this->pass1($approve, $params);
|
||||
}
|
||||
// } catch (\Exception $e) {
|
||||
// return $this->fail($e->getMessage());
|
||||
// }
|
||||
}
|
||||
|
||||
private function refuse1($params, $approve)
|
||||
{
|
||||
$approve->check_status = $params['check_status'];
|
||||
$approve->remark = $params['remark'];
|
||||
$approve->update_time = time();
|
||||
$approve->save();
|
||||
}
|
||||
|
||||
private function pass1($approve, $params)
|
||||
{
|
||||
Db::startTrans();
|
||||
|
||||
// 审批
|
||||
$approve->check_status = 2;
|
||||
$approve->update_time = time();
|
||||
$approve->remark = $params['remark'];
|
||||
$approve->save();
|
||||
|
||||
// 任务
|
||||
$task = Task::find($approve['task_id']);
|
||||
if ($task['status'] == 2) {
|
||||
$task->status = 3;
|
||||
$task->save();
|
||||
}
|
||||
Db::commit();
|
||||
// 小组服务公司股金上交 小组服务团队-入股任务
|
||||
// if ($approve->type == Approve::APPROVE_TYPE_10) {
|
||||
// // 小组服务公司
|
||||
// $subordinateCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// // 村公司
|
||||
// $parentCompany = Company::where(['village'=>$subordinateCompany['village'], 'company_type'=>17])->find();
|
||||
// }
|
||||
//
|
||||
// // 村联络员-督促小组服务团队入股任务
|
||||
// if ( $approve->type == Approve::APPROVE_TYPE_11) {
|
||||
// $parentCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// }
|
||||
//
|
||||
// // 村管理公司股金上交 村联络员任务-入股甲方公司
|
||||
// if ($approve->type == Approve::APPROVE_TYPE_12) {
|
||||
// // 村公司
|
||||
// $subordinateCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// // 镇农科公司 负责区域包含有村公司的street码
|
||||
// $parentCompany = Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$subordinateCompany['street']], true)[0];
|
||||
// }
|
||||
//
|
||||
// // 镇农科服务部长-督促小组服务团队入股村管理公司任务
|
||||
// if ($approve->type == Approve::APPROVE_TYPE_13) {
|
||||
// $parentCompany = Company::where(['id'=>$approve->department_id])->find(); //无法确定那个小组服务公司入股到哪个村管理公司
|
||||
// }
|
||||
//
|
||||
// // 镇农科负责人任务-促成村联络员入股甲方
|
||||
// if ($approve->type == Approve::APPROVE_TYPE_14) {
|
||||
// // 镇农科公司
|
||||
// $parentCompany = Company::where(['id'=>$approve->department_id])->find();
|
||||
// }
|
||||
//
|
||||
// $amount = $approve->amount; // 上交股金金额
|
||||
//
|
||||
// $subordinateCompany->shareholder_money = $amount;
|
||||
// $subordinateCompany->save();
|
||||
//
|
||||
// // 添加入股记录
|
||||
// $this->addConpanyAccountLog($parentCompany, $amount, $task);
|
||||
|
||||
|
||||
// 小组服务团队-入股任务结算
|
||||
if ($approve->type == Approve::APPROVE_TYPE_10) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 18)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
$taskInfo = $task->toArray();
|
||||
$company = Company::where(['id' => $taskInfo['company_id']])->find();
|
||||
$this->taskSettlement($taskInfo, $company, $taskSchedulingPaln);
|
||||
}
|
||||
// 村联络员-督促小组服务团队入股
|
||||
if ($approve->type == Approve::APPROVE_TYPE_11) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::dealVillageTask4($taskSchedulingPaln, $approve);
|
||||
}
|
||||
// 村联络员-入股甲方公司
|
||||
if ($approve->type == Approve::APPROVE_TYPE_12) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::dealVillageTask5($taskSchedulingPaln, $approve);
|
||||
}
|
||||
// 镇合伙人服务部长-督促小组服务团队入股村管理公司任务
|
||||
if ($approve->type == Approve::APPROVE_TYPE_13) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::dealTownTask6($taskSchedulingPaln, $approve);
|
||||
}
|
||||
// 镇合伙人负责人-促成村联络员入股甲方
|
||||
if ($approve->type == Approve::APPROVE_TYPE_14) {
|
||||
$taskSchedulingPaln = TaskSchedulingPlan::where(['task_id' => $task->id])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray()[0];
|
||||
TaskLogic::masterTask6Settlement($taskSchedulingPaln, $approve);
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
private function addConpanyAccountLog($parentCompany, $amount, $task)
|
||||
{
|
||||
// 接收股金公司股金变更 + 公司股金增加记录
|
||||
$addAmount = bcadd($parentCompany['shareholder_money'], $amount, 2);
|
||||
Company::where('id', $parentCompany['id'])->save(['shareholder_money'=>$addAmount]);
|
||||
|
||||
// 公司账户变动记录
|
||||
$company_log2 = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $parentCompany['id'],
|
||||
'change_object' => CompanyAccountLog::SHAREHOLDER, // 变动对象 1余额 2股金
|
||||
'change_type' => CompanyAccountLog::TASK_INC_SHAREHOLDER_MONEY, //变动类型
|
||||
'action' => CompanyAccountLog::INC, //1-增加 2-减少
|
||||
'left_amount' => $addAmount, //变动后数量
|
||||
'change_amount' => $amount, //变动数量
|
||||
'extend' => json_encode(['task_id' => $task->id]),
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log2);
|
||||
}
|
||||
|
||||
public function taskSettlement($data, $company, $datas = [])
|
||||
{
|
||||
$proportion = 0;
|
||||
$remark = '来自任务【' . $datas['template_info']['title'] . '】,';
|
||||
//总金额除以2等于不可提现账号金额和收益
|
||||
$master_money = bcdiv($data['money'], 2, 2);
|
||||
//收益的百分之25为负责人的收益其余为成员的平分收益
|
||||
$master_money_user = bcdiv($master_money, 2, 2);
|
||||
|
||||
//成员数量
|
||||
$userAll = User::where('company_id', $data['company_id'])->where('admin_id', 0)->field('id,user_money')->select();
|
||||
$yser_all_count = count($userAll);
|
||||
$member_money_user = bcdiv($master_money_user, $yser_all_count, 2);
|
||||
|
||||
//负责人
|
||||
$arr = [$company['user_id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC, $master_money_user, $datas['sn'], $remark . '获得收益' . $master_money_user . '元', ['company_id' => $data['company_id'], 'proportion' => $proportion], $data['status']];
|
||||
$this->master($arr);
|
||||
$arr_two = [$company['user_id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC, $master_money_user, $datas['sn'], $remark. '获得账户余额' . $master_money_user . '元', ['company_id' => $data['company_id'], 'proportion' => $proportion], $data['status']];
|
||||
$this->Account($arr_two);
|
||||
|
||||
//成员
|
||||
foreach ($userAll as $value) {
|
||||
$arr = [$value['id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC, $member_money_user, $datas['sn'], $remark . '获得收益' . $member_money_user . '元', ['company_id' => $data['company_id'], 'proportion' => $proportion], $data['status']];
|
||||
$this->member($arr);
|
||||
$arr_two = [$value['id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC, $member_money_user, $datas['sn'], $remark. '获得账户余额' . $member_money_user . '元', ['company_id' => $data['company_id'], 'proportion' => $proportion], $data['status']];
|
||||
$this->Account($arr_two);
|
||||
}
|
||||
|
||||
//公司
|
||||
$deposit_count = bcadd($company['deposit'], $master_money, 2);
|
||||
$this->AccountLog($data['company_id'], $deposit_count, $master_money);
|
||||
|
||||
$company_money_count = bcadd($company['company_money'], $master_money, 2);
|
||||
$this->AccountLog($data['company_id'], $company_money_count, $master_money);
|
||||
Company::where('id', $data['company_id'])->update(['deposit' => Db::raw('deposit+' . $master_money), 'company_money' => Db::raw('company_money+' . $master_money)]);
|
||||
}
|
||||
|
||||
public function AccountLog($companyId, $left_amount, $changeAmount, $change_object = 1, $change_type = 1, $action = 1)
|
||||
{
|
||||
$company_log = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $companyId,
|
||||
'change_object' => $change_object, //变动对象
|
||||
'change_type' => $change_type, //变动类型
|
||||
'action' => $action, //1-增加 2-减少
|
||||
'left_amount' => $left_amount, //变动后数量
|
||||
'change_amount' => $changeAmount, //变动数量
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log);
|
||||
}
|
||||
|
||||
/**负责人的分润
|
||||
* @param $data
|
||||
*/
|
||||
private function master($data)
|
||||
{
|
||||
User::where('id', $data[0])->update(['deposit'=>Db::raw('deposit+' . $data[3]),'user_money'=>Db::raw('user_money+' . $data[3])]);
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
|
||||
/**成员分润
|
||||
* @param $data
|
||||
*/
|
||||
private function member($data)
|
||||
{
|
||||
User::where('id', $data[0])->update(['deposit'=>Db::raw('deposit+' . $data[3]),'user_money'=>Db::raw('user_money+' . $data[3])]);
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
|
||||
private function Account($data)
|
||||
{
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ use app\adminapi\controller\BaseAdminController;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\model\contract\VehicleContract;
|
||||
use app\common\model\vehicle\VehicleRent;
|
||||
|
||||
class VehicleContractController extends BaseAdminController
|
||||
{
|
||||
@ -39,6 +40,7 @@ class VehicleContractController extends BaseAdminController
|
||||
'id' => $vehicle_contract['contract_logistic_id'],
|
||||
'file' => $params['file'],
|
||||
'status' => 1,
|
||||
'update_time' => time()
|
||||
];
|
||||
//判断合同类型
|
||||
if($vehicle_contract['type'] == 0 && $vehicle_contract['contract_logistic_id'] != 0){
|
||||
@ -143,7 +145,7 @@ class VehicleContractController extends BaseAdminController
|
||||
if($contract->isEmpty()){
|
||||
return $this->fail('数据不存在');
|
||||
}
|
||||
if($contract['status'] != 1){
|
||||
if(!($contract['status'] == 1 || ($contract['status'] == 2 && $contract['signing_timer'] != 2))){
|
||||
return $this->fail('合同状态错误');
|
||||
}
|
||||
$signData = [
|
||||
@ -157,7 +159,11 @@ class VehicleContractController extends BaseAdminController
|
||||
$notify_url = '';
|
||||
if($contract['type'] == 0){
|
||||
$smsTitle = '《租赁合同》';
|
||||
$notify_url = env('project.website_domain').'/api/index/townCarRent';
|
||||
if(empty($contract['contract_logistic_id'])){
|
||||
$notify_url = env('project.website_domain').'/api/index/systemCarRent';
|
||||
}else{
|
||||
$notify_url = env('project.website_domain').'/api/index/townCarRent';
|
||||
}
|
||||
}elseif($contract['type'] == 1){
|
||||
$smsTitle = '《自有车辆上传合同》';
|
||||
$notify_url = env('project.website_domain').'/api/index/selfCarRent';
|
||||
@ -173,13 +179,16 @@ class VehicleContractController extends BaseAdminController
|
||||
$contract->save([
|
||||
'id' => $contract['id'],
|
||||
'contract_no' => $signRes->data,
|
||||
'status' => 2
|
||||
'status' => 2,
|
||||
'signing_timer' => 0
|
||||
]);
|
||||
if(!empty($contract['contract_logistic_id'])){
|
||||
curl_post(env('project.logistic_domain').'/api/contractUpdate',[],[
|
||||
'id' => $contract['contract_logistic_id'],
|
||||
'contract_no' => $signRes->data,
|
||||
'status' => 2,
|
||||
'signing_timer' => 0,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}
|
||||
$this->sendSms($params['id'],$smsTitle);
|
||||
@ -260,14 +269,49 @@ class VehicleContractController extends BaseAdminController
|
||||
if($data->isEmpty()){
|
||||
return $this->fail('未查找到数据');
|
||||
}
|
||||
$cars = json_decode($data['cars_info'],true);
|
||||
//判断合同类型
|
||||
if($data['type'] == 0 && $data['contract_logistic_id'] != 0){
|
||||
//获取平台车辆
|
||||
if(!empty($data['contract_logistic_id']) && $data['type'] == 0){
|
||||
$carList = curl_get(env('project.logistic_domain').'/api/getAvailableVehicles');
|
||||
$data['car_list'] = $carList&&$carList['code']==1 ? $carList['data'] : [];
|
||||
}else{
|
||||
$data['cars_info'] = json_decode($data['cars_info'],true);
|
||||
}
|
||||
if(!empty($cars)){
|
||||
foreach ($cars as $k=>$v) {
|
||||
if($data['type'] == 0){
|
||||
$cars[$k]['type'] = 0;
|
||||
}
|
||||
if($data['type'] == 1){
|
||||
if(empty($v['id'])){
|
||||
$cars[$k]['type'] = 1;
|
||||
}else{
|
||||
$rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
|
||||
if($rentInfo->isEmpty()){
|
||||
$cars[$k]['type'] = 0;
|
||||
}else{
|
||||
$cars[$k]['type'] = $rentInfo['type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if($data['type'] == 2){
|
||||
$rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
|
||||
if($rentInfo->isEmpty()){
|
||||
$cars[$k]['type'] = 0;
|
||||
}else{
|
||||
$cars[$k]['type'] = $rentInfo['type'];
|
||||
}
|
||||
}
|
||||
if($data['type'] == 3){
|
||||
$rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
|
||||
if($rentInfo->isEmpty()){
|
||||
$cars[$k]['type'] = 2;
|
||||
}else{
|
||||
$cars[$k]['type'] = $rentInfo['type'];
|
||||
}
|
||||
}
|
||||
$cars[$k]['rent_time'] = $data['update_time'];
|
||||
}
|
||||
}
|
||||
$data['cars_info'] = $cars;
|
||||
return $this->success('success',$data->toArray());
|
||||
}
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
|
||||
namespace app\adminapi\controller\create_task_template;
|
||||
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\create_task_template\CreateTaskTemplateLists;
|
||||
use app\adminapi\logic\create_task_template\CreateTaskTemplateLogic;
|
||||
use app\adminapi\validate\create_task_template\CreateTaskTemplateValidate;
|
||||
use app\common\model\dict\DictData;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate控制器
|
||||
* Class CreateTaskTemplateController
|
||||
* @package app\adminapi\controller\create_task_template
|
||||
*/
|
||||
class CreateTaskTemplateController extends BaseAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
return $this->dataLists(new CreateTaskTemplateLists());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new CreateTaskTemplateValidate())->post()->goCheck('add');
|
||||
$params['admin_id'] = $this->adminId;
|
||||
$result = CreateTaskTemplateLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CreateTaskTemplateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new CreateTaskTemplateValidate())->post()->goCheck('edit');
|
||||
$result = CreateTaskTemplateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CreateTaskTemplateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new CreateTaskTemplateValidate())->post()->goCheck('delete');
|
||||
CreateTaskTemplateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new CreateTaskTemplateValidate())->goCheck('detail');
|
||||
$result = CreateTaskTemplateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function taskTypeList()
|
||||
{
|
||||
$taskRoleId = $this->request->param('task_role_id');
|
||||
$result = CreateTaskTemplateLogic::taskTypeList($taskRoleId);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function selectList()
|
||||
{
|
||||
|
||||
$role = $this->request->param('task_role_id');
|
||||
$list = CreateTaskTemplateLogic::getList($role);
|
||||
return $this->data($list);
|
||||
}
|
||||
|
||||
public function taskTypeInfo()
|
||||
{
|
||||
$type = ['town_task_type_master', 'town_task_type_marketing_director', 'town_task_type', 'village_task_type', 'task_type'];
|
||||
$lists = DictData::whereIn('type_value', $type)->column('name', 'id');
|
||||
return $this->data($lists);
|
||||
}
|
||||
|
||||
}
|
@ -55,7 +55,7 @@ class AccountLogController extends BaseAdminController
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$companyId = $param['company_id'];
|
||||
$userList = User::where(['company_id' => $companyId])->field('id,nickname,avatar,sn,mobile,group_id,deposit,income')->select()->toArray();
|
||||
$userList = User::where(['company_id' => $companyId])->field('id,nickname,avatar,sn,mobile,group_id,deposit,income,user_money')->select()->toArray();
|
||||
return $this->success('成功', $userList);
|
||||
}
|
||||
|
||||
|
@ -101,5 +101,16 @@ class DictDataController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getTaskApproveTypeList()
|
||||
{
|
||||
$result = DictDataLogic::getTaskApproveTypeList();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getShareholderMoneyTaskApproveTypeList()
|
||||
{
|
||||
$result = DictDataLogic::getShareholderMoneyTaskApproveTypeList();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
}
|
@ -116,5 +116,19 @@ class TaskSchedulingPlanController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getDayTaskList()
|
||||
{
|
||||
$companyId = $this->request->param('company_id', 0);
|
||||
$date = $this->request->param('date',);
|
||||
$lists = TaskSchedulingPlan::where(['company_id' => $companyId])
|
||||
->where('start_time', strtotime($date))
|
||||
->with(['template','templateInfo', 'task'])
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $this->success('', compact('lists'));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -18,9 +18,11 @@ namespace app\adminapi\controller\task_template;
|
||||
|
||||
use app\adminapi\controller\BaseAdminController;
|
||||
use app\adminapi\lists\task_template\TaskTemplateLists;
|
||||
use app\common\logic\ShopRequestLogic;
|
||||
use app\common\logic\task_template\TaskTemplateLogic;
|
||||
use app\adminapi\validate\task_template\TaskTemplateValidate;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task\Task;
|
||||
|
||||
|
||||
/**
|
||||
@ -55,9 +57,11 @@ class TaskTemplateController extends BaseAdminController
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('add');
|
||||
$params['admin_id'] = $this->adminId;
|
||||
$company = Company::find($params['company_id']);
|
||||
if ($company->company_type == 41) {
|
||||
// 创建 镇农科公司 任务模板
|
||||
if ($company->company_type == 16) {
|
||||
// 创建 镇合伙人公司 任务模板
|
||||
$result = TaskTemplateLogic::addTownTaskTemplate($params);
|
||||
} else if ($company->company_type == 17) {
|
||||
$result = TaskTemplateLogic::addVillageTaskTemplate($params);
|
||||
} else {
|
||||
$result = TaskTemplateLogic::add($params);
|
||||
}
|
||||
@ -99,6 +103,10 @@ class TaskTemplateController extends BaseAdminController
|
||||
public function delete()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('delete');
|
||||
$task = Task::where(['template_id' =>$params['id']])->whereDay('start_time', 'today')->find();
|
||||
if(!empty($task)) {
|
||||
return $this->fail('该任务今天已在进行中,无法删除');
|
||||
}
|
||||
TaskTemplateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
@ -117,5 +125,44 @@ class TaskTemplateController extends BaseAdminController
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getProductList()
|
||||
{
|
||||
$param = $this->request->param(); // page keyword
|
||||
$p['page'] = $param['page_no'] ?? 1;
|
||||
$p['keyword'] = $param['keyword'] ??'';
|
||||
$result = ShopRequestLogic::getProductList($p);;
|
||||
// $result['data']['count'] = 1000;
|
||||
$data = [
|
||||
'lists' => $result['data']['data'],
|
||||
'count' => $result['data']['count'],
|
||||
'page_no' => $result['data']['page'],
|
||||
'page_size' => 10,
|
||||
];
|
||||
return $this->data($data);
|
||||
}
|
||||
|
||||
public function checkRole()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if ($params['task_role'] == 1) {
|
||||
$serviceManagerUser = (new User())->searchMaster($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
return $this->fail('公司还没有负责人,无法指派任务');
|
||||
}
|
||||
}
|
||||
if ($params['task_role'] == 2) {
|
||||
$serviceManagerUser = (new User())->searchMarketingManager($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
return $this->fail('公司还没有市场部长,无法指派任务');
|
||||
}
|
||||
}
|
||||
|
||||
if ($params['task_role'] == 3) {
|
||||
$serviceManagerUser = (new User())->searchServiceManager($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
return $this->fail('公司还没有服务部长,无法指派任务');
|
||||
}
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
}
|
@ -114,7 +114,7 @@ class UserController extends BaseAdminController
|
||||
public function Draftingcontracts()
|
||||
{
|
||||
$params = Request::param();
|
||||
$result = ContractLogic::Draftingcontracts($params);
|
||||
$result = ContractLogic::Draftingcontracts($params, 2);
|
||||
if ($result === true) {
|
||||
return $this->success('发送合同成功', [], 1, 1);
|
||||
} else {
|
||||
|
@ -7,6 +7,7 @@ use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\Approve;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task\Task;
|
||||
use think\facade\Db;
|
||||
|
||||
class ApproveLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
@ -20,7 +21,8 @@ class ApproveLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['type']
|
||||
'in' => ['type'],
|
||||
'='=>['check_status']
|
||||
];
|
||||
}
|
||||
|
||||
@ -46,11 +48,92 @@ class ApproveLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
return Admin::where(['id' => $data['check_admin_ids']])->value('name');
|
||||
})
|
||||
->withAttr('company_name',function($value,$data){
|
||||
return Company::where(['admin_id' => $data['check_admin_ids']])->value('company_name');
|
||||
$task = Task::where('id', $data['task_id'])->find();
|
||||
return Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
public function lists2(): array
|
||||
{
|
||||
$list = Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->with('task')
|
||||
->field('*')
|
||||
->append(['area_manager', 'company_name'], true)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
$company = Company::where(['admin_id'=>$data['check_admin_ids']])->find();
|
||||
return Admin::where(['id' => $company['area_manager']])->value('name');
|
||||
})
|
||||
->withAttr('company_name',function($value,$data){
|
||||
$company = Company::where(['admin_id'=>$data['check_admin_ids']])->find();
|
||||
return $company['company_name'];
|
||||
})
|
||||
->toArray();
|
||||
$count = Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())->count();
|
||||
|
||||
return [
|
||||
'lists' => $list,
|
||||
'count' => $count,
|
||||
'page_no' => $this->pageNo,
|
||||
'page_size' => $this->pageSize,
|
||||
];
|
||||
}
|
||||
|
||||
public function lists3(): array
|
||||
{
|
||||
$list = Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())
|
||||
->with('task')
|
||||
->field('*')
|
||||
->append(['area_manager', 'company_a_name', 'company_b_name'], true)
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
return Admin::where(['id' => $data['check_admin_ids']])->value('name');
|
||||
})
|
||||
->withAttr('company_b_name',function($value,$data){
|
||||
$task = Task::where('id', $data['task_id'])->find();
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_11) {
|
||||
return '下属小组服务公司';
|
||||
}
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_13) {
|
||||
$townCompanyName = Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
return $townCompanyName.'(镇农科公司)下属小组服务公司';
|
||||
}
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_14) {
|
||||
return '下属村管理公司';
|
||||
}
|
||||
return Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
})
|
||||
->withAttr('company_a_name',function($value,$data){
|
||||
$task = Task::where('id', $data['task_id'])->find();
|
||||
$companyB = Company::where(['id' => $task['company_id']])->find();
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_12 || $data['type'] == Approve::APPROVE_TYPE_14) {
|
||||
return Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$companyB['street']], true)[0]['company_name'];
|
||||
}
|
||||
if ($data['type'] == Approve::APPROVE_TYPE_13) {
|
||||
$townCompanyName = Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
return $townCompanyName.'(镇农科公司)下属村管理公司';
|
||||
}
|
||||
return Company::where(['village' => $companyB['village'], 'company_type'=>17])->value('company_name');
|
||||
})
|
||||
->toArray();
|
||||
$count = Approve::where($this->searchWhere)
|
||||
->where($this->queryWhere())->count();
|
||||
|
||||
return [
|
||||
'lists' => $list,
|
||||
'count' => $count,
|
||||
'page_no' => $this->pageNo,
|
||||
'page_size' => $this->pageSize,
|
||||
];
|
||||
}
|
||||
|
||||
public function count(): int
|
||||
{
|
||||
|
@ -0,0 +1,82 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\lists\create_task_template;
|
||||
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\create_task_template\CreateTaskTemplate;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate列表
|
||||
* Class CreateTaskTemplateLists
|
||||
* @package app\adminapi\listscreate_task_template
|
||||
*/
|
||||
class CreateTaskTemplateLists extends BaseAdminDataLists implements ListsSearchInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 设置搜索条件
|
||||
* @return \string[][]
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
return [
|
||||
'=' => ['title', 'task_role_id', 'type'],
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取列表
|
||||
* @return array
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function lists(): array
|
||||
{
|
||||
return CreateTaskTemplate::where($this->searchWhere)
|
||||
->field(['id', 'title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'recharge', 'content'])
|
||||
->append(['admin_name'])
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->withAttr('admin_name', function ($value, $data) {
|
||||
return Admin::where('id', $data['admin_id'])->value('name');
|
||||
})
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取数量
|
||||
* @return int
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function count(): int
|
||||
{
|
||||
return CreateTaskTemplate::where($this->searchWhere)->count();
|
||||
}
|
||||
|
||||
}
|
@ -97,7 +97,6 @@ class RefundRecordLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
foreach ($lists as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
}
|
||||
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
@ -17,6 +17,7 @@ namespace app\adminapi\lists\informationg;
|
||||
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\model\informationg\UserInformationgDemand;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
|
||||
|
||||
@ -61,6 +62,23 @@ class UserInformationgLists extends BaseAdminDataLists implements ListsSearchInt
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->select()
|
||||
->toArray();
|
||||
$informationIdArray = [];
|
||||
foreach($lists as $k=>$v) {
|
||||
$informationIdArray[] = $v['id'];
|
||||
}
|
||||
$data = UserInformationgDemand::whereIn('information_id', $informationIdArray)->order('id', 'desc')->select();
|
||||
$aianalyseArray = [];
|
||||
foreach($data as $kk=>$vv) {
|
||||
if (!empty($vv['ai_aianalyse'])) {
|
||||
$aianalyseArray[$vv['information_id']][] = $vv['id'];
|
||||
}
|
||||
}
|
||||
foreach($lists as $k=>$v) {
|
||||
$lists[$k]['aianalyse_status'] = 0;
|
||||
if (!empty($aianalyseArray[$v['id']])) {
|
||||
$lists[$k]['aianalyse_status'] = 1;
|
||||
}
|
||||
}
|
||||
return $lists;
|
||||
}
|
||||
|
||||
|
@ -19,6 +19,7 @@ use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\lists\ListsSearchInterface;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\model\user\User;
|
||||
|
||||
/**
|
||||
* 任务模板列表
|
||||
@ -59,6 +60,16 @@ class TaskTemplateLists extends BaseAdminDataLists implements ListsSearchInterfa
|
||||
->limit($this->limitOffset, $this->limitLength)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->append(['task_admin_name'])
|
||||
->withAttr("task_admin_name", function ($value,$data) {
|
||||
if ($data['type'] == 35) {
|
||||
$extend = json_decode($data['extend'], true);
|
||||
$userName = User::where('id', $extend['shareholder']['user_id'])->value('nickname');
|
||||
return $userName;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
})
|
||||
->toArray();
|
||||
}
|
||||
|
||||
|
@ -16,6 +16,7 @@ namespace app\adminapi\lists\user;
|
||||
use app\adminapi\lists\BaseAdminDataLists;
|
||||
use app\common\enum\user\UserTerminalEnum;
|
||||
use app\common\lists\ListsExcelInterface;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Db;
|
||||
@ -37,7 +38,11 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
*/
|
||||
public function setSearch(): array
|
||||
{
|
||||
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end'];
|
||||
$allowSearch = ['keyword', 'channel', 'create_time_start', 'create_time_end', 'company_id'];
|
||||
if (empty($this->params['company_id'])) {
|
||||
unset($allowSearch['company_id']);
|
||||
unset($this->params['company_id']);
|
||||
}
|
||||
return array_intersect(array_keys($this->params), $allowSearch);
|
||||
}
|
||||
|
||||
@ -67,7 +72,9 @@ class UserLists extends BaseAdminDataLists implements ListsExcelInterface
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
|
||||
|
||||
$lists = User::withSearch($this->setSearch(), $this->params)
|
||||
->with(['company'])
|
||||
->where($where)
|
||||
|
@ -0,0 +1,174 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\logic\create_task_template;
|
||||
|
||||
|
||||
use app\adminapi\logic\ConfigLogic;
|
||||
use app\common\model\create_task_template\CreateTaskTemplate;
|
||||
use app\common\logic\BaseLogic;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate逻辑
|
||||
* Class CreateTaskTemplateLogic
|
||||
* @package app\adminapi\logic\create_task_template
|
||||
*/
|
||||
class CreateTaskTemplateLogic extends BaseLogic
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public static function add(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CreateTaskTemplate::create([
|
||||
'title' => $params['title'],
|
||||
'admin_id' => $params['admin_id'],
|
||||
'task_role_id' => $params['task_role_id'],
|
||||
'type' => $params['type'],
|
||||
'stage_day_one' => $params['stage_day_one'],
|
||||
'money' => $params['money'],
|
||||
'proportion_one' => $params['proportion_one'],
|
||||
'stage_day_two' => $params['stage_day_two'],
|
||||
'proportion_two' => $params['proportion_two'],
|
||||
'money_two' => $params['money_two'],
|
||||
'stage_day_three' => $params['stage_day_three'],
|
||||
'new_money_three' => $params['new_money_three'],
|
||||
'money_longtime' => $params['money_longtime'],
|
||||
'types' => $params['types'],
|
||||
'recharge' => $params['recharge'],
|
||||
'content' => $params['content']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public static function edit(array $params): bool
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
CreateTaskTemplate::where('id', $params['id'])->update([
|
||||
'title' => $params['title'],
|
||||
'admin_id' => $params['admin_id'],
|
||||
'task_role_id' => $params['task_role_id'],
|
||||
'type' => $params['type'],
|
||||
'stage_day_one' => $params['stage_day_one'],
|
||||
'money' => $params['money'],
|
||||
'proportion_one' => $params['proportion_one'],
|
||||
'stage_day_two' => $params['stage_day_two'],
|
||||
'proportion_two' => $params['proportion_two'],
|
||||
'money_two' => $params['money_two'],
|
||||
'stage_day_three' => $params['stage_day_three'],
|
||||
'new_money_three' => $params['new_money_three'],
|
||||
'money_longtime' => $params['money_longtime'],
|
||||
'types' => $params['types'],
|
||||
'recharge' => $params['recharge'],
|
||||
'content' => $params['content']
|
||||
]);
|
||||
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public static function delete(array $params): bool
|
||||
{
|
||||
return CreateTaskTemplate::destroy($params['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取详情
|
||||
* @param $params
|
||||
* @return array
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public static function detail($params): array
|
||||
{
|
||||
return CreateTaskTemplate::findOrEmpty($params['id'])->toArray();
|
||||
}
|
||||
|
||||
public static function taskTypeList($taskRoleId=0)
|
||||
{
|
||||
$type = '';
|
||||
switch ($taskRoleId) {
|
||||
case 1:
|
||||
$type = 'town_task_type_master';
|
||||
break;
|
||||
case 2:
|
||||
$type = 'town_task_type_marketing_director';
|
||||
break;
|
||||
case 3:
|
||||
$type = 'town_task_type';
|
||||
break;
|
||||
case 4:
|
||||
$type = 'village_task_type';
|
||||
break;
|
||||
case 5:
|
||||
$type = 'task_type';
|
||||
break;
|
||||
}
|
||||
if ($type) {
|
||||
$data = ConfigLogic::getDictByType($type);
|
||||
return $data;
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
|
||||
public static function getList($role)
|
||||
{
|
||||
return CreateTaskTemplate::field(['id', 'title', 'admin_id', 'task_role_id', 'type', 'stage_day_one', 'money', 'proportion_one', 'stage_day_two', 'proportion_two', 'money_two', 'stage_day_three', 'new_money_three', 'money_longtime', 'types', 'recharge', 'content'])
|
||||
->order(['id' => 'desc'])
|
||||
->whereIn('task_role_id', explode(',', $role))
|
||||
->select()
|
||||
->toArray();
|
||||
}
|
||||
}
|
@ -99,11 +99,13 @@ class RechargeLogic extends BaseLogic
|
||||
]);
|
||||
|
||||
// 更新用户余额及累计充值金额
|
||||
User::where(['id' => $order['user_id']])
|
||||
->dec('total_recharge_amount', $order['order_amount'])
|
||||
->dec('user_money', $order['order_amount'])
|
||||
->update();
|
||||
|
||||
$userInfo = User::where(['id' => $order['user_id']])->findOrEmpty();
|
||||
if ($userInfo['total_recharge_amount'] >= $order['order_amount']) {
|
||||
User::where(['id' => $order['user_id']])
|
||||
->dec('total_recharge_amount', $order['order_amount'])
|
||||
->dec('user_money', $order['order_amount'])
|
||||
->update();
|
||||
}
|
||||
// 记录日志
|
||||
AccountLogLogic::add(
|
||||
$order['user_id'],
|
||||
|
@ -84,4 +84,14 @@ class DictDataLogic extends BaseLogic
|
||||
{
|
||||
return DictData::whereIn('id', [30,16,41])->order('sort')->select()->toArray();
|
||||
}
|
||||
|
||||
public static function getTaskApproveTypeList()
|
||||
{
|
||||
return DictData::where(['type_value' => 'task_approve_type', 'status' => 1])->column('value');
|
||||
}
|
||||
|
||||
public static function getShareholderMoneyTaskApproveTypeList()
|
||||
{
|
||||
return DictData::where(['type_value' => 'shareholder_money_task_approve_type', 'status' => 1])->column('value');
|
||||
}
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\adminapi\validate\create_task_template;
|
||||
|
||||
|
||||
use app\common\validate\BaseValidate;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate验证器
|
||||
* Class CreateTaskTemplateValidate
|
||||
* @package app\adminapi\validate\create_task_template
|
||||
*/
|
||||
class CreateTaskTemplateValidate extends BaseValidate
|
||||
{
|
||||
|
||||
/**
|
||||
* 设置校验规则
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rule = [
|
||||
'id' => 'require',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* 参数描述
|
||||
* @var string[]
|
||||
*/
|
||||
protected $field = [
|
||||
'id' => 'id',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加场景
|
||||
* @return CreateTaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function sceneAdd()
|
||||
{
|
||||
return $this->remove('id', true);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑场景
|
||||
* @return CreateTaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function sceneEdit()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除场景
|
||||
* @return CreateTaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function sceneDelete()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 详情场景
|
||||
* @return CreateTaskTemplateValidate
|
||||
* @author likeadmin
|
||||
* @date 2023/12/18 14:50
|
||||
*/
|
||||
public function sceneDetail()
|
||||
{
|
||||
return $this->only(['id']);
|
||||
}
|
||||
|
||||
}
|
@ -36,8 +36,8 @@ class RechargeRefundValidate extends BaseValidate
|
||||
];
|
||||
|
||||
protected $message = [
|
||||
'recharge_id.require' => '参数缺失',
|
||||
'record_id.require' => '参数缺失',
|
||||
'recharge_id.require' => '参数缺失recharge_id',
|
||||
'record_id.require' => '参数缺失record_id',
|
||||
];
|
||||
|
||||
|
||||
|
@ -7,6 +7,7 @@ use app\adminapi\validate\CompanyValidate;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\logic\finance\ShareProfit;
|
||||
use app\common\logic\RedisLogic;
|
||||
use app\common\logic\ShopRequestLogic;
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
@ -16,6 +17,9 @@ use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\job\TaskAdd;
|
||||
use app\job\TaskInformationJob;
|
||||
use app\job\VillageTaskAdd;
|
||||
use app\job\VillageTaskSettlementJob;
|
||||
use think\Exception;
|
||||
use think\facade\Log;
|
||||
use app\job\TaskTenZehn;
|
||||
use think\facade\Db;
|
||||
@ -36,6 +40,12 @@ class CeshiController extends BaseApiController
|
||||
'initiate_contract', // 发起合同
|
||||
'Draftingcontracts', // 发送合同
|
||||
'postsms', // 发送短信
|
||||
'addSupplyMerchant', // 添加供应商
|
||||
'signSupplyMerchantContract', // 生成合同
|
||||
'countRate',
|
||||
'village_task_add_test',
|
||||
'village_task_settlement_test',
|
||||
'testShopApi'
|
||||
];
|
||||
|
||||
public function index()
|
||||
@ -250,18 +260,22 @@ class CeshiController extends BaseApiController
|
||||
public function service_group_task_add_test()
|
||||
{
|
||||
//任务下发
|
||||
$companyId = $this->request->param('company_id');
|
||||
$time = strtotime(date('Y-m-d')); // 今天的00:00:00
|
||||
// 注意 cron_time
|
||||
$plan_all = TaskScheduling::where('cron_time', '<', $time)
|
||||
$plan_all = TaskScheduling::where('cron_time', '<', time())
|
||||
->where('status', 1)
|
||||
->where('company_type', 18)
|
||||
->where('company_id', $companyId)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
dd($plan_all);
|
||||
$plan_ids = [];
|
||||
dd($plan_all);
|
||||
foreach ($plan_all as $k => $v) {
|
||||
|
||||
$all = TaskTemplate::where('status', 1)->where('task_scheduling', $v['id'])->limit(30)->select()->toArray();
|
||||
|
||||
$plan_ids[] = $v['id'];
|
||||
if ($all) {
|
||||
$plan_all[$k]['template'] = $all;
|
||||
@ -292,11 +306,11 @@ class CeshiController extends BaseApiController
|
||||
$all = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 18)
|
||||
->where('is_pay',0)
|
||||
->where('scheduling.company_id', 34)
|
||||
// ->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
dd($all);
|
||||
|
||||
foreach($all as $k=>$data){
|
||||
try {
|
||||
@ -363,34 +377,37 @@ class CeshiController extends BaseApiController
|
||||
$task_35 = Task::where('id', $data['task_id'])->field('director_uid,status,money,start_time,end_time')->with('director_info')->find();
|
||||
if($task_35){
|
||||
$day= $data['template_info']['stage_day_one'] + $data['template_info']['stage_day_two'];
|
||||
if($task_35['status']==3 && $data['template_info']['day_count']<=$day){
|
||||
$name = $task_35['director_info']['nickname'];
|
||||
$arr['status'] = 1;
|
||||
$arr['money'] = $task_35['money'];
|
||||
$arr['company_account_type'] = 2;
|
||||
}else{
|
||||
/**
|
||||
* 判断入股任务 单次类型 是否超时
|
||||
* 未超时时刷新开始结束时间
|
||||
* 超时则关闭
|
||||
*/
|
||||
if($data['template_info']['day_count']<=$day){
|
||||
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 0]);
|
||||
try{
|
||||
Task::where('id', $data['task_id'])->update(['create_time' => $task_35['start_time']+86400,'update_time' =>time(),'start_time'=>$task_35['start_time']+86400,'end_time'=>$task_35['start_time']+86400+86399]);
|
||||
}catch(\Exception $e){
|
||||
$start_time = strtotime(date('Y-m-d'));
|
||||
Task::where('id', $data['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if($data['template_info']['day_count']>$day){
|
||||
Task::where('id', $data['task_id'])->update(['status' =>5]);
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
// if($task_35['status']==3 && $data['template_info']['day_count']<=$day){
|
||||
// $name = $task_35['director_info']['nickname'];
|
||||
// $arr['status'] = 1;
|
||||
// $arr['money'] = $task_35['money'];
|
||||
// $arr['company_account_type'] = 2;
|
||||
// }else{
|
||||
if ($task_35['status'] == 3) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 判断入股任务 单次类型 是否超时
|
||||
* 未超时时刷新开始结束时间
|
||||
* 超时则关闭
|
||||
*/
|
||||
if($data['template_info']['day_count']<=$day){
|
||||
TaskSchedulingPlan::where('id', $data['id'])->update(['is_pay' => 0]);
|
||||
try{
|
||||
Task::where('id', $data['task_id'])->update(['create_time' => $task_35['start_time']+86400,'update_time' =>time(),'start_time'=>$task_35['start_time']+86400,'end_time'=>$task_35['start_time']+86400+86399]);
|
||||
}catch(\Exception $e){
|
||||
$start_time = strtotime(date('Y-m-d'));
|
||||
Task::where('id', $data['task_id'])->update(['create_time' => $start_time+86400,'update_time' =>time(),'start_time'=>$start_time+86400,'end_time'=> $start_time + 86400+86399]);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if($data['template_info']['day_count']>$day){
|
||||
Task::where('id', $data['task_id'])->update(['status' =>5]);
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
// }
|
||||
}else{
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
|
||||
return false;
|
||||
@ -409,7 +426,7 @@ class CeshiController extends BaseApiController
|
||||
|
||||
if($data['template_info']['day_count'] >= $day){
|
||||
Task::where('id', $data['task_id'])->update(['status' =>5]);
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
Log::info( $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -454,20 +471,32 @@ class CeshiController extends BaseApiController
|
||||
public function town_task_add_ceshi()
|
||||
{
|
||||
//任务下发
|
||||
$companyId = $this->request->param('company_id');
|
||||
$taskTypeIds = $this->request->param('task_type_ids');
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)->where('status', 1)->where('company_type', 41)->with('company_info')->select()->toArray();
|
||||
dd($taskSchedulingList);
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', time())
|
||||
->where('status', 1)
|
||||
->where('company_type', 16)
|
||||
->where('company_id', $companyId)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$taskSchedulingIds = [];
|
||||
$companyIds = [];
|
||||
|
||||
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
||||
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
||||
|
||||
$taskSchedulingIds[] = $taskScheduling['id'];
|
||||
$companyIds[] = $taskScheduling['company_id'];
|
||||
foreach ($templateList as $template) {
|
||||
if (in_array($template['type'], explode(',', $taskTypeIds))) {
|
||||
TaskLogic::TownCronAdd($template); // 手动下发用
|
||||
}
|
||||
// queue(TownTaskAdd::class, $template);
|
||||
TaskLogic::TownCronAdd($template); // 手动下发用
|
||||
|
||||
}
|
||||
|
||||
if (empty($templateList)) {
|
||||
@ -477,6 +506,7 @@ class CeshiController extends BaseApiController
|
||||
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
||||
Log::info('定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -487,17 +517,206 @@ class CeshiController extends BaseApiController
|
||||
// 今日未结算的任务计划
|
||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 41)
|
||||
->where('scheduling.company_type', 16)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
dd($taskSchedulingPlanList);
|
||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan) {
|
||||
if (in_array($taskSchedulingPlan['template_info']['type'], [44,45,46,47,48,49,50])) {
|
||||
continue;
|
||||
if ($taskSchedulingPlan['company_id'] == 30 && $taskSchedulingPlan['template_info']['type'] == 50) {
|
||||
|
||||
TaskLogic::townTaskSettlement($taskSchedulingPlan);
|
||||
}
|
||||
TaskLogic::townTaskSettlement($taskSchedulingPlan);
|
||||
}
|
||||
return $this->success('镇农科公司定时任务结算执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务下发
|
||||
*/
|
||||
public function village_task_add_test()
|
||||
{
|
||||
//任务下发
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', time())
|
||||
->where('status', 1)
|
||||
->where('company_type', 17)
|
||||
->where('company_id', 33)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
dd($taskSchedulingList);
|
||||
$taskSchedulingIds = [];
|
||||
$companyIds = [];
|
||||
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
||||
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
||||
$taskSchedulingIds[] = $taskScheduling['id'];
|
||||
$companyIds[] = $taskScheduling['company_id'];
|
||||
foreach ($templateList as $template) {
|
||||
|
||||
if ($template['type'] == 69) {
|
||||
TaskLogic::VillageCronAdd($template); // 手动下发用
|
||||
}
|
||||
|
||||
|
||||
// queue(VillageTaskAdd::class, $template);
|
||||
|
||||
}
|
||||
|
||||
if (empty($templateList)) {
|
||||
unset($taskSchedulingList[$k]);
|
||||
}
|
||||
}
|
||||
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
||||
Log::info('村管理公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('村管理公司定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务结算
|
||||
*/
|
||||
public function village_task_settlement_test()
|
||||
{
|
||||
Log::info('村管理公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
||||
//today 今日未结算的任务计划
|
||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','yesterday')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->where('scheduling.company_id', 33)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
|
||||
|
||||
TaskLogic::villageTaskSettlement($taskSchedulingPlan);
|
||||
|
||||
// queue(VillageTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||
return $this->success('村管理公司定时任务结算执行成功');
|
||||
}
|
||||
|
||||
|
||||
public function countRate()
|
||||
{
|
||||
// 第一个月
|
||||
$startTime1 = strtotime(date('Y-m-d', time())); // 任务下发当天 00:00:00
|
||||
$endTime1 = strtotime("+30 day", $startTime1); // 30天后的00:00:00
|
||||
|
||||
|
||||
// 第二个月
|
||||
$startTime2 = strtotime(date('Y-m-d', $endTime1)); // 第一个月截止日 00:00:00
|
||||
$endTime2 = strtotime("+30 day", $startTime2); // 30天后的00:00:00
|
||||
dd([date('Y-m-d H:i:s', $startTime1), date('Y-m-d H:i:s', $endTime1), date('Y-m-d H:i:s', $startTime2), date('Y-m-d H:i:s', $endTime2)]);
|
||||
$procureAmount = 1234;
|
||||
$step = $this->request->param('step', 1);
|
||||
// 商户入驻至今累计天数
|
||||
$targetProcureAmount = 10000;
|
||||
// 目标采购额每阶段增幅30%
|
||||
for ($i = 1; $i < $step; $i++) {
|
||||
$targetProcureAmount = self::increase($targetProcureAmount);
|
||||
}
|
||||
dd($targetProcureAmount);
|
||||
$rate = bcdiv($procureAmount, $targetProcureAmount, 2);
|
||||
return $rate;
|
||||
}
|
||||
|
||||
private static function increase($value)
|
||||
{
|
||||
return bcmul($value, 1.3,2);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加供应链商户
|
||||
*/
|
||||
public function addSupplyMerchant()
|
||||
{
|
||||
try {
|
||||
// 添加商户数据
|
||||
$params = $this->request->param();
|
||||
$data = [
|
||||
'mer_intention_id' => 0, // 商城商户入驻申请id,签约完成后回调使用
|
||||
'company_name' => $params['company_name']??'',
|
||||
'mer_name' => $params['mer_name']??'', // 店铺名称
|
||||
'organization_code' => $params['organization_code']??'',
|
||||
'city' => $params['city']??'',
|
||||
'area' => $params['area']??'',
|
||||
'street' => $params['street']??'',
|
||||
'address' => $params['address']??'',
|
||||
'master_name' => $params['master_name']??'',
|
||||
'master_phone' => $params['master_phone']??'',
|
||||
'master_email' => $master_email??'',
|
||||
'type_name' => $params['type_name'] ?? '', //店铺类型
|
||||
'category_name' => $params['category_name'] ?? '', //商户分类
|
||||
'qualification' => !empty($params['images'])?$params['images']:json_encode([])
|
||||
];
|
||||
$shopMerchantModel = ShopMerchant::create($data);
|
||||
|
||||
$shopMerchantCertificationData = [
|
||||
'name' => $shopMerchantModel->company_name,
|
||||
'organization_code' => $shopMerchantModel->organization_code,
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png',
|
||||
'master_name' => $shopMerchantModel->master_name,
|
||||
'master_email' => $shopMerchantModel->master_email,
|
||||
'master_phone' => $shopMerchantModel->master_phone,
|
||||
'id' => $shopMerchantModel->id,
|
||||
];
|
||||
$re = app(JunziqianController::class)->ShopMerchantCertification($shopMerchantCertificationData);
|
||||
|
||||
return $this->success('成功', $shopMerchantModel->toArray());
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 生成合同
|
||||
public function signSupplyMerchantContract()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param();
|
||||
// 生成合同
|
||||
$createContractData = [
|
||||
'id' => $params['id'],
|
||||
'party_a' => $params['party_a'],
|
||||
'party_a_name' => $params['party_a_name'],
|
||||
'party_b' => $params['party_b'],
|
||||
'party_b_name' => $params['party_b_name'],
|
||||
'contract_type' => 58, // 供应链商户合同
|
||||
];
|
||||
$model = new ShopContract();
|
||||
$model->contract_no = time();
|
||||
$model->create_time = time();
|
||||
$model->check_status = 1;
|
||||
$model->update_time = time();
|
||||
$model->setAttrs($createContractData);
|
||||
$res = $model->save($createContractData);
|
||||
return $this->success('成功', $res->toArray());
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function testShopApi()
|
||||
{
|
||||
$id = $this->request->param('id');
|
||||
$templateInfo = TaskTemplate::where(['id'=>$id])->find();
|
||||
$townCompany = Company::where(['id' => $templateInfo['company_id']])->find();
|
||||
|
||||
$param['start_time'] = strtotime(date('Y-m-d', $templateInfo['cretate_time'])) + 86400;
|
||||
$param['end_time'] = time();
|
||||
$param['mer_intention_id'] = 131;
|
||||
// $param['goods_id'] = '17,18';
|
||||
$param['type_id'] = 10;
|
||||
|
||||
|
||||
// todo 返回字段要对接
|
||||
$result = ShopRequestLogic::getGeneralMerchantProductListing($param);
|
||||
dd($result);
|
||||
}
|
||||
}
|
||||
|
@ -290,7 +290,9 @@ class CompanyController extends BaseApiController
|
||||
Db::startTrans();
|
||||
// 上交股金金额
|
||||
$amount = $serviceGroupCompany['shareholder_money'];
|
||||
|
||||
if ($amount == 0) {
|
||||
return $this->fail('股金金额不能为0');
|
||||
}
|
||||
$sharecapitalChangeLogData = [
|
||||
'subordinate_company_id' => $serviceGroupCompany['id'],
|
||||
'parent_company_id' => $villageCompany['id'],
|
||||
@ -334,7 +336,7 @@ class CompanyController extends BaseApiController
|
||||
];
|
||||
CompanyAccountLog::create($company_log2);
|
||||
Db::commit();
|
||||
return $this->success('上交成功');
|
||||
return $this->success('上交成功', [], 1, 1);
|
||||
} catch (Exception $e) {
|
||||
Db::rollback();
|
||||
return $this->fail($e->getMessage());
|
||||
@ -353,13 +355,25 @@ class CompanyController extends BaseApiController
|
||||
* 查询镇农科公司
|
||||
*/
|
||||
public function street_company(){
|
||||
$street=$this->request->param('street_code');
|
||||
$company=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$street], true);
|
||||
if($company){
|
||||
return $this->success('ok',['title'=>$company[0]['company_name'],'organization_code'=>$company[0]['organization_code']]);
|
||||
}else{
|
||||
return $this->fail('当前区域无镇农科公司');
|
||||
$street=$this->request->param('street_code', '');
|
||||
$area=$this->request->param('area_code', '');
|
||||
if (!empty($street)) {
|
||||
$company=Db::query("select * from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$street], true);
|
||||
if($company){
|
||||
return $this->success('ok',['title'=>$company[0]['company_name'],'organization_code'=>$company[0]['organization_code']]);
|
||||
}else{
|
||||
return $this->fail('当前区域无镇农科公司');
|
||||
}
|
||||
}
|
||||
if(!empty($area)) {
|
||||
$company= Company::where(['company_type'=>15, 'area'=>$area])->findOrEmpty();
|
||||
if(!$company->isEmpty()){
|
||||
return $this->success('ok',['title'=>$company['company_name'],'organization_code'=>$company['organization_code']]);
|
||||
}else{
|
||||
return $this->fail('当前区域无供投公司');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -5,6 +5,8 @@ use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\job\TaskInformationJob;
|
||||
use app\job\TownTaskAdd;
|
||||
use app\job\TownTaskSettlementJob;
|
||||
use app\job\VillageTaskAdd;
|
||||
use app\job\VillageTaskSettlementJob;
|
||||
use think\facade\Log;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
@ -19,33 +21,13 @@ use app\job\TaskAdd;
|
||||
*/
|
||||
class CronController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['settlement','task_add', 'town_task_add', 'town_task_settlement'];
|
||||
|
||||
/**
|
||||
* 小组服务公司任务结算
|
||||
*/
|
||||
public function settlement(){
|
||||
// $all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
|
||||
$all = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 18)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
foreach($all as $k=>$v){
|
||||
queue(TaskInformationJob::class,$v);
|
||||
}
|
||||
Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s'));
|
||||
return $this->success('小组服务公司定时任务结算执行成功');
|
||||
|
||||
}
|
||||
public array $notNeedLogin = ['settlement','task_add', 'town_task_add', 'town_task_settlement','village_task_add', 'village_task_settlement'];
|
||||
|
||||
/**
|
||||
* 小组服务公司任务下发
|
||||
*/
|
||||
public function task_add(){
|
||||
//任务下发
|
||||
//任务下发
|
||||
// $time=strtotime(date('Y-m-d',strtotime('-1 day')));
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// $tiem_end=$time+86399;
|
||||
@ -76,35 +58,105 @@ class CronController extends BaseApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科公司任务结算
|
||||
* 小组服务公司任务结算
|
||||
*/
|
||||
public function town_task_settlement()
|
||||
public function settlement(){
|
||||
// $all=TaskSchedulingPlan::where('is_pay',0)->with(['template_info','scheduling'])->select()->toArray();
|
||||
$all = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 18)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach($all as $k=>$v){
|
||||
// 任务运行中,后台删除了任务模板
|
||||
if (empty($v['template_info'])) {
|
||||
continue;
|
||||
}
|
||||
queue(TaskInformationJob::class,$v);
|
||||
}
|
||||
Log::info('小组服务公司定时任务结算执行成功'.date('Y-m-d H:i:s'));
|
||||
return $this->success('小组服务公司定时任务结算执行成功');
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务下发
|
||||
*/
|
||||
public function village_task_add()
|
||||
{
|
||||
Log::info('镇农科公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
||||
//任务下发
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)
|
||||
->where('status', 1)
|
||||
->where('company_type', 17)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$taskSchedulingIds = [];
|
||||
$companyIds = [];
|
||||
foreach ($taskSchedulingList as $k => $taskScheduling) {
|
||||
$templateList = TaskTemplate::where('status', 1)->where('task_scheduling', $taskScheduling['id'])->limit(30)->select()->toArray();
|
||||
$taskSchedulingIds[] = $taskScheduling['id'];
|
||||
$companyIds[] = $taskScheduling['company_id'];
|
||||
foreach ($templateList as $template) {
|
||||
queue(VillageTaskAdd::class, $template);
|
||||
// TaskLogic::TownCronAdd($template); // 手动下发用
|
||||
}
|
||||
|
||||
if (empty($templateList)) {
|
||||
unset($taskSchedulingList[$k]);
|
||||
}
|
||||
}
|
||||
Company::where('id', 'in', $companyIds)->inc('day_count')->update();
|
||||
TaskScheduling::where('id', 'in', $taskSchedulingIds)->update(['cron_time' => time()]);
|
||||
Log::info('村管理公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('村管理公司定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 村管理公司任务结算
|
||||
*/
|
||||
public function village_task_settlement()
|
||||
{
|
||||
Log::info('村管理公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
||||
//today 今日未结算的任务计划
|
||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 41)
|
||||
->where('scheduling.company_type', 17)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
|
||||
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
// 任务运行中,后台删除了任务模板
|
||||
if (empty($taskSchedulingPlan['template_info'])) {
|
||||
continue;
|
||||
}
|
||||
queue(VillageTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
Log::info('镇农科公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||
return $this->success('镇农科公司定时任务结算执行成功');
|
||||
Log::info('村管理公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||
return $this->success('村管理公司定时任务结算执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科公司任务下发
|
||||
* 镇合伙人公司任务下发
|
||||
*/
|
||||
public function town_task_add()
|
||||
{
|
||||
//任务下发
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
// 查询系统 所有镇农科公司 未下发 的 任务安排
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)->where('status', 1)->where('company_type', 41)->with('company_info')->select()->toArray();
|
||||
$taskSchedulingList = TaskScheduling::where('cron_time', '<', $time)
|
||||
->where('status', 1)
|
||||
->where('company_type', 16)
|
||||
->with('company_info')
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$taskSchedulingIds = [];
|
||||
$companyIds = [];
|
||||
@ -126,4 +178,42 @@ class CronController extends BaseApiController
|
||||
Log::info('镇农科公司定时任务下发执行成功' . date('Y-m-d H:i:s'));
|
||||
return $this->success('镇农科公司定时任务下发执行成功');
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科公司任务结算
|
||||
*/
|
||||
public function town_task_settlement()
|
||||
{
|
||||
Log::info('镇合伙人公司定时任务结算执行-开始'.date('Y-m-d H:i:s'));
|
||||
//today 今日未结算的任务计划
|
||||
$taskSchedulingPlanList = TaskSchedulingPlan::whereDay('end_time','today')
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 16)
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->select()
|
||||
->toArray();
|
||||
foreach($taskSchedulingPlanList as $taskSchedulingPlan){
|
||||
// 任务运行中,后台删除了任务模板
|
||||
if (empty($taskSchedulingPlan['template_info'])) {
|
||||
continue;
|
||||
}
|
||||
// 解耦 三个角色分开结算,避免某个角色的结算逻辑出现异常,导致整个镇农科公司的任务结算都终止
|
||||
$taskTemplateInfo = $taskSchedulingPlan['template_info'];
|
||||
// 负责人任务结算
|
||||
if ($taskTemplateInfo['extend']['task_role'] == 1) {
|
||||
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
// 市场部长任务结算
|
||||
if ($taskTemplateInfo['extend']['task_role'] == 2) {
|
||||
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
// 服务部长任务结算
|
||||
if ($taskTemplateInfo['extend']['task_role'] == 3) {
|
||||
queue(TownTaskSettlementJob::class, $taskSchedulingPlan);
|
||||
}
|
||||
}
|
||||
Log::info('镇镇合伙人公司定时任务结算执行-结束'.date('Y-m-d H:i:s'));
|
||||
return $this->success('镇农科公司定时任务结算执行成功');
|
||||
}
|
||||
}
|
@ -38,7 +38,11 @@ use think\response\Json;
|
||||
*/
|
||||
class IndexController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['index', 'config', 'policy', 'decorate', 'notifyUrl', 'notifyProperty', 'notifyAuthentication', 'notifyVehicleContractUpdate','townCarRent','systemCarRent', 'selfCarRent', 'cancelRent', 'buyCar'];
|
||||
public array $notNeedLogin = [
|
||||
'index', 'config', 'policy', 'decorate', 'notifyUrl',
|
||||
'notifyProperty', 'notifyAuthentication', 'notifyVehicleContractUpdate',
|
||||
'townCarRent','systemCarRent', 'selfCarRent', 'cancelRent', 'buyCar',
|
||||
'vehicleCarList', 'getCompanyBankInfo'];
|
||||
|
||||
/**
|
||||
* @notes 首页数据
|
||||
@ -178,6 +182,7 @@ class IndexController extends BaseApiController
|
||||
$updateSverRes =curl_post(env('project.logistic_domain').'/api/contractUpdate',[],[
|
||||
'id' => $contract['contract_logistic_id'],
|
||||
'signing_timer' => 1,
|
||||
'update_time' => time()
|
||||
]);
|
||||
if(!$updateLocalRes || $updateSverRes['code']==0){
|
||||
return json(['success' => false, 'msg' => '更新失败']);
|
||||
@ -224,7 +229,8 @@ class IndexController extends BaseApiController
|
||||
'signing_timer' => 2,
|
||||
'status' => 3,
|
||||
'contract_url'=>$signContractFile,
|
||||
'contract_evidence'=>$contractEvidence
|
||||
'contract_evidence'=>$contractEvidence,
|
||||
'update_time' => time()
|
||||
]);
|
||||
if(!$updateLocalRes || $updateSverRes['code']==0){
|
||||
return json(['success' => false, 'msg' => '更新失败']);
|
||||
@ -279,7 +285,7 @@ class IndexController extends BaseApiController
|
||||
VehicleContract::where('id', $id)->update(['signing_timer' => 2, 'status' => 3,'contract_url'=>$signContractFile,'contract_evidence'=>$contractEvidence]);
|
||||
//添加车辆到租赁列表
|
||||
$vehicle = json_decode($contract['cars_info'], true);
|
||||
VehicleRent::where('car_id', $vehicle['id'])->update([
|
||||
VehicleRent::where('car_id', $vehicle[0]['id'])->update([
|
||||
'status' => 2,
|
||||
'rent_contract_id' => $contract['id'],
|
||||
'rent_company_id' => $contract['company_b_id'],
|
||||
@ -288,7 +294,7 @@ class IndexController extends BaseApiController
|
||||
$party_b = Company::where('id', $contract['company_b_id'])->find();
|
||||
//通知物流系统跟新
|
||||
curl_post(env('project.logistic_domain').'/api/updateVehicleRent', [], [
|
||||
'car_id' => $vehicle['id'],
|
||||
'car_id' => $vehicle[0]['id'],
|
||||
'use_user_id' => $party_b['user_id'],
|
||||
'use_user_name' => $party_b['master_name'],
|
||||
'use_user_phone' => $party_b['master_phone']
|
||||
@ -329,8 +335,8 @@ class IndexController extends BaseApiController
|
||||
//添加车辆到物流系统
|
||||
$vehicle = json_decode($contract['cars_info'], true);
|
||||
$curl_res = curl_post(env('project.logistic_domain').'/api/addSelfCar', [], [
|
||||
'license' => $vehicle['license'],
|
||||
'pic' => $vehicle['pic'],
|
||||
'license' => $vehicle[0]['license'],
|
||||
'pic' => $vehicle[0]['pic'],
|
||||
'company_id' => $contract['company_a_id'],
|
||||
'company_name' => $contract['company_a_name'],
|
||||
'company_user' => $contract['company_a_user'],
|
||||
@ -339,7 +345,7 @@ class IndexController extends BaseApiController
|
||||
if (!$curl_res || $curl_res['code'] == 0) {
|
||||
return json(['success' => false, 'msg' => '失败2.6']);
|
||||
}
|
||||
$cars_info = json_encode(['id' => $curl_res['data']['car_id'], 'license' => $vehicle['license']]);
|
||||
$cars_info = json_encode([['id' => $curl_res['data']['car_id'], 'license' => $vehicle[0]['license']]]);
|
||||
//获取签约后的合同
|
||||
$signContractFile = app(JunziqianController::class)->downloadVehicleContractFile($contract['contract_no']);
|
||||
$signContractFile = $signContractFile ?? '';
|
||||
@ -357,7 +363,7 @@ class IndexController extends BaseApiController
|
||||
'car_id' => $curl_res['data']['car_id'],
|
||||
'contract_id' => $contract['id'],
|
||||
'company_id' => $contract['company_a_id'],
|
||||
'car_license' => $vehicle['license'],
|
||||
'car_license' => $vehicle[0]['license'],
|
||||
'status' => 2,
|
||||
'rent_time' => time(),
|
||||
'rent_contract_id' => $contract['id'],
|
||||
@ -374,13 +380,6 @@ class IndexController extends BaseApiController
|
||||
'use_user_name' => $party_b['master_name'],
|
||||
'use_user_phone' => $party_b['master_phone']
|
||||
]);
|
||||
CompanyProperty::create([
|
||||
'company_id' => $contract['company_b_id'],
|
||||
'object_id' => $car_id,
|
||||
'type' => 1,
|
||||
'create_time' => time(),
|
||||
'update_time' => time(),
|
||||
]);
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
} else {
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
@ -436,6 +435,7 @@ class IndexController extends BaseApiController
|
||||
'status' => 3,
|
||||
'contract_url'=>$signContractFile,
|
||||
'contract_evidence'=>$contractEvidence,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}
|
||||
//判断合同是否存在购买记录表中
|
||||
@ -486,11 +486,6 @@ class IndexController extends BaseApiController
|
||||
if($vehicleBuyRecord['status'] == 2){
|
||||
//获取租赁车辆信息
|
||||
$rentCarsInfo = VehicleRent::where('car_id',$cars_ids[0])->findOrEmpty();
|
||||
//获取镇街公司信息
|
||||
$zjCompany = Company::where('id',$rentCarsInfo['company_id'])->findOrEmpty();
|
||||
//判断购买车辆中是否包含镇街公司租赁的车辆
|
||||
$car_ids = array_column(json_decode($vehicleBuyRecord['cars_info'],true),'id');
|
||||
$zjRentCars = VehicleRent::field('car_id as id,car_license as license')->where('company_id',$zjCompany['id'])->where('car_id','in',$car_ids)->where('status',0)->where('type',0)->select();
|
||||
if($rentCarsInfo['type'] == 0){
|
||||
//修改租赁车俩状态
|
||||
VehicleRent::where('id',$rentCarsInfo['id'])->update(['status'=>0,'rent_company_id'=>0,'rent_contract_id'=>0,'rent_time'=>0]);
|
||||
@ -505,6 +500,11 @@ class IndexController extends BaseApiController
|
||||
curl_post(env('project.logistic_domain').'/api/Vehicle/delRentUseInfo', [], [
|
||||
'car_id' => $cars_ids[0]
|
||||
]);
|
||||
//获取镇街公司信息
|
||||
$zjCompany = Company::where('id',$rentCarsInfo['company_id'])->findOrEmpty();
|
||||
//判断购买车辆中是否包含镇街公司租赁的车辆
|
||||
$car_ids = array_column(json_decode($vehicleBuyRecord['cars_info'],true),'id');
|
||||
$zjRentCars = VehicleRent::field('car_id as id,car_license as license')->where('company_id',$zjCompany['id'])->where('car_id','in',$car_ids)->where('status',0)->where('type',0)->select();
|
||||
//发送镇公司与平台公司的解约合同
|
||||
$curl_result = curl_post(env('project.logistic_domain').'/api/signContract',[],[
|
||||
'num' => count($zjRentCars),
|
||||
@ -524,8 +524,8 @@ class IndexController extends BaseApiController
|
||||
return $this->fail($curl_result['msg'].' from logistic');
|
||||
}
|
||||
//生成本地合同
|
||||
VehicleContract::create($curl_result['data']);
|
||||
VehicleBuyRecord::where('id',$vehicleBuyRecord['id'])->update(['status'=>3]);
|
||||
$res = VehicleContract::create($curl_result['data']);
|
||||
VehicleBuyRecord::where('id',$vehicleBuyRecord['id'])->update(['status'=>3,'contract_id'=>$res->id]);
|
||||
return json(['success' => true, 'msg' => '成功']);
|
||||
}
|
||||
//镇街公司与平台公司解约
|
||||
@ -651,6 +651,7 @@ class IndexController extends BaseApiController
|
||||
'use_user_id' =>$compay['user_id'],
|
||||
'use_user_name' =>$compay['master_name'],
|
||||
'use_user_phone' =>$compay['master_phone'],
|
||||
'update_time' => time()
|
||||
]);
|
||||
if(!$updateLocalRes || $updateSverRes['code']==0){
|
||||
return json(['success' => false, 'msg' => '更新失败']);
|
||||
@ -823,4 +824,24 @@ class IndexController extends BaseApiController
|
||||
Db::name('company_authentication_fail_log')->insert(['company_id'=>$parmas['id'], 'log_type'=>3, 'fail_reason'=>$data['msg'], 'create_time'=>time()]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getCompanyBankInfo()
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
$company = Db::query("select company_name,qualification from la_company where company_type=:company_type and FIND_IN_SET(:street,responsible_area)", ['company_type' => 41,'street'=>$parmas['street_code']], true);
|
||||
|
||||
if (empty($company)) {
|
||||
return $this->success('成功', ['corporate_account'=> '22170201040004168', 'corporate_bank'=> '中国农业银行股份有限公司泸州石洞支行', 'company_name' => '泸州里海农业科技有限公司', 'corporate_bank_address'=> '泸州市龙马潭区张家祠东路竹林馨居东侧约60米']);
|
||||
}
|
||||
$company=$company[0];
|
||||
$company['qualification'] = json_decode($company['qualification'], true);
|
||||
|
||||
if (!empty($company['qualification']['corporate_account']) && !empty($company['qualification']['corporate_bank'])) {
|
||||
return $this->success('成功', ['corporate_account'=> $company['qualification']['corporate_account'], 'corporate_bank'=> $company['qualification']['corporate_bank'], 'company_name' => $company['company_name'], 'corporate_bank_address'=> $company['qualification']['corporate_bank_address'] ]);
|
||||
}
|
||||
|
||||
return $this->success('成功', ['corporate_account'=> '22170201040004168', 'corporate_bank'=> '中国农业银行股份有限公司泸州石洞支行', 'company_name' => '泸州里海农业科技有限公司', 'corporate_bank_address'=> '' ]);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -2,14 +2,19 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\model\Company;
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\logic\BaseLogic;
|
||||
use app\common\model\informationg\UserInformationgDemand;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\user\User;
|
||||
use think\response\Json;
|
||||
|
||||
class InformationController extends BaseApiController
|
||||
{
|
||||
public array $notNeedLogin = ['groupServiceInfo','captainInfo','farmerInfo','farmerInfoByPhone','farmerLandInfo','farmerPondInfo','farmerList'];
|
||||
|
||||
public function list()
|
||||
{
|
||||
$param = Request()->param();
|
||||
@ -128,4 +133,404 @@ class InformationController extends BaseApiController
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
//获取吓阻服务公司用户信息
|
||||
public function groupServiceInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id']);
|
||||
if(empty($params['user_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
$userData = User::field('id,company_id,nickname as name,avatar')->where('id',$params['user_id'])->findOrEmpty();
|
||||
if($userData->isEmpty()){
|
||||
return $this->fail('用户数据不存在');
|
||||
}
|
||||
$companyData = Company::field('id,company_name,company_type')->where('id',$userData['company_id'])->findOrEmpty();
|
||||
if($companyData->isEmpty() || $companyData['company_type'] != 18){
|
||||
return $this->fail('当前用户不是小组服务公司用户');
|
||||
}
|
||||
$userData['company_name'] = $companyData['company_name'];
|
||||
//获取小组服务公司下面的队长
|
||||
$captainList = User::field('id,nickname as name,avatar,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name')->where('company_id',$userData['company_id'])->where('is_captain',1)->select()->each(function($item){
|
||||
$item['address'] = $item['province_name'].$item['city_name'].$item['area_name'].$item['street_name'].$item['village_name'].$item['brigade_name'];
|
||||
unset($item['province'],$item['province_name'],$item['city'],$item['city_name'],$item['area'],$item['area_name'],$item['street'],$item['street_name'],$item['village'],$item['village_name'],$item['brigade'],$item['brigade_name']);
|
||||
$farmerList = UserInformationg::where('create_user_id', $item['id'])->field('id')->select()->each(function($val){
|
||||
//获取农户档案详情
|
||||
$information = UserInformationgDemand::field('id,category_child,data')->where('information_id', $val['id'])->where('category_id',6)->where('category_child','in','7,32')->order('id', 'desc')->select()->toArray();
|
||||
//总面积
|
||||
$val['land_total_area'] = 0;
|
||||
$val['pond_total_area'] = 0;
|
||||
$val['animal_total_area'] = 0;
|
||||
$val['poultry_total_area'] = 0;
|
||||
//种养类型
|
||||
$val['is_zz_user'] = false;
|
||||
$val['is_sc_user'] = false;
|
||||
$val['is_jc_user'] = false;
|
||||
$val['is_jq_user'] = false;
|
||||
foreach($information as $v){
|
||||
if($v['category_child'] == 7){
|
||||
$val['is_zz_user'] = true;
|
||||
$val['land_total_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
if($v['category_child'] == 32){
|
||||
if($v['data']['breeding_type'] == 1){//水产
|
||||
$val['is_sc_user'] = true;
|
||||
$val['pond_total_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 2) {//脯乳动物
|
||||
$val['is_jc_user'] = true;
|
||||
$val['animal_total_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 3){//家禽
|
||||
$val['is_jq_user'] = true;
|
||||
$val['poultry_total_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$val['total_area'] = $val['land_total_area'] + $val['pond_total_area'] + $val['animal_total_area'] + $val['poultry_total_area'];
|
||||
return $val;
|
||||
})->toArray();
|
||||
$item['farmer_total'] = count($farmerList);
|
||||
$item['farmer_area'] = array_sum(array_column($farmerList,'total_area'));
|
||||
$item['farmer_zz_total'] = 0;
|
||||
$item['farmer_sc_total'] = 0;
|
||||
$item['farmer_jc_total'] = 0;
|
||||
$item['farmer_jq_total'] = 0;
|
||||
$item['farmer_zz_area'] = 0;
|
||||
$item['farmer_sc_area'] = 0;
|
||||
$item['farmer_jc_area'] = 0;
|
||||
$item['farmer_jq_area'] = 0;
|
||||
foreach($farmerList as $v){
|
||||
if($v['is_zz_user']){
|
||||
$item['farmer_zz_total'] += 1;
|
||||
}
|
||||
if($v['is_sc_user']){
|
||||
$item['farmer_sc_total'] += 1;
|
||||
}
|
||||
if($v['is_jc_user']){
|
||||
$item['farmer_jc_total'] += 1;
|
||||
}
|
||||
if($v['is_jq_user']){
|
||||
$item['farmer_jq_total'] += 1;
|
||||
}
|
||||
$item['farmer_zz_area'] += $v['land_total_area'];
|
||||
$item['farmer_sc_area'] += $v['pond_total_area'];
|
||||
$item['farmer_jc_area'] += $v['animal_total_area'];
|
||||
$item['farmer_jq_area'] += $v['poultry_total_area'];
|
||||
}
|
||||
return $item;
|
||||
})->toArray();
|
||||
$userData['captain_list'] = $captainList;
|
||||
return $this->success('请求成功',$userData->toArray());
|
||||
}
|
||||
|
||||
//获取生产队长信息
|
||||
public function captainInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id']);
|
||||
if(empty($params['user_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
$userData = User::field('id,nickname as name,avatar,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name')->where('id',$params['user_id'])->where('is_captain',1)->findOrEmpty();
|
||||
if($userData->isEmpty()){
|
||||
return $this->fail('用户数据不存在');
|
||||
}
|
||||
$userData['address'] = $userData['province_name'].$userData['city_name'].$userData['area_name'].$userData['street_name'].$userData['village_name'].$userData['brigade_name'];
|
||||
unset($userData['province'],$userData['province_name'],$userData['city'],$userData['city_name'],$userData['area'],$userData['area_name'],$userData['street'],$userData['street_name'],$userData['village'],$userData['village_name'],$userData['brigade'],$userData['brigade_name']);
|
||||
//获取生产队长下面的农户
|
||||
$farmerList = UserInformationg::where('create_user_id', $params['user_id'])->field('id,name,phone,area_id,street_id,village_id,brigade_id,area_id area_name,street_id street_name,village_id village_name,brigade_id brigade_name')->select()->each(function($item){
|
||||
$item['address'] = $item['area_name'].$item['street_name'].$item['village_name'].$item['brigade_name'];
|
||||
unset($item['area_id'],$item['area_name'],$item['street_id'],$item['street_name'],$item['village_id'],$item['village_name'],$item['brigade_id'],$item['brigade_name']);
|
||||
//获取农户档案详情
|
||||
$information = UserInformationgDemand::field('id,category_child,data')->where('information_id', $item['id'])->where('category_id',6)->where('category_child','in','7,32')->order('id', 'desc')->select()->toArray();
|
||||
//总面积
|
||||
$item['land_total_area'] = 0;
|
||||
$item['pond_total_area'] = 0;
|
||||
$item['animal_total_area'] = 0;
|
||||
$item['poultry_total_area'] = 0;
|
||||
//种养类型
|
||||
$item['is_zz_user'] = false;
|
||||
$item['is_sc_user'] = false;
|
||||
$item['is_jc_user'] = false;
|
||||
$item['is_jq_user'] = false;
|
||||
foreach($information as $v){
|
||||
if($v['category_child'] == 7){
|
||||
$item['is_zz_user'] = true;
|
||||
$item['land_total_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
if($v['category_child'] == 32){
|
||||
if($v['data']['breeding_type'] == 1){//水产
|
||||
$item['is_sc_user'] = true;
|
||||
$item['pond_total_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 2) {//脯乳动物
|
||||
$item['is_jc_user'] = true;
|
||||
$item['animal_total_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 3){//家禽
|
||||
$item['is_jq_user'] = true;
|
||||
$item['poultry_total_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$item['total_area'] = $item['land_total_area'] + $item['pond_total_area'] + $item['animal_total_area'] + $item['poultry_total_area'];
|
||||
return $item;
|
||||
})->toArray();
|
||||
$userData['farmer_total'] = count($farmerList);
|
||||
$userData['farmer_area'] = array_sum(array_column($farmerList,'total_area'));
|
||||
$userData['farmer_zz_total'] = 0;
|
||||
$userData['farmer_sc_total'] = 0;
|
||||
$userData['farmer_jc_total'] = 0;
|
||||
$userData['farmer_jq_total'] = 0;
|
||||
$userData['farmer_zz_area'] = 0;
|
||||
$userData['farmer_sc_area'] = 0;
|
||||
$userData['farmer_jc_area'] = 0;
|
||||
$userData['farmer_jq_area'] = 0;
|
||||
foreach($farmerList as $v){
|
||||
if($v['is_zz_user']){
|
||||
$userData['farmer_zz_total'] += 1;
|
||||
}
|
||||
if($v['is_sc_user']){
|
||||
$userData['farmer_sc_total'] += 1;
|
||||
}
|
||||
if($v['is_jc_user']){
|
||||
$userData['farmer_jc_total'] += 1;
|
||||
}
|
||||
if($v['is_jq_user']){
|
||||
$userData['farmer_jq_total'] += 1;
|
||||
}
|
||||
$userData['farmer_zz_area'] += $v['land_total_area'];
|
||||
$userData['farmer_sc_area'] += $v['pond_total_area'];
|
||||
$userData['farmer_jc_area'] += $v['animal_total_area'];
|
||||
$userData['farmer_jq_area'] += $v['poultry_total_area'];
|
||||
}
|
||||
$userData['farmer_list'] = $farmerList;
|
||||
return $this->success('请求成功',$userData->toArray());
|
||||
}
|
||||
|
||||
//获取农户信息,该接口溯源系统调用
|
||||
public function farmerInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id']);
|
||||
if(empty($params['user_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
//获取农户信息
|
||||
$farmerInfo = UserInformationg::alias('f')
|
||||
->leftJoin('company c','f.company_id = c.id')
|
||||
->leftJoin('user u','u.id = f.create_user_id')
|
||||
->leftJoin('user g','g.id = c.user_id')
|
||||
->where('f.id', $params['user_id'])
|
||||
->field('f.id,f.create_user_id,f.company_id,f.name,f.phone,f.area_id,f.street_id,f.village_id,f.brigade_id,f.area_id area_name,f.street_id street_name,f.village_id village_name,f.brigade_id brigade_name,c.company_name,f.address,u.nickname as captain_name,g.nickname as group_name')
|
||||
->findOrEmpty()->toArray();
|
||||
if(empty($farmerInfo)){
|
||||
return $this->fail('用户不存在_worker');
|
||||
}
|
||||
unset($farmerInfo['area_id'],$farmerInfo['street_id'],$farmerInfo['village_id'],$farmerInfo['brigade_id']);
|
||||
$data = UserInformationgDemand::field('id,category_child,data')->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child','in','7,32')->order('id', 'desc')->select()->toArray();
|
||||
//是否是种植户
|
||||
$farmerInfo['is_zz_user'] = false;
|
||||
//是否是水产养殖户
|
||||
$farmerInfo['is_sc_user'] = false;
|
||||
//是否是家禽养殖户
|
||||
$farmerInfo['is_jq_user'] = false;
|
||||
//是否是大型动物养殖户
|
||||
$farmerInfo['is_dw_user'] = false;
|
||||
//土地总面积
|
||||
$farmerInfo['total_land_area'] = 0;
|
||||
//池塘总面积
|
||||
$farmerInfo['total_pond_area'] = 0;
|
||||
//家禽养殖场总面积
|
||||
$farmerInfo['total_henhouse_area'] = 0;
|
||||
//动物养殖场总面积
|
||||
$farmerInfo['total_pasture_area'] = 0;
|
||||
foreach($data as $v){
|
||||
if($v['category_child'] == 7){
|
||||
$farmerInfo['is_zz_user'] = true;
|
||||
$farmerInfo['total_land_area'] += floatval($v['data']['area']);
|
||||
$farmerInfo['land_detail'][] = [
|
||||
'land_id' => $v['id'],
|
||||
'land_area' => $v['data']['area'],
|
||||
'land_notes' => $v['data']['notes'],
|
||||
];
|
||||
}
|
||||
if($v['category_child'] == 32){
|
||||
if($v['data']['breeding_type'] == 1){//水产
|
||||
$farmerInfo['is_sc_user'] = true;
|
||||
$farmerInfo['total_pond_area'] += floatval($v['data']['area']);
|
||||
$farmerInfo['pond_detail'][] = [
|
||||
'pond_id' => $v['id'],
|
||||
'pond_area' => $v['data']['area'],
|
||||
'pond_notes' => $v['data']['notes'],
|
||||
];
|
||||
}elseif ($v['data']['breeding_type'] == 2) {//脯乳动物
|
||||
$farmerInfo['is_jq_user'] = true;
|
||||
$farmerInfo['total_henhouse_area'] += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 3){//家禽
|
||||
$farmerInfo['is_dw_user'] = true;
|
||||
$farmerInfo['total_pasture_area'] += floatval($v['data']['area']);
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->success('请求成功',$farmerInfo);
|
||||
}
|
||||
|
||||
//通过手机号码查找农户
|
||||
public function farmerInfoByPhone(): Json
|
||||
{
|
||||
$params = $this->request->post(['phone']);
|
||||
if(empty($params['phone'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = UserInformationg::where('phone',$params['phone'])
|
||||
->field('id,name,phone,area_id,street_id,village_id,brigade_id,area_id area_name,street_id street_name,village_id village_name,brigade_id brigade_name,address')
|
||||
->findOrEmpty();
|
||||
return !$data->isEmpty() ? $this->success('请求成功',$data->toArray()) : $this->fail('请求失败');
|
||||
}
|
||||
|
||||
//获取农户土地信息
|
||||
public function farmerLandInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id','land_id']);
|
||||
if(empty($params['user_id']) || empty($params['land_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
//获取农户信息
|
||||
$data = UserInformationgDemand::field('id,data')->where('id',$params['land_id'])->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child',7)->findOrEmpty()->toArray();
|
||||
if(empty($data)){
|
||||
return $this->fail('数据不存在_worker');
|
||||
}
|
||||
$resData = [
|
||||
'land_id' => $data['id'],
|
||||
'land_area' => $data['data']['area']
|
||||
];
|
||||
return $this->success('请求成功',$resData);
|
||||
}
|
||||
|
||||
//获取农户鱼塘信息
|
||||
public function farmerPondInfo(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['user_id','pond_id']);
|
||||
if(empty($params['user_id']) || empty($params['pond_id'])){
|
||||
return $this->fail('参数错误_worker');
|
||||
}
|
||||
//获取农户信息
|
||||
$data = UserInformationgDemand::field('id,data')->where('id',$params['pond_id'])->where('information_id', $params['user_id'])->where('category_id',6)->where('category_child',32)->findOrEmpty()->toArray();
|
||||
if(empty($data) || empty($data['data'])){
|
||||
return $this->fail('数据不存在_worker');
|
||||
}
|
||||
if($data['data']['breeding_type'] != 1){
|
||||
return $this->fail('数据错误_work');
|
||||
}
|
||||
$resData = [
|
||||
'pond_id' => $data['id'],
|
||||
'pond_area' => $data['data']['area']
|
||||
];
|
||||
return $this->success('请求成功',$resData);
|
||||
}
|
||||
|
||||
//获取农户列表
|
||||
public function farmerList(): Json
|
||||
{
|
||||
$params = $this->request->post(['farmer_name','farmer_phone','group_name','captain_name','page_no','page_size']);
|
||||
if(empty($params['page_no']) || empty($params['page_size'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$search = [];
|
||||
if(!empty($params['farmer_name'])){
|
||||
$search[] = ['f.name','like','%'.$params['farmer_name'].'%'];
|
||||
}
|
||||
if(!empty($params['farmer_phone'])){
|
||||
$search[] = ['f.phone','like','%'.$params['farmer_phone'].'%'];
|
||||
}
|
||||
if(!empty($params['group_name'])){
|
||||
$search[] = ['g.nickname','like','%'.$params['group_name'].'%'];
|
||||
}
|
||||
if(!empty($params['captain_name'])){
|
||||
$search[] = ['u.nickname','like','%'.$params['captain_name'].'%'];
|
||||
}
|
||||
$data = UserInformationg::alias('f')
|
||||
->field('f.id,f.create_user_id,f.company_id,f.name,f.phone,f.area_id,f.street_id,f.village_id,f.brigade_id,c.company_name,u.nickname as captain_name,g.nickname as group_name,f.area_id area_name,f.street_id street_name,f.village_id village_name,f.brigade_id brigade_name,f.address')
|
||||
->leftJoin('company c','f.company_id = c.id')
|
||||
->leftJoin('user u','u.id = f.create_user_id')
|
||||
->leftJoin('user g','g.id = c.user_id')
|
||||
->where($search)
|
||||
->page($params['page_no'],$params['page_size'])->order('id desc')->select()
|
||||
->each(function($item){
|
||||
$item['address'] = $item['area_name'].$item['street_name'].$item['village_name'].$item['brigade_name'].$item['address'];
|
||||
unset($item['area_name'],$item['street_name'],$item['village_name'],$item['brigade_name'],$item['area_id'],$item['street_id'],$item['village_id'],$item['brigade_id']);
|
||||
$userInformationgDemand = UserInformationgDemand::field('id,category_child,data')->where('information_id', $item['id'])->where('category_id',6)->where('category_child','in','7,32')->order('id', 'desc')->select()->toArray();
|
||||
//是否是种植户
|
||||
$is_zz_user = false;
|
||||
//是否是水产养殖户
|
||||
$is_sc_user = false;
|
||||
//是否是家禽养殖户
|
||||
$is_jq_user = false;
|
||||
//是否是大型动物养殖户
|
||||
$is_dw_user = false;
|
||||
//土地总面积
|
||||
$total_land_area = 0;
|
||||
//池塘总面积
|
||||
$total_pond_area = 0;
|
||||
//家禽养殖场总面积
|
||||
$total_henhouse_area = 0;
|
||||
//动物养殖场总面积
|
||||
$total_pasture_area = 0;
|
||||
foreach($userInformationgDemand as $v){
|
||||
if($v['category_child'] == 7){
|
||||
$is_zz_user = true;
|
||||
$total_land_area += floatval($v['data']['area']);
|
||||
}
|
||||
if($v['category_child'] == 32){
|
||||
if($v['data']['breeding_type'] == 1){//水产
|
||||
$is_sc_user = true;
|
||||
$total_pond_area += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 2) {//脯乳动物
|
||||
$is_jq_user = true;
|
||||
$total_henhouse_area += floatval($v['data']['area']);
|
||||
}elseif ($v['data']['breeding_type'] == 3){//家禽
|
||||
$is_dw_user = true;
|
||||
$total_pasture_area += floatval($v['data']['area']);
|
||||
}
|
||||
}
|
||||
}
|
||||
$str = [];
|
||||
$area = [];
|
||||
if($is_zz_user){
|
||||
$str[] = '种植户';
|
||||
$area[] = $total_land_area;
|
||||
}
|
||||
if($is_sc_user){
|
||||
$str[] = '水产养殖户';
|
||||
$area[] = $total_pond_area;
|
||||
}
|
||||
if($is_jq_user){
|
||||
$str[] = '家禽养殖户';
|
||||
$area[] = $total_henhouse_area;
|
||||
}
|
||||
if($is_dw_user){
|
||||
$str[] = '家畜养殖户';
|
||||
$area[] = $total_pasture_area;
|
||||
}
|
||||
$item['farmer_type'] = implode('/',$str);
|
||||
$item['farmer_area'] = implode('/',$area);
|
||||
return $item;
|
||||
})->toArray();
|
||||
$count = UserInformationg::alias('f')
|
||||
->field('f.id,f.create_user_id,f.company_id,f.name,f.phone,f.area_id,f.street_id,f.village_id,f.brigade_id,c.company_name,u.nickname as captain_name,g.nickname as group_name,f.area_id area_name,f.street_id street_name,f.village_id village_name,f.brigade_id brigade_name,f.address')
|
||||
->leftJoin('company c','f.company_id = c.id')
|
||||
->leftJoin('user u','u.id = f.create_user_id')
|
||||
->leftJoin('user g','g.id = c.user_id')
|
||||
->where($search)
|
||||
->count();
|
||||
$result = [
|
||||
'count' => $count,
|
||||
'page_no' => $params['page_no'],
|
||||
'page_size' => $params['page_size'],
|
||||
'lists' => $data
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\cache\UserTokenCache;
|
||||
use app\common\model\Company;
|
||||
use app\api\validate\{LoginAccountValidate, RegisterValidate, WebScanLoginValidate, WechatLoginValidate};
|
||||
use app\api\logic\LoginLogic;
|
||||
use app\api\logic\UserLogic;
|
||||
@ -32,7 +34,7 @@ use app\common\service\FileService;
|
||||
class LoginController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['register', 'account', 'logout', 'codeUrl', 'oaLogin', 'mnpLogin', 'getScanCode', 'scanLogin', 'shop_account'];
|
||||
public array $notNeedLogin = ['register', 'account', 'logout', 'codeUrl', 'oaLogin', 'mnpLogin', 'getScanCode', 'scanLogin', 'shop_account','checkToken', 'parseToken'];
|
||||
|
||||
|
||||
/**
|
||||
@ -255,4 +257,36 @@ class LoginController extends BaseApiController
|
||||
LoginLogic::updateUser($params, $this->userId);
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
public function checkToken(): \think\response\Json
|
||||
{
|
||||
$token = $this->request->post('token');
|
||||
if(empty($token)){
|
||||
return $this->fail('token参数错误');
|
||||
}
|
||||
$userInfo = (new UserTokenCache())->getUserInfo($token);
|
||||
if(!$userInfo){
|
||||
return $this->fail('token无效');
|
||||
}
|
||||
//获取公司信息
|
||||
$company = Company::field('company_name,company_type')->where('id',$userInfo['company_id'])->findOrEmpty();
|
||||
if(!$company->isEmpty()){
|
||||
$userInfo['company_name'] = $company['company_name'];
|
||||
$userInfo['company_type'] = $company['company_type'];
|
||||
}
|
||||
return $this->success('请求成功', $userInfo);
|
||||
}
|
||||
|
||||
public function parseToken()
|
||||
{
|
||||
$token = $this->request->post('token');
|
||||
if(empty($token)){
|
||||
return $this->fail('token参数不能为空');
|
||||
}
|
||||
$result = LoginLogic::parseToken($token);
|
||||
if (false === $result) {
|
||||
return $this->fail(LoginLogic::getError() ?? '登录失败');
|
||||
}
|
||||
return $this->success('请求成功', $result);
|
||||
}
|
||||
}
|
||||
|
@ -39,12 +39,12 @@ class RechargeController extends BaseApiController
|
||||
public function deposit_lists()
|
||||
{
|
||||
$params=$this->request->param();
|
||||
$list=CompanyAccountLog::where('company_id',$this->userInfo['company_id'])->page($params['page_no'],15)->select();
|
||||
$list=CompanyAccountLog::where('company_id',$this->userInfo['company_id'])->page($params['page_no'],15)->order('id', 'desc')->select();
|
||||
$datas=[];
|
||||
foreach($list as $k=>$v){
|
||||
$datas[$k]['create_time']=$v['create_time'];
|
||||
$datas[$k]['order_amount']=$v['change_amount'];
|
||||
$datas[$k]['tips']='充值保证金'.$v['change_amount'];
|
||||
$datas[$k]['tips']='押金充值'.$v['change_amount'];
|
||||
}
|
||||
return $this->success('ok',['count'=>0,'extend'=>[],'lists'=>$datas,'page_no'=>$params['page_no'],'page_size'=>$params['page_size']]);
|
||||
}
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace app\api\controller;
|
||||
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\task\Task;
|
||||
@ -16,5 +17,20 @@ use think\facade\Log;
|
||||
*/
|
||||
class ShopCallController extends BaseApiController
|
||||
{
|
||||
|
||||
public array $notNeedLogin = ['getVillageCompany'];
|
||||
public function getVillageCompany()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$geoVillage = Db::name('geo_village')->where('village_id', $param['village_id'])->find();
|
||||
$company = Company::where(['village' =>$geoVillage['village_code'], 'company_type'=>17])->find();
|
||||
$find= Admin::where('id', $company['admin_id'])->field('avatar,id_card')->find();
|
||||
if($find){
|
||||
$company['avatar']=$find['avatar'];
|
||||
$company['id_card']=$find['id_card'];
|
||||
}else{
|
||||
$company['avatar']='';
|
||||
$company['id_card']='';
|
||||
}
|
||||
return $this->success('成功', compact('company'));
|
||||
}
|
||||
}
|
@ -13,13 +13,13 @@ use app\common\model\informationg\UserInformationg;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\vehicle\VehicleRent;
|
||||
use think\Exception;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
class TaskController extends BaseApiController
|
||||
{
|
||||
|
||||
public function lists()
|
||||
{
|
||||
$param = Request()->param();
|
||||
@ -27,24 +27,34 @@ class TaskController extends BaseApiController
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
$userCompanyInfo = Company::where('id', $this->userInfo['company_id'])->find();
|
||||
$where = [];
|
||||
// 公司负责人直接看公司的全部任务
|
||||
if ($this->userInfo['admin_id'] != 0) {
|
||||
$where[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||
}
|
||||
if ($userCompanyInfo['company_type'] == 18) {
|
||||
$is_captain = User::where('id', $this->userId)->value('is_captain');
|
||||
if ($is_captain == 1) {
|
||||
$where[] = ['type', 'in', [31,33]];
|
||||
} else {
|
||||
$where[] = ['type', '=', 33];
|
||||
$where[] = ['director_uid', '=', $this->userId];
|
||||
} else {
|
||||
// 其他角色看个人的任务
|
||||
if ($userCompanyInfo['company_type'] == 18) {
|
||||
$is_captain = User::where('id', $this->userId)->value('is_captain');
|
||||
if ($is_captain == 1) {
|
||||
$where[] = ['type', 'in', [31,33]];
|
||||
}
|
||||
// else {
|
||||
// $where[] = ['type', '=', 33];
|
||||
// $where[] = ['director_uid', '=', $this->userId];
|
||||
// }
|
||||
$where[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||
}
|
||||
|
||||
if ($userCompanyInfo['company_type'] == 16) {
|
||||
$where[] = ['director_uid', '=', $this->userId];
|
||||
// $where[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||
}
|
||||
if ($userCompanyInfo['company_type'] == 17) {
|
||||
$where[] = ['director_uid', '=', $this->userId];
|
||||
// $where[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||
}
|
||||
}
|
||||
|
||||
if ($userCompanyInfo['company_type'] == 41) {
|
||||
$where[] = ['director_uid', '=', $this->userId];
|
||||
// $where[] = ['company_id', '=', $this->userInfo['company_id']];
|
||||
}
|
||||
|
||||
if (isset($param['date_time']) && $param['date_time'] != '') {
|
||||
$time = strtotime($param['date_time']);
|
||||
$param['start_time']=date('Y-m-d H:i:s',$time);
|
||||
@ -63,14 +73,36 @@ class TaskController extends BaseApiController
|
||||
if (isset($param['status']) && $param['status'] > 0) {
|
||||
$where[] = ['status', '=', $param['status']];
|
||||
}
|
||||
$serviceGroupTaskTypeList = DictData::where(['type_value' => 'task_type', 'status' => 1])->column('value', 'id');
|
||||
$villageTaskTypeList = DictData::where(['type_value' => 'village_task_type', 'status' => 1])->column('value', 'id');
|
||||
$townTaskTypeList = DictData::where(['type_value' => 'town_task_type', 'status' => 1])->column('value', 'id');
|
||||
$townMarketingManagerTaskTypeList = DictData::where(['type_value' => 'town_task_type_marketing_director', 'status' => 1])->column('value', 'id');
|
||||
$townMasterTaskTypeList = DictData::where(['type_value' => 'town_task_type_master', 'status' => 1])->column('value', 'id');
|
||||
|
||||
$res = Task::where($where)
|
||||
->field(['id', 'title', 'money', 'template_id', 'director_uid', 'company_id', 'start_time', 'end_time', 'director_uid', 'type', 'status', 'content', 'extend'])
|
||||
->with(['directorInfo'])
|
||||
->field(['id', 'title', 'money', 'template_id', 'director_uid', 'company_id', 'start_time', 'end_time', 'type', 'status', 'content', 'extend'])
|
||||
->page($page, 25)
|
||||
->order(['id' => 'desc', 'status' => 'asc'])
|
||||
->select()->toArray();
|
||||
|
||||
foreach ($res as $k => $item) {
|
||||
$res[$k]['task_type_value'] = '';
|
||||
if (isset($serviceGroupTaskTypeList[$item['type']])) {
|
||||
$res[$k]['task_type_value'] = $serviceGroupTaskTypeList[$item['type']];
|
||||
}
|
||||
if (isset($villageTaskTypeList[$item['type']])) {
|
||||
$res[$k]['task_type_value'] = $villageTaskTypeList[$item['type']];
|
||||
}
|
||||
if (isset($townTaskTypeList[$item['type']])) {
|
||||
$res[$k]['task_type_value'] = $townTaskTypeList[$item['type']];
|
||||
}
|
||||
if (isset($townMasterTaskTypeList[$item['type']])) {
|
||||
$res[$k]['task_type_value'] = $townMasterTaskTypeList[$item['type']];
|
||||
}
|
||||
if (isset($townMarketingManagerTaskTypeList[$item['type']])) {
|
||||
$res[$k]['task_type_value'] = $townMarketingManagerTaskTypeList[$item['type']];
|
||||
}
|
||||
|
||||
if ($item['type'] == 33) {
|
||||
$company = Company::where('id', $item['company_id'])->field('id,deposit,company_money,user_id,day_count,company_type,province,city,area,street,village,brigade,responsible_area')->find(); // 可能要判断预存金是否满足
|
||||
$find = App(RemoteController::class)->shang_date_total_price($company,$param,$item['template_id']);
|
||||
@ -124,31 +156,34 @@ class TaskController extends BaseApiController
|
||||
}
|
||||
}
|
||||
|
||||
// break;
|
||||
// case 'town_task_type_2':
|
||||
// // 拓展小组服务团队工作任务
|
||||
//
|
||||
// break;
|
||||
// case 'town_task_type_3':
|
||||
// // 督促小组服务团队完成任务,协助开展工作,解决问题任务
|
||||
//
|
||||
// break;
|
||||
// case 'town_task_type_4':
|
||||
// // 督促小组服务团队学习任务
|
||||
//
|
||||
// break;
|
||||
// case 'town_task_type_5':
|
||||
// // 督促小组服务团队完成需求手机和交易任务
|
||||
//
|
||||
// break;
|
||||
// case 'town_task_type_6':
|
||||
// // 督促小组服务团队入股村联络员所成立的公司任务
|
||||
//
|
||||
// break;
|
||||
// case 'town_task_type_7':
|
||||
// // 安全工作任务
|
||||
//
|
||||
// break;
|
||||
if (isset($townMarketingManagerTaskTypeList[$item['type']])) {
|
||||
// 数字农贸宣传、加工业务建设和招商任务 返回给前端当前任务模板进行到哪个阶段
|
||||
// 每个阶段不同,前台展示不同的资料上传页面,上传走审批接口
|
||||
if ($townMarketingManagerTaskTypeList[$item['type']] == 'town_task_type_marketing_director_10') {
|
||||
$templateInfo = TaskTemplate::where(['id' => $item['template_id']])->find();
|
||||
$dayCount = $templateInfo['day_count'];
|
||||
$stageDayOne = $templateInfo['stage_day_one'];
|
||||
$stageDayTwoCount = bcadd($templateInfo['stage_day_one'], $templateInfo['stage_day_two']);
|
||||
$stageDayThreeCount = bcadd($templateInfo['stage_day_three'], $stageDayTwoCount);
|
||||
// 第一阶段
|
||||
if ($dayCount < $stageDayOne) {
|
||||
$res[$k]['stage'] = 1;
|
||||
}
|
||||
// 第二阶段
|
||||
if ($dayCount > $stageDayOne && $dayCount <= $stageDayTwoCount) {
|
||||
$res[$k]['stage'] = 2;
|
||||
}
|
||||
// 第三阶段
|
||||
if ($dayCount > $stageDayTwoCount && $dayCount <= $stageDayThreeCount) {
|
||||
$res[$k]['stage'] = 3;
|
||||
}
|
||||
// 第四阶段
|
||||
if ($dayCount > $stageDayThreeCount) {
|
||||
$res[$k]['stage'] = 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return $this->success('ok', $res);
|
||||
@ -195,6 +230,12 @@ class TaskController extends BaseApiController
|
||||
public function shareholder(){
|
||||
$parmas = $this->request->param();
|
||||
$task = TaskLogic::detail($parmas);
|
||||
$extend = $task['extend'];
|
||||
if (isset($extend['is_commit']) && $extend['is_commit'] == 1) {
|
||||
$approve = Approve::where(['task_id' =>$task['id']])->order('id', 'desc')->find();
|
||||
$task['approve_status'] = $approve['check_status']; //审核状态
|
||||
$task['deny_notes'] = $approve['remark']; // 拒绝原因
|
||||
}
|
||||
return $this->success('ok', $task);
|
||||
}
|
||||
/**
|
||||
@ -214,15 +255,20 @@ class TaskController extends BaseApiController
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
$task = Task::where('id', $parmas['id'])->find()->toArray();
|
||||
$object_id=CompanyProperty::where('company_id',$this->userInfo['company_id'])->value('object_id');
|
||||
if(!$object_id){
|
||||
return $this->fail('该公司没有三轮车,请先租赁三轮车');
|
||||
$VehicleRent = VehicleRent::where('rent_company_id', $this->userInfo['company_id'])->find();
|
||||
if(empty($VehicleRent)){
|
||||
self::setError('该公司没有三轮车,请先租赁三轮车');
|
||||
return false;
|
||||
}
|
||||
// $object_id=CompanyProperty::where('company_id',$this->userInfo['company_id'])->value('object_id');
|
||||
// if(!$object_id){
|
||||
// return $this->fail('该公司没有三轮车,请先租赁三轮车');
|
||||
// }
|
||||
$start_time = date('Y-m-d');
|
||||
$time=strtotime($start_time)+86399;
|
||||
$end_time=date('Y-m-d H:i:s',$time);
|
||||
$datas=[
|
||||
'car_id'=>$object_id,
|
||||
'car_id'=>$VehicleRent['car_id'],
|
||||
'start_time'=>$start_time.' 00:00:00',
|
||||
'end_time'=>$end_time
|
||||
];
|
||||
@ -294,7 +340,7 @@ class TaskController extends BaseApiController
|
||||
$parmas = $this->request->param();
|
||||
$task = TaskLogic::detail($parmas);
|
||||
$extend = $task['extend'];
|
||||
if ($extend['other']['is_commit'] == 1) {
|
||||
if (isset($extend['other']) && $extend['other']['is_commit'] == 1) {
|
||||
$approve = Approve::where(['task_id' =>$task['id']])->find();
|
||||
$task['approve_status'] = $approve['check_status']; //审核状态
|
||||
$task['deny_notes'] = $approve['remark']; // 拒绝原因
|
||||
@ -313,6 +359,10 @@ class TaskController extends BaseApiController
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
if (empty($parmas['annex']) && empty($parmas['video_annex'])) {
|
||||
$this->fail('没有上传凭证,无法提交审核');
|
||||
}
|
||||
|
||||
$extend = ['other' => ['is_commit' => 1, 'note' => $parmas['note'], 'annex'=>$parmas['annex'], 'video_annex' => $parmas['video_annex']]];
|
||||
Db::startTrans();
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time(), 'director_uid'=>$this->userId]); // director_uid 指派人
|
||||
@ -321,12 +371,11 @@ class TaskController extends BaseApiController
|
||||
$areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager');
|
||||
|
||||
// 没有则创建审批任务
|
||||
$approveModel = Approve::where(['task_id' => $task['id']])->find();
|
||||
$approveModel = Approve::where(['task_id' => $task['id']])->findOrEmpty();
|
||||
if ($approveModel->isEmpty()) {
|
||||
$approveModel->type = 1;
|
||||
$approveModel->type = Approve::APPROVE_TYPE_1;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->type = 1;
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 前台发起人用户id
|
||||
@ -336,7 +385,7 @@ class TaskController extends BaseApiController
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$approveModel->save();
|
||||
$re = $approveModel->save();
|
||||
} else {
|
||||
// 有则更新状态
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
@ -353,17 +402,18 @@ class TaskController extends BaseApiController
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科公司任务详情
|
||||
* 镇负责人公司任务详情
|
||||
*/
|
||||
public function service_task_detail()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$task = TaskLogic::detail($param);
|
||||
$task['template_info'] = TaskTemplate::where(['id' => $task['template_id']])->find();
|
||||
return $this->success('成功', $task);
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇农科公司任务-督促小组服务团队学习任务 -提交
|
||||
* 镇负责人公司任务-督促小组服务团队学习任务 -提交
|
||||
*/
|
||||
public function commit_town_task_type4()
|
||||
{
|
||||
@ -379,6 +429,589 @@ class TaskController extends BaseApiController
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 镇负责人公司任务-数字农贸宣传、加工业务建设和招商任务
|
||||
* 第一阶段 上传 宣传和加工两个业务 的手续办理完成证明
|
||||
* 第二阶段 上传 竣工验收单
|
||||
* 第三阶段 上传 两个业务体系招商入驻证明
|
||||
* 第四阶段 上传完成净利润的证明
|
||||
*
|
||||
* 将上传文件保存,走任务审批流程
|
||||
*/
|
||||
public function commit_town_task_type_marketing_director_10()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); //id stage stage_1第一阶段完成证明 stage_2 stage_3 stage_4
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
$extend = [];
|
||||
$stage = $parmas['stage']; // 当前做的是任务第几阶段
|
||||
if ($stage == 1) {
|
||||
$extend['stage1'] = $parmas['stage1'];
|
||||
$extend['stage1']['is_commit'] = 1;
|
||||
}
|
||||
if ($stage == 2) {
|
||||
$extend['stage2'] = $parmas['stage2'];
|
||||
$extend['stage2']['is_commit'] = 1;
|
||||
}
|
||||
if ($stage == 3) {
|
||||
$extend['stage3'] = $parmas['stage3'];
|
||||
$extend['stage3']['is_commit'] = 1;
|
||||
}
|
||||
if ($stage == 4) {
|
||||
$extend['stage4'] = $parmas['stage4'];
|
||||
$extend['stage4']['is_commit'] = 1;
|
||||
}
|
||||
$extend['stage'] = $stage;
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time()]);
|
||||
|
||||
// 片区经理
|
||||
$areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager');
|
||||
|
||||
|
||||
// 创建审批任务
|
||||
$approveModel = new Approve();
|
||||
$approveModel->type = Approve::APPROVE_TYPE_4;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = '0';
|
||||
$approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function town_task_type_marketing_director_10_detail()
|
||||
{
|
||||
$parmas = $this->request->param();
|
||||
$task = TaskLogic::detail($parmas);
|
||||
$approve = Approve::where(['task_id' =>$task['id']])->order('id', 'desc')->find();
|
||||
if ($approve) {
|
||||
$task['approve_status'] = $approve['check_status']; //审核状态
|
||||
$task['deny_notes'] = $approve['remark']; // 拒绝原因
|
||||
$task['approve_extend'] = $approve['extend']; // 审批扩展信息
|
||||
}
|
||||
return $this->success('ok', $task);
|
||||
}
|
||||
|
||||
public function commit_village_task_type_6()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); //id annex video_annex
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
if (empty($parmas['annex']) && empty($parmas['video_annex'])) {
|
||||
$this->fail('没有上传凭证,无法提交审核');
|
||||
}
|
||||
|
||||
$extend = [
|
||||
'other'=> [
|
||||
'is_commit' => 1,
|
||||
'note' => $parmas['note'],
|
||||
'annex' => $parmas['annex'],
|
||||
'video_annex' => $parmas['video_annex'],
|
||||
]
|
||||
];
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time()]);
|
||||
|
||||
// 片区经理
|
||||
$areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager');
|
||||
|
||||
|
||||
// 没有则创建审批任务
|
||||
$approveModel = Approve::where(['task_id' => $task['id']])->findOrEmpty();
|
||||
if ($approveModel->isEmpty()) {
|
||||
$approveModel->type = Approve::APPROVE_TYPE_6;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = '0';
|
||||
$approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
} else {
|
||||
// 有则更新状态
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->save();
|
||||
}
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function commit_village_task_type_8()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex video_annex
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
if (empty($parmas['annex']) && empty($parmas['video_annex'])) {
|
||||
$this->fail('没有上传凭证,无法提交审核');
|
||||
}
|
||||
|
||||
$extend = [
|
||||
'other'=> [
|
||||
'is_commit' => 1,
|
||||
'note' => $parmas['note'],
|
||||
'annex' => $parmas['annex'],
|
||||
'video_annex' => $parmas['video_annex'],
|
||||
]
|
||||
];
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time()]);
|
||||
|
||||
// 片区经理
|
||||
$areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager');
|
||||
|
||||
|
||||
// 没有则创建审批任务
|
||||
$approveModel = Approve::where(['task_id' => $task['id']])->findOrEmpty();
|
||||
if ($approveModel->isEmpty()) {
|
||||
$approveModel->type = Approve::APPROVE_TYPE_6;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = '0';
|
||||
$approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
} else {
|
||||
// 有则更新状态
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->save();
|
||||
}
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提前完成,截止提交时间,前面的钱一次性结算,往后至任务结束每天发放
|
||||
*/
|
||||
public function commit_town_master_task_type_2()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex video_annex
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
if (empty($parmas['annex']) && empty($parmas['video_annex'])) {
|
||||
$this->fail('没有上传凭证,无法提交审核');
|
||||
}
|
||||
|
||||
$extend = [
|
||||
'other'=> [
|
||||
'is_commit' => 1,
|
||||
'note' => $parmas['note'],
|
||||
'annex' => $parmas['annex'],
|
||||
'video_annex' => $parmas['video_annex'],
|
||||
]
|
||||
];
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time()]);
|
||||
|
||||
// 片区经理
|
||||
$areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager');
|
||||
|
||||
|
||||
// 查询是否 已有审批通过的
|
||||
$approveModel = Approve::where(['business_id' => $task['template_id'], 'check_status' => 2])->findOrEmpty();
|
||||
if ($approveModel->isEmpty()) {
|
||||
$approveModel->type = Approve::APPROVE_TYPE_7;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->business_id = $task['template_id']; // 关联模板id,结算时用于判断这个任务是否提前完成
|
||||
$approveModel->department_id = '0';
|
||||
$approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
} else {
|
||||
// 有则更新状态
|
||||
return $this->fail('该任务已完成,请勿重复提交');
|
||||
}
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交 镇合伙人负责人-信息收集
|
||||
* 将信息收集存入task_template表中
|
||||
*/
|
||||
publiC function commit_town_master_task_type_3()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$task = Task::where(['id'=>$param['id']])->find();
|
||||
$taskTemplate = TaskTemplate::where(['id'=>$task['template_id']])->find();
|
||||
$extend = $taskTemplate['extend'];
|
||||
$extend['purchase_sales_info'] = $param['purchase_sales_info'];
|
||||
$taskTemplate->save(['extend'=>json_encode($extend)]);
|
||||
return $this->success('成功', []);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提交 镇合伙人负责人-政策补贴申请
|
||||
* 上传凭证,后台审批,填写实际完成金额
|
||||
*/
|
||||
publiC function commit_town_master_task_type_7()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex video_annex
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
if (empty($parmas['annex']) && empty($parmas['video_annex'])) {
|
||||
$this->fail('没有上传凭证,无法提交审核');
|
||||
}
|
||||
|
||||
$extend = [
|
||||
'other'=> [
|
||||
'is_commit' => 1,
|
||||
'note' => $parmas['note'],
|
||||
'annex' => $parmas['annex'],
|
||||
'video_annex' => $parmas['video_annex'],
|
||||
]
|
||||
];
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time()]);
|
||||
|
||||
// 片区经理
|
||||
$areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager');
|
||||
|
||||
|
||||
// 没有则创建审批任务
|
||||
$approveModel = Approve::where(['task_id' => $task['id']])->findOrEmpty();
|
||||
if ($approveModel->isEmpty()) {
|
||||
$approveModel->type = Approve::APPROVE_TYPE_8;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = '0';
|
||||
$approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
} else {
|
||||
// 有则更新状态
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->save();
|
||||
}
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function commit_town_master_task_type_8()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex video_annex
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
if (empty($parmas['annex']) && empty($parmas['video_annex'])) {
|
||||
$this->fail('没有上传凭证,无法提交审核');
|
||||
}
|
||||
|
||||
$extend = [
|
||||
'other'=> [
|
||||
'is_commit' => 1,
|
||||
'note' => $parmas['note'],
|
||||
'annex' => $parmas['annex'],
|
||||
'video_annex' => $parmas['video_annex'],
|
||||
]
|
||||
];
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time'=>time()]);
|
||||
|
||||
// 片区经理
|
||||
$areaManagerId = User::where(['id' => $this->userId])->with('company')->value('area_manager');
|
||||
|
||||
|
||||
// 没有则创建审批任务
|
||||
$approveModel = Approve::where(['task_id' => $task['id']])->findOrEmpty();
|
||||
if ($approveModel->isEmpty()) {
|
||||
$approveModel->type = Approve::APPROVE_TYPE_9;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = '0';
|
||||
$approveModel->check_admin_ids = $areaManagerId; // 当前审批人ID 片区经理的admin_id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
} else {
|
||||
// 有则更新状态
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->save();
|
||||
}
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 小组服务团队-入股任务提交
|
||||
|
||||
public function commit_service_group_task()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex amount
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
$extend = $task['extend'];
|
||||
$extend['is_commit'] = 1;
|
||||
$extend['annex'] = $parmas['annex'];
|
||||
$extend['file_type'] = $parmas['file_type'];
|
||||
$extend['amount'] = $parmas['amount'];
|
||||
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time' => time(), 'director_uid' => $this->userId]); // director_uid 指派人
|
||||
|
||||
// 创建审批任务
|
||||
$approveModel = new Approve();
|
||||
$approveModel->type = Approve::APPROVE_TYPE_10;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = $this->userInfo['company_id']; // 公司id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->amount = $parmas['amount']; // 入股金额
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 村联络员-督促小组服务团队入股任务提交
|
||||
public function commit_village_task_4()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex amount
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
$extend = $task['extend'];
|
||||
$extend['is_commit'] = 1;
|
||||
$extend['annex'] = $parmas['annex'];
|
||||
$extend['file_type'] = $parmas['file_type'];
|
||||
$extend['amount'] = $parmas['amount'];
|
||||
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time' => time()]);
|
||||
|
||||
// 创建审批任务
|
||||
$approveModel = new Approve();
|
||||
$approveModel->type = Approve::APPROVE_TYPE_11;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = $this->userInfo['company_id']; // 公司id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->amount = $parmas['amount']; // 入股金额
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 村联络员-入股甲方公司任务提交
|
||||
public function commit_village_task_5()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex amount
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
$extend = $task['extend'];
|
||||
$extend['is_commit'] = 1;
|
||||
$extend['annex'] = $parmas['annex'];
|
||||
$extend['file_type'] = $parmas['file_type'];
|
||||
$extend['amount'] = $parmas['amount'];
|
||||
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time' => time()]);
|
||||
|
||||
// 创建审批任务
|
||||
$approveModel = new Approve();
|
||||
$approveModel->type = Approve::APPROVE_TYPE_12;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = $this->userInfo['company_id']; // 公司id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->amount = $parmas['amount']; // 入股金额
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 镇合伙人服务部长-督促小组服务团队入股村管理公司
|
||||
public function commit_town_service_manager_task_6()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex amount
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
$extend = $task['extend'];
|
||||
$extend['is_commit'] = 1;
|
||||
$extend['annex'] = $parmas['annex'];
|
||||
$extend['file_type'] = $parmas['file_type'];
|
||||
$extend['amount'] = $parmas['amount'];
|
||||
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time' => time()]);
|
||||
|
||||
// 创建审批任务
|
||||
$approveModel = new Approve();
|
||||
$approveModel->type = Approve::APPROVE_TYPE_13;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = $this->userInfo['company_id']; // 公司id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->amount = $parmas['amount']; // 入股金额
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 镇合伙人负责人-促成村联络员入股甲方
|
||||
public function commit_town_master_task_6()
|
||||
{
|
||||
try {
|
||||
$parmas = $this->request->param(); // id annex amount
|
||||
$task = TaskLogic::detail($parmas);
|
||||
if (empty($task)) {
|
||||
$this->fail('任务不存在');
|
||||
}
|
||||
$extend = $task['extend'];
|
||||
$extend['is_commit'] = 1;
|
||||
$extend['annex'] = $parmas['annex'];
|
||||
$extend['file_type'] = $parmas['file_type'];
|
||||
$extend['amount'] = $parmas['amount'];
|
||||
|
||||
Task::where(['id' => $parmas['id']])->update(['extend' => json_encode($extend), 'update_time' => time()]);
|
||||
|
||||
// 创建审批任务
|
||||
$approveModel = new Approve();
|
||||
$approveModel->type = Approve::APPROVE_TYPE_14;
|
||||
$approveModel->flow_id = 1;
|
||||
$approveModel->name = $task['title'];
|
||||
$approveModel->admin_id = 0; // 后台发起人id 暂时为0
|
||||
$approveModel->user_id = $this->userId; // 前台发起人用户id
|
||||
$approveModel->task_id = $task['id']; // 任务id
|
||||
$approveModel->department_id = $this->userInfo['company_id']; // 公司id
|
||||
$approveModel->check_status = 1; // 状态 0待审核,1审核中,2审核通过,3审核不通过,4撤销审核
|
||||
$approveModel->other_type = 6;
|
||||
$approveModel->amount = $parmas['amount']; // 入股金额
|
||||
$approveModel->extend = json_encode($extend);
|
||||
$approveModel->create_time = time();
|
||||
$approveModel->update_time = time();
|
||||
$re = $approveModel->save();
|
||||
return $this->success('ok', []);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 任务开始通知
|
||||
public function taskStartNotice()
|
||||
{
|
||||
$startTime = strtotime(date('Y-m-d', time()));
|
||||
$endTime = strtotime(date('Y-m-d', strtotime('+2 day')));
|
||||
// 查询用户所在公司的任务安排
|
||||
$template = TaskTemplate::where('company_id', $this->userInfo['company_id'])
|
||||
->whereBetweenTime('cron_time', $startTime, $endTime)
|
||||
->order('cron_time', 'asc')
|
||||
->find();
|
||||
|
||||
if (!empty($template)) {
|
||||
$template['cron_time'] = date('Y-m-d', $template['cron_time']);
|
||||
return $this->success('成功', compact('template'));
|
||||
} else {
|
||||
return $this->success('成功', []);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,22 +15,32 @@ class VehicleController extends BaseApiController
|
||||
//镇街公司想物流平台申请租赁车辆
|
||||
public function setContractByTownCompany()
|
||||
{
|
||||
//获取参数
|
||||
//获取参数 测试1111
|
||||
$params = $this->request->post(['num']);
|
||||
//验证参数
|
||||
if(empty($params['num'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
//获取该公司已签约的小组服务公司数量
|
||||
$villageCompany = Contract::field('id')->where('party_a',$this->userInfo['company_id'])->where('signing_timer',2)->count();
|
||||
//已经租赁车辆
|
||||
$rentCar = VehicleRent::field('id')->where('company_id',$this->userInfo['company_id'])->where('type','<>', 1)->count();
|
||||
//申请中的车辆
|
||||
$applyCar = VehicleContract::field('num')->where('company_b_id',$this->userInfo['company_id'])->where('status','in','-1,0,1,2')->sum('num');
|
||||
//自有车辆数量
|
||||
$selfCar = VehicleRent::field('id')->where('company_id',$this->userInfo['company_id'])->where('status','<>',3)->where('type',1)->count();
|
||||
//可在租车辆
|
||||
$doubleRentCar = max($villageCompany - $rentCar - $applyCar - $selfCar,0);
|
||||
//获取该公司已签约的小组服务公司数量
|
||||
$villageCompany = Contract::field('id')->where('party_a',$this->userInfo['company_id'])->where('signing_timer',2)->count();
|
||||
//已经租赁车辆
|
||||
$rentCar = VehicleRent::field('id')->where('company_id',$this->userInfo['company_id'])->whereNotIn('type','1,2')->count();
|
||||
//申请中的车辆
|
||||
$applyCar = VehicleContract::field('num')->where('company_b_id',$this->userInfo['company_id'])->where('status','in','-1,0,1,2')->sum('num');
|
||||
//自有车辆数量
|
||||
$selfCar = VehicleContract::field('id')->where('company_a_id',$this->userInfo['company_id'])->where('type',1)->where('status','in','-1,0,1,2,3')->sum('num');
|
||||
//购买车辆数量
|
||||
//获取下面的小组服务公司
|
||||
$villageCompanys = Contract::field('party_b')->where('party_a',$this->userInfo['company_id'])->where('signing_timer',2)->select()->toArray();
|
||||
$buyCar = 0;
|
||||
foreach ($villageCompanys as $v) {
|
||||
$aa = VehicleContract::field('id')->where('company_b_id',$v['party_b'])->where('type',3)->where('status','in','-1,0,1,2,3')->findOrEmpty();
|
||||
if(!$aa->isEmpty()){
|
||||
$buyCar += 1;
|
||||
}
|
||||
}
|
||||
//可在租车辆
|
||||
$doubleRentCar = max($villageCompany - $rentCar - $applyCar - $selfCar - $buyCar,0);
|
||||
if($params['num'] > $doubleRentCar ){
|
||||
return $this->fail('数量超过可再租车辆数');
|
||||
}
|
||||
@ -48,7 +58,7 @@ class VehicleController extends BaseApiController
|
||||
return $this->fail('数据不存在');
|
||||
}
|
||||
//判断是否是镇街公司
|
||||
if($party_b['company_type'] != 16){
|
||||
if($party_b['company_type'] != 41){
|
||||
return ['code'=>0,'msg'=>'非镇街公司不能签约'];
|
||||
}
|
||||
//发送生成合同给物流信息
|
||||
@ -226,12 +236,12 @@ class VehicleController extends BaseApiController
|
||||
return $this->fail('当前小组服务公司未签约');
|
||||
}
|
||||
//获取签约信息
|
||||
$contract = Contract::where('party_b',$this->userInfo['company_id'])->where('signing_timer',2)->find();
|
||||
$contract = Contract::where('party_b',$this->userInfo['company_id'])->where('signing_timer',2)->findOrEmpty();
|
||||
if($contract->isEmpty()){
|
||||
return $this->fail('未找到签约镇街公司');
|
||||
}
|
||||
$party_a = Company::field('id,company_name,master_name,master_phone,master_email,is_contract,organization_code,company_type')->where('id',$contract['party_a'])->find();
|
||||
if(empty($contract) || empty($party_a)){
|
||||
return $this->fail('未找到签约镇街公司');
|
||||
}
|
||||
if($party_a['company_type'] != 16){
|
||||
if($party_a['company_type'] != 41){
|
||||
return $this->fail('不能与非镇街公司签约');
|
||||
}
|
||||
if($party_a['is_contract'] != 1){
|
||||
@ -354,6 +364,7 @@ class VehicleController extends BaseApiController
|
||||
}
|
||||
//获取数据
|
||||
$vehicleContract = VehicleContract::where('id',$id)->find();
|
||||
$vehicleContract['cars_info'] = json_decode($vehicleContract['cars_info'],true);
|
||||
if(empty($vehicleContract)){
|
||||
return $this->fail('获取数据失败');
|
||||
}
|
||||
@ -375,11 +386,18 @@ class VehicleController extends BaseApiController
|
||||
if(empty($company)){
|
||||
return $this->fail('数据错误');
|
||||
}
|
||||
if($company['company_type'] != 16){
|
||||
if($company['company_type'] != 41){
|
||||
return $this->fail('非镇街公司不能访问');
|
||||
}
|
||||
//获取小组服务公司申请信息
|
||||
$vehicleContract = VehicleContract::where('company_a_id',$company['id'])->where('status','in','-1,0,1,2')->limit(4)->order('create_time desc')->select()->toArray();
|
||||
$vehicleContract_pre = VehicleContract::where('company_a_id',$company['id'])->where('status','in','-1,0,1,2')->where('type','<>',2)->limit(4)->order('create_time desc')->select()->toArray();
|
||||
$vehicleContract = [];
|
||||
foreach ($vehicleContract_pre as $v) {
|
||||
$vehicleBuy = VehicleBuyRecord::where('contract_id',$v['id'])->findOrEmpty();
|
||||
if($vehicleBuy->isEmpty()){
|
||||
$vehicleContract[] = $v;
|
||||
}
|
||||
}
|
||||
//获取车辆列表
|
||||
$vehicleRentCars = VehicleRent::where('company_id',$company['id'])->where('status','in','0,1,2')->select()->each(function($item){
|
||||
if($item['status'] == 2){
|
||||
@ -389,13 +407,23 @@ class VehicleController extends BaseApiController
|
||||
//获取该公司已签约的小组服务公司数量
|
||||
$villageCompany = Contract::field('id')->where('party_a',$company['id'])->where('signing_timer',2)->count();
|
||||
//已经租赁车辆
|
||||
$rentCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('type','<>', 1)->count();
|
||||
$rentCar = VehicleRent::field('id')->where('company_id',$company['id'])->whereNotIn('type','1,2')->count();
|
||||
//申请中的车辆
|
||||
$applyCar = VehicleContract::field('num')->where('company_b_id',$company['id'])->where('status','in','-1,0,1,2')->sum('num');
|
||||
//自有车辆数量
|
||||
$selfCar = VehicleRent::field('id')->where('company_id',$company['id'])->where('status','<>',3)->where('type',1)->count();
|
||||
$selfCar = VehicleContract::field('id')->where('company_a_id',$company['id'])->where('type',1)->where('status','in','-1,0,1,2,3')->sum('num');
|
||||
//购买车辆数量
|
||||
//获取下面的小组服务公司
|
||||
$villageCompanys = Contract::field('party_b')->where('party_a',$company['id'])->where('signing_timer',2)->select()->toArray();
|
||||
$buyCar = 0;
|
||||
foreach ($villageCompanys as $v) {
|
||||
$aa = VehicleContract::field('id')->where('company_b_id',$v['party_b'])->where('type',3)->where('status','in','-1,0,1,2,3')->findOrEmpty();
|
||||
if(!$aa->isEmpty()){
|
||||
$buyCar += 1;
|
||||
}
|
||||
}
|
||||
//可在租车辆
|
||||
$doubleRentCar = max($villageCompany - $rentCar - $applyCar - $selfCar,0);
|
||||
$doubleRentCar = max($villageCompany - $rentCar - $applyCar - $selfCar - $buyCar,0);
|
||||
//设置数据
|
||||
$data = [
|
||||
'apply' => $vehicleContract,
|
||||
@ -404,6 +432,7 @@ class VehicleController extends BaseApiController
|
||||
'rent_num' => $rentCar,
|
||||
'can_rent_num' => intval($doubleRentCar),
|
||||
'self_num' => $selfCar,
|
||||
'buy_num' => $buyCar,
|
||||
'apply_num' => $applyCar
|
||||
];
|
||||
//返回
|
||||
@ -558,7 +587,7 @@ class VehicleController extends BaseApiController
|
||||
if(empty($company)){
|
||||
return $this->fail('请求错误');
|
||||
}
|
||||
if($company['company_type'] != 16){
|
||||
if($company['company_type'] != 41){
|
||||
return $this->fail('非镇街公司不能访问');
|
||||
}
|
||||
$data = VehicleContract::field('id,contract_no,contract_url,status,create_time,update_time')->where('contract_logistic_id','<>',0)->where('company_b_id',$company['id'])->select();
|
||||
@ -637,11 +666,14 @@ class VehicleController extends BaseApiController
|
||||
}
|
||||
//2、获取小组服务公司签约的镇街公司
|
||||
$zjCompany = Contract::field('party_a')->where('party_b',$this->userInfo['company_id'])->where('signing_timer',2)->findOrEmpty();
|
||||
if($zjCompany->isEmpty()){
|
||||
return $this->fail('未获取到小组服务公司签约的镇街公司');
|
||||
}
|
||||
//3、获取镇街公司向平台租赁的且未二次租赁给小组公司的车辆
|
||||
$zjRentCars = VehicleRent::field('car_id')->where('company_id',$zjCompany['party_a'])->where('status',0)->select()->toArray();
|
||||
$zjRentCars = array_column($zjRentCars,'car_id');
|
||||
//4、获取小组公司自己租赁的车辆
|
||||
$xzRentCars = VehicleRent::field('car_id')->where('company_id',$zjCompany['party_a'])->where('rent_company_id',$xzCompany['id'])->where('status',2)->where('type','<>',2)->select()->toArray();
|
||||
$xzRentCars = VehicleRent::field('car_id')->where('company_id',$zjCompany['party_a'])->where('rent_company_id',$xzCompany['id'])->where('status',2)->where('type','<>',1)->where('type','<>',2)->select()->toArray();
|
||||
$xzRentCars = array_column($xzRentCars,'car_id');
|
||||
//5、获取平台未出租的车辆
|
||||
$result = curl_post(env('project.logistic_domain').'/api/Vehicle/getFreeCars',[],['ids'=>implode(',',array_merge($zjRentCars,$xzRentCars))]);
|
||||
@ -770,6 +802,11 @@ class VehicleController extends BaseApiController
|
||||
'update_time' => time(),
|
||||
]);
|
||||
//生成关联记录
|
||||
if($xzRentCars['type'] == 0){
|
||||
$status = 2;
|
||||
}else{
|
||||
$status = 1;
|
||||
}
|
||||
VehicleBuyRecord::create([
|
||||
'company_id' => $xzCompany['id'],
|
||||
'company_name' => $xzCompany['company_name'],
|
||||
@ -779,7 +816,7 @@ class VehicleController extends BaseApiController
|
||||
'company_email' => $xzCompany['master_email'],
|
||||
'cars_info' => json_encode($cars),
|
||||
'num' => count($cars),
|
||||
'status' => 1,
|
||||
'status' => $status,
|
||||
'contract_id' => $res->id,
|
||||
'create_time' => time()
|
||||
]);
|
||||
|
@ -114,7 +114,7 @@ class XunFeiController extends BaseApiController
|
||||
foreach($data_field as $k=>$v) {
|
||||
$demand .= $k . ':' . $v . ';';
|
||||
}
|
||||
$question = "分析以下{$type_name}信息【{$demand}】请问有那些商机?";
|
||||
$question = "根据以下{$type_name}信息【{$demand}】请问有那些商机?";
|
||||
$chat=new ChatClient($this->app_id,$this->api_key,$this->api_secret);
|
||||
$client = new Client($chat->assembleAuthUrl('wss://spark-api.xf-yun.com/v2.1/chat'));
|
||||
// 连接到 WebSocket 服务器
|
||||
@ -216,6 +216,7 @@ class XunFeiController extends BaseApiController
|
||||
if (!in_array($ext, $extArray)) {
|
||||
return $this->fail('录音格式错误');
|
||||
}
|
||||
// ********** 临时方案 ********** //
|
||||
$encoding = 'raw';
|
||||
if ($ext == 'mp3') {
|
||||
$encoding = 'lame';
|
||||
@ -356,7 +357,7 @@ class XunFeiController extends BaseApiController
|
||||
$audioFile = $dir . '/' . $file_name;
|
||||
$business = [
|
||||
'aue' => 'lame', //mp3格式
|
||||
'vcn' => 'x4_lingxiaoyao_en', //发音人
|
||||
'vcn' => 'aisjinger', //发音人
|
||||
'auf' => 'audio/L16;rate=16000', //音频采样率
|
||||
'speed' => 50, //语速
|
||||
'volume' => 100, //音量
|
||||
@ -377,10 +378,11 @@ class XunFeiController extends BaseApiController
|
||||
public function ocr()
|
||||
{
|
||||
$ocrHostUrl = "https://api.xf-yun.com/v1/private/sf8e6aca1";
|
||||
$file = request()->file('image');
|
||||
$file = request()->param('image');
|
||||
if (empty($file)) {
|
||||
return $this->fail('未上传图片文件');
|
||||
}
|
||||
/*
|
||||
// 上传图片临时文件
|
||||
$savename = \think\facade\Filesystem::putFile('ocr', $file);
|
||||
$file = app()->getRootPath() . '/runtime/storage/' . $savename;
|
||||
@ -391,12 +393,9 @@ class XunFeiController extends BaseApiController
|
||||
if ($filesize > 4 * 1024 * 1024) {
|
||||
return $this->fail('图片文件不能超过4M');
|
||||
}
|
||||
*/
|
||||
$ext = pathinfo($file, PATHINFO_EXTENSION);
|
||||
$base64_image = base64_encode(file_get_contents($file));
|
||||
if (file_exists($file)) {
|
||||
// 删除临时文件
|
||||
unlink($file);
|
||||
}
|
||||
$ocr = new OcrClient($this->app_id, $this->api_key, $this->api_secret);
|
||||
$ocrHostUrl = $ocr->assembleAuthUrl($ocrHostUrl);
|
||||
$requestBody = [
|
||||
@ -424,7 +423,7 @@ class XunFeiController extends BaseApiController
|
||||
];
|
||||
$text = [];
|
||||
try {
|
||||
$client = new GzClient(['timeout' => 2]);
|
||||
$client = new GzClient(['timeout' => 5]);
|
||||
$response = $client->request('POST', $ocrHostUrl, [
|
||||
'json' => $requestBody,
|
||||
'verify' => false
|
||||
@ -438,7 +437,10 @@ class XunFeiController extends BaseApiController
|
||||
$textArray = json_decode(base64_decode($encodeText), true);
|
||||
$lineArray = $textArray['pages'][0]['lines'] ?? [];
|
||||
foreach($lineArray as $item) {
|
||||
$text[] = $item['words'][0]['content'] ?? '';
|
||||
$content = $item['words'][0]['content'] ?? '';
|
||||
if ($content) {
|
||||
$text[] = $content;
|
||||
}
|
||||
}
|
||||
} catch (GuzzleException $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
|
@ -31,6 +31,13 @@ use app\common\model\user\{User, UserAuth};
|
||||
use think\facade\{Db, Config};
|
||||
use Firebase\JWT\JWT;
|
||||
use Firebase\JWT\Key;
|
||||
use Firebase\JWT\SignatureInvalidException;
|
||||
use Firebase\JWT\BeforeValidException;
|
||||
use Firebase\JWT\ExpiredException;
|
||||
use GuzzleHttp\Client;
|
||||
use GuzzleHttp\Psr7\Request;
|
||||
use GuzzleHttp\Exception\GuzzleException;
|
||||
use Guzzle\Http\Exception\RequestException;
|
||||
/**
|
||||
* 登录逻辑
|
||||
* Class LoginLogic
|
||||
@ -140,6 +147,9 @@ class LoginLogic extends BaseLogic
|
||||
if (isset($params['register_id']) && $params['register_id'] != '') {
|
||||
$user->register_id = $params['register_id'];
|
||||
}
|
||||
if (isset($params['ytj_register_id']) && $params['ytj_register_id'] != '') {
|
||||
$user->ytj_register_id = $params['ytj_register_id'];
|
||||
}
|
||||
//更新登录信息
|
||||
$user->login_time = time();
|
||||
$user->login_ip = request()->ip();
|
||||
@ -207,6 +217,116 @@ class LoginLogic extends BaseLogic
|
||||
self::setError('无登录信息');
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function parseToken($token){
|
||||
$app_key = 'ae47e94a7dcd1fdfacb499b60e361a8d';
|
||||
try {
|
||||
JWT::$leeway = 10; //当前时间减去10秒,时间留点余地
|
||||
$decoded = JWT::decode($token, new Key($app_key, 'HS256'));
|
||||
$decodedArray = json_decode(json_encode($decoded), true);
|
||||
$jwtData = $decodedArray['data'] ?? [];
|
||||
if (empty($jwtData['uid']) || empty($jwtData['phone'])) {
|
||||
self::setError('当前账号未授权,请手动登录');
|
||||
return false;
|
||||
}
|
||||
$where = ['account|mobile' => $jwtData['phone']];
|
||||
$user = User::where($where)->findOrEmpty();
|
||||
if ($user->isEmpty()) {
|
||||
try {
|
||||
//适配解析商城token
|
||||
$parseHostUrl = env('url.shop_prefix') . '/api/parse/token';
|
||||
$client = new Client(['timeout' => 5]);
|
||||
$requestBody['token'] = $token;
|
||||
$response = $client->request('POST', $parseHostUrl, [
|
||||
'json' => $requestBody,
|
||||
'verify' => false
|
||||
]);
|
||||
$responseData = $response->getBody()->getContents();
|
||||
$responseArray = json_decode($responseData, true);
|
||||
if (empty($responseArray['data']['user']['uid'])) {
|
||||
self::setError('用户不存在,请联系管理员开通供销系统账户');
|
||||
return false;
|
||||
} else {
|
||||
$user_id = $responseArray['data']['user']['uid'];
|
||||
$find = Db::name('user_other')->where('other_user_id', $user_id)->where('type', 'shop_user')->find();
|
||||
if ($find) {
|
||||
$user = User::where('id', $find['user_id'])->findOrEmpty();
|
||||
if ($user->isEmpty()) {
|
||||
self::setError('用户不存在,请联系管理员开通供销系统账户');
|
||||
return false;
|
||||
}
|
||||
$terminal=3;
|
||||
$Android=IndexLogic::isAndroid();
|
||||
if($Android){
|
||||
$terminal=5;
|
||||
}
|
||||
$ios=IndexLogic::isIOS();
|
||||
if($ios){
|
||||
$terminal=6;
|
||||
}
|
||||
$userInfo = UserTokenService::setToken($user->id, $terminal);
|
||||
//返回登录信息
|
||||
$avatar = $user->avatar ?: Config::get('project.default_image.user_avatar');
|
||||
$avatar = FileService::getFileUrl($avatar);
|
||||
return [
|
||||
'nickname' => $userInfo['nickname'],
|
||||
'sn' => $userInfo['sn'],
|
||||
'mobile' => $userInfo['mobile'],
|
||||
'avatar' => $avatar,
|
||||
'token' => $userInfo['token'],
|
||||
];
|
||||
} else {
|
||||
self::setError('用户不存在,请联系管理员开通供销系统账户');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} catch (GuzzleException $e) {
|
||||
//return $this->fail($e->getMessage());self::setError('用户不存在,请联系管理员开通供销系统账户');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//更新登录信息
|
||||
$user->login_time = time();
|
||||
$user->login_ip = request()->ip();
|
||||
$user->save();
|
||||
$terminal=3;
|
||||
$Android=IndexLogic::isAndroid();
|
||||
if($Android){
|
||||
$terminal=5;
|
||||
}
|
||||
$ios=IndexLogic::isIOS();
|
||||
if($ios){
|
||||
$terminal=6;
|
||||
}
|
||||
//设置token
|
||||
$userInfo = UserTokenService::setToken($user->id, $terminal);
|
||||
//返回登录信息
|
||||
$avatar = $user->avatar ?: Config::get('project.default_image.user_avatar');
|
||||
$avatar = FileService::getFileUrl($avatar);
|
||||
$user_id = $jwtData['uid'];
|
||||
return [
|
||||
'nickname' => $userInfo['nickname'],
|
||||
'sn' => $userInfo['sn'],
|
||||
'mobile' => $userInfo['mobile'],
|
||||
'avatar' => $avatar,
|
||||
'token' => $userInfo['token'],
|
||||
];
|
||||
} catch(\Firebase\JWT\SignatureInvalidException $e) {
|
||||
self::setError('签名错误');
|
||||
return false;
|
||||
} catch(\Firebase\JWT\BeforeValidException $e) {
|
||||
self::setError('token无效');
|
||||
return false;
|
||||
} catch(\Firebase\JWT\ExpiredException $e) {
|
||||
self::setError('token已过期');
|
||||
return false;
|
||||
} catch(\Exception $e) {
|
||||
self::setError('非法请求');
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 退出登录
|
||||
* @param $userInfo
|
||||
|
@ -76,7 +76,7 @@ class UserLogic extends BaseLogic
|
||||
public static function info(int $userId)
|
||||
{
|
||||
$user = User::where(['id' => $userId])->with(['company'])
|
||||
->field('id,sn,sex,is_new_user,account,nickname,real_name,avatar,mobile,create_time,user_money,deposit,income,admin_id,company_id,is_captain,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name')
|
||||
->field('id,sn,sex,is_new_user,account,nickname,real_name,avatar,mobile,create_time,user_money,deposit,income,admin_id,company_id,is_captain,province,province province_name,city,city city_name,area,area area_name,street,street street_name,village,village village_name,brigade,brigade brigade_name, group_id')
|
||||
->findOrEmpty();
|
||||
// $user['avatar'] = $user['avatar'] ? Request()->host() . $user['avatar'] : $user['avatar'];
|
||||
$user['day_money_count']=UserAccountLog::where(['user_id'=>$userId,'action'=>1])->whereDay('create_time')->sum('change_amount');
|
||||
|
@ -78,7 +78,7 @@ class UserTokenService
|
||||
public static function overtimeToken($token)
|
||||
{
|
||||
$time = time();
|
||||
$userSession = UserSession::where('token', '=', $token)->find();
|
||||
$userSession = UserSession::where('token', '=', $token)->findOrEmpty();
|
||||
if ($userSession->isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -8,12 +8,19 @@ use app\common\model\Company;
|
||||
use app\common\model\im\UserImMessage;
|
||||
use app\common\model\user\User;
|
||||
use GatewayClient\Gateway;
|
||||
use think\App;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class ImController extends BaseLikeAdminController
|
||||
{
|
||||
//获取场景值
|
||||
public function __construct(App $app)
|
||||
{
|
||||
parent::__construct($app);
|
||||
Gateway::$registerAddress = "172.19.97.179:1256";
|
||||
}
|
||||
|
||||
//获取场景值
|
||||
private function sceneText($scene): string
|
||||
{
|
||||
if($scene == 0){
|
||||
@ -380,7 +387,7 @@ class ImController extends BaseLikeAdminController
|
||||
return $this->fail('用户信息错误');
|
||||
}
|
||||
if($params['user_id'] == $companyInfo['area_manager']){
|
||||
return $this->fail('用户身份错误错误');
|
||||
return $this->fail('用户身份错误');
|
||||
}
|
||||
//获取用户信息
|
||||
$adminInfo = Admin::field('id,name,avatar')->where('id',$companyInfo['area_manager'])->findOrEmpty();
|
||||
|
@ -103,10 +103,10 @@ class CompanyLogic extends BaseLogic
|
||||
$admin['password'] = create_password(123456, $passwordSalt);
|
||||
|
||||
$admin_id=Admin::strict(false)->insertGetId($admin);
|
||||
//镇/街公司
|
||||
// 镇合伙人公司
|
||||
if($params['company_type']==16){
|
||||
AdminLogic::insertRole($admin_id, [3]);
|
||||
$admin['group_id']=4;
|
||||
$admin['group_id']=15;
|
||||
}elseif($params['company_type']==17){
|
||||
//村管理公司
|
||||
AdminLogic::insertRole($admin_id, [4]);
|
||||
@ -117,9 +117,9 @@ class CompanyLogic extends BaseLogic
|
||||
AdminLogic::insertRole($admin_id, [6]);
|
||||
$admin['group_id']=5;
|
||||
} elseif ($params['company_type']==41) {
|
||||
//镇农科公司 总负责人
|
||||
//镇农科公司
|
||||
AdminLogic::insertRole($admin_id, [7]); //后台角色
|
||||
$admin['group_id']=15; // 前台角色
|
||||
$admin['group_id']=4; // 前台角色
|
||||
}
|
||||
$userSn = User::createUserSn();
|
||||
$admin['admin_id']=$admin_id;
|
||||
@ -297,7 +297,7 @@ class CompanyLogic extends BaseLogic
|
||||
|
||||
if($params['company_type']==16){
|
||||
$adminRoleId = 3;
|
||||
$userGroupId = 4;
|
||||
$userGroupId = 15;
|
||||
} elseif ($params['company_type']==17){
|
||||
$adminRoleId = 4;
|
||||
$userGroupId = 3;
|
||||
@ -306,7 +306,7 @@ class CompanyLogic extends BaseLogic
|
||||
$userGroupId = 5;
|
||||
} elseif ($params['company_type']==41) {
|
||||
$adminRoleId = 7; //后台角色
|
||||
$userGroupId = 15; // 前台角色
|
||||
$userGroupId = 4; // 前台角色
|
||||
}
|
||||
|
||||
// 更新后台账户角色
|
||||
|
@ -67,6 +67,7 @@ class PayNotifyLogic extends BaseLogic
|
||||
$order = RechargeOrder::where('sn', $orderSn)->findOrEmpty();
|
||||
|
||||
if ($order && isset($order['extend']['type']) && $order['extend']['type'] == 1) {
|
||||
// ***** 小组服务团队-入股任务逻辑 已废弃 *****
|
||||
$find = Task::where('id', $order['extend']['task_id'])->find();
|
||||
$extend=$find['extend'];
|
||||
$extend['shareholder']['order_sn']=$order->sn;
|
||||
@ -81,8 +82,8 @@ class PayNotifyLogic extends BaseLogic
|
||||
'sn' => $order->sn,
|
||||
'user_id' => $order->user_id,
|
||||
'company_id' => $company['id']??0,
|
||||
'change_type' => 300,
|
||||
'change_object' => 2,
|
||||
'change_type' => CompanyAccountLog::COMPANY_DEPOSIT,
|
||||
'change_object' => CompanyAccountLog::DEPOSIT,
|
||||
'action' => 1,
|
||||
'change_amount' => $order->order_amount,
|
||||
'left_amount' =>$left_amount,
|
||||
|
21
app/common/logic/PayRequestLogic.php
Normal file
21
app/common/logic/PayRequestLogic.php
Normal file
@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\logic;
|
||||
|
||||
use Symfony\Component\HttpClient\HttpClient;
|
||||
|
||||
class PayRequestLogic extends BaseLogic
|
||||
{
|
||||
public static function getPrePayId($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('POST', env('url.pay_prefix'). '/api/wechat_pay_service_merchant_pay/appPrePay', [
|
||||
'body' => $param
|
||||
]);
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -7,23 +7,17 @@ use think\Exception;
|
||||
|
||||
class ShopRequestLogic extends BaseLogic
|
||||
{
|
||||
public static $shopUrlPrefix;
|
||||
public function __construct()
|
||||
{
|
||||
self::$shopUrlPrefix = env('url.shop_prefix');
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询时间范围内,某一农科公司下的 供应链商户入驻统计
|
||||
*/
|
||||
public static function getSupplyChainMerchantCount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_mer_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -36,10 +30,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getProductListing($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_product_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -52,10 +46,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getStockUpdate($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_product_stock_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -68,10 +62,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getProductList($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/product_list', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -84,10 +78,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getPurchaseAmount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_product_price_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -100,10 +94,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getTradeAmount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_product_price_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -116,10 +110,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getGeneralMerchantCount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_mer_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -132,10 +126,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getGeneralMerchantProductListing($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_product_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -148,10 +142,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getGeneralMerchantStockUpdate($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_product_stock_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -164,10 +158,10 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getGeneralMerchantPurchaseAmount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_street_product_price_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
@ -180,10 +174,58 @@ class ShopRequestLogic extends BaseLogic
|
||||
public static function getGeneralMerchantTradeAmount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', self::$shopUrlPrefix . '', [
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_street_product_price_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return $requestResponse->getContent();
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询村管理公司负责片区内的种养殖商户交易额
|
||||
*/
|
||||
public static function getPlantingAndBreedingMerchantTradeAmount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_village_breeding_price_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询镇农科公司负责片区内的种养殖商户和供应链商户交易额 todo 商城还需确认种养殖商户是何种类型
|
||||
*/
|
||||
public static function getTownTradeAmount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/supply_chain_breeding_street_product_count', [
|
||||
'query' => $param
|
||||
]);
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询手机号用户的交易金额
|
||||
*/
|
||||
public static function getUserTradeAmount($param)
|
||||
{
|
||||
try {
|
||||
$requestResponse = HttpClient::create()->request('GET', env('url.shop_prefix'). '/api/statistics/store_order_user_trade_amount', [
|
||||
'query' => $param
|
||||
]);
|
||||
return json_decode($requestResponse->getContent(), true);
|
||||
} catch (Exception $e) {
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
|
@ -23,30 +23,20 @@ class ApproveLogic extends BaseLogic
|
||||
}
|
||||
// 修改任务完成状态
|
||||
if ($params['check_status'] == 2) {
|
||||
self::pass($approve,$userInfo);
|
||||
self::pass($approve);
|
||||
}
|
||||
|
||||
// 回调商城,通知审核状态
|
||||
if (in_array($approve['type'], [2, 3])) {
|
||||
$shopMerchantInfo = json_decode($approve['extend'], true);
|
||||
self::shopCallBack($approve, $shopMerchantInfo, $params);
|
||||
self::shopCallBack($approve, $shopMerchantInfo, $params, $userInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private static function pass(Approve $approve, $userInfo)
|
||||
private static function pass(Approve $approve)
|
||||
{
|
||||
Db::startTrans();
|
||||
$approve->check_status = 2;
|
||||
$approve->save();
|
||||
// 记录商户入驻时间,镇农科公司市场部长任务会使用到
|
||||
$shopMerchantInfo = json_decode($approve['extend'], true);
|
||||
$data = [
|
||||
'town_company_id' => $userInfo['company_id'],
|
||||
'mer_intention_id' => $shopMerchantInfo['mer_intention_id'],
|
||||
'create_time' => time()
|
||||
];
|
||||
ShopMerchantSettleinLog::create($data);
|
||||
Db::commit();
|
||||
}
|
||||
|
||||
private static function refuse(Approve $approve, $params)
|
||||
@ -56,13 +46,25 @@ class ApproveLogic extends BaseLogic
|
||||
$approve->save();
|
||||
}
|
||||
|
||||
private static function shopCallBack(Approve $approve, $shopMerchantInfo, $params)
|
||||
private static function shopCallBack(Approve $approve, $shopMerchantInfo, $params, $userInfo)
|
||||
{
|
||||
$status = $params['check_status'] == 2? 1: 2;
|
||||
// 通过商户入驻审批, 记录商户入驻时间,镇农科公司市场部长任务会使用到
|
||||
if ($status == 1 && $approve['type'] == 2) {
|
||||
$shopMerchantInfo = json_decode($approve['extend'], true);
|
||||
$data = [
|
||||
'town_company_id' => $userInfo['company_id'],
|
||||
'mer_intention_id' => $shopMerchantInfo['mer_intention_id'],
|
||||
'create_time' => time()
|
||||
];
|
||||
ShopMerchantSettleinLog::create($data);
|
||||
}
|
||||
|
||||
// 通知商城审批状态
|
||||
$requestResponse = HttpClient::create()->request('POST', env('url.shop_prefix') . '/api/merchant/syncStatus/'.$shopMerchantInfo['mer_intention_id'], [
|
||||
'body' => ['status' => $status, 'type' => $approve['type'] ==2 ? 1: 2, 'remark'=> $params['remark']??'']
|
||||
]);
|
||||
|
||||
Log::info(['通知商城审批状态-参数', ['status' => $status, 'type' => $approve['type']]]);
|
||||
Log::info(['通知商城审批状态-响应', [$requestResponse->getContent()]]);
|
||||
}
|
||||
|
@ -52,15 +52,15 @@ class ShareProfit
|
||||
//公司
|
||||
if ($data['company_account_type'] == 1) {
|
||||
$deposit_count = bcadd($company['deposit'], $master_maoney, 2);
|
||||
$this->AccountLog($data['company_id'], $deposit_count, $master_maoney);
|
||||
$this->AccountLog($data['company_id'], $deposit_count, $master_maoney,1,1,1, $data['msg']);
|
||||
|
||||
$company_money_count = bcadd($company['company_money'], $master_maoney, 2);
|
||||
$this->AccountLog($data['company_id'], $company_money_count, $master_maoney);
|
||||
$this->AccountLog($data['company_id'], $company_money_count, $master_maoney, 1, 1,1, $data['msg']);
|
||||
|
||||
Company::where('id', $data['company_id'])->update(['deposit' => Db::raw('deposit+' . $master_maoney), 'company_money' => Db::raw('company_money+' . $master_maoney)]);
|
||||
} elseif ($data['company_account_type'] == 2) {
|
||||
$company_money_count = bcadd($company['shareholder_money'], $data['money'], 2);
|
||||
$this->AccountLog($data['company_id'], $company_money_count, $data['money'], 1, 2);
|
||||
$this->AccountLog($data['company_id'], $company_money_count, $data['money'], 1, 2, 1, $data['msg']);
|
||||
Company::where('id', $data['company_id'])->update([
|
||||
'deposit' => Db::raw('deposit+' . $master_maoney),
|
||||
'company_money' => Db::raw('company_money+' . $master_maoney),
|
||||
@ -81,7 +81,7 @@ class ShareProfit
|
||||
$money = bcdiv($datas['template_info']['over_decimal'], count($responsible_area), 2);
|
||||
$left_amount = 0;
|
||||
foreach ($responsible_area as $kkk => $vvv) {
|
||||
$left_amount += bcadd(1000, $money, 2);
|
||||
$left_amount += bcadd($company['shareholder_money'], $money, 2);
|
||||
$company_log = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $datas['company_id'],
|
||||
@ -105,7 +105,7 @@ class ShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function AccountLog($companyId, $left_amount, $changeAmount, $change_object = 1, $change_type = 1, $action = 1)
|
||||
public function AccountLog($companyId, $left_amount, $changeAmount, $change_object = 1, $change_type = 1, $action = 1, $remark='')
|
||||
{
|
||||
$company_log = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
@ -115,6 +115,7 @@ class ShareProfit
|
||||
'action' => $action, //1-增加 2-减少
|
||||
'left_amount' => $left_amount, //变动后数量
|
||||
'change_amount' => $changeAmount, //变动数量
|
||||
'remark' => $remark, //变动数量
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log);
|
||||
|
@ -24,7 +24,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -45,7 +45,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
}
|
||||
|
||||
Db::commit();
|
||||
@ -65,7 +65,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -82,7 +82,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -100,7 +100,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
// 更新镇交易池
|
||||
(new TaskTemplate())->updateTransactionPool($taskSchedulePlan['template_info']['id'], $leftTransactionPool);
|
||||
Db::commit();
|
||||
@ -120,7 +120,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -137,7 +137,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -157,18 +157,19 @@ class TownShareProfit
|
||||
|
||||
$remark = '来自任务【' . $taskSchedulePlan['template_info']['title'] . '】,';
|
||||
|
||||
//负责人收益 todo
|
||||
//负责人收益
|
||||
if ($taskSchedulePlan['template_info']['extend']['task_role'] == 1) {
|
||||
|
||||
$serviceManagerUser = (new User())->searchMaster($company['id']);
|
||||
Log::info([$taskSchedulePlan['template_info']['title'].'结算-市场部长用户信息', $serviceManagerUser]);
|
||||
}
|
||||
//市场部长收益
|
||||
if ($taskSchedulePlan['template_info']['extend']['task_role'] == 2) {
|
||||
$serviceManagerUser = User::where(['company_id' => $company['id'], 'group_id' => 16])->find();
|
||||
$serviceManagerUser = (new User())->searchMarketingManager($company['id']);;
|
||||
Log::info([$taskSchedulePlan['template_info']['title'].'结算-市场部长用户信息', $serviceManagerUser]);
|
||||
}
|
||||
//服务部长收益 任务金额的50%为服务部长的收益
|
||||
if ($taskSchedulePlan['template_info']['extend']['task_role'] == 3) {
|
||||
$serviceManagerUser = User::where(['company_id' => $company['id'], 'group_id' => 14])->find();
|
||||
$serviceManagerUser = (new User())->searchServiceManager($company['id']);;
|
||||
Log::info([$taskSchedulePlan['template_info']['title'].'结算-服务部长用户信息', $serviceManagerUser]);
|
||||
}
|
||||
|
||||
@ -183,7 +184,7 @@ class TownShareProfit
|
||||
// 公司收益
|
||||
$deposit_count = bcadd($company['deposit'], $masterMoney, 2);
|
||||
// 公司收益变动记录
|
||||
$this->AccountLog($company['id'], $deposit_count, $masterMoney, 1, CompanyAccountLog::TASK_INC_DEPOSIT);
|
||||
$this->AccountLog($company['id'], $deposit_count, $masterMoney, 1, CompanyAccountLog::TASK_INC_INCOME);
|
||||
$company_money_count = bcadd($company['company_money'], $masterMoney, 2);
|
||||
//公司余额变动记录
|
||||
$this->AccountLog($company['id'], $company_money_count, $masterMoney, 1, CompanyAccountLog::TASK_INC_COMPANY_MONEY);
|
||||
@ -239,7 +240,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -249,7 +250,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector2(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector2(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -257,7 +258,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -267,7 +268,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector3(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector3(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -275,7 +276,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -285,7 +286,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector4(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector4(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -293,7 +294,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -303,7 +304,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector5(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector5(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -311,7 +312,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -321,7 +322,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector6(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector6(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -329,7 +330,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -339,7 +340,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector7(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector7(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -347,7 +348,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -357,7 +358,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector8(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector8(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -365,7 +366,7 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
@ -375,7 +376,7 @@ class TownShareProfit
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector9(Task $taskInfo, Company $townCompany, TaskSchedulingPlan $taskSchedulePlan)
|
||||
public function dealTaskSettlementMarketingDirector9(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
@ -383,7 +384,155 @@ class TownShareProfit
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3]);
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMarketingDirector10(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMaster2(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMaster3(Task $taskInfo, Company $townCompany, $taskSchedulePlan, $leftTransactionPool)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
// 更新交易池
|
||||
(new TaskTemplate())->updateTransactionPool($taskSchedulePlan['template_info']['id'], $leftTransactionPool);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMaster4(Task $taskInfo, Company $townCompany, $taskSchedulePlan, $leftTransactionPool)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
// 更新交易池
|
||||
(new TaskTemplate())->updateTransactionPool($taskSchedulePlan['template_info']['id'], $leftTransactionPool);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMaster5(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMaster6(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMaster7(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealTaskSettlementMaster8(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
|
234
app/common/logic/finance/VillageShareProfit.php
Normal file
234
app/common/logic/finance/VillageShareProfit.php
Normal file
@ -0,0 +1,234 @@
|
||||
<?php
|
||||
|
||||
namespace app\common\logic\finance;
|
||||
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\logic\AccountLogLogic;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
|
||||
class VillageShareProfit
|
||||
{
|
||||
/**
|
||||
* 分润
|
||||
*/
|
||||
public function shareProfit($taskInfo, $company, $taskSchedulePlan)
|
||||
{
|
||||
$proportion = 0;
|
||||
//总金额除以2等于不可提现账号金额和收益
|
||||
$masterMoney = bcdiv($taskInfo['money'], 2, 2);
|
||||
|
||||
$remark = '来自任务【' . $taskSchedulePlan['template_info']['title'] . '】,';
|
||||
$liaisonMan = (new User())->searchLiaisonMan($company['id']);
|
||||
Log::info([$taskSchedulePlan['template_info']['title'].'结算-村联络员用户信息', $liaisonMan]);
|
||||
|
||||
// 用户收益变动
|
||||
$arr = [$liaisonMan['id'], AccountLogEnum::UM_INC_TASK, AccountLogEnum::INC, $masterMoney, $taskSchedulePlan['sn'], $remark.'任务结算获得收益' . $masterMoney . '元', ['company_id' => $company['id'], 'proportion' => $proportion], 1];
|
||||
$this->master($arr);
|
||||
// 用户余额变动
|
||||
$arr_two = [$liaisonMan['id'], AccountLogEnum::UM_INC_TASKUSER, AccountLogEnum::INC, $masterMoney, $taskSchedulePlan['sn'], $remark . '获得账户余额' . $masterMoney . '元', ['company_id' => $company['id'], 'proportion' => $proportion], 1];
|
||||
$this->Account($arr_two);
|
||||
|
||||
// 公司收益
|
||||
$deposit_count = bcadd($company['deposit'], $masterMoney, 2);
|
||||
// 公司收益变动记录
|
||||
$this->AccountLog($company['id'], $deposit_count, $masterMoney, 1, CompanyAccountLog::TASK_INC_INCOME);
|
||||
$company_money_count = bcadd($company['company_money'], $masterMoney, 2);
|
||||
//公司余额变动记录
|
||||
$this->AccountLog($company['id'], $company_money_count, $masterMoney, 1, CompanyAccountLog::TASK_INC_COMPANY_MONEY);
|
||||
// 变更公司收益和余额
|
||||
Company::where('id', $company['id'])->update(['deposit' => Db::raw('deposit+' . $masterMoney), 'company_money' => Db::raw('company_money+' . $masterMoney)]);
|
||||
}
|
||||
public function AccountLog($companyId, $left_amount, $changeAmount, $change_object = 1, $change_type = 1, $action = 1)
|
||||
{
|
||||
$company_log = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $companyId,
|
||||
'change_object' => $change_object, //变动对象
|
||||
'change_type' => $change_type, //变动类型
|
||||
'action' => $action, //1-增加 2-减少
|
||||
'left_amount' => $left_amount, //变动后数量
|
||||
'change_amount' => $changeAmount, //变动数量
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($company_log);
|
||||
}
|
||||
/**负责人的分润
|
||||
* @param $data
|
||||
*/
|
||||
private function master($data)
|
||||
{
|
||||
User::where('id', $data[0])->update(['deposit'=>Db::raw('deposit+' . $data[3]),'user_money'=>Db::raw('user_money+' . $data[3])]);
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
|
||||
/**成员分润
|
||||
* @param $data
|
||||
*/
|
||||
private function member($data)
|
||||
{
|
||||
User::where('id', $data[0])->update(['deposit'=>Db::raw('deposit+' . $data[3]),'user_money'=>Db::raw('user_money+' . $data[3])]);
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
|
||||
private function Account($data)
|
||||
{
|
||||
return AccountLogLogic::add($data[0], $data[1], $data[2], $data[3], $data[4], $data[5], $data[6], $data[7]);
|
||||
}
|
||||
|
||||
public function dealVillageTaskSettlement1(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealVillageTaskSettlement2($taskInfo, $townCompany, $taskSchedulePlan, $leftTransactionPool)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
// 更新镇交易池
|
||||
(new TaskTemplate())->updateTransactionPool($taskSchedulePlan['template_info']['id'], $leftTransactionPool);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealVillageTaskSettlement3($taskInfo, $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealVillageTaskSettlement4(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealVillageTaskSettlement5(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealVillageTaskSettlement6(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealVillageTaskSettlement7(Task $taskInfo, Company $townCompany, $taskSchedulePlan, $leftTransactionPool)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
// 更新交易池
|
||||
(new TaskTemplate())->updateTransactionPool($taskSchedulePlan['template_info']['id'], $leftTransactionPool);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function dealVillageTaskSettlement8(Task $taskInfo, Company $townCompany, $taskSchedulePlan)
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
$this->shareProfit($taskInfo, $townCompany, $taskSchedulePlan);
|
||||
// 更改结算状态
|
||||
(new TaskSchedulingPlan())->settlement($taskSchedulePlan['id']);
|
||||
// 更改任务状态
|
||||
Task::where(['id' => $taskSchedulePlan['task_id']])->update(['status' => 3,'money' => $taskInfo['money']]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
Log::error($taskSchedulePlan['template_info']['title'].'-任务结算失败:' . $e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -44,7 +44,7 @@ class WithdrawLogic extends BaseLogic
|
||||
|
||||
// 拒绝通过审核,记录备注原因
|
||||
if ($params['status'] == 2) {
|
||||
Withdraw::where(['id'=>$withDrawInfo['id']])->update(['status'=>2, 'deny_desc'=>$params['deny_desc']]);
|
||||
Withdraw::where(['id'=>$withDrawInfo['id']])->update(['status'=>2, 'deny_desc'=>$params['deny_desc'] ?? '']);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ class WithdrawLogic extends BaseLogic
|
||||
$companyAccountLog = [
|
||||
'sn' => generate_sn(UserAccountLog::class, 'sn', 20),
|
||||
'company_id' => $companyInfo['id'],
|
||||
'change_object' => CompanyAccountLog::TASK, //变动对象
|
||||
'change_object' => CompanyAccountLog::COMPANY_MONEY, //变动对象
|
||||
'change_type' => CompanyAccountLog::WITHDRAW_DEC_DEPOSIT, //变动类型
|
||||
'action' => CompanyAccountLog::DEC, //1-增加 2-减少
|
||||
'left_amount' => $leftMoney, //变动后数量
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@ use app\common\model\company\CompanyProperty;
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\vehicle\VehicleRent;
|
||||
use think\facade\Db;
|
||||
|
||||
|
||||
@ -47,19 +48,23 @@ class TaskTemplateLogic extends BaseLogic
|
||||
try {
|
||||
Db::startTrans();
|
||||
|
||||
$find=TaskTemplate::where('task_scheduling', $params['task_scheduling'])->where('company_id',$params['company_id'])->where('type',$params['type'])->field('id,types,type')->find();
|
||||
if($find&&$params['type']==$find['type']){
|
||||
self::setError('已经有同一种任务类型了');
|
||||
return false;
|
||||
}
|
||||
if($params['type']==33){
|
||||
$count=UserInformationg::where('company_id',$params['company_id'])->where('status',1)->count();
|
||||
if($count<300){
|
||||
self::setError('用户档案数量300不足,无法创建任务模板');
|
||||
// 其他任务可重复创建
|
||||
if ($params['type'] != 34) {
|
||||
$find=TaskTemplate::where('task_scheduling', $params['task_scheduling'])->where('company_id',$params['company_id'])->where('type',$params['type'])->field('id,types,type')->find();
|
||||
if($find&&$params['type']==$find['type']){
|
||||
self::setError('已经有同一种任务类型了');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// if($params['type']==33){
|
||||
// $count=UserInformationg::where('company_id',$params['company_id'])->where('status',1)->count();
|
||||
// if($count<300){
|
||||
// self::setError('用户档案数量300不足,无法创建任务模板');
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
|
||||
$moeny=TaskTemplate::where('company_id', $params['company_id'])->sum('money');
|
||||
if($moeny+$params['money']>200){
|
||||
self::setError('任务模板一阶段合计金额不能大于任务调度金额');
|
||||
@ -76,8 +81,8 @@ class TaskTemplateLogic extends BaseLogic
|
||||
return false;
|
||||
}
|
||||
if($params['type']==32){
|
||||
$object_id=CompanyProperty::where('company_id',$params['company_id'])->value('object_id');
|
||||
if(!$object_id){
|
||||
$VehicleRent = VehicleRent::where('rent_company_id',$params['company_id'])->find();
|
||||
if(empty($VehicleRent)){
|
||||
self::setError('该公司没有三轮车,请先租赁三轮车');
|
||||
return false;
|
||||
}
|
||||
@ -108,6 +113,7 @@ class TaskTemplateLogic extends BaseLogic
|
||||
'stage_day_two' => $params['stage_day_two']??0,
|
||||
'proportion_two' => $params['proportion_two']??0,
|
||||
'recharge' => $params['recharge']??0,
|
||||
// 'cron_time' => strtotime($params['cron_time']), // 定时下发日期
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
@ -130,36 +136,43 @@ class TaskTemplateLogic extends BaseLogic
|
||||
{
|
||||
Db::startTrans();
|
||||
try {
|
||||
$find=TaskTemplate::where('task_scheduling', $params['task_scheduling'])->where('company_id',$params['company_id'])->where('type',$params['type'])->field('id,types,type,money,money_two,money_three')->find();
|
||||
$company = Company::find($params['company_id']);
|
||||
if ($company->company_type == 16) {
|
||||
// 创建 镇合伙人公司 任务模板
|
||||
$taskScheduleAmount = 700;
|
||||
} else {
|
||||
$taskScheduleAmount = 200;
|
||||
}
|
||||
$find=TaskTemplate::where('task_scheduling', $params['task_scheduling'])->where('company_id',$params['company_id'])->where('type',$params['type'])->field('id,types,type,money,money_two,money_three,extend')->find();
|
||||
if($find && $find['id']!=$params['id']&&$params['type']==$find['type']){
|
||||
self::setError('已经有同一种任务类型了');
|
||||
return false;
|
||||
}
|
||||
if($params['type']==33){
|
||||
$count=UserInformationg::where('company_id',$params['company_id'])->where('status',1)->count();
|
||||
if($count<300){
|
||||
self::setError('用户档案数量300不足,无法创建任务模板');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// if($params['type']==33){
|
||||
// $count=UserInformationg::where('company_id',$params['company_id'])->where('status',1)->count();
|
||||
// if($count<300){
|
||||
// self::setError('用户档案数量300不足,无法创建任务模板');
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
$moeny=TaskTemplate::where('company_id', $params['company_id'])->sum('money');
|
||||
if($moeny+$params['money']-$find['money']>200){
|
||||
if($moeny+$params['money']-$find['money']>$taskScheduleAmount){
|
||||
self::setError('任务模板一阶段合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
$money_two=TaskTemplate::where('company_id', $params['company_id'])->sum('money_two');
|
||||
if($money_two+$params['money_two']-$find['money_two']>200){
|
||||
if($money_two+$params['money_two']-$find['money_two']>$taskScheduleAmount){
|
||||
self::setError('任务模板二阶段合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
$money_three=TaskTemplate::where('company_id', $params['company_id'])->sum('money_three');
|
||||
if($money_three+$params['money_three']-$find['money_three']>200){
|
||||
if($money_three+$params['money_three']-$find['money_three']>$taskScheduleAmount){
|
||||
self::setError('任务模板长期合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
if($params['type']==32){
|
||||
$object_id=CompanyProperty::where('company_id',$params['company_id'])->value('object_id');
|
||||
if(!$object_id){
|
||||
$VehicleRent = VehicleRent::where('rent_company_id',$params['company_id'])->find();
|
||||
if(empty($VehicleRent)){
|
||||
self::setError('该公司没有三轮车,请先租赁三轮车');
|
||||
return false;
|
||||
}
|
||||
@ -181,7 +194,7 @@ class TaskTemplateLogic extends BaseLogic
|
||||
'types' => $params['types'],
|
||||
'status' => $params['status'],
|
||||
'content' => $params['content'],
|
||||
'extend'=>json_encode($params['extend']),
|
||||
'extend'=>json_encode(array_merge($find['extend'],$params['extend'])),
|
||||
'stage_day_one' => $params['stage_day_one']??0,
|
||||
'proportion_one' => $params['proportion_one']??0,
|
||||
'stage_day_two' => $params['stage_day_two']??0,
|
||||
@ -252,6 +265,14 @@ class TaskTemplateLogic extends BaseLogic
|
||||
Db::startTrans();
|
||||
|
||||
// $params['extend']['task_role'] 扩展字段 任务角色 1总负责人 2市场部长 3服务部长
|
||||
$taskScheduleAmount = 700;
|
||||
if ($params['extend']['task_role'] == 1) {
|
||||
$serviceManagerUser = (new User())->searchMaster($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
self::setError('公司还没有负责人,无法指派任务');
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if ($params['extend']['task_role'] == 2) {
|
||||
$serviceManagerUser = (new User())->searchMarketingManager($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
@ -269,6 +290,82 @@ class TaskTemplateLogic extends BaseLogic
|
||||
}
|
||||
|
||||
|
||||
$find = TaskTemplate::where('task_scheduling', $params['task_scheduling'])->where('company_id',$params['company_id'])->where('type',$params['type'])->field('id,types,type')->find();
|
||||
if($find && $params['type'] == $find['type']){
|
||||
self::setError('已经有同一种任务类型了');
|
||||
return false;
|
||||
}
|
||||
|
||||
$moeny = TaskTemplate::where('company_id', $params['company_id'])->sum('money');
|
||||
if($moeny + $params['money'] > $taskScheduleAmount){
|
||||
self::setError('任务模板一阶段合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
$moneyTwo = TaskTemplate::where('company_id', $params['company_id'])->sum('money_two');
|
||||
if($moneyTwo + $params['money_two'] > $taskScheduleAmount){
|
||||
self::setError('任务模板二阶段合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
$newMoneyThree = TaskTemplate::where('company_id', $params['company_id'])->sum('new_money_three');
|
||||
if($newMoneyThree + $params['new_money_three'] > $taskScheduleAmount){
|
||||
self::setError('任务模板三阶段合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
$moneyThree = TaskTemplate::where('company_id', $params['company_id'])->sum('money_three');
|
||||
if($moneyThree + $params['money_three']>$taskScheduleAmount){
|
||||
self::setError('任务模板长期合计金额不能大于任务调度金额');
|
||||
return false;
|
||||
}
|
||||
|
||||
TaskTemplate::create([
|
||||
'title' => $params['title'],
|
||||
'admin_id' => $params['admin_id'],
|
||||
'company_id' => $params['company_id'],
|
||||
'task_scheduling' => $params['task_scheduling']??0,
|
||||
'money' => $params['money'],
|
||||
'money_two' => $params['money_two'],
|
||||
'money_three' => $params['money_three'],
|
||||
'type' => $params['type'],
|
||||
'types' => $params['types'],
|
||||
'status' => $params['status'],
|
||||
'content' => $params['content'],
|
||||
'extend'=>json_encode($params['extend']),
|
||||
'stage_day_one' => $params['stage_day_one']??0,
|
||||
'proportion_one' => $params['proportion_one']??0,
|
||||
'stage_day_two' => $params['stage_day_two']??0,
|
||||
'proportion_two' => $params['proportion_two']??0,
|
||||
'recharge' => $params['recharge']??0,
|
||||
'stage_day_three' => $params['stage_day_three']??0,
|
||||
'new_money_three' => $params['new_money_three']??0,
|
||||
// 'cron_time' => strtotime($params['cron_time']), // 定时下发日期
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
self::setError($e->getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* @notes 添加任务模板
|
||||
* @param array $params
|
||||
* @return bool
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public static function addVillageTaskTemplate(array $params): bool
|
||||
{
|
||||
try {
|
||||
Db::startTrans();
|
||||
|
||||
|
||||
$serviceManagerUser = (new User())->searchLiaisonMan($params['company_id']);
|
||||
if (empty($serviceManagerUser)) {
|
||||
self::setError('公司还没有村联络员,无法指派任务');
|
||||
return false;
|
||||
}
|
||||
|
||||
$find = TaskTemplate::where('task_scheduling', $params['task_scheduling'])->where('company_id',$params['company_id'])->where('type',$params['type'])->field('id,types,type')->find();
|
||||
if($find && $params['type'] == $find['type']){
|
||||
self::setError('已经有同一种任务类型了');
|
||||
@ -316,6 +413,7 @@ class TaskTemplateLogic extends BaseLogic
|
||||
'recharge' => $params['recharge']??0,
|
||||
'stage_day_three' => $params['stage_day_three']??0,
|
||||
'new_money_three' => $params['new_money_three']??0,
|
||||
// 'cron_time' => strtotime($params['cron_time']), // 定时下发日期
|
||||
]);
|
||||
Db::commit();
|
||||
return true;
|
||||
|
@ -11,6 +11,23 @@ class Approve extends BaseModel
|
||||
use SoftDelete;
|
||||
protected $name = 'approve';
|
||||
protected $deleteTime = 'delete_time';
|
||||
const APPROVE_TYPE_1 = 1; // 其他任务
|
||||
const APPROVE_TYPE_2 = 2; // 商户入驻
|
||||
const APPROVE_TYPE_3 = 3; // 开通交易
|
||||
const APPROVE_TYPE_4 = 4; // 镇农科市场部长数字农贸宣传业务、加工业务的建设和招商任务
|
||||
|
||||
const APPROVE_TYPE_5 = 5; // 村联络员任务-信息平台铺设工作任务
|
||||
const APPROVE_TYPE_6 = 6; // 村联络员任务-日常管理及其他临时任务
|
||||
|
||||
const APPROVE_TYPE_7 = 7; // 镇农科负责人任务-应用软件推广
|
||||
|
||||
const APPROVE_TYPE_8 = 8; // 镇农科负责人任务-政策补贴申请
|
||||
const APPROVE_TYPE_9 = 9; // 镇农科负责人任务-日常管理及其他临时任务
|
||||
const APPROVE_TYPE_10 = 10; // 小组团队任务-入股任务
|
||||
const APPROVE_TYPE_11 = 11; // 村联络员任务-督促小组服务团队入股
|
||||
const APPROVE_TYPE_12 = 12; // 村联络员任务-入股甲方公司
|
||||
const APPROVE_TYPE_13 = 13; // 镇农科服务部长任务-督促入股村管理公司
|
||||
const APPROVE_TYPE_14 = 14; // 镇农科负责人任务-促成村联络员入股甲方
|
||||
|
||||
public function task()
|
||||
{
|
||||
|
@ -4,5 +4,5 @@ namespace app\common\model;
|
||||
|
||||
class ShopMerchantSettleinLog extends BaseModel
|
||||
{
|
||||
protected $name = 'shop_merchant_settle_log';
|
||||
protected $name = 'shop_merchant_settlein_log';
|
||||
}
|
@ -41,9 +41,18 @@ class CompanyAccountLog extends BaseModel
|
||||
*/
|
||||
const TASK = 1;
|
||||
/**
|
||||
* 股金
|
||||
* 公司股金
|
||||
*/
|
||||
const SHAREHOLDER = 2;
|
||||
/**
|
||||
* 公司余额
|
||||
*/
|
||||
const COMPANY_MONEY = 3;
|
||||
|
||||
/**
|
||||
* 公司押金
|
||||
*/
|
||||
const DEPOSIT = 4;
|
||||
|
||||
/**
|
||||
* 动作
|
||||
@ -72,13 +81,13 @@ class CompanyAccountLog extends BaseModel
|
||||
const WITHDRAW_DEC_DEPOSIT = 102;
|
||||
|
||||
/**
|
||||
* 用户余额增加类型
|
||||
* 公司金额变动类型
|
||||
*/
|
||||
|
||||
/**
|
||||
* 任务收益
|
||||
*/
|
||||
const TASK_INC_DEPOSIT = 200;
|
||||
const TASK_INC_INCOME = 200;
|
||||
/**
|
||||
* 公司余额
|
||||
*/
|
||||
@ -88,4 +97,9 @@ class CompanyAccountLog extends BaseModel
|
||||
*/
|
||||
const TASK_INC_SHAREHOLDER_MONEY = 202;
|
||||
|
||||
/**
|
||||
* 押金
|
||||
*/
|
||||
const COMPANY_DEPOSIT = 300;
|
||||
|
||||
}
|
34
app/common/model/create_task_template/CreateTaskTemplate.php
Normal file
34
app/common/model/create_task_template/CreateTaskTemplate.php
Normal file
@ -0,0 +1,34 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
namespace app\common\model\create_task_template;
|
||||
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use think\model\concern\SoftDelete;
|
||||
|
||||
|
||||
/**
|
||||
* CreateTaskTemplate模型
|
||||
* Class CreateTaskTemplate
|
||||
* @package app\common\model\create_task_template
|
||||
*/
|
||||
class CreateTaskTemplate extends BaseModel
|
||||
{
|
||||
use SoftDelete;
|
||||
protected $name = 'create_task_template';
|
||||
protected $deleteTime = 'delete_time';
|
||||
|
||||
|
||||
}
|
@ -17,6 +17,7 @@ namespace app\common\model\task_scheduling_plan;
|
||||
|
||||
use app\common\model\BaseModel;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\user\User;
|
||||
@ -46,6 +47,10 @@ class TaskSchedulingPlan extends BaseModel
|
||||
{
|
||||
return $this->hasOne(TaskTemplate::class, 'id', 'template_id')->bind(['template_name'=>'title']);
|
||||
}
|
||||
public function task()
|
||||
{
|
||||
return $this->hasOne(Task::class, 'id', 'task_id');
|
||||
}
|
||||
public function templateInfo()
|
||||
{
|
||||
return $this->hasOne(TaskTemplate::class, 'id', 'template_id');
|
||||
|
@ -221,12 +221,27 @@ class User extends BaseModel
|
||||
}
|
||||
}
|
||||
|
||||
// 查询镇合伙人服务部长
|
||||
public function searchServiceManager($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 14])->find();
|
||||
}
|
||||
|
||||
// 查询镇合伙人负责人
|
||||
public function searchMaster($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 15])->find();
|
||||
}
|
||||
|
||||
// 查询镇合伙人市场部长
|
||||
public function searchMarketingManager($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 16])->find();
|
||||
}
|
||||
|
||||
// 查询村联络员
|
||||
public function searchLiaisonMan($companyId)
|
||||
{
|
||||
return User::where(['company_id' => $companyId, 'group_id'=> 17])->find();
|
||||
}
|
||||
}
|
@ -376,6 +376,7 @@ class WeChatPayService extends BasePayService
|
||||
switch ($attach) {
|
||||
case 'recharge':
|
||||
$order = RechargeOrder::where(['sn' => $message['out_trade_no']])->findOrEmpty();
|
||||
Log::info('wechat pay notify: ' . var_export($order, true));
|
||||
if($order->isEmpty() || $order->pay_status == PayEnum::ISPAID) {
|
||||
return true;
|
||||
}
|
||||
|
@ -1,7 +1,8 @@
|
||||
<?php
|
||||
namespace workerim;
|
||||
namespace app\common\service\workerim;
|
||||
|
||||
use GatewayClient\Gateway;
|
||||
|
||||
/**
|
||||
* 主逻辑
|
||||
* 主要是处理 onConnect onMessage onClose 三个方法
|
30
app/common/service/workerim/start_businessworker.php
Normal file
30
app/common/service/workerim/start_businessworker.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
use GatewayWorker\BusinessWorker;
|
||||
use Workerman\Worker;
|
||||
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../../../vendor/autoload.php';
|
||||
|
||||
// bussinessWorker 进程
|
||||
$worker = new BusinessWorker();
|
||||
|
||||
// worker名称
|
||||
$worker->name = 'PushBusinessWorker';
|
||||
|
||||
// bussinessWorker进程数量
|
||||
$worker->count = 4;
|
||||
|
||||
// 服务注册地址
|
||||
$worker->registerAddress = '172.19.97.179:1256';
|
||||
|
||||
// 注册服务类
|
||||
$worker->eventHandler = 'app\common\service\workerim\Events';
|
||||
|
||||
// 如果不是在根目录启动,则运行runAll方法
|
||||
if(!defined('GLOBAL_START'))
|
||||
{
|
||||
Worker::runAll();
|
||||
}
|
||||
|
39
app/common/service/workerim/start_gateway.php
Normal file
39
app/common/service/workerim/start_gateway.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
use \Workerman\Worker;
|
||||
use \GatewayWorker\Gateway;
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../../../vendor/autoload.php';
|
||||
|
||||
// gateway 进程,这里使用Text协议,可以用telnet测试
|
||||
$gateway = new Gateway("Websocket://0.0.0.0:8282");
|
||||
|
||||
// gateway名称,status方便查看
|
||||
$gateway->name = 'worker_task_im';
|
||||
|
||||
// gateway进程数,一般设置2个就足够
|
||||
$gateway->count = 4;
|
||||
|
||||
// 本机ip,分布式部署时使用内网ip
|
||||
$gateway->lanIp = '172.19.97.179';
|
||||
|
||||
// 内部通讯起始端口,假如$gateway->count=2,起始端口为2900
|
||||
// 则一般会使用3900 3901 3902 3903 4个端口作为内部通讯端口
|
||||
$gateway->startPort = 3900;
|
||||
|
||||
// 服务注册地址
|
||||
$gateway->registerAddress = '172.19.97.179:1256';
|
||||
|
||||
// 心跳间隔
|
||||
$gateway->pingInterval = 20;
|
||||
|
||||
// 心跳数据
|
||||
$gateway->pingData = '{"type":"ping"}';
|
||||
|
||||
// 如果不是在根目录启动,则运行runAll方法
|
||||
if(!defined('GLOBAL_START'))
|
||||
{
|
||||
Worker::runAll();
|
||||
}
|
||||
|
16
app/common/service/workerim/start_register.php
Normal file
16
app/common/service/workerim/start_register.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
use \Workerman\Worker;
|
||||
use \GatewayWorker\Register;
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../../../vendor/autoload.php';
|
||||
|
||||
// register 必须是text协议,切记不能将register端口开放给外网
|
||||
$register = new Register('text://172.19.97.179:1256');
|
||||
|
||||
// 如果不是在根目录启动,则运行runAll方法
|
||||
if(!defined('GLOBAL_START'))
|
||||
{
|
||||
Worker::runAll();
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ class AiAianalyse
|
||||
foreach($data_field as $k=>$v) {
|
||||
$demand .= $k . ':' . $v . ';';
|
||||
}
|
||||
$question = "分析以下{$type_name}信息【{$demand}】请问有那些商机?需要购买哪些商品?";
|
||||
$question = "根据以下{$type_name}信息【{$demand}】请问有那些商机?需要购买哪些商品?";
|
||||
try {
|
||||
$chat=new ChatClient($this->app_id,$this->api_key,$this->api_secret);
|
||||
$client = new Client($chat->assembleAuthUrl('wss://spark-api.xf-yun.com/v2.1/chat'));
|
||||
|
@ -28,6 +28,7 @@ class TaskInformationJob
|
||||
$company = Company::where('id', $data['company_id'])->field('id,deposit,responsible_area,company_money,shareholder_money,user_id,day_count,company_type,province,city,area,street,village,brigade')->find(); // 可能要判断预存金是否满足
|
||||
$arr['status'] = 0;
|
||||
$arr['company_account_type'] = 1;
|
||||
$name = '';
|
||||
//信息更新
|
||||
if ($data['template_info']['type'] == 31) {
|
||||
if ($data['template_info']['information_count'] < $data['template_info']['information_day_count']) {
|
||||
@ -87,12 +88,16 @@ class TaskInformationJob
|
||||
$task_35 = Task::where('id', $data['task_id'])->field('director_uid,status,money,start_time,end_time')->with('director_info')->find();
|
||||
if($task_35){
|
||||
$day= $data['template_info']['stage_day_one'] + $data['template_info']['stage_day_two'];
|
||||
if($task_35['status']==3 && $data['template_info']['day_count']<=$day){
|
||||
$name = $task_35['director_info']['nickname'];
|
||||
$arr['status'] = 1;
|
||||
$arr['money'] = $task_35['money'];
|
||||
$arr['company_account_type'] = 2;
|
||||
}else{
|
||||
$name = $task_35['director_info']['nickname'];
|
||||
// if($task_35['status']==3 && $data['template_info']['day_count']<=$day){
|
||||
// $name = $task_35['director_info']['nickname'];
|
||||
// $arr['status'] = 1;
|
||||
// $arr['money'] = $task_35['money'];
|
||||
// $arr['company_account_type'] = 2;
|
||||
// }else{
|
||||
if ($task_35['status'] == 3) {
|
||||
return true;
|
||||
}
|
||||
/**
|
||||
* 判断入股任务 单次类型 是否超时
|
||||
* 未超时时刷新开始结束时间
|
||||
@ -114,7 +119,7 @@ class TaskInformationJob
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}else{
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为空:' . json_encode($data));
|
||||
return false;
|
||||
@ -133,7 +138,7 @@ class TaskInformationJob
|
||||
|
||||
if($data['template_info']['day_count'] >= $day){
|
||||
Task::where('id', $data['task_id'])->update(['status' =>5]);
|
||||
Log::info('入股任务 ' . $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
Log::info( $data['template_info']['title'] . '结算失败,任务为超时:' . json_encode($data));
|
||||
return false;
|
||||
}
|
||||
|
||||
|
23
app/job/VillageTaskAdd.php
Normal file
23
app/job/VillageTaskAdd.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace app\job;
|
||||
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use think\queue\Job;
|
||||
|
||||
/**
|
||||
* 镇农科公司任务下发执行的具体逻辑
|
||||
*/
|
||||
class VillageTaskAdd
|
||||
{
|
||||
|
||||
public function fire(Job $job, $template)
|
||||
{
|
||||
if ($job->attempts() > 3) {
|
||||
//通过这个方法可以检查这个任务已经重试了几次了
|
||||
}
|
||||
TaskLogic::VillageCronAdd($template);
|
||||
//如果任务执行成功后 记得删除任务,不然这个任务会重复执行,直到达到最大重试次数后失败后,执行failed方法
|
||||
$job->delete();
|
||||
}
|
||||
}
|
26
app/job/VillageTaskSettlementJob.php
Normal file
26
app/job/VillageTaskSettlementJob.php
Normal file
@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
namespace app\job;
|
||||
|
||||
use app\api\controller\RemoteController;
|
||||
use app\common\logic\finance\ShareProfit;
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use think\facade\Log;
|
||||
use think\queue\Job;
|
||||
|
||||
class VillageTaskSettlementJob
|
||||
{
|
||||
/**
|
||||
* 镇农科公司任务结算
|
||||
*/
|
||||
public function fire(Job $job, $taskSchedulingPlan)
|
||||
{
|
||||
TaskLogic::villageTaskSettlement($taskSchedulingPlan);
|
||||
//如果任务执行成功后 记得删除任务,不然这个任务会重复执行,直到达到最大重试次数后失败后,执行failed方法
|
||||
$job->delete();
|
||||
}
|
||||
}
|
20
app/middleapi/config/route.php
Normal file
20
app/middleapi/config/route.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
// +----------------------------------------------------------------------
|
||||
// | likeadmin快速开发前后端分离管理后台(PHP版)
|
||||
// +----------------------------------------------------------------------
|
||||
// | 欢迎阅读学习系统程序代码,建议反馈是我们前进的动力
|
||||
// | 开源版本可自由商用,可去除界面版权logo
|
||||
// | gitee下载:https://gitee.com/likeshop_gitee/likeadmin
|
||||
// | github下载:https://github.com/likeshop-github/likeadmin
|
||||
// | 访问官网:https://www.likeadmin.cn
|
||||
// | likeadmin团队 版权所有 拥有最终解释权
|
||||
// +----------------------------------------------------------------------
|
||||
// | author: likeadminTeam
|
||||
// +----------------------------------------------------------------------
|
||||
|
||||
return [
|
||||
'middleware' => [
|
||||
// 权限认证
|
||||
// app\middleapi\http\middleware\AuthMiddleware::class,
|
||||
],
|
||||
];
|
100
app/middleapi/controller/AccountLogController.php
Normal file
100
app/middleapi/controller/AccountLogController.php
Normal file
@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserAccountLog;
|
||||
use app\common\model\user\UserRole;
|
||||
use app\common\service\FileService;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
/***
|
||||
* 账户流水控制器
|
||||
* Class AccountLogController
|
||||
* @package app\adminapi\controller
|
||||
*/
|
||||
class AccountLogController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* @notes 账户流水明细
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:25
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size', 'start_time', 'end_time', 'user_info', 'type', 'change_type', 'company_id']);
|
||||
$where = [];
|
||||
if (isset($params['type']) && $params['type'] == 'um') {
|
||||
$where[] = ['change_type', 'in', AccountLogEnum::getUserMoneyChangeType()];
|
||||
}
|
||||
if (!empty($params['change_type'])) {
|
||||
$where[] = ['change_type', '=', $params['change_type']];
|
||||
}
|
||||
if (!empty($params['company_id'])) {
|
||||
$where[] = ['company_id', '=', $params['company_id']];
|
||||
}
|
||||
if (!empty($params['start_time'])) {
|
||||
$where[] = ['create_time', '>=', strtotime($params['start_time'])];
|
||||
}
|
||||
if (!empty($params['end_time'])) {
|
||||
$where[] = ['create_time', '<=', strtotime($params['end_time'])];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$lists = UserAccountLog::where($where)
|
||||
->with(['company_info','user_info'])
|
||||
->order('id', 'desc')
|
||||
->page($pageNo, $pageSize)
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($lists as &$item) {
|
||||
$item['user_info']['avatar'] = FileService::getFileUrl($item['user_info']['avatar']);
|
||||
$item['user_info']['group_name']=UserRole::where('id',$item['user_info']['group_id'])->value('name');
|
||||
$item['change_type_desc'] = AccountLogEnum::getChangeTypeDesc($item['change_type']);
|
||||
$symbol = $item['action'] == AccountLogEnum::INC ? '+' : '-';
|
||||
$item['change_amount'] = $symbol . $item['change_amount'];
|
||||
// 用于导出
|
||||
$item['user_info_sn'] = $item['user_info']['sn'];
|
||||
$item['company_info_company_name'] = $item['company_info']['company_name'];
|
||||
$item['user_info_nickname'] = $item['user_info']['nickname'];
|
||||
$item['user_info_group_name'] = $item['user_info']['group_name'];
|
||||
$item['user_info_mobile'] = $item['user_info']['mobile'];
|
||||
}
|
||||
$count = UserAccountLog::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $lists,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 用户余额变动类型
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:25
|
||||
*/
|
||||
public function getUmChangeType()
|
||||
{
|
||||
return $this->data(AccountLogEnum::getUserMoneyChangeTypeDesc());
|
||||
}
|
||||
|
||||
public function getCompanyUserList()
|
||||
{
|
||||
$param = $this->request->param();
|
||||
$companyId = $param['company_id'] ?? 0;
|
||||
$userList = User::where(['company_id' => $companyId])->field('id,nickname,avatar,sn,mobile,group_id,deposit,income')->select()->toArray();
|
||||
return $this->success('成功', $userList);
|
||||
}
|
||||
|
||||
}
|
200
app/middleapi/controller/ApproveController.php
Normal file
200
app/middleapi/controller/ApproveController.php
Normal file
@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\lists\approve\ApproveLists;
|
||||
use app\common\logic\task\TaskLogic;
|
||||
use app\common\model\Approve;
|
||||
use app\common\model\task\Task;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use think\facade\Db;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
class ApproveController extends BaseLikeAdminController
|
||||
{
|
||||
public function lists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['page_no','page_size','type','check_status']);
|
||||
$where = [];
|
||||
if (isset($params['check_status']) && $params['check_status'] != '') {
|
||||
$where[] = ['check_status', '=', $params['check_status']];
|
||||
}
|
||||
if (isset($params['type']) && $params['type'] != '') {
|
||||
$where[] = ['type', 'in', $params['type']];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$data = Approve::where($where)
|
||||
->with('task')
|
||||
->field('*')
|
||||
->append(['area_manager', 'company_name'], true)
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
return Admin::where(['id' => $data['check_admin_ids']])->value('name');
|
||||
})
|
||||
->withAttr('company_name',function($value,$data){
|
||||
$task = Task::where('id', $data['task_id'])->find();
|
||||
return Company::where(['id' => $task['company_id'] ?? 0])->value('company_name');
|
||||
})
|
||||
->toArray();
|
||||
$count = Approve::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
public function audit()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param();
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('缺少必要参数id');
|
||||
}
|
||||
if(empty($params['check_status'])){
|
||||
return $this->fail('缺少必要参数审核状态');
|
||||
}
|
||||
$approve = Approve::find($params['id']);
|
||||
if (!$approve) {
|
||||
$this->fail('数据不存在');
|
||||
}
|
||||
Db::startTrans();
|
||||
// 拒绝通过 要让用户今天可以继续做任务
|
||||
if ($params['check_status'] == 3) {
|
||||
$this->refuse($params, $approve);
|
||||
}
|
||||
// 修改任务完成状态
|
||||
if ($params['check_status'] == 2) {
|
||||
if ($approve->type == Approve::APPROVE_TYPE_7) {
|
||||
$taskTemplate = TaskTemplate::where(['id'=>$approve->business_id])->find();
|
||||
// 提前完成
|
||||
if ($taskTemplate['day_count'] < $taskTemplate['stage_day_one']) {
|
||||
if (bccomp($params['amount'], 300000, 2) == -1) {
|
||||
$this->fail('该任务提前完成条件:销售总额必须达到30万元及以上');
|
||||
} else {
|
||||
// 提前完成标识
|
||||
$extend = json_decode($taskTemplate['extend'], true);
|
||||
$extend['early_finish'] = 1;
|
||||
$taskTemplate->extend = json_encode($extend);
|
||||
$taskTemplate->save();
|
||||
$this->pass($approve, $params);
|
||||
}
|
||||
} else {
|
||||
$this->pass($approve, $params);
|
||||
}
|
||||
} else {
|
||||
$this->pass($approve);
|
||||
}
|
||||
|
||||
}
|
||||
Db::commit();
|
||||
return $this->success('审核成功');
|
||||
} catch (\Exception $e) {
|
||||
Db::rollback();
|
||||
return $this->fail($e->getFile().$e->getLine().$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
// 通过
|
||||
private function pass($approve, $params=[])
|
||||
{
|
||||
$approve->check_status = 2;
|
||||
$approve->update_time = time();
|
||||
$approve->save();
|
||||
// 任务
|
||||
$task = Task::find($approve['task_id']);
|
||||
if ($task['status'] == 2) {
|
||||
$task->status = 3;
|
||||
$task->save();
|
||||
}
|
||||
// 镇农科公司任务-数字农贸宣传业务、加工业务的建设和招商工作任务 结算
|
||||
if ($approve->type == Approve::APPROVE_TYPE_4) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 41)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealTaskMarketingDirector10($taskSchedulePlan, $approve);
|
||||
}
|
||||
|
||||
if ($approve->type == Approve::APPROVE_TYPE_5) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealVillageTask6($taskSchedulePlan);
|
||||
}
|
||||
|
||||
if ($approve->type == Approve::APPROVE_TYPE_6) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::dealVillageTask8($taskSchedulePlan);
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_7) {
|
||||
// 需要手动输入销售总额
|
||||
$approve->amount = $params['amount'];
|
||||
$approve->save();
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_8) {
|
||||
// 需要手动输入申请的政策补贴金额
|
||||
$approve->amount = $params['amount'];
|
||||
$approve->save();
|
||||
}
|
||||
if ($approve->type == Approve::APPROVE_TYPE_9) {
|
||||
$taskSchedulePlan = TaskSchedulingPlan::where('la_task_scheduling_plan.id', $task['scheduling_plan_id'])
|
||||
->where('is_pay',0)
|
||||
->with(['template_info'])
|
||||
->withJoin(['scheduling'], 'left')
|
||||
->where('scheduling.company_type', 17)
|
||||
->find()
|
||||
->toArray();
|
||||
TaskLogic::masterTask8Settlement($taskSchedulePlan);
|
||||
}
|
||||
}
|
||||
|
||||
// 拒绝
|
||||
private function refuse($params, $approve)
|
||||
{
|
||||
$approve->check_status = $params['check_status'];
|
||||
$approve->remark = $params['remark'];
|
||||
$approve->update_time = time();
|
||||
$approve->save();
|
||||
|
||||
// 更新schedule_plan时间和task的时间为今天依旧可提交
|
||||
$schedulePlan = TaskSchedulingPlan::find(['tast_id' => $approve['task_id']]);
|
||||
if (empty($schedule_plan)) {
|
||||
return $this->fail('数据异常,任务计划不存在');
|
||||
}
|
||||
$time = strtotime(date('Y-m-d'));
|
||||
TaskSchedulingPlan::where(['id' => $schedulePlan['id']])->update([
|
||||
'start_time'=>$time,
|
||||
'end_time'=>$time + 86399
|
||||
]);
|
||||
Task::where('id', $approve['task_id'])->update([
|
||||
'start_time'=>$time,
|
||||
'end_time'=>$time + 86399
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
68
app/middleapi/controller/ArchivesController.php
Normal file
68
app/middleapi/controller/ArchivesController.php
Normal file
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\logic\informationg\UserInformationgLogic;
|
||||
use app\adminapi\validate\informationg\UserInformationgValidate;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\model\informationg\UserInformationg;
|
||||
use app\common\model\informationg\UserInformationgDemand;
|
||||
use think\response\Json;
|
||||
|
||||
class ArchivesController extends BaseLikeAdminController
|
||||
{
|
||||
//档案列表
|
||||
public function lists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size','name']);
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$where = [];
|
||||
if(!empty($params['name'])){
|
||||
$where[] = ['name','like','%'.$params['name'].'%'];
|
||||
}
|
||||
$lists = UserInformationg::where($where)
|
||||
->field(['id','create_user_id','company_id','area_id','area_id area_name','street_id','street_id street_name','village_id','village_id village_name', 'brigade_id','brigade_id brigade_name', 'address', 'name', 'phone', 'sex', 'age','update_time','create_time','status'])
|
||||
->append(['extend'])
|
||||
->order(['id' => 'desc'])
|
||||
->page($pageNo, $pageSize)
|
||||
->select()
|
||||
->toArray();
|
||||
$informationIdArray = [];
|
||||
foreach($lists as $k=>$v) {
|
||||
$informationIdArray[] = $v['id'];
|
||||
}
|
||||
$data = UserInformationgDemand::whereIn('information_id', $informationIdArray)->order('id', 'desc')->select();
|
||||
$aianalyseArray = [];
|
||||
foreach($data as $kk=>$vv) {
|
||||
if (!empty($vv['ai_aianalyse'])) {
|
||||
$aianalyseArray[$vv['information_id']][] = $vv['id'];
|
||||
}
|
||||
}
|
||||
foreach($lists as $k=>$v) {
|
||||
$lists[$k]['aianalyse_status'] = 0;
|
||||
if (!empty($aianalyseArray[$v['id']])) {
|
||||
$lists[$k]['aianalyse_status'] = 1;
|
||||
}
|
||||
}
|
||||
$count = UserInformationg::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $lists,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
//档案详情
|
||||
public function detail(): Json
|
||||
{
|
||||
$params = (new UserInformationgValidate())->post()->goCheck('detail');
|
||||
$result = UserInformationgLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
}
|
83
app/middleapi/controller/BusinessController.php
Normal file
83
app/middleapi/controller/BusinessController.php
Normal file
@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\validate\category_business\CategoryBusinessValidate;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\logic\category_business\CategoryBusinessLogic;
|
||||
use app\common\model\category_business\CategoryBusiness;
|
||||
use think\response\Json;
|
||||
|
||||
class BusinessController extends BaseLikeAdminController
|
||||
{
|
||||
//商机分类列表
|
||||
public function lists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size','name','status']);
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$where = [];
|
||||
if(!empty($params['name'])){
|
||||
$where[] = ['name','like','%'.$params['name'].'%'];
|
||||
}
|
||||
if(!empty($params['status'])){
|
||||
$where[] = ['status','=',$params['status']];
|
||||
}
|
||||
$data = CategoryBusiness::where($where)->field(['id', 'name', 'pid', 'sort', 'status'])->order(['id' => 'desc'])->select()->toArray();
|
||||
$count = CategoryBusiness::where($where)->count();
|
||||
$result = [
|
||||
'lists' => linear_to_tree($data, 'children'),
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
//商机分类详情
|
||||
public function detail(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = CategoryBusiness::where('id',$params['id'])->findOrEmpty();
|
||||
return $this->success('请求成功',$data->toArray());
|
||||
}
|
||||
|
||||
//新增商机分类
|
||||
public function create(): Json
|
||||
{
|
||||
$params = (new CategoryBusinessValidate())->post()->goCheck('add');
|
||||
$result = CategoryBusinessLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CategoryBusinessLogic::getError());
|
||||
}
|
||||
|
||||
//编辑商机分类
|
||||
public function edit(): Json
|
||||
{
|
||||
$params = (new CategoryBusinessValidate())->post()->goCheck('edit');
|
||||
$result = CategoryBusinessLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CategoryBusinessLogic::getError());
|
||||
}
|
||||
|
||||
//删除商机分类
|
||||
public function delete(): Json
|
||||
{
|
||||
$params = (new CategoryBusinessValidate())->post()->goCheck('delete');
|
||||
CategoryBusinessLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
}
|
484
app/middleapi/controller/CompanyController.php
Normal file
484
app/middleapi/controller/CompanyController.php
Normal file
@ -0,0 +1,484 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\logic\auth\AdminLogic;
|
||||
use app\adminapi\logic\user\UserLogic;
|
||||
use app\adminapi\validate\CompanyValidate;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\enum\user\UserTerminalEnum;
|
||||
use app\common\logic\CompanyLogic;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\logic\RedisLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\company\CompanyAccountLog;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\dict\DictData;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\CompanyDepositVoucher;
|
||||
use Exception;
|
||||
use think\facade\Db;
|
||||
use think\facade\Log;
|
||||
use think\response\Json;
|
||||
|
||||
class CompanyController extends BaseLikeAdminController
|
||||
{
|
||||
//公司列表
|
||||
public function lists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['page_no','page_size','company_name','area_name','street_name','area_manager','company_type','is_contract']);
|
||||
$where = [];
|
||||
if(!empty($params['company_name'])){
|
||||
$where[] = ['company_name','like','%'.$params['company_name'].'%'];
|
||||
}
|
||||
if(!empty($params['area_name'])){
|
||||
$arr= Db::name('geo_area')->where('area_name','like','%'.$params['area_name'].'%')->column('area_code');
|
||||
if($arr){
|
||||
$where[]=['area','in',$arr];
|
||||
}
|
||||
}
|
||||
if(!empty($params['street_name'])){
|
||||
$arr= Db::name('geo_street')->where('street_name','like','%'.$params['street_name'].'%')->column('street_code');
|
||||
if($arr){
|
||||
$where[]=['street','in',$arr];
|
||||
}
|
||||
}
|
||||
if(!empty($params['area_manager'])){
|
||||
$arr= Admin::where('name','like','%'.$params['area_manager'].'%')->column('id');
|
||||
if($arr){
|
||||
$where[]=['area_manager','in',$arr];
|
||||
}
|
||||
}
|
||||
if(!empty($params['company_type'])){
|
||||
$where[] = ['company_type','=',$params['company_type']];
|
||||
}
|
||||
if(!empty($params['is_contract'])){
|
||||
$where[] = ['is_contract','=',$params['is_contract']];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$data = Company::where($where)
|
||||
->field(['is_authentication','id', 'id contract', 'company_name', 'organization_code', 'city', 'area', 'street', 'company_type', 'master_name', 'master_position', 'master_phone', 'master_email', 'area_manager', 'is_contract', 'deposit', 'company_money', 'shareholder_money', 'deposit_time', 'status', 'face_create_status'])
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->append(['notes'], true)
|
||||
->withAttr('company_type',function($value,$data){
|
||||
return Db::name('dict_data')->where('id',$value)->value('name');
|
||||
})
|
||||
->withAttr('area',function($value,$data){
|
||||
return Db::name('geo_area')->where('area_code',$value)->value('area_name');
|
||||
})
|
||||
->withAttr('street',function($value,$data){
|
||||
return Db::name('geo_street')->where('street_code',$value)->value('street_name');
|
||||
})
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
return Db::name('admin')->where('id',$value)->value('name');
|
||||
})
|
||||
->withAttr('notes',function($value,$data){
|
||||
if ($data['is_authentication'] == 1) {
|
||||
return Db::name('company_authentication_fail_log')->where('company_id',$data['id'])->where('log_type', 2)->order(['id'=>'desc'])->limit(1)->value('fail_reason');
|
||||
} else {
|
||||
return Db::name('company_authentication_fail_log')->where('company_id',$data['id'])->where('log_type', 1)->order(['id'=>'desc'])->limit(1)->value('fail_reason');
|
||||
}
|
||||
|
||||
})->select()->toArray();
|
||||
$count = Company::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
//公司详情
|
||||
public function detail(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
$result = CompanyLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
//公司删除
|
||||
public function delete(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
$admin_id = Company::where('id', $params['id'])->value('admin_id');
|
||||
User::where('company_id', $params['id'])->update(['delete_time' => time()]);
|
||||
TaskScheduling::where('company_id', $params['id'])->update(['delete_time' => time()]);
|
||||
AdminLogic::delete(['id' => $admin_id]);
|
||||
CompanyLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
//添加公司
|
||||
public function create(): Json
|
||||
{
|
||||
$params = (new CompanyValidate())->post()->goCheck('add');
|
||||
$params['other_contacts'] = json_encode($params['other_contacts']);
|
||||
$params['qualification'] = json_encode($params['qualification']);
|
||||
if (isset($params['responsible_area'])) {
|
||||
$params['responsible_area'] = implode(',', $params['responsible_area']);
|
||||
}
|
||||
$result = CompanyLogic::add($params);
|
||||
if (true === $result) {
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CompanyLogic::getError());
|
||||
}
|
||||
|
||||
//修改公司
|
||||
public function edit(): Json
|
||||
{
|
||||
$params = (new CompanyValidate())->post()->goCheck('edit');
|
||||
$params['other_contacts'] = json_encode($params['other_contacts']);
|
||||
$params['qualification'] = json_encode($params['qualification']);
|
||||
if (isset($params['responsible_area'])) {
|
||||
$params['responsible_area'] = implode(',', $params['responsible_area']);
|
||||
}
|
||||
$result = CompanyLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(CompanyLogic::getError());
|
||||
}
|
||||
|
||||
//公司认证
|
||||
public function enterpriseCertification(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
$company = Db::name('company')->where('id', $params['id'])->find();
|
||||
$qualification = json_decode($company['qualification'], true);
|
||||
if ($company && $qualification['business_license']) {
|
||||
$data = [
|
||||
'name' => $company['company_name'],
|
||||
'organization_code' => $company['organization_code'],
|
||||
'business_license' => 'https://lihai001.oss-cn-chengdu.aliyuncs.com/def/561f8202305171526091317.png', //$qualification['business_license'],
|
||||
'master_name' => $company['master_name'],
|
||||
'master_email' => $company['master_email'],
|
||||
'master_phone' => $company['master_phone'],
|
||||
'master_id_card' => $company['master_id_card'],
|
||||
'id' => $company['id'],
|
||||
];
|
||||
$res = app(JunziqianController::class)->EnterpriseCertification($data);
|
||||
Log::info(['企业认证同步结果',$res]);
|
||||
if ($res->success) {
|
||||
if ($company['company_type'] == 30) {
|
||||
// 平台公司不用初始化生成合同 合同签约暂不用人脸识别,预留人脸采集状态为已采集
|
||||
Db::name('company')->where('id', $params['id'])->update([ 'is_contract'=>1,'face_create_status'=>1]);
|
||||
} else {
|
||||
Db::name('company')->where('id', $params['id'])->update([ 'face_create_status'=>1]);
|
||||
}
|
||||
// 加入缓存中,is_callback用于判断是否获取到异步通知
|
||||
RedisLogic::getInstance()->set('authentication_company_id_'.$company['id'], json_encode(['company_id'=>$company['id'],'is_callback'=>0, 'timing'=>time()]));
|
||||
return $this->success('系统认证中,请稍后刷新页面查看', ['email' => $res->data], 1, 1);
|
||||
} else {
|
||||
return $this->fail($res->msg);
|
||||
}
|
||||
} else {
|
||||
return $this->fail("公司不存在");
|
||||
}
|
||||
}
|
||||
|
||||
//生成合同
|
||||
public function generateContract(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['id','party_a','contract_type']);
|
||||
if(empty($params['id']) || empty($params['party_a']) || empty($params['contract_type'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
$area_manager = Company::where('id', $params['party_a'])->value('area_manager');
|
||||
$params['area_manager'] = $area_manager;
|
||||
$params['type'] = 1;
|
||||
$params['party_b'] = $params['id'];
|
||||
unset($params['id']);
|
||||
$result = ContractLogic::initiate_contract($params);
|
||||
if (!empty($result) && $result['code'] == 1) {
|
||||
return $this->success($result['msg'], $result['data'], 1, 1);
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
//下属公司
|
||||
public function subsidiaryCompany(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['id','page_no','page_size']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$ids = Contract::where('party_a', $params['id'])->where('status', 1)->where('type', 1)->column('party_b');
|
||||
if ($ids) {
|
||||
$result = Company::where('id', 'in', $ids)->field('company_name,id,company_type,company_type company_type_name,area,area area_name,street,street street_name,is_contract,area_manager,area_manager area_manager_name,master_name,master_phone,is_authentication')->page($pageNo,$pageSize)->select();
|
||||
$count = Company::where('id', 'in', $ids)->count();
|
||||
} else {
|
||||
$result = [];
|
||||
$count = 0;
|
||||
}
|
||||
$data = [
|
||||
'lists' => $result,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('success', $data);
|
||||
}
|
||||
|
||||
//公司类型
|
||||
public function companyType(): Json
|
||||
{
|
||||
$data = DictData::where('type_id',6)
|
||||
->append(['status_desc'])
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $this->success('请求成功',$data);
|
||||
}
|
||||
|
||||
//合同类型
|
||||
public function contractType(): Json
|
||||
{
|
||||
$data = DictData::where('type_id',7)
|
||||
->append(['status_desc'])
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
return $this->success('请求成功',$data);
|
||||
}
|
||||
|
||||
public function responsibleArea(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['key','value','company_type']);
|
||||
if (empty($params['key']) || empty($params['value']) || empty($params['company_type'])) {
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
if ($params['key'] == 'city') {
|
||||
$where[] = ['area', '=', 0];
|
||||
}
|
||||
if ($params['value'] == '') {
|
||||
return $this->fail('参数不能为空');
|
||||
}
|
||||
$where[] = [$params['key'], '=', $params['value']];
|
||||
$where[] = ['company_type', '=', $params['company_type']];
|
||||
switch ($params['key']) {
|
||||
case 'city':
|
||||
// $geo_area=Db::name('geo_area')->where('city_code', '=', $parmas['value'])->column('area_code');
|
||||
// $where[] = ['area', 'in', $geo_area];
|
||||
break;
|
||||
case 'area':
|
||||
$street_code = Db::name('geo_street')->where('area_code', '=', $params['value'])->column('street_code');
|
||||
$where[] = ['street', 'in', $street_code];
|
||||
$where[] = ['village', '=', 0];
|
||||
break;
|
||||
case 'street':
|
||||
$street_code = Db::name('geo_village')->where('street_code', '=', $params['value'])->column('village_code');
|
||||
$where[] = ['village', 'in', $street_code];
|
||||
$where[] = ['brigade', '=', 0];
|
||||
break;
|
||||
case 'village':
|
||||
// $street_code = Db::name('geo_brigade')->where('street_code', '=', $parmas['value'])->column('village_code');
|
||||
$where[] = ['village', '=', $params['value']];
|
||||
// $where[] = ['brigade', '=', 0];
|
||||
break;
|
||||
}
|
||||
|
||||
$res = Company::where($where)->column('responsible_area');
|
||||
|
||||
foreach ($res as $k => $v) {
|
||||
$res[$k] = explode(',', $v);
|
||||
}
|
||||
$data = [];
|
||||
foreach ($res as $k => $v) {
|
||||
foreach ($v as $kk => $vv) {
|
||||
if ($vv != '') {
|
||||
$data[] = $vv;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $this->success('success', array_unique($data));
|
||||
}
|
||||
|
||||
public function getDepositRechargeTransferVoucherList(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size', 'account', 'mobile', 'company_id']);
|
||||
$where = [];
|
||||
if(isset($params['company_id']) && $params['company_id'] > 0){
|
||||
$where[] = ['company_id', '=', $params['company_id']];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$lists = CompanyDepositVoucher::where($where)
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
$count=CompanyDepositVoucher::where($where)->count();
|
||||
|
||||
$result = [
|
||||
'lists' => $lists,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
public function depositRechargeTransferVoucher(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$param = $this->request->param();
|
||||
if(empty($param['company_id'])){
|
||||
return $this->fail('缺少company_id');
|
||||
}
|
||||
if(empty($param['deposit'])){
|
||||
return $this->fail('缺少押金金额');
|
||||
}
|
||||
if(empty($param['voucher'])){
|
||||
return $this->fail('缺少凭证文件');
|
||||
}
|
||||
try {
|
||||
$adminId = 1;
|
||||
Db::startTrans();
|
||||
$data = [
|
||||
'company_id' => $param['company_id'],
|
||||
'deposit' => $param['deposit'],
|
||||
'voucher' => $param['voucher'],
|
||||
'create_admin_id' => $adminId,
|
||||
'create_time' => time(),
|
||||
'update_time' => time()
|
||||
];
|
||||
$result = (new CompanyDepositVoucher())->save($data);
|
||||
|
||||
$companyModel = Company::where(['id' => $param['company_id']])->find();
|
||||
$left_amount = bcadd($companyModel['deposit'], $param['deposit'], 2);
|
||||
|
||||
// 添加流水记录
|
||||
$datas = [
|
||||
'sn' => generate_sn(CompanyAccountLog::class, 'sn', 20),
|
||||
'user_id' => 0,
|
||||
'company_id' => $param['company_id'],
|
||||
'change_type' => CompanyAccountLog::COMPANY_DEPOSIT,
|
||||
'change_object' => CompanyAccountLog::DEPOSIT,
|
||||
'action' => 1,
|
||||
'change_amount' => $param['deposit'],
|
||||
'left_amount' =>$left_amount,
|
||||
'remark' => '后台押金转账凭证充值',
|
||||
'status' => 1,
|
||||
];
|
||||
CompanyAccountLog::create($datas);
|
||||
|
||||
// 更新公司押金金额
|
||||
$companyModel->deposit = $left_amount;
|
||||
$companyModel->save();
|
||||
Db::commit();
|
||||
return $this->success('成功');
|
||||
} catch (Exception $exception) {
|
||||
Db::rollback();
|
||||
return $this->fail($exception->getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public function getPartyA(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$companyId = $this->request->param('company_id');
|
||||
if(empty($companyId)){
|
||||
return $this->fail('缺少公司id');
|
||||
}
|
||||
$re = CompanyLogic::getPartyA($companyId);
|
||||
if ($re === false) {
|
||||
return $this->fail(CompanyLogic::getError());
|
||||
}
|
||||
return $this->success('成功', $re);
|
||||
}
|
||||
|
||||
//获取公司成员
|
||||
public function companyUserLists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['company_id','page_no','page_size']);
|
||||
if(empty($params['company_id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
|
||||
$lists = User::with(['company'])
|
||||
->where('company_id',$params['company_id'])
|
||||
->page($pageNo, $pageSize)
|
||||
->field($field)
|
||||
->order('id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($lists as &$item) {
|
||||
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
|
||||
}
|
||||
$count = User::where('company_id',$params['company_id'])->count();
|
||||
$result = [
|
||||
'lists' => $lists,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
//获取公司成员详情
|
||||
public function companyUserDetail(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['user_id']);
|
||||
if(empty($params['user_id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$detail = UserLogic::detail($params['user_id']);
|
||||
return $this->success('', $detail);
|
||||
}
|
||||
}
|
181
app/middleapi/controller/ContractController.php
Normal file
181
app/middleapi/controller/ContractController.php
Normal file
@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\validate\contract\ContractValidate;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\api\logic\SmsLogic;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\contract\Contract;
|
||||
use app\common\model\user\User;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class ContractController extends BaseLikeAdminController
|
||||
{
|
||||
//合同列表
|
||||
public function lists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size','contract_no','contract_type','contract_status','company_name','area_manager']);
|
||||
$where = [];
|
||||
if(isset($params['contract_no']) && $params['contract_no']!=''){
|
||||
$where[] = ['contract_no','like','%'.$params['contract_no'].'%'];
|
||||
}
|
||||
if(isset($params['contract_type']) && $params['contract_type']!=''){
|
||||
$where[] = ['contract_type','=',$params['contract_type']];
|
||||
}
|
||||
if(isset($params['contract_status']) && in_array($params['contract_status'],[0,1])){
|
||||
$where[] = ['status','=', $params['contract_status']];
|
||||
}
|
||||
if(isset($params['company_name']) && $params['company_name']!=''){
|
||||
$arr= Company::where('company_name','like','%'.$params['company_name'].'%')->column('id');
|
||||
if($arr){
|
||||
$where[]=['party_a|party_b','in',$arr];
|
||||
}
|
||||
}
|
||||
if(isset($params['area_manager']) && $params['area_manager']!=''){
|
||||
$arr= Admin::where('name','like','%'.$params['area_manager'].'%')->column('id');
|
||||
if($arr){
|
||||
$where[]=['area_manager','in',$arr];
|
||||
}
|
||||
}
|
||||
$pageNo = !empty($param['page_no']) ? $param['page_no'] : 1;
|
||||
$pageSize = !empty($param['page_size']) ? $param['page_size'] : 20;
|
||||
$data = Contract::where($where)->with(['companyName','party_a_info','contractType'])
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->select()->each(function ($item) {
|
||||
if($item->type==1){
|
||||
$item->party_b_name=Db::name('company')->where('id',$item->party_b)->value('company_name');
|
||||
}else{
|
||||
$item->party_b_name=Db::name('user')->where('id',$item->party_b)->value('nickname');
|
||||
}
|
||||
if(!empty($item->party_a_info)){
|
||||
$area_manager_name=Db::name('admin')->where('id',$item->party_a_info->area_manager)->value('name');
|
||||
if($area_manager_name){
|
||||
$item->area_manager_name=$area_manager_name;
|
||||
}else{
|
||||
$item->area_manager_name='暂无片区经理';
|
||||
}
|
||||
}else{
|
||||
$item->area_manager_name='暂无片区经理';
|
||||
}
|
||||
$item->contract_type_name=Db::name('dict_data')->where('id',$item->contract_type)->value('name');
|
||||
$item->status_name=$item->status==1?'已签约':'未签约';
|
||||
})->toArray();
|
||||
$count = Contract::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
//合同详情
|
||||
public function detail(): Json
|
||||
{
|
||||
$params = (new ContractValidate())->post()->goCheck('detail');
|
||||
$result = ContractLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
//上传合同
|
||||
public function uploadContract(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id','file']);
|
||||
if(empty($params['id']) || empty($params['file'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$res = Contract::where('id', $params['id'])->update(['file' => $params['file'], 'check_status' => 2]);
|
||||
if ($res) {
|
||||
$find = Contract::where('id', $params['id'])->with(['party_a_info'])->field('type,party_b,party_a')->find()->toArray();
|
||||
if ($find['type'] == 1) {
|
||||
$find['party_b_info'] = Company::where('id', $find['party_b'])->field('company_name name,master_phone phone')->find()->toArray();
|
||||
} else {
|
||||
$find['party_b_info'] = User::where('id', $find['party_b'])->field('nickname name,mobile phone')->find()->toArray();
|
||||
}
|
||||
$a = [
|
||||
'mobile' => $find['party_a_info']['master_phone'],
|
||||
'name' => $find['party_a_info']['company_name'],
|
||||
'scene' => 'WQTZ'
|
||||
];
|
||||
SmsLogic::contractUrl($a);
|
||||
$b = [
|
||||
'mobile' => $find['party_b_info']['phone'],
|
||||
'name' => $find['party_b_info']['name'],
|
||||
'scene' => 'WQTZ'
|
||||
];
|
||||
SmsLogic::contractUrl($b);
|
||||
return $this->success('上传成功', [], 1, 1);
|
||||
} else {
|
||||
if ($res == 0) {
|
||||
return $this->success('没有更新', [], 1, 1);
|
||||
}
|
||||
return $this->fail('上传失败');
|
||||
}
|
||||
}
|
||||
|
||||
//发起合同
|
||||
public function DraftingContract(): Json
|
||||
{
|
||||
$params = $this->request->post(['id','part_b','type']);
|
||||
if(empty($params['id']) || empty($params['part_b']) || empty($params['type'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$data = [
|
||||
'id' => $params['part_b'],
|
||||
'contract_id' => $params['id']
|
||||
];
|
||||
$result = ContractLogic::Draftingcontracts($data,$params['type']);
|
||||
if ($result) {
|
||||
return $this->success('发送合同成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
//发送短信
|
||||
public function sendSms(): Json
|
||||
{
|
||||
$params = $this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$res = ContractLogic::postsms($params);
|
||||
if ($res) {
|
||||
return $this->success('发送成功', [], 1, 1);
|
||||
} else {
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
}
|
||||
|
||||
//下载证据包
|
||||
public function evidence() {
|
||||
$params = $this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
$this->fail('参数错误');
|
||||
}
|
||||
$detail=Contract::where('id',$params['id'])->find();
|
||||
if(!empty($detail['evidence_url'])){
|
||||
return $this->success('获取成功', ['url' => env('url.url_prefix').$detail['evidence_url']]);
|
||||
}
|
||||
$company=Company::where('id',$detail['party_a'])->find();
|
||||
$request = array(
|
||||
"applyNo" => $detail['contract_no'],
|
||||
"fullName" => $company['company_name'],
|
||||
"identityCard" => $company['organization_code'],
|
||||
"identityType" => 12,
|
||||
);
|
||||
return app(JunziqianController::class)->EvidenceDownload($request);
|
||||
}
|
||||
}
|
77
app/middleapi/controller/DictDataController.php
Normal file
77
app/middleapi/controller/DictDataController.php
Normal file
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\model\dict\DictData;
|
||||
use app\adminapi\logic\setting\dict\DictDataLogic;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
|
||||
/**
|
||||
* 字典数据
|
||||
* Class DictDataController
|
||||
* @package app\adminapi\controller\dictionary
|
||||
*/
|
||||
class DictDataController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取字典数据列表
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 16:35
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['page_no','page_size','name','type_id','type_value']);
|
||||
$where = [];
|
||||
if(!empty($params['name'])){
|
||||
$where[] = ['name','like','%' . $params['name'] . '%'];
|
||||
}
|
||||
if(!empty($params['type_id'])){
|
||||
$where[] = ['type_id', '=', $params['type_id']];
|
||||
}
|
||||
if(!empty($params['type_value'])){
|
||||
$where[] = ['type_value', '=', $params['type_value']];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$data = DictData::where($where)
|
||||
->append(['status_desc'])
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['sort' => 'desc', 'id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
$count = DictData::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取字典详情
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2022/6/20 17:14
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new DictDataValidate())->goCheck('id');
|
||||
$result = DictDataLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
public function getTaskApproveTypeList()
|
||||
{
|
||||
$result = DictDataLogic::getTaskApproveTypeList();
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
}
|
44
app/middleapi/controller/GeoController.php
Normal file
44
app/middleapi/controller/GeoController.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use think\facade\Db;
|
||||
|
||||
class GeoController extends BaseLikeAdminController
|
||||
{
|
||||
public function province()
|
||||
{
|
||||
$data = Db::name('geo_province')->where(['switch' => 1])->select();
|
||||
return $this->data($data->toArray());
|
||||
} //**市列表 */
|
||||
public function city($city)
|
||||
{
|
||||
$data = Db::name('geo_city')->where(['province_code' => $city])->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
//**区域列表 */
|
||||
public function area($area)
|
||||
{
|
||||
$data = Db::name('geo_area')->where(['city_code' => $area])->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
//**街道列表 */
|
||||
public function street($street)
|
||||
{
|
||||
$data = Db::name('geo_street')->where(['area_code' => $street])->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
//**村列表 */
|
||||
public function village($village)
|
||||
{
|
||||
$data = Db::name('geo_village')->where(['street_code' => $village])->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
//**小队列表 */
|
||||
public function brigade()
|
||||
{
|
||||
$data = Db::name('geo_brigade')->select();
|
||||
return $this->data($data->toArray());
|
||||
}
|
||||
}
|
124
app/middleapi/controller/MerchantController.php
Normal file
124
app/middleapi/controller/MerchantController.php
Normal file
@ -0,0 +1,124 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\model\Approve;
|
||||
use app\common\model\auth\Admin;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\CompanyForm;
|
||||
use app\common\model\ShopMerchant;
|
||||
use app\common\model\task\Task;
|
||||
use think\facade\Db;
|
||||
use think\response\Json;
|
||||
|
||||
class MerchantController extends BaseLikeAdminController
|
||||
{
|
||||
//商户档案列表
|
||||
public function merchantRecordLists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size','merchant_name','master_name','master_phone']);
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$where = [];
|
||||
if(!empty($params['merchant_name'])){
|
||||
$where[] = ['company_name','like','%'.$params['merchant_name'].'%'];
|
||||
}
|
||||
if(!empty($params['master_name'])){
|
||||
$where[] = ['master_name','like','%'.$params['master_name'].'%'];
|
||||
}
|
||||
if(!empty($params['master_phone'])){
|
||||
$where[] = ['master_phone','like','%'.$params['master_phone'].'%'];
|
||||
}
|
||||
$data = ShopMerchant::where($where)
|
||||
->field(['id', 'company_name', 'organization_code', 'master_name', 'master_phone'])
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->append(['notes'], true)
|
||||
->withAttr('notes',function($value,$data){
|
||||
return Db::name('company_authentication_fail_log')->where('company_id',$data['id'])->where('log_type', 3)->order(['id'=>'desc'])->limit(1)->value('fail_reason');
|
||||
})->select()->toArray();
|
||||
$count = ShopMerchant::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
//商户认证表格列表
|
||||
public function merchantAuthLists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size','merchant_name','organization_code','master_name']);
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$where = [];
|
||||
if(!empty($params['merchant_name'])){
|
||||
$where[] = ['company_name','like','%'.$params['merchant_name'].'%'];
|
||||
}
|
||||
if(!empty($params['organization_code'])){
|
||||
$where[] = ['organization_code','like','%'.$params['organization_code'].'%'];
|
||||
}
|
||||
if(!empty($params['master_name'])){
|
||||
$where[] = ['master_name','like','%'.$params['master_name'].'%'];
|
||||
}
|
||||
$data = CompanyForm::where($where)
|
||||
->field(['id', 'company_name', 'organization_code', 'address', 'master_name', 'type', 'master_email', 'notes'])
|
||||
->page($pageNo, $pageSize)->order(['id' => 'desc'])->select()->toArray();
|
||||
$count = CompanyForm::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
//商户申请列表
|
||||
public function merchantApplyLists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size','check_status','type']);
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$where = [];
|
||||
if(!empty($params['check_status']) && in_array($params['check_status'],[1,2,3])){
|
||||
$where[] = ['check_status','=', $params['check_status']];
|
||||
}
|
||||
if(!empty($params['type']) && in_array($params['type'],[2,3])){
|
||||
$where[] = ['type','=',$params['type']];
|
||||
}else{
|
||||
$where[] = ['type','in','2,3'];
|
||||
}
|
||||
$data = Approve::where($where)->with('task')->append(['area_manager', 'company_name'], true)
|
||||
->page($pageNo, $pageSize)->order(['id' => 'desc'])->select()
|
||||
->withAttr('area_manager',function($value,$data){
|
||||
return Admin::where(['id' => $data['check_admin_ids']])->value('name');
|
||||
})
|
||||
->withAttr('company_name',function($value,$data){
|
||||
$task = Task::where('id', $data['task_id'])->find();
|
||||
if(!empty($task)){
|
||||
return Company::where(['id' => $task['company_id']])->value('company_name');
|
||||
}
|
||||
})->toArray();
|
||||
$count = Approve::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
}
|
99
app/middleapi/controller/RechargeController.php
Normal file
99
app/middleapi/controller/RechargeController.php
Normal file
@ -0,0 +1,99 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\logic\recharge\RechargeLogic;
|
||||
use app\adminapi\validate\recharge\RechargeRefundValidate;
|
||||
use app\common\model\recharge\RechargeOrder;
|
||||
use app\common\service\FileService;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
/**
|
||||
* 充值控制器
|
||||
* Class RechargeController
|
||||
* @package app\adminapi\controller\recharge
|
||||
*/
|
||||
class RechargeController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 充值记录
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 16:01
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size', 'user_info', 'start_time', 'end_time', 'sn', 'pay_way', 'pay_status' ]);
|
||||
$where = [];
|
||||
if (!empty($params['sn'])) {
|
||||
$where[] = ['ro.sn', '=', $params['sn']];
|
||||
}
|
||||
if (!empty($params['pay_way'])) {
|
||||
$where[] = ['ro.pay_way', '=', $params['pay_way']];
|
||||
}
|
||||
if (!empty($params['pay_status'])) {
|
||||
$where[] = ['ro.pay_status', '=', $params['pay_status']];
|
||||
}
|
||||
if (!empty($params['user_info'])) {
|
||||
$where[] = ['u.sn|u.nickname|u.mobile', 'like', '%' . $params['user_info'] . '%'];
|
||||
}
|
||||
if (!empty($params['start_time']) && !empty($params['end_time'])) {
|
||||
$where[] = ['ro.create_time', 'between', [strtotime($params['start_time']), strtotime($params['end_time'])]];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$field = 'ro.id,ro.sn,ro.order_amount,ro.pay_way,ro.pay_time,ro.pay_status,ro.create_time,ro.refund_status';
|
||||
$field .= ',u.avatar,u.nickname,u.company_id';
|
||||
$data = RechargeOrder::alias('ro')
|
||||
->join('user u', 'u.id = ro.user_id')
|
||||
->join('admin a', 'u.admin_id = a.id')
|
||||
->join('company c', 'u.company_id = c.id')
|
||||
->field($field)
|
||||
->where($where)
|
||||
->order('ro.id', 'desc')
|
||||
->page($pageNo, $pageSize)
|
||||
->append(['pay_status_text', 'pay_way_text'])
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($data as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
$item['pay_time'] = empty($item['pay_time']) ? '' : date('Y-m-d H:i:s', $item['pay_time']);
|
||||
}
|
||||
$count = RechargeOrder::alias('ro')
|
||||
->join('user u', 'u.id = ro.user_id')
|
||||
->join('admin a', 'u.admin_id = a.id')
|
||||
->join('company c', 'u.company_id = c.id')
|
||||
->where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 退款
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2023/2/28 17:29
|
||||
*/
|
||||
public function refund()
|
||||
{
|
||||
$params = (new RechargeRefundValidate())->post()->goCheck('refund');
|
||||
$adminId = 1;
|
||||
$result = RechargeLogic::refund($params, $adminId);
|
||||
list($flag, $msg) = $result;
|
||||
if(false === $flag) {
|
||||
return $this->fail($msg);
|
||||
}
|
||||
return $this->success($msg, [], 1, 1);
|
||||
}
|
||||
|
||||
}
|
121
app/middleapi/controller/RefundController.php
Normal file
121
app/middleapi/controller/RefundController.php
Normal file
@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\logic\finance\RefundLogic;
|
||||
use app\common\model\refund\RefundRecord;
|
||||
use app\common\enum\RefundEnum;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\service\FileService;
|
||||
|
||||
/**
|
||||
* 退款控制器
|
||||
* Class RefundController
|
||||
* @package app\adminapi\controller\finance
|
||||
*/
|
||||
class RefundController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 退还统计
|
||||
* @return \think\response\Json
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
* @author 段誉
|
||||
* @date 2023/3/3 12:10
|
||||
*/
|
||||
public function stat()
|
||||
{
|
||||
$result = RefundLogic::stat();
|
||||
return $this->success('', $result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 退款记录
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:47
|
||||
*/
|
||||
public function record()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size', 'user_info', 'start_time', 'end_time', 'sn', 'order_sn', 'refund_type', 'refund_status']);
|
||||
$where = [];
|
||||
if (!empty($params['sn'])) {
|
||||
$where[] = ['r.sn', '=', $params['sn']];
|
||||
}
|
||||
if (!empty($params['order_sn'])) {
|
||||
$where[] = ['r.order_sn', '=', $params['order_sn']];
|
||||
}
|
||||
if (!empty($params['refund_type'])) {
|
||||
$where[] = ['r.refund_type', '=', $params['refund_type']];
|
||||
}
|
||||
if (!empty($params['user_info'])) {
|
||||
$where[] = ['u.sn|u.nickname|u.mobile', 'like', '%' . $params['user_info'] . '%'];
|
||||
}
|
||||
if (!empty($params['start_time']) && !empty($params['end_time'])) {
|
||||
$where[] = ['r.create_time', 'between', [strtotime($params['start_time']), strtotime($params['end_time'])]];
|
||||
}
|
||||
if (isset($params['refund_status']) && $params['refund_status'] != '') {
|
||||
$where[] = ['r.refund_status', '=', $params['refund_status']];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$lists = (new RefundRecord())->alias('r')
|
||||
->field('r.*,u.nickname,u.avatar')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->order(['r.id' => 'desc'])
|
||||
->where($where)
|
||||
->page($pageNo, $pageSize)
|
||||
->append(['refund_type_text', 'refund_status_text', 'refund_way_text'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
foreach ($lists as &$item) {
|
||||
$item['avatar'] = FileService::getFileUrl($item['avatar']);
|
||||
}
|
||||
$count = (new RefundRecord())->alias('r')
|
||||
->field('r.*,u.nickname,u.avatar')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->order(['r.id' => 'desc'])
|
||||
->where($where)->count();
|
||||
$extend = (new RefundRecord())->alias('r')
|
||||
->join('user u', 'u.id = r.user_id')
|
||||
->field([
|
||||
'count(r.id) as total',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_ING.', true, null)) as ing',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_SUCCESS.', true, null)) as success',
|
||||
'count(if(r.refund_status='.RefundEnum::REFUND_ERROR.', true, null)) as error',
|
||||
])
|
||||
->where($where)
|
||||
->select()->toArray();
|
||||
$result = [
|
||||
'lists' => $lists,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize,
|
||||
'extend' => array_shift($extend)
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 退款日志
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2023/3/1 9:47
|
||||
*/
|
||||
public function log()
|
||||
{
|
||||
$params = $this->request->post(['record_id']);
|
||||
$recordId = $params['record_id'] ?? 0;
|
||||
$result = RefundLogic::refundLog($recordId);
|
||||
return $this->success('', $result);
|
||||
}
|
||||
|
||||
}
|
180
app/middleapi/controller/ShopContractController.php
Normal file
180
app/middleapi/controller/ShopContractController.php
Normal file
@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\logic\ShopContractLogic;
|
||||
use app\adminapi\validate\ShopContractValidate;
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\api\logic\SmsLogic;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\logic\contract\ContractLogic;
|
||||
use app\common\model\ShopContract;
|
||||
use app\common\model\ShopMerchant;
|
||||
use think\response\Json;
|
||||
|
||||
class ShopContractController extends BaseLikeAdminController
|
||||
{
|
||||
//商户合同列表
|
||||
public function lists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size','contract_no','party_a','party_b','status']);
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$where = [];
|
||||
if(!empty($params['contract_no'])){
|
||||
$where[] = ['contract_no','like','%'.$params['contract_no'].'%'];
|
||||
}
|
||||
if(isset($params['party_a']) && $params['party_a']!=''){
|
||||
$arr= ShopMerchant::where('company_name','like','%'.$params['party_a'].'%')->column('id');
|
||||
if($arr){
|
||||
$where[]=['party_a','in',$arr];
|
||||
}
|
||||
}
|
||||
if(isset($params['party_b']) && $params['party_b']!=''){
|
||||
$arr= ShopMerchant::where('company_name','like','%'.$params['party_b'].'%')->column('id');
|
||||
if($arr){
|
||||
$where[]=['party_b','in',$arr];
|
||||
}
|
||||
}
|
||||
if(isset($params['status']) && in_array($params['status'],[0,1])){
|
||||
$where[] = ['status','=',$params['status']];
|
||||
}
|
||||
|
||||
$data = ShopContract::where($where)
|
||||
->field(['id', 'contract_no', 'party_a', 'party_b', 'area_manager', 'type', 'evidence_url', 'check_status', 'status', 'notes'])
|
||||
->page($pageNo, $pageSize)->order(['id' => 'desc'])
|
||||
->with(['partyA', 'partyB'])->select()->toArray();
|
||||
$count = ShopContract::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
//商户合同详情
|
||||
public function detail(): Json
|
||||
{
|
||||
$params = (new ShopContractValidate())->post()->goCheck('detail');
|
||||
$result = ShopContractLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
//商户合同审核后
|
||||
public function check(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id','file']);
|
||||
if(empty($params['id']) || empty($params['file'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$res = ShopContract::where('id', $params['id'])->update(['file' => $params['file'], 'check_status' => 2]);
|
||||
if ($res) {
|
||||
$find = ShopContract::where('id', $params['id'])->field('type,party_b,party_a')->find()->toArray();
|
||||
$find['party_a_info'] = ShopMerchant::where('id', $find['party_a'])->field('company_name name,master_phone phone')->find()->toArray();
|
||||
$find['party_b_info'] = ShopMerchant::where('id', $find['party_b'])->field('company_name name,master_phone phone')->find()->toArray();
|
||||
$a = [
|
||||
'mobile' => $find['party_a_info']['phone'],
|
||||
'name' => $find['party_a_info']['name'],
|
||||
'scene' => 'WQTZ'
|
||||
];
|
||||
SmsLogic::contractUrl($a);
|
||||
$b = [
|
||||
'mobile' => $find['party_b_info']['phone'],
|
||||
'name' => $find['party_b_info']['name'],
|
||||
'scene' => 'WQTZ'
|
||||
];
|
||||
SmsLogic::contractUrl($b);
|
||||
return $this->success('上传成功', [], 1, 1);
|
||||
} else {
|
||||
if ($res == 0) {
|
||||
return $this->success('没有更新', [], 1, 1);
|
||||
}
|
||||
return $this->fail('上传失败');
|
||||
}
|
||||
}
|
||||
|
||||
//商户合同备注
|
||||
public function note(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id','notes']);
|
||||
if(empty($params['id']) || empty($params['notes'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$shopContract = ShopContract::where('id', $params['id'])->find();
|
||||
if (empty($shopContract)) {
|
||||
return $this->fail('合同不存在');
|
||||
}
|
||||
$shopContract->notes = $params['notes'];
|
||||
$shopContract->save();
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
//发送合同
|
||||
public function draftContract(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$result = ShopContractLogic::Draftingcontracts($params);
|
||||
if ($result) {
|
||||
return $this->success('生成合同成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(ContractLogic::getError());
|
||||
}
|
||||
|
||||
//发送短信
|
||||
public function sendSms(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$re = ShopContractLogic::postsms($params);
|
||||
if (!$re) {
|
||||
return $this->fail(ShopContractLogic::getError());
|
||||
}
|
||||
return $this->success('成功');
|
||||
}
|
||||
|
||||
//下载证据包
|
||||
public function evidence()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
$detail=ShopContract::where('id',$params['id'])->find();
|
||||
if(!empty($detail['evidence_url'])){
|
||||
return $this->success('获取成功', ['url' => env('url.url_prefix').$detail['evidence_url']]);
|
||||
}
|
||||
$company=ShopMerchant::where('id',$detail['party_a'])->find();
|
||||
$request = array(
|
||||
"applyNo" => $detail['contract_no'],
|
||||
"fullName" => $company['company_name'],
|
||||
"identityCard" => $company['organization_code'],
|
||||
"identityType" => 12,
|
||||
);
|
||||
return app(JunziqianController::class)->EvidenceShopDownload($request);
|
||||
}
|
||||
}
|
106
app/middleapi/controller/TaskSchedulingController.php
Normal file
106
app/middleapi/controller/TaskSchedulingController.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\model\Company;
|
||||
use app\adminapi\validate\task_scheduling\TaskSchedulingValidate;
|
||||
use app\common\logic\task_scheduling\TaskSchedulingLogic;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
/**
|
||||
* 任务公司排期控制器
|
||||
* Class TaskSchedulingController
|
||||
* @package app\adminapi\controller\task_scheduling
|
||||
*/
|
||||
class TaskSchedulingController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取任务公司排期列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['page_no','page_size','company_id']);
|
||||
$where = [];
|
||||
if (isset($params['company_id']) && $params['company_id'] != '') {
|
||||
$arr = Company::where('company_name', 'like', '%' . $params['company_id'] . '%')->column('id');
|
||||
if ($arr) {
|
||||
$where[] = ['company_id', 'in', $arr];
|
||||
} else {
|
||||
$where[] = ['company_id', 'in', [0]];
|
||||
}
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$data = TaskScheduling::where($where)
|
||||
->with(['admin', 'company', 'company_type'])
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
$count = TaskScheduling::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 编辑任务公司排期
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new TaskSchedulingValidate())->post()->goCheck('edit');
|
||||
$result = TaskSchedulingLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskSchedulingLogic::getError());
|
||||
}
|
||||
|
||||
//编辑金额
|
||||
public function editMoney()
|
||||
{
|
||||
$params = $this->request->param();
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('缺少必要参数id');
|
||||
}
|
||||
if(empty($params['money'])){
|
||||
return $this->fail('缺少必要参数金额');
|
||||
}
|
||||
$moeny = $params['money'];
|
||||
$result = TaskScheduling::where(['id'=>$params['id']])->update(['money'=>$moeny]);
|
||||
if ( $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail('编辑失败');
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 获取任务公司排期详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:08
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new TaskSchedulingValidate())->post()->goCheck('detail');
|
||||
$result = TaskSchedulingLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
|
||||
}
|
62
app/middleapi/controller/TaskSchedulingPlanController.php
Normal file
62
app/middleapi/controller/TaskSchedulingPlanController.php
Normal file
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\model\task_scheduling_plan\TaskSchedulingPlan;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
/**
|
||||
* 任务排期日历控制器
|
||||
* Class TaskSchedulingPlanController
|
||||
* @package app\adminapi\controller\task_scheduling_plan
|
||||
*/
|
||||
class TaskSchedulingPlanController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取任务排期日历列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/08 10:34
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['page_no','page_size','template_id','scheduling_id','status','start_time','end_time']);
|
||||
$where = [];
|
||||
if (isset($params['template_id']) && $params['template_id'] != '') {
|
||||
$where[] = ['template_id', '=', $params['template_id']];
|
||||
}
|
||||
if (isset($params['scheduling_id']) && $params['scheduling_id'] != '') {
|
||||
$where[] = ['scheduling_id', '=', $params['scheduling_id']];
|
||||
}
|
||||
if (isset($params['status']) && $params['status'] != '') {
|
||||
$where[] = ['status', '=', $params['status']];
|
||||
}
|
||||
if (isset($params['start_time']) && $params['start_time'] != '') {
|
||||
$where[] = ['start_time', '>=', strtotime($params['start_time'])];
|
||||
}
|
||||
if (isset($params['end_time']) && $params['end_time'] != '') {
|
||||
$where[] = ['end_time', '<=', strtotime($params['end_time'])];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$data = TaskSchedulingPlan::where($where)
|
||||
->with(['template','templateInfo'])
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
$count = TaskSchedulingPlan::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
}
|
142
app/middleapi/controller/TaskTemplateController.php
Normal file
142
app/middleapi/controller/TaskTemplateController.php
Normal file
@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\logic\task_template\TaskTemplateLogic;
|
||||
use app\adminapi\validate\task_template\TaskTemplateValidate;
|
||||
use app\common\model\Company;
|
||||
use app\common\model\task_template\TaskTemplate;
|
||||
use app\common\model\task_scheduling\TaskScheduling;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
/**
|
||||
* 任务模板控制器
|
||||
* Class TaskTemplateController
|
||||
* @package app\adminapi\controller\task_template
|
||||
*/
|
||||
class TaskTemplateController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 获取任务模板列表
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params=$this->request->post(['page_no','page_size','title', 'type', 'status', 'company_id']);
|
||||
$where = [];
|
||||
if (isset($params['title']) && $params['title'] != '') {
|
||||
$where[] = ['title', 'like', '%' . $params['title'] . '%'];
|
||||
}
|
||||
if (isset($params['type']) && $params['type'] != '') {
|
||||
$where[] = ['type', '=', $params['type']];
|
||||
}
|
||||
if (isset($params['status']) && $params['status'] != '') {
|
||||
$where[] = ['status', '=', $params['status']];
|
||||
}
|
||||
if (isset($params['company_id']) && $params['company_id'] != '') {
|
||||
$where[] = ['company_id', '=', $params['company_id']];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$data = TaskTemplate::where($where)
|
||||
->with(['admin','data_type'])
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
$count = TaskTemplate::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $data,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 添加任务模板
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function add()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('add');
|
||||
$params['admin_id'] = 1;
|
||||
if (empty($params['extend'])) {
|
||||
$params['extend'] = '{}';
|
||||
}
|
||||
$company = Company::find($params['company_id']);
|
||||
if ($company->company_type == 41) {
|
||||
// 创建 镇农科公司 任务模板
|
||||
$result = TaskTemplateLogic::addTownTaskTemplate($params);
|
||||
} else if ($company->company_type == 17) {
|
||||
$result = TaskTemplateLogic::addVillageTaskTemplate($params);
|
||||
} else {
|
||||
$result = TaskTemplateLogic::add($params);
|
||||
}
|
||||
if (true === $result) {
|
||||
TaskTemplateLogic::initCompanyWithdrawDeadline($params['company_id']);
|
||||
return $this->success('添加成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskTemplateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 编辑任务模板
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function edit()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('edit');
|
||||
if (empty($params['extend'])) {
|
||||
$params['extend'] = '{}';
|
||||
}
|
||||
$params['admin_id'] = 1;
|
||||
$result = TaskTemplateLogic::edit($params);
|
||||
if (true === $result) {
|
||||
return $this->success('编辑成功', [], 1, 1);
|
||||
}
|
||||
return $this->fail(TaskTemplateLogic::getError());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 删除任务模板
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('delete');
|
||||
TaskTemplateLogic::delete($params);
|
||||
return $this->success('删除成功', [], 1, 1);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @notes 获取任务模板详情
|
||||
* @return \think\response\Json
|
||||
* @author likeadmin
|
||||
* @date 2023/08/06 17:30
|
||||
*/
|
||||
public function detail()
|
||||
{
|
||||
$params = (new TaskTemplateValidate())->post()->goCheck('detail');
|
||||
$result = TaskTemplateLogic::detail($params);
|
||||
return $this->data($result);
|
||||
}
|
||||
|
||||
}
|
46
app/middleapi/controller/UploadController.php
Normal file
46
app/middleapi/controller/UploadController.php
Normal file
@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\service\UploadService;
|
||||
use Exception;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
|
||||
/**
|
||||
* 字典数据
|
||||
* Class DictDataController
|
||||
* @package app\adminapi\controller\dictionary
|
||||
*/
|
||||
class UploadController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
public function image()
|
||||
{
|
||||
try {
|
||||
$cid = $this->request->post('cid', 0);
|
||||
$result = UploadService::image($cid);
|
||||
return $this->success('上传成功', $result);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @notes 上传文件
|
||||
* @return Json
|
||||
* @author 段誉
|
||||
* @date 2021/12/29 16:27
|
||||
*/
|
||||
public function file()
|
||||
{
|
||||
try {
|
||||
$cid = $this->request->post('cid', 0);
|
||||
$result = UploadService::file($cid);
|
||||
return $this->success('上传成功', $result);
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
89
app/middleapi/controller/UserController.php
Normal file
89
app/middleapi/controller/UserController.php
Normal file
@ -0,0 +1,89 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\common\enum\user\AccountLogEnum;
|
||||
use app\common\model\user\User;
|
||||
use app\common\model\user\UserRole;
|
||||
use app\common\enum\user\UserTerminalEnum;
|
||||
use think\facade\Db;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
/***
|
||||
* 用户控制器
|
||||
* Class AccountLogController
|
||||
* @package app\adminapi\controller
|
||||
*/
|
||||
class UserController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
/**
|
||||
* @notes 账户流水明细
|
||||
* @return \think\response\Json
|
||||
* @author 段誉
|
||||
* @date 2023/2/24 15:25
|
||||
*/
|
||||
public function lists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size', 'account', 'mobile', 'company_id']);
|
||||
$where = [];
|
||||
if(isset($params['company_id']) && $params['company_id'] > 0){
|
||||
$where[] = ['company_id', '=', $params['company_id']];
|
||||
}
|
||||
if(isset($params['account']) && $params['account'] != ''){
|
||||
$where[] = ['account', '=', $params['account']];
|
||||
}
|
||||
if(isset($params['mobile']) && $params['mobile'] != ''){
|
||||
$where[] = ['mobile', 'like', '%'.$params['mobile'].'%'];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$field = "id,id contract,sn,nickname,sex,avatar,account,mobile,channel,create_time,admin_id,company_id,street,street as street_name,is_contract";
|
||||
$lists = User::where($where)
|
||||
->with(['company'])
|
||||
->page($pageNo, $pageSize)
|
||||
->field($field)
|
||||
->order('id desc')
|
||||
->select()
|
||||
->toArray();
|
||||
foreach ($lists as &$item) {
|
||||
$item['channel'] = UserTerminalEnum::getTermInalDesc($item['channel']);
|
||||
}
|
||||
$count = User::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $lists,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
public function roleLists()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size']);
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$lists = UserRole::field(['id', 'name', 'desc', 'menu_arr', 'sort'])
|
||||
->page($pageNo, $pageSize)
|
||||
->order(['id' => 'desc'])
|
||||
->select()
|
||||
->toArray();
|
||||
|
||||
$count = UserRole::count();
|
||||
$result = [
|
||||
'lists' => $lists,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
}
|
314
app/middleapi/controller/VehicleController.php
Normal file
314
app/middleapi/controller/VehicleController.php
Normal file
@ -0,0 +1,314 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\api\controller\JunziqianController;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
use app\common\enum\notice\NoticeEnum;
|
||||
use app\common\model\contract\VehicleContract;
|
||||
use app\common\model\vehicle\VehicleRent;
|
||||
use think\response\Json;
|
||||
|
||||
class VehicleController extends BaseLikeAdminController
|
||||
{
|
||||
//三轮车合同列表
|
||||
public function lists(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$param = $this->request->post(['page_no','page_size','company_name','contract_no','status']);
|
||||
$where = [];
|
||||
if(isset($param['company_name'])){
|
||||
$where[] = ['company_b_name','like','%'.$param['company_name'].'%'];
|
||||
}
|
||||
if(isset($param['contract_no'])){
|
||||
$where[] = ['contract_no','like','%'.$param['contract_no'].'%'];
|
||||
}
|
||||
if(isset($param['status']) && in_array($param['status'],[0,1])){
|
||||
if($param['status'] == 1){
|
||||
$where[] = ['status','in', '1,2,3'];
|
||||
}else{
|
||||
$where[] = ['status','=', $param['status']];
|
||||
}
|
||||
}else{
|
||||
$where[] = ['status','in', '0,1,2,3'];
|
||||
}
|
||||
$pageNo = !empty($param['page_no']) ? $param['page_no'] : 1;
|
||||
$pageSize = !empty($param['page_size']) ? $param['page_size'] : 20;
|
||||
$data = VehicleContract::where($where)
|
||||
->page($pageNo, $pageSize)
|
||||
->order('create_time desc')
|
||||
->select()->each(function($item){
|
||||
$item['cars_info'] = json_decode($item['cars_info'],true);
|
||||
});
|
||||
return $this->success('success',['lists'=>$data->toArray(),'page_no'=>$pageNo,'page_size'=>$pageSize,'count'=>$data->count()]);
|
||||
}
|
||||
|
||||
//三轮车合同详情
|
||||
public function detail(): Json
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$id = $this->request->post('id');
|
||||
if(empty($id)){
|
||||
$this->fail('参数错误');
|
||||
}
|
||||
$data = VehicleContract::where('id',$id)->findOrEmpty();
|
||||
if($data->isEmpty()){
|
||||
return $this->fail('未查找到数据');
|
||||
}
|
||||
$cars = json_decode($data['cars_info'],true);
|
||||
//判断合同类型
|
||||
if(!empty($data['contract_logistic_id']) && $data['type'] == 0){
|
||||
$carList = curl_get(env('project.logistic_domain').'/api/getAvailableVehicles');
|
||||
$data['car_list'] = $carList&&$carList['code']==1 ? $carList['data'] : [];
|
||||
}
|
||||
if(!empty($cars)){
|
||||
foreach ($cars as $k=>$v) {
|
||||
if($data['type'] == 0){
|
||||
$cars[$k]['type'] = 0;
|
||||
}
|
||||
if($data['type'] == 1){
|
||||
if(empty($v['id'])){
|
||||
$cars[$k]['type'] = 1;
|
||||
}else{
|
||||
$rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
|
||||
if($rentInfo->isEmpty()){
|
||||
$cars[$k]['type'] = 0;
|
||||
}else{
|
||||
$cars[$k]['type'] = $rentInfo['type'];
|
||||
}
|
||||
}
|
||||
}
|
||||
if($data['type'] == 2){
|
||||
$rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
|
||||
if($rentInfo->isEmpty()){
|
||||
$cars[$k]['type'] = 0;
|
||||
}else{
|
||||
$cars[$k]['type'] = $rentInfo['type'];
|
||||
}
|
||||
}
|
||||
if($data['type'] == 3){
|
||||
$rentInfo = VehicleRent::where('car_id',$v['id'])->findOrEmpty();
|
||||
if($rentInfo->isEmpty()){
|
||||
$cars[$k]['type'] = 2;
|
||||
}else{
|
||||
$cars[$k]['type'] = $rentInfo['type'];
|
||||
}
|
||||
}
|
||||
$cars[$k]['rent_time'] = $data['update_time'];
|
||||
}
|
||||
}
|
||||
$data['cars_info'] = $cars;
|
||||
return $this->success('success',$data->toArray());
|
||||
}
|
||||
|
||||
//上传三轮车合同
|
||||
public function uploadContract(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['id','file','cars']);
|
||||
if(empty($params['id']) || empty($params['file'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
//获取合同信息
|
||||
$vehicle_contract = VehicleContract::where('id',$params['id'])->findOrEmpty();
|
||||
if($vehicle_contract->isEmpty()){
|
||||
return $this->fail('合同信息错误');
|
||||
}
|
||||
if($vehicle_contract['type']==0 && $vehicle_contract['contract_logistic_id'] != 0){
|
||||
if(empty($params['cars'])){
|
||||
return $this->fail('缺少必要参数cars');
|
||||
}
|
||||
$cars = json_decode($params['cars'],true);
|
||||
if(empty($cars)){
|
||||
return $this->fail('参数cars无效');
|
||||
}
|
||||
}
|
||||
if($vehicle_contract['status'] != 0){
|
||||
return $this->fail('合同状态错误');
|
||||
}
|
||||
//更新本地
|
||||
try {
|
||||
$data = [
|
||||
'id' => $vehicle_contract['contract_logistic_id'],
|
||||
'file' => $params['file'],
|
||||
'status' => 1,
|
||||
'update_time' => time()
|
||||
];
|
||||
//判断合同类型
|
||||
if($vehicle_contract['type'] == 0 && $vehicle_contract['contract_logistic_id'] != 0){
|
||||
$data['cars_info'] = $params['cars'];
|
||||
}
|
||||
if(!empty($vehicle_contract['contract_logistic_id'])){
|
||||
//更新物流系统
|
||||
curl_post(env('project.logistic_domain').'/api/contractUpdate',[],$data);
|
||||
}
|
||||
unset($data['id']);
|
||||
VehicleContract::where('id', $params['id'])->update($data);
|
||||
|
||||
}catch (\Exception $e){
|
||||
return $this->fail($e->getMessage());
|
||||
}
|
||||
return $this->success('上传成功', [], 1, 1);
|
||||
}
|
||||
|
||||
//发起三轮车合同
|
||||
public function initiatingContract(): Json
|
||||
{
|
||||
//获取参数
|
||||
$params = $this->request->post(['id']);
|
||||
if(empty($params['id'])){
|
||||
return $this->fail('缺少必要参数');
|
||||
}
|
||||
//获取数据
|
||||
$contract = VehicleContract::where('id',$params['id'])->findOrEmpty();
|
||||
if($contract->isEmpty()){
|
||||
return $this->fail('数据不存在');
|
||||
}
|
||||
if(!($contract['status'] == 1 || ($contract['status'] == 2 && $contract['signing_timer'] != 2))){
|
||||
return $this->fail('合同状态错误');
|
||||
}
|
||||
$signData = [
|
||||
'name' => $contract['company_a_name'] . '的合同',
|
||||
'signatories' => [
|
||||
['fullName' => $contract['company_a_name'], 'identityType' => 12, 'identityCard' => $contract['company_a_code'], 'email' => $contract['company_a_email'], 'noNeedVerify' => 1, 'signLevel' => 1],
|
||||
['fullName' => $contract['company_b_name'], 'identityType' => 12, 'identityCard' => $contract['company_b_code'], 'email' => $contract['company_b_email'], 'noNeedVerify' => 1, 'signLevel' => 1]
|
||||
],
|
||||
'url' => $contract['file']
|
||||
];
|
||||
$notify_url = '';
|
||||
$smsTitle = '';
|
||||
if($contract['type'] == 0){
|
||||
$smsTitle = '《租赁合同》';
|
||||
if(empty($contract['contract_logistic_id'])){
|
||||
$notify_url = env('project.website_domain').'/api/index/systemCarRent';
|
||||
}else{
|
||||
$notify_url = env('project.website_domain').'/api/index/townCarRent';
|
||||
}
|
||||
}elseif($contract['type'] == 1){
|
||||
$smsTitle = '《自有车辆上传合同》';
|
||||
$notify_url = env('project.website_domain').'/api/index/selfCarRent';
|
||||
}elseif($contract['type'] == 2){
|
||||
$smsTitle = '《解约合同》';
|
||||
$notify_url = env('project.website_domain').'/api/index/cancelRent';
|
||||
}elseif($contract['type'] == 3){
|
||||
$smsTitle = '《购买合同》';
|
||||
$notify_url = env('project.website_domain').'/api/index/buyCar';
|
||||
}
|
||||
$signRes = app(JunziqianController::class)->VehicleRentSigning($signData, $params['id'],$notify_url);
|
||||
if ($signRes->success) {
|
||||
$contract->save([
|
||||
'id' => $contract['id'],
|
||||
'contract_no' => $signRes->data,
|
||||
'status' => 2,
|
||||
'signing_timer' => 0
|
||||
]);
|
||||
if(!empty($contract['contract_logistic_id'])){
|
||||
curl_post(env('project.logistic_domain').'/api/contractUpdate',[],[
|
||||
'id' => $contract['contract_logistic_id'],
|
||||
'contract_no' => $signRes->data,
|
||||
'status' => 2,
|
||||
'signing_timer' => 0,
|
||||
'update_time' => time()
|
||||
]);
|
||||
}
|
||||
$this->sendSms($params['id'],$smsTitle);
|
||||
return $this->success('合同发送成功');
|
||||
} else {
|
||||
return $this->fail($signRes->msg);
|
||||
}
|
||||
}
|
||||
|
||||
//重新发送三轮车合同短信
|
||||
public function sendSmsAgain(): Json
|
||||
{
|
||||
//获取参数
|
||||
$id = $this->request->post('id');
|
||||
if(empty($id)){
|
||||
return $this->fail('参数错误');
|
||||
}
|
||||
//获取数据
|
||||
$contract = VehicleContract::where('id',$id)->find();
|
||||
if(empty($contract)){
|
||||
return $this->fail('数据错误');
|
||||
}
|
||||
$smsTitle = '';
|
||||
if($contract['type'] == 0){
|
||||
$smsTitle = '《租赁合同》';
|
||||
}elseif($contract['type'] == 1){
|
||||
$smsTitle = '《自有车辆上传合同》';
|
||||
}elseif($contract['type'] == 2){
|
||||
$smsTitle = '《解约合同》';
|
||||
}elseif($contract['type'] == 3){
|
||||
$smsTitle = '《购买合同》';
|
||||
}
|
||||
$this->sendSms($id,$smsTitle);
|
||||
return $this->success('发送成功');
|
||||
}
|
||||
|
||||
protected function sendSms($id,$title): bool
|
||||
{
|
||||
//获取合同数据
|
||||
$contract = VehicleContract::where('id',$id)->findOrEmpty();
|
||||
if (!$contract->isEmpty() && $contract['file'] != '') {
|
||||
//发送短信
|
||||
$data = [
|
||||
//甲方
|
||||
[
|
||||
"applyNo" => $contract['contract_no'],
|
||||
"fullName" => $contract['company_a_name'],
|
||||
"identityCard" => $contract['company_a_code'],
|
||||
"identityType" => 12,
|
||||
"master_phone" => $contract['company_a_phone'],
|
||||
"type"=>"party_a"
|
||||
],
|
||||
//乙方
|
||||
[
|
||||
"applyNo" => $contract['contract_no'],
|
||||
"fullName" => $contract['company_b_name'],
|
||||
"identityCard" => $contract['company_b_code'],
|
||||
"identityType" => 12,
|
||||
"master_phone" => $contract['company_b_phone'],
|
||||
"type"=>"party_b"
|
||||
|
||||
],
|
||||
];
|
||||
|
||||
$url = [];
|
||||
foreach ($data as $v) {
|
||||
$res = app(JunziqianController::class)->SigningLink($v);
|
||||
if (!$res->success) {
|
||||
return false;
|
||||
}
|
||||
if ($v['type'] == 'party_a') {
|
||||
$url['party_a'] =$res->data;
|
||||
} else {
|
||||
$url['party_b'] =$res->data;
|
||||
}
|
||||
//发送短信
|
||||
$sms = [
|
||||
'mobile' => $v['master_phone'],
|
||||
'name' => $v['fullName'],
|
||||
'type' => $title,
|
||||
'code' => 'api/Hetong/info?id='.$id.'&type='.$v['type'],
|
||||
'scene' => 'WQ'
|
||||
];
|
||||
$scene = NoticeEnum::getSceneByTag($sms['scene']);
|
||||
if (empty($scene)) {
|
||||
throw new \Exception('场景值异常');
|
||||
}
|
||||
event('Notice', [
|
||||
'scene_id' => $scene,
|
||||
'params' => $sms
|
||||
]);
|
||||
}
|
||||
VehicleContract::where('id', $id)->update(['url' => json_encode($url)]);
|
||||
return true;
|
||||
}else{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
106
app/middleapi/controller/WithdrawController.php
Normal file
106
app/middleapi/controller/WithdrawController.php
Normal file
@ -0,0 +1,106 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\controller;
|
||||
|
||||
use app\adminapi\lists\finance\WithdrawLists;
|
||||
use app\common\logic\finance\WithdrawLogic;
|
||||
use app\common\model\user\Withdraw;
|
||||
use think\Exception;
|
||||
use app\common\controller\BaseLikeAdminController;
|
||||
|
||||
class WithdrawController extends BaseLikeAdminController
|
||||
{
|
||||
|
||||
public function index()
|
||||
{
|
||||
if(!$this->request->isPost()){
|
||||
return $this->fail('请求方式错误');
|
||||
}
|
||||
$params = $this->request->post(['page_no','page_size', 'order_sn', 'status']);
|
||||
$where = [];
|
||||
if (!empty($params['order_sn'])) {
|
||||
$where[] = ['order_sn', '=', $params['order_sn']];
|
||||
}
|
||||
if (isset($params['status']) && $params['status'] != '') {
|
||||
$where[] = ['status', '=', $params['status']];
|
||||
}
|
||||
$pageNo = !empty($params['page_no']) ? $params['page_no'] : 1;
|
||||
$pageSize = !empty($params['page_size']) ? $params['page_size'] : 20;
|
||||
$lists = Withdraw::where($where)
|
||||
->append(['s_date', 'e_date', 'company_name'], true)
|
||||
->with('user')
|
||||
->withAttr('company_name', function ($value, $data) {
|
||||
$company = Company::where(['admin_id'=>$data['admin_id']])->find();
|
||||
return $company['company_name']??'';
|
||||
})
|
||||
->withAttr('s_date', function ($value, $data) {
|
||||
$withdrawedCount = Withdraw::where(['user_id'=>$data['user_id'], 'status'=>3])->count();
|
||||
$company = Company::where(['admin_id'=>$data['admin_id']])->find();
|
||||
if ($withdrawedCount == 0) {
|
||||
$firstUserLog = UserAccountLog::where(['company_id'=>$company['id'] ?? 0])->order('id', 'asc')->find();
|
||||
return $firstUserLog['create_time'] ?? '';
|
||||
} else {
|
||||
$withdrawedCount = Withdraw::where(['user_id'=>$data['user_id'], 'status'=>3])->order('id', 'desc')->find();
|
||||
return $withdrawedCount['transfer_end_cycel'] ?? '';
|
||||
}
|
||||
})
|
||||
->withAttr('e_date', function ($value, $data) {
|
||||
return date('Y-m-d H:i:s', $data['transfer_end_cycel']);
|
||||
})
|
||||
->order('id', 'desc')
|
||||
->page($pageNo, $pageSize)
|
||||
->select()
|
||||
->toArray();
|
||||
$count = Withdraw::where($where)->count();
|
||||
$result = [
|
||||
'lists' => $lists,
|
||||
'count' => $count,
|
||||
'page_no' => $pageNo,
|
||||
'page_size' => $pageSize
|
||||
];
|
||||
return $this->success('请求成功',$result);
|
||||
}
|
||||
|
||||
public function update()
|
||||
{
|
||||
$id = $this->request->param('id');
|
||||
$status = $this->request->param('status');
|
||||
if (empty($id)) {
|
||||
return $this->fail('参数id不能为空');
|
||||
}
|
||||
if (!in_array($status, [1, 2, 3])) {
|
||||
return $this->fail('参数status错误');
|
||||
}
|
||||
$data = Withdraw::find($id);
|
||||
if (empty($data)) {
|
||||
return $this->fail('数据不存在');
|
||||
}
|
||||
$data->status = $status;
|
||||
$data->udpate_time = time();
|
||||
$data->save();
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现申请审核
|
||||
*/
|
||||
public function audit()
|
||||
{
|
||||
try {
|
||||
$params = $this->request->param();
|
||||
if (empty($params['id'])) {
|
||||
return $this->fail('参数id不能为空');
|
||||
}
|
||||
if (empty($params['status'])) {
|
||||
return $this->fail('参数status不能为空');
|
||||
}
|
||||
$re = WithdrawLogic::audit($params);
|
||||
if (!$re) {
|
||||
return $this->fail(WithdrawLogic::getError());
|
||||
}
|
||||
return $this->success('操作成功', [], 1, 1);
|
||||
} catch (Exception $exception) {
|
||||
return $this->fail($exception->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
27
app/middleapi/http/middleware/AuthMiddleware.php
Normal file
27
app/middleapi/http/middleware/AuthMiddleware.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace app\middleapi\http\middleware;
|
||||
|
||||
use app\middleapi\service\ApiSignService;
|
||||
use app\common\service\JsonService;
|
||||
|
||||
class AuthMiddleware
|
||||
{
|
||||
public function handle($request, \Closure $next)
|
||||
{
|
||||
//获取header参数
|
||||
$appid = $request->header('appid');
|
||||
$timestamp = $request->header('timestamp');
|
||||
$sign = $request->header('sign');
|
||||
//验证参数
|
||||
if(empty($appid) || empty($timestamp) || empty($sign)){
|
||||
return JsonService::fail('缺少请求头参数', [], 0);
|
||||
}
|
||||
//验证签名
|
||||
$checkSign = ApiSignService::verifySign(['appid'=>$appid,'timestamp'=>$timestamp,'sign'=>$sign],env('app.app_secret'));
|
||||
if($checkSign['code'] == 0){
|
||||
return JsonService::fail($checkSign['msg'],[],0);
|
||||
}
|
||||
return $next($request);
|
||||
}
|
||||
}
|
39
app/middleapi/service/ApiSignService.php
Normal file
39
app/middleapi/service/ApiSignService.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
namespace app\middleapi\service;
|
||||
|
||||
class ApiSignService
|
||||
{
|
||||
//创建sign
|
||||
public static function makeSign($data,$appSecret): string
|
||||
{
|
||||
ksort($data);
|
||||
$string = "";
|
||||
foreach ($data as $k => $v) {
|
||||
if ($k == "sign" || is_array($v)) {
|
||||
continue;
|
||||
}
|
||||
$string .= $k . "=" . $v . "&";
|
||||
}
|
||||
$string = trim($string, "&");
|
||||
$string = $string . "&key=" . $appSecret;
|
||||
$string = md5(md5($string));
|
||||
return strtolower($string);
|
||||
}
|
||||
|
||||
//检验sign是否正确
|
||||
public static function verifySign($data,$appSecret): array
|
||||
{
|
||||
// 验证请求, 10秒钟失效
|
||||
if (time() - $data['timestamp'] > 10) {
|
||||
return ['code' => 0, 'msg' => '签名已失效'];
|
||||
}
|
||||
//比对签名
|
||||
$clientSign = $data['sign'];
|
||||
$serverSign = self::makeSign($data,$appSecret);
|
||||
if ($clientSign == $serverSign) {
|
||||
return ['code' => 1, 'msg' => '验证通过'];
|
||||
} else {
|
||||
return ['code' => 0, 'msg' => '签名校验失败'];
|
||||
}
|
||||
}
|
||||
}
|
@ -44,7 +44,8 @@
|
||||
"jpush/jpush": "^3.6",
|
||||
"topthink/think-filesystem": "^2.0",
|
||||
"alibabacloud/live": "^1.8",
|
||||
"alibabacloud/live-20161101": "1.1.1"
|
||||
"alibabacloud/live-20161101": "1.1.1",
|
||||
"ext-bcmath": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"symfony/var-dumper": "^4.2",
|
||||
|
20
composer.lock
generated
20
composer.lock
generated
@ -5301,11 +5301,22 @@
|
||||
{
|
||||
"name": "textalk/websocket",
|
||||
"version": "1.6.3",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Textalk/websocket-php.git",
|
||||
"reference": "67de79745b1a357caf812bfc44e0abf481cee012"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://mirrors.cloud.tencent.com/repository/composer/textalk/websocket/1.6.3/textalk-websocket-1.6.3.zip",
|
||||
"url": "https://api.github.com/repos/Textalk/websocket-php/zipball/67de79745b1a357caf812bfc44e0abf481cee012",
|
||||
"reference": "67de79745b1a357caf812bfc44e0abf481cee012",
|
||||
"shasum": ""
|
||||
"shasum": "",
|
||||
"mirrors": [
|
||||
{
|
||||
"url": "https://mirrors.aliyun.com/composer/dists/%package%/%reference%.%type%",
|
||||
"preferred": true
|
||||
}
|
||||
]
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4 | ^8.0",
|
||||
@ -5325,6 +5336,7 @@
|
||||
"WebSocket\\": "lib"
|
||||
}
|
||||
},
|
||||
"notification-url": "https://packagist.org/downloads/",
|
||||
"license": [
|
||||
"ISC"
|
||||
],
|
||||
@ -5337,6 +5349,10 @@
|
||||
}
|
||||
],
|
||||
"description": "WebSocket client and server",
|
||||
"support": {
|
||||
"issues": "https://github.com/Textalk/websocket-php/issues",
|
||||
"source": "https://github.com/Textalk/websocket-php/tree/1.6.3"
|
||||
},
|
||||
"time": "2022-11-07T18:59:33+00:00"
|
||||
},
|
||||
{
|
||||
|
@ -50,7 +50,7 @@ return [
|
||||
// 是否严格检查字段是否存在
|
||||
'fields_strict' => true,
|
||||
// 是否需要断线重连
|
||||
'break_reconnect' => false,
|
||||
'break_reconnect' => true,
|
||||
// 监听SQL
|
||||
'trigger_sql' => env('app_debug', true),
|
||||
// 开启字段缓存
|
||||
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
use \Workerman\Worker;
|
||||
use \GatewayWorker\BusinessWorker;
|
||||
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
// bussinessWorker 进程
|
||||
$worker = new BusinessWorker();
|
||||
|
||||
// worker名称
|
||||
$worker->name = 'PushBusinessWorker';
|
||||
|
||||
// bussinessWorker进程数量
|
||||
$worker->count = 4;
|
||||
|
||||
// 服务注册地址
|
||||
$worker->registerAddress = '127.0.0.1:1236';
|
||||
|
||||
// 注册服务类
|
||||
$worker->eventHandler = 'workerim\Events';
|
||||
|
||||
// 如果不是在根目录启动,则运行runAll方法
|
||||
if(!defined('GLOBAL_START'))
|
||||
{
|
||||
Worker::runAll();
|
||||
}
|
||||
|
@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
use \Workerman\Worker;
|
||||
use \GatewayWorker\Gateway;
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
// gateway 进程,这里使用Text协议,可以用telnet测试
|
||||
$gateway = new Gateway("Websocket://0.0.0.0:8282");
|
||||
|
||||
// gateway名称,status方便查看
|
||||
$gateway->name = 'worker_im';
|
||||
|
||||
// gateway进程数,一般设置2个就足够
|
||||
$gateway->count = 4;
|
||||
|
||||
// 本机ip,分布式部署时使用内网ip
|
||||
$gateway->lanIp = '127.0.0.1';
|
||||
|
||||
// 内部通讯起始端口,假如$gateway->count=2,起始端口为2900
|
||||
// 则一般会使用2900 2901 2902 2903 4个端口作为内部通讯端口
|
||||
$gateway->startPort = 2900;
|
||||
|
||||
// 服务注册地址
|
||||
$gateway->registerAddress = '127.0.0.1:1236';
|
||||
|
||||
// 心跳间隔
|
||||
$gateway->pingInterval = 20;
|
||||
|
||||
// 心跳数据
|
||||
$gateway->pingData = '{"type":"ping"}';
|
||||
|
||||
// 如果不是在根目录启动,则运行runAll方法
|
||||
if(!defined('GLOBAL_START'))
|
||||
{
|
||||
Worker::runAll();
|
||||
}
|
||||
|
@ -1,16 +0,0 @@
|
||||
<?php
|
||||
use \Workerman\Worker;
|
||||
use \GatewayWorker\Register;
|
||||
|
||||
// 自动加载类
|
||||
require_once __DIR__ . '/../../vendor/autoload.php';
|
||||
|
||||
// register 必须是text协议,切记不能将register端口开放给外网
|
||||
$register = new Register('text://127.0.0.1:1236');
|
||||
|
||||
// 如果不是在根目录启动,则运行runAll方法
|
||||
if(!defined('GLOBAL_START'))
|
||||
{
|
||||
Worker::runAll();
|
||||
}
|
||||
|
@ -1 +0,0 @@
|
||||
import o from"./error.ab90784a.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.4328d892.js";import"./@vueuse.ec90c285.js";import"./@element-plus.a074d1f6.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.ed71ac09.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
@ -1 +0,0 @@
|
||||
import o from"./error.c52a2209.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.b64c0a90.js";import"./@vueuse.ec90c285.js";import"./@element-plus.a074d1f6.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.f190d0dd.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
1
public/admin/assets/403.385ffa4b.js
Normal file
1
public/admin/assets/403.385ffa4b.js
Normal file
@ -0,0 +1 @@
|
||||
import o from"./error.321207d6.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.10e48c93.js";import"./@vueuse.ec90c285.js";import"./@element-plus.c80b8015.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.8604d989.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
1
public/admin/assets/403.38ece3dc.js
Normal file
1
public/admin/assets/403.38ece3dc.js
Normal file
@ -0,0 +1 @@
|
||||
import o from"./error.4b32e03b.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.10e48c93.js";import"./@vueuse.ec90c285.js";import"./@element-plus.c80b8015.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.f095bcc5.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
@ -1 +0,0 @@
|
||||
import o from"./error.1b553d1e.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.49ac63ff.js";import"./@vueuse.ec90c285.js";import"./@element-plus.a074d1f6.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.e06d2f61.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
1
public/admin/assets/403.4ff9146c.js
Normal file
1
public/admin/assets/403.4ff9146c.js
Normal file
@ -0,0 +1 @@
|
||||
import o from"./error.7b4a2c14.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.10e48c93.js";import"./@vueuse.ec90c285.js";import"./@element-plus.c80b8015.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.8f12c553.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
1
public/admin/assets/403.5d8a5303.js
Normal file
1
public/admin/assets/403.5d8a5303.js
Normal file
@ -0,0 +1 @@
|
||||
import o from"./error.a0933d01.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.10e48c93.js";import"./@vueuse.ec90c285.js";import"./@element-plus.c80b8015.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.5b774352.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
@ -1 +0,0 @@
|
||||
import o from"./error.06f8098f.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.b64c0a90.js";import"./@vueuse.ec90c285.js";import"./@element-plus.a074d1f6.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.d710a8b7.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
@ -1 +0,0 @@
|
||||
import o from"./error.b10dbad5.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.4328d892.js";import"./@vueuse.ec90c285.js";import"./@element-plus.a074d1f6.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.4ff2d535.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
@ -1 +0,0 @@
|
||||
import o from"./error.b20a557d.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.4328d892.js";import"./@vueuse.ec90c285.js";import"./@element-plus.a074d1f6.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.aa9bb752.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
1
public/admin/assets/403.6e6941e3.js
Normal file
1
public/admin/assets/403.6e6941e3.js
Normal file
@ -0,0 +1 @@
|
||||
import o from"./error.dc4cbbcf.js";import{d as r,o as i,c as p,U as m,L as e,a as t}from"./@vue.51d7f2d8.js";import"./element-plus.10e48c93.js";import"./@vueuse.ec90c285.js";import"./@element-plus.c80b8015.js";import"./lodash-es.29c53eac.js";import"./dayjs.e873ead7.js";import"./@amap.8a62addd.js";import"./async-validator.fb49d0f5.js";import"./@ctrl.82a509e0.js";import"./escape-html.e5dfadb9.js";import"./normalize-wheel-es.8aeb3683.js";import"./vue-router.9f65afb1.js";import"./index.844708ff.js";import"./lodash.08438971.js";import"./axios.105476b3.js";import"./pinia.56356cb7.js";import"./vue-demi.b3a9cad9.js";import"./css-color-function.7ac6f233.js";import"./color.44a05936.js";import"./clone.0afcbf90.js";import"./color-convert.755d189f.js";import"./color-name.e7a4e1d3.js";import"./color-string.e356f5de.js";import"./balanced-match.d2a36341.js";import"./debug.86067895.js";import"./ms.a9ae1d6d.js";import"./nprogress.f73355d0.js";import"./vue-clipboard3.dca5bca3.js";import"./clipboard.16e4491b.js";import"./echarts.ac57a99a.js";import"./zrender.d54ce080.js";import"./tslib.60310f1a.js";import"./highlight.js.dba6fa1b.js";import"./@highlightjs.40d5feba.js";const s="/admin/assets/no_perms.a56e95a5.png",a={class:"error404"},u=t("div",{class:"flex justify-center"},[t("img",{class:"w-[150px] h-[150px]",src:s,alt:""})],-1),T=r({__name:"403",setup(c){return(n,_)=>(i(),p("div",a,[m(o,{code:"403",title:"\u60A8\u7684\u8D26\u53F7\u6743\u9650\u4E0D\u8DB3\uFF0C\u8BF7\u8054\u7CFB\u7BA1\u7406\u5458\u6DFB\u52A0\u6743\u9650\uFF01","show-btn":!1},{content:e(()=>[u]),_:1})]))}});export{T as default};
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user