MasterWorkerAgreeController.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. $result = [
  19. [
  20. 'type'=>'master_privacy',
  21. 'value'=>'隐私政策'
  22. ],
  23. [
  24. 'type'=>'agreement_service_title',
  25. 'value'=>'用户协议'
  26. ],
  27. ];
  28. return $this->data($result);
  29. }
  30. /**
  31. * 我的协议列表
  32. * @return \think\response\Json
  33. */
  34. public function agreement()
  35. {
  36. //服务合作协议是否存在pdf
  37. $pdf = MasterWorkerAgree::where(['agree_type'=>'master_service_content','worker_id'=>$this->userId])->value('pdf_url');
  38. $result = [
  39. [
  40. 'type'=>'master_service',
  41. 'value'=>'服务合作协议',
  42. 'pdf'=> !empty($pdf)?$pdf:''
  43. ],
  44. [
  45. 'type'=>'master_bill',
  46. 'value'=>'开票授权协议'
  47. ],
  48. [
  49. 'type'=>'master_privacy',
  50. 'value'=>'隐私政策'
  51. ],
  52. [
  53. 'type'=>'master_allow',
  54. 'value'=>'工程师软件许可协议'
  55. ],
  56. ];
  57. return $this->data($result);
  58. }
  59. /**
  60. * 协议详情
  61. * @return \think\response\Json
  62. */
  63. public function agreement_detail()
  64. {
  65. $type = $this->request->get('type/s', '');
  66. $result = MasterWorkerAgreeLogic::getAgreeByType($type,$this->userId);
  67. return $this->data($result);
  68. }
  69. /**
  70. * 协议签名
  71. * @return \think\response\Json
  72. */
  73. public function agreeSign()
  74. {
  75. $params = (new MasterWorkerAgreeValidate())->post()->goCheck('sign', [
  76. 'user_id' => $this->userId,
  77. 'user_info' => $this->userInfo
  78. ]);
  79. $result = MasterWorkerAgreeLogic::sign($params);
  80. if (false === $result) {
  81. return $this->fail(MasterWorkerAgreeLogic::getError());
  82. }
  83. MasterWorkerExamineLogic::updateEngineerInformation($params['user_id']);
  84. return $this->success('签名成功', [], 1, 1);
  85. }
  86. }