workerskilllogic.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /*
  3. * @Author: wang jun
  4. * @Date: 2021-09-27 09:02:06
  5. * @Last Modified by: wang jun
  6. * @Last Modified time: 2021-10-22 15:46:16
  7. */
  8. namespace app\index\logic;
  9. use app\index\model\userinfomodel;
  10. use app\index\model\workerskillmodel;
  11. class workerskilllogic
  12. {
  13. public function getinfobyid($id)
  14. {
  15. $m_wt = new workerskillmodel();
  16. $where = ['id' => $id];
  17. $info = $m_wt->getInfo($where);
  18. return $info;
  19. }
  20. public function insertinfo($info)
  21. {
  22. $m_wt = new workerskillmodel();
  23. $m_u = new userinfomodel();
  24. if (!isset($info['uid']) || empty($info['uid'])) {
  25. return backarr(0, "请求错误");
  26. }
  27. $uid = $info['uid'];
  28. $userinfo = $m_u->getInfo(['id' => $uid]);
  29. if (empty($userinfo)) {
  30. return backarr(0, "无用户数据");
  31. }
  32. $id = $m_wt->insertData($info);
  33. return backarr(1, "新增成功", ['id' => $id]);
  34. }
  35. public function updateinfobyid($id, $updateData)
  36. {
  37. $m_wt = new workerskillmodel();
  38. $where = ['id' => $id];
  39. $result = $m_wt->updateinfo($where, $updateData);
  40. return $result;
  41. }
  42. public function getlistonepage($arr)
  43. {
  44. $where = [];
  45. $m_wt = new workerskillmodel();
  46. $count = $m_wt->getList($where, 'count');
  47. if ($count <= 0) {
  48. return backarr(0, "无数据");
  49. }
  50. $list = $m_wt->getList($where, '*', 1, 0, "id desc");
  51. return backarr(1, "查询成功", $list);
  52. }
  53. /*
  54. * 20211022
  55. * 获取指定用户的工作技能
  56. * steelxu5
  57. */
  58. public function getlistbyuid($arr){
  59. $uid=$arr['uid'];
  60. $where = ['uid' => $uid];
  61. $m_wt = new workerskillmodel();
  62. $count = $m_wt->getList($where, 'count');
  63. if ($count <= 0) {
  64. return backarr(0, "无数据");
  65. }
  66. $list = $m_wt->getList($where, '*', 1, 0, "id desc");
  67. return backarr(1, "查询成功", $list);
  68. }
  69. }