UserTaskDb.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /// @Brief 用户任务db
  3. ///
  4. class UserTaskDb implements IUserTaskDb
  5. {
  6. // @function 获取用户任务
  7. //
  8. // @param userId 用户编号
  9. // @return 用户任务列表
  10. public function getUserTaskByUserId($userId){
  11. $db = new MysqlPdo();
  12. $sql = "select * from wp_user_task WHERE user_id = {$userId} ORDER BY id desc ";
  13. $res = $db->query($sql);
  14. return $res;
  15. }
  16. // @function 获取用户信息
  17. //
  18. // @param userId 用户编号
  19. // @return 用户任务信息
  20. public function getUserInfoByUserId($userId){
  21. return [
  22. 'baseInfo' => [
  23. 'age' => 29,
  24. 'sex' => '男',
  25. 'time' => date('Y-m-d H:i:s'),
  26. 'ulevel' => 2,
  27. 'place' => '长沙市岳麓区',
  28. 'weather' => '良好',
  29. ],
  30. 'physical' => [
  31. 'isLikeSports' => '是',
  32. 'isHypertension' => '否',
  33. 'isHeartAttack' => '是',
  34. 'isAgile' => '是',
  35. 'isHardBody' => '是',
  36. ]
  37. ];
  38. }
  39. // @function 获取任务信息
  40. //
  41. // @param id 任务编号
  42. // @return 任务信息
  43. public function getTaskInfoById($id){
  44. $db = new MysqlPdo();
  45. $sql = "select * from wp_task WHERE id = {$id} ";
  46. $res = $db->query($sql);
  47. return isset($res[0])?$res[0]:[];
  48. }
  49. }