MasterWorkerAgreeController.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace app\workerapi\controller;
  3. use app\common\command\AddAgreementPdf;
  4. use app\common\logic\MasterWorkerExamineLogic;
  5. use app\common\model\master_worker\MasterWorkerAgree;
  6. use app\workerapi\logic\MasterWorkerAgreeLogic;
  7. use app\workerapi\validate\MasterWorkerAgreeValidate;
  8. class MasterWorkerAgreeController extends BaseApiController
  9. {
  10. public array $notNeedLogin = ['policy'];
  11. public function ceshi()
  12. {
  13. AddAgreementPdf::sendMq('202408181742334617','https://weixiu.zhongdunzhizhao.com/index/agreement/index?code=202408181742334617');
  14. dd(1);
  15. }
  16. public function policy()
  17. {
  18. $type = $this->request->get('type/s', '');
  19. $result = MasterWorkerAgreeLogic::getPolicyByType($type);
  20. return $this->data($result);
  21. }
  22. /**
  23. * 我的协议列表
  24. * @return \think\response\Json
  25. */
  26. public function agreement()
  27. {
  28. //服务合作协议是否存在pdf
  29. $pdf = MasterWorkerAgree::where(['agree_type'=>'master_service_content','worker_id'=>$this->userId])->value('pdf_url');
  30. $result = [
  31. [
  32. 'type'=>'master_service',
  33. 'value'=>'服务合作协议',
  34. 'pdf'=> !empty($pdf)?$pdf:''
  35. ],
  36. [
  37. 'type'=>'master_bill',
  38. 'value'=>'开票授权协议'
  39. ],
  40. [
  41. 'type'=>'master_privacy',
  42. 'value'=>'隐私政策'
  43. ],
  44. [
  45. 'type'=>'master_allow',
  46. 'value'=>'工程师软件许可协议'
  47. ],
  48. ];
  49. return $this->data($result);
  50. }
  51. /**
  52. * 协议详情
  53. * @return \think\response\Json
  54. */
  55. public function agreement_detail()
  56. {
  57. $type = $this->request->get('type/s', '');
  58. $result = MasterWorkerAgreeLogic::getAgreeByType($type,$this->userId);
  59. return $this->data($result);
  60. }
  61. /**
  62. * 协议签名
  63. * @return \think\response\Json
  64. */
  65. public function agreeSign()
  66. {
  67. $params = (new MasterWorkerAgreeValidate())->post()->goCheck('sign', [
  68. 'user_id' => $this->userId,
  69. 'user_info' => $this->userInfo
  70. ]);
  71. $result = MasterWorkerAgreeLogic::sign($params);
  72. if (false === $result) {
  73. return $this->fail(MasterWorkerAgreeLogic::getError());
  74. }
  75. MasterWorkerExamineLogic::updateEngineerInformation($params['user_id']);
  76. return $this->success('签名成功', [], 1, 1);
  77. }
  78. }