12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /// @Brief 用户任务db
- ///
- class UserTaskDb implements IUserTaskDb
- {
- // @function 获取用户任务
- //
- // @param userId 用户编号
- // @return 用户任务列表
- public function getUserTaskByUserId($userId){
- $db = new MysqlPdo();
- $sql = "select * from wp_user_task WHERE user_id = {$userId} ORDER BY id desc ";
- $res = $db->query($sql);
- return $res;
- }
- // @function 获取用户信息
- //
- // @param userId 用户编号
- // @return 用户任务信息
- public function getUserInfoByUserId($userId){
- return [
- 'baseInfo' => [
- 'age' => 29,
- 'sex' => '男',
- 'time' => date('Y-m-d H:i:s'),
- 'ulevel' => 2,
- 'place' => '长沙市岳麓区',
- 'weather' => '良好',
- ],
- 'physical' => [
- 'isLikeSports' => '是',
- 'isHypertension' => '否',
- 'isHeartAttack' => '是',
- 'isAgile' => '是',
- 'isHardBody' => '是',
- ]
- ];
- }
- // @function 获取任务信息
- //
- // @param id 任务编号
- // @return 任务信息
- public function getTaskInfoById($id){
- $db = new MysqlPdo();
- $sql = "select * from wp_task WHERE id = {$id} ";
- $res = $db->query($sql);
- return isset($res[0])?$res[0]:[];
- }
- }
|