Index.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. /*
  3. * @Author: wang jun
  4. * @Date: 2022-01-18 10:57:14
  5. * @Last Modified by: wang jun
  6. * @Last Modified time: 2022-01-18 14:03:44
  7. * 微信类
  8. */
  9. namespace app\index\controller;
  10. use app\index\logic\wechatlogic;
  11. use think\Controller;
  12. class Index extends Base
  13. {
  14. /**
  15. * 设置请求数据规则
  16. * 20220107
  17. * wj
  18. */
  19. protected function setrules()
  20. {
  21. $list = [
  22. 'getOpenid' => [
  23. ['name' => 'code', 'title' => 'code', 'require' => true, 'type' => 'string'],
  24. ],
  25. 'create_qrcode' => [
  26. ['name' => 'scene', 'title' => 'scene', 'require' => true, 'type' => 'string'],
  27. ['name' => 'page', 'title' => 'page', 'require' => true, 'type' => 'string'],
  28. ],
  29. 'down_qrcode' => [
  30. ['name' => 'scene', 'title' => 'scene', 'require' => true, 'type' => 'string'],
  31. ['name' => 'page', 'title' => 'page', 'require' => true, 'type' => 'string'],
  32. ],
  33. ];
  34. return $list;
  35. }
  36. public function index()
  37. {
  38. echo "recruit";
  39. }
  40. /**
  41. * 获取openid
  42. * 20220118
  43. * wj
  44. * code 必填
  45. */
  46. public function getOpenid()
  47. {
  48. $param = request()->param();
  49. $l_w = new wechatlogic();
  50. $result = $l_w->getOpenid($param);
  51. if (1 != $result['status']) {
  52. return backjson(0, $result['msg']);
  53. } else {
  54. return backjson(200, $result['data']);
  55. }
  56. }
  57. /**
  58. * 保存二维码
  59. * 20220118
  60. * wj
  61. * scene page 必填
  62. */
  63. public function create_qrcode()
  64. {
  65. $param = request()->param();
  66. $l_w = new wechatlogic();
  67. $result = $l_w->create_qrcode($param);
  68. if (1 != $result['status']) {
  69. return backjson(0, $result['msg']);
  70. } else {
  71. return backjson(200, $result['data']);
  72. }
  73. }
  74. /**
  75. * 保存并下载二维码
  76. * 20220118
  77. * wj
  78. * scene page 必填
  79. */
  80. public function down_qrcode()
  81. {
  82. $param = request()->param();
  83. $l_w = new wechatlogic();
  84. $result = $l_w->down_qrcode($param);
  85. if (1 != $result['status']) {
  86. return backjson(0, $result['msg']);
  87. } else {
  88. return backjson(200, $result['data']);
  89. }
  90. }
  91. }