You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

107 lines
3.0 KiB

2 years ago
package com.dsideal.FengHuang.Yp.Controller;
import com.alibaba.fastjson.JSONObject;
import com.dsideal.FengHuang.Interceptor.*;
import com.dsideal.FengHuang.LoginPerson.Model.LoginPersonModel;
import com.dsideal.FengHuang.Util.CommonUtil;
import com.dsideal.FengHuang.Util.IpUtil;
import com.dsideal.FengHuang.Yp.Model.YpModel;
import com.jfinal.aop.Before;
import com.jfinal.core.Controller;
import com.jfinal.ext.interceptor.GET;
import com.jfinal.ext.interceptor.POST;
2 years ago
import com.jfinal.kit.Kv;
2 years ago
import com.jfinal.plugin.activerecord.Page;
import com.jfinal.plugin.activerecord.Record;
import java.util.List;
public class YpController extends Controller {
YpModel model = new YpModel();
/**
*
* http://10.10.21.20:9000/FengHuang/yp/getCurrentTaskInfo
*
* @return
*/
@Before(GET.class)
public void getCurrentTaskInfo() {
Record record = model.getCurrentTaskInfo();
renderJson(record);
}
/**
*
* http://10.10.21.20:9000/FengHuang/yp/getTaskLimit?task_id=1
*/
@Before(GET.class)
@IsNumericInterface({"task_id"})
public void getTaskLimit(int task_id) {
List<Record> list = model.getTaskLimit(task_id);
renderJson(list);
}
/*
http://10.10.21.20:9000/FengHuang/yp/getTaskApplyCount?task_id=1
*/
@Before(GET.class)
@IsNumericInterface({"task_id"})
public void getTaskApplyCount(int task_id) {
List<Record> list = model.getTaskApplyCount(task_id);
renderJson(list);
}
2 years ago
/**
*
*/
@Before(POST.class)
@EmptyInterface({"task_name"})
public void addTask(String task_name) {
model.addTask(task_name);
Kv kv = Kv.by("success", true);
kv.set("message", "保存成功!");
renderJson(kv);
}
/**
*
*/
@Before(POST.class)
@IsNumericInterface({"task_id"})
@EmptyInterface({"task_name"})
public void updateTask(int task_id, String task_name) {
model.updateTask(task_id, task_name);
Kv kv = Kv.by("success", true);
kv.set("message", "保存成功!");
renderJson(kv);
}
/**
*
*
* @param task_id
*/
@Before(POST.class)
@IsNumericInterface({"task_id"})
public void delTask(int task_id) {
model.delTask(task_id);
Kv kv = Kv.by("success", true);
kv.set("message", "保存成功!");
renderJson(kv);
}
/**
*/
@Before(POST.class)
@IsNumericInterface({"task_id"})
public void startTask(int task_id) {
model.startTask(task_id);
Kv kv = Kv.by("success", true);
kv.set("message", "保存成功!");
renderJson(kv);
}
2 years ago
}