コード例 #1
0
ファイル: function.php プロジェクト: mracale/agent
function isTaskGet($tid)
{
    $where['tid'] = $tid;
    $where['uid'] = cookie("home_userid");
    $TasksGetModel = new \Common\Model\TasksGetModel();
    if ($TasksGetModel->where($where)->find()) {
        //已经领取
        return "已认领";
    } else {
        //未领取
        return "认领";
    }
}
コード例 #2
0
ファイル: MeController.class.php プロジェクト: mracale/agent
 public function tasks_get()
 {
     $TasksGetModel = new \Common\Model\TasksGetModel();
     $data['tid'] = isset($_POST['tid']) ? intval($_POST['tid']) : exit("参数有误");
     $data['uid'] = session("home_userid");
     //判断是否已领取
     if ($TasksGetModel->where($data)->find()) {
         exit("已领取");
     }
     $data['time'] = time();
     $data['status'] = 1;
     //默认状态
     if ($TasksGetModel->data($data)->add()) {
         exit("领取成功");
     } else {
         exit("领取失败");
     }
 }
コード例 #3
0
 public function task_get()
 {
     $where['tid'] = I('get.tid', 'intval');
     $TasksGetModel = new \Common\Model\TasksGetModel();
     $data = $TasksGetModel->where($where)->select();
     $this->assign('data', $data);
     $this->display();
 }
コード例 #4
0
 public function mytask()
 {
     $TasksGetModel = new \Common\Model\TasksGetModel();
     $where['w_tasks_get.uid'] = session('home_userid');
     $count = $TasksGetModel->where($where)->count();
     $size = 8;
     //每页显示条数
     $Page = new \Think\Page($count, $size);
     $pages = $Page->show();
     // 分页显示输出
     $list = $TasksGetModel->field('w_tasks.title,w_tasks_get.time,w_tasks.endtime')->join('w_tasks on w_tasks_get.tid=w_tasks.id')->where($where)->limit($Page->firstRow . ',' . $Page->listRows)->select();
     $this->assign("list", $list);
     $this->assign("count", $count);
     $this->assign("start", $Page->firstRow);
     $this->assign("end", $Page->firstRow + $size);
     $this->assign("pages", $pages);
     $this->display();
 }